diff --git a/include/common/tmsg.h b/include/common/tmsg.h index d69849349c..820f0fbe8d 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -1494,9 +1494,9 @@ typedef struct { int32_t code; } STaskDropRsp; -#define STREAM_TRIGGER_AT_ONCE 1 -#define STREAM_TRIGGER_WINDOW_CLOSE 2 -#define STREAM_TRIGGER_MAX_DELAY 3 +#define STREAM_TRIGGER_AT_ONCE 1 +#define STREAM_TRIGGER_WINDOW_CLOSE 2 +#define STREAM_TRIGGER_MAX_DELAY 3 typedef struct { char name[TSDB_TABLE_FNAME_LEN]; @@ -1506,6 +1506,7 @@ typedef struct { char* sql; char* ast; int8_t triggerType; + int64_t maxDelay; int64_t watermark; } SCMCreateStreamReq; diff --git a/include/common/ttokendef.h b/include/common/ttokendef.h index 84e0527587..f5495db5ae 100644 --- a/include/common/ttokendef.h +++ b/include/common/ttokendef.h @@ -184,76 +184,77 @@ #define TK_TRIGGER 166 #define TK_AT_ONCE 167 #define TK_WINDOW_CLOSE 168 -#define TK_WATERMARK 169 -#define TK_KILL 170 -#define TK_CONNECTION 171 -#define TK_TRANSACTION 172 -#define TK_BALANCE 173 -#define TK_VGROUP 174 -#define TK_MERGE 175 -#define TK_REDISTRIBUTE 176 -#define TK_SPLIT 177 -#define TK_SYNCDB 178 -#define TK_DELETE 179 -#define TK_NULL 180 -#define TK_NK_QUESTION 181 -#define TK_NK_ARROW 182 -#define TK_ROWTS 183 -#define TK_TBNAME 184 -#define TK_QSTARTTS 185 -#define TK_QENDTS 186 -#define TK_WSTARTTS 187 -#define TK_WENDTS 188 -#define TK_WDURATION 189 -#define TK_CAST 190 -#define TK_NOW 191 -#define TK_TODAY 192 -#define TK_TIMEZONE 193 -#define TK_COUNT 194 -#define TK_FIRST 195 -#define TK_LAST 196 -#define TK_LAST_ROW 197 -#define TK_BETWEEN 198 -#define TK_IS 199 -#define TK_NK_LT 200 -#define TK_NK_GT 201 -#define TK_NK_LE 202 -#define TK_NK_GE 203 -#define TK_NK_NE 204 -#define TK_MATCH 205 -#define TK_NMATCH 206 -#define TK_CONTAINS 207 -#define TK_JOIN 208 -#define TK_INNER 209 -#define TK_SELECT 210 -#define TK_DISTINCT 211 -#define TK_WHERE 212 -#define TK_PARTITION 213 -#define TK_BY 214 -#define TK_SESSION 215 -#define TK_STATE_WINDOW 216 -#define TK_SLIDING 217 -#define TK_FILL 218 -#define TK_VALUE 219 -#define TK_NONE 220 -#define TK_PREV 221 -#define TK_LINEAR 222 -#define TK_NEXT 223 -#define TK_HAVING 224 -#define TK_ORDER 225 -#define TK_SLIMIT 226 -#define TK_SOFFSET 227 -#define TK_LIMIT 228 -#define TK_OFFSET 229 -#define TK_ASC 230 -#define TK_NULLS 231 -#define TK_ID 232 -#define TK_NK_BITNOT 233 -#define TK_INSERT 234 -#define TK_VALUES 235 -#define TK_IMPORT 236 -#define TK_NK_SEMI 237 -#define TK_FILE 238 +#define TK_MAX_DELAY 169 +#define TK_WATERMARK 170 +#define TK_KILL 171 +#define TK_CONNECTION 172 +#define TK_TRANSACTION 173 +#define TK_BALANCE 174 +#define TK_VGROUP 175 +#define TK_MERGE 176 +#define TK_REDISTRIBUTE 177 +#define TK_SPLIT 178 +#define TK_SYNCDB 179 +#define TK_DELETE 180 +#define TK_NULL 181 +#define TK_NK_QUESTION 182 +#define TK_NK_ARROW 183 +#define TK_ROWTS 184 +#define TK_TBNAME 185 +#define TK_QSTARTTS 186 +#define TK_QENDTS 187 +#define TK_WSTARTTS 188 +#define TK_WENDTS 189 +#define TK_WDURATION 190 +#define TK_CAST 191 +#define TK_NOW 192 +#define TK_TODAY 193 +#define TK_TIMEZONE 194 +#define TK_COUNT 195 +#define TK_FIRST 196 +#define TK_LAST 197 +#define TK_LAST_ROW 198 +#define TK_BETWEEN 199 +#define TK_IS 200 +#define TK_NK_LT 201 +#define TK_NK_GT 202 +#define TK_NK_LE 203 +#define TK_NK_GE 204 +#define TK_NK_NE 205 +#define TK_MATCH 206 +#define TK_NMATCH 207 +#define TK_CONTAINS 208 +#define TK_JOIN 209 +#define TK_INNER 210 +#define TK_SELECT 211 +#define TK_DISTINCT 212 +#define TK_WHERE 213 +#define TK_PARTITION 214 +#define TK_BY 215 +#define TK_SESSION 216 +#define TK_STATE_WINDOW 217 +#define TK_SLIDING 218 +#define TK_FILL 219 +#define TK_VALUE 220 +#define TK_NONE 221 +#define TK_PREV 222 +#define TK_LINEAR 223 +#define TK_NEXT 224 +#define TK_HAVING 225 +#define TK_ORDER 226 +#define TK_SLIMIT 227 +#define TK_SOFFSET 228 +#define TK_LIMIT 229 +#define TK_OFFSET 230 +#define TK_ASC 231 +#define TK_NULLS 232 +#define TK_ID 233 +#define TK_NK_BITNOT 234 +#define TK_INSERT 235 +#define TK_VALUES 236 +#define TK_IMPORT 237 +#define TK_NK_SEMI 238 +#define TK_FILE 239 #define TK_NK_SPACE 300 #define TK_NK_COMMENT 301 diff --git a/include/libs/function/functionMgt.h b/include/libs/function/functionMgt.h index e86d643c0d..7eca020371 100644 --- a/include/libs/function/functionMgt.h +++ b/include/libs/function/functionMgt.h @@ -175,6 +175,7 @@ bool fmIsRepeatScanFunc(int32_t funcId); bool fmIsUserDefinedFunc(int32_t funcId); bool fmIsDistExecFunc(int32_t funcId); bool fmIsForbidFillFunc(int32_t funcId); +bool fmIsForbidStreamFunc(int32_t funcId); int32_t fmGetDistMethod(const SFunctionNode* pFunc, SFunctionNode** pPartialFunc, SFunctionNode** pMergeFunc); diff --git a/include/libs/nodes/cmdnodes.h b/include/libs/nodes/cmdnodes.h index 25369f2342..8d4e94663f 100644 --- a/include/libs/nodes/cmdnodes.h +++ b/include/libs/nodes/cmdnodes.h @@ -289,6 +289,7 @@ typedef struct SKillStmt { typedef struct SStreamOptions { ENodeType type; int8_t triggerType; + SNode* pDelay; SNode* pWatermark; } SStreamOptions; diff --git a/include/libs/nodes/nodes.h b/include/libs/nodes/nodes.h index 7df731b95c..3937fc13f4 100644 --- a/include/libs/nodes/nodes.h +++ b/include/libs/nodes/nodes.h @@ -252,22 +252,20 @@ typedef struct SNodeList { SListCell* pTail; } SNodeList; -#define SNodeptr void* - -SNodeptr nodesMakeNode(ENodeType type); -void nodesDestroyNode(SNodeptr pNode); +SNode* nodesMakeNode(ENodeType type); +void nodesDestroyNode(SNode* pNode); SNodeList* nodesMakeList(); -int32_t nodesListAppend(SNodeList* pList, SNodeptr pNode); -int32_t nodesListStrictAppend(SNodeList* pList, SNodeptr pNode); -int32_t nodesListMakeAppend(SNodeList** pList, SNodeptr pNode); -int32_t nodesListMakeStrictAppend(SNodeList** pList, SNodeptr pNode); +int32_t nodesListAppend(SNodeList* pList, SNode* pNode); +int32_t nodesListStrictAppend(SNodeList* pList, SNode* pNode); +int32_t nodesListMakeAppend(SNodeList** pList, SNode* pNode); +int32_t nodesListMakeStrictAppend(SNodeList** pList, SNode* pNode); int32_t nodesListAppendList(SNodeList* pTarget, SNodeList* pSrc); int32_t nodesListStrictAppendList(SNodeList* pTarget, SNodeList* pSrc); -int32_t nodesListPushFront(SNodeList* pList, SNodeptr pNode); +int32_t nodesListPushFront(SNodeList* pList, SNode* pNode); SListCell* nodesListErase(SNodeList* pList, SListCell* pCell); void nodesListInsertList(SNodeList* pTarget, SListCell* pPos, SNodeList* pSrc); -SNodeptr nodesListGetNode(SNodeList* pList, int32_t index); +SNode* nodesListGetNode(SNodeList* pList, int32_t index); void nodesDestroyList(SNodeList* pList); // Only clear the linked list structure, without releasing the elements inside void nodesClearList(SNodeList* pList); @@ -275,9 +273,9 @@ void nodesClearList(SNodeList* pList); typedef enum EDealRes { DEAL_RES_CONTINUE = 1, DEAL_RES_IGNORE_CHILD, DEAL_RES_ERROR, DEAL_RES_END } EDealRes; typedef EDealRes (*FNodeWalker)(SNode* pNode, void* pContext); -void nodesWalkExpr(SNodeptr pNode, FNodeWalker walker, void* pContext); +void nodesWalkExpr(SNode* pNode, FNodeWalker walker, void* pContext); void nodesWalkExprs(SNodeList* pList, FNodeWalker walker, void* pContext); -void nodesWalkExprPostOrder(SNodeptr pNode, FNodeWalker walker, void* pContext); +void nodesWalkExprPostOrder(SNode* pNode, FNodeWalker walker, void* pContext); void nodesWalkExprsPostOrder(SNodeList* pList, FNodeWalker walker, void* pContext); typedef EDealRes (*FNodeRewriter)(SNode** pNode, void* pContext); @@ -286,13 +284,13 @@ void nodesRewriteExprs(SNodeList* pList, FNodeRewriter rewriter, void* pContext) void nodesRewriteExprPostOrder(SNode** pNode, FNodeRewriter rewriter, void* pContext); void nodesRewriteExprsPostOrder(SNodeList* pList, FNodeRewriter rewriter, void* pContext); -bool nodesEqualNode(const SNodeptr a, const SNodeptr b); +bool nodesEqualNode(const SNode* a, const SNode* b); -SNodeptr nodesCloneNode(const SNodeptr pNode); +SNode* nodesCloneNode(const SNode* pNode); SNodeList* nodesCloneList(const SNodeList* pList); const char* nodesNodeName(ENodeType type); -int32_t nodesNodeToString(const SNodeptr pNode, bool format, char** pStr, int32_t* pLen); +int32_t nodesNodeToString(const SNode* pNode, bool format, char** pStr, int32_t* pLen); int32_t nodesStringToNode(const char* pStr, SNode** pNode); int32_t nodesListToString(const SNodeList* pList, bool format, char** pStr, int32_t* pLen); diff --git a/include/libs/nodes/querynodes.h b/include/libs/nodes/querynodes.h index 33cc4a9c86..3957f3b755 100644 --- a/include/libs/nodes/querynodes.h +++ b/include/libs/nodes/querynodes.h @@ -336,22 +336,21 @@ typedef enum EQueryExecMode { } EQueryExecMode; typedef struct SQuery { - ENodeType type; - EQueryExecMode execMode; - bool haveResultSet; - SNode* pRoot; - int32_t numOfResCols; - SSchema* pResSchema; - int8_t precision; - SCmdMsgInfo* pCmdMsg; - int32_t msgType; - SArray* pTableList; - SArray* pDbList; - bool showRewrite; - int32_t placeholderNum; - SArray* pPlaceholderValues; - SNode* pPrepareRoot; - struct SParseMetaCache* pMetaCache; + ENodeType type; + EQueryExecMode execMode; + bool haveResultSet; + SNode* pRoot; + int32_t numOfResCols; + SSchema* pResSchema; + int8_t precision; + SCmdMsgInfo* pCmdMsg; + int32_t msgType; + SArray* pTableList; + SArray* pDbList; + bool showRewrite; + int32_t placeholderNum; + SArray* pPlaceholderValues; + SNode* pPrepareRoot; } SQuery; void nodesWalkSelectStmt(SSelectStmt* pSelect, ESqlClause clause, FNodeWalker walker, void* pContext); diff --git a/source/client/src/clientHb.c b/source/client/src/clientHb.c index 9df0e0c1c8..2412b32df2 100644 --- a/source/client/src/clientHb.c +++ b/source/client/src/clientHb.c @@ -698,7 +698,7 @@ SAppHbMgr *appHbMgrInit(SAppInstInfo *pAppInstInfo, char *key) { return NULL; } - taosHashSetFreeFp(pAppHbMgr->activeInfo, tFreeClientHbReq); + // taosHashSetFreeFp(pAppHbMgr->activeInfo, tFreeClientHbReq); taosThreadMutexLock(&clientHbMgr.lock); taosArrayPush(clientHbMgr.appHbMgrs, &pAppHbMgr); diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index 216aa5fbd0..93234a3e80 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -233,9 +233,7 @@ int32_t execDdlQuery(SRequestObj* pRequest, SQuery* pQuery) { return TSDB_CODE_SUCCESS; } -static SAppInstInfo* getAppInfo(SRequestObj* pRequest) { - return pRequest->pTscObj->pAppInfo; -} +static SAppInstInfo* getAppInfo(SRequestObj* pRequest) { return pRequest->pTscObj->pAppInfo; } void asyncExecLocalCmd(SRequestObj* pRequest, SQuery* pQuery) { SRetrieveTableRsp* pRsp = NULL; @@ -259,7 +257,7 @@ void asyncExecLocalCmd(SRequestObj* pRequest, SQuery* pQuery) { } pRequest->body.queryFp(pRequest->body.param, pRequest, 0); -// pRequest->body.fetchFp(pRequest->body.param, pRequest, pResultInfo->numOfRows); + // pRequest->body.fetchFp(pRequest->body.param, pRequest, pResultInfo->numOfRows); } int32_t asyncExecDdlQuery(SRequestObj* pRequest, SQuery* pQuery) { @@ -323,7 +321,7 @@ int32_t getQnodeList(SRequestObj* pRequest, SArray** pNodeList) { code = catalogGetHandle(pRequest->pTscObj->pAppInfo->clusterId, &pCatalog); if (TSDB_CODE_SUCCESS == code) { *pNodeList = taosArrayInit(5, sizeof(SQueryNodeLoad)); - SRequestConnInfo conn = {.pTrans = pRequest->pTscObj->pAppInfo->pTransporter, + SRequestConnInfo conn = {.pTrans = pRequest->pTscObj->pAppInfo->pTransporter, .requestId = pRequest->requestId, .requestObjRefId = pRequest->self, .mgmtEps = getEpSet_s(&pRequest->pTscObj->pAppInfo->mgmtEp)}; @@ -401,21 +399,19 @@ void setResPrecision(SReqResultInfo* pResInfo, int32_t precision) { int32_t scheduleAsyncQuery(SRequestObj* pRequest, SQueryPlan* pDag, SArray* pNodeList) { tsem_init(&schdRspSem, 0, 0); - SQueryResult res = {.code = 0, .numOfRows = 0}; - SRequestConnInfo conn = {.pTrans = pRequest->pTscObj->pAppInfo->pTransporter, + SQueryResult res = {.code = 0, .numOfRows = 0}; + SRequestConnInfo conn = {.pTrans = pRequest->pTscObj->pAppInfo->pTransporter, .requestId = pRequest->requestId, - .requestObjRefId = pRequest->self - }; - SSchedulerReq req = {.pConn = &conn, - .pNodeList = pNodeList, - .pDag = pDag, - .sql = pRequest->sqlstr, - .startTs = pRequest->metric.start, - .fp = schdExecCallback, - .cbParam = &res - }; - - int32_t code = schedulerAsyncExecJob(&req, &pRequest->body.queryJob); + .requestObjRefId = pRequest->self}; + SSchedulerReq req = {.pConn = &conn, + .pNodeList = pNodeList, + .pDag = pDag, + .sql = pRequest->sqlstr, + .startTs = pRequest->metric.start, + .fp = schdExecCallback, + .cbParam = &res}; + + int32_t code = schedulerAsyncExecJob(&req, &pRequest->body.queryJob); pRequest->body.resInfo.execRes = res.res; @@ -455,21 +451,19 @@ int32_t scheduleAsyncQuery(SRequestObj* pRequest, SQueryPlan* pDag, SArray* pNod int32_t scheduleQuery(SRequestObj* pRequest, SQueryPlan* pDag, SArray* pNodeList) { void* pTransporter = pRequest->pTscObj->pAppInfo->pTransporter; - SQueryResult res = {0}; - SRequestConnInfo conn = {.pTrans = pRequest->pTscObj->pAppInfo->pTransporter, + SQueryResult res = {0}; + SRequestConnInfo conn = {.pTrans = pRequest->pTscObj->pAppInfo->pTransporter, .requestId = pRequest->requestId, - .requestObjRefId = pRequest->self - }; - SSchedulerReq req = {.pConn = &conn, - .pNodeList = pNodeList, - .pDag = pDag, - .sql = pRequest->sqlstr, - .startTs = pRequest->metric.start, - .fp = NULL, - .cbParam = NULL - }; - - int32_t code = schedulerExecJob(&req,&pRequest->body.queryJob, &res); + .requestObjRefId = pRequest->self}; + SSchedulerReq req = {.pConn = &conn, + .pNodeList = pNodeList, + .pDag = pDag, + .sql = pRequest->sqlstr, + .startTs = pRequest->metric.start, + .fp = NULL, + .cbParam = NULL}; + + int32_t code = schedulerExecJob(&req, &pRequest->body.queryJob, &res); pRequest->body.resInfo.execRes = res.res; if (code != TSDB_CODE_SUCCESS) { @@ -482,7 +476,8 @@ int32_t scheduleQuery(SRequestObj* pRequest, SQueryPlan* pDag, SArray* pNodeList return pRequest->code; } - if (TDMT_VND_SUBMIT == pRequest->type || TDMT_VND_DELETE == pRequest->type || TDMT_VND_CREATE_TABLE == pRequest->type) { + if (TDMT_VND_SUBMIT == pRequest->type || TDMT_VND_DELETE == pRequest->type || + TDMT_VND_CREATE_TABLE == pRequest->type) { pRequest->body.resInfo.numOfRows = res.numOfRows; if (pRequest->body.queryJob != 0) { @@ -495,9 +490,9 @@ int32_t scheduleQuery(SRequestObj* pRequest, SQueryPlan* pDag, SArray* pNodeList return pRequest->code; } -int32_t handleSubmitExecRes(SRequestObj* pRequest, void* res, SCatalog* pCatalog, SEpSet *epset) { - int32_t code = 0; - SArray* pArray = NULL; +int32_t handleSubmitExecRes(SRequestObj* pRequest, void* res, SCatalog* pCatalog, SEpSet* epset) { + int32_t code = 0; + SArray* pArray = NULL; SSubmitRsp* pRsp = (SSubmitRsp*)res; if (pRsp->nBlocks <= 0) { return TSDB_CODE_SUCCESS; @@ -519,7 +514,7 @@ int32_t handleSubmitExecRes(SRequestObj* pRequest, void* res, SCatalog* pCatalog taosArrayPush(pArray, &tbSver); } - SRequestConnInfo conn = {.pTrans = pRequest->pTscObj->pAppInfo->pTransporter, + SRequestConnInfo conn = {.pTrans = pRequest->pTscObj->pAppInfo->pTransporter, .requestId = pRequest->requestId, .requestObjRefId = pRequest->self, .mgmtEps = *epset}; @@ -532,7 +527,7 @@ _return: return code; } -int32_t handleQueryExecRes(SRequestObj* pRequest, void* res, SCatalog* pCatalog, SEpSet *epset) { +int32_t handleQueryExecRes(SRequestObj* pRequest, void* res, SCatalog* pCatalog, SEpSet* epset) { int32_t code = 0; SArray* pArray = NULL; SArray* pTbArray = (SArray*)res; @@ -553,7 +548,7 @@ int32_t handleQueryExecRes(SRequestObj* pRequest, void* res, SCatalog* pCatalog, taosArrayPush(pArray, &tbSver); } - SRequestConnInfo conn = {.pTrans = pRequest->pTscObj->pAppInfo->pTransporter, + SRequestConnInfo conn = {.pTrans = pRequest->pTscObj->pAppInfo->pTransporter, .requestId = pRequest->requestId, .requestObjRefId = pRequest->self, .mgmtEps = *epset}; @@ -575,15 +570,15 @@ int32_t handleQueryExecRsp(SRequestObj* pRequest) { return TSDB_CODE_SUCCESS; } - SCatalog* pCatalog = NULL; - SAppInstInfo* pAppInfo = getAppInfo(pRequest); + SCatalog* pCatalog = NULL; + SAppInstInfo* pAppInfo = getAppInfo(pRequest); int32_t code = catalogGetHandle(pAppInfo->clusterId, &pCatalog); if (code) { return code; } - SEpSet epset = getEpSet_s(&pAppInfo->mgmtEp); + SEpSet epset = getEpSet_s(&pAppInfo->mgmtEp); SQueryExecRes* pRes = &pRequest->body.resInfo.execRes; switch (pRes->msgType) { @@ -601,8 +596,8 @@ int32_t handleQueryExecRsp(SRequestObj* pRequest) { break; } default: - tscError("0x%"PRIx64", invalid exec result for request type %d, reqId:0x%"PRIx64, pRequest->self, - pRequest->type, pRequest->requestId); + tscError("0x%" PRIx64 ", invalid exec result for request type %d, reqId:0x%" PRIx64, pRequest->self, + pRequest->type, pRequest->requestId); code = TSDB_CODE_APP_ERROR; } @@ -610,13 +605,13 @@ int32_t handleQueryExecRsp(SRequestObj* pRequest) { } void schedulerExecCb(SQueryResult* pResult, void* param, int32_t code) { - SRequestObj* pRequest = (SRequestObj*) param; + SRequestObj* pRequest = (SRequestObj*)param; pRequest->code = code; STscObj* pTscObj = pRequest->pTscObj; if (code != TSDB_CODE_SUCCESS && NEED_CLIENT_HANDLE_ERROR(code)) { - tscDebug("0x%"PRIx64" client retry to handle the error, code:%d - %s, tryCount:%d, reqId:0x%"PRIx64, pRequest->self, code, tstrerror(code), - pRequest->retry, pRequest->requestId); + tscDebug("0x%" PRIx64 " client retry to handle the error, code:%d - %s, tryCount:%d, reqId:0x%" PRIx64, + pRequest->self, code, tstrerror(code), pRequest->retry, pRequest->requestId); pRequest->prevCode = code; doAsyncQuery(pRequest, true); return; @@ -624,7 +619,7 @@ void schedulerExecCb(SQueryResult* pResult, void* param, int32_t code) { if (code == TSDB_CODE_SUCCESS) { code = handleQueryExecRsp(pRequest); - ASSERT(pRequest->code == TSDB_CODE_SUCCESS); + ASSERT(pRequest->code == TSDB_CODE_SUCCESS); pRequest->code = code; } @@ -727,35 +722,34 @@ void launchAsyncQuery(SRequestObj* pRequest, SQuery* pQuery) { if (TSDB_CODE_SUCCESS == code) { code = qCreateQueryPlan(&cxt, &pRequest->body.pDag, pNodeList); if (code) { - tscError("0x%"PRIx64" failed to create query plan, code:%s 0x%"PRIx64, pRequest->self, tstrerror(code), pRequest->requestId); + tscError("0x%" PRIx64 " failed to create query plan, code:%s 0x%" PRIx64, pRequest->self, tstrerror(code), + pRequest->requestId); } } if (TSDB_CODE_SUCCESS == code) { - SRequestConnInfo conn = {.pTrans = pAppInfo->pTransporter, - .requestId = pRequest->requestId, - .requestObjRefId = pRequest->self - }; + SRequestConnInfo conn = { + .pTrans = pAppInfo->pTransporter, .requestId = pRequest->requestId, .requestObjRefId = pRequest->self}; SSchedulerReq req = {.pConn = &conn, .pNodeList = pNodeList, .pDag = pRequest->body.pDag, .sql = pRequest->sqlstr, .startTs = pRequest->metric.start, .fp = schedulerExecCb, - .cbParam = pRequest - }; + .cbParam = pRequest}; code = schedulerAsyncExecJob(&req, &pRequest->body.queryJob); } else { - tscError("0x%"PRIx64" failed to create query plan, code:%s 0x%"PRIx64, pRequest->self, tstrerror(code), pRequest->requestId); + tscError("0x%" PRIx64 " failed to create query plan, code:%s 0x%" PRIx64, pRequest->self, tstrerror(code), + pRequest->requestId); pRequest->body.queryFp(pRequest->body.param, pRequest, code); } - //todo not to be released here + // todo not to be released here taosArrayDestroy(pNodeList); break; } case QUERY_EXEC_MODE_EMPTY_RESULT: - pRequest->type = TSDB_SQL_RETRIEVE_EMPTY_RESULT; + pRequest->type = TSDB_SQL_RETRIEVE_EMPTY_RESULT; pRequest->body.queryFp(pRequest->body.param, pRequest, 0); break; default: @@ -786,7 +780,7 @@ int32_t refreshMeta(STscObj* pTscObj, SRequestObj* pRequest) { return code; } - SRequestConnInfo conn = {.pTrans = pTscObj->pAppInfo->pTransporter, + SRequestConnInfo conn = {.pTrans = pTscObj->pAppInfo->pTransporter, .requestId = pRequest->requestId, .requestObjRefId = pRequest->self, .mgmtEps = getEpSet_s(&pTscObj->pAppInfo->mgmtEp)}; @@ -989,23 +983,22 @@ void updateTargetEpSet(SMsgSendInfo* pSendInfo, STscObj* pTscObj, SRpcMsg* pMsg, switch (pSendInfo->target.type) { case TARGET_TYPE_MNODE: if (NULL == pTscObj) { - tscError("mnode epset changed but not able to update it, msg:%s, reqObjRefId:%" PRIx64, - TMSG_INFO(pMsg->msgType), pSendInfo->requestObjRefId); + tscError("mnode epset changed but not able to update it, msg:%s, reqObjRefId:%" PRIx64, + TMSG_INFO(pMsg->msgType), pSendInfo->requestObjRefId); return; } SEpSet* pOrig = &pTscObj->pAppInfo->mgmtEp.epSet; - SEp* pOrigEp = &pOrig->eps[pOrig->inUse]; - SEp* pNewEp = &pEpSet->eps[pEpSet->inUse]; - tscDebug("mnode epset updated from %d/%d=>%s:%d to %d/%d=>%s:%d in client", - pOrig->inUse, pOrig->numOfEps, pOrigEp->fqdn, pOrigEp->port, - pEpSet->inUse, pEpSet->numOfEps, pNewEp->fqdn, pNewEp->port); + SEp* pOrigEp = &pOrig->eps[pOrig->inUse]; + SEp* pNewEp = &pEpSet->eps[pEpSet->inUse]; + tscDebug("mnode epset updated from %d/%d=>%s:%d to %d/%d=>%s:%d in client", pOrig->inUse, pOrig->numOfEps, + pOrigEp->fqdn, pOrigEp->port, pEpSet->inUse, pEpSet->numOfEps, pNewEp->fqdn, pNewEp->port); updateEpSet_s(&pTscObj->pAppInfo->mgmtEp, pEpSet); break; case TARGET_TYPE_VNODE: { if (NULL == pTscObj) { - tscError("vnode epset changed but not able to update it, msg:%s, reqObjRefId:%" PRIx64, - TMSG_INFO(pMsg->msgType), pSendInfo->requestObjRefId); + tscError("vnode epset changed but not able to update it, msg:%s, reqObjRefId:%" PRIx64, + TMSG_INFO(pMsg->msgType), pSendInfo->requestObjRefId); return; } @@ -1415,14 +1408,14 @@ int32_t setResultDataPtr(SReqResultInfo* pResultInfo, TAOS_FIELD* pFields, int32 p += sizeof(uint64_t); // check fields - for(int32_t i = 0; i < numOfCols; ++i) { - int16_t type = *(int16_t*) p; + for (int32_t i = 0; i < numOfCols; ++i) { + int16_t type = *(int16_t*)p; p += sizeof(int16_t); - int32_t bytes = *(int32_t*) p; + int32_t bytes = *(int32_t*)p; p += sizeof(int32_t); -// ASSERT(type == pFields[i].type && bytes == pFields[i].bytes); + // ASSERT(type == pFields[i].type && bytes == pFields[i].bytes); } int32_t* colLength = (int32_t*)p; diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c index e3fafa0a82..83b481658e 100644 --- a/source/client/src/clientMain.c +++ b/source/client/src/clientMain.c @@ -30,7 +30,7 @@ #define TSC_VAR_RELEASED 0 static int32_t sentinel = TSC_VAR_NOT_RELEASE; -static int32_t createParseContext(const SRequestObj *pRequest, SParseContext** pCxt); +static int32_t createParseContext(const SRequestObj *pRequest, SParseContext **pCxt); int taos_options(TSDB_OPTION option, const void *arg, ...) { static int32_t lock = 0; @@ -177,8 +177,8 @@ TAOS_FIELD *taos_fetch_fields(TAOS_RES *res) { return pResInfo->userFields; } -static void syncQueryFn(void* param, void* res, int32_t code) { - SSyncQueryParam* pParam = param; +static void syncQueryFn(void *param, void *res, int32_t code) { + SSyncQueryParam *pParam = param; pParam->pRequest = res; pParam->pRequest->code = code; @@ -190,10 +190,10 @@ TAOS_RES *taos_query(TAOS *taos, const char *sql) { return NULL; } - STscObj* pTscObj = (STscObj*)taos; + STscObj *pTscObj = (STscObj *)taos; #if SYNC_ON_TOP_OF_ASYNC - SSyncQueryParam* param = taosMemoryCalloc(1, sizeof(SSyncQueryParam)); + SSyncQueryParam *param = taosMemoryCalloc(1, sizeof(SSyncQueryParam)); tsem_init(¶m->sem, 0, 0); taos_query_a(pTscObj, sql, syncQueryFn, param); @@ -606,16 +606,30 @@ const char *taos_get_server_info(TAOS *taos) { } typedef struct SqlParseWrapper { - SParseContext* pCtx; + SParseContext *pCtx; SCatalogReq catalogReq; - SRequestObj* pRequest; - SQuery* pQuery; + SRequestObj *pRequest; + SQuery *pQuery; } SqlParseWrapper; -void retrieveMetaCallback(SMetaData* pResultMeta, void* param, int32_t code) { - SqlParseWrapper *pWrapper = (SqlParseWrapper*) param; - SQuery* pQuery = pWrapper->pQuery; - SRequestObj* pRequest = pWrapper->pRequest; +static void destorySqlParseWrapper(SqlParseWrapper *pWrapper) { + taosArrayDestroy(pWrapper->catalogReq.pDbVgroup); + taosArrayDestroy(pWrapper->catalogReq.pDbCfg); + taosArrayDestroy(pWrapper->catalogReq.pDbInfo); + taosArrayDestroy(pWrapper->catalogReq.pTableMeta); + taosArrayDestroy(pWrapper->catalogReq.pTableHash); + taosArrayDestroy(pWrapper->catalogReq.pUdf); + taosArrayDestroy(pWrapper->catalogReq.pIndex); + taosArrayDestroy(pWrapper->catalogReq.pUser); + taosArrayDestroy(pWrapper->catalogReq.pTableIndex); + taosMemoryFree(pWrapper->pCtx); + taosMemoryFree(pWrapper); +} + +void retrieveMetaCallback(SMetaData *pResultMeta, void *param, int32_t code) { + SqlParseWrapper *pWrapper = (SqlParseWrapper *)param; + SQuery *pQuery = pWrapper->pQuery; + SRequestObj *pRequest = pWrapper->pRequest; if (code == TSDB_CODE_SUCCESS) { code = qAnalyseSqlSemantic(pWrapper->pCtx, &pWrapper->catalogReq, pResultMeta, pQuery); @@ -630,22 +644,22 @@ void retrieveMetaCallback(SMetaData* pResultMeta, void* param, int32_t code) { TSWAP(pRequest->dbList, (pQuery)->pDbList); TSWAP(pRequest->tableList, (pQuery)->pTableList); - taosMemoryFree(pWrapper); + destorySqlParseWrapper(pWrapper); launchAsyncQuery(pRequest, pQuery); } else { + destorySqlParseWrapper(pWrapper); tscDebug("error happens, code:%d", code); if (NEED_CLIENT_HANDLE_ERROR(code)) { - tscDebug("0x%"PRIx64" client retry to handle the error, code:%d - %s, tryCount:%d, reqId:0x%"PRIx64, pRequest->self, code, tstrerror(code), - pRequest->retry, pRequest->requestId); + tscDebug("0x%" PRIx64 " client retry to handle the error, code:%d - %s, tryCount:%d, reqId:0x%" PRIx64, + pRequest->self, code, tstrerror(code), pRequest->retry, pRequest->requestId); pRequest->prevCode = code; doAsyncQuery(pRequest, true); return; } // return to app directly - taosMemoryFree(pWrapper); - tscError("0x%" PRIx64 " error occurs, code:%s, return to user app, reqId:0x%" PRIx64, pRequest->self, tstrerror(code), - pRequest->requestId); + tscError("0x%" PRIx64 " error occurs, code:%s, return to user app, reqId:0x%" PRIx64, pRequest->self, + tstrerror(code), pRequest->requestId); pRequest->code = code; pRequest->body.queryFp(pRequest->body.param, pRequest, code); } @@ -670,7 +684,7 @@ void taos_query_a(TAOS *taos, const char *sql, __taos_async_fn_t fp, void *param } SRequestObj *pRequest = NULL; - int32_t code = buildRequest(taos, sql, sqlLen, &pRequest); + int32_t code = buildRequest(taos, sql, sqlLen, &pRequest); if (code != TSDB_CODE_SUCCESS) { terrno = code; fp(param, NULL, terrno); @@ -678,11 +692,11 @@ void taos_query_a(TAOS *taos, const char *sql, __taos_async_fn_t fp, void *param } pRequest->body.queryFp = fp; - pRequest->body.param = param; + pRequest->body.param = param; doAsyncQuery(pRequest, false); } -int32_t createParseContext(const SRequestObj *pRequest, SParseContext** pCxt) { +int32_t createParseContext(const SRequestObj *pRequest, SParseContext **pCxt) { const STscObj *pTscObj = pRequest->pTscObj; *pCxt = taosMemoryCalloc(1, sizeof(SParseContext)); @@ -690,28 +704,30 @@ int32_t createParseContext(const SRequestObj *pRequest, SParseContext** pCxt) { return TSDB_CODE_OUT_OF_MEMORY; } - **pCxt = (SParseContext){.requestId = pRequest->requestId, - .requestRid = pRequest->self, - .acctId = pTscObj->acctId, - .db = pRequest->pDb, - .topicQuery = false, - .pSql = pRequest->sqlstr, - .sqlLen = pRequest->sqlLen, - .pMsg = pRequest->msgBuf, - .msgLen = ERROR_MSG_BUF_DEFAULT_SIZE, - .pTransporter = pTscObj->pAppInfo->pTransporter, - .pStmtCb = NULL, - .pUser = pTscObj->user, - .schemalessType = pTscObj->schemalessType, - .isSuperUser = (0 == strcmp(pTscObj->user, TSDB_DEFAULT_USER)), - .async = true,}; + **pCxt = (SParseContext){ + .requestId = pRequest->requestId, + .requestRid = pRequest->self, + .acctId = pTscObj->acctId, + .db = pRequest->pDb, + .topicQuery = false, + .pSql = pRequest->sqlstr, + .sqlLen = pRequest->sqlLen, + .pMsg = pRequest->msgBuf, + .msgLen = ERROR_MSG_BUF_DEFAULT_SIZE, + .pTransporter = pTscObj->pAppInfo->pTransporter, + .pStmtCb = NULL, + .pUser = pTscObj->user, + .schemalessType = pTscObj->schemalessType, + .isSuperUser = (0 == strcmp(pTscObj->user, TSDB_DEFAULT_USER)), + .async = true, + }; return TSDB_CODE_SUCCESS; } -void doAsyncQuery(SRequestObj* pRequest, bool updateMetaForce) { - SParseContext* pCxt = NULL; - STscObj *pTscObj = pRequest->pTscObj; - int32_t code = 0; +void doAsyncQuery(SRequestObj *pRequest, bool updateMetaForce) { + SParseContext *pCxt = NULL; + STscObj *pTscObj = pRequest->pTscObj; + int32_t code = 0; if (pRequest->retry++ > REQUEST_TOTAL_EXEC_TIMES) { code = pRequest->prevCode; @@ -748,28 +764,29 @@ void doAsyncQuery(SRequestObj* pRequest, bool updateMetaForce) { pWrapper->pRequest = pRequest; pWrapper->catalogReq = catalogReq; - SRequestConnInfo conn = {.pTrans = pCxt->pTransporter, + SRequestConnInfo conn = {.pTrans = pCxt->pTransporter, .requestId = pCxt->requestId, .requestObjRefId = pCxt->requestRid, .mgmtEps = pCxt->mgmtEpSet}; - code = catalogAsyncGetAllMeta(pCxt->pCatalog, &conn, pRequest->requestId, - &catalogReq, retrieveMetaCallback, pWrapper, &pRequest->body.queryJob); + code = catalogAsyncGetAllMeta(pCxt->pCatalog, &conn, pRequest->requestId, &catalogReq, retrieveMetaCallback, pWrapper, + &pRequest->body.queryJob); if (code == TSDB_CODE_SUCCESS) { return; } - _error: - tscError("0x%"PRIx64" error happens, code:%d - %s, reqId:0x%"PRIx64, pRequest->self, code, tstrerror(code), pRequest->requestId); +_error: + tscError("0x%" PRIx64 " error happens, code:%d - %s, reqId:0x%" PRIx64, pRequest->self, code, tstrerror(code), + pRequest->requestId); terrno = code; pRequest->code = code; pRequest->body.queryFp(pRequest->body.param, pRequest, code); } -static void fetchCallback(void* pResult, void* param, int32_t code) { - SRequestObj* pRequest = (SRequestObj*) param; +static void fetchCallback(void *pResult, void *param, int32_t code) { + SRequestObj *pRequest = (SRequestObj *)param; - SReqResultInfo* pResultInfo = &pRequest->body.resInfo; + SReqResultInfo *pResultInfo = &pRequest->body.resInfo; pResultInfo->pData = pResult; pResultInfo->numOfRows = 0; @@ -785,7 +802,8 @@ static void fetchCallback(void* pResult, void* param, int32_t code) { return; } - pRequest->code = setQueryResultFromRsp(pResultInfo, (SRetrieveTableRsp*)pResultInfo->pData, pResultInfo->convertUcs4, false); + pRequest->code = + setQueryResultFromRsp(pResultInfo, (SRetrieveTableRsp *)pResultInfo->pData, pResultInfo->convertUcs4, false); if (pRequest->code != TSDB_CODE_SUCCESS) { pResultInfo->numOfRows = 0; pRequest->code = code; @@ -801,7 +819,7 @@ static void fetchCallback(void* pResult, void* param, int32_t code) { } void taos_fetch_rows_a(TAOS_RES *res, __taos_async_fn_t fp, void *param) { - ASSERT (res != NULL && fp != NULL); + ASSERT(res != NULL && fp != NULL); SRequestObj *pRequest = res; pRequest->body.fetchFp = fp; @@ -825,7 +843,7 @@ void taos_fetch_rows_a(TAOS_RES *res, __taos_async_fn_t fp, void *param) { schedulerAsyncFetchRows(pRequest->body.queryJob, fetchCallback, pRequest); } -void taos_fetch_raw_block_a(TAOS_RES* res, __taos_async_fn_t fp, void* param) { +void taos_fetch_raw_block_a(TAOS_RES *res, __taos_async_fn_t fp, void *param) { ASSERT(res != NULL && fp != NULL); SRequestObj *pRequest = res; @@ -838,9 +856,9 @@ void taos_fetch_raw_block_a(TAOS_RES* res, __taos_async_fn_t fp, void* param) { taos_fetch_rows_a(res, fp, param); } -const void* taos_get_raw_block(TAOS_RES* res) { +const void *taos_get_raw_block(TAOS_RES *res) { ASSERT(res != NULL); - SRequestObj* pRequest = res; + SRequestObj *pRequest = res; return pRequest->body.resInfo.pData; } @@ -924,26 +942,25 @@ int taos_stmt_set_tags(TAOS_STMT *stmt, TAOS_MULTI_BIND *tags) { return stmtSetTbTags(stmt, tags); } - int taos_stmt_set_sub_tbname(TAOS_STMT *stmt, const char *name) { return taos_stmt_set_tbname(stmt, name); } -int taos_stmt_get_tag_fields(TAOS_STMT *stmt, int* fieldNum, TAOS_FIELD_E** fields) { +int taos_stmt_get_tag_fields(TAOS_STMT *stmt, int *fieldNum, TAOS_FIELD_E **fields) { if (stmt == NULL || NULL == fieldNum) { tscError("NULL parameter for %s", __FUNCTION__); terrno = TSDB_CODE_INVALID_PARA; return terrno; } - + return stmtGetTagFields(stmt, fieldNum, fields); } -int taos_stmt_get_col_fields(TAOS_STMT *stmt, int* fieldNum, TAOS_FIELD_E** fields) { +int taos_stmt_get_col_fields(TAOS_STMT *stmt, int *fieldNum, TAOS_FIELD_E **fields) { if (stmt == NULL || NULL == fieldNum) { tscError("NULL parameter for %s", __FUNCTION__); terrno = TSDB_CODE_INVALID_PARA; return terrno; } - + return stmtGetColFields(stmt, fieldNum, fields); } @@ -1102,4 +1119,3 @@ int taos_stmt_close(TAOS_STMT *stmt) { return stmtClose(stmt); } - diff --git a/source/client/src/clientSml.c b/source/client/src/clientSml.c index 8c5645e5b6..cf1d5b7828 100644 --- a/source/client/src/clientSml.c +++ b/source/client/src/clientSml.c @@ -3,22 +3,22 @@ #include #include +#include "cJSON.h" +#include "catalog.h" +#include "clientInt.h" +#include "osSemaphore.h" +#include "osThread.h" #include "query.h" #include "taos.h" #include "taoserror.h" +#include "tcommon.h" #include "tdef.h" +#include "tglobal.h" #include "tlog.h" #include "tmsg.h" +#include "tname.h" #include "ttime.h" #include "ttypes.h" -#include "tcommon.h" -#include "catalog.h" -#include "clientInt.h" -#include "tname.h" -#include "cJSON.h" -#include "tglobal.h" -#include "osSemaphore.h" -#include "osThread.h" //================================================================================================= @@ -28,34 +28,41 @@ #define QUOTE '"' #define SLASH '\\' -#define JUMP_SPACE(sql) while (*sql != '\0'){if(*sql == SPACE) sql++;else break;} +#define JUMP_SPACE(sql) \ + while (*sql != '\0') { \ + if (*sql == SPACE) \ + sql++; \ + else \ + break; \ + } // comma , -#define IS_SLASH_COMMA(sql) (*(sql) == COMMA && *((sql) - 1) == SLASH) -#define IS_COMMA(sql) (*(sql) == COMMA && *((sql) - 1) != SLASH) +#define IS_SLASH_COMMA(sql) (*(sql) == COMMA && *((sql)-1) == SLASH) +#define IS_COMMA(sql) (*(sql) == COMMA && *((sql)-1) != SLASH) // space -#define IS_SLASH_SPACE(sql) (*(sql) == SPACE && *((sql) - 1) == SLASH) -#define IS_SPACE(sql) (*(sql) == SPACE && *((sql) - 1) != SLASH) +#define IS_SLASH_SPACE(sql) (*(sql) == SPACE && *((sql)-1) == SLASH) +#define IS_SPACE(sql) (*(sql) == SPACE && *((sql)-1) != SLASH) // equal = -#define IS_SLASH_EQUAL(sql) (*(sql) == EQUAL && *((sql) - 1) == SLASH) -#define IS_EQUAL(sql) (*(sql) == EQUAL && *((sql) - 1) != SLASH) +#define IS_SLASH_EQUAL(sql) (*(sql) == EQUAL && *((sql)-1) == SLASH) +#define IS_EQUAL(sql) (*(sql) == EQUAL && *((sql)-1) != SLASH) // quote " -#define IS_SLASH_QUOTE(sql) (*(sql) == QUOTE && *((sql) - 1) == SLASH) -#define IS_QUOTE(sql) (*(sql) == QUOTE && *((sql) - 1) != SLASH) +#define IS_SLASH_QUOTE(sql) (*(sql) == QUOTE && *((sql)-1) == SLASH) +#define IS_QUOTE(sql) (*(sql) == QUOTE && *((sql)-1) != SLASH) // SLASH -#define IS_SLASH_SLASH(sql) (*(sql) == SLASH && *((sql) - 1) == SLASH) +#define IS_SLASH_SLASH(sql) (*(sql) == SLASH && *((sql)-1) == SLASH) -#define IS_SLASH_LETTER(sql) (IS_SLASH_COMMA(sql) || IS_SLASH_SPACE(sql) || IS_SLASH_EQUAL(sql) || IS_SLASH_QUOTE(sql) || IS_SLASH_SLASH(sql)) +#define IS_SLASH_LETTER(sql) \ + (IS_SLASH_COMMA(sql) || IS_SLASH_SPACE(sql) || IS_SLASH_EQUAL(sql) || IS_SLASH_QUOTE(sql) || IS_SLASH_SLASH(sql)) -#define MOVE_FORWARD_ONE(sql,len) (memmove((void*)((sql) - 1), (sql), len)) +#define MOVE_FORWARD_ONE(sql, len) (memmove((void *)((sql)-1), (sql), len)) -#define PROCESS_SLASH(key,keyLen) \ -for (int i = 1; i < keyLen; ++i) { \ - if(IS_SLASH_LETTER(key+i)){ \ - MOVE_FORWARD_ONE(key+i, keyLen-i); \ - i--; \ - keyLen--; \ - } \ -} +#define PROCESS_SLASH(key, keyLen) \ + for (int i = 1; i < keyLen; ++i) { \ + if (IS_SLASH_LETTER(key + i)) { \ + MOVE_FORWARD_ONE(key + i, keyLen - i); \ + i--; \ + keyLen--; \ + } \ + } #define IS_INVALID_COL_LEN(len) ((len) <= 0 || (len) >= TSDB_COL_NAME_LEN) #define IS_INVALID_TABLE_LEN(len) ((len) <= 0 || (len) >= TSDB_TABLE_NAME_LEN) @@ -63,16 +70,16 @@ for (int i = 1; i < keyLen; ++i) { \ #define OTD_JSON_SUB_FIELDS_NUM 2 #define OTD_JSON_FIELDS_NUM 4 -#define TS "_ts" -#define TS_LEN 3 -#define VALUE "_value" -#define VALUE_LEN 6 +#define TS "_ts" +#define TS_LEN 3 +#define VALUE "_value" +#define VALUE_LEN 6 -#define BINARY_ADD_LEN 2 // "binary" 2 means " " -#define NCHAR_ADD_LEN 3 // L"nchar" 3 means L" " +#define BINARY_ADD_LEN 2 // "binary" 2 means " " +#define NCHAR_ADD_LEN 3 // L"nchar" 3 means L" " #define MAX_RETRY_TIMES 5 -#define LINE_BATCH 20000 +#define LINE_BATCH 20000 //================================================================================================= typedef TSDB_SML_PROTOCOL_TYPE SMLProtocolType; @@ -85,18 +92,18 @@ typedef enum { } ESchemaAction; typedef struct { - char sTableName[TSDB_TABLE_NAME_LEN]; - SArray *tags; - SArray *fields; + char sTableName[TSDB_TABLE_NAME_LEN]; + SArray *tags; + SArray *fields; } SCreateSTableActionInfo; typedef struct { - char sTableName[TSDB_TABLE_NAME_LEN]; - SSmlKv *field; + char sTableName[TSDB_TABLE_NAME_LEN]; + SSmlKv *field; } SAlterSTableActionInfo; typedef struct { - ESchemaAction action; + ESchemaAction action; union { SCreateSTableActionInfo createSTable; SAlterSTableActionInfo alterSTable; @@ -104,10 +111,10 @@ typedef struct { } SSchemaAction; typedef struct { - const char *measure; - const char *tags; - const char *cols; - const char *timestamp; + const char *measure; + const char *tags; + const char *cols; + const char *timestamp; int32_t measureLen; int32_t measureTagsLen; @@ -117,31 +124,31 @@ typedef struct { } SSmlLineInfo; typedef struct { - const char *sTableName; // super table name - int32_t sTableNameLen; - char childTableName[TSDB_TABLE_NAME_LEN]; - uint64_t uid; + const char *sTableName; // super table name + int32_t sTableNameLen; + char childTableName[TSDB_TABLE_NAME_LEN]; + uint64_t uid; - SArray *tags; + SArray *tags; // if info->formatData is true, elements are SArray. // if info->formatData is false, elements are SHashObj for find by key quickly - SArray *cols; + SArray *cols; } SSmlTableInfo; typedef struct { - SArray *tags; // save the origin order to create table - SHashObj *tagHash; // elements are + SArray *tags; // save the origin order to create table + SHashObj *tagHash; // elements are - SArray *cols; - SHashObj *colHash; + SArray *cols; + SHashObj *colHash; STableMeta *tableMeta; } SSmlSTableMeta; typedef struct { - int32_t len; - char *buf; + int32_t len; + char *buf; } SSmlMsgBuf; typedef struct { @@ -159,53 +166,53 @@ typedef struct { int64_t endTime; } SSmlCostInfo; -typedef struct{ - SRequestObj* request; - tsem_t sem; +typedef struct { + SRequestObj *request; + tsem_t sem; TdThreadSpinlock lock; } Params; typedef struct { - int64_t id; - Params *params; - bool isLast; + int64_t id; + Params *params; + bool isLast; - SMLProtocolType protocol; - int8_t precision; - bool dataFormat; // true means that the name and order of keys in each line are the same(only for influx protocol) + SMLProtocolType protocol; + int8_t precision; + bool dataFormat; // true means that the name and order of keys in each line are the same(only for influx protocol) - SHashObj *childTables; - SHashObj *superTables; - SHashObj *pVgHash; - void *exec; + SHashObj *childTables; + SHashObj *superTables; + SHashObj *pVgHash; + void *exec; - STscObj *taos; - SCatalog *pCatalog; - SRequestObj *pRequest; - SQuery *pQuery; + STscObj *taos; + SCatalog *pCatalog; + SRequestObj *pRequest; + SQuery *pQuery; - SSmlCostInfo cost; - int32_t affectedRows; - SSmlMsgBuf msgBuf; - SHashObj *dumplicateKey; // for dumplicate key - SArray *colsContainer; // for cols parse, if dataFormat == false + SSmlCostInfo cost; + int32_t affectedRows; + SSmlMsgBuf msgBuf; + SHashObj *dumplicateKey; // for dumplicate key + SArray *colsContainer; // for cols parse, if dataFormat == false } SSmlHandle; //================================================================================================= //================================================================================================= static volatile int64_t linesSmlHandleId = 0; -static int64_t smlGenId() { - int64_t id; +static int64_t smlGenId() { + int64_t id; - do { - id = atomic_add_fetch_64(&linesSmlHandleId, 1); + do { + id = atomic_add_fetch_64(&linesSmlHandleId, 1); } while (id == 0); - return id; + return id; } static inline bool smlDoubleToInt64OverFlow(double num) { - if(num >= (double)INT64_MAX || num <= (double)INT64_MIN) return true; + if (num >= (double)INT64_MAX || num <= (double)INT64_MIN) return true; return false; } @@ -218,29 +225,31 @@ static inline bool smlCheckDuplicateKey(const char *key, int32_t keyLen, SHashOb return false; } -static int32_t smlBuildInvalidDataMsg(SSmlMsgBuf* pBuf, const char *msg1, const char *msg2) { - memset(pBuf->buf, 0 , pBuf->len); - if(msg1) strncat(pBuf->buf, msg1, pBuf->len); +static int32_t smlBuildInvalidDataMsg(SSmlMsgBuf *pBuf, const char *msg1, const char *msg2) { + memset(pBuf->buf, 0, pBuf->len); + if (msg1) strncat(pBuf->buf, msg1, pBuf->len); int32_t left = pBuf->len - strlen(pBuf->buf); - if(left > 2 && msg2) { + if (left > 2 && msg2) { strncat(pBuf->buf, ":", left - 1); strncat(pBuf->buf, msg2, left - 2); } return TSDB_CODE_SML_INVALID_DATA; } -static int32_t smlGenerateSchemaAction(SSchema* colField, SHashObj* colHash, SSmlKv* kv, bool isTag, - SSchemaAction* action, bool* actionNeeded, SSmlHandle* info) { +static int32_t smlGenerateSchemaAction(SSchema *colField, SHashObj *colHash, SSmlKv *kv, bool isTag, + SSchemaAction *action, bool *actionNeeded, SSmlHandle *info) { uint16_t *index = (uint16_t *)taosHashGet(colHash, kv->key, kv->keyLen); if (index) { if (colField[*index].type != kv->type) { - uError("SML:0x%"PRIx64" point type and db type mismatch. key: %s. point type: %d, db type: %d", info->id, kv->key, - colField[*index].type, kv->type); + uError("SML:0x%" PRIx64 " point type and db type mismatch. key: %s. point type: %d, db type: %d", info->id, + kv->key, colField[*index].type, kv->type); return TSDB_CODE_TSC_INVALID_VALUE; } - if ((colField[*index].type == TSDB_DATA_TYPE_VARCHAR && (colField[*index].bytes - VARSTR_HEADER_SIZE) < kv->length) || - (colField[*index].type == TSDB_DATA_TYPE_NCHAR &&((colField[*index].bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE < kv->length))) { + if ((colField[*index].type == TSDB_DATA_TYPE_VARCHAR && + (colField[*index].bytes - VARSTR_HEADER_SIZE) < kv->length) || + (colField[*index].type == TSDB_DATA_TYPE_NCHAR && + ((colField[*index].bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE < kv->length))) { if (isTag) { action->action = SCHEMA_ACTION_CHANGE_TAG_SIZE; } else { @@ -260,27 +269,26 @@ static int32_t smlGenerateSchemaAction(SSchema* colField, SHashObj* colHash, SSm } if (*actionNeeded) { uDebug("SML:0x%" PRIx64 " generate schema action. column name: %s, action: %d", info->id, colField->name, - action->action); + action->action); } return 0; } -static int32_t smlFindNearestPowerOf2(int32_t length){ +static int32_t smlFindNearestPowerOf2(int32_t length) { int32_t result = 1; - while(result <= length){ + while (result <= length) { result *= 2; } return result; } -static int32_t smlBuildColumnDescription(SSmlKv* field, char* buf, int32_t bufSize, int32_t* outBytes) { +static int32_t smlBuildColumnDescription(SSmlKv *field, char *buf, int32_t bufSize, int32_t *outBytes) { uint8_t type = field->type; char tname[TSDB_TABLE_NAME_LEN] = {0}; memcpy(tname, field->key, field->keyLen); if (type == TSDB_DATA_TYPE_BINARY || type == TSDB_DATA_TYPE_NCHAR) { int32_t bytes = smlFindNearestPowerOf2(field->length); - int out = snprintf(buf, bufSize, "`%s` %s(%d)", - tname, tDataTypes[field->type].name, bytes); + int out = snprintf(buf, bufSize, "`%s` %s(%d)", tname, tDataTypes[field->type].name, bytes); *outBytes = out; } else { int out = snprintf(buf, bufSize, "`%s` %s", tname, tDataTypes[type].name); @@ -290,22 +298,22 @@ static int32_t smlBuildColumnDescription(SSmlKv* field, char* buf, int32_t bufSi return 0; } -static int32_t smlApplySchemaAction(SSmlHandle* info, SSchemaAction* action) { +static int32_t smlApplySchemaAction(SSmlHandle *info, SSchemaAction *action) { int32_t code = 0; int32_t outBytes = 0; - char *result = (char *)taosMemoryCalloc(1, TSDB_MAX_ALLOWED_SQL_LEN); + char *result = (char *)taosMemoryCalloc(1, TSDB_MAX_ALLOWED_SQL_LEN); int32_t capacity = TSDB_MAX_ALLOWED_SQL_LEN; - uDebug("SML:0x%"PRIx64" apply schema action. action: %d", info->id, action->action); + uDebug("SML:0x%" PRIx64 " apply schema action. action: %d", info->id, action->action); switch (action->action) { case SCHEMA_ACTION_ADD_COLUMN: { int n = sprintf(result, "alter stable `%s` add column ", action->alterSTable.sTableName); - smlBuildColumnDescription(action->alterSTable.field, result+n, capacity-n, &outBytes); - TAOS_RES* res = taos_query(info->taos, result); //TODO async doAsyncQuery + smlBuildColumnDescription(action->alterSTable.field, result + n, capacity - n, &outBytes); + TAOS_RES *res = taos_query(info->taos, result); // TODO async doAsyncQuery code = taos_errno(res); - const char* errStr = taos_errstr(res); + const char *errStr = taos_errstr(res); if (code != TSDB_CODE_SUCCESS) { - uError("SML:0x%"PRIx64" apply schema action. error: %s", info->id, errStr); + uError("SML:0x%" PRIx64 " apply schema action. error: %s", info->id, errStr); taosMsleep(100); } taos_free_result(res); @@ -314,13 +322,12 @@ static int32_t smlApplySchemaAction(SSmlHandle* info, SSchemaAction* action) { } case SCHEMA_ACTION_ADD_TAG: { int n = sprintf(result, "alter stable `%s` add tag ", action->alterSTable.sTableName); - smlBuildColumnDescription(action->alterSTable.field, - result+n, capacity-n, &outBytes); - TAOS_RES* res = taos_query(info->taos, result); //TODO async doAsyncQuery + smlBuildColumnDescription(action->alterSTable.field, result + n, capacity - n, &outBytes); + TAOS_RES *res = taos_query(info->taos, result); // TODO async doAsyncQuery code = taos_errno(res); - const char* errStr = taos_errstr(res); + const char *errStr = taos_errstr(res); if (code != TSDB_CODE_SUCCESS) { - uError("SML:0x%"PRIx64" apply schema action. error : %s", info->id, taos_errstr(res)); + uError("SML:0x%" PRIx64 " apply schema action. error : %s", info->id, taos_errstr(res)); taosMsleep(100); } taos_free_result(res); @@ -329,12 +336,11 @@ static int32_t smlApplySchemaAction(SSmlHandle* info, SSchemaAction* action) { } case SCHEMA_ACTION_CHANGE_COLUMN_SIZE: { int n = sprintf(result, "alter stable `%s` modify column ", action->alterSTable.sTableName); - smlBuildColumnDescription(action->alterSTable.field, result+n, - capacity-n, &outBytes); - TAOS_RES* res = taos_query(info->taos, result); //TODO async doAsyncQuery + smlBuildColumnDescription(action->alterSTable.field, result + n, capacity - n, &outBytes); + TAOS_RES *res = taos_query(info->taos, result); // TODO async doAsyncQuery code = taos_errno(res); if (code != TSDB_CODE_SUCCESS) { - uError("SML:0x%"PRIx64" apply schema action. error : %s", info->id, taos_errstr(res)); + uError("SML:0x%" PRIx64 " apply schema action. error : %s", info->id, taos_errstr(res)); taosMsleep(100); } taos_free_result(res); @@ -343,12 +349,11 @@ static int32_t smlApplySchemaAction(SSmlHandle* info, SSchemaAction* action) { } case SCHEMA_ACTION_CHANGE_TAG_SIZE: { int n = sprintf(result, "alter stable `%s` modify tag ", action->alterSTable.sTableName); - smlBuildColumnDescription(action->alterSTable.field, result+n, - capacity-n, &outBytes); - TAOS_RES* res = taos_query(info->taos, result); //TODO async doAsyncQuery + smlBuildColumnDescription(action->alterSTable.field, result + n, capacity - n, &outBytes); + TAOS_RES *res = taos_query(info->taos, result); // TODO async doAsyncQuery code = taos_errno(res); if (code != TSDB_CODE_SUCCESS) { - uError("SML:0x%"PRIx64" apply schema action. error : %s", info->id, taos_errstr(res)); + uError("SML:0x%" PRIx64 " apply schema action. error : %s", info->id, taos_errstr(res)); taosMsleep(100); } taos_free_result(res); @@ -356,42 +361,54 @@ static int32_t smlApplySchemaAction(SSmlHandle* info, SSchemaAction* action) { break; } case SCHEMA_ACTION_CREATE_STABLE: { - int n = sprintf(result, "create stable `%s` (", action->createSTable.sTableName); - char* pos = result + n; int freeBytes = capacity - n; + int n = sprintf(result, "create stable `%s` (", action->createSTable.sTableName); + char *pos = result + n; + int freeBytes = capacity - n; SArray *cols = action->createSTable.fields; - for(int i = 0; i < taosArrayGetSize(cols); i++){ + for (int i = 0; i < taosArrayGetSize(cols); i++) { SSmlKv *kv = (SSmlKv *)taosArrayGetP(cols, i); smlBuildColumnDescription(kv, pos, freeBytes, &outBytes); - pos += outBytes; freeBytes -= outBytes; - *pos = ','; ++pos; --freeBytes; + pos += outBytes; + freeBytes -= outBytes; + *pos = ','; + ++pos; + --freeBytes; } - --pos; ++freeBytes; + --pos; + ++freeBytes; outBytes = snprintf(pos, freeBytes, ") tags ("); - pos += outBytes; freeBytes -= outBytes; + pos += outBytes; + freeBytes -= outBytes; cols = action->createSTable.tags; - for(int i = 0; i < taosArrayGetSize(cols); i++){ + for (int i = 0; i < taosArrayGetSize(cols); i++) { SSmlKv *kv = (SSmlKv *)taosArrayGetP(cols, i); smlBuildColumnDescription(kv, pos, freeBytes, &outBytes); - pos += outBytes; freeBytes -= outBytes; - *pos = ','; ++pos; --freeBytes; + pos += outBytes; + freeBytes -= outBytes; + *pos = ','; + ++pos; + --freeBytes; } - if(taosArrayGetSize(cols) == 0){ - outBytes = snprintf(pos, freeBytes,"`%s` %s(%d)", - tsSmlTagName, tDataTypes[TSDB_DATA_TYPE_NCHAR].name, 1); - pos += outBytes; freeBytes -= outBytes; - *pos = ','; ++pos; --freeBytes; + if (taosArrayGetSize(cols) == 0) { + outBytes = snprintf(pos, freeBytes, "`%s` %s(%d)", tsSmlTagName, tDataTypes[TSDB_DATA_TYPE_NCHAR].name, 1); + pos += outBytes; + freeBytes -= outBytes; + *pos = ','; + ++pos; + --freeBytes; } - pos--; ++freeBytes; + pos--; + ++freeBytes; outBytes = snprintf(pos, freeBytes, ")"); - TAOS_RES* res = taos_query(info->taos, result); + TAOS_RES *res = taos_query(info->taos, result); code = taos_errno(res); if (code != TSDB_CODE_SUCCESS) { - uError("SML:0x%"PRIx64" apply schema action. error : %s", info->id, taos_errstr(res)); + uError("SML:0x%" PRIx64 " apply schema action. error : %s", info->id, taos_errstr(res)); taosMsleep(100); } taos_free_result(res); @@ -405,18 +422,19 @@ static int32_t smlApplySchemaAction(SSmlHandle* info, SSchemaAction* action) { taosMemoryFreeClear(result); if (code != 0) { - uError("SML:0x%"PRIx64 " apply schema action failure. %s", info->id, tstrerror(code)); + uError("SML:0x%" PRIx64 " apply schema action failure. %s", info->id, tstrerror(code)); } return code; } -static int32_t smlProcessSchemaAction(SSmlHandle* info, SSchema* schemaField, SHashObj* schemaHash, SArray *cols, SSchemaAction* action, bool isTag){ +static int32_t smlProcessSchemaAction(SSmlHandle *info, SSchema *schemaField, SHashObj *schemaHash, SArray *cols, + SSchemaAction *action, bool isTag) { int32_t code = TSDB_CODE_SUCCESS; for (int j = 0; j < taosArrayGetSize(cols); ++j) { - SSmlKv* kv = (SSmlKv*)taosArrayGetP(cols, j); - bool actionNeeded = false; + SSmlKv *kv = (SSmlKv *)taosArrayGetP(cols, j); + bool actionNeeded = false; code = smlGenerateSchemaAction(schemaField, schemaHash, kv, isTag, action, &actionNeeded, info); - if(code != TSDB_CODE_SUCCESS){ + if (code != TSDB_CODE_SUCCESS) { return code; } if (actionNeeded) { @@ -429,24 +447,24 @@ static int32_t smlProcessSchemaAction(SSmlHandle* info, SSchema* schemaField, SH return TSDB_CODE_SUCCESS; } -static int32_t smlCheckMeta(SSchema* schema, int32_t length, SArray* cols){ +static int32_t smlCheckMeta(SSchema *schema, int32_t length, SArray *cols) { SHashObj *hashTmp = taosHashInit(length, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK); - for(uint16_t i = 0; i < length; i++){ + for (uint16_t i = 0; i < length; i++) { taosHashPut(hashTmp, schema[i].name, strlen(schema[i].name), &i, SHORT_BYTES); } - for(int32_t i = 0; i < taosArrayGetSize(cols); i++){ - SSmlKv* kv = (SSmlKv*)taosArrayGetP(cols, i); - if(taosHashGet(hashTmp, kv->key, kv->keyLen) == NULL){ + for (int32_t i = 0; i < taosArrayGetSize(cols); i++) { + SSmlKv *kv = (SSmlKv *)taosArrayGetP(cols, i); + if (taosHashGet(hashTmp, kv->key, kv->keyLen) == NULL) { return -1; } } return 0; } -static int32_t smlModifyDBSchemas(SSmlHandle* info) { +static int32_t smlModifyDBSchemas(SSmlHandle *info) { int32_t code = 0; - SName pName = {TSDB_TABLE_NAME_T, info->taos->acctId, {0}, {0}}; + SName pName = {TSDB_TABLE_NAME_T, info->taos->acctId, {0}, {0}}; strcpy(pName.dbname, info->pRequest->pDb); SRequestConnInfo conn = {0}; @@ -454,15 +472,15 @@ static int32_t smlModifyDBSchemas(SSmlHandle* info) { conn.requestId = info->pRequest->requestId; conn.requestObjRefId = info->pRequest->self; conn.mgmtEps = getEpSet_s(&info->taos->pAppInfo->mgmtEp); - - SSmlSTableMeta** tableMetaSml = (SSmlSTableMeta**)taosHashIterate(info->superTables, NULL); + + SSmlSTableMeta **tableMetaSml = (SSmlSTableMeta **)taosHashIterate(info->superTables, NULL); while (tableMetaSml) { - SSmlSTableMeta* sTableData = *tableMetaSml; - STableMeta *pTableMeta = NULL; - bool needCheckMeta = false; // for multi thread + SSmlSTableMeta *sTableData = *tableMetaSml; + STableMeta *pTableMeta = NULL; + bool needCheckMeta = false; // for multi thread size_t superTableLen = 0; - void *superTable = taosHashGetKey(tableMetaSml, &superTableLen); + void *superTable = taosHashGetKey(tableMetaSml, &superTableLen); memset(pName.tname, 0, TSDB_TABLE_NAME_LEN); memcpy(pName.tname, superTable, superTableLen); @@ -477,13 +495,16 @@ static int32_t smlModifyDBSchemas(SSmlHandle* info) { schemaAction.createSTable.fields = sTableData->cols; code = smlApplySchemaAction(info, &schemaAction); if (code != TSDB_CODE_SUCCESS) { - uError("SML:0x%"PRIx64" smlApplySchemaAction failed. can not create %s", info->id, schemaAction.createSTable.sTableName); + uError("SML:0x%" PRIx64 " smlApplySchemaAction failed. can not create %s", info->id, + schemaAction.createSTable.sTableName); goto end; } info->cost.numOfCreateSTables++; - }else if (code == TSDB_CODE_SUCCESS) { - SHashObj *hashTmp = taosHashInit(pTableMeta->tableInfo.numOfTags, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK); - for(uint16_t i = pTableMeta->tableInfo.numOfColumns; i < pTableMeta->tableInfo.numOfColumns + pTableMeta->tableInfo.numOfTags; i++){ + } else if (code == TSDB_CODE_SUCCESS) { + SHashObj *hashTmp = taosHashInit(pTableMeta->tableInfo.numOfTags, + taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK); + for (uint16_t i = pTableMeta->tableInfo.numOfColumns; + i < pTableMeta->tableInfo.numOfColumns + pTableMeta->tableInfo.numOfTags; i++) { taosHashPut(hashTmp, pTableMeta->schema[i].name, strlen(pTableMeta->schema[i].name), &i, SHORT_BYTES); } @@ -497,7 +518,7 @@ static int32_t smlModifyDBSchemas(SSmlHandle* info) { } taosHashClear(hashTmp); - for(uint16_t i = 0; i < pTableMeta->tableInfo.numOfColumns; i++){ + for (uint16_t i = 0; i < pTableMeta->tableInfo.numOfColumns; i++) { taosHashPut(hashTmp, pTableMeta->schema[i].name, strlen(pTableMeta->schema[i].name), &i, SHORT_BYTES); } code = smlProcessSchemaAction(info, pTableMeta->schema, hashTmp, sTableData->cols, &schemaAction, false); @@ -512,33 +533,34 @@ static int32_t smlModifyDBSchemas(SSmlHandle* info) { } needCheckMeta = true; } else { - uError("SML:0x%"PRIx64" load table meta error: %s", info->id, tstrerror(code)); + uError("SML:0x%" PRIx64 " load table meta error: %s", info->id, tstrerror(code)); goto end; } - if(pTableMeta) taosMemoryFree(pTableMeta); + if (pTableMeta) taosMemoryFree(pTableMeta); code = catalogGetSTableMeta(info->pCatalog, &conn, &pName, &pTableMeta); if (code != TSDB_CODE_SUCCESS) { - uError("SML:0x%"PRIx64" catalogGetSTableMeta failed. super table name %s", info->id, (char*)superTable); + uError("SML:0x%" PRIx64 " catalogGetSTableMeta failed. super table name %s", info->id, (char *)superTable); goto end; } - if(needCheckMeta){ - code = smlCheckMeta(&(pTableMeta->schema[pTableMeta->tableInfo.numOfColumns]), pTableMeta->tableInfo.numOfTags, sTableData->tags); + if (needCheckMeta) { + code = smlCheckMeta(&(pTableMeta->schema[pTableMeta->tableInfo.numOfColumns]), pTableMeta->tableInfo.numOfTags, + sTableData->tags); if (code != TSDB_CODE_SUCCESS) { - uError("SML:0x%"PRIx64" check tag failed. super table name %s", info->id, (char*)superTable); + uError("SML:0x%" PRIx64 " check tag failed. super table name %s", info->id, (char *)superTable); goto end; } code = smlCheckMeta(&(pTableMeta->schema[0]), pTableMeta->tableInfo.numOfColumns, sTableData->cols); if (code != TSDB_CODE_SUCCESS) { - uError("SML:0x%"PRIx64" check cols failed. super table name %s", info->id, (char*)superTable); + uError("SML:0x%" PRIx64 " check cols failed. super table name %s", info->id, (char *)superTable); goto end; } } sTableData->tableMeta = pTableMeta; - tableMetaSml = (SSmlSTableMeta**)taosHashIterate(info->superTables, tableMetaSml); + tableMetaSml = (SSmlSTableMeta **)taosHashIterate(info->superTables, tableMetaSml); } return 0; @@ -547,32 +569,32 @@ end: return code; } -static bool smlParseNumber(SSmlKv *kvVal, SSmlMsgBuf *msg){ +static bool smlParseNumber(SSmlKv *kvVal, SSmlMsgBuf *msg) { const char *pVal = kvVal->value; - int32_t len = kvVal->length; - char *endptr = NULL; - double result = taosStr2Double(pVal, &endptr); - if(pVal == endptr){ + int32_t len = kvVal->length; + char *endptr = NULL; + double result = taosStr2Double(pVal, &endptr); + if (pVal == endptr) { smlBuildInvalidDataMsg(msg, "invalid data", pVal); return false; } int32_t left = len - (endptr - pVal); - if(left == 0 || (left == 3 && strncasecmp(endptr, "f64", left) == 0)){ + if (left == 0 || (left == 3 && strncasecmp(endptr, "f64", left) == 0)) { kvVal->type = TSDB_DATA_TYPE_DOUBLE; kvVal->d = result; - }else if ((left == 3 && strncasecmp(endptr, "f32", left) == 0)){ - if(!IS_VALID_FLOAT(result)){ + } else if ((left == 3 && strncasecmp(endptr, "f32", left) == 0)) { + if (!IS_VALID_FLOAT(result)) { smlBuildInvalidDataMsg(msg, "float out of range[-3.402823466e+38,3.402823466e+38]", pVal); return false; } kvVal->type = TSDB_DATA_TYPE_FLOAT; kvVal->f = (float)result; - }else if ((left == 1 && *endptr == 'i') || (left == 3 && strncasecmp(endptr, "i64", left) == 0)){ - if(smlDoubleToInt64OverFlow(result)){ + } else if ((left == 1 && *endptr == 'i') || (left == 3 && strncasecmp(endptr, "i64", left) == 0)) { + if (smlDoubleToInt64OverFlow(result)) { errno = 0; int64_t tmp = taosStr2Int64(pVal, &endptr, 10); - if(errno == ERANGE){ + if (errno == ERANGE) { smlBuildInvalidDataMsg(msg, "big int out of range[-9223372036854775808,9223372036854775807]", pVal); return false; } @@ -582,11 +604,11 @@ static bool smlParseNumber(SSmlKv *kvVal, SSmlMsgBuf *msg){ } kvVal->type = TSDB_DATA_TYPE_BIGINT; kvVal->i = (int64_t)result; - }else if ((left == 3 && strncasecmp(endptr, "u64", left) == 0)){ - if(result >= (double)UINT64_MAX || result < 0){ + } else if ((left == 3 && strncasecmp(endptr, "u64", left) == 0)) { + if (result >= (double)UINT64_MAX || result < 0) { errno = 0; uint64_t tmp = taosStr2UInt64(pVal, &endptr, 10); - if(errno == ERANGE || result < 0){ + if (errno == ERANGE || result < 0) { smlBuildInvalidDataMsg(msg, "unsigned big int out of range[0,18446744073709551615]", pVal); return false; } @@ -596,49 +618,49 @@ static bool smlParseNumber(SSmlKv *kvVal, SSmlMsgBuf *msg){ } kvVal->type = TSDB_DATA_TYPE_UBIGINT; kvVal->u = result; - }else if (left == 3 && strncasecmp(endptr, "i32", left) == 0){ - if(!IS_VALID_INT(result)){ + } else if (left == 3 && strncasecmp(endptr, "i32", left) == 0) { + if (!IS_VALID_INT(result)) { smlBuildInvalidDataMsg(msg, "int out of range[-2147483648,2147483647]", pVal); return false; } kvVal->type = TSDB_DATA_TYPE_INT; kvVal->i = result; - }else if (left == 3 && strncasecmp(endptr, "u32", left) == 0){ - if(!IS_VALID_UINT(result)){ + } else if (left == 3 && strncasecmp(endptr, "u32", left) == 0) { + if (!IS_VALID_UINT(result)) { smlBuildInvalidDataMsg(msg, "unsigned int out of range[0,4294967295]", pVal); return false; } kvVal->type = TSDB_DATA_TYPE_UINT; kvVal->u = result; - }else if (left == 3 && strncasecmp(endptr, "i16", left) == 0){ - if(!IS_VALID_SMALLINT(result)){ + } else if (left == 3 && strncasecmp(endptr, "i16", left) == 0) { + if (!IS_VALID_SMALLINT(result)) { smlBuildInvalidDataMsg(msg, "small int our of range[-32768,32767]", pVal); return false; } kvVal->type = TSDB_DATA_TYPE_SMALLINT; kvVal->i = result; - }else if (left == 3 && strncasecmp(endptr, "u16", left) == 0){ - if(!IS_VALID_USMALLINT(result)){ + } else if (left == 3 && strncasecmp(endptr, "u16", left) == 0) { + if (!IS_VALID_USMALLINT(result)) { smlBuildInvalidDataMsg(msg, "unsigned small int out of rang[0,65535]", pVal); return false; } kvVal->type = TSDB_DATA_TYPE_USMALLINT; kvVal->u = result; - }else if (left == 2 && strncasecmp(endptr, "i8", left) == 0){ - if(!IS_VALID_TINYINT(result)){ + } else if (left == 2 && strncasecmp(endptr, "i8", left) == 0) { + if (!IS_VALID_TINYINT(result)) { smlBuildInvalidDataMsg(msg, "tiny int out of range[-128,127]", pVal); return false; } kvVal->type = TSDB_DATA_TYPE_TINYINT; kvVal->i = result; - }else if (left == 2 && strncasecmp(endptr, "u8", left) == 0){ - if(!IS_VALID_UTINYINT(result)){ + } else if (left == 2 && strncasecmp(endptr, "u8", left) == 0) { + if (!IS_VALID_UTINYINT(result)) { smlBuildInvalidDataMsg(msg, "unsigned tiny int out of range[0,255]", pVal); return false; } kvVal->type = TSDB_DATA_TYPE_UTINYINT; kvVal->u = result; - }else{ + } else { smlBuildInvalidDataMsg(msg, "invalid data", pVal); return false; } @@ -647,7 +669,7 @@ static bool smlParseNumber(SSmlKv *kvVal, SSmlMsgBuf *msg){ static bool smlParseBool(SSmlKv *kvVal) { const char *pVal = kvVal->value; - int32_t len = kvVal->length; + int32_t len = kvVal->length; if ((len == 1) && (pVal[0] == 't' || pVal[0] == 'T')) { kvVal->i = true; return true; @@ -658,11 +680,11 @@ static bool smlParseBool(SSmlKv *kvVal) { return true; } - if((len == 4) && !strncasecmp(pVal, "true", len)) { + if ((len == 4) && !strncasecmp(pVal, "true", len)) { kvVal->i = true; return true; } - if((len == 5) && !strncasecmp(pVal, "false", len)) { + if ((len == 5) && !strncasecmp(pVal, "false", len)) { kvVal->i = false; return true; } @@ -670,7 +692,7 @@ static bool smlParseBool(SSmlKv *kvVal) { } static bool smlIsBinary(const char *pVal, uint16_t len) { - //binary: "abc" + // binary: "abc" if (len < 2) { return false; } @@ -681,20 +703,20 @@ static bool smlIsBinary(const char *pVal, uint16_t len) { } static bool smlIsNchar(const char *pVal, uint16_t len) { - //nchar: L"abc" + // nchar: L"abc" if (len < 3) { return false; } - if ((pVal[0] == 'l' || pVal[0] == 'L')&& pVal[1] == '"' && pVal[len - 1] == '"') { + if ((pVal[0] == 'l' || pVal[0] == 'L') && pVal[1] == '"' && pVal[len - 1] == '"') { return true; } return false; } static int64_t smlGetTimeValue(const char *value, int32_t len, int8_t type) { - char *endPtr = NULL; + char *endPtr = NULL; int64_t tsInt64 = taosStr2Int64(value, &endPtr, 10); - if(value + len != endPtr){ + if (value + len != endPtr) { return -1; } double ts = tsInt64; @@ -724,7 +746,7 @@ static int64_t smlGetTimeValue(const char *value, int32_t len, int8_t type) { default: ASSERT(0); } - if(ts >= (double)INT64_MAX || ts < 0){ + if (ts >= (double)INT64_MAX || ts < 0) { return -1; } @@ -761,8 +783,8 @@ static int8_t smlGetTsTypeByPrecision(int8_t precision) { } } -static int64_t smlParseInfluxTime(SSmlHandle* info, const char* data, int32_t len){ - if(len == 0 || (len == 1 && data[0] == '0')){ +static int64_t smlParseInfluxTime(SSmlHandle *info, const char *data, int32_t len) { + if (len == 0 || (len == 1 && data[0] == '0')) { return taosGetTimestampNs(); } @@ -773,49 +795,50 @@ static int64_t smlParseInfluxTime(SSmlHandle* info, const char* data, int32_t le } int64_t ts = smlGetTimeValue(data, len, tsType); - if(ts == -1){ + if (ts == -1) { smlBuildInvalidDataMsg(&info->msgBuf, "invalid timestamp", data); return -1; } return ts; } -static int64_t smlParseOpenTsdbTime(SSmlHandle* info, const char* data, int32_t len){ - if(!data){ +static int64_t smlParseOpenTsdbTime(SSmlHandle *info, const char *data, int32_t len) { + if (!data) { smlBuildInvalidDataMsg(&info->msgBuf, "timestamp can not be null", NULL); return -1; } - if(len == 1 && data[0] == '0'){ + if (len == 1 && data[0] == '0') { return taosGetTimestampNs(); } int8_t tsType = smlGetTsTypeByLen(len); if (tsType == -1) { - smlBuildInvalidDataMsg(&info->msgBuf, "timestamp precision can only be seconds(10 digits) or milli seconds(13 digits)", data); + smlBuildInvalidDataMsg(&info->msgBuf, + "timestamp precision can only be seconds(10 digits) or milli seconds(13 digits)", data); return -1; } int64_t ts = smlGetTimeValue(data, len, tsType); - if(ts == -1){ + if (ts == -1) { smlBuildInvalidDataMsg(&info->msgBuf, "invalid timestamp", data); return -1; } return ts; } -static int32_t smlParseTS(SSmlHandle* info, const char* data, int32_t len, SArray *cols){ +static int32_t smlParseTS(SSmlHandle *info, const char *data, int32_t len, SArray *cols) { int64_t ts = 0; - if(info->protocol == TSDB_SML_LINE_PROTOCOL){ + if (info->protocol == TSDB_SML_LINE_PROTOCOL) { ts = smlParseInfluxTime(info, data, len); - }else if(info->protocol == TSDB_SML_TELNET_PROTOCOL){ + } else if (info->protocol == TSDB_SML_TELNET_PROTOCOL) { ts = smlParseOpenTsdbTime(info, data, len); - }else{ + } else { ASSERT(0); } - if(ts == -1) return TSDB_CODE_TSC_INVALID_TIME_STAMP; + if (ts == -1) return TSDB_CODE_TSC_INVALID_TIME_STAMP; // add ts to SSmlKv *kv = (SSmlKv *)taosMemoryCalloc(sizeof(SSmlKv), 1); - if(!kv){ + if (!kv) { return TSDB_CODE_OUT_OF_MEMORY; } @@ -824,19 +847,19 @@ static int32_t smlParseTS(SSmlHandle* info, const char* data, int32_t len, SArra kv->i = ts; kv->type = TSDB_DATA_TYPE_TIMESTAMP; kv->length = (int16_t)tDataTypes[kv->type].bytes; - if(cols) taosArrayPush(cols, &kv); + if (cols) taosArrayPush(cols, &kv); return TSDB_CODE_SUCCESS; } static bool smlParseValue(SSmlKv *pVal, SSmlMsgBuf *msg) { - //binary + // binary if (smlIsBinary(pVal->value, pVal->length)) { pVal->type = TSDB_DATA_TYPE_BINARY; pVal->length -= BINARY_ADD_LEN; pVal->value += (BINARY_ADD_LEN - 1); return true; } - //nchar + // nchar if (smlIsNchar(pVal->value, pVal->length)) { pVal->type = TSDB_DATA_TYPE_NCHAR; pVal->length -= NCHAR_ADD_LEN; @@ -844,13 +867,13 @@ static bool smlParseValue(SSmlKv *pVal, SSmlMsgBuf *msg) { return true; } - //bool + // bool if (smlParseBool(pVal)) { pVal->type = TSDB_DATA_TYPE_BOOL; pVal->length = (int16_t)tDataTypes[pVal->type].bytes; return true; } - //number + // number if (smlParseNumber(pVal, msg)) { pVal->length = (int16_t)tDataTypes[pVal->type].bytes; return true; @@ -859,41 +882,41 @@ static bool smlParseValue(SSmlKv *pVal, SSmlMsgBuf *msg) { return false; } -static int32_t smlParseInfluxString(const char* sql, SSmlLineInfo *elements, SSmlMsgBuf *msg){ - if(!sql) return TSDB_CODE_SML_INVALID_DATA; +static int32_t smlParseInfluxString(const char *sql, SSmlLineInfo *elements, SSmlMsgBuf *msg) { + if (!sql) return TSDB_CODE_SML_INVALID_DATA; JUMP_SPACE(sql) - if(*sql == COMMA) return TSDB_CODE_SML_INVALID_DATA; + if (*sql == COMMA) return TSDB_CODE_SML_INVALID_DATA; elements->measure = sql; // parse measure while (*sql != '\0') { - if((sql != elements->measure) && IS_SLASH_LETTER(sql)){ - MOVE_FORWARD_ONE(sql,strlen(sql) + 1); + if ((sql != elements->measure) && IS_SLASH_LETTER(sql)) { + MOVE_FORWARD_ONE(sql, strlen(sql) + 1); continue; } - if(IS_COMMA(sql)){ + if (IS_COMMA(sql)) { break; } - if(IS_SPACE(sql)){ + if (IS_SPACE(sql)) { break; } sql++; } elements->measureLen = sql - elements->measure; - if(IS_INVALID_TABLE_LEN(elements->measureLen)) { + if (IS_INVALID_TABLE_LEN(elements->measureLen)) { smlBuildInvalidDataMsg(msg, "measure is empty or too large than 192", NULL); return TSDB_CODE_SML_INVALID_DATA; } // parse tag - if(*sql == SPACE){ + if (*sql == SPACE) { elements->tagsLen = 0; - }else{ - if(*sql == COMMA) sql++; + } else { + if (*sql == COMMA) sql++; elements->tags = sql; while (*sql != '\0') { - if(IS_SPACE(sql)){ + if (IS_SPACE(sql)) { break; } sql++; @@ -907,20 +930,20 @@ static int32_t smlParseInfluxString(const char* sql, SSmlLineInfo *elements, SSm elements->cols = sql; bool isInQuote = false; while (*sql != '\0') { - if(IS_QUOTE(sql)){ + if (IS_QUOTE(sql)) { isInQuote = !isInQuote; } - if(!isInQuote && IS_SPACE(sql)){ + if (!isInQuote && IS_SPACE(sql)) { break; } sql++; } - if(isInQuote){ + if (isInQuote) { smlBuildInvalidDataMsg(msg, "only one quote", elements->cols); return TSDB_CODE_SML_INVALID_DATA; } elements->colsLen = sql - elements->cols; - if(elements->colsLen == 0) { + if (elements->colsLen == 0) { smlBuildInvalidDataMsg(msg, "cols is empty", NULL); return TSDB_CODE_SML_INVALID_DATA; } @@ -929,7 +952,7 @@ static int32_t smlParseInfluxString(const char* sql, SSmlLineInfo *elements, SSm JUMP_SPACE(sql) elements->timestamp = sql; while (*sql != '\0') { - if(*sql == SPACE){ + if (*sql == SPACE) { break; } sql++; @@ -939,11 +962,11 @@ static int32_t smlParseInfluxString(const char* sql, SSmlLineInfo *elements, SSm return TSDB_CODE_SUCCESS; } -static void smlParseTelnetElement(const char **sql, const char **data, int32_t *len){ +static void smlParseTelnetElement(const char **sql, const char **data, int32_t *len) { while (**sql != '\0') { - if(**sql != SPACE && !(*data)) { + if (**sql != SPACE && !(*data)) { *data = *sql; - }else if (**sql == SPACE && *data) { + } else if (**sql == SPACE && *data) { *len = *sql - *data; break; } @@ -951,23 +974,24 @@ static void smlParseTelnetElement(const char **sql, const char **data, int32_t * } } -static int32_t smlParseTelnetTags(const char* data, SArray *cols, char *childTableName, SHashObj *dumplicateKey, SSmlMsgBuf *msg){ +static int32_t smlParseTelnetTags(const char *data, SArray *cols, char *childTableName, SHashObj *dumplicateKey, + SSmlMsgBuf *msg) { const char *sql = data; - size_t childTableNameLen = strlen(tsSmlChildTableName); - while(*sql != '\0'){ + size_t childTableNameLen = strlen(tsSmlChildTableName); + while (*sql != '\0') { JUMP_SPACE(sql) - if(*sql == '\0') break; + if (*sql == '\0') break; const char *key = sql; - int32_t keyLen = 0; + int32_t keyLen = 0; // parse key - while(*sql != '\0'){ - if(*sql == SPACE) { + while (*sql != '\0') { + if (*sql == SPACE) { smlBuildInvalidDataMsg(msg, "invalid data", sql); return TSDB_CODE_SML_INVALID_DATA; } - if(*sql == EQUAL) { + if (*sql == EQUAL) { keyLen = sql - key; sql++; break; @@ -975,19 +999,19 @@ static int32_t smlParseTelnetTags(const char* data, SArray *cols, char *childTab sql++; } - if(IS_INVALID_COL_LEN(keyLen)){ + if (IS_INVALID_COL_LEN(keyLen)) { smlBuildInvalidDataMsg(msg, "invalid key or key is too long than 64", key); return TSDB_CODE_SML_INVALID_DATA; } - if(smlCheckDuplicateKey(key, keyLen, dumplicateKey)){ + if (smlCheckDuplicateKey(key, keyLen, dumplicateKey)) { smlBuildInvalidDataMsg(msg, "dumplicate key", key); return TSDB_CODE_TSC_DUP_TAG_NAMES; } // parse value const char *value = sql; - int32_t valueLen = 0; - while(*sql != '\0') { + int32_t valueLen = 0; + while (*sql != '\0') { // parse value if (*sql == SPACE) { break; @@ -1000,13 +1024,13 @@ static int32_t smlParseTelnetTags(const char* data, SArray *cols, char *childTab } valueLen = sql - value; - if(valueLen == 0){ + if (valueLen == 0) { smlBuildInvalidDataMsg(msg, "invalid value", value); return TSDB_CODE_SML_INVALID_DATA; } - //handle child table name - if(childTableNameLen != 0 && strncmp(key, tsSmlChildTableName, keyLen) == 0){ + // handle child table name + if (childTableNameLen != 0 && strncmp(key, tsSmlChildTableName, keyLen) == 0) { memset(childTableName, 0, TSDB_TABLE_NAME_LEN); strncpy(childTableName, value, (valueLen < TSDB_TABLE_NAME_LEN ? valueLen : TSDB_TABLE_NAME_LEN)); continue; @@ -1014,22 +1038,22 @@ static int32_t smlParseTelnetTags(const char* data, SArray *cols, char *childTab // add kv to SSmlKv SSmlKv *kv = (SSmlKv *)taosMemoryCalloc(sizeof(SSmlKv), 1); - if(!kv) return TSDB_CODE_OUT_OF_MEMORY; + if (!kv) return TSDB_CODE_OUT_OF_MEMORY; kv->key = key; kv->keyLen = keyLen; kv->value = value; kv->length = valueLen; kv->type = TSDB_DATA_TYPE_NCHAR; - if(cols) taosArrayPush(cols, &kv); + if (cols) taosArrayPush(cols, &kv); } return TSDB_CODE_SUCCESS; } // format: =[ =] -static int32_t smlParseTelnetString(SSmlHandle *info, const char* sql, SSmlTableInfo *tinfo, SArray *cols){ - if(!sql) return TSDB_CODE_SML_INVALID_DATA; +static int32_t smlParseTelnetString(SSmlHandle *info, const char *sql, SSmlTableInfo *tinfo, SArray *cols) { + if (!sql) return TSDB_CODE_SML_INVALID_DATA; // parse metric smlParseTelnetElement(&sql, &tinfo->sTableName, &tinfo->sTableNameLen); @@ -1040,7 +1064,7 @@ static int32_t smlParseTelnetString(SSmlHandle *info, const char* sql, SSmlTable // parse timestamp const char *timestamp = NULL; - int32_t tLen = 0; + int32_t tLen = 0; smlParseTelnetElement(&sql, ×tamp, &tLen); if (!timestamp || tLen == 0) { smlBuildInvalidDataMsg(&info->msgBuf, "invalid timestamp", sql); @@ -1055,7 +1079,7 @@ static int32_t smlParseTelnetString(SSmlHandle *info, const char* sql, SSmlTable // parse value const char *value = NULL; - int32_t valueLen = 0; + int32_t valueLen = 0; smlParseTelnetElement(&sql, &value, &valueLen); if (!value || valueLen == 0) { smlBuildInvalidDataMsg(&info->msgBuf, "invalid value", sql); @@ -1063,13 +1087,13 @@ static int32_t smlParseTelnetString(SSmlHandle *info, const char* sql, SSmlTable } SSmlKv *kv = (SSmlKv *)taosMemoryCalloc(sizeof(SSmlKv), 1); - if(!kv) return TSDB_CODE_OUT_OF_MEMORY; + if (!kv) return TSDB_CODE_OUT_OF_MEMORY; taosArrayPush(cols, &kv); kv->key = VALUE; kv->keyLen = VALUE_LEN; kv->value = value; kv->length = valueLen; - if(!smlParseValue(kv, &info->msgBuf)){ + if (!smlParseValue(kv, &info->msgBuf)) { return TSDB_CODE_SML_INVALID_DATA; } @@ -1083,24 +1107,25 @@ static int32_t smlParseTelnetString(SSmlHandle *info, const char* sql, SSmlTable return TSDB_CODE_SUCCESS; } -static int32_t smlParseCols(const char* data, int32_t len, SArray *cols, char *childTableName, bool isTag, SHashObj *dumplicateKey, SSmlMsgBuf *msg){ - if(len == 0){ +static int32_t smlParseCols(const char *data, int32_t len, SArray *cols, char *childTableName, bool isTag, + SHashObj *dumplicateKey, SSmlMsgBuf *msg) { + if (len == 0) { return TSDB_CODE_SUCCESS; } - size_t childTableNameLen = strlen(tsSmlChildTableName); + size_t childTableNameLen = strlen(tsSmlChildTableName); const char *sql = data; - while(sql < data + len){ + while (sql < data + len) { const char *key = sql; - int32_t keyLen = 0; + int32_t keyLen = 0; - while(sql < data + len){ + while (sql < data + len) { // parse key - if(IS_COMMA(sql)) { + if (IS_COMMA(sql)) { smlBuildInvalidDataMsg(msg, "invalid data", sql); return TSDB_CODE_SML_INVALID_DATA; } - if(IS_EQUAL(sql)) { + if (IS_EQUAL(sql)) { keyLen = sql - key; sql++; break; @@ -1108,22 +1133,22 @@ static int32_t smlParseCols(const char* data, int32_t len, SArray *cols, char *c sql++; } - if(IS_INVALID_COL_LEN(keyLen)){ + if (IS_INVALID_COL_LEN(keyLen)) { smlBuildInvalidDataMsg(msg, "invalid key or key is too long than 64", key); return TSDB_CODE_SML_INVALID_DATA; } - if(smlCheckDuplicateKey(key, keyLen, dumplicateKey)){ + if (smlCheckDuplicateKey(key, keyLen, dumplicateKey)) { smlBuildInvalidDataMsg(msg, "dumplicate key", key); return TSDB_CODE_TSC_DUP_TAG_NAMES; } // parse value const char *value = sql; - int32_t valueLen = 0; - bool isInQuote = false; - while(sql < data + len) { + int32_t valueLen = 0; + bool isInQuote = false; + while (sql < data + len) { // parse value - if(!isTag && IS_QUOTE(sql)){ + if (!isTag && IS_QUOTE(sql)) { isInQuote = !isInQuote; sql++; continue; @@ -1140,19 +1165,19 @@ static int32_t smlParseCols(const char* data, int32_t len, SArray *cols, char *c valueLen = sql - value; sql++; - if(isInQuote){ + if (isInQuote) { smlBuildInvalidDataMsg(msg, "only one quote", value); return TSDB_CODE_SML_INVALID_DATA; } - if(valueLen == 0){ + if (valueLen == 0) { smlBuildInvalidDataMsg(msg, "invalid value", value); return TSDB_CODE_SML_INVALID_DATA; } PROCESS_SLASH(key, keyLen) PROCESS_SLASH(value, valueLen) - //handle child table name - if(childTableName && childTableNameLen != 0 && strncmp(key, tsSmlChildTableName, keyLen) == 0){ + // handle child table name + if (childTableName && childTableNameLen != 0 && strncmp(key, tsSmlChildTableName, keyLen) == 0) { memset(childTableName, 0, TSDB_TABLE_NAME_LEN); strncpy(childTableName, value, (valueLen < TSDB_TABLE_NAME_LEN ? valueLen : TSDB_TABLE_NAME_LEN)); continue; @@ -1160,17 +1185,17 @@ static int32_t smlParseCols(const char* data, int32_t len, SArray *cols, char *c // add kv to SSmlKv SSmlKv *kv = (SSmlKv *)taosMemoryCalloc(sizeof(SSmlKv), 1); - if(!kv) return TSDB_CODE_OUT_OF_MEMORY; - if(cols) taosArrayPush(cols, &kv); + if (!kv) return TSDB_CODE_OUT_OF_MEMORY; + if (cols) taosArrayPush(cols, &kv); kv->key = key; kv->keyLen = keyLen; kv->value = value; kv->length = valueLen; - if(isTag){ + if (isTag) { kv->type = TSDB_DATA_TYPE_NCHAR; - }else{ - if(!smlParseValue(kv, msg)){ + } else { + if (!smlParseValue(kv, msg)) { return TSDB_CODE_SML_INVALID_DATA; } } @@ -1179,24 +1204,24 @@ static int32_t smlParseCols(const char* data, int32_t len, SArray *cols, char *c return TSDB_CODE_SUCCESS; } -static bool smlUpdateMeta(SHashObj *metaHash, SArray *metaArray, SArray *cols, SSmlMsgBuf *msg){ - for (int i = 0; i < taosArrayGetSize(cols); ++i) { //jump timestamp +static bool smlUpdateMeta(SHashObj *metaHash, SArray *metaArray, SArray *cols, SSmlMsgBuf *msg) { + for (int i = 0; i < taosArrayGetSize(cols); ++i) { // jump timestamp SSmlKv *kv = (SSmlKv *)taosArrayGetP(cols, i); int16_t *index = (int16_t *)taosHashGet(metaHash, kv->key, kv->keyLen); - if(index){ + if (index) { SSmlKv **value = (SSmlKv **)taosArrayGet(metaArray, *index); - if(kv->type != (*value)->type){ + if (kv->type != (*value)->type) { smlBuildInvalidDataMsg(msg, "the type is not the same like before", kv->key); return false; - }else{ - if(IS_VAR_DATA_TYPE(kv->type)){ // update string len, if bigger - if(kv->length > (*value)->length){ + } else { + if (IS_VAR_DATA_TYPE(kv->type)) { // update string len, if bigger + if (kv->length > (*value)->length) { *value = kv; } } } - }else{ + } else { size_t tmp = taosArrayGetSize(metaArray); ASSERT(tmp <= INT16_MAX); int16_t size = tmp; @@ -1208,7 +1233,7 @@ static bool smlUpdateMeta(SHashObj *metaHash, SArray *metaArray, SArray *cols, S return true; } -static void smlInsertMeta(SHashObj *metaHash, SArray *metaArray, SArray *cols){ +static void smlInsertMeta(SHashObj *metaHash, SArray *metaArray, SArray *cols) { for (int16_t i = 0; i < taosArrayGetSize(cols); ++i) { SSmlKv *kv = (SSmlKv *)taosArrayGetP(cols, i); taosArrayPush(metaArray, &kv); @@ -1216,9 +1241,9 @@ static void smlInsertMeta(SHashObj *metaHash, SArray *metaArray, SArray *cols){ } } -static SSmlTableInfo* smlBuildTableInfo(){ +static SSmlTableInfo *smlBuildTableInfo() { SSmlTableInfo *tag = (SSmlTableInfo *)taosMemoryCalloc(sizeof(SSmlTableInfo), 1); - if(!tag){ + if (!tag) { return NULL; } @@ -1240,50 +1265,50 @@ cleanup: return NULL; } -static void smlDestroyTableInfo(SSmlHandle* info, SSmlTableInfo *tag){ - if(info->dataFormat){ - for(size_t i = 0; i < taosArrayGetSize(tag->cols); i++){ +static void smlDestroyTableInfo(SSmlHandle *info, SSmlTableInfo *tag) { + if (info->dataFormat) { + for (size_t i = 0; i < taosArrayGetSize(tag->cols); i++) { SArray *kvArray = (SArray *)taosArrayGetP(tag->cols, i); for (int j = 0; j < taosArrayGetSize(kvArray); ++j) { SSmlKv *p = (SSmlKv *)taosArrayGetP(kvArray, j); - if(info->protocol == TSDB_SML_JSON_PROTOCOL && - (p->type == TSDB_DATA_TYPE_NCHAR || p->type == TSDB_DATA_TYPE_BINARY)){ - taosMemoryFree((void*)p->value); + if (info->protocol == TSDB_SML_JSON_PROTOCOL && + (p->type == TSDB_DATA_TYPE_NCHAR || p->type == TSDB_DATA_TYPE_BINARY)) { + taosMemoryFree((void *)p->value); } taosMemoryFree(p); } taosArrayDestroy(kvArray); } - }else{ - for(size_t i = 0; i < taosArrayGetSize(tag->cols); i++){ + } else { + for (size_t i = 0; i < taosArrayGetSize(tag->cols); i++) { SHashObj *kvHash = (SHashObj *)taosArrayGetP(tag->cols, i); - void** p1 = (void**)taosHashIterate(kvHash, NULL); + void **p1 = (void **)taosHashIterate(kvHash, NULL); while (p1) { taosMemoryFree(*p1); - p1 = (void**)taosHashIterate(kvHash, p1); + p1 = (void **)taosHashIterate(kvHash, p1); } taosHashCleanup(kvHash); } } - for(size_t i = 0; i < taosArrayGetSize(tag->tags); i++){ + for (size_t i = 0; i < taosArrayGetSize(tag->tags); i++) { SSmlKv *p = (SSmlKv *)taosArrayGetP(tag->tags, i); - if(info->protocol == TSDB_SML_JSON_PROTOCOL){ - taosMemoryFree((void*)p->key); - if(p->type == TSDB_DATA_TYPE_NCHAR || p->type == TSDB_DATA_TYPE_BINARY){ - taosMemoryFree((void*)p->value); + if (info->protocol == TSDB_SML_JSON_PROTOCOL) { + taosMemoryFree((void *)p->key); + if (p->type == TSDB_DATA_TYPE_NCHAR || p->type == TSDB_DATA_TYPE_BINARY) { + taosMemoryFree((void *)p->value); } } taosMemoryFree(p); } - if(info->protocol == TSDB_SML_JSON_PROTOCOL && tag->sTableName){ - taosMemoryFree((void*)tag->sTableName); + if (info->protocol == TSDB_SML_JSON_PROTOCOL && tag->sTableName) { + taosMemoryFree((void *)tag->sTableName); } taosArrayDestroy(tag->cols); taosArrayDestroy(tag->tags); taosMemoryFree(tag); } -static int32_t smlKvTimeArrayCompare(const void* key1, const void* key2) { +static int32_t smlKvTimeArrayCompare(const void *key1, const void *key2) { SArray *s1 = *(SArray **)key1; SArray *s2 = *(SArray **)key2; SSmlKv *kv1 = (SSmlKv *)taosArrayGetP(s1, 0); @@ -1299,11 +1324,11 @@ static int32_t smlKvTimeArrayCompare(const void* key1, const void* key2) { } } -static int32_t smlKvTimeHashCompare(const void* key1, const void* key2) { +static int32_t smlKvTimeHashCompare(const void *key1, const void *key2) { SHashObj *s1 = *(SHashObj **)key1; SHashObj *s2 = *(SHashObj **)key2; - SSmlKv *kv1 = (SSmlKv *)taosHashGet(s1, TS, TS_LEN); - SSmlKv *kv2 = (SSmlKv *)taosHashGet(s2, TS, TS_LEN); + SSmlKv *kv1 = (SSmlKv *)taosHashGet(s1, TS, TS_LEN); + SSmlKv *kv2 = (SSmlKv *)taosHashGet(s2, TS, TS_LEN); ASSERT(kv1->type == TSDB_DATA_TYPE_TIMESTAMP); ASSERT(kv2->type == TSDB_DATA_TYPE_TIMESTAMP); if (kv1->i < kv2->i) { @@ -1315,24 +1340,24 @@ static int32_t smlKvTimeHashCompare(const void* key1, const void* key2) { } } -static int32_t smlDealCols(SSmlTableInfo* oneTable, bool dataFormat, SArray *cols){ - if(dataFormat){ +static int32_t smlDealCols(SSmlTableInfo *oneTable, bool dataFormat, SArray *cols) { + if (dataFormat) { void *p = taosArraySearch(oneTable->cols, &cols, smlKvTimeArrayCompare, TD_GE); - if(p == NULL){ + if (p == NULL) { taosArrayPush(oneTable->cols, &cols); - }else{ // to make the sort stable for update data + } else { // to make the sort stable for update data SArray *sa = (SArray *)p; - SSmlKv *cur = (SSmlKv*)taosArrayGet(sa, 0); - SSmlKv *dCur = (SSmlKv*)taosArrayGet(cols, 0); - if(cur->i > dCur->i){ + SSmlKv *cur = (SSmlKv *)taosArrayGet(sa, 0); + SSmlKv *dCur = (SSmlKv *)taosArrayGet(cols, 0); + if (cur->i > dCur->i) { taosArrayInsert(oneTable->cols, TARRAY_ELEM_IDX(oneTable->cols, p), &cols); - }else{ + } else { ASSERT(cur->i == dCur->i); int32_t index = TARRAY_ELEM_IDX(oneTable->cols, p) + 1; - for(; index < taosArrayGetSize(oneTable->cols); index++){ + for (; index < taosArrayGetSize(oneTable->cols); index++) { SArray *tmp = (SArray *)taosArrayGet(oneTable->cols, index); - SSmlKv *curTs = (SSmlKv*)taosArrayGet(tmp, 0); - if(curTs->i > dCur->i){ + SSmlKv *curTs = (SSmlKv *)taosArrayGet(tmp, 0); + if (curTs->i > dCur->i) { break; } } @@ -1343,31 +1368,31 @@ static int32_t smlDealCols(SSmlTableInfo* oneTable, bool dataFormat, SArray *col } SHashObj *kvHash = taosHashInit(32, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_NO_LOCK); - if(!kvHash){ + if (!kvHash) { uError("SML:smlDealCols failed to allocate memory"); return TSDB_CODE_TSC_OUT_OF_MEMORY; } - for(size_t i = 0; i < taosArrayGetSize(cols); i++){ + for (size_t i = 0; i < taosArrayGetSize(cols); i++) { SSmlKv *kv = (SSmlKv *)taosArrayGetP(cols, i); taosHashPut(kvHash, kv->key, kv->keyLen, &kv, POINTER_BYTES); } void *p = taosArraySearch(oneTable->cols, &kvHash, smlKvTimeHashCompare, TD_GE); - if(p == NULL){ + if (p == NULL) { taosArrayPush(oneTable->cols, &kvHash); - }else{ // to make the sort stable for update data + } else { // to make the sort stable for update data SHashObj *sa = (SHashObj *)p; - SSmlKv *cur = (SSmlKv *)taosHashGet(sa, TS, TS_LEN); - SSmlKv *dCur = (SSmlKv*)taosArrayGet(cols, 0); - if(cur->i > dCur->i){ + SSmlKv *cur = (SSmlKv *)taosHashGet(sa, TS, TS_LEN); + SSmlKv *dCur = (SSmlKv *)taosArrayGet(cols, 0); + if (cur->i > dCur->i) { taosArrayInsert(oneTable->cols, TARRAY_ELEM_IDX(oneTable->cols, p), &cols); - }else{ + } else { ASSERT(cur->i == dCur->i); int32_t index = TARRAY_ELEM_IDX(oneTable->cols, p) + 1; - for(; index < taosArrayGetSize(oneTable->cols); index++){ + for (; index < taosArrayGetSize(oneTable->cols); index++) { SHashObj *tmp = (SHashObj *)taosArrayGet(oneTable->cols, index); - SSmlKv *curTs = (SSmlKv *)taosHashGet(tmp, TS, TS_LEN); - if(curTs->i > dCur->i){ + SSmlKv *curTs = (SSmlKv *)taosHashGet(tmp, TS, TS_LEN); + if (curTs->i > dCur->i) { break; } } @@ -1377,9 +1402,9 @@ static int32_t smlDealCols(SSmlTableInfo* oneTable, bool dataFormat, SArray *col return TSDB_CODE_SUCCESS; } -static SSmlSTableMeta* smlBuildSTableMeta(){ - SSmlSTableMeta* meta = (SSmlSTableMeta*)taosMemoryCalloc(sizeof(SSmlSTableMeta), 1); - if(!meta){ +static SSmlSTableMeta *smlBuildSTableMeta() { + SSmlSTableMeta *meta = (SSmlSTableMeta *)taosMemoryCalloc(sizeof(SSmlSTableMeta), 1); + if (!meta) { return NULL; } meta->tagHash = taosHashInit(32, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_NO_LOCK); @@ -1412,7 +1437,7 @@ cleanup: return NULL; } -static void smlDestroySTableMeta(SSmlSTableMeta *meta){ +static void smlDestroySTableMeta(SSmlSTableMeta *meta) { taosHashCleanup(meta->tagHash); taosHashCleanup(meta->colHash); taosArrayDestroy(meta->tags); @@ -1429,95 +1454,94 @@ static void smlDestroyCols(SArray *cols) { } } -static void smlDestroyInfo(SSmlHandle* info){ - if(!info) return; +static void smlDestroyInfo(SSmlHandle *info) { + if (!info) return; qDestroyQuery(info->pQuery); smlDestroyHandle(info->exec); // destroy info->childTables - void** p1 = (void**)taosHashIterate(info->childTables, NULL); + void **p1 = (void **)taosHashIterate(info->childTables, NULL); while (p1) { - smlDestroyTableInfo(info, (SSmlTableInfo*)(*p1)); - p1 = (void**)taosHashIterate(info->childTables, p1); + smlDestroyTableInfo(info, (SSmlTableInfo *)(*p1)); + p1 = (void **)taosHashIterate(info->childTables, p1); } taosHashCleanup(info->childTables); // destroy info->superTables - p1 = (void**)taosHashIterate(info->superTables, NULL); + p1 = (void **)taosHashIterate(info->superTables, NULL); while (p1) { - smlDestroySTableMeta((SSmlSTableMeta*)(*p1)); - p1 = (void**)taosHashIterate(info->superTables, p1); + smlDestroySTableMeta((SSmlSTableMeta *)(*p1)); + p1 = (void **)taosHashIterate(info->superTables, p1); } taosHashCleanup(info->superTables); // destroy info->pVgHash taosHashCleanup(info->pVgHash); taosHashCleanup(info->dumplicateKey); - if(!info->dataFormat){ + if (!info->dataFormat) { taosArrayDestroy(info->colsContainer); } destroyRequest(info->pRequest); taosMemoryFreeClear(info); } -static SSmlHandle* smlBuildSmlInfo(TAOS* taos, SRequestObj* request, SMLProtocolType protocol, int8_t precision){ - int32_t code = TSDB_CODE_SUCCESS; - SSmlHandle* info = (SSmlHandle*)taosMemoryCalloc(1, sizeof(SSmlHandle)); +static SSmlHandle *smlBuildSmlInfo(TAOS *taos, SRequestObj *request, SMLProtocolType protocol, int8_t precision) { + int32_t code = TSDB_CODE_SUCCESS; + SSmlHandle *info = (SSmlHandle *)taosMemoryCalloc(1, sizeof(SSmlHandle)); if (NULL == info) { return NULL; } - info->id = smlGenId(); + info->id = smlGenId(); - info->pQuery = (SQuery *)taosMemoryCalloc(1, sizeof(SQuery)); + info->pQuery = (SQuery *)taosMemoryCalloc(1, sizeof(SQuery)); if (NULL == info->pQuery) { - uError("SML:0x%"PRIx64" create info->pQuery error", info->id); + uError("SML:0x%" PRIx64 " create info->pQuery error", info->id); goto cleanup; } - info->pQuery->execMode = QUERY_EXEC_MODE_SCHEDULE; + info->pQuery->execMode = QUERY_EXEC_MODE_SCHEDULE; info->pQuery->haveResultSet = false; - info->pQuery->msgType = TDMT_VND_SUBMIT; - info->pQuery->pRoot = (SNode*)nodesMakeNode(QUERY_NODE_VNODE_MODIF_STMT); - if(NULL == info->pQuery->pRoot){ - uError("SML:0x%"PRIx64" create info->pQuery->pRoot error", info->id); + info->pQuery->msgType = TDMT_VND_SUBMIT; + info->pQuery->pRoot = (SNode *)nodesMakeNode(QUERY_NODE_VNODE_MODIF_STMT); + if (NULL == info->pQuery->pRoot) { + uError("SML:0x%" PRIx64 " create info->pQuery->pRoot error", info->id); goto cleanup; } - ((SVnodeModifOpStmt*)(info->pQuery->pRoot))->payloadType = PAYLOAD_TYPE_KV; + ((SVnodeModifOpStmt *)(info->pQuery->pRoot))->payloadType = PAYLOAD_TYPE_KV; - info->taos = (STscObj *)taos; + info->taos = (STscObj *)taos; code = catalogGetHandle(info->taos->pAppInfo->clusterId, &info->pCatalog); - if(code != TSDB_CODE_SUCCESS){ - uError("SML:0x%"PRIx64" get catalog error %d", info->id, code); + if (code != TSDB_CODE_SUCCESS) { + uError("SML:0x%" PRIx64 " get catalog error %d", info->id, code); goto cleanup; } - info->precision = precision; - info->protocol = protocol; - if(protocol == TSDB_SML_LINE_PROTOCOL){ + info->precision = precision; + info->protocol = protocol; + if (protocol == TSDB_SML_LINE_PROTOCOL) { info->dataFormat = tsSmlDataFormat; - }else{ + } else { info->dataFormat = true; } - info->pRequest = request; - info->msgBuf.buf = info->pRequest->msgBuf; - info->msgBuf.len = ERROR_MSG_BUF_DEFAULT_SIZE; + info->pRequest = request; + info->msgBuf.buf = info->pRequest->msgBuf; + info->msgBuf.len = ERROR_MSG_BUF_DEFAULT_SIZE; - info->exec = smlInitHandle(info->pQuery); + info->exec = smlInitHandle(info->pQuery); info->childTables = taosHashInit(32, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_NO_LOCK); info->superTables = taosHashInit(32, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_NO_LOCK); - info->pVgHash = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, HASH_NO_LOCK); + info->pVgHash = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, HASH_NO_LOCK); info->dumplicateKey = taosHashInit(32, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_NO_LOCK); - if(!info->dataFormat){ + if (!info->dataFormat) { info->colsContainer = taosArrayInit(32, POINTER_BYTES); - if(NULL == info->colsContainer){ - uError("SML:0x%"PRIx64" create info failed", info->id); + if (NULL == info->colsContainer) { + uError("SML:0x%" PRIx64 " create info failed", info->id); goto cleanup; } } - if(NULL == info->exec || NULL == info->childTables - || NULL == info->superTables || NULL == info->pVgHash - || NULL == info->dumplicateKey){ - uError("SML:0x%"PRIx64" create info failed", info->id); + if (NULL == info->exec || NULL == info->childTables || NULL == info->superTables || NULL == info->pVgHash || + NULL == info->dumplicateKey) { + uError("SML:0x%" PRIx64 " create info failed", info->id); goto cleanup; } @@ -1528,25 +1552,25 @@ cleanup: } /************* TSDB_SML_JSON_PROTOCOL function start **************/ -static int32_t smlJsonCreateSring(const char **output, char *input, int32_t inputLen){ +static int32_t smlJsonCreateSring(const char **output, char *input, int32_t inputLen) { *output = (const char *)taosMemoryMalloc(inputLen); - if (*output == NULL){ + if (*output == NULL) { return TSDB_CODE_TSC_OUT_OF_MEMORY; } - memcpy((void*)(*output), input, inputLen); + memcpy((void *)(*output), input, inputLen); return TSDB_CODE_SUCCESS; } static int32_t smlParseMetricFromJSON(SSmlHandle *info, cJSON *root, SSmlTableInfo *tinfo) { cJSON *metric = cJSON_GetObjectItem(root, "metric"); if (!cJSON_IsString(metric)) { - return TSDB_CODE_TSC_INVALID_JSON; + return TSDB_CODE_TSC_INVALID_JSON; } tinfo->sTableNameLen = strlen(metric->valuestring); if (IS_INVALID_TABLE_LEN(tinfo->sTableNameLen)) { - uError("OTD:0x%"PRIx64" Metric lenght is 0 or large than 192", info->id); + uError("OTD:0x%" PRIx64 " Metric lenght is 0 or large than 192", info->id); return TSDB_CODE_TSC_INVALID_TABLE_ID_LENGTH; } @@ -1570,19 +1594,19 @@ static int32_t smlParseTSFromJSONObj(SSmlHandle *info, cJSON *root, int64_t *tsV } double timeDouble = value->valuedouble; - if(smlDoubleToInt64OverFlow(timeDouble)){ + if (smlDoubleToInt64OverFlow(timeDouble)) { smlBuildInvalidDataMsg(&info->msgBuf, "timestamp is too large", NULL); return TSDB_CODE_TSC_INVALID_TIME_STAMP; } - if(timeDouble <= 0){ + if (timeDouble <= 0) { return TSDB_CODE_TSC_INVALID_TIME_STAMP; } size_t typeLen = strlen(type->valuestring); if (typeLen == 1 && (type->valuestring[0] == 's' || type->valuestring[0] == 'S')) { - //seconds + // seconds timeDouble = timeDouble * 1e9; - if(smlDoubleToInt64OverFlow(timeDouble)){ + if (smlDoubleToInt64OverFlow(timeDouble)) { smlBuildInvalidDataMsg(&info->msgBuf, "timestamp is too large", NULL); return TSDB_CODE_TSC_INVALID_TIME_STAMP; } @@ -1591,9 +1615,9 @@ static int32_t smlParseTSFromJSONObj(SSmlHandle *info, cJSON *root, int64_t *tsV switch (type->valuestring[0]) { case 'm': case 'M': - //milliseconds + // milliseconds timeDouble = timeDouble * 1e6; - if(smlDoubleToInt64OverFlow(timeDouble)){ + if (smlDoubleToInt64OverFlow(timeDouble)) { smlBuildInvalidDataMsg(&info->msgBuf, "timestamp is too large", NULL); return TSDB_CODE_TSC_INVALID_TIME_STAMP; } @@ -1601,9 +1625,9 @@ static int32_t smlParseTSFromJSONObj(SSmlHandle *info, cJSON *root, int64_t *tsV break; case 'u': case 'U': - //microseconds + // microseconds timeDouble = timeDouble * 1e3; - if(smlDoubleToInt64OverFlow(timeDouble)){ + if (smlDoubleToInt64OverFlow(timeDouble)) { smlBuildInvalidDataMsg(&info->msgBuf, "timestamp is too large", NULL); return TSDB_CODE_TSC_INVALID_TIME_STAMP; } @@ -1611,7 +1635,7 @@ static int32_t smlParseTSFromJSONObj(SSmlHandle *info, cJSON *root, int64_t *tsV break; case 'n': case 'N': - //nanoseconds + // nanoseconds *tsVal = timeDouble; break; default: @@ -1634,45 +1658,45 @@ static uint8_t smlGetTimestampLen(int64_t num) { } static int32_t smlParseTSFromJSON(SSmlHandle *info, cJSON *root, SArray *cols) { - //Timestamp must be the first KV to parse + // Timestamp must be the first KV to parse int64_t tsVal = 0; cJSON *timestamp = cJSON_GetObjectItem(root, "timestamp"); if (cJSON_IsNumber(timestamp)) { - //timestamp value 0 indicates current system time + // timestamp value 0 indicates current system time double timeDouble = timestamp->valuedouble; - if(smlDoubleToInt64OverFlow(timeDouble)){ + if (smlDoubleToInt64OverFlow(timeDouble)) { smlBuildInvalidDataMsg(&info->msgBuf, "timestamp is too large", NULL); return TSDB_CODE_TSC_INVALID_TIME_STAMP; } - if(timeDouble < 0){ + if (timeDouble < 0) { return TSDB_CODE_TSC_INVALID_TIME_STAMP; } uint8_t tsLen = smlGetTimestampLen((int64_t)timeDouble); if (tsLen == TSDB_TIME_PRECISION_SEC_DIGITS) { timeDouble = timeDouble * 1e9; - if(smlDoubleToInt64OverFlow(timeDouble)){ + if (smlDoubleToInt64OverFlow(timeDouble)) { smlBuildInvalidDataMsg(&info->msgBuf, "timestamp is too large", NULL); return TSDB_CODE_TSC_INVALID_TIME_STAMP; } tsVal = timeDouble; } else if (tsLen == TSDB_TIME_PRECISION_MILLI_DIGITS) { timeDouble = timeDouble * 1e6; - if(smlDoubleToInt64OverFlow(timeDouble)){ + if (smlDoubleToInt64OverFlow(timeDouble)) { smlBuildInvalidDataMsg(&info->msgBuf, "timestamp is too large", NULL); return TSDB_CODE_TSC_INVALID_TIME_STAMP; } tsVal = timeDouble; - } else if(timeDouble == 0){ + } else if (timeDouble == 0) { tsVal = taosGetTimestampNs(); - }else { + } else { return TSDB_CODE_TSC_INVALID_TIME_STAMP; } } else if (cJSON_IsObject(timestamp)) { int32_t ret = smlParseTSFromJSONObj(info, timestamp, &tsVal); if (ret != TSDB_CODE_SUCCESS) { - uError("SML:0x%"PRIx64" Failed to parse timestamp from JSON Obj", info->id); + uError("SML:0x%" PRIx64 " Failed to parse timestamp from JSON Obj", info->id); return ret; } } else { @@ -1681,7 +1705,7 @@ static int32_t smlParseTSFromJSON(SSmlHandle *info, cJSON *root, SArray *cols) { // add ts to SSmlKv *kv = (SSmlKv *)taosMemoryCalloc(sizeof(SSmlKv), 1); - if(!kv){ + if (!kv) { return TSDB_CODE_OUT_OF_MEMORY; } kv->key = TS; @@ -1689,12 +1713,11 @@ static int32_t smlParseTSFromJSON(SSmlHandle *info, cJSON *root, SArray *cols) { kv->i = tsVal; kv->type = TSDB_DATA_TYPE_TIMESTAMP; kv->length = (int16_t)tDataTypes[kv->type].bytes; - if(cols) taosArrayPush(cols, &kv); + if (cols) taosArrayPush(cols, &kv); return TSDB_CODE_SUCCESS; - } -static int32_t smlConvertJSONBool(SSmlKv *pVal, char* typeStr, cJSON *value) { +static int32_t smlConvertJSONBool(SSmlKv *pVal, char *typeStr, cJSON *value) { if (strcasecmp(typeStr, "bool") != 0) { uError("OTD:invalid type(%s) for JSON Bool", typeStr); return TSDB_CODE_TSC_INVALID_JSON_TYPE; @@ -1706,10 +1729,9 @@ static int32_t smlConvertJSONBool(SSmlKv *pVal, char* typeStr, cJSON *value) { return TSDB_CODE_SUCCESS; } -static int32_t smlConvertJSONNumber(SSmlKv *pVal, char* typeStr, cJSON *value) { - //tinyint - if (strcasecmp(typeStr, "i8") == 0 || - strcasecmp(typeStr, "tinyint") == 0) { +static int32_t smlConvertJSONNumber(SSmlKv *pVal, char *typeStr, cJSON *value) { + // tinyint + if (strcasecmp(typeStr, "i8") == 0 || strcasecmp(typeStr, "tinyint") == 0) { if (!IS_VALID_TINYINT(value->valuedouble)) { uError("OTD:JSON value(%f) cannot fit in type(tinyint)", value->valuedouble); return TSDB_CODE_TSC_VALUE_OUT_OF_RANGE; @@ -1719,9 +1741,8 @@ static int32_t smlConvertJSONNumber(SSmlKv *pVal, char* typeStr, cJSON *value) { pVal->i = value->valuedouble; return TSDB_CODE_SUCCESS; } - //smallint - if (strcasecmp(typeStr, "i16") == 0 || - strcasecmp(typeStr, "smallint") == 0) { + // smallint + if (strcasecmp(typeStr, "i16") == 0 || strcasecmp(typeStr, "smallint") == 0) { if (!IS_VALID_SMALLINT(value->valuedouble)) { uError("OTD:JSON value(%f) cannot fit in type(smallint)", value->valuedouble); return TSDB_CODE_TSC_VALUE_OUT_OF_RANGE; @@ -1731,9 +1752,8 @@ static int32_t smlConvertJSONNumber(SSmlKv *pVal, char* typeStr, cJSON *value) { pVal->i = value->valuedouble; return TSDB_CODE_SUCCESS; } - //int - if (strcasecmp(typeStr, "i32") == 0 || - strcasecmp(typeStr, "int") == 0) { + // int + if (strcasecmp(typeStr, "i32") == 0 || strcasecmp(typeStr, "int") == 0) { if (!IS_VALID_INT(value->valuedouble)) { uError("OTD:JSON value(%f) cannot fit in type(int)", value->valuedouble); return TSDB_CODE_TSC_VALUE_OUT_OF_RANGE; @@ -1743,23 +1763,21 @@ static int32_t smlConvertJSONNumber(SSmlKv *pVal, char* typeStr, cJSON *value) { pVal->i = value->valuedouble; return TSDB_CODE_SUCCESS; } - //bigint - if (strcasecmp(typeStr, "i64") == 0 || - strcasecmp(typeStr, "bigint") == 0) { + // bigint + if (strcasecmp(typeStr, "i64") == 0 || strcasecmp(typeStr, "bigint") == 0) { pVal->type = TSDB_DATA_TYPE_BIGINT; pVal->length = (int16_t)tDataTypes[pVal->type].bytes; - if(value->valuedouble >= (double)INT64_MAX){ + if (value->valuedouble >= (double)INT64_MAX) { pVal->i = INT64_MAX; - }else if(value->valuedouble <= (double)INT64_MIN){ + } else if (value->valuedouble <= (double)INT64_MIN) { pVal->i = INT64_MIN; - }else{ + } else { pVal->i = value->valuedouble; } return TSDB_CODE_SUCCESS; } - //float - if (strcasecmp(typeStr, "f32") == 0 || - strcasecmp(typeStr, "float") == 0) { + // float + if (strcasecmp(typeStr, "f32") == 0 || strcasecmp(typeStr, "float") == 0) { if (!IS_VALID_FLOAT(value->valuedouble)) { uError("OTD:JSON value(%f) cannot fit in type(float)", value->valuedouble); return TSDB_CODE_TSC_VALUE_OUT_OF_RANGE; @@ -1769,21 +1787,20 @@ static int32_t smlConvertJSONNumber(SSmlKv *pVal, char* typeStr, cJSON *value) { pVal->f = value->valuedouble; return TSDB_CODE_SUCCESS; } - //double - if (strcasecmp(typeStr, "f64") == 0 || - strcasecmp(typeStr, "double") == 0) { + // double + if (strcasecmp(typeStr, "f64") == 0 || strcasecmp(typeStr, "double") == 0) { pVal->type = TSDB_DATA_TYPE_DOUBLE; pVal->length = (int16_t)tDataTypes[pVal->type].bytes; pVal->d = value->valuedouble; return TSDB_CODE_SUCCESS; } - //if reach here means type is unsupported + // if reach here means type is unsupported uError("OTD:invalid type(%s) for JSON Number", typeStr); return TSDB_CODE_TSC_INVALID_JSON_TYPE; } -static int32_t smlConvertJSONString(SSmlKv *pVal, char* typeStr, cJSON *value) { +static int32_t smlConvertJSONString(SSmlKv *pVal, char *typeStr, cJSON *value) { if (strcasecmp(typeStr, "binary") == 0) { pVal->type = TSDB_DATA_TYPE_BINARY; } else if (strcasecmp(typeStr, "nchar") == 0) { @@ -1864,7 +1881,7 @@ static int32_t smlParseValueFromJSON(cJSON *root, SSmlKv *kv) { * user configured parameter tsDefaultJSONStrType */ - char *tsDefaultJSONStrType = "nchar"; //todo + char *tsDefaultJSONStrType = "nchar"; // todo smlConvertJSONString(kv, tsDefaultJSONStrType, root); break; } @@ -1890,10 +1907,10 @@ static int32_t smlParseColsFromJSON(cJSON *root, SArray *cols) { } SSmlKv *kv = (SSmlKv *)taosMemoryCalloc(sizeof(SSmlKv), 1); - if(!kv){ + if (!kv) { return TSDB_CODE_OUT_OF_MEMORY; } - if(cols) taosArrayPush(cols, &kv); + if (cols) taosArrayPush(cols, &kv); kv->key = VALUE; kv->keyLen = VALUE_LEN; @@ -1904,7 +1921,8 @@ static int32_t smlParseColsFromJSON(cJSON *root, SArray *cols) { return TSDB_CODE_SUCCESS; } -static int32_t smlParseTagsFromJSON(cJSON *root, SArray *pKVs, char *childTableName, SHashObj *dumplicateKey, SSmlMsgBuf *msg) { +static int32_t smlParseTagsFromJSON(cJSON *root, SArray *pKVs, char *childTableName, SHashObj *dumplicateKey, + SSmlMsgBuf *msg) { int32_t ret = TSDB_CODE_SUCCESS; cJSON *tags = cJSON_GetObjectItem(root, "tags"); @@ -1912,7 +1930,7 @@ static int32_t smlParseTagsFromJSON(cJSON *root, SArray *pKVs, char *childTableN return TSDB_CODE_TSC_INVALID_JSON; } - size_t childTableNameLen = strlen(tsSmlChildTableName); + size_t childTableNameLen = strlen(tsSmlChildTableName); int32_t tagNum = cJSON_GetArraySize(tags); for (int32_t i = 0; i < tagNum; ++i) { cJSON *tag = cJSON_GetArrayItem(tags, i); @@ -1924,13 +1942,13 @@ static int32_t smlParseTagsFromJSON(cJSON *root, SArray *pKVs, char *childTableN uError("OTD:Tag key length is 0 or too large than 64"); return TSDB_CODE_TSC_INVALID_COLUMN_LENGTH; } - //check duplicate keys + // check duplicate keys if (smlCheckDuplicateKey(tag->string, keyLen, dumplicateKey)) { return TSDB_CODE_TSC_DUP_TAG_NAMES; } - //handle child table name - if(childTableNameLen != 0 && strcmp(tag->string, tsSmlChildTableName) == 0){ + // handle child table name + if (childTableNameLen != 0 && strcmp(tag->string, tsSmlChildTableName) == 0) { if (!cJSON_IsString(tag)) { uError("OTD:ID must be JSON string"); return TSDB_CODE_TSC_INVALID_JSON; @@ -1942,16 +1960,16 @@ static int32_t smlParseTagsFromJSON(cJSON *root, SArray *pKVs, char *childTableN // add kv to SSmlKv SSmlKv *kv = (SSmlKv *)taosMemoryCalloc(sizeof(SSmlKv), 1); - if(!kv) return TSDB_CODE_OUT_OF_MEMORY; - if(pKVs) taosArrayPush(pKVs, &kv); + if (!kv) return TSDB_CODE_OUT_OF_MEMORY; + if (pKVs) taosArrayPush(pKVs, &kv); - //key + // key kv->keyLen = keyLen; ret = smlJsonCreateSring(&kv->key, tag->string, kv->keyLen); if (ret != TSDB_CODE_SUCCESS) { return ret; } - //value + // value ret = smlParseValueFromJSON(tag, kv); if (ret != TSDB_CODE_SUCCESS) { return ret; @@ -1959,105 +1977,103 @@ static int32_t smlParseTagsFromJSON(cJSON *root, SArray *pKVs, char *childTableN } return ret; - } static int32_t smlParseJSONString(SSmlHandle *info, cJSON *root, SSmlTableInfo *tinfo, SArray *cols) { int32_t ret = TSDB_CODE_SUCCESS; if (!cJSON_IsObject(root)) { - uError("OTD:0x%"PRIx64" data point needs to be JSON object", info->id); + uError("OTD:0x%" PRIx64 " data point needs to be JSON object", info->id); return TSDB_CODE_TSC_INVALID_JSON; } int32_t size = cJSON_GetArraySize(root); - //outmost json fields has to be exactly 4 + // outmost json fields has to be exactly 4 if (size != OTD_JSON_FIELDS_NUM) { - uError("OTD:0x%"PRIx64" Invalid number of JSON fields in data point %d", info->id, size); + uError("OTD:0x%" PRIx64 " Invalid number of JSON fields in data point %d", info->id, size); return TSDB_CODE_TSC_INVALID_JSON; } - //Parse metric + // Parse metric ret = smlParseMetricFromJSON(info, root, tinfo); if (ret != TSDB_CODE_SUCCESS) { - uError("OTD:0x%"PRIx64" Unable to parse metric from JSON payload", info->id); + uError("OTD:0x%" PRIx64 " Unable to parse metric from JSON payload", info->id); return ret; } - uDebug("OTD:0x%"PRIx64" Parse metric from JSON payload finished", info->id); + uDebug("OTD:0x%" PRIx64 " Parse metric from JSON payload finished", info->id); - //Parse timestamp + // Parse timestamp ret = smlParseTSFromJSON(info, root, cols); if (ret) { - uError("OTD:0x%"PRIx64" Unable to parse timestamp from JSON payload", info->id); + uError("OTD:0x%" PRIx64 " Unable to parse timestamp from JSON payload", info->id); return ret; } - uDebug("OTD:0x%"PRIx64" Parse timestamp from JSON payload finished", info->id); + uDebug("OTD:0x%" PRIx64 " Parse timestamp from JSON payload finished", info->id); - //Parse metric value + // Parse metric value ret = smlParseColsFromJSON(root, cols); if (ret) { - uError("OTD:0x%"PRIx64" Unable to parse metric value from JSON payload", info->id); + uError("OTD:0x%" PRIx64 " Unable to parse metric value from JSON payload", info->id); return ret; } - uDebug("OTD:0x%"PRIx64" Parse metric value from JSON payload finished", info->id); + uDebug("OTD:0x%" PRIx64 " Parse metric value from JSON payload finished", info->id); - //Parse tags + // Parse tags ret = smlParseTagsFromJSON(root, tinfo->tags, tinfo->childTableName, info->dumplicateKey, &info->msgBuf); if (ret) { - uError("OTD:0x%"PRIx64" Unable to parse tags from JSON payload", info->id); + uError("OTD:0x%" PRIx64 " Unable to parse tags from JSON payload", info->id); return ret; } - uDebug("OTD:0x%"PRIx64" Parse tags from JSON payload finished", info->id); + uDebug("OTD:0x%" PRIx64 " Parse tags from JSON payload finished", info->id); return TSDB_CODE_SUCCESS; } /************* TSDB_SML_JSON_PROTOCOL function end **************/ - - -static int32_t smlParseInfluxLine(SSmlHandle* info, const char* sql) { +static int32_t smlParseInfluxLine(SSmlHandle *info, const char *sql) { SSmlLineInfo elements = {0}; - int ret = smlParseInfluxString(sql, &elements, &info->msgBuf); - if(ret != TSDB_CODE_SUCCESS){ - uError("SML:0x%"PRIx64" smlParseInfluxLine failed", info->id); + int ret = smlParseInfluxString(sql, &elements, &info->msgBuf); + if (ret != TSDB_CODE_SUCCESS) { + uError("SML:0x%" PRIx64 " smlParseInfluxLine failed", info->id); return ret; } SArray *cols = NULL; - if(info->dataFormat){ // if dataFormat, cols need new memory to save data + if (info->dataFormat) { // if dataFormat, cols need new memory to save data cols = taosArrayInit(16, POINTER_BYTES); if (cols == NULL) { - uError("SML:0x%"PRIx64" smlParseInfluxLine failed to allocate memory", info->id); + uError("SML:0x%" PRIx64 " smlParseInfluxLine failed to allocate memory", info->id); return TSDB_CODE_TSC_OUT_OF_MEMORY; } - }else{ // if dataFormat is false, cols do not need to save data, there is another new memory to save data + } else { // if dataFormat is false, cols do not need to save data, there is another new memory to save data cols = info->colsContainer; } ret = smlParseTS(info, elements.timestamp, elements.timestampLen, cols); - if(ret != TSDB_CODE_SUCCESS){ - uError("SML:0x%"PRIx64" smlParseTS failed", info->id); - if(info->dataFormat) taosArrayDestroy(cols); + if (ret != TSDB_CODE_SUCCESS) { + uError("SML:0x%" PRIx64 " smlParseTS failed", info->id); + if (info->dataFormat) taosArrayDestroy(cols); return ret; } ret = smlParseCols(elements.cols, elements.colsLen, cols, NULL, false, info->dumplicateKey, &info->msgBuf); - if(ret != TSDB_CODE_SUCCESS){ - uError("SML:0x%"PRIx64" smlParseCols parse cloums fields failed", info->id); + if (ret != TSDB_CODE_SUCCESS) { + uError("SML:0x%" PRIx64 " smlParseCols parse cloums fields failed", info->id); smlDestroyCols(cols); - if(info->dataFormat) taosArrayDestroy(cols); + if (info->dataFormat) taosArrayDestroy(cols); return ret; } - if(taosArrayGetSize(cols) > TSDB_MAX_COLUMNS){ + if (taosArrayGetSize(cols) > TSDB_MAX_COLUMNS) { smlBuildInvalidDataMsg(&info->msgBuf, "too many columns than 4096", NULL); return TSDB_CODE_SML_INVALID_DATA; } - bool hasTable = true; - SSmlTableInfo *tinfo = NULL; - SSmlTableInfo **oneTable = (SSmlTableInfo **)taosHashGet(info->childTables, elements.measure, elements.measureTagsLen); - if(!oneTable){ + bool hasTable = true; + SSmlTableInfo *tinfo = NULL; + SSmlTableInfo **oneTable = + (SSmlTableInfo **)taosHashGet(info->childTables, elements.measure, elements.measureTagsLen); + if (!oneTable) { tinfo = smlBuildTableInfo(); - if(!tinfo){ + if (!tinfo) { return TSDB_CODE_TSC_OUT_OF_MEMORY; } taosHashPut(info->childTables, elements.measure, elements.measureTagsLen, &tinfo, POINTER_BYTES); @@ -2066,89 +2082,89 @@ static int32_t smlParseInfluxLine(SSmlHandle* info, const char* sql) { } ret = smlDealCols(*oneTable, info->dataFormat, cols); - if(ret != TSDB_CODE_SUCCESS){ + if (ret != TSDB_CODE_SUCCESS) { return ret; } - if(!hasTable){ - ret = smlParseCols(elements.tags, elements.tagsLen, (*oneTable)->tags, (*oneTable)->childTableName, true, info->dumplicateKey, &info->msgBuf); - if(ret != TSDB_CODE_SUCCESS){ - uError("SML:0x%"PRIx64" smlParseCols parse tag fields failed", info->id); + if (!hasTable) { + ret = smlParseCols(elements.tags, elements.tagsLen, (*oneTable)->tags, (*oneTable)->childTableName, true, + info->dumplicateKey, &info->msgBuf); + if (ret != TSDB_CODE_SUCCESS) { + uError("SML:0x%" PRIx64 " smlParseCols parse tag fields failed", info->id); return ret; } - if(taosArrayGetSize((*oneTable)->tags) > TSDB_MAX_TAGS){ + if (taosArrayGetSize((*oneTable)->tags) > TSDB_MAX_TAGS) { smlBuildInvalidDataMsg(&info->msgBuf, "too many tags than 128", NULL); return TSDB_CODE_SML_INVALID_DATA; } (*oneTable)->sTableName = elements.measure; (*oneTable)->sTableNameLen = elements.measureLen; - if(strlen((*oneTable)->childTableName) == 0){ - RandTableName rName = { (*oneTable)->tags, (*oneTable)->sTableName, (uint8_t)(*oneTable)->sTableNameLen, - (*oneTable)->childTableName, 0 }; + if (strlen((*oneTable)->childTableName) == 0) { + RandTableName rName = {(*oneTable)->tags, (*oneTable)->sTableName, (uint8_t)(*oneTable)->sTableNameLen, + (*oneTable)->childTableName, 0}; buildChildTableName(&rName); (*oneTable)->uid = rName.uid; - }else{ - (*oneTable)->uid = *(uint64_t*)((*oneTable)->childTableName); + } else { + (*oneTable)->uid = *(uint64_t *)((*oneTable)->childTableName); } - } - SSmlSTableMeta** tableMeta = (SSmlSTableMeta**)taosHashGet(info->superTables, elements.measure, elements.measureLen); - if(tableMeta){ // update meta + SSmlSTableMeta **tableMeta = (SSmlSTableMeta **)taosHashGet(info->superTables, elements.measure, elements.measureLen); + if (tableMeta) { // update meta ret = smlUpdateMeta((*tableMeta)->colHash, (*tableMeta)->cols, cols, &info->msgBuf); - if(!hasTable && ret){ + if (!hasTable && ret) { ret = smlUpdateMeta((*tableMeta)->tagHash, (*tableMeta)->tags, (*oneTable)->tags, &info->msgBuf); } - if(!ret){ - uError("SML:0x%"PRIx64" smlUpdateMeta failed", info->id); + if (!ret) { + uError("SML:0x%" PRIx64 " smlUpdateMeta failed", info->id); return TSDB_CODE_SML_INVALID_DATA; } - }else{ + } else { SSmlSTableMeta *meta = smlBuildSTableMeta(); smlInsertMeta(meta->tagHash, meta->tags, (*oneTable)->tags); smlInsertMeta(meta->colHash, meta->cols, cols); taosHashPut(info->superTables, elements.measure, elements.measureLen, &meta, POINTER_BYTES); } - if(!info->dataFormat){ + if (!info->dataFormat) { taosArrayClear(info->colsContainer); } taosHashClear(info->dumplicateKey); return TSDB_CODE_SUCCESS; } -static int32_t smlParseTelnetLine(SSmlHandle* info, void *data) { - int ret = TSDB_CODE_SUCCESS; +static int32_t smlParseTelnetLine(SSmlHandle *info, void *data) { + int ret = TSDB_CODE_SUCCESS; SSmlTableInfo *tinfo = smlBuildTableInfo(); - if(!tinfo){ + if (!tinfo) { return TSDB_CODE_TSC_OUT_OF_MEMORY; } SArray *cols = taosArrayInit(16, POINTER_BYTES); if (cols == NULL) { - uError("SML:0x%"PRIx64" smlParseTelnetLine failed to allocate memory", info->id); + uError("SML:0x%" PRIx64 " smlParseTelnetLine failed to allocate memory", info->id); return TSDB_CODE_TSC_OUT_OF_MEMORY; } - if(info->protocol == TSDB_SML_TELNET_PROTOCOL){ - ret = smlParseTelnetString(info, (const char*)data, tinfo, cols); - }else if(info->protocol == TSDB_SML_JSON_PROTOCOL){ + if (info->protocol == TSDB_SML_TELNET_PROTOCOL) { + ret = smlParseTelnetString(info, (const char *)data, tinfo, cols); + } else if (info->protocol == TSDB_SML_JSON_PROTOCOL) { ret = smlParseJSONString(info, (cJSON *)data, tinfo, cols); - }else{ + } else { ASSERT(0); } - if(ret != TSDB_CODE_SUCCESS){ - uError("SML:0x%"PRIx64" smlParseTelnetLine failed", info->id); + if (ret != TSDB_CODE_SUCCESS) { + uError("SML:0x%" PRIx64 " smlParseTelnetLine failed", info->id); smlDestroyTableInfo(info, tinfo); smlDestroyCols(cols); taosArrayDestroy(cols); return ret; } - if(taosArrayGetSize(tinfo->tags) <= 0 || taosArrayGetSize(tinfo->tags) > TSDB_MAX_TAGS){ + if (taosArrayGetSize(tinfo->tags) <= 0 || taosArrayGetSize(tinfo->tags) > TSDB_MAX_TAGS) { smlBuildInvalidDataMsg(&info->msgBuf, "invalidate tags length:[1,128]", NULL); smlDestroyTableInfo(info, tinfo); smlDestroyCols(cols); @@ -2157,38 +2173,38 @@ static int32_t smlParseTelnetLine(SSmlHandle* info, void *data) { } taosHashClear(info->dumplicateKey); - if(strlen(tinfo->childTableName) == 0){ - RandTableName rName = { tinfo->tags, tinfo->sTableName, (uint8_t)tinfo->sTableNameLen, - tinfo->childTableName, 0 }; + if (strlen(tinfo->childTableName) == 0) { + RandTableName rName = {tinfo->tags, tinfo->sTableName, (uint8_t)tinfo->sTableNameLen, tinfo->childTableName, 0}; buildChildTableName(&rName); tinfo->uid = rName.uid; - }else{ - tinfo->uid = *(uint64_t*)(tinfo->childTableName); // generate uid by name simple + } else { + tinfo->uid = *(uint64_t *)(tinfo->childTableName); // generate uid by name simple } - - bool hasTable = true; - SSmlTableInfo **oneTable = (SSmlTableInfo **)taosHashGet(info->childTables, tinfo->childTableName, strlen(tinfo->childTableName)); - if(!oneTable) { + bool hasTable = true; + SSmlTableInfo **oneTable = + (SSmlTableInfo **)taosHashGet(info->childTables, tinfo->childTableName, strlen(tinfo->childTableName)); + if (!oneTable) { taosHashPut(info->childTables, tinfo->childTableName, strlen(tinfo->childTableName), &tinfo, POINTER_BYTES); oneTable = &tinfo; hasTable = false; - }else{ + } else { smlDestroyTableInfo(info, tinfo); } taosArrayPush((*oneTable)->cols, &cols); - SSmlSTableMeta** tableMeta = (SSmlSTableMeta** )taosHashGet(info->superTables, (*oneTable)->sTableName, (*oneTable)->sTableNameLen); - if(tableMeta){ // update meta + SSmlSTableMeta **tableMeta = + (SSmlSTableMeta **)taosHashGet(info->superTables, (*oneTable)->sTableName, (*oneTable)->sTableNameLen); + if (tableMeta) { // update meta ret = smlUpdateMeta((*tableMeta)->colHash, (*tableMeta)->cols, cols, &info->msgBuf); - if(!hasTable && ret){ + if (!hasTable && ret) { ret = smlUpdateMeta((*tableMeta)->tagHash, (*tableMeta)->tags, (*oneTable)->tags, &info->msgBuf); } - if(!ret){ - uError("SML:0x%"PRIx64" smlUpdateMeta failed", info->id); + if (!ret) { + uError("SML:0x%" PRIx64 " smlUpdateMeta failed", info->id); return TSDB_CODE_SML_INVALID_DATA; } - }else{ + } else { SSmlSTableMeta *meta = smlBuildSTableMeta(); smlInsertMeta(meta->tagHash, meta->tags, (*oneTable)->tags); smlInsertMeta(meta->colHash, meta->cols, cols); @@ -2198,27 +2214,27 @@ static int32_t smlParseTelnetLine(SSmlHandle* info, void *data) { return TSDB_CODE_SUCCESS; } -static int32_t smlParseJSON(SSmlHandle *info, char* payload) { +static int32_t smlParseJSON(SSmlHandle *info, char *payload) { int32_t payloadNum = 0; int32_t ret = TSDB_CODE_SUCCESS; if (payload == NULL) { - uError("SML:0x%"PRIx64" empty JSON Payload", info->id); + uError("SML:0x%" PRIx64 " empty JSON Payload", info->id); return TSDB_CODE_TSC_INVALID_JSON; } cJSON *root = cJSON_Parse(payload); if (root == NULL) { - uError("SML:0x%"PRIx64" parse json failed:%s", info->id, payload); + uError("SML:0x%" PRIx64 " parse json failed:%s", info->id, payload); return TSDB_CODE_TSC_INVALID_JSON; } - //multiple data points must be sent in JSON array + // multiple data points must be sent in JSON array if (cJSON_IsObject(root)) { payloadNum = 1; } else if (cJSON_IsArray(root)) { payloadNum = cJSON_GetArraySize(root); } else { - uError("SML:0x%"PRIx64" Invalid JSON Payload", info->id); + uError("SML:0x%" PRIx64 " Invalid JSON Payload", info->id); ret = TSDB_CODE_TSC_INVALID_JSON; goto end; } @@ -2226,8 +2242,8 @@ static int32_t smlParseJSON(SSmlHandle *info, char* payload) { for (int32_t i = 0; i < payloadNum; ++i) { cJSON *dataPoint = (payloadNum == 1 && cJSON_IsObject(root)) ? root : cJSON_GetArrayItem(root, i); ret = smlParseTelnetLine(info, dataPoint); - if(ret != TSDB_CODE_SUCCESS){ - uError("SML:0x%"PRIx64" Invalid JSON Payload", info->id); + if (ret != TSDB_CODE_SUCCESS) { + uError("SML:0x%" PRIx64 " Invalid JSON Payload", info->id); goto end; } } @@ -2237,12 +2253,12 @@ end: return ret; } -static int32_t smlInsertData(SSmlHandle* info) { +static int32_t smlInsertData(SSmlHandle *info) { int32_t code = TSDB_CODE_SUCCESS; - SSmlTableInfo** oneTable = (SSmlTableInfo**)taosHashIterate(info->childTables, NULL); + SSmlTableInfo **oneTable = (SSmlTableInfo **)taosHashIterate(info->childTables, NULL); while (oneTable) { - SSmlTableInfo* tableData = *oneTable; + SSmlTableInfo *tableData = *oneTable; SName pName = {TSDB_TABLE_NAME_T, info->taos->acctId, {0}, {0}}; strcpy(pName.dbname, info->pRequest->pDb); @@ -2253,56 +2269,59 @@ static int32_t smlInsertData(SSmlHandle* info) { conn.requestId = info->pRequest->requestId; conn.requestObjRefId = info->pRequest->self; conn.mgmtEps = getEpSet_s(&info->taos->pAppInfo->mgmtEp); - + SVgroupInfo vg; code = catalogGetTableHashVgroup(info->pCatalog, &conn, &pName, &vg); if (code != TSDB_CODE_SUCCESS) { - uError("SML:0x%"PRIx64" catalogGetTableHashVgroup failed. table name: %s", info->id, tableData->childTableName); + uError("SML:0x%" PRIx64 " catalogGetTableHashVgroup failed. table name: %s", info->id, tableData->childTableName); return code; } - taosHashPut(info->pVgHash, (const char*)&vg.vgId, sizeof(vg.vgId), (char*)&vg, sizeof(vg)); + taosHashPut(info->pVgHash, (const char *)&vg.vgId, sizeof(vg.vgId), (char *)&vg, sizeof(vg)); - SSmlSTableMeta** pMeta = (SSmlSTableMeta** )taosHashGet(info->superTables, tableData->sTableName, tableData->sTableNameLen); - ASSERT (NULL != pMeta && NULL != *pMeta); + SSmlSTableMeta **pMeta = + (SSmlSTableMeta **)taosHashGet(info->superTables, tableData->sTableName, tableData->sTableNameLen); + ASSERT(NULL != pMeta && NULL != *pMeta); // use tablemeta of stable to save vgid and uid of child table (*pMeta)->tableMeta->vgId = vg.vgId; - (*pMeta)->tableMeta->uid = tableData->uid; // one table merge data block together according uid + (*pMeta)->tableMeta->uid = tableData->uid; // one table merge data block together according uid code = smlBindData(info->exec, tableData->tags, (*pMeta)->cols, tableData->cols, info->dataFormat, (*pMeta)->tableMeta, tableData->childTableName, info->msgBuf.buf, info->msgBuf.len); - if(code != TSDB_CODE_SUCCESS){ - uError("SML:0x%"PRIx64" smlBindData failed", info->id); + if (code != TSDB_CODE_SUCCESS) { + uError("SML:0x%" PRIx64 " smlBindData failed", info->id); return code; } - oneTable = (SSmlTableInfo**)taosHashIterate(info->childTables, oneTable); + oneTable = (SSmlTableInfo **)taosHashIterate(info->childTables, oneTable); } code = smlBuildOutput(info->exec, info->pVgHash); if (code != TSDB_CODE_SUCCESS) { - uError("SML:0x%"PRIx64" smlBuildOutput failed", info->id); + uError("SML:0x%" PRIx64 " smlBuildOutput failed", info->id); return code; } info->cost.insertRpcTime = taosGetTimestampUs(); - //launchQueryImpl(info->pRequest, info->pQuery, false, NULL); -// info->affectedRows = taos_affected_rows(info->pRequest); -// return info->pRequest->code; + // launchQueryImpl(info->pRequest, info->pQuery, false, NULL); + // info->affectedRows = taos_affected_rows(info->pRequest); + // return info->pRequest->code; launchAsyncQuery(info->pRequest, info->pQuery); return TSDB_CODE_SUCCESS; } -static void smlPrintStatisticInfo(SSmlHandle *info){ - uError("SML:0x%"PRIx64" smlInsertLines result, code:%d,lineNum:%d,stable num:%d,ctable num:%d,create stable num:%d \ - parse cost:%"PRId64",schema cost:%"PRId64",bind cost:%"PRId64",rpc cost:%"PRId64",total cost:%"PRId64"", info->id, info->cost.code, - info->cost.lineNum, info->cost.numOfSTables, info->cost.numOfCTables, info->cost.numOfCreateSTables, - info->cost.schemaTime-info->cost.parseTime, info->cost.insertBindTime-info->cost.schemaTime, - info->cost.insertRpcTime-info->cost.insertBindTime, info->cost.endTime-info->cost.insertRpcTime, - info->cost.endTime-info->cost.parseTime); +static void smlPrintStatisticInfo(SSmlHandle *info) { + uError("SML:0x%" PRIx64 + " smlInsertLines result, code:%d,lineNum:%d,stable num:%d,ctable num:%d,create stable num:%d \ + parse cost:%" PRId64 ",schema cost:%" PRId64 ",bind cost:%" PRId64 ",rpc cost:%" PRId64 ",total cost:%" PRId64 + "", + info->id, info->cost.code, info->cost.lineNum, info->cost.numOfSTables, info->cost.numOfCTables, + info->cost.numOfCreateSTables, info->cost.schemaTime - info->cost.parseTime, + info->cost.insertBindTime - info->cost.schemaTime, info->cost.insertRpcTime - info->cost.insertBindTime, + info->cost.endTime - info->cost.insertRpcTime, info->cost.endTime - info->cost.parseTime); } -static int32_t smlParseLine(SSmlHandle *info, char* lines[], int numLines){ +static int32_t smlParseLine(SSmlHandle *info, char *lines[], int numLines) { int32_t code = TSDB_CODE_SUCCESS; if (info->protocol == TSDB_SML_JSON_PROTOCOL) { code = smlParseJSON(info, *lines); @@ -2314,11 +2333,11 @@ static int32_t smlParseLine(SSmlHandle *info, char* lines[], int numLines){ } for (int32_t i = 0; i < numLines; ++i) { - if(info->protocol == TSDB_SML_LINE_PROTOCOL){ + if (info->protocol == TSDB_SML_LINE_PROTOCOL) { code = smlParseInfluxLine(info, lines[i]); - }else if(info->protocol == TSDB_SML_TELNET_PROTOCOL){ + } else if (info->protocol == TSDB_SML_TELNET_PROTOCOL) { code = smlParseTelnetLine(info, lines[i]); - }else{ + } else { ASSERT(0); } if (code != TSDB_CODE_SUCCESS) { @@ -2329,7 +2348,7 @@ static int32_t smlParseLine(SSmlHandle *info, char* lines[], int numLines){ return code; } -static int smlProcess(SSmlHandle *info, char* lines[], int numLines) { +static int smlProcess(SSmlHandle *info, char *lines[], int numLines) { int32_t code = TSDB_CODE_SUCCESS; int32_t retryNum = 0; @@ -2337,7 +2356,7 @@ static int smlProcess(SSmlHandle *info, char* lines[], int numLines) { code = smlParseLine(info, lines, numLines); if (code != 0) { - uError("SML:0x%"PRIx64" smlParseLine error : %s", info->id, tstrerror(code)); + uError("SML:0x%" PRIx64 " smlParseLine error : %s", info->id, tstrerror(code)); return code; } @@ -2347,35 +2366,35 @@ static int smlProcess(SSmlHandle *info, char* lines[], int numLines) { info->cost.schemaTime = taosGetTimestampUs(); - do{ + do { code = smlModifyDBSchemas(info); if (code == 0) break; } while (retryNum++ < taosHashGetSize(info->superTables) * MAX_RETRY_TIMES); if (code != 0) { - uError("SML:0x%"PRIx64" smlModifyDBSchemas error : %s", info->id, tstrerror(code)); + uError("SML:0x%" PRIx64 " smlModifyDBSchemas error : %s", info->id, tstrerror(code)); return code; } info->cost.insertBindTime = taosGetTimestampUs(); code = smlInsertData(info); if (code != 0) { - uError("SML:0x%"PRIx64" smlInsertData error : %s", info->id, tstrerror(code)); + uError("SML:0x%" PRIx64 " smlInsertData error : %s", info->id, tstrerror(code)); return code; } return code; } -static int32_t isSchemalessDb(STscObj *taos, SRequestObj* request){ - SCatalog* catalog = NULL; - int32_t code = catalogGetHandle(((STscObj *)taos)->pAppInfo->clusterId, &catalog); - if(code != TSDB_CODE_SUCCESS){ +static int32_t isSchemalessDb(STscObj *taos, SRequestObj *request) { + SCatalog *catalog = NULL; + int32_t code = catalogGetHandle(((STscObj *)taos)->pAppInfo->clusterId, &catalog); + if (code != TSDB_CODE_SUCCESS) { uError("SML get catalog error %d", code); return code; } - SName name; + SName name; tNameSetDbName(&name, taos->acctId, taos->db, strlen(taos->db)); char dbFname[TSDB_DB_FNAME_LEN] = {0}; tNameGetFullDbName(&name, dbFname); @@ -2392,20 +2411,20 @@ static int32_t isSchemalessDb(STscObj *taos, SRequestObj* request){ return code; } taosArrayDestroy(pInfo.pRetensions); - - if (!pInfo.schemaless){ + + if (!pInfo.schemaless) { return TSDB_CODE_SML_INVALID_DB_CONF; } return TSDB_CODE_SUCCESS; } -static void smlInsertCallback(void* param, void* res, int32_t code) { +static void smlInsertCallback(void *param, void *res, int32_t code) { SRequestObj *pRequest = (SRequestObj *)res; - SSmlHandle* info = (SSmlHandle *)param; + SSmlHandle *info = (SSmlHandle *)param; - uDebug("SML:0x%"PRIx64" result. code:%d, msg:%s", info->id, pRequest->code, pRequest->msgBuf); + uDebug("SML:0x%" PRIx64 " result. code:%d, msg:%s", info->id, pRequest->code, pRequest->msgBuf); // lock - if(code != TSDB_CODE_SUCCESS){ + if (code != TSDB_CODE_SUCCESS) { taosThreadSpinLock(&info->params->lock); info->params->request->code = code; taosThreadSpinUnlock(&info->params->lock); @@ -2414,13 +2433,13 @@ static void smlInsertCallback(void* param, void* res, int32_t code) { printf("SML:0x%" PRIx64 " insert finished, code: %d, total: %d\n", info->id, code, info->affectedRows); Params *pParam = info->params; - bool isLast = info->isLast; + bool isLast = info->isLast; info->cost.endTime = taosGetTimestampUs(); info->cost.code = code; smlPrintStatisticInfo(info); smlDestroyInfo(info); - if(isLast){ + if (isLast) { tsem_post(&pParam->sem); } } @@ -2446,9 +2465,9 @@ static void smlInsertCallback(void* param, void* res, int32_t code) { * */ -TAOS_RES* taos_schemaless_insert(TAOS* taos, char* lines[], int numLines, int protocol, int precision) { - SRequestObj* request = (SRequestObj*)createRequest((STscObj *)taos, TSDB_SQL_INSERT); - if(!request){ +TAOS_RES *taos_schemaless_insert(TAOS *taos, char *lines[], int numLines, int protocol, int precision) { + SRequestObj *request = (SRequestObj *)createRequest((STscObj *)taos, TSDB_SQL_INSERT); + if (!request) { uError("SML:taos_schemaless_insert error request is null"); return NULL; } @@ -2456,19 +2475,19 @@ TAOS_RES* taos_schemaless_insert(TAOS* taos, char* lines[], int numLines, int pr ((STscObj *)taos)->schemalessType = 1; SSmlMsgBuf msg = {ERROR_MSG_BUF_DEFAULT_SIZE, request->msgBuf}; - int cnt = ceil(((double)numLines)/LINE_BATCH); + int cnt = ceil(((double)numLines) / LINE_BATCH); Params params; params.request = request; tsem_init(¶ms.sem, 0, 0); taosThreadSpinInit(&(params.lock), 0); - if(request->pDb == NULL){ + if (request->pDb == NULL) { request->code = TSDB_CODE_PAR_DB_NOT_SPECIFIED; smlBuildInvalidDataMsg(&msg, "Database not specified", NULL); goto end; } - if(isSchemalessDb(((STscObj *)taos), request) != TSDB_CODE_SUCCESS){ + if (isSchemalessDb(((STscObj *)taos), request) != TSDB_CODE_SUCCESS) { request->code = TSDB_CODE_SML_INVALID_DB_CONF; smlBuildInvalidDataMsg(&msg, "Cannot write data to a non schemaless database", NULL); goto end; @@ -2480,27 +2499,28 @@ TAOS_RES* taos_schemaless_insert(TAOS* taos, char* lines[], int numLines, int pr goto end; } - if(protocol < TSDB_SML_LINE_PROTOCOL || protocol > TSDB_SML_JSON_PROTOCOL){ + if (protocol < TSDB_SML_LINE_PROTOCOL || protocol > TSDB_SML_JSON_PROTOCOL) { request->code = TSDB_CODE_SML_INVALID_PROTOCOL_TYPE; smlBuildInvalidDataMsg(&msg, "protocol invalidate", NULL); goto end; } - if(protocol == TSDB_SML_LINE_PROTOCOL && (precision < TSDB_SML_TIMESTAMP_NOT_CONFIGURED || precision > TSDB_SML_TIMESTAMP_NANO_SECONDS)){ + if (protocol == TSDB_SML_LINE_PROTOCOL && + (precision < TSDB_SML_TIMESTAMP_NOT_CONFIGURED || precision > TSDB_SML_TIMESTAMP_NANO_SECONDS)) { request->code = TSDB_CODE_SML_INVALID_PRECISION_TYPE; smlBuildInvalidDataMsg(&msg, "precision invalidate for line protocol", NULL); goto end; } for (int i = 0; i < cnt; ++i) { - SRequestObj* req = (SRequestObj*)createRequest((STscObj *)taos, TSDB_SQL_INSERT); - if(!req){ + SRequestObj *req = (SRequestObj *)createRequest((STscObj *)taos, TSDB_SQL_INSERT); + if (!req) { request->code = TSDB_CODE_OUT_OF_MEMORY; uError("SML:taos_schemaless_insert error request is null"); goto end; } - SSmlHandle* info = smlBuildSmlInfo(taos, req, (SMLProtocolType)protocol, precision); - if(!info){ + SSmlHandle *info = smlBuildSmlInfo(taos, req, (SMLProtocolType)protocol, precision); + if (!info) { request->code = TSDB_CODE_OUT_OF_MEMORY; uError("SML:taos_schemaless_insert error SSmlHandle is null"); goto end; @@ -2508,10 +2528,10 @@ TAOS_RES* taos_schemaless_insert(TAOS* taos, char* lines[], int numLines, int pr int32_t perBatch = LINE_BATCH; - if(numLines > perBatch){ + if (numLines > perBatch) { numLines -= perBatch; info->isLast = false; - }else{ + } else { perBatch = numLines; numLines = 0; info->isLast = true; @@ -2520,10 +2540,10 @@ TAOS_RES* taos_schemaless_insert(TAOS* taos, char* lines[], int numLines, int pr info->params = ¶ms; info->affectedRows = perBatch; info->pRequest->body.queryFp = smlInsertCallback; - info->pRequest->body.param = info; + info->pRequest->body.param = info; int32_t code = smlProcess(info, lines, perBatch); lines += perBatch; - if (code != TSDB_CODE_SUCCESS){ + if (code != TSDB_CODE_SUCCESS) { info->pRequest->body.queryFp(info, req, code); } } @@ -2532,9 +2552,8 @@ TAOS_RES* taos_schemaless_insert(TAOS* taos, char* lines[], int numLines, int pr end: taosThreadSpinDestroy(¶ms.lock); tsem_destroy(¶ms.sem); -// ((STscObj *)taos)->schemalessType = 0; + // ((STscObj *)taos)->schemalessType = 0; ((STscObj *)taos)->schemalessType = 1; uDebug("resultend:%s", request->msgBuf); - return (TAOS_RES*)request; + return (TAOS_RES *)request; } - diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index d16ab57ea9..40c801c1a1 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -692,6 +692,7 @@ int32_t tDeserializeSMAlterStbReq(void *buf, int32_t bufLen, SMAlterStbReq *pReq void tFreeSMAltertbReq(SMAlterStbReq *pReq) { taosArrayDestroy(pReq->pFields); pReq->pFields = NULL; + taosMemoryFreeClear(pReq->comment); } int32_t tSerializeSEpSet(void *buf, int32_t bufLen, const SEpSet *pEpset) { @@ -4064,6 +4065,7 @@ int32_t tSerializeSCMCreateStreamReq(void *buf, int32_t bufLen, const SCMCreateS if (tEncodeI32(&encoder, sqlLen) < 0) return -1; if (tEncodeI32(&encoder, astLen) < 0) return -1; if (tEncodeI8(&encoder, pReq->triggerType) < 0) return -1; + if (tEncodeI64(&encoder, pReq->maxDelay) < 0) return -1; if (tEncodeI64(&encoder, pReq->watermark) < 0) return -1; if (sqlLen > 0 && tEncodeCStr(&encoder, pReq->sql) < 0) return -1; if (astLen > 0 && tEncodeCStr(&encoder, pReq->ast) < 0) return -1; @@ -4090,6 +4092,7 @@ int32_t tDeserializeSCMCreateStreamReq(void *buf, int32_t bufLen, SCMCreateStrea if (tDecodeI32(&decoder, &sqlLen) < 0) return -1; if (tDecodeI32(&decoder, &astLen) < 0) return -1; if (tDecodeI8(&decoder, &pReq->triggerType) < 0) return -1; + if (tDecodeI64(&decoder, &pReq->maxDelay) < 0) return -1; if (tDecodeI64(&decoder, &pReq->watermark) < 0) return -1; if (sqlLen > 0) { diff --git a/source/dnode/mnode/impl/src/mndScheduler.c b/source/dnode/mnode/impl/src/mndScheduler.c index 2454a4686d..a3b7754a4e 100644 --- a/source/dnode/mnode/impl/src/mndScheduler.c +++ b/source/dnode/mnode/impl/src/mndScheduler.c @@ -77,7 +77,7 @@ int32_t mndConvertRsmaTask(char** pDst, int32_t* pDstLen, const char* ast, int64 terrno = TSDB_CODE_QRY_INVALID_INPUT; goto END; } - SNodeListNode* inner = nodesListGetNode(pPlan->pSubplans, 0); + SNodeListNode* inner = (SNodeListNode*)nodesListGetNode(pPlan->pSubplans, 0); int32_t opNum = LIST_LENGTH(inner->pNodeList); if (opNum != 1) { @@ -85,7 +85,7 @@ int32_t mndConvertRsmaTask(char** pDst, int32_t* pDstLen, const char* ast, int64 goto END; } - SSubplan* plan = nodesListGetNode(inner->pNodeList, 0); + SSubplan* plan = (SSubplan*)nodesListGetNode(inner->pNodeList, 0); if (qSubPlanToString(plan, pDst, pDstLen) < 0) { terrno = TSDB_CODE_QRY_INVALID_INPUT; goto END; @@ -93,7 +93,7 @@ int32_t mndConvertRsmaTask(char** pDst, int32_t* pDstLen, const char* ast, int64 END: if (pAst) nodesDestroyNode(pAst); - if (pPlan) nodesDestroyNode(pPlan); + if (pPlan) nodesDestroyNode((SNode*)pPlan); return terrno; } @@ -378,8 +378,8 @@ int32_t mndScheduleStream(SMnode* pMnode, STrans* pTrans, SStreamObj* pStream) { SArray* taskInnerLevel = taosArrayInit(0, sizeof(void*)); taosArrayPush(pStream->tasks, &taskInnerLevel); - SNodeListNode* inner = nodesListGetNode(pPlan->pSubplans, 0); - SSubplan* plan = nodesListGetNode(inner->pNodeList, 0); + SNodeListNode* inner = (SNodeListNode*)nodesListGetNode(pPlan->pSubplans, 0); + SSubplan* plan = (SSubplan*)nodesListGetNode(inner->pNodeList, 0); ASSERT(plan->subplanType == SUBPLAN_TYPE_MERGE); pFinalTask = tNewSStreamTask(pStream->uid); @@ -407,8 +407,8 @@ int32_t mndScheduleStream(SMnode* pMnode, STrans* pTrans, SStreamObj* pStream) { SArray* taskSourceLevel = taosArrayInit(0, sizeof(void*)); taosArrayPush(pStream->tasks, &taskSourceLevel); - SNodeListNode* inner = nodesListGetNode(pPlan->pSubplans, 1); - SSubplan* plan = nodesListGetNode(inner->pNodeList, 0); + SNodeListNode* inner = (SNodeListNode*)nodesListGetNode(pPlan->pSubplans, 1); + SSubplan* plan = (SSubplan*)nodesListGetNode(inner->pNodeList, 0); ASSERT(plan->subplanType == SUBPLAN_TYPE_SCAN); void* pIter = NULL; @@ -449,9 +449,9 @@ int32_t mndScheduleStream(SMnode* pMnode, STrans* pTrans, SStreamObj* pStream) { SArray* taskOneLevel = taosArrayInit(0, sizeof(void*)); taosArrayPush(pStream->tasks, &taskOneLevel); - SNodeListNode* inner = nodesListGetNode(pPlan->pSubplans, 0); + SNodeListNode* inner = (SNodeListNode*)nodesListGetNode(pPlan->pSubplans, 0); ASSERT(LIST_LENGTH(inner->pNodeList) == 1); - SSubplan* plan = nodesListGetNode(inner->pNodeList, 0); + SSubplan* plan = (SSubplan*)nodesListGetNode(inner->pNodeList, 0); ASSERT(plan->subplanType == SUBPLAN_TYPE_SCAN); void* pIter = NULL; @@ -509,7 +509,7 @@ int32_t mndSchedInitSubEp(SMnode* pMnode, const SMqTopicObj* pTopic, SMqSubscrib return -1; } - SNodeListNode* inner = nodesListGetNode(pPlan->pSubplans, 0); + SNodeListNode* inner = (SNodeListNode*)nodesListGetNode(pPlan->pSubplans, 0); int32_t opNum = LIST_LENGTH(inner->pNodeList); if (opNum != 1) { @@ -517,7 +517,7 @@ int32_t mndSchedInitSubEp(SMnode* pMnode, const SMqTopicObj* pTopic, SMqSubscrib terrno = TSDB_CODE_MND_INVALID_TOPIC_QUERY; return -1; } - plan = nodesListGetNode(inner->pNodeList, 0); + plan = (SSubplan*)nodesListGetNode(inner->pNodeList, 0); } ASSERT(pSub->unassignedVgs); diff --git a/source/dnode/mnode/impl/src/mndStream.c b/source/dnode/mnode/impl/src/mndStream.c index a331534a93..96d199fcb6 100644 --- a/source/dnode/mnode/impl/src/mndStream.c +++ b/source/dnode/mnode/impl/src/mndStream.c @@ -235,10 +235,10 @@ static int32_t mndStreamGetPlanString(const char *ast, int8_t triggerType, int64 } if (TSDB_CODE_SUCCESS == code) { - code = nodesNodeToString(pPlan, false, pStr, NULL); + code = nodesNodeToString((SNode*)pPlan, false, pStr, NULL); } nodesDestroyNode(pAst); - nodesDestroyNode(pPlan); + nodesDestroyNode((SNode*)pPlan); terrno = code; return code; } diff --git a/source/dnode/mnode/impl/src/mndTopic.c b/source/dnode/mnode/impl/src/mndTopic.c index c8333c32f0..3247008d58 100644 --- a/source/dnode/mnode/impl/src/mndTopic.c +++ b/source/dnode/mnode/impl/src/mndTopic.c @@ -387,7 +387,7 @@ static int32_t mndCreateTopic(SMnode *pMnode, SRpcMsg *pReq, SCMCreateTopicReq * return -1; } - if (nodesNodeToString(pPlan, false, &topicObj.physicalPlan, NULL) != 0) { + if (nodesNodeToString((SNode*)pPlan, false, &topicObj.physicalPlan, NULL) != 0) { mError("topic:%s, failed to create since %s", pCreate->name, terrstr()); taosMemoryFree(topicObj.ast); taosMemoryFree(topicObj.sql); diff --git a/source/libs/command/src/explain.c b/source/libs/command/src/explain.c index 960f8dc9ac..79861dfa05 100644 --- a/source/libs/command/src/explain.c +++ b/source/libs/command/src/explain.c @@ -211,7 +211,7 @@ int32_t qExplainGenerateResChildren(SPhysiNode *pNode, SExplainGroup *group, SNo SExplainResNode *pResNode = NULL; FOREACH(node, pPhysiChildren) { QRY_ERR_RET(qExplainGenerateResNode((SPhysiNode *)node, group, &pResNode)); - QRY_ERR_RET(nodesListAppend(*pChildren, pResNode)); + QRY_ERR_RET(nodesListAppend(*pChildren, (SNode*)pResNode)); } return TSDB_CODE_SUCCESS; @@ -715,7 +715,7 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i EXPLAIN_ROW_NEW(level + 1, "Sort Key: "); if (pResNode->pExecInfo) { for (int32_t i = 0; i < LIST_LENGTH(pSortNode->pSortKeys); ++i) { - SOrderByExprNode *ptn = nodesListGetNode(pSortNode->pSortKeys, i); + SOrderByExprNode *ptn = (SOrderByExprNode*)nodesListGetNode(pSortNode->pSortKeys, i); EXPLAIN_ROW_APPEND("%s ", nodesGetNameFromColumnNode(ptn->pExpr)); } } @@ -1039,7 +1039,7 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i EXPLAIN_ROW_NEW(level + 1, "Merge Key: "); if (pResNode->pExecInfo) { for (int32_t i = 0; i < LIST_LENGTH(pMergeNode->pMergeKeys); ++i) { - SOrderByExprNode *ptn = nodesListGetNode(pMergeNode->pMergeKeys, i); + SOrderByExprNode *ptn = (SOrderByExprNode*)nodesListGetNode(pMergeNode->pMergeKeys, i); EXPLAIN_ROW_APPEND("%s ", nodesGetNameFromColumnNode(ptn->pExpr)); } } @@ -1078,7 +1078,7 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i EXPLAIN_ROW_NEW(level + 1, EXPLAIN_MERGE_KEYS_FORMAT); for (int32_t i = 0; i < LIST_LENGTH(pMergeNode->pMergeKeys); ++i) { - SOrderByExprNode *ptn = nodesListGetNode(pMergeNode->pMergeKeys, i); + SOrderByExprNode *ptn = (SOrderByExprNode*)nodesListGetNode(pMergeNode->pMergeKeys, i); EXPLAIN_ROW_APPEND("%s ", nodesGetNameFromColumnNode(ptn->pExpr)); } EXPLAIN_ROW_END(); diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index 789fe9929b..474b700868 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -202,7 +202,7 @@ SSDataBlock* createResDataBlock(SDataBlockDescNode* pNode) { for (int32_t i = 0; i < numOfCols; ++i) { SColumnInfoData idata = {{0}}; - SSlotDescNode* pDescNode = nodesListGetNode(pNode->pSlots, i); + SSlotDescNode* pDescNode = (SSlotDescNode*)nodesListGetNode(pNode->pSlots, i); // if (!pDescNode->output) { // todo disable it temporarily // continue; // } @@ -2920,7 +2920,7 @@ static int32_t initExchangeOperator(SExchangePhysiNode* pExNode, SExchangeInfo* } for (int32_t i = 0; i < numOfSources; ++i) { - SNodeListNode* pNode = nodesListGetNode((SNodeList*)pExNode->pSrcEndPoints, i); + SNodeListNode* pNode = (SNodeListNode*)nodesListGetNode((SNodeList*)pExNode->pSrcEndPoints, i); taosArrayPush(pInfo->pSources, pNode); } @@ -4494,7 +4494,7 @@ SExprInfo* createExprInfo(SNodeList* pNodeList, SNodeList* pGroupKeys, int32_t* if (NULL == res) { // todo handle error } else { res->node.resType = (SDataType){.bytes = sizeof(int64_t), .type = TSDB_DATA_TYPE_BIGINT}; - nodesListAppend(pFuncNode->pParameterList, res); + nodesListAppend(pFuncNode->pParameterList, (SNode*)res); } } #endif diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c index 9a7045110c..0151474008 100644 --- a/source/libs/executor/src/timewindowoperator.c +++ b/source/libs/executor/src/timewindowoperator.c @@ -1378,7 +1378,7 @@ void destroyStreamFinalIntervalOperatorInfo(void* param, int32_t numOfOutput) { taosMemoryFreeClear(pChildOp); } } - nodesDestroyNode(pInfo->pPhyNode); + nodesDestroyNode((SNode*)pInfo->pPhyNode); } static bool allInvertible(SqlFunctionCtx* pFCtx, int32_t numOfCols) { @@ -2157,7 +2157,7 @@ SOperatorInfo* createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream, pInfo->pUpdateRes = createResDataBlock(pPhyNode->pOutputDataBlockDesc); pInfo->pUpdateRes->info.type = STREAM_REPROCESS; blockDataEnsureCapacity(pInfo->pUpdateRes, 128); - pInfo->pPhyNode = nodesCloneNode(pPhyNode); + pInfo->pPhyNode = (SPhysiNode*)nodesCloneNode((SNode*)pPhyNode); pOperator->name = "StreamFinalIntervalOperator"; pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL; diff --git a/source/libs/function/inc/functionMgtInt.h b/source/libs/function/inc/functionMgtInt.h index d1af6b6051..6fefcceb87 100644 --- a/source/libs/function/inc/functionMgtInt.h +++ b/source/libs/function/inc/functionMgtInt.h @@ -42,6 +42,7 @@ extern "C" { #define FUNC_MGT_SELECT_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(13) #define FUNC_MGT_REPEAT_SCAN_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(14) #define FUNC_MGT_FORBID_FILL_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(15) +#define FUNC_MGT_FORBID_STREAM_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(16) #define FUNC_MGT_TEST_MASK(val, mask) (((val) & (mask)) != 0) diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index 8f1ee8b7ca..7441dbacf3 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -1274,7 +1274,7 @@ void static addTimezoneParam(SNodeList* pList) { varDataSetLen(pVal->datum.p, len); strncpy(varDataVal(pVal->datum.p), pVal->literal, len); - nodesListAppend(pList, pVal); + nodesListAppend(pList, (SNode*)pVal); } static int32_t translateToIso8601(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { @@ -1363,7 +1363,7 @@ static int32_t translateToJson(SFunctionNode* pFunc, char* pErrBuf, int32_t len) return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); } - SExprNode* pPara = nodesListGetNode(pFunc->pParameterList, 0); + SExprNode* pPara = (SExprNode*)nodesListGetNode(pFunc->pParameterList, 0); if (QUERY_NODE_VALUE != nodeType(pPara) || (!IS_VAR_DATA_TYPE(pPara->resType.type))) { return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); } diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index 3d64f82eba..238334ab42 100644 --- a/source/libs/function/src/builtinsimpl.c +++ b/source/libs/function/src/builtinsimpl.c @@ -14,7 +14,6 @@ */ #include "builtinsimpl.h" -#include "tglobal.h" #include "cJSON.h" #include "function.h" #include "querynodes.h" @@ -22,23 +21,23 @@ #include "tcompare.h" #include "tdatablock.h" #include "tdigest.h" +#include "tglobal.h" #include "thistogram.h" #include "tpercentile.h" -#define HISTOGRAM_MAX_BINS_NUM 1000 -#define MAVG_MAX_POINTS_NUM 1000 -#define SAMPLE_MAX_POINTS_NUM 1000 -#define TAIL_MAX_POINTS_NUM 100 -#define TAIL_MAX_OFFSET 100 +#define HISTOGRAM_MAX_BINS_NUM 1000 +#define MAVG_MAX_POINTS_NUM 1000 +#define SAMPLE_MAX_POINTS_NUM 1000 +#define TAIL_MAX_POINTS_NUM 100 +#define TAIL_MAX_OFFSET 100 -#define UNIQUE_MAX_RESULT_SIZE (1024*1024*10) - -#define HLL_BUCKET_BITS 14 // The bits of the bucket -#define HLL_DATA_BITS (64-HLL_BUCKET_BITS) -#define HLL_BUCKETS (1<initialized) { @@ -329,15 +315,14 @@ int32_t functionFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { int32_t firstCombine(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx) { SResultRowEntryInfo* pDResInfo = GET_RES_INFO(pDestCtx); - char* pDBuf = GET_ROWCELL_INTERBUF(pDResInfo); - int32_t type = pDestCtx->input.pData[0]->info.type; - int32_t bytes = pDestCtx->input.pData[0]->info.bytes; + char* pDBuf = GET_ROWCELL_INTERBUF(pDResInfo); + int32_t type = pDestCtx->input.pData[0]->info.type; + int32_t bytes = pDestCtx->input.pData[0]->info.bytes; SResultRowEntryInfo* pSResInfo = GET_RES_INFO(pSourceCtx); - char* pSBuf = GET_ROWCELL_INTERBUF(pSResInfo); + char* pSBuf = GET_ROWCELL_INTERBUF(pSResInfo); - if (pSResInfo->numOfRes != 0 && - (pDResInfo->numOfRes == 0 || *(TSKEY*)(pDBuf + bytes) > *(TSKEY*)(pSBuf + bytes)) ) { + if (pSResInfo->numOfRes != 0 && (pDResInfo->numOfRes == 0 || *(TSKEY*)(pDBuf + bytes) > *(TSKEY*)(pSBuf + bytes))) { memcpy(pDBuf, pSBuf, bytes); *(TSKEY*)(pDBuf + bytes) = *(TSKEY*)(pSBuf + bytes); pDResInfo->numOfRes = 1; @@ -409,14 +394,14 @@ static FORCE_INLINE int32_t getNumOfElems(SqlFunctionCtx* pCtx) { int32_t countFunction(SqlFunctionCtx* pCtx) { int32_t numOfElem = getNumOfElems(pCtx); - SResultRowEntryInfo* pResInfo = GET_RES_INFO(pCtx); + SResultRowEntryInfo* pResInfo = GET_RES_INFO(pCtx); SInputColumnInfoData* pInput = &pCtx->input; int32_t type = pInput->pData[0]->info.type; char* buf = GET_ROWCELL_INTERBUF(pResInfo); if (IS_NULL_TYPE(type)) { - //select count(NULL) returns 0 + // select count(NULL) returns 0 numOfElem = 1; *((int64_t*)buf) = 0; } else { @@ -445,7 +430,7 @@ int32_t countInvertFunction(SqlFunctionCtx* pCtx) { int32_t combineFunction(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx) { SResultRowEntryInfo* pDResInfo = GET_RES_INFO(pDestCtx); - char* pDBuf = GET_ROWCELL_INTERBUF(pDResInfo); + char* pDBuf = GET_ROWCELL_INTERBUF(pDResInfo); SResultRowEntryInfo* pSResInfo = GET_RES_INFO(pSourceCtx); char* pSBuf = GET_ROWCELL_INTERBUF(pSResInfo); @@ -484,8 +469,8 @@ int32_t sumFunction(SqlFunctionCtx* pCtx) { // Only the pre-computing information loaded and actual data does not loaded SInputColumnInfoData* pInput = &pCtx->input; - SColumnDataAgg* pAgg = pInput->pColumnDataAgg[0]; - int32_t type = pInput->pData[0]->info.type; + SColumnDataAgg* pAgg = pInput->pColumnDataAgg[0]; + int32_t type = pInput->pData[0]->info.type; SSumRes* pSumRes = GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx)); @@ -539,7 +524,7 @@ int32_t sumFunction(SqlFunctionCtx* pCtx) { } } - //check for overflow + // check for overflow if (IS_FLOAT_TYPE(type) && (isinf(pSumRes->dsum) || isnan(pSumRes->dsum))) { GET_RES_INFO(pCtx)->isNullRes = 1; } @@ -611,11 +596,11 @@ int32_t sumInvertFunction(SqlFunctionCtx* pCtx) { int32_t sumCombine(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx) { SResultRowEntryInfo* pDResInfo = GET_RES_INFO(pDestCtx); - SSumRes* pDBuf = GET_ROWCELL_INTERBUF(pDResInfo); - int32_t type = pDestCtx->input.pData[0]->info.type; + SSumRes* pDBuf = GET_ROWCELL_INTERBUF(pDResInfo); + int32_t type = pDestCtx->input.pData[0]->info.type; SResultRowEntryInfo* pSResInfo = GET_RES_INFO(pSourceCtx); - SSumRes* pSBuf = GET_ROWCELL_INTERBUF(pSResInfo); + SSumRes* pSBuf = GET_ROWCELL_INTERBUF(pSResInfo); if (IS_SIGNED_NUMERIC_TYPE(type) || type == TSDB_DATA_TYPE_BOOL) { pDBuf->isum += pSBuf->isum; @@ -766,18 +751,18 @@ _avg_over: return TSDB_CODE_SUCCESS; } -#define LIST_AVG_N(sumT, T) \ - do { \ - T* plist = (T*)pCol->pData; \ - for (int32_t i = start; i < numOfRows + pInput->startRowIndex; ++i) { \ - if (pCol->hasNull && colDataIsNull_f(pCol->nullbitmap, i)) { \ - continue; \ - } \ - \ - numOfElem += 1; \ - pAvgRes->count -= 1; \ - sumT -= plist[i]; \ - } \ +#define LIST_AVG_N(sumT, T) \ + do { \ + T* plist = (T*)pCol->pData; \ + for (int32_t i = start; i < numOfRows + pInput->startRowIndex; ++i) { \ + if (pCol->hasNull && colDataIsNull_f(pCol->nullbitmap, i)) { \ + continue; \ + } \ + \ + numOfElem += 1; \ + pAvgRes->count -= 1; \ + sumT -= plist[i]; \ + } \ } while (0) int32_t avgInvertFunction(SqlFunctionCtx* pCtx) { @@ -831,11 +816,11 @@ int32_t avgInvertFunction(SqlFunctionCtx* pCtx) { int32_t avgCombine(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx) { SResultRowEntryInfo* pDResInfo = GET_RES_INFO(pDestCtx); - SAvgRes* pDBuf = GET_ROWCELL_INTERBUF(pDResInfo); - int32_t type = pDestCtx->input.pData[0]->info.type; + SAvgRes* pDBuf = GET_ROWCELL_INTERBUF(pDResInfo); + int32_t type = pDestCtx->input.pData[0]->info.type; SResultRowEntryInfo* pSResInfo = GET_RES_INFO(pSourceCtx); - SAvgRes* pSBuf = GET_ROWCELL_INTERBUF(pSResInfo); + SAvgRes* pSBuf = GET_ROWCELL_INTERBUF(pSResInfo); if (IS_INTEGER_TYPE(type)) { pDBuf->sum.isum += pSBuf->sum.isum; @@ -850,7 +835,7 @@ int32_t avgCombine(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx) { int32_t avgFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { SInputColumnInfoData* pInput = &pCtx->input; - int32_t type = pInput->pData[0]->info.type; + int32_t type = pInput->pData[0]->info.type; SAvgRes* pAvgRes = GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx)); if (IS_INTEGER_TYPE(type)) { @@ -859,7 +844,7 @@ int32_t avgFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { pAvgRes->result = pAvgRes->sum.dsum / ((double)pAvgRes->count); } - //check for overflow + // check for overflow if (isinf(pAvgRes->result) || isnan(pAvgRes->result)) { GET_RES_INFO(pCtx)->isNullRes = 1; } @@ -872,7 +857,7 @@ EFuncDataRequired statisDataRequired(SFunctionNode* pFunc, STimeWindow* pTimeWin } typedef struct SMinmaxResInfo { - bool assign; // assign the first value or not + bool assign; // assign the first value or not int64_t v; STuplePos tuplePos; } SMinmaxResInfo; @@ -906,7 +891,7 @@ int32_t doMinMaxHelper(SqlFunctionCtx* pCtx, int32_t isMinFunc) { int32_t type = pCol->info.type; SResultRowEntryInfo* pResInfo = GET_RES_INFO(pCtx); - SMinmaxResInfo *pBuf = GET_ROWCELL_INTERBUF(pResInfo); + SMinmaxResInfo* pBuf = GET_ROWCELL_INTERBUF(pResInfo); if (IS_NULL_TYPE(type)) { GET_RES_INFO(pCtx)->isNullRes = 1; @@ -1282,7 +1267,7 @@ int32_t doMinMaxHelper(SqlFunctionCtx* pCtx, int32_t isMinFunc) { numOfElems += 1; } } else if (type == TSDB_DATA_TYPE_FLOAT) { - float* pData = (float*)pCol->pData; + float* pData = (float*)pCol->pData; double* val = (double*)&pBuf->v; for (int32_t i = start; i < start + numOfRows; ++i) { @@ -1330,7 +1315,8 @@ int32_t maxFunction(SqlFunctionCtx* pCtx) { return TSDB_CODE_SUCCESS; } -static void setSelectivityValue(SqlFunctionCtx* pCtx, SSDataBlock* pBlock, const STuplePos *pTuplePos, int32_t rowIndex); +static void setSelectivityValue(SqlFunctionCtx* pCtx, SSDataBlock* pBlock, const STuplePos* pTuplePos, + int32_t rowIndex); int32_t minmaxFunctionFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { SResultRowEntryInfo* pEntryInfo = GET_RES_INFO(pCtx); @@ -1344,7 +1330,7 @@ int32_t minmaxFunctionFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { pEntryInfo->isNullRes = (pEntryInfo->numOfRes == 0); if (pCol->info.type == TSDB_DATA_TYPE_FLOAT) { - float v = *(double*) &pRes->v; + float v = *(double*)&pRes->v; colDataAppend(pCol, currentRow, (const char*)&v, pEntryInfo->isNullRes); } else { colDataAppend(pCol, currentRow, (const char*)&pRes->v, pEntryInfo->isNullRes); @@ -1357,7 +1343,7 @@ int32_t minmaxFunctionFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { return pEntryInfo->numOfRes; } -void setSelectivityValue(SqlFunctionCtx* pCtx, SSDataBlock* pBlock, const STuplePos *pTuplePos, int32_t rowIndex) { +void setSelectivityValue(SqlFunctionCtx* pCtx, SSDataBlock* pBlock, const STuplePos* pTuplePos, int32_t rowIndex) { int32_t pageId = pTuplePos->pageId; int32_t offset = pTuplePos->offset; if (pTuplePos->pageId != -1) { @@ -1392,7 +1378,7 @@ void setSelectivityValue(SqlFunctionCtx* pCtx, SSDataBlock* pBlock, const STuple void releaseSource(STuplePos* pPos) { if (pPos->pageId == -1) { - return ; + return; } // Todo(liuyao) relase row } @@ -1405,18 +1391,17 @@ void replaceTupleData(STuplePos* pDestPos, STuplePos* pSourcePos) { int32_t minMaxCombine(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx, int32_t isMinFunc) { SResultRowEntryInfo* pDResInfo = GET_RES_INFO(pDestCtx); SMinmaxResInfo* pDBuf = GET_ROWCELL_INTERBUF(pDResInfo); - int32_t type = pDestCtx->input.pData[0]->info.type; + int32_t type = pDestCtx->input.pData[0]->info.type; SResultRowEntryInfo* pSResInfo = GET_RES_INFO(pSourceCtx); SMinmaxResInfo* pSBuf = GET_ROWCELL_INTERBUF(pSResInfo); if (IS_FLOAT_TYPE(type)) { - if (pSBuf->assign && - ( (((*(double*)&pDBuf->v) < (*(double*)&pSBuf->v)) ^ isMinFunc) || !pDBuf->assign ) ) { - *(double*) &pDBuf->v = *(double*) &pSBuf->v; + if (pSBuf->assign && ((((*(double*)&pDBuf->v) < (*(double*)&pSBuf->v)) ^ isMinFunc) || !pDBuf->assign)) { + *(double*)&pDBuf->v = *(double*)&pSBuf->v; replaceTupleData(&pDBuf->tuplePos, &pSBuf->tuplePos); } } else { - if ( pSBuf->assign && ( ((pDBuf->v < pSBuf->v) ^ isMinFunc) || !pDBuf->assign ) ) { + if (pSBuf->assign && (((pDBuf->v < pSBuf->v) ^ isMinFunc) || !pDBuf->assign)) { pDBuf->v = pSBuf->v; replaceTupleData(&pDBuf->tuplePos, &pSBuf->tuplePos); } @@ -1584,7 +1569,7 @@ _stddev_over: pStddevRes->quadraticISum -= plist[i] * plist[i]; \ } \ } while (0) - + int32_t stddevInvertFunction(SqlFunctionCtx* pCtx) { int32_t numOfElem = 0; @@ -1652,11 +1637,11 @@ int32_t stddevFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { int32_t stddevCombine(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx) { SResultRowEntryInfo* pDResInfo = GET_RES_INFO(pDestCtx); - SStddevRes* pDBuf = GET_ROWCELL_INTERBUF(pDResInfo); - int32_t type = pDestCtx->input.pData[0]->info.type; + SStddevRes* pDBuf = GET_ROWCELL_INTERBUF(pDResInfo); + int32_t type = pDestCtx->input.pData[0]->info.type; SResultRowEntryInfo* pSResInfo = GET_RES_INFO(pSourceCtx); - SStddevRes* pSBuf = GET_ROWCELL_INTERBUF(pSResInfo); + SStddevRes* pSBuf = GET_ROWCELL_INTERBUF(pSResInfo); if (IS_INTEGER_TYPE(type)) { pDBuf->isum += pSBuf->isum; @@ -1682,10 +1667,8 @@ bool leastSQRFunctionSetup(SqlFunctionCtx* pCtx, SResultRowEntryInfo* pResultInf SLeastSQRInfo* pInfo = GET_ROWCELL_INTERBUF(pResultInfo); - pInfo->startVal = IS_FLOAT_TYPE(pCtx->param[1].param.nType) ? pCtx->param[1].param.d : - (double)pCtx->param[1].param.i; - pInfo->stepVal = IS_FLOAT_TYPE(pCtx->param[2].param.nType) ? pCtx->param[2].param.d : - (double)pCtx->param[2].param.i; + pInfo->startVal = IS_FLOAT_TYPE(pCtx->param[1].param.nType) ? pCtx->param[1].param.d : (double)pCtx->param[1].param.i; + pInfo->stepVal = IS_FLOAT_TYPE(pCtx->param[2].param.nType) ? pCtx->param[2].param.d : (double)pCtx->param[2].param.i; return true; } @@ -1812,9 +1795,9 @@ int32_t leastSQRFunction(SqlFunctionCtx* pCtx) { int32_t leastSQRFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { SResultRowEntryInfo* pResInfo = GET_RES_INFO(pCtx); - SLeastSQRInfo* pInfo = GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx)); - int32_t slotId = pCtx->pExpr->base.resSchema.slotId; - SColumnInfoData* pCol = taosArrayGet(pBlock->pDataBlock, slotId); + SLeastSQRInfo* pInfo = GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx)); + int32_t slotId = pCtx->pExpr->base.resSchema.slotId; + SColumnInfoData* pCol = taosArrayGet(pBlock->pDataBlock, slotId); int32_t currentRow = pBlock->info.rows; @@ -1836,8 +1819,9 @@ int32_t leastSQRFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { param12 /= param[1][1]; - char buf[64] = {0}; - size_t len = snprintf(varDataVal(buf), sizeof(buf) - VARSTR_HEADER_SIZE, "{slop:%.6lf, intercept:%.6lf}", param02, param12); + char buf[64] = {0}; + size_t len = + snprintf(varDataVal(buf), sizeof(buf) - VARSTR_HEADER_SIZE, "{slop:%.6lf, intercept:%.6lf}", param02, param12); varDataSetLen(buf, len); colDataAppend(pCol, currentRow, buf, pResInfo->isNullRes); @@ -1846,7 +1830,7 @@ int32_t leastSQRFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { } int32_t leastSQRInvertFunction(SqlFunctionCtx* pCtx) { - //TODO + // TODO return TSDB_CODE_SUCCESS; } @@ -1854,11 +1838,11 @@ int32_t leastSQRCombine(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx) { SResultRowEntryInfo* pDResInfo = GET_RES_INFO(pDestCtx); SLeastSQRInfo* pDBuf = GET_ROWCELL_INTERBUF(pDResInfo); int32_t type = pDestCtx->input.pData[0]->info.type; - double (*pDparam)[3] = pDBuf->matrix; + double(*pDparam)[3] = pDBuf->matrix; SResultRowEntryInfo* pSResInfo = GET_RES_INFO(pSourceCtx); SLeastSQRInfo* pSBuf = GET_ROWCELL_INTERBUF(pSResInfo); - double (*pSparam)[3] = pSBuf->matrix; + double(*pSparam)[3] = pSBuf->matrix; for (int32_t i = 0; i < pSBuf->num; i++) { pDparam[0][0] += pDBuf->startVal * pDBuf->startVal; pDparam[0][1] += pDBuf->startVal; @@ -1996,19 +1980,21 @@ int32_t percentileFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { } bool getApercentileFuncEnv(SFunctionNode* pFunc, SFuncExecEnv* pEnv) { - int32_t bytesHist = (int32_t)(sizeof(SAPercentileInfo) + sizeof(SHistogramInfo) + sizeof(SHistBin) * (MAX_HISTOGRAM_BIN + 1)); + int32_t bytesHist = + (int32_t)(sizeof(SAPercentileInfo) + sizeof(SHistogramInfo) + sizeof(SHistBin) * (MAX_HISTOGRAM_BIN + 1)); int32_t bytesDigest = (int32_t)(sizeof(SAPercentileInfo) + TDIGEST_SIZE(COMPRESSION)); pEnv->calcMemSize = TMAX(bytesHist, bytesDigest); return true; } int32_t getApercentileMaxSize() { - int32_t bytesHist = (int32_t)(sizeof(SAPercentileInfo) + sizeof(SHistogramInfo) + sizeof(SHistBin) * (MAX_HISTOGRAM_BIN + 1)); + int32_t bytesHist = + (int32_t)(sizeof(SAPercentileInfo) + sizeof(SHistogramInfo) + sizeof(SHistBin) * (MAX_HISTOGRAM_BIN + 1)); int32_t bytesDigest = (int32_t)(sizeof(SAPercentileInfo) + TDIGEST_SIZE(COMPRESSION)); return TMAX(bytesHist, bytesDigest); } -static int8_t getApercentileAlgo(char *algoStr) { +static int8_t getApercentileAlgo(char* algoStr) { int8_t algoType; if (strcasecmp(algoStr, "default") == 0) { algoType = APERCT_ALGO_DEFAULT; @@ -2022,8 +2008,8 @@ static int8_t getApercentileAlgo(char *algoStr) { } static void buildHistogramInfo(SAPercentileInfo* pInfo) { - pInfo->pHisto = (SHistogramInfo*) ((char*)pInfo + sizeof(SAPercentileInfo)); - pInfo->pHisto->elems = (SHistBin*) ((char*)pInfo->pHisto + sizeof(SHistogramInfo)); + pInfo->pHisto = (SHistogramInfo*)((char*)pInfo + sizeof(SAPercentileInfo)); + pInfo->pHisto->elems = (SHistBin*)((char*)pInfo->pHisto + sizeof(SHistogramInfo)); } static void buildTDigestInfo(SAPercentileInfo* pInfo) { @@ -2049,7 +2035,7 @@ bool apercentileFunctionSetup(SqlFunctionCtx* pCtx, SResultRowEntryInfo* pResult } } - char *tmp = (char *)pInfo + sizeof(SAPercentileInfo); + char* tmp = (char*)pInfo + sizeof(SAPercentileInfo); if (pInfo->algo == APERCT_ALGO_TDIGEST) { pInfo->pTDigest = tdigestNewFrom(tmp, COMPRESSION); } else { @@ -2065,7 +2051,7 @@ int32_t apercentileFunction(SqlFunctionCtx* pCtx) { SResultRowEntryInfo* pResInfo = GET_RES_INFO(pCtx); SInputColumnInfoData* pInput = &pCtx->input; - //SColumnDataAgg* pAgg = pInput->pColumnDataAgg[0]; + // SColumnDataAgg* pAgg = pInput->pColumnDataAgg[0]; SColumnInfoData* pCol = pInput->pData[0]; int32_t type = pCol->info.type; @@ -2081,8 +2067,8 @@ int32_t apercentileFunction(SqlFunctionCtx* pCtx) { numOfElems += 1; char* data = colDataGetData(pCol, i); - double v = 0; // value - int64_t w = 1; // weigth + double v = 0; // value + int64_t w = 1; // weigth GET_TYPED_DATA(v, double, type, data); tdigestAdd(pInfo->pTDigest, v, w); } @@ -2111,14 +2097,14 @@ static void apercentileTransferInfo(SAPercentileInfo* pInput, SAPercentileInfo* buildTDigestInfo(pInput); tdigestAutoFill(pInput->pTDigest, COMPRESSION); - if(pInput->pTDigest->num_centroids == 0 && pInput->pTDigest->num_buffered_pts == 0) { + if (pInput->pTDigest->num_centroids == 0 && pInput->pTDigest->num_buffered_pts == 0) { return; } buildTDigestInfo(pOutput); - TDigest *pTDigest = pOutput->pTDigest; + TDigest* pTDigest = pOutput->pTDigest; - if(pTDigest->num_centroids <= 0) { + if (pTDigest->num_centroids <= 0) { memcpy(pTDigest, pInput->pTDigest, (size_t)TDIGEST_SIZE(COMPRESSION)); tdigestAutoFill(pTDigest, COMPRESSION); } else { @@ -2131,16 +2117,16 @@ static void apercentileTransferInfo(SAPercentileInfo* pInput, SAPercentileInfo* } buildHistogramInfo(pOutput); - SHistogramInfo *pHisto = pOutput->pHisto; + SHistogramInfo* pHisto = pOutput->pHisto; if (pHisto->numOfElems <= 0) { memcpy(pHisto, pInput->pHisto, sizeof(SHistogramInfo) + sizeof(SHistBin) * (MAX_HISTOGRAM_BIN + 1)); - pHisto->elems = (SHistBin*) ((char *)pHisto + sizeof(SHistogramInfo)); + pHisto->elems = (SHistBin*)((char*)pHisto + sizeof(SHistogramInfo)); } else { - pHisto->elems = (SHistBin*) ((char *)pHisto + sizeof(SHistogramInfo)); - SHistogramInfo *pRes = tHistogramMerge(pHisto, pInput->pHisto, MAX_HISTOGRAM_BIN); + pHisto->elems = (SHistBin*)((char*)pHisto + sizeof(SHistogramInfo)); + SHistogramInfo* pRes = tHistogramMerge(pHisto, pInput->pHisto, MAX_HISTOGRAM_BIN); memcpy(pHisto, pRes, sizeof(SHistogramInfo) + sizeof(SHistBin) * MAX_HISTOGRAM_BIN); - pHisto->elems = (SHistBin*) ((char *)pHisto + sizeof(SHistogramInfo)); + pHisto->elems = (SHistBin*)((char*)pHisto + sizeof(SHistogramInfo)); tHistogramDestroy(&pRes); } } @@ -2156,9 +2142,9 @@ int32_t apercentileFunctionMerge(SqlFunctionCtx* pCtx) { SAPercentileInfo* pInfo = GET_ROWCELL_INTERBUF(pResInfo); - int32_t start = pInput->startRowIndex; - char* data = colDataGetData(pCol, start); - SAPercentileInfo* pInputInfo = (SAPercentileInfo *)varDataVal(data); + int32_t start = pInput->startRowIndex; + char* data = colDataGetData(pCol, start); + SAPercentileInfo* pInputInfo = (SAPercentileInfo*)varDataVal(data); apercentileTransferInfo(pInputInfo, pInfo); @@ -2168,24 +2154,24 @@ int32_t apercentileFunctionMerge(SqlFunctionCtx* pCtx) { int32_t apercentileFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { SResultRowEntryInfo* pResInfo = GET_RES_INFO(pCtx); - SAPercentileInfo* pInfo = (SAPercentileInfo*)GET_ROWCELL_INTERBUF(pResInfo); + SAPercentileInfo* pInfo = (SAPercentileInfo*)GET_ROWCELL_INTERBUF(pResInfo); if (pInfo->algo == APERCT_ALGO_TDIGEST) { if (pInfo->pTDigest->size > 0) { pInfo->result = tdigestQuantile(pInfo->pTDigest, pInfo->percent / 100); } else { // no need to free - //setNull(pCtx->pOutput, pCtx->outputType, pCtx->outputBytes); + // setNull(pCtx->pOutput, pCtx->outputType, pCtx->outputBytes); return TSDB_CODE_SUCCESS; } } else { if (pInfo->pHisto->numOfElems > 0) { - double ratio[] = {pInfo->percent}; - double *res = tHistogramUniform(pInfo->pHisto, ratio, 1); + double ratio[] = {pInfo->percent}; + double* res = tHistogramUniform(pInfo->pHisto, ratio, 1); pInfo->result = *res; - //memcpy(pCtx->pOutput, res, sizeof(double)); + // memcpy(pCtx->pOutput, res, sizeof(double)); taosMemoryFree(res); } else { // no need to free - //setNull(pCtx->pOutput, pCtx->outputType, pCtx->outputBytes); + // setNull(pCtx->pOutput, pCtx->outputType, pCtx->outputBytes); return TSDB_CODE_SUCCESS; } } @@ -2195,10 +2181,10 @@ int32_t apercentileFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { int32_t apercentilePartialFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { SResultRowEntryInfo* pResInfo = GET_RES_INFO(pCtx); - SAPercentileInfo* pInfo = (SAPercentileInfo*)GET_ROWCELL_INTERBUF(pResInfo); + SAPercentileInfo* pInfo = (SAPercentileInfo*)GET_ROWCELL_INTERBUF(pResInfo); int32_t resultBytes = getApercentileMaxSize(); - char *res = taosMemoryCalloc(resultBytes + VARSTR_HEADER_SIZE, sizeof(char)); + char* res = taosMemoryCalloc(resultBytes + VARSTR_HEADER_SIZE, sizeof(char)); if (pInfo->algo == APERCT_ALGO_TDIGEST) { if (pInfo->pTDigest->size > 0) { @@ -2237,7 +2223,7 @@ int32_t apercentileCombine(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx) } else { SHistogramInfo* pTmp = tHistogramMerge(pDBuf->pHisto, pSBuf->pHisto, MAX_HISTOGRAM_BIN); memcpy(pDBuf->pHisto, pTmp, sizeof(SHistogramInfo) + sizeof(SHistBin) * (MAX_HISTOGRAM_BIN + 1)); - pDBuf->pHisto->elems = (SHistBin*) ((char *)pDBuf->pHisto + sizeof(SHistogramInfo)); + pDBuf->pHisto->elems = (SHistBin*)((char*)pDBuf->pHisto + sizeof(SHistogramInfo)); tHistogramDestroy(&pTmp); } pDResInfo->numOfRes = TMAX(pDResInfo->numOfRes, pSResInfo->numOfRes); @@ -2245,13 +2231,13 @@ int32_t apercentileCombine(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx) } bool getFirstLastFuncEnv(SFunctionNode* pFunc, SFuncExecEnv* pEnv) { - SColumnNode* pNode = nodesListGetNode(pFunc->pParameterList, 0); + SColumnNode* pNode = (SColumnNode*)nodesListGetNode(pFunc->pParameterList, 0); pEnv->calcMemSize = pNode->node.resType.bytes + sizeof(int64_t); return true; } bool getSelectivityFuncEnv(SFunctionNode* pFunc, SFuncExecEnv* pEnv) { - SColumnNode* pNode = nodesListGetNode(pFunc->pParameterList, 0); + SColumnNode* pNode = (SColumnNode*)nodesListGetNode(pFunc->pParameterList, 0); pEnv->calcMemSize = pNode->node.resType.bytes; return true; } @@ -2433,15 +2419,14 @@ int32_t firstLastFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { int32_t lastCombine(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx) { SResultRowEntryInfo* pDResInfo = GET_RES_INFO(pDestCtx); - char* pDBuf = GET_ROWCELL_INTERBUF(pDResInfo); - int32_t type = pDestCtx->input.pData[0]->info.type; - int32_t bytes = pDestCtx->input.pData[0]->info.bytes; + char* pDBuf = GET_ROWCELL_INTERBUF(pDResInfo); + int32_t type = pDestCtx->input.pData[0]->info.type; + int32_t bytes = pDestCtx->input.pData[0]->info.bytes; SResultRowEntryInfo* pSResInfo = GET_RES_INFO(pSourceCtx); - char* pSBuf = GET_ROWCELL_INTERBUF(pSResInfo); + char* pSBuf = GET_ROWCELL_INTERBUF(pSResInfo); - if (pSResInfo->numOfRes != 0 && - (pDResInfo->numOfRes == 0 || *(TSKEY*)(pDBuf + bytes) < *(TSKEY*)(pSBuf + bytes)) ) { + if (pSResInfo->numOfRes != 0 && (pDResInfo->numOfRes == 0 || *(TSKEY*)(pDBuf + bytes) < *(TSKEY*)(pSBuf + bytes))) { memcpy(pDBuf, pSBuf, bytes); *(TSKEY*)(pDBuf + bytes) = *(TSKEY*)(pSBuf + bytes); pDResInfo->numOfRes = 1; @@ -2469,31 +2454,38 @@ bool diffFunctionSetup(SqlFunctionCtx* pCtx, SResultRowEntryInfo* pResInfo) { } static void doSetPrevVal(SDiffInfo* pDiffInfo, int32_t type, const char* pv) { - switch(type) { + switch (type) { case TSDB_DATA_TYPE_BOOL: case TSDB_DATA_TYPE_TINYINT: - pDiffInfo->prev.i64 = *(int8_t*) pv; break; + pDiffInfo->prev.i64 = *(int8_t*)pv; + break; case TSDB_DATA_TYPE_INT: - pDiffInfo->prev.i64 = *(int32_t*) pv; break; + pDiffInfo->prev.i64 = *(int32_t*)pv; + break; case TSDB_DATA_TYPE_SMALLINT: - pDiffInfo->prev.i64 = *(int16_t*) pv; break; + pDiffInfo->prev.i64 = *(int16_t*)pv; + break; case TSDB_DATA_TYPE_BIGINT: - pDiffInfo->prev.i64 = *(int64_t*) pv; break; + pDiffInfo->prev.i64 = *(int64_t*)pv; + break; case TSDB_DATA_TYPE_FLOAT: - pDiffInfo->prev.d64 = *(float *) pv; break; + pDiffInfo->prev.d64 = *(float*)pv; + break; case TSDB_DATA_TYPE_DOUBLE: - pDiffInfo->prev.d64 = *(double*) pv; break; + pDiffInfo->prev.d64 = *(double*)pv; + break; default: ASSERT(0); } } -static void doHandleDiff(SDiffInfo* pDiffInfo, int32_t type, const char* pv, SColumnInfoData* pOutput, int32_t pos, int32_t order) { - int32_t factor = (order == TSDB_ORDER_ASC)? 1:-1; +static void doHandleDiff(SDiffInfo* pDiffInfo, int32_t type, const char* pv, SColumnInfoData* pOutput, int32_t pos, + int32_t order) { + int32_t factor = (order == TSDB_ORDER_ASC) ? 1 : -1; switch (type) { case TSDB_DATA_TYPE_INT: { int32_t v = *(int32_t*)pv; - int64_t delta = factor*(v - pDiffInfo->prev.i64); // direct previous may be null + int64_t delta = factor * (v - pDiffInfo->prev.i64); // direct previous may be null if (delta < 0 && pDiffInfo->ignoreNegative) { colDataSetNull_f(pOutput->nullbitmap, pos); } else { @@ -2504,8 +2496,8 @@ static void doHandleDiff(SDiffInfo* pDiffInfo, int32_t type, const char* pv, SCo } case TSDB_DATA_TYPE_BOOL: case TSDB_DATA_TYPE_TINYINT: { - int8_t v = *(int8_t*)pv; - int64_t delta = factor*(v - pDiffInfo->prev.i64); // direct previous may be null + int8_t v = *(int8_t*)pv; + int64_t delta = factor * (v - pDiffInfo->prev.i64); // direct previous may be null if (delta < 0 && pDiffInfo->ignoreNegative) { colDataSetNull_f(pOutput->nullbitmap, pos); } else { @@ -2516,7 +2508,7 @@ static void doHandleDiff(SDiffInfo* pDiffInfo, int32_t type, const char* pv, SCo } case TSDB_DATA_TYPE_SMALLINT: { int16_t v = *(int16_t*)pv; - int64_t delta = factor*(v - pDiffInfo->prev.i64); // direct previous may be null + int64_t delta = factor * (v - pDiffInfo->prev.i64); // direct previous may be null if (delta < 0 && pDiffInfo->ignoreNegative) { colDataSetNull_f(pOutput->nullbitmap, pos); } else { @@ -2527,7 +2519,7 @@ static void doHandleDiff(SDiffInfo* pDiffInfo, int32_t type, const char* pv, SCo } case TSDB_DATA_TYPE_BIGINT: { int64_t v = *(int64_t*)pv; - int64_t delta = factor*(v - pDiffInfo->prev.i64); // direct previous may be null + int64_t delta = factor * (v - pDiffInfo->prev.i64); // direct previous may be null if (delta < 0 && pDiffInfo->ignoreNegative) { colDataSetNull_f(pOutput->nullbitmap, pos); } else { @@ -2537,9 +2529,9 @@ static void doHandleDiff(SDiffInfo* pDiffInfo, int32_t type, const char* pv, SCo break; } case TSDB_DATA_TYPE_FLOAT: { - float v = *(float*)pv; - double delta = factor*(v - pDiffInfo->prev.d64); // direct previous may be null - if ((delta < 0 && pDiffInfo->ignoreNegative) || isinf(delta) || isnan(delta)) { //check for overflow + float v = *(float*)pv; + double delta = factor * (v - pDiffInfo->prev.d64); // direct previous may be null + if ((delta < 0 && pDiffInfo->ignoreNegative) || isinf(delta) || isnan(delta)) { // check for overflow colDataSetNull_f(pOutput->nullbitmap, pos); } else { colDataAppendDouble(pOutput, pos, &delta); @@ -2549,8 +2541,8 @@ static void doHandleDiff(SDiffInfo* pDiffInfo, int32_t type, const char* pv, SCo } case TSDB_DATA_TYPE_DOUBLE: { double v = *(double*)pv; - double delta = factor*(v - pDiffInfo->prev.d64); // direct previous may be null - if ((delta < 0 && pDiffInfo->ignoreNegative) || isinf(delta) || isnan(delta)) { //check for overflow + double delta = factor * (v - pDiffInfo->prev.d64); // direct previous may be null + if ((delta < 0 && pDiffInfo->ignoreNegative) || isinf(delta) || isnan(delta)) { // check for overflow colDataSetNull_f(pOutput->nullbitmap, pos); } else { colDataAppendDouble(pOutput, pos, &delta); @@ -2573,7 +2565,7 @@ int32_t diffFunction(SqlFunctionCtx* pCtx) { SColumnInfoData* pTsOutput = pCtx->pTsOutput; int32_t numOfElems = 0; - TSKEY* tsList = (int64_t*)pInput->pPTS->pData; + TSKEY* tsList = (int64_t*)pInput->pPTS->pData; int32_t startOffset = pCtx->offset; SColumnInfoData* pOutput = (SColumnInfoData*)pCtx->pOutput; @@ -2650,9 +2642,7 @@ int32_t diffFunction(SqlFunctionCtx* pCtx) { return numOfElems; } -int32_t getTopBotInfoSize(int64_t numOfItems) { - return sizeof(STopBotRes) + numOfItems * sizeof(STopBotResItem); -} +int32_t getTopBotInfoSize(int64_t numOfItems) { return sizeof(STopBotRes) + numOfItems * sizeof(STopBotResItem); } bool getTopBotFuncEnv(SFunctionNode* pFunc, SFuncExecEnv* pEnv) { SValueNode* pkNode = (SValueNode*)nodesListGetNode(pFunc->pParameterList, 1); @@ -2661,7 +2651,7 @@ bool getTopBotFuncEnv(SFunctionNode* pFunc, SFuncExecEnv* pEnv) { } bool getTopBotMergeFuncEnv(SFunctionNode* pFunc, SFuncExecEnv* pEnv) { - //intermediate result is binary and length contains VAR header size + // intermediate result is binary and length contains VAR header size pEnv->calcMemSize = pFunc->node.resType.bytes; return true; } @@ -2671,7 +2661,7 @@ bool topBotFunctionSetup(SqlFunctionCtx* pCtx, SResultRowEntryInfo* pResInfo) { return false; } - STopBotRes* pRes = GET_ROWCELL_INTERBUF(pResInfo); + STopBotRes* pRes = GET_ROWCELL_INTERBUF(pResInfo); SInputColumnInfoData* pInput = &pCtx->input; pRes->maxSize = pCtx->param[1].param.i; @@ -2747,38 +2737,37 @@ static void topBotTransferInfo(SqlFunctionCtx* pCtx, STopBotRes* pInput, bool is } int32_t topFunctionMerge(SqlFunctionCtx* pCtx) { - SResultRowEntryInfo* pEntryInfo = GET_RES_INFO(pCtx); + SResultRowEntryInfo* pEntryInfo = GET_RES_INFO(pCtx); SInputColumnInfoData* pInput = &pCtx->input; - SColumnInfoData* pCol = pInput->pData[0]; + SColumnInfoData* pCol = pInput->pData[0]; ASSERT(pCol->info.type == TSDB_DATA_TYPE_BINARY); - int32_t start = pInput->startRowIndex; - char* data = colDataGetData(pCol, start); - STopBotRes* pInputInfo = (STopBotRes *)varDataVal(data); + int32_t start = pInput->startRowIndex; + char* data = colDataGetData(pCol, start); + STopBotRes* pInputInfo = (STopBotRes*)varDataVal(data); STopBotRes* pInfo = GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx)); pInfo->maxSize = pInputInfo->maxSize; - pInfo->type = pInputInfo->type; + pInfo->type = pInputInfo->type; topBotTransferInfo(pCtx, pInputInfo, true); SET_VAL(GET_RES_INFO(pCtx), pEntryInfo->numOfRes, pEntryInfo->numOfRes); return TSDB_CODE_SUCCESS; } - int32_t bottomFunctionMerge(SqlFunctionCtx* pCtx) { - SResultRowEntryInfo* pEntryInfo = GET_RES_INFO(pCtx); + SResultRowEntryInfo* pEntryInfo = GET_RES_INFO(pCtx); SInputColumnInfoData* pInput = &pCtx->input; - SColumnInfoData* pCol = pInput->pData[0]; + SColumnInfoData* pCol = pInput->pData[0]; ASSERT(pCol->info.type == TSDB_DATA_TYPE_BINARY); - int32_t start = pInput->startRowIndex; - char* data = colDataGetData(pCol, start); - STopBotRes* pInputInfo = (STopBotRes *)varDataVal(data); + int32_t start = pInput->startRowIndex; + char* data = colDataGetData(pCol, start); + STopBotRes* pInputInfo = (STopBotRes*)varDataVal(data); STopBotRes* pInfo = GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx)); pInfo->maxSize = pInputInfo->maxSize; - pInfo->type = pInputInfo->type; + pInfo->type = pInputInfo->type; topBotTransferInfo(pCtx, pInputInfo, false); SET_VAL(GET_RES_INFO(pCtx), pEntryInfo->numOfRes, pEntryInfo->numOfRes); @@ -2838,15 +2827,12 @@ void doAddIntoResult(SqlFunctionCtx* pCtx, void* pData, int32_t rowIndex, SSData taosheapsort((void*)pItems, sizeof(STopBotResItem), pEntryInfo->numOfRes, (const void*)&type, topBotResComparFn, !isTopQuery); } else { // replace the minimum value in the result - if ((isTopQuery && ( - (IS_SIGNED_NUMERIC_TYPE(type) && val.i > pItems[0].v.i) || - (IS_UNSIGNED_NUMERIC_TYPE(type) && val.u > pItems[0].v.u) || - (IS_FLOAT_TYPE(type) && val.d > pItems[0].v.d))) - || (!isTopQuery && ( - (IS_SIGNED_NUMERIC_TYPE(type) && val.i < pItems[0].v.i) || - (IS_UNSIGNED_NUMERIC_TYPE(type) && val.u < pItems[0].v.u) || - (IS_FLOAT_TYPE(type) && val.d < pItems[0].v.d)) - )) { + if ((isTopQuery && ((IS_SIGNED_NUMERIC_TYPE(type) && val.i > pItems[0].v.i) || + (IS_UNSIGNED_NUMERIC_TYPE(type) && val.u > pItems[0].v.u) || + (IS_FLOAT_TYPE(type) && val.d > pItems[0].v.d))) || + (!isTopQuery && ((IS_SIGNED_NUMERIC_TYPE(type) && val.i < pItems[0].v.i) || + (IS_UNSIGNED_NUMERIC_TYPE(type) && val.u < pItems[0].v.u) || + (IS_FLOAT_TYPE(type) && val.d < pItems[0].v.d)))) { // replace the old data and the coresponding tuple data STopBotResItem* pItem = &pItems[0]; pItem->v = val; @@ -2965,9 +2951,7 @@ int32_t topBotFinalizeImpl(SqlFunctionCtx* pCtx, SSDataBlock* pBlock, bool isMer return pEntryInfo->numOfRes; } -int32_t topBotFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { - return topBotFinalizeImpl(pCtx, pBlock, false); -} +int32_t topBotFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { return topBotFinalizeImpl(pCtx, pBlock, false); } int32_t topBotMergeFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { return topBotFinalizeImpl(pCtx, pBlock, true); @@ -2975,9 +2959,9 @@ int32_t topBotMergeFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { int32_t topBotPartialFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { SResultRowEntryInfo* pEntryInfo = GET_RES_INFO(pCtx); - STopBotRes* pRes = GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx)); - int32_t resultBytes = getTopBotInfoSize(pRes->maxSize); - char *res = taosMemoryCalloc(resultBytes + VARSTR_HEADER_SIZE, sizeof(char)); + STopBotRes* pRes = GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx)); + int32_t resultBytes = getTopBotInfoSize(pRes->maxSize); + char* res = taosMemoryCalloc(resultBytes + VARSTR_HEADER_SIZE, sizeof(char)); memcpy(varDataVal(res), pRes, resultBytes); varDataSetLen(res, resultBytes); @@ -2991,11 +2975,10 @@ int32_t topBotPartialFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { return 1; } -void addResult(SqlFunctionCtx* pCtx, STopBotResItem* pSourceItem, int16_t type, - bool isTopQuery) { +void addResult(SqlFunctionCtx* pCtx, STopBotResItem* pSourceItem, int16_t type, bool isTopQuery) { SResultRowEntryInfo* pEntryInfo = GET_RES_INFO(pCtx); - STopBotRes* pRes = getTopBotOutputInfo(pCtx); - STopBotResItem* pItems = pRes->pItems; + STopBotRes* pRes = getTopBotOutputInfo(pCtx); + STopBotResItem* pItems = pRes->pItems; assert(pItems != NULL); // not full yet @@ -3011,15 +2994,12 @@ void addResult(SqlFunctionCtx* pCtx, STopBotResItem* pSourceItem, int16_t type, taosheapsort((void*)pItems, sizeof(STopBotResItem), pEntryInfo->numOfRes, (const void*)&type, topBotResComparFn, !isTopQuery); } else { // replace the minimum value in the result - if ((isTopQuery && ( - (IS_SIGNED_NUMERIC_TYPE(type) && pSourceItem->v.i > pItems[0].v.i) || - (IS_UNSIGNED_NUMERIC_TYPE(type) && pSourceItem->v.u > pItems[0].v.u) || - (IS_FLOAT_TYPE(type) && pSourceItem->v.d > pItems[0].v.d))) - || (!isTopQuery && ( - (IS_SIGNED_NUMERIC_TYPE(type) && pSourceItem->v.i < pItems[0].v.i) || - (IS_UNSIGNED_NUMERIC_TYPE(type) && pSourceItem->v.u < pItems[0].v.u) || - (IS_FLOAT_TYPE(type) && pSourceItem->v.d < pItems[0].v.d)) - )) { + if ((isTopQuery && ((IS_SIGNED_NUMERIC_TYPE(type) && pSourceItem->v.i > pItems[0].v.i) || + (IS_UNSIGNED_NUMERIC_TYPE(type) && pSourceItem->v.u > pItems[0].v.u) || + (IS_FLOAT_TYPE(type) && pSourceItem->v.d > pItems[0].v.d))) || + (!isTopQuery && ((IS_SIGNED_NUMERIC_TYPE(type) && pSourceItem->v.i < pItems[0].v.i) || + (IS_UNSIGNED_NUMERIC_TYPE(type) && pSourceItem->v.u < pItems[0].v.u) || + (IS_FLOAT_TYPE(type) && pSourceItem->v.d < pItems[0].v.d)))) { // replace the old data and the coresponding tuple data STopBotResItem* pItem = &pItems[0]; pItem->v = pSourceItem->v; @@ -3034,7 +3014,7 @@ void addResult(SqlFunctionCtx* pCtx, STopBotResItem* pSourceItem, int16_t type, } int32_t topCombine(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx) { - int32_t type = pDestCtx->input.pData[0]->info.type; + int32_t type = pDestCtx->input.pData[0]->info.type; SResultRowEntryInfo* pSResInfo = GET_RES_INFO(pSourceCtx); STopBotRes* pSBuf = getTopBotOutputInfo(pSourceCtx); for (int32_t i = 0; i < pSResInfo->numOfRes; i++) { @@ -3044,7 +3024,7 @@ int32_t topCombine(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx) { } int32_t bottomCombine(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx) { - int32_t type = pDestCtx->input.pData[0]->info.type; + int32_t type = pDestCtx->input.pData[0]->info.type; SResultRowEntryInfo* pSResInfo = GET_RES_INFO(pSourceCtx); STopBotRes* pSBuf = getTopBotOutputInfo(pSourceCtx); for (int32_t i = 0; i < pSResInfo->numOfRes; i++) { @@ -3053,16 +3033,14 @@ int32_t bottomCombine(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx) { return TSDB_CODE_SUCCESS; } -int32_t getSpreadInfoSize() { - return (int32_t)sizeof(SSpreadInfo); -} +int32_t getSpreadInfoSize() { return (int32_t)sizeof(SSpreadInfo); } bool getSpreadFuncEnv(SFunctionNode* UNUSED_PARAM(pFunc), SFuncExecEnv* pEnv) { pEnv->calcMemSize = sizeof(SSpreadInfo); return true; } -bool spreadFunctionSetup(SqlFunctionCtx *pCtx, SResultRowEntryInfo* pResultInfo) { +bool spreadFunctionSetup(SqlFunctionCtx* pCtx, SResultRowEntryInfo* pResultInfo) { if (!functionSetup(pCtx, pResultInfo)) { return false; } @@ -3074,13 +3052,13 @@ bool spreadFunctionSetup(SqlFunctionCtx *pCtx, SResultRowEntryInfo* pResultInfo) return true; } -int32_t spreadFunction(SqlFunctionCtx *pCtx) { +int32_t spreadFunction(SqlFunctionCtx* pCtx) { int32_t numOfElems = 0; // Only the pre-computing information loaded and actual data does not loaded SInputColumnInfoData* pInput = &pCtx->input; - SColumnDataAgg *pAgg = pInput->pColumnDataAgg[0]; - int32_t type = pInput->pData[0]->info.type; + SColumnDataAgg* pAgg = pInput->pColumnDataAgg[0]; + int32_t type = pInput->pData[0]->info.type; SSpreadInfo* pInfo = GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx)); @@ -3112,7 +3090,7 @@ int32_t spreadFunction(SqlFunctionCtx *pCtx) { } else { // computing based on the true data block SColumnInfoData* pCol = pInput->pData[0]; - int32_t start = pInput->startRowIndex; + int32_t start = pInput->startRowIndex; int32_t numOfRows = pInput->numOfRows; // check the valid data one by one @@ -3121,7 +3099,7 @@ int32_t spreadFunction(SqlFunctionCtx *pCtx) { continue; } - char *data = colDataGetData(pCol, i); + char* data = colDataGetData(pCol, i); double v = 0; GET_TYPED_DATA(v, double, type, data); @@ -3158,17 +3136,17 @@ static void spreadTransferInfo(SSpreadInfo* pInput, SSpreadInfo* pOutput) { } } -int32_t spreadFunctionMerge(SqlFunctionCtx *pCtx) { +int32_t spreadFunctionMerge(SqlFunctionCtx* pCtx) { SInputColumnInfoData* pInput = &pCtx->input; - SColumnInfoData* pCol = pInput->pData[0]; + SColumnInfoData* pCol = pInput->pData[0]; ASSERT(pCol->info.type == TSDB_DATA_TYPE_BINARY); SSpreadInfo* pInfo = GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx)); SSpreadInfo* pInputInfo; int32_t start = pInput->startRowIndex; - char* data = colDataGetData(pCol, start); - pInputInfo = (SSpreadInfo *)varDataVal(data); + char* data = colDataGetData(pCol, start); + pInputInfo = (SSpreadInfo*)varDataVal(data); spreadTransferInfo(pInputInfo, pInfo); @@ -3188,8 +3166,8 @@ int32_t spreadFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { int32_t spreadPartialFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { SResultRowEntryInfo* pResInfo = GET_RES_INFO(pCtx); SSpreadInfo* pInfo = GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx)); - int32_t resultBytes = getSpreadInfoSize(); - char *res = taosMemoryCalloc(resultBytes + VARSTR_HEADER_SIZE, sizeof(char)); + int32_t resultBytes = getSpreadInfoSize(); + char* res = taosMemoryCalloc(resultBytes + VARSTR_HEADER_SIZE, sizeof(char)); memcpy(varDataVal(res), pInfo, resultBytes); varDataSetLen(res, resultBytes); @@ -3205,25 +3183,23 @@ int32_t spreadPartialFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { int32_t spreadCombine(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx) { SResultRowEntryInfo* pDResInfo = GET_RES_INFO(pDestCtx); - SSpreadInfo* pDBuf = GET_ROWCELL_INTERBUF(pDResInfo); + SSpreadInfo* pDBuf = GET_ROWCELL_INTERBUF(pDResInfo); SResultRowEntryInfo* pSResInfo = GET_RES_INFO(pSourceCtx); - SSpreadInfo* pSBuf = GET_ROWCELL_INTERBUF(pSResInfo); + SSpreadInfo* pSBuf = GET_ROWCELL_INTERBUF(pSResInfo); spreadTransferInfo(pSBuf, pDBuf); pDResInfo->numOfRes = TMAX(pDResInfo->numOfRes, pSResInfo->numOfRes); return TSDB_CODE_SUCCESS; } -int32_t getElapsedInfoSize() { - return (int32_t)sizeof(SElapsedInfo); -} +int32_t getElapsedInfoSize() { return (int32_t)sizeof(SElapsedInfo); } bool getElapsedFuncEnv(SFunctionNode* UNUSED_PARAM(pFunc), SFuncExecEnv* pEnv) { pEnv->calcMemSize = sizeof(SElapsedInfo); return true; } -bool elapsedFunctionSetup(SqlFunctionCtx *pCtx, SResultRowEntryInfo* pResultInfo) { +bool elapsedFunctionSetup(SqlFunctionCtx* pCtx, SResultRowEntryInfo* pResultInfo) { if (!functionSetup(pCtx, pResultInfo)) { return false; } @@ -3242,16 +3218,16 @@ bool elapsedFunctionSetup(SqlFunctionCtx *pCtx, SResultRowEntryInfo* pResultInfo return true; } -int32_t elapsedFunction(SqlFunctionCtx *pCtx) { +int32_t elapsedFunction(SqlFunctionCtx* pCtx) { int32_t numOfElems = 0; // Only the pre-computing information loaded and actual data does not loaded SInputColumnInfoData* pInput = &pCtx->input; - SColumnDataAgg *pAgg = pInput->pColumnDataAgg[0]; + SColumnDataAgg* pAgg = pInput->pColumnDataAgg[0]; SElapsedInfo* pInfo = GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx)); - numOfElems = pInput->numOfRows; //since this is the primary timestamp, no need to exclude NULL values + numOfElems = pInput->numOfRows; // since this is the primary timestamp, no need to exclude NULL values if (numOfElems == 0) { goto _elapsed_over; } @@ -3283,11 +3259,12 @@ int32_t elapsedFunction(SqlFunctionCtx *pCtx) { SColumnInfoData* pCol = pInput->pData[0]; - int32_t start = pInput->startRowIndex; - TSKEY* ptsList = (int64_t*)colDataGetData(pCol, start); + int32_t start = pInput->startRowIndex; + TSKEY* ptsList = (int64_t*)colDataGetData(pCol, start); if (pCtx->order == TSDB_ORDER_DESC) { if (pCtx->start.key == INT64_MIN) { - pInfo->max = (pInfo->max < ptsList[start + pInput->numOfRows - 1]) ? ptsList[start + pInput->numOfRows - 1] : pInfo->max; + pInfo->max = + (pInfo->max < ptsList[start + pInput->numOfRows - 1]) ? ptsList[start + pInput->numOfRows - 1] : pInfo->max; } else { pInfo->max = pCtx->start.key + 1; } @@ -3330,16 +3307,16 @@ static void elapsedTransferInfo(SElapsedInfo* pInput, SElapsedInfo* pOutput) { } } -int32_t elapsedFunctionMerge(SqlFunctionCtx *pCtx) { +int32_t elapsedFunctionMerge(SqlFunctionCtx* pCtx) { SInputColumnInfoData* pInput = &pCtx->input; - SColumnInfoData* pCol = pInput->pData[0]; + SColumnInfoData* pCol = pInput->pData[0]; ASSERT(pCol->info.type == TSDB_DATA_TYPE_BINARY); SElapsedInfo* pInfo = GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx)); - int32_t start = pInput->startRowIndex; - char* data = colDataGetData(pCol, start); - SElapsedInfo* pInputInfo = (SElapsedInfo *)varDataVal(data); + int32_t start = pInput->startRowIndex; + char* data = colDataGetData(pCol, start); + SElapsedInfo* pInputInfo = (SElapsedInfo*)varDataVal(data); elapsedTransferInfo(pInputInfo, pInfo); @@ -3349,7 +3326,7 @@ int32_t elapsedFunctionMerge(SqlFunctionCtx *pCtx) { int32_t elapsedFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { SElapsedInfo* pInfo = GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx)); - double result = (double)pInfo->max - (double)pInfo->min; + double result = (double)pInfo->max - (double)pInfo->min; result = (result >= 0) ? result : -result; pInfo->result = result / pInfo->timeUnit; return functionFinalize(pCtx, pBlock); @@ -3357,9 +3334,9 @@ int32_t elapsedFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { int32_t elapsedPartialFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { SResultRowEntryInfo* pResInfo = GET_RES_INFO(pCtx); - SElapsedInfo* pInfo = GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx)); - int32_t resultBytes = getElapsedInfoSize(); - char *res = taosMemoryCalloc(resultBytes + VARSTR_HEADER_SIZE, sizeof(char)); + SElapsedInfo* pInfo = GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx)); + int32_t resultBytes = getElapsedInfoSize(); + char* res = taosMemoryCalloc(resultBytes + VARSTR_HEADER_SIZE, sizeof(char)); memcpy(varDataVal(res), pInfo, resultBytes); varDataSetLen(res, resultBytes); @@ -3375,10 +3352,10 @@ int32_t elapsedPartialFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { int32_t elapsedCombine(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx) { SResultRowEntryInfo* pDResInfo = GET_RES_INFO(pDestCtx); - SElapsedInfo* pDBuf = GET_ROWCELL_INTERBUF(pDResInfo); + SElapsedInfo* pDBuf = GET_ROWCELL_INTERBUF(pDResInfo); SResultRowEntryInfo* pSResInfo = GET_RES_INFO(pSourceCtx); - SElapsedInfo* pSBuf = GET_ROWCELL_INTERBUF(pSResInfo); + SElapsedInfo* pSBuf = GET_ROWCELL_INTERBUF(pSResInfo); elapsedTransferInfo(pSBuf, pDBuf); pDResInfo->numOfRes = TMAX(pDResInfo->numOfRes, pSResInfo->numOfRes); @@ -3394,7 +3371,7 @@ bool getHistogramFuncEnv(SFunctionNode* UNUSED_PARAM(pFunc), SFuncExecEnv* pEnv) return true; } -static int8_t getHistogramBinType(char *binTypeStr) { +static int8_t getHistogramBinType(char* binTypeStr) { int8_t binType; if (strcasecmp(binTypeStr, "user_input") == 0) { binType = USER_INPUT_BIN; @@ -3409,7 +3386,7 @@ static int8_t getHistogramBinType(char *binTypeStr) { return binType; } -static bool getHistogramBinDesc(SHistoFuncInfo *pInfo, char *binDescStr, int8_t binType, bool normalized) { +static bool getHistogramBinDesc(SHistoFuncInfo* pInfo, char* binDescStr, int8_t binType, bool normalized) { cJSON* binDesc = cJSON_Parse(binDescStr); int32_t numOfBins; double* intervals; @@ -3420,17 +3397,17 @@ static bool getHistogramBinDesc(SHistoFuncInfo *pInfo, char *binDescStr, int8_t return false; } - cJSON* start = cJSON_GetObjectItem(binDesc, "start"); - cJSON* factor = cJSON_GetObjectItem(binDesc, "factor"); - cJSON* width = cJSON_GetObjectItem(binDesc, "width"); - cJSON* count = cJSON_GetObjectItem(binDesc, "count"); + cJSON* start = cJSON_GetObjectItem(binDesc, "start"); + cJSON* factor = cJSON_GetObjectItem(binDesc, "factor"); + cJSON* width = cJSON_GetObjectItem(binDesc, "width"); + cJSON* count = cJSON_GetObjectItem(binDesc, "count"); cJSON* infinity = cJSON_GetObjectItem(binDesc, "infinity"); if (!cJSON_IsNumber(start) || !cJSON_IsNumber(count) || !cJSON_IsBool(infinity)) { return false; } - if (count->valueint <= 0 || count->valueint > 1000) { // limit count to 1000 + if (count->valueint <= 0 || count->valueint > 1000) { // limit count to 1000 return false; } @@ -3524,7 +3501,7 @@ static bool getHistogramBinDesc(SHistoFuncInfo *pInfo, char *binDescStr, int8_t return false; } - pInfo->numOfBins = numOfBins - 1; + pInfo->numOfBins = numOfBins - 1; pInfo->normalized = normalized; for (int32_t i = 0; i < pInfo->numOfBins; ++i) { pInfo->bins[i].lower = intervals[i] < intervals[i + 1] ? intervals[i] : intervals[i + 1]; @@ -3536,12 +3513,12 @@ static bool getHistogramBinDesc(SHistoFuncInfo *pInfo, char *binDescStr, int8_t return true; } -bool histogramFunctionSetup(SqlFunctionCtx *pCtx, SResultRowEntryInfo *pResultInfo) { +bool histogramFunctionSetup(SqlFunctionCtx* pCtx, SResultRowEntryInfo* pResultInfo) { if (!functionSetup(pCtx, pResultInfo)) { return false; } - SHistoFuncInfo *pInfo = GET_ROWCELL_INTERBUF(pResultInfo); + SHistoFuncInfo* pInfo = GET_ROWCELL_INTERBUF(pResultInfo); pInfo->numOfBins = 0; pInfo->totalCount = 0; pInfo->normalized = 0; @@ -3550,7 +3527,7 @@ bool histogramFunctionSetup(SqlFunctionCtx *pCtx, SResultRowEntryInfo *pResultIn if (binType == UNKNOWN_BIN) { return false; } - char* binDesc = varDataVal(pCtx->param[2].param.pz); + char* binDesc = varDataVal(pCtx->param[2].param.pz); int64_t normalized = pCtx->param[3].param.i; if (normalized != 0 && normalized != 1) { return false; @@ -3562,7 +3539,7 @@ bool histogramFunctionSetup(SqlFunctionCtx *pCtx, SResultRowEntryInfo *pResultIn return true; } -int32_t histogramFunction(SqlFunctionCtx *pCtx) { +int32_t histogramFunction(SqlFunctionCtx* pCtx) { SHistoFuncInfo* pInfo = GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx)); SInputColumnInfoData* pInput = &pCtx->input; @@ -3581,7 +3558,7 @@ int32_t histogramFunction(SqlFunctionCtx *pCtx) { numOfElems++; - char* data = colDataGetData(pCol, i); + char* data = colDataGetData(pCol, i); double v; GET_TYPED_DATA(v, double, type, data); @@ -3592,7 +3569,6 @@ int32_t histogramFunction(SqlFunctionCtx *pCtx) { break; } } - } SET_VAL(GET_RES_INFO(pCtx), numOfElems, pInfo->numOfBins); @@ -3601,7 +3577,7 @@ int32_t histogramFunction(SqlFunctionCtx *pCtx) { static void histogramTransferInfo(SHistoFuncInfo* pInput, SHistoFuncInfo* pOutput) { pOutput->normalized = pInput->normalized; - pOutput->numOfBins = pInput->numOfBins; + pOutput->numOfBins = pInput->numOfBins; pOutput->totalCount += pInput->totalCount; for (int32_t k = 0; k < pOutput->numOfBins; ++k) { pOutput->bins[k].lower = pInput->bins[k].lower; @@ -3610,16 +3586,16 @@ static void histogramTransferInfo(SHistoFuncInfo* pInput, SHistoFuncInfo* pOutpu } } -int32_t histogramFunctionMerge(SqlFunctionCtx *pCtx) { +int32_t histogramFunctionMerge(SqlFunctionCtx* pCtx) { SInputColumnInfoData* pInput = &pCtx->input; - SColumnInfoData* pCol = pInput->pData[0]; + SColumnInfoData* pCol = pInput->pData[0]; ASSERT(pCol->info.type == TSDB_DATA_TYPE_BINARY); SHistoFuncInfo* pInfo = GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx)); - int32_t start = pInput->startRowIndex; - char* data = colDataGetData(pCol, start); - SHistoFuncInfo* pInputInfo = (SHistoFuncInfo *)varDataVal(data); + int32_t start = pInput->startRowIndex; + char* data = colDataGetData(pCol, start); + SHistoFuncInfo* pInputInfo = (SHistoFuncInfo*)varDataVal(data); histogramTransferInfo(pInputInfo, pInfo); @@ -3629,15 +3605,15 @@ int32_t histogramFunctionMerge(SqlFunctionCtx *pCtx) { int32_t histogramFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { SResultRowEntryInfo* pResInfo = GET_RES_INFO(pCtx); - SHistoFuncInfo* pInfo = GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx)); - int32_t slotId = pCtx->pExpr->base.resSchema.slotId; - SColumnInfoData* pCol = taosArrayGet(pBlock->pDataBlock, slotId); + SHistoFuncInfo* pInfo = GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx)); + int32_t slotId = pCtx->pExpr->base.resSchema.slotId; + SColumnInfoData* pCol = taosArrayGet(pBlock->pDataBlock, slotId); int32_t currentRow = pBlock->info.rows; if (pInfo->normalized) { for (int32_t k = 0; k < pResInfo->numOfRes; ++k) { - if(pInfo->totalCount != 0) { + if (pInfo->totalCount != 0) { pInfo->bins[k].percentage = pInfo->bins[k].count / (double)pInfo->totalCount; } else { pInfo->bins[k].percentage = 0; @@ -3647,13 +3623,13 @@ int32_t histogramFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { for (int32_t i = 0; i < pResInfo->numOfRes; ++i) { int32_t len; - char buf[512] = {0}; + char buf[512] = {0}; if (!pInfo->normalized) { - len = sprintf(varDataVal(buf), "{\"lower_bin\":%g, \"upper_bin\":%g, \"count\":%"PRId64"}", - pInfo->bins[i].lower, pInfo->bins[i].upper, pInfo->bins[i].count); + len = sprintf(varDataVal(buf), "{\"lower_bin\":%g, \"upper_bin\":%g, \"count\":%" PRId64 "}", + pInfo->bins[i].lower, pInfo->bins[i].upper, pInfo->bins[i].count); } else { - len = sprintf(varDataVal(buf), "{\"lower_bin\":%g, \"upper_bin\":%g, \"count\":%lf}", - pInfo->bins[i].lower, pInfo->bins[i].upper, pInfo->bins[i].percentage); + len = sprintf(varDataVal(buf), "{\"lower_bin\":%g, \"upper_bin\":%g, \"count\":%lf}", pInfo->bins[i].lower, + pInfo->bins[i].upper, pInfo->bins[i].percentage); } varDataSetLen(buf, len); colDataAppend(pCol, currentRow, buf, false); @@ -3665,8 +3641,8 @@ int32_t histogramFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { int32_t histogramPartialFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { SHistoFuncInfo* pInfo = GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx)); - int32_t resultBytes = getHistogramInfoSize(); - char *res = taosMemoryCalloc(resultBytes + VARSTR_HEADER_SIZE, sizeof(char)); + int32_t resultBytes = getHistogramInfoSize(); + char* res = taosMemoryCalloc(resultBytes + VARSTR_HEADER_SIZE, sizeof(char)); memcpy(varDataVal(res), pInfo, resultBytes); varDataSetLen(res, resultBytes); @@ -3692,23 +3668,21 @@ int32_t histogramCombine(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx) { return TSDB_CODE_SUCCESS; } -int32_t getHLLInfoSize() { - return (int32_t)sizeof(SHLLInfo); -} +int32_t getHLLInfoSize() { return (int32_t)sizeof(SHLLInfo); } bool getHLLFuncEnv(SFunctionNode* UNUSED_PARAM(pFunc), SFuncExecEnv* pEnv) { pEnv->calcMemSize = sizeof(SHLLInfo); return true; } -static uint8_t hllCountNum(void* data, int32_t bytes, int32_t *buk) { +static uint8_t hllCountNum(void* data, int32_t bytes, int32_t* buk) { uint64_t hash = MurmurHash3_64(data, bytes); - int32_t index = hash & HLL_BUCKET_MASK; + int32_t index = hash & HLL_BUCKET_MASK; hash >>= HLL_BUCKET_BITS; hash |= ((uint64_t)1 << HLL_DATA_BITS); uint64_t bit = 1; - uint8_t count = 1; - while((hash & bit) == 0) { + uint8_t count = 1; + while ((hash & bit) == 0) { count++; bit <<= 1; } @@ -3716,15 +3690,15 @@ static uint8_t hllCountNum(void* data, int32_t bytes, int32_t *buk) { return count; } -static void hllBucketHisto(uint8_t *buckets, int32_t* bucketHisto) { - uint64_t *word = (uint64_t*) buckets; - uint8_t *bytes; +static void hllBucketHisto(uint8_t* buckets, int32_t* bucketHisto) { + uint64_t* word = (uint64_t*)buckets; + uint8_t* bytes; - for (int32_t j = 0; j < HLL_BUCKETS>>3; j++) { + for (int32_t j = 0; j < HLL_BUCKETS >> 3; j++) { if (*word == 0) { bucketHisto[0] += 8; } else { - bytes = (uint8_t*) word; + bytes = (uint8_t*)word; bucketHisto[bytes[0]]++; bucketHisto[bytes[1]]++; bucketHisto[bytes[2]]++; @@ -3746,8 +3720,8 @@ static double hllTau(double x) { x = sqrt(x); zPrime = z; y *= 0.5; - z -= pow(1 - x, 2)*y; - } while(zPrime != z); + z -= pow(1 - x, 2) * y; + } while (zPrime != z); return z / 3; } @@ -3761,35 +3735,36 @@ static double hllSigma(double x) { zPrime = z; z += x * y; y += y; - } while(zPrime != z); + } while (zPrime != z); return z; } -// estimate the cardinality, the algorithm refer this paper: "New cardinality estimation algorithms for HyperLogLog sketches" -static uint64_t hllCountCnt(uint8_t *buckets) { - double m = HLL_BUCKETS; +// estimate the cardinality, the algorithm refer this paper: "New cardinality estimation algorithms for HyperLogLog +// sketches" +static uint64_t hllCountCnt(uint8_t* buckets) { + double m = HLL_BUCKETS; int32_t buckethisto[64] = {0}; - hllBucketHisto(buckets,buckethisto); + hllBucketHisto(buckets, buckethisto); - double z = m * hllTau((m-buckethisto[HLL_DATA_BITS+1])/(double)m); + double z = m * hllTau((m - buckethisto[HLL_DATA_BITS + 1]) / (double)m); for (int j = HLL_DATA_BITS; j >= 1; --j) { z += buckethisto[j]; z *= 0.5; } - z += m * hllSigma(buckethisto[0]/(double)m); - double E = (double)llroundl(HLL_ALPHA_INF*m*m/z); + z += m * hllSigma(buckethisto[0] / (double)m); + double E = (double)llroundl(HLL_ALPHA_INF * m * m / z); - return (uint64_t) E; + return (uint64_t)E; } -int32_t hllFunction(SqlFunctionCtx *pCtx) { +int32_t hllFunction(SqlFunctionCtx* pCtx) { SHLLInfo* pInfo = GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx)); SInputColumnInfoData* pInput = &pCtx->input; SColumnInfoData* pCol = pInput->pData[0]; - int32_t type = pCol->info.type; + int32_t type = pCol->info.type; int32_t bytes = pCol->info.bytes; int32_t start = pInput->startRowIndex; @@ -3829,16 +3804,16 @@ static void hllTransferInfo(SHLLInfo* pInput, SHLLInfo* pOutput) { } } -int32_t hllFunctionMerge(SqlFunctionCtx *pCtx) { +int32_t hllFunctionMerge(SqlFunctionCtx* pCtx) { SInputColumnInfoData* pInput = &pCtx->input; - SColumnInfoData* pCol = pInput->pData[0]; + SColumnInfoData* pCol = pInput->pData[0]; ASSERT(pCol->info.type == TSDB_DATA_TYPE_BINARY); SHLLInfo* pInfo = GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx)); - int32_t start = pInput->startRowIndex; - char* data = colDataGetData(pCol, start); - SHLLInfo* pInputInfo = (SHLLInfo *)varDataVal(data); + int32_t start = pInput->startRowIndex; + char* data = colDataGetData(pCol, start); + SHLLInfo* pInputInfo = (SHLLInfo*)varDataVal(data); hllTransferInfo(pInputInfo, pInfo); @@ -3847,7 +3822,7 @@ int32_t hllFunctionMerge(SqlFunctionCtx *pCtx) { } int32_t hllFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { - SResultRowEntryInfo *pInfo = GET_RES_INFO(pCtx); + SResultRowEntryInfo* pInfo = GET_RES_INFO(pCtx); SHLLInfo* pHllInfo = GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx)); pHllInfo->result = hllCountCnt(pHllInfo->buckets); @@ -3860,9 +3835,9 @@ int32_t hllFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { int32_t hllPartialFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { SResultRowEntryInfo* pResInfo = GET_RES_INFO(pCtx); - SHLLInfo* pInfo = GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx)); - int32_t resultBytes = getHLLInfoSize(); - char *res = taosMemoryCalloc(resultBytes + VARSTR_HEADER_SIZE, sizeof(char)); + SHLLInfo* pInfo = GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx)); + int32_t resultBytes = getHLLInfoSize(); + char* res = taosMemoryCalloc(resultBytes + VARSTR_HEADER_SIZE, sizeof(char)); memcpy(varDataVal(res), pInfo, resultBytes); varDataSetLen(res, resultBytes); @@ -3878,10 +3853,10 @@ int32_t hllPartialFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { int32_t hllCombine(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx) { SResultRowEntryInfo* pDResInfo = GET_RES_INFO(pDestCtx); - SHLLInfo* pDBuf = GET_ROWCELL_INTERBUF(pDResInfo); + SHLLInfo* pDBuf = GET_ROWCELL_INTERBUF(pDResInfo); SResultRowEntryInfo* pSResInfo = GET_RES_INFO(pSourceCtx); - SHLLInfo* pSBuf = GET_ROWCELL_INTERBUF(pSResInfo); + SHLLInfo* pSBuf = GET_ROWCELL_INTERBUF(pSResInfo); hllTransferInfo(pSBuf, pDBuf); pDResInfo->numOfRes = TMAX(pDResInfo->numOfRes, pSResInfo->numOfRes); @@ -3893,7 +3868,7 @@ bool getStateFuncEnv(SFunctionNode* UNUSED_PARAM(pFunc), SFuncExecEnv* pEnv) { return true; } -static int8_t getStateOpType(char *opStr) { +static int8_t getStateOpType(char* opStr) { int8_t opType; if (strcasecmp(opStr, "LT") == 0) { opType = STATE_OPER_LT; @@ -3914,88 +3889,86 @@ static int8_t getStateOpType(char *opStr) { return opType; } -#define GET_STATE_VAL(param) \ - ((param.nType == TSDB_DATA_TYPE_BIGINT) ? (param.i) : (param.d)) +#define GET_STATE_VAL(param) ((param.nType == TSDB_DATA_TYPE_BIGINT) ? (param.i) : (param.d)) -#define STATE_COMP(_op, _lval, _param) \ - STATE_COMP_IMPL(_op, _lval, GET_STATE_VAL(_param)) +#define STATE_COMP(_op, _lval, _param) STATE_COMP_IMPL(_op, _lval, GET_STATE_VAL(_param)) -#define STATE_COMP_IMPL(_op, _lval, _rval) \ - do { \ - switch(_op) { \ - case STATE_OPER_LT: \ - return ((_lval) < (_rval)); \ - break; \ - case STATE_OPER_GT: \ - return ((_lval) > (_rval)); \ - break; \ - case STATE_OPER_LE: \ - return ((_lval) <= (_rval)); \ - break; \ - case STATE_OPER_GE: \ - return ((_lval) >= (_rval)); \ - break; \ - case STATE_OPER_NE: \ - return ((_lval) != (_rval)); \ - break; \ - case STATE_OPER_EQ: \ - return ((_lval) == (_rval)); \ - break; \ - default: \ - break; \ - } \ +#define STATE_COMP_IMPL(_op, _lval, _rval) \ + do { \ + switch (_op) { \ + case STATE_OPER_LT: \ + return ((_lval) < (_rval)); \ + break; \ + case STATE_OPER_GT: \ + return ((_lval) > (_rval)); \ + break; \ + case STATE_OPER_LE: \ + return ((_lval) <= (_rval)); \ + break; \ + case STATE_OPER_GE: \ + return ((_lval) >= (_rval)); \ + break; \ + case STATE_OPER_NE: \ + return ((_lval) != (_rval)); \ + break; \ + case STATE_OPER_EQ: \ + return ((_lval) == (_rval)); \ + break; \ + default: \ + break; \ + } \ } while (0) static bool checkStateOp(int8_t op, SColumnInfoData* pCol, int32_t index, SVariant param) { char* data = colDataGetData(pCol, index); - switch(pCol->info.type) { + switch (pCol->info.type) { case TSDB_DATA_TYPE_TINYINT: { - int8_t v = *(int8_t *)data; + int8_t v = *(int8_t*)data; STATE_COMP(op, v, param); break; } case TSDB_DATA_TYPE_UTINYINT: { - uint8_t v = *(uint8_t *)data; + uint8_t v = *(uint8_t*)data; STATE_COMP(op, v, param); break; } case TSDB_DATA_TYPE_SMALLINT: { - int16_t v = *(int16_t *)data; + int16_t v = *(int16_t*)data; STATE_COMP(op, v, param); break; } case TSDB_DATA_TYPE_USMALLINT: { - uint16_t v = *(uint16_t *)data; + uint16_t v = *(uint16_t*)data; STATE_COMP(op, v, param); break; } case TSDB_DATA_TYPE_INT: { - int32_t v = *(int32_t *)data; + int32_t v = *(int32_t*)data; STATE_COMP(op, v, param); break; } case TSDB_DATA_TYPE_UINT: { - uint32_t v = *(uint32_t *)data; + uint32_t v = *(uint32_t*)data; STATE_COMP(op, v, param); break; } case TSDB_DATA_TYPE_BIGINT: { - int64_t v = *(int64_t *)data; + int64_t v = *(int64_t*)data; STATE_COMP(op, v, param); break; } case TSDB_DATA_TYPE_UBIGINT: { - uint64_t v = *(uint64_t *)data; + uint64_t v = *(uint64_t*)data; STATE_COMP(op, v, param); break; } case TSDB_DATA_TYPE_FLOAT: { - float v = *(float *)data; + float v = *(float*)data; STATE_COMP(op, v, param); break; } case TSDB_DATA_TYPE_DOUBLE: { - double v = *(double *)data; + double v = *(double*)data; STATE_COMP(op, v, param); break; } @@ -4014,7 +3987,7 @@ int32_t stateCountFunction(SqlFunctionCtx* pCtx) { SColumnInfoData* pInputCol = pInput->pData[0]; - int32_t numOfElems = 0; + int32_t numOfElems = 0; SColumnInfoData* pOutput = (SColumnInfoData*)pCtx->pOutput; int8_t op = getStateOpType(varDataVal(pCtx->param[1].param.pz)); @@ -4029,14 +4002,14 @@ int32_t stateCountFunction(SqlFunctionCtx* pCtx) { continue; } - bool ret = checkStateOp(op, pInputCol, i, pCtx->param[2].param); + bool ret = checkStateOp(op, pInputCol, i, pCtx->param[2].param); int64_t output = -1; if (ret) { output = ++pInfo->count; } else { pInfo->count = 0; } - colDataAppend(pOutput, i, (char *)&output, false); + colDataAppend(pOutput, i, (char*)&output, false); } return numOfElems; @@ -4047,16 +4020,16 @@ int32_t stateDurationFunction(SqlFunctionCtx* pCtx) { SStateInfo* pInfo = GET_ROWCELL_INTERBUF(pResInfo); SInputColumnInfoData* pInput = &pCtx->input; - TSKEY* tsList = (int64_t*)pInput->pPTS->pData; + TSKEY* tsList = (int64_t*)pInput->pPTS->pData; SColumnInfoData* pInputCol = pInput->pData[0]; - int32_t numOfElems = 0; + int32_t numOfElems = 0; SColumnInfoData* pOutput = (SColumnInfoData*)pCtx->pOutput; - //TODO: process timeUnit for different db precisions + // TODO: process timeUnit for different db precisions int32_t timeUnit = 1000; - if (pCtx->numOfParams == 5) { //TODO: param number incorrect + if (pCtx->numOfParams == 5) { // TODO: param number incorrect timeUnit = pCtx->param[3].param.i; } @@ -4072,7 +4045,7 @@ int32_t stateDurationFunction(SqlFunctionCtx* pCtx) { continue; } - bool ret = checkStateOp(op, pInputCol, i, pCtx->param[2].param); + bool ret = checkStateOp(op, pInputCol, i, pCtx->param[2].param); int64_t output = -1; if (ret) { if (pInfo->durationStart == 0) { @@ -4084,7 +4057,7 @@ int32_t stateDurationFunction(SqlFunctionCtx* pCtx) { } else { pInfo->durationStart = 0; } - colDataAppend(pOutput, i, (char *)&output, false); + colDataAppend(pOutput, i, (char*)&output, false); } return numOfElems; @@ -4100,7 +4073,7 @@ int32_t csumFunction(SqlFunctionCtx* pCtx) { SSumRes* pSumRes = GET_ROWCELL_INTERBUF(pResInfo); SInputColumnInfoData* pInput = &pCtx->input; - TSKEY* tsList = (int64_t*)pInput->pPTS->pData; + TSKEY* tsList = (int64_t*)pInput->pPTS->pData; SColumnInfoData* pInputCol = pInput->pData[0]; SColumnInfoData* pTsOutput = pCtx->pTsOutput; @@ -4112,7 +4085,7 @@ int32_t csumFunction(SqlFunctionCtx* pCtx) { for (int32_t i = pInput->startRowIndex; i < pInput->numOfRows + pInput->startRowIndex; i += 1) { int32_t pos = startOffset + numOfElems; if (colDataIsNull_f(pInputCol->nullbitmap, i)) { - //colDataAppendNULL(pOutput, i); + // colDataAppendNULL(pOutput, i); continue; } @@ -4121,25 +4094,25 @@ int32_t csumFunction(SqlFunctionCtx* pCtx) { int64_t v; GET_TYPED_DATA(v, int64_t, type, data); pSumRes->isum += v; - colDataAppend(pOutput, pos, (char *)&pSumRes->isum, false); + colDataAppend(pOutput, pos, (char*)&pSumRes->isum, false); } else if (IS_UNSIGNED_NUMERIC_TYPE(type)) { uint64_t v; GET_TYPED_DATA(v, uint64_t, type, data); pSumRes->usum += v; - colDataAppend(pOutput, pos, (char *)&pSumRes->usum, false); + colDataAppend(pOutput, pos, (char*)&pSumRes->usum, false); } else if (IS_FLOAT_TYPE(type)) { double v; GET_TYPED_DATA(v, double, type, data); pSumRes->dsum += v; - //check for overflow + // check for overflow if (isinf(pSumRes->dsum) || isnan(pSumRes->dsum)) { colDataAppendNULL(pOutput, pos); - } else { - colDataAppend(pOutput, pos, (char *)&pSumRes->dsum, false); + } else { + colDataAppend(pOutput, pos, (char*)&pSumRes->dsum, false); } } - //TODO: remove this after pTsOutput is handled + // TODO: remove this after pTsOutput is handled if (pTsOutput != NULL) { colDataAppendInt64(pTsOutput, pos, &tsList[i]); } @@ -4155,12 +4128,12 @@ bool getMavgFuncEnv(SFunctionNode* UNUSED_PARAM(pFunc), SFuncExecEnv* pEnv) { return true; } -bool mavgFunctionSetup(SqlFunctionCtx *pCtx, SResultRowEntryInfo *pResultInfo) { +bool mavgFunctionSetup(SqlFunctionCtx* pCtx, SResultRowEntryInfo* pResultInfo) { if (!functionSetup(pCtx, pResultInfo)) { return false; } - SMavgInfo *pInfo = GET_ROWCELL_INTERBUF(pResultInfo); + SMavgInfo* pInfo = GET_ROWCELL_INTERBUF(pResultInfo); pInfo->pos = 0; pInfo->sum = 0; pInfo->numOfPoints = pCtx->param[1].param.i; @@ -4177,7 +4150,7 @@ int32_t mavgFunction(SqlFunctionCtx* pCtx) { SMavgInfo* pInfo = GET_ROWCELL_INTERBUF(pResInfo); SInputColumnInfoData* pInput = &pCtx->input; - TSKEY* tsList = (int64_t*)pInput->pPTS->pData; + TSKEY* tsList = (int64_t*)pInput->pPTS->pData; SColumnInfoData* pInputCol = pInput->pData[0]; SColumnInfoData* pTsOutput = pCtx->pTsOutput; @@ -4189,11 +4162,11 @@ int32_t mavgFunction(SqlFunctionCtx* pCtx) { for (int32_t i = pInput->startRowIndex; i < pInput->numOfRows + pInput->startRowIndex; i += 1) { int32_t pos = startOffset + numOfElems; if (colDataIsNull_f(pInputCol->nullbitmap, i)) { - //colDataAppendNULL(pOutput, i); + // colDataAppendNULL(pOutput, i); continue; } - char* data = colDataGetData(pInputCol, i); + char* data = colDataGetData(pInputCol, i); double v; GET_TYPED_DATA(v, double, type, data); @@ -4202,7 +4175,7 @@ int32_t mavgFunction(SqlFunctionCtx* pCtx) { pInfo->sum += v; } else { if (!pInfo->pointsMeet && (pInfo->pos == pInfo->numOfPoints - 1)) { - pInfo->sum +=v; + pInfo->sum += v; pInfo->pointsMeet = true; } else { pInfo->sum = pInfo->sum + v - pInfo->points[pInfo->pos]; @@ -4210,14 +4183,14 @@ int32_t mavgFunction(SqlFunctionCtx* pCtx) { pInfo->points[pInfo->pos] = v; double result = pInfo->sum / pInfo->numOfPoints; - //check for overflow + // check for overflow if (isinf(result) || isnan(result)) { colDataAppendNULL(pOutput, pos); - } else { - colDataAppend(pOutput, pos, (char *)&result, false); + } else { + colDataAppend(pOutput, pos, (char*)&result, false); } - //TODO: remove this after pTsOutput is handled + // TODO: remove this after pTsOutput is handled if (pTsOutput != NULL) { colDataAppendInt64(pTsOutput, pos, &tsList[i]); } @@ -4235,20 +4208,20 @@ int32_t mavgFunction(SqlFunctionCtx* pCtx) { bool getSampleFuncEnv(SFunctionNode* pFunc, SFuncExecEnv* pEnv) { SColumnNode* pCol = (SColumnNode*)nodesListGetNode(pFunc->pParameterList, 0); - SValueNode* pVal = (SValueNode*)nodesListGetNode(pFunc->pParameterList, 1); - int32_t numOfSamples = pVal->datum.i; + SValueNode* pVal = (SValueNode*)nodesListGetNode(pFunc->pParameterList, 1); + int32_t numOfSamples = pVal->datum.i; pEnv->calcMemSize = sizeof(SSampleInfo) + numOfSamples * (pCol->node.resType.bytes + sizeof(int64_t)); return true; } -bool sampleFunctionSetup(SqlFunctionCtx *pCtx, SResultRowEntryInfo *pResultInfo) { +bool sampleFunctionSetup(SqlFunctionCtx* pCtx, SResultRowEntryInfo* pResultInfo) { if (!functionSetup(pCtx, pResultInfo)) { return false; } taosSeedRand(taosSafeRand()); - SSampleInfo *pInfo = GET_ROWCELL_INTERBUF(pResultInfo); + SSampleInfo* pInfo = GET_ROWCELL_INTERBUF(pResultInfo); pInfo->samples = pCtx->param[1].param.i; pInfo->totalPoints = 0; pInfo->numSampled = 0; @@ -4257,18 +4230,18 @@ bool sampleFunctionSetup(SqlFunctionCtx *pCtx, SResultRowEntryInfo *pResultInfo) if (pInfo->samples < 1 || pInfo->samples > SAMPLE_MAX_POINTS_NUM) { return false; } - pInfo->data = (char *)pInfo + sizeof(SSampleInfo); - pInfo->timestamp = (int64_t *)((char *)pInfo + sizeof(SSampleInfo) + pInfo->samples * pInfo->colBytes); + pInfo->data = (char*)pInfo + sizeof(SSampleInfo); + pInfo->timestamp = (int64_t*)((char*)pInfo + sizeof(SSampleInfo) + pInfo->samples * pInfo->colBytes); return true; } -static void sampleAssignResult(SSampleInfo* pInfo, char *data, TSKEY ts, int32_t index) { +static void sampleAssignResult(SSampleInfo* pInfo, char* data, TSKEY ts, int32_t index) { assignVal(pInfo->data + index * pInfo->colBytes, data, pInfo->colBytes, pInfo->colType); *(pInfo->timestamp + index) = ts; } -static void doReservoirSample(SSampleInfo* pInfo, char *data, TSKEY ts, int32_t index) { +static void doReservoirSample(SSampleInfo* pInfo, char* data, TSKEY ts, int32_t index) { pInfo->totalPoints++; if (pInfo->numSampled < pInfo->samples) { sampleAssignResult(pInfo, data, ts, pInfo->numSampled); @@ -4299,7 +4272,7 @@ int32_t sampleFunction(SqlFunctionCtx* pCtx) { } char* data = colDataGetData(pInputCol, i); - doReservoirSample(pInfo, data, /*tsList[i]*/0, i); + doReservoirSample(pInfo, data, /*tsList[i]*/ 0, i); } SET_VAL(pResInfo, pInfo->numSampled, pInfo->numSampled); @@ -4312,7 +4285,7 @@ int32_t sampleFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { SSampleInfo* pInfo = GET_ROWCELL_INTERBUF(pEntryInfo); pEntryInfo->complete = true; - int32_t slotId = pCtx->pExpr->base.resSchema.slotId; + int32_t slotId = pCtx->pExpr->base.resSchema.slotId; SColumnInfoData* pCol = taosArrayGet(pBlock->pDataBlock, slotId); int32_t currentRow = pBlock->info.rows; @@ -4326,17 +4299,17 @@ int32_t sampleFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { bool getTailFuncEnv(SFunctionNode* pFunc, SFuncExecEnv* pEnv) { SColumnNode* pCol = (SColumnNode*)nodesListGetNode(pFunc->pParameterList, 0); SValueNode* pVal = (SValueNode*)nodesListGetNode(pFunc->pParameterList, 1); - int32_t numOfPoints = pVal->datum.i; + int32_t numOfPoints = pVal->datum.i; pEnv->calcMemSize = sizeof(STailInfo) + numOfPoints * (POINTER_BYTES + sizeof(STailItem) + pCol->node.resType.bytes); return true; } -bool tailFunctionSetup(SqlFunctionCtx *pCtx, SResultRowEntryInfo *pResultInfo) { +bool tailFunctionSetup(SqlFunctionCtx* pCtx, SResultRowEntryInfo* pResultInfo) { if (!functionSetup(pCtx, pResultInfo)) { return false; } - STailInfo *pInfo = GET_ROWCELL_INTERBUF(pResultInfo); + STailInfo* pInfo = GET_ROWCELL_INTERBUF(pResultInfo); pInfo->numAdded = 0; pInfo->numOfPoints = pCtx->param[1].param.i; if (pCtx->numOfParams == 4) { @@ -4351,19 +4324,19 @@ bool tailFunctionSetup(SqlFunctionCtx *pCtx, SResultRowEntryInfo *pResultInfo) { return false; } - pInfo->pItems = (STailItem **)((char *)pInfo + sizeof(STailInfo)); - char *pItem = (char *)pInfo->pItems + pInfo->numOfPoints * POINTER_BYTES; + pInfo->pItems = (STailItem**)((char*)pInfo + sizeof(STailInfo)); + char* pItem = (char*)pInfo->pItems + pInfo->numOfPoints * POINTER_BYTES; size_t unitSize = sizeof(STailItem) + pInfo->colBytes; for (int32_t i = 0; i < pInfo->numOfPoints; ++i) { - pInfo->pItems[i] = (STailItem *)(pItem + i * unitSize); + pInfo->pItems[i] = (STailItem*)(pItem + i * unitSize); pInfo->pItems[i]->isNull = false; } return true; } -static void tailAssignResult(STailItem* pItem, char *data, int32_t colBytes, TSKEY ts, bool isNull) { +static void tailAssignResult(STailItem* pItem, char* data, int32_t colBytes, TSKEY ts, bool isNull) { pItem->timestamp = ts; if (isNull) { pItem->isNull = true; @@ -4373,30 +4346,30 @@ static void tailAssignResult(STailItem* pItem, char *data, int32_t colBytes, TSK } } -static int32_t tailCompFn(const void *p1, const void *p2, const void *param) { - STailItem *d1 = *(STailItem **)p1; - STailItem *d2 = *(STailItem **)p2; +static int32_t tailCompFn(const void* p1, const void* p2, const void* param) { + STailItem* d1 = *(STailItem**)p1; + STailItem* d2 = *(STailItem**)p2; return compareInt64Val(&d1->timestamp, &d2->timestamp); } -static void doTailAdd(STailInfo* pInfo, char *data, TSKEY ts, bool isNull) { - STailItem **pList = pInfo->pItems; +static void doTailAdd(STailInfo* pInfo, char* data, TSKEY ts, bool isNull) { + STailItem** pList = pInfo->pItems; if (pInfo->numAdded < pInfo->numOfPoints) { tailAssignResult(pList[pInfo->numAdded], data, pInfo->colBytes, ts, isNull); - taosheapsort((void *)pList, sizeof(STailItem **), pInfo->numAdded + 1, NULL, tailCompFn, 0); + taosheapsort((void*)pList, sizeof(STailItem**), pInfo->numAdded + 1, NULL, tailCompFn, 0); pInfo->numAdded++; } else if (pList[0]->timestamp < ts) { tailAssignResult(pList[0], data, pInfo->colBytes, ts, isNull); - taosheapadjust((void *)pList, sizeof(STailItem **), 0, pInfo->numOfPoints - 1, NULL, tailCompFn, NULL, 0); + taosheapadjust((void*)pList, sizeof(STailItem**), 0, pInfo->numOfPoints - 1, NULL, tailCompFn, NULL, 0); } } int32_t tailFunction(SqlFunctionCtx* pCtx) { SResultRowEntryInfo* pResInfo = GET_RES_INFO(pCtx); - STailInfo* pInfo = GET_ROWCELL_INTERBUF(pResInfo); + STailInfo* pInfo = GET_ROWCELL_INTERBUF(pResInfo); SInputColumnInfoData* pInput = &pCtx->input; - TSKEY* tsList = (int64_t*)pInput->pPTS->pData; + TSKEY* tsList = (int64_t*)pInput->pPTS->pData; SColumnInfoData* pInputCol = pInput->pData[0]; SColumnInfoData* pOutput = (SColumnInfoData*)pCtx->pOutput; @@ -4408,7 +4381,6 @@ int32_t tailFunction(SqlFunctionCtx* pCtx) { pInfo->numOfPoints = TMIN(pInfo->numOfPoints, pInput->numOfRows - pInfo->offset); } for (int32_t i = pInput->startRowIndex; i < pInput->numOfRows + pInput->startRowIndex - pInfo->offset; i += 1) { - char* data = colDataGetData(pInputCol, i); doTailAdd(pInfo, data, tsList[i], colDataIsNull_s(pInputCol, i)); } @@ -4416,8 +4388,8 @@ int32_t tailFunction(SqlFunctionCtx* pCtx) { taosqsort(pInfo->pItems, pInfo->numOfPoints, POINTER_BYTES, NULL, tailCompFn); for (int32_t i = 0; i < pInfo->numOfPoints; ++i) { - int32_t pos = startOffset + i; - STailItem *pItem = pInfo->pItems[i]; + int32_t pos = startOffset + i; + STailItem* pItem = pInfo->pItems[i]; if (pItem->isNull) { colDataAppendNULL(pOutput, pos); } else { @@ -4430,7 +4402,7 @@ int32_t tailFunction(SqlFunctionCtx* pCtx) { int32_t tailFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { SResultRowEntryInfo* pEntryInfo = GET_RES_INFO(pCtx); - STailInfo* pInfo = GET_ROWCELL_INTERBUF(pEntryInfo); + STailInfo* pInfo = GET_ROWCELL_INTERBUF(pEntryInfo); pEntryInfo->complete = true; int32_t type = pCtx->input.pData[0]->info.type; @@ -4441,10 +4413,10 @@ int32_t tailFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { // todo assign the tag value and the corresponding row data int32_t currentRow = pBlock->info.rows; for (int32_t i = 0; i < pEntryInfo->numOfRes; ++i) { - STailItem *pItem = pInfo->pItems[i]; + STailItem* pItem = pInfo->pItems[i]; colDataAppend(pCol, currentRow, pItem->data, false); - //setSelectivityValue(pCtx, pBlock, &pInfo->pItems[i].tuplePos, currentRow); + // setSelectivityValue(pCtx, pBlock, &pInfo->pItems[i].tuplePos, currentRow); currentRow += 1; } @@ -4473,11 +4445,11 @@ bool uniqueFunctionSetup(SqlFunctionCtx* pCtx, SResultRowEntryInfo* pResInfo) { return true; } -static void doUniqueAdd(SUniqueInfo* pInfo, char *data, TSKEY ts, bool isNull) { - //handle null elements +static void doUniqueAdd(SUniqueInfo* pInfo, char* data, TSKEY ts, bool isNull) { + // handle null elements if (isNull == true) { - int32_t size = sizeof(SUniqueItem) + pInfo->colBytes; - SUniqueItem *pItem = (SUniqueItem *)(pInfo->pItems + pInfo->numOfPoints * size); + int32_t size = sizeof(SUniqueItem) + pInfo->colBytes; + SUniqueItem* pItem = (SUniqueItem*)(pInfo->pItems + pInfo->numOfPoints * size); if (pInfo->hasNull == false && pItem->isNull == false) { pItem->timestamp = ts; pItem->isNull = true; @@ -4489,15 +4461,15 @@ static void doUniqueAdd(SUniqueInfo* pInfo, char *data, TSKEY ts, bool isNull) { return; } - int32_t hashKeyBytes = IS_VAR_DATA_TYPE(pInfo->colType) ? varDataTLen(data) : pInfo->colBytes; - SUniqueItem *pHashItem = taosHashGet(pInfo->pHash, data, hashKeyBytes); + int32_t hashKeyBytes = IS_VAR_DATA_TYPE(pInfo->colType) ? varDataTLen(data) : pInfo->colBytes; + SUniqueItem* pHashItem = taosHashGet(pInfo->pHash, data, hashKeyBytes); if (pHashItem == NULL) { - int32_t size = sizeof(SUniqueItem) + pInfo->colBytes; - SUniqueItem *pItem = (SUniqueItem *)(pInfo->pItems + pInfo->numOfPoints * size); + int32_t size = sizeof(SUniqueItem) + pInfo->colBytes; + SUniqueItem* pItem = (SUniqueItem*)(pInfo->pItems + pInfo->numOfPoints * size); pItem->timestamp = ts; memcpy(pItem->data, data, pInfo->colBytes); - taosHashPut(pInfo->pHash, data, hashKeyBytes, (char *)pItem, sizeof(SUniqueItem*)); + taosHashPut(pInfo->pHash, data, hashKeyBytes, (char*)pItem, sizeof(SUniqueItem*)); pInfo->numOfPoints++; } else if (pHashItem->timestamp > ts) { pHashItem->timestamp = ts; @@ -4509,7 +4481,7 @@ int32_t uniqueFunction(SqlFunctionCtx* pCtx) { SUniqueInfo* pInfo = GET_ROWCELL_INTERBUF(pResInfo); SInputColumnInfoData* pInput = &pCtx->input; - TSKEY* tsList = (int64_t*)pInput->pPTS->pData; + TSKEY* tsList = (int64_t*)pInput->pPTS->pData; SColumnInfoData* pInputCol = pInput->pData[0]; SColumnInfoData* pTsOutput = pCtx->pTsOutput; @@ -4527,7 +4499,7 @@ int32_t uniqueFunction(SqlFunctionCtx* pCtx) { } for (int32_t i = 0; i < pInfo->numOfPoints; ++i) { - SUniqueItem *pItem = (SUniqueItem *)(pInfo->pItems + i * (sizeof(SUniqueItem) + pInfo->colBytes)); + SUniqueItem* pItem = (SUniqueItem*)(pInfo->pItems + i * (sizeof(SUniqueItem) + pInfo->colBytes)); if (pItem->isNull == true) { colDataAppendNULL(pOutput, i); } else { @@ -4543,14 +4515,14 @@ int32_t uniqueFunction(SqlFunctionCtx* pCtx) { int32_t uniqueFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { SResultRowEntryInfo* pResInfo = GET_RES_INFO(pCtx); - SUniqueInfo* pInfo = GET_ROWCELL_INTERBUF(pResInfo); - int32_t slotId = pCtx->pExpr->base.resSchema.slotId; - SColumnInfoData* pCol = taosArrayGet(pBlock->pDataBlock, slotId); + SUniqueInfo* pInfo = GET_ROWCELL_INTERBUF(pResInfo); + int32_t slotId = pCtx->pExpr->base.resSchema.slotId; + SColumnInfoData* pCol = taosArrayGet(pBlock->pDataBlock, slotId); for (int32_t i = 0; i < pResInfo->numOfRes; ++i) { - SUniqueItem *pItem = (SUniqueItem *)(pInfo->pItems + i * (sizeof(SUniqueItem) + pInfo->colBytes)); + SUniqueItem* pItem = (SUniqueItem*)(pInfo->pItems + i * (sizeof(SUniqueItem) + pInfo->colBytes)); colDataAppend(pCol, i, pItem->data, false); - //TODO: handle ts output + // TODO: handle ts output } return pResInfo->numOfRes; @@ -4567,43 +4539,43 @@ bool getTwaFuncEnv(struct SFunctionNode* pFunc, SFuncExecEnv* pEnv) { return true; } -bool twaFunctionSetup(SqlFunctionCtx *pCtx, SResultRowEntryInfo* pResultInfo) { +bool twaFunctionSetup(SqlFunctionCtx* pCtx, SResultRowEntryInfo* pResultInfo) { if (!functionSetup(pCtx, pResultInfo)) { return false; } - STwaInfo *pInfo = GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx)); - pInfo->p.key = INT64_MIN; - pInfo->win = TSWINDOW_INITIALIZER; + STwaInfo* pInfo = GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx)); + pInfo->p.key = INT64_MIN; + pInfo->win = TSWINDOW_INITIALIZER; return true; } static double twa_get_area(SPoint1 s, SPoint1 e) { - if ((s.val >= 0 && e.val >= 0)|| (s.val <=0 && e.val <= 0)) { + if ((s.val >= 0 && e.val >= 0) || (s.val <= 0 && e.val <= 0)) { return (s.val + e.val) * (e.key - s.key) / 2; } - double x = (s.key * e.val - e.key * s.val)/(e.val - s.val); + double x = (s.key * e.val - e.key * s.val) / (e.val - s.val); double val = (s.val * (x - s.key) + e.val * (e.key - x)) / 2; return val; } #define INIT_INTP_POINT(_p, _k, _v) \ - do { \ - (_p).key = (_k); \ - (_p).val = (_v); \ + do { \ + (_p).key = (_k); \ + (_p).val = (_v); \ } while (0) int32_t twaFunction(SqlFunctionCtx* pCtx) { SInputColumnInfoData* pInput = &pCtx->input; - SColumnInfoData* pInputCol = pInput->pData[0]; + SColumnInfoData* pInputCol = pInput->pData[0]; TSKEY* tsList = (int64_t*)pInput->pPTS->pData; - SResultRowEntryInfo *pResInfo = GET_RES_INFO(pCtx); + SResultRowEntryInfo* pResInfo = GET_RES_INFO(pCtx); - STwaInfo *pInfo = GET_ROWCELL_INTERBUF(pResInfo); - SPoint1 *last = &pInfo->p; + STwaInfo* pInfo = GET_ROWCELL_INTERBUF(pResInfo); + SPoint1* last = &pInfo->p; int32_t numOfElems = 0; int32_t i = pInput->startRowIndex; @@ -4632,9 +4604,9 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) { SPoint1 st = {0}; // calculate the value of - switch(pInputCol->info.type) { + switch (pInputCol->info.type) { case TSDB_DATA_TYPE_TINYINT: { - int8_t *val = (int8_t*) colDataGetData(pInputCol, 0); + int8_t* val = (int8_t*)colDataGetData(pInputCol, 0); for (; i < pInput->numOfRows + pInput->startRowIndex; i += 1) { if (colDataIsNull_f(pInputCol->nullbitmap, i)) { continue; @@ -4648,7 +4620,7 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) { } case TSDB_DATA_TYPE_SMALLINT: { - int16_t *val = (int16_t*) colDataGetData(pInputCol, 0); + int16_t* val = (int16_t*)colDataGetData(pInputCol, 0); for (; i < pInput->numOfRows + pInput->startRowIndex; i += 1) { if (colDataIsNull_f(pInputCol->nullbitmap, i)) { continue; @@ -4661,7 +4633,7 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) { break; } case TSDB_DATA_TYPE_INT: { - int32_t *val = (int32_t*) colDataGetData(pInputCol, 0); + int32_t* val = (int32_t*)colDataGetData(pInputCol, 0); for (; i < pInput->numOfRows + pInput->startRowIndex; i += 1) { if (colDataIsNull_f(pInputCol->nullbitmap, i)) { continue; @@ -4674,7 +4646,7 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) { break; } case TSDB_DATA_TYPE_BIGINT: { - int64_t *val = (int64_t*) colDataGetData(pInputCol, 0); + int64_t* val = (int64_t*)colDataGetData(pInputCol, 0); for (; i < pInput->numOfRows + pInput->startRowIndex; i += 1) { if (colDataIsNull_f(pInputCol->nullbitmap, i)) { continue; @@ -4687,7 +4659,7 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) { break; } case TSDB_DATA_TYPE_FLOAT: { - float *val = (float*) colDataGetData(pInputCol, 0); + float* val = (float*)colDataGetData(pInputCol, 0); for (; i < pInput->numOfRows + pInput->startRowIndex; i += 1) { if (colDataIsNull_f(pInputCol->nullbitmap, i)) { continue; @@ -4700,7 +4672,7 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) { break; } case TSDB_DATA_TYPE_DOUBLE: { - double *val = (double*) colDataGetData(pInputCol, 0); + double* val = (double*)colDataGetData(pInputCol, 0); for (; i < pInput->numOfRows + pInput->startRowIndex; i += 1) { if (colDataIsNull_f(pInputCol->nullbitmap, i)) { continue; @@ -4713,7 +4685,7 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) { break; } case TSDB_DATA_TYPE_UTINYINT: { - uint8_t *val = (uint8_t*) colDataGetData(pInputCol, 0); + uint8_t* val = (uint8_t*)colDataGetData(pInputCol, 0); for (; i < pInput->numOfRows + pInput->startRowIndex; i += 1) { if (colDataIsNull_f(pInputCol->nullbitmap, i)) { continue; @@ -4726,7 +4698,7 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) { break; } case TSDB_DATA_TYPE_USMALLINT: { - uint16_t *val = (uint16_t*) colDataGetData(pInputCol, 0); + uint16_t* val = (uint16_t*)colDataGetData(pInputCol, 0); for (; i < pInput->numOfRows + pInput->startRowIndex; i += 1) { if (colDataIsNull_f(pInputCol->nullbitmap, i)) { continue; @@ -4739,7 +4711,7 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) { break; } case TSDB_DATA_TYPE_UINT: { - uint32_t *val = (uint32_t*) colDataGetData(pInputCol, 0); + uint32_t* val = (uint32_t*)colDataGetData(pInputCol, 0); for (; i < pInput->numOfRows + pInput->startRowIndex; i += 1) { if (colDataIsNull_f(pInputCol->nullbitmap, i)) { continue; @@ -4752,7 +4724,7 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) { break; } case TSDB_DATA_TYPE_UBIGINT: { - uint64_t *val = (uint64_t*) colDataGetData(pInputCol, 0); + uint64_t* val = (uint64_t*)colDataGetData(pInputCol, 0); for (; i < pInput->numOfRows + pInput->startRowIndex; i += 1) { if (colDataIsNull_f(pInputCol->nullbitmap, i)) { continue; @@ -4765,16 +4737,17 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) { break; } - default: ASSERT(0); + default: + ASSERT(0); } // the last interpolated time window value if (pCtx->end.key != INT64_MIN) { - pInfo->dOutput += twa_get_area(pInfo->p, pCtx->end); + pInfo->dOutput += twa_get_area(pInfo->p, pCtx->end); pInfo->p = pCtx->end; } - pInfo->win.ekey = pInfo->p.key; + pInfo->win.ekey = pInfo->p.key; SET_VAL(pResInfo, numOfElems, 1); return TSDB_CODE_SUCCESS; @@ -4785,18 +4758,18 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) { * by next input data. The TWA function only applies to each table, so no merge procedure * is required, we simply copy to the resut ot interResBuffer. */ -//void twa_function_copy(SQLFunctionCtx *pCtx) { -// assert(pCtx->inputType == TSDB_DATA_TYPE_BINARY); -// SResultRowEntryInfo *pResInfo = GET_RES_INFO(pCtx); +// void twa_function_copy(SQLFunctionCtx *pCtx) { +// assert(pCtx->inputType == TSDB_DATA_TYPE_BINARY); +// SResultRowEntryInfo *pResInfo = GET_RES_INFO(pCtx); // -// memcpy(GET_ROWCELL_INTERBUF(pResInfo), pCtx->pInput, (size_t)pCtx->inputBytes); -// pResInfo->hasResult = ((STwaInfo *)pCtx->pInput)->hasResult; -//} +// memcpy(GET_ROWCELL_INTERBUF(pResInfo), pCtx->pInput, (size_t)pCtx->inputBytes); +// pResInfo->hasResult = ((STwaInfo *)pCtx->pInput)->hasResult; +// } -int32_t twaFinalize(struct SqlFunctionCtx *pCtx, SSDataBlock* pBlock) { - SResultRowEntryInfo *pResInfo = GET_RES_INFO(pCtx); +int32_t twaFinalize(struct SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { + SResultRowEntryInfo* pResInfo = GET_RES_INFO(pCtx); - STwaInfo *pInfo = (STwaInfo *)GET_ROWCELL_INTERBUF(pResInfo); + STwaInfo* pInfo = (STwaInfo*)GET_ROWCELL_INTERBUF(pResInfo); if (pResInfo->numOfRes == 0) { pResInfo->isNullRes = 1; } else { @@ -4812,11 +4785,11 @@ int32_t twaFinalize(struct SqlFunctionCtx *pCtx, SSDataBlock* pBlock) { return functionFinalize(pCtx, pBlock); } -int32_t blockDistFunction(SqlFunctionCtx *pCtx) { +int32_t blockDistFunction(SqlFunctionCtx* pCtx) { SInputColumnInfoData* pInput = &pCtx->input; - SColumnInfoData* pInputCol = pInput->pData[0]; + SColumnInfoData* pInputCol = pInput->pData[0]; - SResultRowEntryInfo *pResInfo = GET_RES_INFO(pCtx); + SResultRowEntryInfo* pResInfo = GET_RES_INFO(pCtx); STableBlockDistInfo* pDistInfo = GET_ROWCELL_INTERBUF(pResInfo); @@ -4837,7 +4810,7 @@ int32_t blockDistFunction(SqlFunctionCtx *pCtx) { pDistInfo->maxRows = p1.maxRows; } - for(int32_t i = 0; i < tListLen(pDistInfo->blockRowsHisto); ++i) { + for (int32_t i = 0; i < tListLen(pDistInfo->blockRowsHisto); ++i) { pDistInfo->blockRowsHisto[i] += p1.blockRowsHisto[i]; } @@ -4865,7 +4838,7 @@ int32_t tSerializeBlockDistInfo(void* buf, int32_t bufLen, const STableBlockDist if (tEncodeU32(&encoder, pInfo->numOfInmemRows) < 0) return -1; if (tEncodeU32(&encoder, pInfo->numOfSmallBlocks) < 0) return -1; - for(int32_t i = 0; i < tListLen(pInfo->blockRowsHisto); ++i) { + for (int32_t i = 0; i < tListLen(pInfo->blockRowsHisto); ++i) { if (tEncodeI32(&encoder, pInfo->blockRowsHisto[i]) < 0) return -1; } @@ -4896,7 +4869,7 @@ int32_t tDeserializeBlockDistInfo(void* buf, int32_t bufLen, STableBlockDistInfo if (tDecodeU32(&decoder, &pInfo->numOfInmemRows) < 0) return -1; if (tDecodeU32(&decoder, &pInfo->numOfSmallBlocks) < 0) return -1; - for(int32_t i = 0; i < tListLen(pInfo->blockRowsHisto); ++i) { + for (int32_t i = 0; i < tListLen(pInfo->blockRowsHisto); ++i) { if (tDecodeI32(&decoder, &pInfo->blockRowsHisto[i]) < 0) return -1; } @@ -4905,8 +4878,8 @@ int32_t tDeserializeBlockDistInfo(void* buf, int32_t bufLen, STableBlockDistInfo } int32_t blockDistFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { - SResultRowEntryInfo *pResInfo = GET_RES_INFO(pCtx); - char *pData = GET_ROWCELL_INTERBUF(pResInfo); + SResultRowEntryInfo* pResInfo = GET_RES_INFO(pCtx); + char* pData = GET_ROWCELL_INTERBUF(pResInfo); SColumnInfoData* pColInfo = taosArrayGet(pBlock->pDataBlock, 0); @@ -4915,41 +4888,35 @@ int32_t blockDistFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { STableBlockDistInfo info = {0}; tDeserializeBlockDistInfo(varDataVal(pData), varDataLen(pData), &info); - char st[256] = {0}; - int32_t len = sprintf(st+VARSTR_HEADER_SIZE, "Blocks=[%d] Size=[%.3fKb] Average_Block_size=[%.3fKb] Compression_Ratio=[%.3f]", info.numOfBlocks, - info.totalSize/1024.0, - info.totalSize/(info.numOfBlocks*1024.0), - info.totalSize/(info.totalRows*info.rowSize*1.0) - ); + char st[256] = {0}; + int32_t len = + sprintf(st + VARSTR_HEADER_SIZE, "Blocks=[%d] Size=[%.3fKb] Average_Block_size=[%.3fKb] Compression_Ratio=[%.3f]", + info.numOfBlocks, info.totalSize / 1024.0, info.totalSize / (info.numOfBlocks * 1024.0), + info.totalSize / (info.totalRows * info.rowSize * 1.0)); varDataSetLen(st, len); colDataAppend(pColInfo, row++, st, false); - len = sprintf(st+VARSTR_HEADER_SIZE, "Total_Rows=[%ld] MinRows=[%d] MaxRows=[%d] Averge_Rows=[%ld] Inmem_Rows=[%d]", - info.totalRows, - info.minRows, - info.maxRows, - info.totalRows/info.numOfBlocks, - info.numOfInmemRows - ); + len = sprintf(st + VARSTR_HEADER_SIZE, "Total_Rows=[%ld] MinRows=[%d] MaxRows=[%d] Averge_Rows=[%ld] Inmem_Rows=[%d]", + info.totalRows, info.minRows, info.maxRows, info.totalRows / info.numOfBlocks, info.numOfInmemRows); varDataSetLen(st, len); colDataAppend(pColInfo, row++, st, false); - len = sprintf(st + VARSTR_HEADER_SIZE, "Total_Tables=[%d] Total_Files=[%d] Total_Vgroups=[%d]", - info.numOfTables, - info.numOfFiles, 0); + len = sprintf(st + VARSTR_HEADER_SIZE, "Total_Tables=[%d] Total_Files=[%d] Total_Vgroups=[%d]", info.numOfTables, + info.numOfFiles, 0); varDataSetLen(st, len); colDataAppend(pColInfo, row++, st, false); - len = sprintf(st+VARSTR_HEADER_SIZE, "--------------------------------------------------------------------------------"); + len = sprintf(st + VARSTR_HEADER_SIZE, + "--------------------------------------------------------------------------------"); varDataSetLen(st, len); colDataAppend(pColInfo, row++, st, false); int32_t maxVal = 0; int32_t minVal = INT32_MAX; - for(int32_t i = 0; i < sizeof(info.blockRowsHisto)/sizeof(info.blockRowsHisto[0]); ++i) { + for (int32_t i = 0; i < sizeof(info.blockRowsHisto) / sizeof(info.blockRowsHisto[0]); ++i) { if (maxVal < info.blockRowsHisto[i]) { maxVal = info.blockRowsHisto[i]; } @@ -4962,10 +4929,10 @@ int32_t blockDistFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { int32_t delta = maxVal - minVal; int32_t step = delta / 50; - int32_t numOfBuckets = sizeof(info.blockRowsHisto)/sizeof(info.blockRowsHisto[0]); + int32_t numOfBuckets = sizeof(info.blockRowsHisto) / sizeof(info.blockRowsHisto[0]); int32_t bucketRange = (info.maxRows - info.minRows) / numOfBuckets; - for(int32_t i = 0; i < 20; ++i) { + for (int32_t i = 0; i < 20; ++i) { len += sprintf(st + VARSTR_HEADER_SIZE, "%04d |", info.defMinRows + bucketRange * (i + 1)); int32_t num = (info.blockRowsHisto[i] + step - 1) / step; @@ -4975,7 +4942,7 @@ int32_t blockDistFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { } double v = info.blockRowsHisto[i] * 100.0 / info.numOfBlocks; - len += sprintf(st+ VARSTR_HEADER_SIZE + len, " %d (%.3f%c)", info.blockRowsHisto[i], v, '%'); + len += sprintf(st + VARSTR_HEADER_SIZE + len, " %d (%.3f%c)", info.blockRowsHisto[i], v, '%'); printf("%s\n", st); varDataSetLen(st, len); diff --git a/source/libs/function/src/functionMgt.c b/source/libs/function/src/functionMgt.c index caae4c05f7..e9c916034d 100644 --- a/source/libs/function/src/functionMgt.c +++ b/source/libs/function/src/functionMgt.c @@ -161,6 +161,8 @@ bool fmIsUserDefinedFunc(int32_t funcId) { return funcId > FUNC_UDF_ID_START; } bool fmIsForbidFillFunc(int32_t funcId) { return isSpecificClassifyFunc(funcId, FUNC_MGT_FORBID_FILL_FUNC); } +bool fmIsForbidStreamFunc(int32_t funcId) { return isSpecificClassifyFunc(funcId, FUNC_MGT_FORBID_STREAM_FUNC); } + void fmFuncMgtDestroy() { void* m = gFunMgtService.pFuncNameHashTable; if (m != NULL && atomic_val_compare_exchange_ptr((void**)&gFunMgtService.pFuncNameHashTable, m, 0) == m) { @@ -239,7 +241,7 @@ static int32_t getFuncInfo(SFunctionNode* pFunc) { } static SFunctionNode* createFunction(const char* pName, SNodeList* pParameterList) { - SFunctionNode* pFunc = nodesMakeNode(QUERY_NODE_FUNCTION); + SFunctionNode* pFunc = (SFunctionNode*)nodesMakeNode(QUERY_NODE_FUNCTION); if (NULL == pFunc) { return NULL; } @@ -247,14 +249,14 @@ static SFunctionNode* createFunction(const char* pName, SNodeList* pParameterLis pFunc->pParameterList = pParameterList; if (TSDB_CODE_SUCCESS != getFuncInfo(pFunc)) { pFunc->pParameterList = NULL; - nodesDestroyNode(pFunc); + nodesDestroyNode((SNode*)pFunc); return NULL; } return pFunc; } static SColumnNode* createColumnByFunc(const SFunctionNode* pFunc) { - SColumnNode* pCol = nodesMakeNode(QUERY_NODE_COLUMN); + SColumnNode* pCol = (SColumnNode*)nodesMakeNode(QUERY_NODE_COLUMN); if (NULL == pCol) { return NULL; } @@ -291,7 +293,7 @@ static int32_t createPartialFunction(const SFunctionNode* pSrcFunc, SFunctionNod static int32_t createMergeFunction(const SFunctionNode* pSrcFunc, const SFunctionNode* pPartialFunc, SFunctionNode** pMergeFunc) { SNodeList* pParameterList = NULL; - nodesListMakeStrictAppend(&pParameterList, createColumnByFunc(pPartialFunc)); + nodesListMakeStrictAppend(&pParameterList, (SNode*)createColumnByFunc(pPartialFunc)); *pMergeFunc = createFunction(funcMgtBuiltins[pSrcFunc->funcId].pMergeFunc, pParameterList); if (NULL == *pMergeFunc) { nodesDestroyList(pParameterList); @@ -316,8 +318,8 @@ int32_t fmGetDistMethod(const SFunctionNode* pFunc, SFunctionNode** pPartialFunc } if (TSDB_CODE_SUCCESS != code) { - nodesDestroyNode(*pPartialFunc); - nodesDestroyNode(*pMergeFunc); + nodesDestroyNode((SNode*)*pPartialFunc); + nodesDestroyNode((SNode*)*pMergeFunc); } return code; diff --git a/source/libs/nodes/src/nodesCloneFuncs.c b/source/libs/nodes/src/nodesCloneFuncs.c index 7e6a1f5e0c..1ef0ccf7f9 100644 --- a/source/libs/nodes/src/nodesCloneFuncs.c +++ b/source/libs/nodes/src/nodesCloneFuncs.c @@ -40,6 +40,10 @@ break; \ } \ (pDst)->fldname = strdup((pSrc)->fldname); \ + if (NULL == (pDst)->fldname) { \ + nodesDestroyNode((SNode*)pDst); \ + return NULL; \ + } \ } while (0) #define CLONE_NODE_FIELD(fldname) \ @@ -49,11 +53,23 @@ } \ (pDst)->fldname = nodesCloneNode((pSrc)->fldname); \ if (NULL == (pDst)->fldname) { \ - nodesDestroyNode((SNode*)(pDst)); \ + nodesDestroyNode((SNode*)pDst); \ return NULL; \ } \ } while (0) +#define CLONE_NODE_FIELD_EX(fldname, nodePtrType) \ + do { \ + if (NULL == (pSrc)->fldname) { \ + break; \ + } \ + (pDst)->fldname = (nodePtrType)nodesCloneNode((SNode*)(pSrc)->fldname); \ + if (NULL == (pDst)->fldname) { \ + nodesDestroyNode((SNode*)pDst); \ + return NULL; \ + } \ + } while (0) + #define CLONE_NODE_LIST_FIELD(fldname) \ do { \ if (NULL == (pSrc)->fldname) { \ @@ -61,7 +77,7 @@ } \ (pDst)->fldname = nodesCloneList((pSrc)->fldname); \ if (NULL == (pDst)->fldname) { \ - nodesDestroyNode((SNode*)(pDst)); \ + nodesDestroyNode((SNode*)pDst); \ return NULL; \ } \ } while (0) @@ -73,7 +89,7 @@ } \ (pDst)->fldname = cloneFunc((pSrc)->fldname); \ if (NULL == (pDst)->fldname) { \ - nodesDestroyNode((SNode*)(pDst)); \ + nodesDestroyNode((SNode*)pDst); \ return NULL; \ } \ } while (0) @@ -81,6 +97,7 @@ #define COPY_BASE_OBJECT_FIELD(fldname, copyFunc) \ do { \ if (NULL == copyFunc(&((pSrc)->fldname), &((pDst)->fldname))) { \ + nodesDestroyNode((SNode*)pDst); \ return NULL; \ } \ } while (0) @@ -147,7 +164,7 @@ static SNode* valueNodeCopy(const SValueNode* pSrc, SValueNode* pDst) { int32_t len = varDataTLen(pSrc->datum.p) + 1; pDst->datum.p = taosMemoryCalloc(1, len); if (NULL == pDst->datum.p) { - nodesDestroyNode(pDst); + nodesDestroyNode((SNode*)pDst); return NULL; } memcpy(pDst->datum.p, pSrc->datum.p, len); @@ -275,8 +292,8 @@ static SNode* stateWindowNodeCopy(const SStateWindowNode* pSrc, SStateWindowNode } static SNode* sessionWindowNodeCopy(const SSessionWindowNode* pSrc, SSessionWindowNode* pDst) { - CLONE_NODE_FIELD(pCol); - CLONE_NODE_FIELD(pGap); + CLONE_NODE_FIELD_EX(pCol, SColumnNode*); + CLONE_NODE_FIELD_EX(pGap, SValueNode*); return (SNode*)pDst; } @@ -442,7 +459,7 @@ static SNode* logicIndefRowsFuncCopy(const SIndefRowsFuncLogicNode* pSrc, SIndef static SNode* logicSubplanCopy(const SLogicSubplan* pSrc, SLogicSubplan* pDst) { COPY_OBJECT_FIELD(id, sizeof(SSubplanId)); - CLONE_NODE_FIELD(pNode); + CLONE_NODE_FIELD_EX(pNode, SLogicNode*); COPY_SCALAR_FIELD(subplanType); COPY_SCALAR_FIELD(level); COPY_SCALAR_FIELD(splitFlag); @@ -450,7 +467,7 @@ static SNode* logicSubplanCopy(const SLogicSubplan* pSrc, SLogicSubplan* pDst) { } static SNode* physiNodeCopy(const SPhysiNode* pSrc, SPhysiNode* pDst) { - CLONE_NODE_FIELD(pOutputDataBlockDesc); + CLONE_NODE_FIELD_EX(pOutputDataBlockDesc, SDataBlockDescNode*); CLONE_NODE_FIELD(pConditions); CLONE_NODE_LIST_FIELD(pChildren); return (SNode*)pDst; @@ -555,8 +572,8 @@ static SNode* selectStmtCopy(const SSelectStmt* pSrc, SSelectStmt* pDst) { CLONE_NODE_LIST_FIELD(pGroupByList); CLONE_NODE_FIELD(pHaving); CLONE_NODE_LIST_FIELD(pOrderByList); - CLONE_NODE_FIELD(pLimit); - CLONE_NODE_FIELD(pLimit); + CLONE_NODE_FIELD_EX(pLimit, SLimitNode*); + CLONE_NODE_FIELD_EX(pLimit, SLimitNode*); COPY_CHAR_ARRAY_FIELD(stmtName); COPY_SCALAR_FIELD(precision); COPY_SCALAR_FIELD(isEmptyResult); @@ -566,7 +583,7 @@ static SNode* selectStmtCopy(const SSelectStmt* pSrc, SSelectStmt* pDst) { return (SNode*)pDst; } -SNodeptr nodesCloneNode(const SNodeptr pNode) { +SNode* nodesCloneNode(const SNode* pNode) { if (NULL == pNode) { return NULL; } diff --git a/source/libs/nodes/src/nodesCodeFuncs.c b/source/libs/nodes/src/nodesCodeFuncs.c index f7e65f100a..be1929d554 100644 --- a/source/libs/nodes/src/nodesCodeFuncs.c +++ b/source/libs/nodes/src/nodesCodeFuncs.c @@ -4205,7 +4205,7 @@ static int32_t jsonToNodeObject(const SJson* pJson, const char* pName, SNode** p return makeNodeByJson(pJsonNode, pNode); } -int32_t nodesNodeToString(const SNodeptr pNode, bool format, char** pStr, int32_t* pLen) { +int32_t nodesNodeToString(const SNode* pNode, bool format, char** pStr, int32_t* pLen) { if (NULL == pNode || NULL == pStr) { terrno = TSDB_CODE_FAILED; return TSDB_CODE_FAILED; diff --git a/source/libs/nodes/src/nodesEqualFuncs.c b/source/libs/nodes/src/nodesEqualFuncs.c index 9887cbdbc5..681e99a452 100644 --- a/source/libs/nodes/src/nodesEqualFuncs.c +++ b/source/libs/nodes/src/nodesEqualFuncs.c @@ -137,7 +137,7 @@ static bool functionNodeEqual(const SFunctionNode* a, const SFunctionNode* b) { return true; } -bool nodesEqualNode(const SNodeptr a, const SNodeptr b) { +bool nodesEqualNode(const SNode* a, const SNode* b) { if (a == b) { return true; } diff --git a/source/libs/nodes/src/nodesTraverseFuncs.c b/source/libs/nodes/src/nodesTraverseFuncs.c index d8130d5650..1fb2db9f23 100644 --- a/source/libs/nodes/src/nodesTraverseFuncs.c +++ b/source/libs/nodes/src/nodesTraverseFuncs.c @@ -168,7 +168,7 @@ static EDealRes walkExprs(SNodeList* pNodeList, ETraversalOrder order, FNodeWalk return DEAL_RES_CONTINUE; } -void nodesWalkExpr(SNodeptr pNode, FNodeWalker walker, void* pContext) { +void nodesWalkExpr(SNode* pNode, FNodeWalker walker, void* pContext) { (void)walkExpr(pNode, TRAVERSAL_PREORDER, walker, pContext); } @@ -176,7 +176,7 @@ void nodesWalkExprs(SNodeList* pNodeList, FNodeWalker walker, void* pContext) { (void)walkExprs(pNodeList, TRAVERSAL_PREORDER, walker, pContext); } -void nodesWalkExprPostOrder(SNodeptr pNode, FNodeWalker walker, void* pContext) { +void nodesWalkExprPostOrder(SNode* pNode, FNodeWalker walker, void* pContext) { (void)walkExpr(pNode, TRAVERSAL_POSTORDER, walker, pContext); } diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index 1ea9124839..72666f833d 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -30,7 +30,7 @@ static SNode* makeNode(ENodeType type, size_t size) { return p; } -SNodeptr nodesMakeNode(ENodeType type) { +SNode* nodesMakeNode(ENodeType type) { switch (type) { case QUERY_NODE_COLUMN: return makeNode(type, sizeof(SColumnNode)); @@ -215,6 +215,8 @@ SNodeptr nodesMakeNode(ENodeType type) { return makeNode(type, sizeof(SKillStmt)); case QUERY_NODE_DELETE_STMT: return makeNode(type, sizeof(SDeleteStmt)); + case QUERY_NODE_QUERY: + return makeNode(type, sizeof(SQuery)); case QUERY_NODE_LOGIC_PLAN_SCAN: return makeNode(type, sizeof(SScanLogicNode)); case QUERY_NODE_LOGIC_PLAN_JOIN: @@ -325,7 +327,7 @@ static void destroyLogicNode(SLogicNode* pNode) { static void destroyPhysiNode(SPhysiNode* pNode) { nodesDestroyList(pNode->pChildren); nodesDestroyNode(pNode->pConditions); - nodesDestroyNode(pNode->pOutputDataBlockDesc); + nodesDestroyNode((SNode*)pNode->pOutputDataBlockDesc); } static void destroyWinodwPhysiNode(SWinodwPhysiNode* pNode) { @@ -340,9 +342,9 @@ static void destroyScanPhysiNode(SScanPhysiNode* pNode) { nodesDestroyList(pNode->pScanCols); } -static void destroyDataSinkNode(SDataSinkNode* pNode) { nodesDestroyNode(pNode->pInputDataBlockDesc); } +static void destroyDataSinkNode(SDataSinkNode* pNode) { nodesDestroyNode((SNode*)pNode->pInputDataBlockDesc); } -void nodesDestroyNode(SNodeptr pNode) { +void nodesDestroyNode(SNode* pNode) { if (NULL == pNode) { return; } @@ -399,8 +401,8 @@ void nodesDestroyNode(SNodeptr pNode) { break; case QUERY_NODE_SESSION_WINDOW: { SSessionWindowNode* pSession = (SSessionWindowNode*)pNode; - nodesDestroyNode(pSession->pCol); - nodesDestroyNode(pSession->pGap); + nodesDestroyNode((SNode*)pSession->pCol); + nodesDestroyNode((SNode*)pSession->pGap); break; } case QUERY_NODE_INTERVAL_WINDOW: { @@ -436,7 +438,7 @@ void nodesDestroyNode(SNodeptr pNode) { break; case QUERY_NODE_DATABASE_OPTIONS: { SDatabaseOptions* pOptions = (SDatabaseOptions*)pNode; - nodesDestroyNode(pOptions->pDaysPerFile); + nodesDestroyNode((SNode*)pOptions->pDaysPerFile); nodesDestroyList(pOptions->pKeep); nodesDestroyList(pOptions->pRetentions); break; @@ -455,6 +457,13 @@ void nodesDestroyNode(SNodeptr pNode) { nodesDestroyNode(pOptions->pSliding); break; } + case QUERY_NODE_EXPLAIN_OPTIONS: // no pointer field + break; + case QUERY_NODE_STREAM_OPTIONS: + nodesDestroyNode(((SStreamOptions*)pNode)->pWatermark); + break; + case QUERY_NODE_LEFT_VALUE: // no pointer field + break; case QUERY_NODE_SET_OPERATOR: { SSetOperator* pStmt = (SSetOperator*)pNode; nodesDestroyNode(pStmt->pLeft); @@ -473,26 +482,26 @@ void nodesDestroyNode(SNodeptr pNode) { nodesDestroyList(pStmt->pGroupByList); nodesDestroyNode(pStmt->pHaving); nodesDestroyList(pStmt->pOrderByList); - nodesDestroyNode(pStmt->pLimit); - nodesDestroyNode(pStmt->pSlimit); + nodesDestroyNode((SNode*)pStmt->pLimit); + nodesDestroyNode((SNode*)pStmt->pSlimit); break; } case QUERY_NODE_VNODE_MODIF_STMT: destroyVgDataBlockArray(((SVnodeModifOpStmt*)pNode)->pDataBlocks); break; case QUERY_NODE_CREATE_DATABASE_STMT: - nodesDestroyNode(((SCreateDatabaseStmt*)pNode)->pOptions); + nodesDestroyNode((SNode*)((SCreateDatabaseStmt*)pNode)->pOptions); break; case QUERY_NODE_DROP_DATABASE_STMT: // no pointer field break; case QUERY_NODE_ALTER_DATABASE_STMT: - nodesDestroyNode(((SAlterDatabaseStmt*)pNode)->pOptions); + nodesDestroyNode((SNode*)((SAlterDatabaseStmt*)pNode)->pOptions); break; case QUERY_NODE_CREATE_TABLE_STMT: { SCreateTableStmt* pStmt = (SCreateTableStmt*)pNode; nodesDestroyList(pStmt->pCols); nodesDestroyList(pStmt->pTags); - nodesDestroyNode(pStmt->pOptions); + nodesDestroyNode((SNode*)pStmt->pOptions); break; } case QUERY_NODE_CREATE_SUBTABLE_CLAUSE: { @@ -507,14 +516,14 @@ void nodesDestroyNode(SNodeptr pNode) { case QUERY_NODE_DROP_TABLE_CLAUSE: // no pointer field break; case QUERY_NODE_DROP_TABLE_STMT: - nodesDestroyNode(((SDropTableStmt*)pNode)->pTables); + nodesDestroyList(((SDropTableStmt*)pNode)->pTables); break; case QUERY_NODE_DROP_SUPER_TABLE_STMT: // no pointer field break; case QUERY_NODE_ALTER_TABLE_STMT: { SAlterTableStmt* pStmt = (SAlterTableStmt*)pNode; - nodesDestroyNode(pStmt->pOptions); - nodesDestroyNode(pStmt->pVal); + nodesDestroyNode((SNode*)pStmt->pOptions); + nodesDestroyNode((SNode*)pStmt->pVal); break; } case QUERY_NODE_CREATE_USER_STMT: // no pointer field @@ -527,37 +536,107 @@ void nodesDestroyNode(SNodeptr pNode) { break; case QUERY_NODE_CREATE_INDEX_STMT: { SCreateIndexStmt* pStmt = (SCreateIndexStmt*)pNode; - nodesDestroyNode(pStmt->pOptions); + nodesDestroyNode((SNode*)pStmt->pOptions); nodesDestroyList(pStmt->pCols); break; } case QUERY_NODE_DROP_INDEX_STMT: // no pointer field case QUERY_NODE_CREATE_QNODE_STMT: // no pointer field case QUERY_NODE_DROP_QNODE_STMT: // no pointer field + case QUERY_NODE_CREATE_BNODE_STMT: // no pointer field + case QUERY_NODE_DROP_BNODE_STMT: // no pointer field + case QUERY_NODE_CREATE_SNODE_STMT: // no pointer field + case QUERY_NODE_DROP_SNODE_STMT: // no pointer field + case QUERY_NODE_CREATE_MNODE_STMT: // no pointer field + case QUERY_NODE_DROP_MNODE_STMT: // no pointer field break; case QUERY_NODE_CREATE_TOPIC_STMT: nodesDestroyNode(((SCreateTopicStmt*)pNode)->pQuery); break; case QUERY_NODE_DROP_TOPIC_STMT: // no pointer field + case QUERY_NODE_DROP_CGROUP_STMT: // no pointer field case QUERY_NODE_ALTER_LOCAL_STMT: // no pointer field break; - case QUERY_NODE_SHOW_DATABASES_STMT: - case QUERY_NODE_SHOW_TABLES_STMT: - case QUERY_NODE_SHOW_STABLES_STMT: - case QUERY_NODE_SHOW_USERS_STMT: + case QUERY_NODE_EXPLAIN_STMT: { + SExplainStmt* pStmt = (SExplainStmt*)pNode; + nodesDestroyNode((SNode*)pStmt->pOptions); + nodesDestroyNode(pStmt->pQuery); + break; + } + case QUERY_NODE_DESCRIBE_STMT: + taosMemoryFree(((SDescribeStmt*)pNode)->pMeta); + break; + case QUERY_NODE_RESET_QUERY_CACHE_STMT: // no pointer field + case QUERY_NODE_COMPACT_STMT: // no pointer field + case QUERY_NODE_CREATE_FUNCTION_STMT: // no pointer field + case QUERY_NODE_DROP_FUNCTION_STMT: // no pointer field + break; + case QUERY_NODE_CREATE_STREAM_STMT: { + SCreateStreamStmt* pStmt = (SCreateStreamStmt*)pNode; + nodesDestroyNode((SNode*)pStmt->pOptions); + nodesDestroyNode(pStmt->pQuery); + break; + } + case QUERY_NODE_DROP_STREAM_STMT: // no pointer field + case QUERY_NODE_BALANCE_VGROUP_STMT: // no pointer field + case QUERY_NODE_MERGE_VGROUP_STMT: // no pointer field + break; + case QUERY_NODE_REDISTRIBUTE_VGROUP_STMT: + nodesDestroyList(((SRedistributeVgroupStmt*)pNode)->pDnodes); + break; + case QUERY_NODE_SPLIT_VGROUP_STMT: // no pointer field + case QUERY_NODE_SYNCDB_STMT: // no pointer field + case QUERY_NODE_GRANT_STMT: // no pointer field + case QUERY_NODE_REVOKE_STMT: // no pointer field + break; case QUERY_NODE_SHOW_DNODES_STMT: - case QUERY_NODE_SHOW_VGROUPS_STMT: case QUERY_NODE_SHOW_MNODES_STMT: case QUERY_NODE_SHOW_MODULES_STMT: case QUERY_NODE_SHOW_QNODES_STMT: + case QUERY_NODE_SHOW_SNODES_STMT: + case QUERY_NODE_SHOW_BNODES_STMT: + case QUERY_NODE_SHOW_CLUSTER_STMT: + case QUERY_NODE_SHOW_DATABASES_STMT: case QUERY_NODE_SHOW_FUNCTIONS_STMT: case QUERY_NODE_SHOW_INDEXES_STMT: - case QUERY_NODE_SHOW_STREAMS_STMT: { + case QUERY_NODE_SHOW_STABLES_STMT: + case QUERY_NODE_SHOW_STREAMS_STMT: + case QUERY_NODE_SHOW_TABLES_STMT: + case QUERY_NODE_SHOW_USERS_STMT: + case QUERY_NODE_SHOW_LICENCE_STMT: + case QUERY_NODE_SHOW_VGROUPS_STMT: + case QUERY_NODE_SHOW_TOPICS_STMT: + case QUERY_NODE_SHOW_CONSUMERS_STMT: + case QUERY_NODE_SHOW_SUBSCRIBES_STMT: + case QUERY_NODE_SHOW_SMAS_STMT: + case QUERY_NODE_SHOW_CONFIGS_STMT: + case QUERY_NODE_SHOW_CONNECTIONS_STMT: + case QUERY_NODE_SHOW_QUERIES_STMT: + case QUERY_NODE_SHOW_VNODES_STMT: + case QUERY_NODE_SHOW_APPS_STMT: + case QUERY_NODE_SHOW_SCORES_STMT: + case QUERY_NODE_SHOW_VARIABLE_STMT: + case QUERY_NODE_SHOW_CREATE_DATABASE_STMT: + case QUERY_NODE_SHOW_CREATE_TABLE_STMT: + case QUERY_NODE_SHOW_CREATE_STABLE_STMT: + case QUERY_NODE_SHOW_TRANSACTIONS_STMT: { SShowStmt* pStmt = (SShowStmt*)pNode; nodesDestroyNode(pStmt->pDbName); nodesDestroyNode(pStmt->pTbNamePattern); break; } + case QUERY_NODE_KILL_CONNECTION_STMT: // no pointer field + case QUERY_NODE_KILL_QUERY_STMT: // no pointer field + case QUERY_NODE_KILL_TRANSACTION_STMT: // no pointer field + break; + case QUERY_NODE_DELETE_STMT: { + SDeleteStmt* pStmt = (SDeleteStmt*)pNode; + nodesDestroyNode(pStmt->pFromTable); + nodesDestroyNode(pStmt->pWhere); + nodesDestroyNode(pStmt->pCountFunc); + nodesDestroyNode(pStmt->pTagIndexCond); + break; + } case QUERY_NODE_QUERY: { SQuery* pQuery = (SQuery*)pNode; nodesDestroyNode(pQuery->pRoot); @@ -606,6 +685,13 @@ void nodesDestroyNode(SNodeptr pNode) { case QUERY_NODE_LOGIC_PLAN_EXCHANGE: destroyLogicNode((SLogicNode*)pNode); break; + case QUERY_NODE_LOGIC_PLAN_MERGE: { + SMergeLogicNode* pLogicNode = (SMergeLogicNode*)pNode; + destroyLogicNode((SLogicNode*)pLogicNode); + nodesDestroyList(pLogicNode->pMergeKeys); + nodesDestroyList(pLogicNode->pInputs); + break; + } case QUERY_NODE_LOGIC_PLAN_WINDOW: { SWindowLogicNode* pLogicNode = (SWindowLogicNode*)pNode; destroyLogicNode((SLogicNode*)pLogicNode); @@ -613,6 +699,13 @@ void nodesDestroyNode(SNodeptr pNode) { nodesDestroyNode(pLogicNode->pTspk); break; } + case QUERY_NODE_LOGIC_PLAN_FILL: { + SFillLogicNode* pLogicNode = (SFillLogicNode*)pNode; + destroyLogicNode((SLogicNode*)pLogicNode); + nodesDestroyNode(pLogicNode->pWStartTs); + nodesDestroyNode(pLogicNode->pValues); + break; + } case QUERY_NODE_LOGIC_PLAN_SORT: { SSortLogicNode* pLogicNode = (SSortLogicNode*)pNode; destroyLogicNode((SLogicNode*)pLogicNode); @@ -625,10 +718,16 @@ void nodesDestroyNode(SNodeptr pNode) { nodesDestroyList(pLogicNode->pPartitionKeys); break; } + case QUERY_NODE_LOGIC_PLAN_INDEF_ROWS_FUNC: { + SIndefRowsFuncLogicNode* pLogicNode = (SIndefRowsFuncLogicNode*)pNode; + destroyLogicNode((SLogicNode*)pLogicNode); + nodesDestroyList(pLogicNode->pVectorFuncs); + break; + } case QUERY_NODE_LOGIC_SUBPLAN: { SLogicSubplan* pSubplan = (SLogicSubplan*)pNode; nodesDestroyList(pSubplan->pChildren); - nodesDestroyNode(pSubplan->pNode); + nodesDestroyNode((SNode*)pSubplan->pNode); nodesClearList(pSubplan->pParents); taosMemoryFreeClear(pSubplan->pVgroupList); break; @@ -637,17 +736,9 @@ void nodesDestroyNode(SNodeptr pNode) { nodesDestroyList(((SQueryLogicPlan*)pNode)->pTopSubplans); break; case QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN: - destroyScanPhysiNode((SScanPhysiNode*)pNode); - break; case QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN: - destroyScanPhysiNode((SScanPhysiNode*)pNode); - break; case QUERY_NODE_PHYSICAL_PLAN_TABLE_SEQ_SCAN: - destroyScanPhysiNode((SScanPhysiNode*)pNode); - break; case QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN: - destroyScanPhysiNode((SScanPhysiNode*)pNode); - break; case QUERY_NODE_PHYSICAL_PLAN_SYSTABLE_SCAN: destroyScanPhysiNode((SScanPhysiNode*)pNode); break; @@ -678,21 +769,62 @@ void nodesDestroyNode(SNodeptr pNode) { nodesDestroyList(pPhyNode->pSrcEndPoints); break; } + case QUERY_NODE_PHYSICAL_PLAN_MERGE: { + SMergePhysiNode* pPhyNode = (SMergePhysiNode*)pNode; + destroyPhysiNode((SPhysiNode*)pPhyNode); + nodesDestroyList(pPhyNode->pMergeKeys); + nodesDestroyList(pPhyNode->pTargets); + break; + } case QUERY_NODE_PHYSICAL_PLAN_SORT: { SSortPhysiNode* pPhyNode = (SSortPhysiNode*)pNode; destroyPhysiNode((SPhysiNode*)pPhyNode); - nodesDestroyNode(pPhyNode->pExprs); - nodesDestroyNode(pPhyNode->pSortKeys); + nodesDestroyList(pPhyNode->pExprs); + nodesDestroyList(pPhyNode->pSortKeys); break; } case QUERY_NODE_PHYSICAL_PLAN_HASH_INTERVAL: + case QUERY_NODE_PHYSICAL_PLAN_MERGE_INTERVAL: case QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL: + case QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL: + case QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL: destroyWinodwPhysiNode((SWinodwPhysiNode*)pNode); break; + case QUERY_NODE_PHYSICAL_PLAN_FILL: { + SFillPhysiNode* pPhyNode = (SFillPhysiNode*)pNode; + destroyPhysiNode((SPhysiNode*)pPhyNode); + nodesDestroyNode(pPhyNode->pWStartTs); + nodesDestroyNode(pPhyNode->pValues); + nodesDestroyList(pPhyNode->pTargets); + break; + } case QUERY_NODE_PHYSICAL_PLAN_MERGE_SESSION: case QUERY_NODE_PHYSICAL_PLAN_STREAM_SESSION: + case QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_SESSION: destroyWinodwPhysiNode((SWinodwPhysiNode*)pNode); break; + case QUERY_NODE_PHYSICAL_PLAN_MERGE_STATE: + case QUERY_NODE_PHYSICAL_PLAN_STREAM_STATE: { + SStateWinodwPhysiNode* pPhyNode = (SStateWinodwPhysiNode*)pNode; + destroyWinodwPhysiNode((SWinodwPhysiNode*)pPhyNode); + nodesDestroyNode(pPhyNode->pStateKey); + break; + } + case QUERY_NODE_PHYSICAL_PLAN_PARTITION: { + SPartitionPhysiNode* pPhyNode = (SPartitionPhysiNode*)pNode; + destroyPhysiNode((SPhysiNode*)pPhyNode); + nodesDestroyList(pPhyNode->pExprs); + nodesDestroyList(pPhyNode->pPartitionKeys); + nodesDestroyList(pPhyNode->pTargets); + break; + } + case QUERY_NODE_PHYSICAL_PLAN_INDEF_ROWS_FUNC: { + SIndefRowsFuncPhysiNode* pPhyNode = (SIndefRowsFuncPhysiNode*)pNode; + destroyPhysiNode((SPhysiNode*)pPhyNode); + nodesDestroyList(pPhyNode->pExprs); + nodesDestroyList(pPhyNode->pVectorFuncs); + break; + } case QUERY_NODE_PHYSICAL_PLAN_DISPATCH: destroyDataSinkNode((SDataSinkNode*)pNode); break; @@ -702,11 +834,17 @@ void nodesDestroyNode(SNodeptr pNode) { taosMemoryFreeClear(pSink->pData); break; } + case QUERY_NODE_PHYSICAL_PLAN_DELETE: { + SDataDeleterNode* pSink = (SDataDeleterNode*)pNode; + destroyDataSinkNode((SDataSinkNode*)pSink); + nodesDestroyNode(pSink->pAffectedRows); + break; + } case QUERY_NODE_PHYSICAL_SUBPLAN: { SSubplan* pSubplan = (SSubplan*)pNode; nodesDestroyList(pSubplan->pChildren); - nodesDestroyNode(pSubplan->pNode); - nodesDestroyNode(pSubplan->pDataSink); + nodesDestroyNode((SNode*)pSubplan->pNode); + nodesDestroyNode((SNode*)pSubplan->pDataSink); nodesClearList(pSubplan->pParents); break; } @@ -744,7 +882,7 @@ SNodeList* nodesMakeList() { return p; } -int32_t nodesListAppend(SNodeList* pList, SNodeptr pNode) { +int32_t nodesListAppend(SNodeList* pList, SNode* pNode) { if (NULL == pList || NULL == pNode) { return TSDB_CODE_FAILED; } @@ -766,7 +904,7 @@ int32_t nodesListAppend(SNodeList* pList, SNodeptr pNode) { return TSDB_CODE_SUCCESS; } -int32_t nodesListStrictAppend(SNodeList* pList, SNodeptr pNode) { +int32_t nodesListStrictAppend(SNodeList* pList, SNode* pNode) { if (NULL == pNode) { terrno = TSDB_CODE_OUT_OF_MEMORY; return TSDB_CODE_OUT_OF_MEMORY; @@ -778,7 +916,7 @@ int32_t nodesListStrictAppend(SNodeList* pList, SNodeptr pNode) { return code; } -int32_t nodesListMakeAppend(SNodeList** pList, SNodeptr pNode) { +int32_t nodesListMakeAppend(SNodeList** pList, SNode* pNode) { if (NULL == *pList) { *pList = nodesMakeList(); if (NULL == *pList) { @@ -789,7 +927,7 @@ int32_t nodesListMakeAppend(SNodeList** pList, SNodeptr pNode) { return nodesListAppend(*pList, pNode); } -int32_t nodesListMakeStrictAppend(SNodeList** pList, SNodeptr pNode) { +int32_t nodesListMakeStrictAppend(SNodeList** pList, SNode* pNode) { if (NULL == *pList) { *pList = nodesMakeList(); if (NULL == *pList) { @@ -831,7 +969,7 @@ int32_t nodesListStrictAppendList(SNodeList* pTarget, SNodeList* pSrc) { return code; } -int32_t nodesListPushFront(SNodeList* pList, SNodeptr pNode) { +int32_t nodesListPushFront(SNodeList* pList, SNode* pNode) { if (NULL == pList || NULL == pNode) { return TSDB_CODE_FAILED; } @@ -886,7 +1024,7 @@ void nodesListInsertList(SNodeList* pTarget, SListCell* pPos, SNodeList* pSrc) { taosMemoryFreeClear(pSrc); } -SNodeptr nodesListGetNode(SNodeList* pList, int32_t index) { +SNode* nodesListGetNode(SNodeList* pList, int32_t index) { SNode* node; FOREACH(node, pList) { if (0 == index--) { @@ -1420,7 +1558,7 @@ int32_t nodesMergeConds(SNode** pDst, SNodeList** pSrc) { *pDst = nodesListGetNode(*pSrc, 0); nodesClearList(*pSrc); } else { - SLogicConditionNode* pLogicCond = nodesMakeNode(QUERY_NODE_LOGIC_CONDITION); + SLogicConditionNode* pLogicCond = (SLogicConditionNode*)nodesMakeNode(QUERY_NODE_LOGIC_CONDITION); if (NULL == pLogicCond) { return TSDB_CODE_OUT_OF_MEMORY; } diff --git a/source/libs/parser/inc/parInt.h b/source/libs/parser/inc/parInt.h index adedcf0fd9..b799fa9855 100644 --- a/source/libs/parser/inc/parInt.h +++ b/source/libs/parser/inc/parInt.h @@ -27,12 +27,12 @@ extern "C" { #define QUERY_SMA_OPTIMIZE_DISABLE 0 #define QUERY_SMA_OPTIMIZE_ENABLE 1 -int32_t parseInsertSyntax(SParseContext* pContext, SQuery** pQuery); -int32_t parseInsertSql(SParseContext* pContext, SQuery** pQuery); +int32_t parseInsertSyntax(SParseContext* pContext, SQuery** pQuery, SParseMetaCache* pMetaCache); +int32_t parseInsertSql(SParseContext* pContext, SQuery** pQuery, SParseMetaCache* pMetaCache); int32_t parse(SParseContext* pParseCxt, SQuery** pQuery); -int32_t collectMetaKey(SParseContext* pParseCxt, SQuery* pQuery); -int32_t authenticate(SParseContext* pParseCxt, SQuery* pQuery); -int32_t translate(SParseContext* pParseCxt, SQuery* pQuery); +int32_t collectMetaKey(SParseContext* pParseCxt, SQuery* pQuery, SParseMetaCache* pMetaCache); +int32_t authenticate(SParseContext* pParseCxt, SQuery* pQuery, SParseMetaCache* pMetaCache); +int32_t translate(SParseContext* pParseCxt, SQuery* pQuery, SParseMetaCache* pMetaCache); int32_t extractResultSchema(const SNode* pRoot, int32_t* numOfCols, SSchema** pSchema); int32_t calculateConstant(SParseContext* pParseCxt, SQuery* pQuery); diff --git a/source/libs/parser/inc/parUtil.h b/source/libs/parser/inc/parUtil.h index fb67a35368..862e3e2cc0 100644 --- a/source/libs/parser/inc/parUtil.h +++ b/source/libs/parser/inc/parUtil.h @@ -87,6 +87,7 @@ int32_t getUserAuthFromCache(SParseMetaCache* pMetaCache, const char* pUser, con bool* pPass); int32_t getUdfInfoFromCache(SParseMetaCache* pMetaCache, const char* pFunc, SFuncInfo* pInfo); int32_t getTableIndexFromCache(SParseMetaCache* pMetaCache, const SName* pName, SArray** pIndexes); +void destoryParseMetaCache(SParseMetaCache* pMetaCache); #ifdef __cplusplus } diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index ed338b89e8..83ad41aac0 100644 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -461,6 +461,7 @@ into_opt(A) ::= INTO full_table_name(B). stream_options(A) ::= . { A = createStreamOptions(pCxt); } stream_options(A) ::= stream_options(B) TRIGGER AT_ONCE. { ((SStreamOptions*)B)->triggerType = STREAM_TRIGGER_AT_ONCE; A = B; } stream_options(A) ::= stream_options(B) TRIGGER WINDOW_CLOSE. { ((SStreamOptions*)B)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; A = B; } +stream_options(A) ::= stream_options(B) TRIGGER MAX_DELAY duration_literal(C). { ((SStreamOptions*)B)->triggerType = STREAM_TRIGGER_MAX_DELAY; ((SStreamOptions*)B)->pDelay = releaseRawExprNode(pCxt, C); A = B; } stream_options(A) ::= stream_options(B) WATERMARK duration_literal(C). { ((SStreamOptions*)B)->pWatermark = releaseRawExprNode(pCxt, C); A = B; } /************************************************ kill connection/query ***********************************************/ diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c index e7f4b05bc8..ca066c7056 100644 --- a/source/libs/parser/src/parAstCreater.c +++ b/source/libs/parser/src/parAstCreater.c @@ -338,7 +338,7 @@ SNode* createPlaceholderValueNode(SAstCreateContext* pCxt, const SToken* pLitera if (NULL == pCxt->pPlaceholderValues) { pCxt->pPlaceholderValues = taosArrayInit(TARRAY_MIN_SIZE, POINTER_BYTES); if (NULL == pCxt->pPlaceholderValues) { - nodesDestroyNode(val); + nodesDestroyNode((SNode*)val); return NULL; } } @@ -368,7 +368,7 @@ SNode* createLogicConditionNode(SAstCreateContext* pCxt, ELogicConditionType typ code = addParamToLogicConditionNode(cond, pParam2); } if (TSDB_CODE_SUCCESS != code) { - nodesDestroyNode(cond); + nodesDestroyNode((SNode*)cond); return NULL; } return (SNode*)cond; @@ -399,7 +399,7 @@ SNode* createNotBetweenAnd(SAstCreateContext* pCxt, SNode* pExpr, SNode* pLeft, static SNode* createPrimaryKeyCol(SAstCreateContext* pCxt) { CHECK_PARSER_STATUS(pCxt); - SColumnNode* pCol = nodesMakeNode(QUERY_NODE_COLUMN); + SColumnNode* pCol = (SColumnNode*)nodesMakeNode(QUERY_NODE_COLUMN); CHECK_OUT_OF_MEM(pCol); pCol->colId = PRIMARYKEY_TIMESTAMP_COL_ID; strcpy(pCol->colName, PK_TS_COL_INTERNAL_NAME); @@ -541,7 +541,7 @@ SNode* createStateWindowNode(SAstCreateContext* pCxt, SNode* pExpr) { CHECK_OUT_OF_MEM(state); state->pCol = createPrimaryKeyCol(pCxt); if (NULL == state->pCol) { - nodesDestroyNode(state); + nodesDestroyNode((SNode*)state); CHECK_OUT_OF_MEM(state->pCol); } state->pExpr = pExpr; @@ -555,7 +555,7 @@ SNode* createIntervalWindowNode(SAstCreateContext* pCxt, SNode* pInterval, SNode CHECK_OUT_OF_MEM(interval); interval->pCol = createPrimaryKeyCol(pCxt); if (NULL == interval->pCol) { - nodesDestroyNode(interval); + nodesDestroyNode((SNode*)interval); CHECK_OUT_OF_MEM(interval->pCol); } interval->pInterval = pInterval; @@ -573,7 +573,7 @@ SNode* createFillNode(SAstCreateContext* pCxt, EFillMode mode, SNode* pValues) { fill->pValues = pValues; fill->pWStartTs = nodesMakeNode(QUERY_NODE_FUNCTION); if (NULL == fill->pWStartTs) { - nodesDestroyNode(fill); + nodesDestroyNode((SNode*)fill); CHECK_OUT_OF_MEM(fill->pWStartTs); } strcpy(((SFunctionNode*)fill->pWStartTs)->functionName, "_wstartts"); @@ -689,7 +689,7 @@ SNode* createSetOperator(SAstCreateContext* pCxt, ESetOperatorType type, SNode* SNode* createDefaultDatabaseOptions(SAstCreateContext* pCxt) { CHECK_PARSER_STATUS(pCxt); - SDatabaseOptions* pOptions = nodesMakeNode(QUERY_NODE_DATABASE_OPTIONS); + SDatabaseOptions* pOptions = (SDatabaseOptions*)nodesMakeNode(QUERY_NODE_DATABASE_OPTIONS); CHECK_OUT_OF_MEM(pOptions); pOptions->buffer = TSDB_DEFAULT_BUFFER_PER_VNODE; pOptions->cachelast = TSDB_DEFAULT_CACHE_LAST_ROW; @@ -715,7 +715,7 @@ SNode* createDefaultDatabaseOptions(SAstCreateContext* pCxt) { SNode* createAlterDatabaseOptions(SAstCreateContext* pCxt) { CHECK_PARSER_STATUS(pCxt); - SDatabaseOptions* pOptions = nodesMakeNode(QUERY_NODE_DATABASE_OPTIONS); + SDatabaseOptions* pOptions = (SDatabaseOptions*)nodesMakeNode(QUERY_NODE_DATABASE_OPTIONS); CHECK_OUT_OF_MEM(pOptions); pOptions->buffer = -1; pOptions->cachelast = -1; @@ -852,7 +852,7 @@ SNode* createAlterDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName, SNode* if (!checkDbName(pCxt, pDbName, false)) { return NULL; } - SAlterDatabaseStmt* pStmt = nodesMakeNode(QUERY_NODE_ALTER_DATABASE_STMT); + SAlterDatabaseStmt* pStmt = (SAlterDatabaseStmt*)nodesMakeNode(QUERY_NODE_ALTER_DATABASE_STMT); CHECK_OUT_OF_MEM(pStmt); strncpy(pStmt->dbName, pDbName->z, pDbName->n); pStmt->pOptions = (SDatabaseOptions*)pOptions; @@ -861,7 +861,7 @@ SNode* createAlterDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName, SNode* SNode* createDefaultTableOptions(SAstCreateContext* pCxt) { CHECK_PARSER_STATUS(pCxt); - STableOptions* pOptions = nodesMakeNode(QUERY_NODE_TABLE_OPTIONS); + STableOptions* pOptions = (STableOptions*)nodesMakeNode(QUERY_NODE_TABLE_OPTIONS); CHECK_OUT_OF_MEM(pOptions); pOptions->filesFactor = TSDB_DEFAULT_ROLLUP_FILE_FACTOR; pOptions->ttl = TSDB_DEFAULT_TABLE_TTL; @@ -870,7 +870,7 @@ SNode* createDefaultTableOptions(SAstCreateContext* pCxt) { SNode* createAlterTableOptions(SAstCreateContext* pCxt) { CHECK_PARSER_STATUS(pCxt); - STableOptions* pOptions = nodesMakeNode(QUERY_NODE_TABLE_OPTIONS); + STableOptions* pOptions = (STableOptions*)nodesMakeNode(QUERY_NODE_TABLE_OPTIONS); CHECK_OUT_OF_MEM(pOptions); pOptions->filesFactor = -1; pOptions->ttl = -1; @@ -948,7 +948,7 @@ SNode* createCreateTableStmt(SAstCreateContext* pCxt, bool ignoreExists, SNode* SNode* createCreateSubTableClause(SAstCreateContext* pCxt, bool ignoreExists, SNode* pRealTable, SNode* pUseRealTable, SNodeList* pSpecificTags, SNodeList* pValsOfTags, SNode* pOptions) { CHECK_PARSER_STATUS(pCxt); - SCreateSubTableClause* pStmt = nodesMakeNode(QUERY_NODE_CREATE_SUBTABLE_CLAUSE); + SCreateSubTableClause* pStmt = (SCreateSubTableClause*)nodesMakeNode(QUERY_NODE_CREATE_SUBTABLE_CLAUSE); CHECK_OUT_OF_MEM(pStmt); strcpy(pStmt->dbName, ((SRealTableNode*)pRealTable)->table.dbName); strcpy(pStmt->tableName, ((SRealTableNode*)pRealTable)->table.tableName); @@ -959,12 +959,13 @@ SNode* createCreateSubTableClause(SAstCreateContext* pCxt, bool ignoreExists, SN pStmt->pValsOfTags = pValsOfTags; nodesDestroyNode(pRealTable); nodesDestroyNode(pUseRealTable); + nodesDestroyNode(pOptions); return (SNode*)pStmt; } SNode* createCreateMultiTableStmt(SAstCreateContext* pCxt, SNodeList* pSubTables) { CHECK_PARSER_STATUS(pCxt); - SCreateMultiTableStmt* pStmt = nodesMakeNode(QUERY_NODE_CREATE_MULTI_TABLE_STMT); + SCreateMultiTableStmt* pStmt = (SCreateMultiTableStmt*)nodesMakeNode(QUERY_NODE_CREATE_MULTI_TABLE_STMT); CHECK_OUT_OF_MEM(pStmt); pStmt->pSubTables = pSubTables; return (SNode*)pStmt; @@ -972,7 +973,7 @@ SNode* createCreateMultiTableStmt(SAstCreateContext* pCxt, SNodeList* pSubTables SNode* createDropTableClause(SAstCreateContext* pCxt, bool ignoreNotExists, SNode* pRealTable) { CHECK_PARSER_STATUS(pCxt); - SDropTableClause* pStmt = nodesMakeNode(QUERY_NODE_DROP_TABLE_CLAUSE); + SDropTableClause* pStmt = (SDropTableClause*)nodesMakeNode(QUERY_NODE_DROP_TABLE_CLAUSE); CHECK_OUT_OF_MEM(pStmt); strcpy(pStmt->dbName, ((SRealTableNode*)pRealTable)->table.dbName); strcpy(pStmt->tableName, ((SRealTableNode*)pRealTable)->table.tableName); @@ -983,7 +984,7 @@ SNode* createDropTableClause(SAstCreateContext* pCxt, bool ignoreNotExists, SNod SNode* createDropTableStmt(SAstCreateContext* pCxt, SNodeList* pTables) { CHECK_PARSER_STATUS(pCxt); - SDropTableStmt* pStmt = nodesMakeNode(QUERY_NODE_DROP_TABLE_STMT); + SDropTableStmt* pStmt = (SDropTableStmt*)nodesMakeNode(QUERY_NODE_DROP_TABLE_STMT); CHECK_OUT_OF_MEM(pStmt); pStmt->pTables = pTables; return (SNode*)pStmt; @@ -991,7 +992,7 @@ SNode* createDropTableStmt(SAstCreateContext* pCxt, SNodeList* pTables) { SNode* createDropSuperTableStmt(SAstCreateContext* pCxt, bool ignoreNotExists, SNode* pRealTable) { CHECK_PARSER_STATUS(pCxt); - SDropSuperTableStmt* pStmt = nodesMakeNode(QUERY_NODE_DROP_SUPER_TABLE_STMT); + SDropSuperTableStmt* pStmt = (SDropSuperTableStmt*)nodesMakeNode(QUERY_NODE_DROP_SUPER_TABLE_STMT); CHECK_OUT_OF_MEM(pStmt); strcpy(pStmt->dbName, ((SRealTableNode*)pRealTable)->table.dbName); strcpy(pStmt->tableName, ((SRealTableNode*)pRealTable)->table.tableName); @@ -1009,7 +1010,7 @@ static SNode* createAlterTableStmtFinalize(SNode* pRealTable, SAlterTableStmt* p SNode* createAlterTableModifyOptions(SAstCreateContext* pCxt, SNode* pRealTable, SNode* pOptions) { CHECK_PARSER_STATUS(pCxt); - SAlterTableStmt* pStmt = nodesMakeNode(QUERY_NODE_ALTER_TABLE_STMT); + SAlterTableStmt* pStmt = (SAlterTableStmt*)nodesMakeNode(QUERY_NODE_ALTER_TABLE_STMT); CHECK_OUT_OF_MEM(pStmt); pStmt->alterType = TSDB_ALTER_TABLE_UPDATE_OPTIONS; pStmt->pOptions = (STableOptions*)pOptions; @@ -1022,7 +1023,7 @@ SNode* createAlterTableAddModifyCol(SAstCreateContext* pCxt, SNode* pRealTable, if (!checkColumnName(pCxt, pColName)) { return NULL; } - SAlterTableStmt* pStmt = nodesMakeNode(QUERY_NODE_ALTER_TABLE_STMT); + SAlterTableStmt* pStmt = (SAlterTableStmt*)nodesMakeNode(QUERY_NODE_ALTER_TABLE_STMT); CHECK_OUT_OF_MEM(pStmt); pStmt->alterType = alterType; strncpy(pStmt->colName, pColName->z, pColName->n); @@ -1035,7 +1036,7 @@ SNode* createAlterTableDropCol(SAstCreateContext* pCxt, SNode* pRealTable, int8_ if (!checkColumnName(pCxt, pColName)) { return NULL; } - SAlterTableStmt* pStmt = nodesMakeNode(QUERY_NODE_ALTER_TABLE_STMT); + SAlterTableStmt* pStmt = (SAlterTableStmt*)nodesMakeNode(QUERY_NODE_ALTER_TABLE_STMT); CHECK_OUT_OF_MEM(pStmt); pStmt->alterType = alterType; strncpy(pStmt->colName, pColName->z, pColName->n); @@ -1048,7 +1049,7 @@ SNode* createAlterTableRenameCol(SAstCreateContext* pCxt, SNode* pRealTable, int if (!checkColumnName(pCxt, pOldColName) || !checkColumnName(pCxt, pNewColName)) { return NULL; } - SAlterTableStmt* pStmt = nodesMakeNode(QUERY_NODE_ALTER_TABLE_STMT); + SAlterTableStmt* pStmt = (SAlterTableStmt*)nodesMakeNode(QUERY_NODE_ALTER_TABLE_STMT); CHECK_OUT_OF_MEM(pStmt); pStmt->alterType = alterType; strncpy(pStmt->colName, pOldColName->z, pOldColName->n); @@ -1061,7 +1062,7 @@ SNode* createAlterTableSetTag(SAstCreateContext* pCxt, SNode* pRealTable, SToken if (!checkColumnName(pCxt, pTagName)) { return NULL; } - SAlterTableStmt* pStmt = nodesMakeNode(QUERY_NODE_ALTER_TABLE_STMT); + SAlterTableStmt* pStmt = (SAlterTableStmt*)nodesMakeNode(QUERY_NODE_ALTER_TABLE_STMT); CHECK_OUT_OF_MEM(pStmt); pStmt->alterType = TSDB_ALTER_TABLE_UPDATE_TAG_VAL; strncpy(pStmt->colName, pTagName->z, pTagName->n); @@ -1092,7 +1093,7 @@ SNode* createShowStmt(SAstCreateContext* pCxt, ENodeType type, SNode* pDbName, S pCxt->errCode = TSDB_CODE_PAR_SYNTAX_ERROR; return NULL; } - SShowStmt* pStmt = nodesMakeNode(type); + SShowStmt* pStmt = (SShowStmt*)nodesMakeNode(type); CHECK_OUT_OF_MEM(pStmt); pStmt->pDbName = pDbName; pStmt->pTbNamePattern = pTbNamePattern; @@ -1137,7 +1138,7 @@ SNode* createAlterUserStmt(SAstCreateContext* pCxt, SToken* pUserName, int8_t al if (TSDB_ALTER_USER_PASSWD == alterType) { char password[TSDB_USET_PASSWORD_LEN] = {0}; if (!checkPassword(pCxt, pVal, password)) { - nodesDestroyNode(pStmt); + nodesDestroyNode((SNode*)pStmt); return NULL; } strcpy(pStmt->password, password); @@ -1187,7 +1188,7 @@ SNode* createDropDnodeStmt(SAstCreateContext* pCxt, const SToken* pDnode) { pStmt->dnodeId = taosStr2Int32(pDnode->z, NULL, 10); } else { if (!checkAndSplitEndpoint(pCxt, pDnode, pStmt->fqdn, &pStmt->port)) { - nodesDestroyNode(pStmt); + nodesDestroyNode((SNode*)pStmt); return NULL; } } @@ -1197,7 +1198,7 @@ SNode* createDropDnodeStmt(SAstCreateContext* pCxt, const SToken* pDnode) { SNode* createAlterDnodeStmt(SAstCreateContext* pCxt, const SToken* pDnode, const SToken* pConfig, const SToken* pValue) { CHECK_PARSER_STATUS(pCxt); - SAlterDnodeStmt* pStmt = nodesMakeNode(QUERY_NODE_ALTER_DNODE_STMT); + SAlterDnodeStmt* pStmt = (SAlterDnodeStmt*)nodesMakeNode(QUERY_NODE_ALTER_DNODE_STMT); CHECK_OUT_OF_MEM(pStmt); pStmt->dnodeId = taosStr2Int32(pDnode->z, NULL, 10); trimString(pConfig->z, pConfig->n, pStmt->config, sizeof(pStmt->config)); @@ -1213,7 +1214,7 @@ SNode* createCreateIndexStmt(SAstCreateContext* pCxt, EIndexType type, bool igno if (!checkIndexName(pCxt, pIndexName) || !checkTableName(pCxt, pTableName) || !checkDbName(pCxt, NULL, true)) { return NULL; } - SCreateIndexStmt* pStmt = nodesMakeNode(QUERY_NODE_CREATE_INDEX_STMT); + SCreateIndexStmt* pStmt = (SCreateIndexStmt*)nodesMakeNode(QUERY_NODE_CREATE_INDEX_STMT); CHECK_OUT_OF_MEM(pStmt); pStmt->indexType = type; pStmt->ignoreExists = ignoreExists; @@ -1227,7 +1228,7 @@ SNode* createCreateIndexStmt(SAstCreateContext* pCxt, EIndexType type, bool igno SNode* createIndexOption(SAstCreateContext* pCxt, SNodeList* pFuncs, SNode* pInterval, SNode* pOffset, SNode* pSliding) { CHECK_PARSER_STATUS(pCxt); - SIndexOptions* pOptions = nodesMakeNode(QUERY_NODE_INDEX_OPTIONS); + SIndexOptions* pOptions = (SIndexOptions*)nodesMakeNode(QUERY_NODE_INDEX_OPTIONS); CHECK_OUT_OF_MEM(pOptions); pOptions->pFuncs = pFuncs; pOptions->pInterval = pInterval; @@ -1241,7 +1242,7 @@ SNode* createDropIndexStmt(SAstCreateContext* pCxt, bool ignoreNotExists, SToken if (!checkIndexName(pCxt, pIndexName) || !checkTableName(pCxt, pTableName)) { return NULL; } - SDropIndexStmt* pStmt = nodesMakeNode(QUERY_NODE_DROP_INDEX_STMT); + SDropIndexStmt* pStmt = (SDropIndexStmt*)nodesMakeNode(QUERY_NODE_DROP_INDEX_STMT); CHECK_OUT_OF_MEM(pStmt); pStmt->ignoreNotExists = ignoreNotExists; strncpy(pStmt->indexName, pIndexName->z, pIndexName->n); @@ -1251,26 +1252,24 @@ SNode* createDropIndexStmt(SAstCreateContext* pCxt, bool ignoreNotExists, SToken SNode* createCreateComponentNodeStmt(SAstCreateContext* pCxt, ENodeType type, const SToken* pDnodeId) { CHECK_PARSER_STATUS(pCxt); - SCreateComponentNodeStmt* pStmt = nodesMakeNode(type); + SCreateComponentNodeStmt* pStmt = (SCreateComponentNodeStmt*)nodesMakeNode(type); CHECK_OUT_OF_MEM(pStmt); pStmt->dnodeId = taosStr2Int32(pDnodeId->z, NULL, 10); - ; return (SNode*)pStmt; } SNode* createDropComponentNodeStmt(SAstCreateContext* pCxt, ENodeType type, const SToken* pDnodeId) { CHECK_PARSER_STATUS(pCxt); - SDropComponentNodeStmt* pStmt = nodesMakeNode(type); + SDropComponentNodeStmt* pStmt = (SDropComponentNodeStmt*)nodesMakeNode(type); CHECK_OUT_OF_MEM(pStmt); pStmt->dnodeId = taosStr2Int32(pDnodeId->z, NULL, 10); - ; return (SNode*)pStmt; } SNode* createCreateTopicStmt(SAstCreateContext* pCxt, bool ignoreExists, const SToken* pTopicName, SNode* pQuery, const SToken* pSubDbName, SNode* pRealTable) { CHECK_PARSER_STATUS(pCxt); - SCreateTopicStmt* pStmt = nodesMakeNode(QUERY_NODE_CREATE_TOPIC_STMT); + SCreateTopicStmt* pStmt = (SCreateTopicStmt*)nodesMakeNode(QUERY_NODE_CREATE_TOPIC_STMT); CHECK_OUT_OF_MEM(pStmt); strncpy(pStmt->topicName, pTopicName->z, pTopicName->n); pStmt->ignoreExists = ignoreExists; @@ -1288,7 +1287,7 @@ SNode* createCreateTopicStmt(SAstCreateContext* pCxt, bool ignoreExists, const S SNode* createDropTopicStmt(SAstCreateContext* pCxt, bool ignoreNotExists, const SToken* pTopicName) { CHECK_PARSER_STATUS(pCxt); - SDropTopicStmt* pStmt = nodesMakeNode(QUERY_NODE_DROP_TOPIC_STMT); + SDropTopicStmt* pStmt = (SDropTopicStmt*)nodesMakeNode(QUERY_NODE_DROP_TOPIC_STMT); CHECK_OUT_OF_MEM(pStmt); strncpy(pStmt->topicName, pTopicName->z, pTopicName->n); pStmt->ignoreNotExists = ignoreNotExists; @@ -1298,7 +1297,7 @@ SNode* createDropTopicStmt(SAstCreateContext* pCxt, bool ignoreNotExists, const SNode* createDropCGroupStmt(SAstCreateContext* pCxt, bool ignoreNotExists, const SToken* pCGroupId, const SToken* pTopicName) { CHECK_PARSER_STATUS(pCxt); - SDropCGroupStmt* pStmt = nodesMakeNode(QUERY_NODE_DROP_CGROUP_STMT); + SDropCGroupStmt* pStmt = (SDropCGroupStmt*)nodesMakeNode(QUERY_NODE_DROP_CGROUP_STMT); CHECK_OUT_OF_MEM(pStmt); pStmt->ignoreNotExists = ignoreNotExists; strncpy(pStmt->topicName, pTopicName->z, pTopicName->n); @@ -1308,7 +1307,7 @@ SNode* createDropCGroupStmt(SAstCreateContext* pCxt, bool ignoreNotExists, const SNode* createAlterLocalStmt(SAstCreateContext* pCxt, const SToken* pConfig, const SToken* pValue) { CHECK_PARSER_STATUS(pCxt); - SAlterLocalStmt* pStmt = nodesMakeNode(QUERY_NODE_ALTER_LOCAL_STMT); + SAlterLocalStmt* pStmt = (SAlterLocalStmt*)nodesMakeNode(QUERY_NODE_ALTER_LOCAL_STMT); CHECK_OUT_OF_MEM(pStmt); trimString(pConfig->z, pConfig->n, pStmt->config, sizeof(pStmt->config)); if (NULL != pValue) { @@ -1319,7 +1318,7 @@ SNode* createAlterLocalStmt(SAstCreateContext* pCxt, const SToken* pConfig, cons SNode* createDefaultExplainOptions(SAstCreateContext* pCxt) { CHECK_PARSER_STATUS(pCxt); - SExplainOptions* pOptions = nodesMakeNode(QUERY_NODE_EXPLAIN_OPTIONS); + SExplainOptions* pOptions = (SExplainOptions*)nodesMakeNode(QUERY_NODE_EXPLAIN_OPTIONS); CHECK_OUT_OF_MEM(pOptions); pOptions->verbose = TSDB_DEFAULT_EXPLAIN_VERBOSE; pOptions->ratio = TSDB_DEFAULT_EXPLAIN_RATIO; @@ -1340,7 +1339,7 @@ SNode* setExplainRatio(SAstCreateContext* pCxt, SNode* pOptions, const SToken* p SNode* createExplainStmt(SAstCreateContext* pCxt, bool analyze, SNode* pOptions, SNode* pQuery) { CHECK_PARSER_STATUS(pCxt); - SExplainStmt* pStmt = nodesMakeNode(QUERY_NODE_EXPLAIN_STMT); + SExplainStmt* pStmt = (SExplainStmt*)nodesMakeNode(QUERY_NODE_EXPLAIN_STMT); CHECK_OUT_OF_MEM(pStmt); pStmt->analyze = analyze; pStmt->pOptions = (SExplainOptions*)pOptions; @@ -1350,7 +1349,7 @@ SNode* createExplainStmt(SAstCreateContext* pCxt, bool analyze, SNode* pOptions, SNode* createDescribeStmt(SAstCreateContext* pCxt, SNode* pRealTable) { CHECK_PARSER_STATUS(pCxt); - SDescribeStmt* pStmt = nodesMakeNode(QUERY_NODE_DESCRIBE_STMT); + SDescribeStmt* pStmt = (SDescribeStmt*)nodesMakeNode(QUERY_NODE_DESCRIBE_STMT); CHECK_OUT_OF_MEM(pStmt); strcpy(pStmt->dbName, ((SRealTableNode*)pRealTable)->table.dbName); strcpy(pStmt->tableName, ((SRealTableNode*)pRealTable)->table.tableName); @@ -1379,7 +1378,7 @@ SNode* createCreateFunctionStmt(SAstCreateContext* pCxt, bool ignoreExists, bool pCxt->errCode = TSDB_CODE_PAR_SYNTAX_ERROR; return NULL; } - SCreateFunctionStmt* pStmt = nodesMakeNode(QUERY_NODE_CREATE_FUNCTION_STMT); + SCreateFunctionStmt* pStmt = (SCreateFunctionStmt*)nodesMakeNode(QUERY_NODE_CREATE_FUNCTION_STMT); CHECK_OUT_OF_MEM(pStmt); pStmt->ignoreExists = ignoreExists; strncpy(pStmt->funcName, pFuncName->z, pFuncName->n); @@ -1392,7 +1391,7 @@ SNode* createCreateFunctionStmt(SAstCreateContext* pCxt, bool ignoreExists, bool SNode* createDropFunctionStmt(SAstCreateContext* pCxt, bool ignoreNotExists, const SToken* pFuncName) { CHECK_PARSER_STATUS(pCxt); - SDropFunctionStmt* pStmt = nodesMakeNode(QUERY_NODE_DROP_FUNCTION_STMT); + SDropFunctionStmt* pStmt = (SDropFunctionStmt*)nodesMakeNode(QUERY_NODE_DROP_FUNCTION_STMT); CHECK_OUT_OF_MEM(pStmt); pStmt->ignoreNotExists = ignoreNotExists; strncpy(pStmt->funcName, pFuncName->z, pFuncName->n); @@ -1401,7 +1400,7 @@ SNode* createDropFunctionStmt(SAstCreateContext* pCxt, bool ignoreNotExists, con SNode* createStreamOptions(SAstCreateContext* pCxt) { CHECK_PARSER_STATUS(pCxt); - SStreamOptions* pOptions = nodesMakeNode(QUERY_NODE_STREAM_OPTIONS); + SStreamOptions* pOptions = (SStreamOptions*)nodesMakeNode(QUERY_NODE_STREAM_OPTIONS); CHECK_OUT_OF_MEM(pOptions); pOptions->triggerType = STREAM_TRIGGER_AT_ONCE; return (SNode*)pOptions; @@ -1410,7 +1409,7 @@ SNode* createStreamOptions(SAstCreateContext* pCxt) { SNode* createCreateStreamStmt(SAstCreateContext* pCxt, bool ignoreExists, const SToken* pStreamName, SNode* pRealTable, SNode* pOptions, SNode* pQuery) { CHECK_PARSER_STATUS(pCxt); - SCreateStreamStmt* pStmt = nodesMakeNode(QUERY_NODE_CREATE_STREAM_STMT); + SCreateStreamStmt* pStmt = (SCreateStreamStmt*)nodesMakeNode(QUERY_NODE_CREATE_STREAM_STMT); CHECK_OUT_OF_MEM(pStmt); strncpy(pStmt->streamName, pStreamName->z, pStreamName->n); if (NULL != pRealTable) { @@ -1426,7 +1425,7 @@ SNode* createCreateStreamStmt(SAstCreateContext* pCxt, bool ignoreExists, const SNode* createDropStreamStmt(SAstCreateContext* pCxt, bool ignoreNotExists, const SToken* pStreamName) { CHECK_PARSER_STATUS(pCxt); - SDropStreamStmt* pStmt = nodesMakeNode(QUERY_NODE_DROP_STREAM_STMT); + SDropStreamStmt* pStmt = (SDropStreamStmt*)nodesMakeNode(QUERY_NODE_DROP_STREAM_STMT); CHECK_OUT_OF_MEM(pStmt); strncpy(pStmt->streamName, pStreamName->z, pStreamName->n); pStmt->ignoreNotExists = ignoreNotExists; @@ -1435,7 +1434,7 @@ SNode* createDropStreamStmt(SAstCreateContext* pCxt, bool ignoreNotExists, const SNode* createKillStmt(SAstCreateContext* pCxt, ENodeType type, const SToken* pId) { CHECK_PARSER_STATUS(pCxt); - SKillStmt* pStmt = nodesMakeNode(type); + SKillStmt* pStmt = (SKillStmt*)nodesMakeNode(type); CHECK_OUT_OF_MEM(pStmt); pStmt->targetId = taosStr2Int32(pId->z, NULL, 10); return (SNode*)pStmt; @@ -1443,14 +1442,14 @@ SNode* createKillStmt(SAstCreateContext* pCxt, ENodeType type, const SToken* pId SNode* createBalanceVgroupStmt(SAstCreateContext* pCxt) { CHECK_PARSER_STATUS(pCxt); - SBalanceVgroupStmt* pStmt = nodesMakeNode(QUERY_NODE_BALANCE_VGROUP_STMT); + SBalanceVgroupStmt* pStmt = (SBalanceVgroupStmt*)nodesMakeNode(QUERY_NODE_BALANCE_VGROUP_STMT); CHECK_OUT_OF_MEM(pStmt); return (SNode*)pStmt; } SNode* createMergeVgroupStmt(SAstCreateContext* pCxt, const SToken* pVgId1, const SToken* pVgId2) { CHECK_PARSER_STATUS(pCxt); - SMergeVgroupStmt* pStmt = nodesMakeNode(QUERY_NODE_MERGE_VGROUP_STMT); + SMergeVgroupStmt* pStmt = (SMergeVgroupStmt*)nodesMakeNode(QUERY_NODE_MERGE_VGROUP_STMT); CHECK_OUT_OF_MEM(pStmt); pStmt->vgId1 = taosStr2Int32(pVgId1->z, NULL, 10); pStmt->vgId2 = taosStr2Int32(pVgId2->z, NULL, 10); @@ -1459,7 +1458,7 @@ SNode* createMergeVgroupStmt(SAstCreateContext* pCxt, const SToken* pVgId1, cons SNode* createRedistributeVgroupStmt(SAstCreateContext* pCxt, const SToken* pVgId, SNodeList* pDnodes) { CHECK_PARSER_STATUS(pCxt); - SRedistributeVgroupStmt* pStmt = nodesMakeNode(QUERY_NODE_REDISTRIBUTE_VGROUP_STMT); + SRedistributeVgroupStmt* pStmt = (SRedistributeVgroupStmt*)nodesMakeNode(QUERY_NODE_REDISTRIBUTE_VGROUP_STMT); CHECK_OUT_OF_MEM(pStmt); pStmt->vgId = taosStr2Int32(pVgId->z, NULL, 10); pStmt->pDnodes = pDnodes; @@ -1468,7 +1467,7 @@ SNode* createRedistributeVgroupStmt(SAstCreateContext* pCxt, const SToken* pVgId SNode* createSplitVgroupStmt(SAstCreateContext* pCxt, const SToken* pVgId) { CHECK_PARSER_STATUS(pCxt); - SSplitVgroupStmt* pStmt = nodesMakeNode(QUERY_NODE_SPLIT_VGROUP_STMT); + SSplitVgroupStmt* pStmt = (SSplitVgroupStmt*)nodesMakeNode(QUERY_NODE_SPLIT_VGROUP_STMT); CHECK_OUT_OF_MEM(pStmt); pStmt->vgId = taosStr2Int32(pVgId->z, NULL, 10); return (SNode*)pStmt; @@ -1486,7 +1485,7 @@ SNode* createGrantStmt(SAstCreateContext* pCxt, int64_t privileges, SToken* pDbN if (!checkDbName(pCxt, pDbName, false) || !checkUserName(pCxt, pUserName)) { return NULL; } - SGrantStmt* pStmt = nodesMakeNode(QUERY_NODE_GRANT_STMT); + SGrantStmt* pStmt = (SGrantStmt*)nodesMakeNode(QUERY_NODE_GRANT_STMT); CHECK_OUT_OF_MEM(pStmt); pStmt->privileges = privileges; strncpy(pStmt->dbName, pDbName->z, pDbName->n); @@ -1499,7 +1498,7 @@ SNode* createRevokeStmt(SAstCreateContext* pCxt, int64_t privileges, SToken* pDb if (!checkDbName(pCxt, pDbName, false) || !checkUserName(pCxt, pUserName)) { return NULL; } - SRevokeStmt* pStmt = nodesMakeNode(QUERY_NODE_REVOKE_STMT); + SRevokeStmt* pStmt = (SRevokeStmt*)nodesMakeNode(QUERY_NODE_REVOKE_STMT); CHECK_OUT_OF_MEM(pStmt); pStmt->privileges = privileges; strncpy(pStmt->dbName, pDbName->z, pDbName->n); @@ -1508,11 +1507,11 @@ SNode* createRevokeStmt(SAstCreateContext* pCxt, int64_t privileges, SToken* pDb } SNode* createCountFuncForDelete(SAstCreateContext* pCxt) { - SFunctionNode* pFunc = nodesMakeNode(QUERY_NODE_FUNCTION); + SFunctionNode* pFunc = (SFunctionNode*)nodesMakeNode(QUERY_NODE_FUNCTION); CHECK_OUT_OF_MEM(pFunc); strcpy(pFunc->functionName, "count"); if (TSDB_CODE_SUCCESS != nodesListMakeStrictAppend(&pFunc->pParameterList, createPrimaryKeyCol(pCxt))) { - nodesDestroyNode(pFunc); + nodesDestroyNode((SNode*)pFunc); CHECK_OUT_OF_MEM(NULL); } return (SNode*)pFunc; @@ -1520,13 +1519,13 @@ SNode* createCountFuncForDelete(SAstCreateContext* pCxt) { SNode* createDeleteStmt(SAstCreateContext* pCxt, SNode* pTable, SNode* pWhere) { CHECK_PARSER_STATUS(pCxt); - SDeleteStmt* pStmt = nodesMakeNode(QUERY_NODE_DELETE_STMT); + SDeleteStmt* pStmt = (SDeleteStmt*)nodesMakeNode(QUERY_NODE_DELETE_STMT); CHECK_OUT_OF_MEM(pStmt); pStmt->pFromTable = pTable; pStmt->pWhere = pWhere; pStmt->pCountFunc = createCountFuncForDelete(pCxt); if (NULL == pStmt->pCountFunc) { - nodesDestroyNode(pStmt); + nodesDestroyNode((SNode*)pStmt); CHECK_OUT_OF_MEM(NULL); } return (SNode*)pStmt; diff --git a/source/libs/parser/src/parAstParser.c b/source/libs/parser/src/parAstParser.c index aca7d9c9d3..f6467dbf23 100644 --- a/source/libs/parser/src/parAstParser.c +++ b/source/libs/parser/src/parAstParser.c @@ -77,7 +77,7 @@ int32_t parse(SParseContext* pParseCxt, SQuery** pQuery) { abort_parse: ParseFree(pParser, (FFree)taosMemoryFree); if (TSDB_CODE_SUCCESS == cxt.errCode) { - *pQuery = taosMemoryCalloc(1, sizeof(SQuery)); + *pQuery = (SQuery*)nodesMakeNode(QUERY_NODE_QUERY); if (NULL == *pQuery) { return TSDB_CODE_OUT_OF_MEMORY; } @@ -95,12 +95,6 @@ typedef struct SCollectMetaKeyCxt { SNode* pStmt; } SCollectMetaKeyCxt; -static void destroyCollectMetaKeyCxt(SCollectMetaKeyCxt* pCxt) { - if (NULL != pCxt->pMetaCache) { - // TODO - } -} - typedef struct SCollectMetaKeyFromExprCxt { SCollectMetaKeyCxt* pComCxt; int32_t errCode; @@ -463,16 +457,7 @@ static int32_t collectMetaKeyFromQuery(SCollectMetaKeyCxt* pCxt, SNode* pStmt) { return TSDB_CODE_SUCCESS; } -int32_t collectMetaKey(SParseContext* pParseCxt, SQuery* pQuery) { - SCollectMetaKeyCxt cxt = { - .pParseCxt = pParseCxt, .pMetaCache = taosMemoryCalloc(1, sizeof(SParseMetaCache)), .pStmt = pQuery->pRoot}; - if (NULL == cxt.pMetaCache) { - return TSDB_CODE_OUT_OF_MEMORY; - } - int32_t code = collectMetaKeyFromQuery(&cxt, pQuery->pRoot); - if (TSDB_CODE_SUCCESS == code) { - TSWAP(pQuery->pMetaCache, cxt.pMetaCache); - } - destroyCollectMetaKeyCxt(&cxt); - return code; +int32_t collectMetaKey(SParseContext* pParseCxt, SQuery* pQuery, SParseMetaCache* pMetaCache) { + SCollectMetaKeyCxt cxt = {.pParseCxt = pParseCxt, .pMetaCache = pMetaCache, .pStmt = pQuery->pRoot}; + return collectMetaKeyFromQuery(&cxt, pQuery->pRoot); } diff --git a/source/libs/parser/src/parAuthenticator.c b/source/libs/parser/src/parAuthenticator.c index 858f602e1e..068ac4c94d 100644 --- a/source/libs/parser/src/parAuthenticator.c +++ b/source/libs/parser/src/parAuthenticator.c @@ -105,7 +105,7 @@ static int32_t authQuery(SAuthCxt* pCxt, SNode* pStmt) { return TSDB_CODE_SUCCESS; } -int32_t authenticate(SParseContext* pParseCxt, SQuery* pQuery) { - SAuthCxt cxt = {.pParseCxt = pParseCxt, .pMetaCache = pQuery->pMetaCache, .errCode = TSDB_CODE_SUCCESS}; +int32_t authenticate(SParseContext* pParseCxt, SQuery* pQuery, SParseMetaCache* pMetaCache) { + SAuthCxt cxt = {.pParseCxt = pParseCxt, .pMetaCache = pMetaCache, .errCode = TSDB_CODE_SUCCESS}; return authQuery(&cxt, pQuery->pRoot); } diff --git a/source/libs/parser/src/parCalcConst.c b/source/libs/parser/src/parCalcConst.c index b2cb67b1c3..22d7afd642 100644 --- a/source/libs/parser/src/parCalcConst.c +++ b/source/libs/parser/src/parCalcConst.c @@ -65,7 +65,7 @@ static bool isCondition(const SNode* pNode) { } static int32_t rewriteIsTrue(SNode* pSrc, SNode** pIsTrue) { - SOperatorNode* pOp = nodesMakeNode(QUERY_NODE_OPERATOR); + SOperatorNode* pOp = (SOperatorNode*)nodesMakeNode(QUERY_NODE_OPERATOR); if (NULL == pOp) { return TSDB_CODE_OUT_OF_MEMORY; } diff --git a/source/libs/parser/src/parInsert.c b/source/libs/parser/src/parInsert.c index 7c0bf0de74..626960bf10 100644 --- a/source/libs/parser/src/parInsert.c +++ b/source/libs/parser/src/parInsert.c @@ -1301,6 +1301,8 @@ static void destroyInsertParseContextForTable(SInsertParseContext* pCxt) { destroyCreateSubTbReq(&pCxt->createTblReq); } +static void destroySubTableHashElem(void* p) { taosMemoryFree(*(STableMeta**)p); } + static void destroyInsertParseContext(SInsertParseContext* pCxt) { destroyInsertParseContextForTable(pCxt); taosHashCleanup(pCxt->pVgroupsHashObj); @@ -1458,7 +1460,7 @@ static int32_t parseInsertBody(SInsertParseContext* pCxt) { // [(field1_name, ...)] // VALUES (field1_value, ...) [(field1_value2, ...) ...] | FILE csv_file_path // [...]; -int32_t parseInsertSql(SParseContext* pContext, SQuery** pQuery) { +int32_t parseInsertSql(SParseContext* pContext, SQuery** pQuery, SParseMetaCache* pMetaCache) { SInsertParseContext context = { .pComCxt = pContext, .pSql = (char*)pContext->pSql, @@ -1469,7 +1471,8 @@ int32_t parseInsertSql(SParseContext* pContext, SQuery** pQuery) { .pDbFNameHashObj = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_VARCHAR), true, HASH_NO_LOCK), .totalNum = 0, .pOutput = (SVnodeModifOpStmt*)nodesMakeNode(QUERY_NODE_VNODE_MODIF_STMT), - .pStmtCb = pContext->pStmtCb}; + .pStmtCb = pContext->pStmtCb, + .pMetaCache = pMetaCache}; if (pContext->pStmtCb && *pQuery) { (*pContext->pStmtCb->getExecInfoFn)(pContext->pStmtCb->pStmt, &context.pVgroupsHashObj, @@ -1484,18 +1487,17 @@ int32_t parseInsertSql(SParseContext* pContext, SQuery** pQuery) { NULL == context.pTableNameHashObj || NULL == context.pDbFNameHashObj || NULL == context.pOutput) { return TSDB_CODE_TSC_OUT_OF_MEMORY; } + taosHashSetFreeFp(context.pSubTableHashObj, destroySubTableHashElem); if (pContext->pStmtCb) { TSDB_QUERY_SET_TYPE(context.pOutput->insertType, TSDB_QUERY_TYPE_STMT_INSERT); } if (NULL == *pQuery) { - *pQuery = taosMemoryCalloc(1, sizeof(SQuery)); + *pQuery = (SQuery*)nodesMakeNode(QUERY_NODE_QUERY); if (NULL == *pQuery) { return TSDB_CODE_OUT_OF_MEMORY; } - } else { - context.pMetaCache = (*pQuery)->pMetaCache; } (*pQuery)->execMode = QUERY_EXEC_MODE_SCHEDULE; (*pQuery)->haveResultSet = false; @@ -1694,24 +1696,20 @@ static int32_t parseInsertBodySyntax(SInsertParseSyntaxCxt* pCxt) { return TSDB_CODE_SUCCESS; } -int32_t parseInsertSyntax(SParseContext* pContext, SQuery** pQuery) { +int32_t parseInsertSyntax(SParseContext* pContext, SQuery** pQuery, SParseMetaCache* pMetaCache) { SInsertParseSyntaxCxt context = {.pComCxt = pContext, .pSql = (char*)pContext->pSql, .msg = {.buf = pContext->pMsg, .len = pContext->msgLen}, - .pMetaCache = taosMemoryCalloc(1, sizeof(SParseMetaCache))}; - if (NULL == context.pMetaCache) { - return TSDB_CODE_OUT_OF_MEMORY; - } - int32_t code = skipInsertInto(&context.pSql, &context.msg); + .pMetaCache = pMetaCache}; + int32_t code = skipInsertInto(&context.pSql, &context.msg); if (TSDB_CODE_SUCCESS == code) { code = parseInsertBodySyntax(&context); } if (TSDB_CODE_SUCCESS == code) { - *pQuery = taosMemoryCalloc(1, sizeof(SQuery)); + *pQuery = (SQuery*)nodesMakeNode(QUERY_NODE_QUERY); if (NULL == *pQuery) { return TSDB_CODE_OUT_OF_MEMORY; } - TSWAP((*pQuery)->pMetaCache, context.pMetaCache); } return code; } diff --git a/source/libs/parser/src/parTokenizer.c b/source/libs/parser/src/parTokenizer.c index e1ae727b66..a9d730e1ad 100644 --- a/source/libs/parser/src/parTokenizer.c +++ b/source/libs/parser/src/parTokenizer.c @@ -117,6 +117,7 @@ static SKeyword keywordTable[] = { {"LOCAL", TK_LOCAL}, {"MATCH", TK_MATCH}, {"MAXROWS", TK_MAXROWS}, + {"MAX_DELAY", TK_MAX_DELAY}, {"MERGE", TK_MERGE}, {"MINROWS", TK_MINROWS}, {"MINUS", TK_MINUS}, diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index d623b1a9a9..fcf2f57dec 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -112,7 +112,7 @@ static int32_t getTableMetaImpl(STranslateContext* pCxt, const SName* pName, STa if (pParCxt->async) { code = getTableMetaFromCache(pCxt->pMetaCache, pName, pMeta); } else { - SRequestConnInfo conn = {.pTrans = pParCxt->pTransporter, + SRequestConnInfo conn = {.pTrans = pParCxt->pTransporter, .requestId = pParCxt->requestId, .requestObjRefId = pParCxt->requestRid, .mgmtEps = pParCxt->mgmtEpSet}; @@ -140,13 +140,12 @@ static int32_t refreshGetTableMeta(STranslateContext* pCxt, const char* pDbName, if (pParCxt->async) { code = getTableMetaFromCache(pCxt->pMetaCache, &name, pMeta); } else { - SRequestConnInfo conn = {.pTrans = pParCxt->pTransporter, + SRequestConnInfo conn = {.pTrans = pParCxt->pTransporter, .requestId = pParCxt->requestId, .requestObjRefId = pParCxt->requestRid, .mgmtEps = pParCxt->mgmtEpSet}; - - code = - catalogRefreshGetTableMeta(pParCxt->pCatalog, &conn, &name, pMeta, false); + + code = catalogRefreshGetTableMeta(pParCxt->pCatalog, &conn, &name, pMeta, false); } if (TSDB_CODE_SUCCESS != code) { parserError("catalogRefreshGetTableMeta error, code:%s, dbName:%s, tbName:%s", tstrerror(code), pDbName, @@ -164,7 +163,7 @@ static int32_t getDBVgInfoImpl(STranslateContext* pCxt, const SName* pName, SArr if (pParCxt->async) { code = getDbVgInfoFromCache(pCxt->pMetaCache, fullDbName, pVgInfo); } else { - SRequestConnInfo conn = {.pTrans = pParCxt->pTransporter, + SRequestConnInfo conn = {.pTrans = pParCxt->pTransporter, .requestId = pParCxt->requestId, .requestObjRefId = pParCxt->requestRid, .mgmtEps = pParCxt->mgmtEpSet}; @@ -195,7 +194,7 @@ static int32_t getTableHashVgroupImpl(STranslateContext* pCxt, const SName* pNam if (pParCxt->async) { code = getTableVgroupFromCache(pCxt->pMetaCache, pName, pInfo); } else { - SRequestConnInfo conn = {.pTrans = pParCxt->pTransporter, + SRequestConnInfo conn = {.pTrans = pParCxt->pTransporter, .requestId = pParCxt->requestId, .requestObjRefId = pParCxt->requestRid, .mgmtEps = pParCxt->mgmtEpSet}; @@ -243,7 +242,7 @@ static int32_t getDBCfg(STranslateContext* pCxt, const char* pDbName, SDbCfgInfo if (pParCxt->async) { code = getDbCfgFromCache(pCxt->pMetaCache, dbFname, pInfo); } else { - SRequestConnInfo conn = {.pTrans = pParCxt->pTransporter, + SRequestConnInfo conn = {.pTrans = pParCxt->pTransporter, .requestId = pParCxt->requestId, .requestObjRefId = pParCxt->requestRid, .mgmtEps = pParCxt->mgmtEpSet}; @@ -264,13 +263,12 @@ static int32_t getUdfInfo(STranslateContext* pCxt, SFunctionNode* pFunc) { if (pParCxt->async) { code = getUdfInfoFromCache(pCxt->pMetaCache, pFunc->functionName, &funcInfo); } else { - SRequestConnInfo conn = {.pTrans = pParCxt->pTransporter, + SRequestConnInfo conn = {.pTrans = pParCxt->pTransporter, .requestId = pParCxt->requestId, .requestObjRefId = pParCxt->requestRid, .mgmtEps = pParCxt->mgmtEpSet}; - code = catalogGetUdfInfo(pParCxt->pCatalog, &conn, pFunc->functionName, - &funcInfo); + code = catalogGetUdfInfo(pParCxt->pCatalog, &conn, pFunc->functionName, &funcInfo); } if (TSDB_CODE_SUCCESS == code) { pFunc->funcType = FUNCTION_TYPE_UDF; @@ -292,11 +290,11 @@ static int32_t getTableIndex(STranslateContext* pCxt, const SName* pName, SArray if (pParCxt->async) { code = getTableIndexFromCache(pCxt->pMetaCache, pName, pIndexes); } else { - SRequestConnInfo conn = {.pTrans = pParCxt->pTransporter, + SRequestConnInfo conn = {.pTrans = pParCxt->pTransporter, .requestId = pParCxt->requestId, .requestObjRefId = pParCxt->requestRid, .mgmtEps = pParCxt->mgmtEpSet}; - + code = catalogGetTableIndex(pParCxt->pCatalog, &conn, pName, pIndexes); } if (TSDB_CODE_SUCCESS != code) { @@ -982,7 +980,7 @@ static bool isCountStar(SFunctionNode* pFunc) { // count(*) is rewritten as count(ts) for scannning optimization static int32_t rewriteCountStar(STranslateContext* pCxt, SFunctionNode* pCount) { - SColumnNode* pCol = nodesListGetNode(pCount->pParameterList, 0); + SColumnNode* pCol = (SColumnNode*)nodesListGetNode(pCount->pParameterList, 0); STableNode* pTable = NULL; int32_t code = findTable(pCxt, ('\0' == pCol->tableAlias[0] ? NULL : pCol->tableAlias), &pTable); if (TSDB_CODE_SUCCESS == code && QUERY_NODE_REAL_TABLE == nodeType(pTable)) { @@ -1034,7 +1032,7 @@ static int32_t translateScanPseudoColumnFunc(STranslateContext* pCxt, SFunctionN return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_TBNAME); } } else { - SValueNode* pVal = nodesListGetNode(pFunc->pParameterList, 0); + SValueNode* pVal = (SValueNode*)nodesListGetNode(pFunc->pParameterList, 0); STableNode* pTable = NULL; pCxt->errCode = findTable(pCxt, pVal->literal, &pTable); if (TSDB_CODE_SUCCESS == pCxt->errCode && (NULL == pTable || QUERY_NODE_REAL_TABLE != nodeType(pTable))) { @@ -1175,7 +1173,7 @@ typedef struct SCheckExprForGroupByCxt { } SCheckExprForGroupByCxt; static EDealRes rewriteColToSelectValFunc(STranslateContext* pCxt, SNode** pNode) { - SFunctionNode* pFunc = nodesMakeNode(QUERY_NODE_FUNCTION); + SFunctionNode* pFunc = (SFunctionNode*)nodesMakeNode(QUERY_NODE_FUNCTION); if (NULL == pFunc) { pCxt->errCode = TSDB_CODE_OUT_OF_MEMORY; return DEAL_RES_ERROR; @@ -1190,7 +1188,7 @@ static EDealRes rewriteColToSelectValFunc(STranslateContext* pCxt, SNode** pNode *pNode = (SNode*)pFunc; pCxt->pCurrSelectStmt->hasSelectValFunc = true; } else { - nodesDestroyNode(pFunc); + nodesDestroyNode((SNode*)pFunc); } return TSDB_CODE_SUCCESS == pCxt->errCode ? DEAL_RES_IGNORE_CHILD : DEAL_RES_ERROR; } @@ -1527,14 +1525,14 @@ static int32_t createAllColumns(STranslateContext* pCxt, SNodeList** pCols) { } static SNode* createMultiResFunc(SFunctionNode* pSrcFunc, SExprNode* pExpr) { - SFunctionNode* pFunc = nodesMakeNode(QUERY_NODE_FUNCTION); + SFunctionNode* pFunc = (SFunctionNode*)nodesMakeNode(QUERY_NODE_FUNCTION); if (NULL == pFunc) { return NULL; } pFunc->pParameterList = nodesMakeList(); if (NULL == pFunc->pParameterList || - TSDB_CODE_SUCCESS != nodesListStrictAppend(pFunc->pParameterList, nodesCloneNode(pExpr))) { - nodesDestroyNode(pFunc); + TSDB_CODE_SUCCESS != nodesListStrictAppend(pFunc->pParameterList, nodesCloneNode((SNode*)pExpr))) { + nodesDestroyNode((SNode*)pFunc); return NULL; } @@ -2039,7 +2037,7 @@ static int32_t checkLimit(STranslateContext* pCxt, SSelectStmt* pSelect) { } static int32_t createPrimaryKeyColByTable(STranslateContext* pCxt, STableNode* pTable, SNode** pPrimaryKey) { - SColumnNode* pCol = nodesMakeNode(QUERY_NODE_COLUMN); + SColumnNode* pCol = (SColumnNode*)nodesMakeNode(QUERY_NODE_COLUMN); if (NULL == pCol) { return TSDB_CODE_OUT_OF_MEMORY; } @@ -2120,7 +2118,7 @@ static int32_t translateSelect(STranslateContext* pCxt, SSelectStmt* pSelect) { } static SNode* createSetOperProject(const char* pTableAlias, SNode* pNode) { - SColumnNode* pCol = nodesMakeNode(QUERY_NODE_COLUMN); + SColumnNode* pCol = (SColumnNode*)nodesMakeNode(QUERY_NODE_COLUMN); if (NULL == pCol) { return NULL; } @@ -2132,20 +2130,20 @@ static SNode* createSetOperProject(const char* pTableAlias, SNode* pNode) { } static int32_t createCastFunc(STranslateContext* pCxt, SNode* pExpr, SDataType dt, SNode** pCast) { - SFunctionNode* pFunc = nodesMakeNode(QUERY_NODE_FUNCTION); + SFunctionNode* pFunc = (SFunctionNode*)nodesMakeNode(QUERY_NODE_FUNCTION); if (NULL == pFunc) { return TSDB_CODE_OUT_OF_MEMORY; } strcpy(pFunc->functionName, "cast"); pFunc->node.resType = dt; if (TSDB_CODE_SUCCESS != nodesListMakeAppend(&pFunc->pParameterList, pExpr)) { - nodesDestroyNode(pFunc); + nodesDestroyNode((SNode*)pFunc); return TSDB_CODE_OUT_OF_MEMORY; } if (TSDB_CODE_SUCCESS != getFuncInfo(pCxt, pFunc)) { nodesClearList(pFunc->pParameterList); pFunc->pParameterList = NULL; - nodesDestroyNode(pFunc); + nodesDestroyNode((SNode*)pFunc); return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_WRONG_VALUE_TYPE, ((SExprNode*)pExpr)->aliasName); } *pCast = (SNode*)pFunc; @@ -2449,11 +2447,11 @@ static int32_t checkDbRetentionsOption(STranslateContext* pCxt, SNodeList* pRete static int32_t checkOptionsDependency(STranslateContext* pCxt, const char* pDbName, SDatabaseOptions* pOptions) { int32_t daysPerFile = pOptions->daysPerFile; - int32_t daysToKeep0 = pOptions->keep[0]; + int64_t daysToKeep0 = pOptions->keep[0]; if (-1 == daysPerFile && -1 == daysToKeep0) { return TSDB_CODE_SUCCESS; } else if (-1 == daysPerFile || -1 == daysToKeep0) { - SDbCfgInfo dbCfg; + SDbCfgInfo dbCfg = {0}; int32_t code = getDBCfg(pCxt, pDbName, &dbCfg); if (TSDB_CODE_SUCCESS != code) { return code; @@ -2557,16 +2555,14 @@ static int32_t buildCmdMsg(STranslateContext* pCxt, int16_t msgType, FSerializeF static int32_t translateCreateDatabase(STranslateContext* pCxt, SCreateDatabaseStmt* pStmt) { SCreateDbReq createReq = {0}; - - int32_t code = checkCreateDatabase(pCxt, pStmt); + int32_t code = checkCreateDatabase(pCxt, pStmt); if (TSDB_CODE_SUCCESS == code) { code = buildCreateDbReq(pCxt, pStmt, &createReq); } - if (TSDB_CODE_SUCCESS == code) { code = buildCmdMsg(pCxt, TDMT_MND_CREATE_DB, (FSerializeFunc)tSerializeSCreateDbReq, &createReq); } - + tFreeSCreateDbReq(&createReq); return code; } @@ -2794,15 +2790,15 @@ static int32_t checkTableSchema(STranslateContext* pCxt, SCreateTableStmt* pStmt } static int32_t checkSchemalessDb(STranslateContext* pCxt, const char* pDbName) { -// if (0 != pCxt->pParseCxt->schemalessType) { -// return TSDB_CODE_SUCCESS; -// } -// SDbCfgInfo info = {0}; -// int32_t code = getDBCfg(pCxt, pDbName, &info); -// if (TSDB_CODE_SUCCESS == code) { -// code = info.schemaless ? TSDB_CODE_SML_INVALID_DB_CONF : TSDB_CODE_SUCCESS; -// } -// return code; + // if (0 != pCxt->pParseCxt->schemalessType) { + // return TSDB_CODE_SUCCESS; + // } + // SDbCfgInfo info = {0}; + // int32_t code = getDBCfg(pCxt, pDbName, &info); + // if (TSDB_CODE_SUCCESS == code) { + // code = info.schemaless ? TSDB_CODE_SML_INVALID_DB_CONF : TSDB_CODE_SUCCESS; + // } + // return code; return TSDB_CODE_SUCCESS; } @@ -2850,15 +2846,15 @@ typedef struct SSampleAstInfo { static int32_t buildSampleAst(STranslateContext* pCxt, SSampleAstInfo* pInfo, char** pAst, int32_t* pLen, char** pExpr, int32_t* pExprLen) { - SSelectStmt* pSelect = nodesMakeNode(QUERY_NODE_SELECT_STMT); + SSelectStmt* pSelect = (SSelectStmt*)nodesMakeNode(QUERY_NODE_SELECT_STMT); if (NULL == pSelect) { return TSDB_CODE_OUT_OF_MEMORY; } sprintf(pSelect->stmtName, "%p", pSelect); - SRealTableNode* pTable = nodesMakeNode(QUERY_NODE_REAL_TABLE); + SRealTableNode* pTable = (SRealTableNode*)nodesMakeNode(QUERY_NODE_REAL_TABLE); if (NULL == pTable) { - nodesDestroyNode(pSelect); + nodesDestroyNode((SNode*)pSelect); return TSDB_CODE_OUT_OF_MEMORY; } strcpy(pTable->table.dbName, pInfo->pDbName); @@ -2867,19 +2863,19 @@ static int32_t buildSampleAst(STranslateContext* pCxt, SSampleAstInfo* pInfo, ch pSelect->pFromTable = (SNode*)pTable; TSWAP(pSelect->pProjectionList, pInfo->pFuncs); - SFunctionNode* pFunc = nodesMakeNode(QUERY_NODE_FUNCTION); + SFunctionNode* pFunc = (SFunctionNode*)nodesMakeNode(QUERY_NODE_FUNCTION); if (NULL == pSelect->pProjectionList || NULL == pFunc) { - nodesDestroyNode(pSelect); + nodesDestroyNode((SNode*)pSelect); return TSDB_CODE_OUT_OF_MEMORY; } strcpy(pFunc->functionName, "_wstartts"); - nodesListPushFront(pSelect->pProjectionList, pFunc); + nodesListPushFront(pSelect->pProjectionList, (SNode*)pFunc); SNode* pProject = NULL; FOREACH(pProject, pSelect->pProjectionList) { sprintf(((SExprNode*)pProject)->aliasName, "#%p", pProject); } - SIntervalWindowNode* pInterval = nodesMakeNode(QUERY_NODE_INTERVAL_WINDOW); + SIntervalWindowNode* pInterval = (SIntervalWindowNode*)nodesMakeNode(QUERY_NODE_INTERVAL_WINDOW); if (NULL == pInterval) { - nodesDestroyNode(pSelect); + nodesDestroyNode((SNode*)pSelect); return TSDB_CODE_OUT_OF_MEMORY; } pSelect->pWindow = (SNode*)pInterval; @@ -2888,7 +2884,7 @@ static int32_t buildSampleAst(STranslateContext* pCxt, SSampleAstInfo* pInfo, ch TSWAP(pInterval->pSliding, pInfo->pSliding); pInterval->pCol = nodesMakeNode(QUERY_NODE_COLUMN); if (NULL == pInterval->pCol) { - nodesDestroyNode(pSelect); + nodesDestroyNode((SNode*)pSelect); return TSDB_CODE_OUT_OF_MEMORY; } ((SColumnNode*)pInterval->pCol)->colId = PRIMARYKEY_TIMESTAMP_COL_ID; @@ -2897,12 +2893,12 @@ static int32_t buildSampleAst(STranslateContext* pCxt, SSampleAstInfo* pInfo, ch pCxt->createStream = true; int32_t code = translateQuery(pCxt, (SNode*)pSelect); if (TSDB_CODE_SUCCESS == code) { - code = nodesNodeToString(pSelect, false, pAst, pLen); + code = nodesNodeToString((SNode*)pSelect, false, pAst, pLen); } if (TSDB_CODE_SUCCESS == code && NULL != pExpr) { code = nodesListToString(pSelect->pProjectionList, false, pExpr, pExprLen); } - nodesDestroyNode(pSelect); + nodesDestroyNode((SNode*)pSelect); return code; } @@ -2914,7 +2910,7 @@ static void clearSampleAstInfo(SSampleAstInfo* pInfo) { } static SNode* makeIntervalVal(SRetention* pRetension, int8_t precision) { - SValueNode* pVal = nodesMakeNode(QUERY_NODE_VALUE); + SValueNode* pVal = (SValueNode*)nodesMakeNode(QUERY_NODE_VALUE); if (NULL == pVal) { return NULL; } @@ -2923,7 +2919,7 @@ static SNode* makeIntervalVal(SRetention* pRetension, int8_t precision) { int32_t len = snprintf(buf, sizeof(buf), "%" PRId64 "%c", timeVal, pRetension->freqUnit); pVal->literal = strndup(buf, len); if (NULL == pVal->literal) { - nodesDestroyNode(pVal); + nodesDestroyNode((SNode*)pVal); return NULL; } pVal->isDuration = true; @@ -2934,7 +2930,7 @@ static SNode* makeIntervalVal(SRetention* pRetension, int8_t precision) { } static SNode* createColumnFromDef(SColumnDefNode* pDef) { - SColumnNode* pCol = nodesMakeNode(QUERY_NODE_COLUMN); + SColumnNode* pCol = (SColumnNode*)nodesMakeNode(QUERY_NODE_COLUMN); if (NULL == pCol) { return NULL; } @@ -2943,12 +2939,12 @@ static SNode* createColumnFromDef(SColumnDefNode* pDef) { } static SNode* createRollupFunc(SNode* pSrcFunc, SColumnDefNode* pColDef) { - SFunctionNode* pFunc = nodesCloneNode(pSrcFunc); + SFunctionNode* pFunc = (SFunctionNode*)nodesCloneNode(pSrcFunc); if (NULL == pFunc) { return NULL; } if (TSDB_CODE_SUCCESS != nodesListMakeStrictAppend(&pFunc->pParameterList, createColumnFromDef(pColDef))) { - nodesDestroyNode(pFunc); + nodesDestroyNode((SNode*)pFunc); return NULL; } return (SNode*)pFunc; @@ -3098,7 +3094,7 @@ static int32_t doTranslateDropSuperTable(STranslateContext* pCxt, const SName* p } static int32_t translateDropTable(STranslateContext* pCxt, SDropTableStmt* pStmt) { - SDropTableClause* pClause = nodesListGetNode(pStmt->pTables, 0); + SDropTableClause* pClause = (SDropTableClause*)nodesListGetNode(pStmt->pTables, 0); SName tableName; return doTranslateDropSuperTable( pCxt, toName(pCxt->pParseCxt->acctId, pClause->dbName, pClause->tableName, &tableName), pClause->ignoreNotExists); @@ -3170,6 +3166,7 @@ static int32_t translateAlterTable(STranslateContext* pCxt, SAlterTableStmt* pSt if (TSDB_CODE_SUCCESS == code) { code = buildCmdMsg(pCxt, TDMT_MND_ALTER_STB, (FSerializeFunc)tSerializeSMAlterStbReq, &alterReq); } + tFreeSMAltertbReq(&alterReq); return code; } @@ -3576,6 +3573,16 @@ static int32_t translateKillTransaction(STranslateContext* pCxt, SKillStmt* pStm } static int32_t checkCreateStream(STranslateContext* pCxt, SCreateStreamStmt* pStmt) { + if (NULL != pStmt->pOptions->pWatermark && + (DEAL_RES_ERROR == translateValue(pCxt, (SValueNode*)pStmt->pOptions->pWatermark))) { + return pCxt->errCode; + } + + if (NULL != pStmt->pOptions->pDelay && + (DEAL_RES_ERROR == translateValue(pCxt, (SValueNode*)pStmt->pOptions->pDelay))) { + return pCxt->errCode; + } + if (NULL == pStmt->pQuery) { return TSDB_CODE_SUCCESS; } @@ -3623,12 +3630,9 @@ static int32_t buildCreateStreamReq(STranslateContext* pCxt, SCreateStreamStmt* } } - if (TSDB_CODE_SUCCESS == code && NULL != pStmt->pOptions->pWatermark) { - code = (DEAL_RES_ERROR == translateValue(pCxt, (SValueNode*)pStmt->pOptions->pWatermark)) ? pCxt->errCode - : TSDB_CODE_SUCCESS; - } if (TSDB_CODE_SUCCESS == code) { pReq->triggerType = pStmt->pOptions->triggerType; + pReq->maxDelay = (NULL != pStmt->pOptions->pDelay ? ((SValueNode*)pStmt->pOptions->pDelay)->datum.i : 0); pReq->watermark = (NULL != pStmt->pOptions->pWatermark ? ((SValueNode*)pStmt->pOptions->pWatermark)->datum.i : 0); } @@ -4116,15 +4120,15 @@ static const char* getSysTableName(ENodeType type) { } static int32_t createSelectStmtForShow(ENodeType showType, SSelectStmt** pStmt) { - SSelectStmt* pSelect = nodesMakeNode(QUERY_NODE_SELECT_STMT); + SSelectStmt* pSelect = (SSelectStmt*)nodesMakeNode(QUERY_NODE_SELECT_STMT); if (NULL == pSelect) { return TSDB_CODE_OUT_OF_MEMORY; } sprintf(pSelect->stmtName, "%p", pSelect); - SRealTableNode* pTable = nodesMakeNode(QUERY_NODE_REAL_TABLE); + SRealTableNode* pTable = (SRealTableNode*)nodesMakeNode(QUERY_NODE_REAL_TABLE); if (NULL == pTable) { - nodesDestroyNode(pSelect); + nodesDestroyNode((SNode*)pSelect); return TSDB_CODE_OUT_OF_MEMORY; } strcpy(pTable->table.dbName, getSysDbName(showType)); @@ -4142,7 +4146,7 @@ static int32_t createOperatorNode(EOperatorType opType, const char* pColName, SN return TSDB_CODE_SUCCESS; } - SOperatorNode* pOper = nodesMakeNode(QUERY_NODE_OPERATOR); + SOperatorNode* pOper = (SOperatorNode*)nodesMakeNode(QUERY_NODE_OPERATOR); if (NULL == pOper) { return TSDB_CODE_OUT_OF_MEMORY; } @@ -4151,7 +4155,7 @@ static int32_t createOperatorNode(EOperatorType opType, const char* pColName, SN pOper->pLeft = nodesMakeNode(QUERY_NODE_COLUMN); pOper->pRight = nodesCloneNode(pRight); if (NULL == pOper->pLeft || NULL == pOper->pRight) { - nodesDestroyNode(pOper); + nodesDestroyNode((SNode*)pOper); return TSDB_CODE_OUT_OF_MEMORY; } strcpy(((SColumnNode*)pOper->pLeft)->colName, pColName); @@ -4165,19 +4169,19 @@ static const char* getTbNameColName(ENodeType type) { } static int32_t createLogicCondNode(SNode* pCond1, SNode* pCond2, SNode** pCond) { - SLogicConditionNode* pCondition = nodesMakeNode(QUERY_NODE_LOGIC_CONDITION); + SLogicConditionNode* pCondition = (SLogicConditionNode*)nodesMakeNode(QUERY_NODE_LOGIC_CONDITION); if (NULL == pCondition) { return TSDB_CODE_OUT_OF_MEMORY; } pCondition->condType = LOGIC_COND_TYPE_AND; pCondition->pParameterList = nodesMakeList(); if (NULL == pCondition->pParameterList) { - nodesDestroyNode(pCondition); + nodesDestroyNode((SNode*)pCondition); return TSDB_CODE_OUT_OF_MEMORY; } if (TSDB_CODE_SUCCESS != nodesListAppend(pCondition->pParameterList, pCond1) || TSDB_CODE_SUCCESS != nodesListAppend(pCondition->pParameterList, pCond2)) { - nodesDestroyNode(pCondition); + nodesDestroyNode((SNode*)pCondition); return TSDB_CODE_OUT_OF_MEMORY; } @@ -4325,7 +4329,7 @@ static void destroyCreateTbReqBatch(SVgroupCreateTableBatch* pTbBatch) { } static int32_t rewriteToVnodeModifyOpStmt(SQuery* pQuery, SArray* pBufArray) { - SVnodeModifOpStmt* pNewStmt = nodesMakeNode(QUERY_NODE_VNODE_MODIF_STMT); + SVnodeModifOpStmt* pNewStmt = (SVnodeModifOpStmt*)nodesMakeNode(QUERY_NODE_VNODE_MODIF_STMT); if (pNewStmt == NULL) { return TSDB_CODE_OUT_OF_MEMORY; } @@ -5078,29 +5082,18 @@ static int32_t buildModifyVnodeArray(STranslateContext* pCxt, SAlterTableStmt* p return code; } -static int32_t rewriteAlterTable(STranslateContext* pCxt, SQuery* pQuery) { - SAlterTableStmt* pStmt = (SAlterTableStmt*)pQuery->pRoot; - int32_t code = checkSchemalessDb(pCxt, pStmt->dbName); - if (TSDB_CODE_SUCCESS != code) { - return code; - } - STableMeta* pTableMeta = NULL; - code = getTableMeta(pCxt, pStmt->dbName, pStmt->tableName, &pTableMeta); - if (TSDB_CODE_SUCCESS != code) { - return code; - } - - if (pStmt->dataType.type == TSDB_DATA_TYPE_JSON && pStmt->alterType == TSDB_ALTER_TABLE_ADD_TAG) { - return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_ONLY_ONE_JSON_TAG); - } - - if (pStmt->dataType.type == TSDB_DATA_TYPE_JSON && pStmt->alterType == TSDB_ALTER_TABLE_ADD_COLUMN) { - return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_COL_JSON); - } +static void destoryAlterTbReq(SVAlterTbReq* pReq) { + taosMemoryFree(pReq->tbName); + taosMemoryFree(pReq->colName); + taosMemoryFree(pReq->colNewName); + taosMemoryFree(pReq->tagName); + taosMemoryFree(pReq->newComment); +} +static int32_t rewriteAlterTableImpl(STranslateContext* pCxt, SAlterTableStmt* pStmt, STableMeta* pTableMeta, + SQuery* pQuery) { if (getNumOfTags(pTableMeta) == 1 && pStmt->alterType == TSDB_ALTER_TABLE_DROP_TAG) { - return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_ALTER_TABLE, - "can not drop tag if there is only one tag"); + return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_ALTER_TABLE); } if (TSDB_SUPER_TABLE == pTableMeta->tableType) { @@ -5116,7 +5109,7 @@ static int32_t rewriteAlterTable(STranslateContext* pCxt, SQuery* pQuery) { } SVAlterTbReq req = {0}; - code = buildAlterTbReq(pCxt, pStmt, pTableMeta, &req); + int32_t code = buildAlterTbReq(pCxt, pStmt, pTableMeta, &req); SArray* pArray = NULL; if (TSDB_CODE_SUCCESS == code) { @@ -5125,7 +5118,27 @@ static int32_t rewriteAlterTable(STranslateContext* pCxt, SQuery* pQuery) { if (TSDB_CODE_SUCCESS == code) { code = rewriteToVnodeModifyOpStmt(pQuery, pArray); } + destoryAlterTbReq(&req); + return code; +} +static int32_t rewriteAlterTable(STranslateContext* pCxt, SQuery* pQuery) { + SAlterTableStmt* pStmt = (SAlterTableStmt*)pQuery->pRoot; + + if (pStmt->dataType.type == TSDB_DATA_TYPE_JSON && pStmt->alterType == TSDB_ALTER_TABLE_ADD_TAG) { + return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_ONLY_ONE_JSON_TAG); + } + + if (pStmt->dataType.type == TSDB_DATA_TYPE_JSON && pStmt->alterType == TSDB_ALTER_TABLE_ADD_COLUMN) { + return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_COL_JSON); + } + + STableMeta* pTableMeta = NULL; + int32_t code = getTableMeta(pCxt, pStmt->dbName, pStmt->tableName, &pTableMeta); + if (TSDB_CODE_SUCCESS == code) { + code = rewriteAlterTableImpl(pCxt, pStmt, pTableMeta, pQuery); + } + taosMemoryFree(pTableMeta); return code; } @@ -5261,10 +5274,10 @@ static int32_t setQuery(STranslateContext* pCxt, SQuery* pQuery) { return TSDB_CODE_SUCCESS; } -int32_t translate(SParseContext* pParseCxt, SQuery* pQuery) { +int32_t translate(SParseContext* pParseCxt, SQuery* pQuery, SParseMetaCache* pMetaCache) { STranslateContext cxt = {0}; - int32_t code = initTranslateContext(pParseCxt, pQuery->pMetaCache, &cxt); + int32_t code = initTranslateContext(pParseCxt, pMetaCache, &cxt); if (TSDB_CODE_SUCCESS == code) { code = rewriteQuery(&cxt, pQuery); } diff --git a/source/libs/parser/src/parUtil.c b/source/libs/parser/src/parUtil.c index 716b120af5..c3ff4c63a4 100644 --- a/source/libs/parser/src/parUtil.c +++ b/source/libs/parser/src/parUtil.c @@ -19,6 +19,8 @@ #define USER_AUTH_KEY_MAX_LEN TSDB_USER_LEN + TSDB_DB_FNAME_LEN + 2 +const void* nullPointer = NULL; + static char* getSyntaxErrFormat(int32_t errCode) { switch (errCode) { case TSDB_CODE_PAR_SYNTAX_ERROR: @@ -550,9 +552,15 @@ int32_t buildCatalogReq(const SParseMetaCache* pMetaCache, SCatalogReq* pCatalog return code; } -static int32_t putMetaDataToHash(const char* pKey, int32_t len, const SArray* pData, int32_t index, SHashObj* pHash) { +static int32_t putMetaDataToHash(const char* pKey, int32_t len, const SArray* pData, int32_t index, SHashObj** pHash) { + if (NULL == *pHash) { + *pHash = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_NO_LOCK); + if (NULL == *pHash) { + return TSDB_CODE_OUT_OF_MEMORY; + } + } SMetaRes* pRes = taosArrayGet(pData, index); - return taosHashPut(pHash, pKey, len, &pRes, POINTER_BYTES); + return taosHashPut(*pHash, pKey, len, &pRes, POINTER_BYTES); } static int32_t getMetaDataFromHash(const char* pKey, int32_t len, SHashObj* pHash, void** pOutput) { @@ -566,7 +574,7 @@ static int32_t getMetaDataFromHash(const char* pKey, int32_t len, SHashObj* pHas return (*pRes)->code; } -static int32_t putTableDataToCache(const SArray* pTableReq, const SArray* pTableData, SHashObj* pTable) { +static int32_t putTableDataToCache(const SArray* pTableReq, const SArray* pTableData, SHashObj** pTable) { int32_t ntables = taosArrayGetSize(pTableReq); for (int32_t i = 0; i < ntables; ++i) { char fullName[TSDB_TABLE_FNAME_LEN]; @@ -578,7 +586,7 @@ static int32_t putTableDataToCache(const SArray* pTableReq, const SArray* pTable return TSDB_CODE_SUCCESS; } -static int32_t putDbDataToCache(const SArray* pDbReq, const SArray* pDbData, SHashObj* pDb) { +static int32_t putDbDataToCache(const SArray* pDbReq, const SArray* pDbData, SHashObj** pDb) { int32_t nvgs = taosArrayGetSize(pDbReq); for (int32_t i = 0; i < nvgs; ++i) { char* pDbFName = taosArrayGet(pDbReq, i); @@ -589,7 +597,7 @@ static int32_t putDbDataToCache(const SArray* pDbReq, const SArray* pDbData, SHa return TSDB_CODE_SUCCESS; } -static int32_t putUserAuthToCache(const SArray* pUserAuthReq, const SArray* pUserAuthData, SHashObj* pUserAuth) { +static int32_t putUserAuthToCache(const SArray* pUserAuthReq, const SArray* pUserAuthData, SHashObj** pUserAuth) { int32_t nvgs = taosArrayGetSize(pUserAuthReq); for (int32_t i = 0; i < nvgs; ++i) { SUserAuthInfo* pUser = taosArrayGet(pUserAuthReq, i); @@ -602,7 +610,7 @@ static int32_t putUserAuthToCache(const SArray* pUserAuthReq, const SArray* pUse return TSDB_CODE_SUCCESS; } -static int32_t putUdfToCache(const SArray* pUdfReq, const SArray* pUdfData, SHashObj* pUdf) { +static int32_t putUdfToCache(const SArray* pUdfReq, const SArray* pUdfData, SHashObj** pUdf) { int32_t num = taosArrayGetSize(pUdfReq); for (int32_t i = 0; i < num; ++i) { char* pFunc = taosArrayGet(pUdfReq, i); @@ -614,27 +622,27 @@ static int32_t putUdfToCache(const SArray* pUdfReq, const SArray* pUdfData, SHas } int32_t putMetaDataToCache(const SCatalogReq* pCatalogReq, const SMetaData* pMetaData, SParseMetaCache* pMetaCache) { - int32_t code = putTableDataToCache(pCatalogReq->pTableMeta, pMetaData->pTableMeta, pMetaCache->pTableMeta); + int32_t code = putTableDataToCache(pCatalogReq->pTableMeta, pMetaData->pTableMeta, &pMetaCache->pTableMeta); if (TSDB_CODE_SUCCESS == code) { - code = putDbDataToCache(pCatalogReq->pDbVgroup, pMetaData->pDbVgroup, pMetaCache->pDbVgroup); + code = putDbDataToCache(pCatalogReq->pDbVgroup, pMetaData->pDbVgroup, &pMetaCache->pDbVgroup); } if (TSDB_CODE_SUCCESS == code) { - code = putTableDataToCache(pCatalogReq->pTableHash, pMetaData->pTableHash, pMetaCache->pTableVgroup); + code = putTableDataToCache(pCatalogReq->pTableHash, pMetaData->pTableHash, &pMetaCache->pTableVgroup); } if (TSDB_CODE_SUCCESS == code) { - code = putDbDataToCache(pCatalogReq->pDbCfg, pMetaData->pDbCfg, pMetaCache->pDbCfg); + code = putDbDataToCache(pCatalogReq->pDbCfg, pMetaData->pDbCfg, &pMetaCache->pDbCfg); } if (TSDB_CODE_SUCCESS == code) { - code = putDbDataToCache(pCatalogReq->pDbInfo, pMetaData->pDbInfo, pMetaCache->pDbInfo); + code = putDbDataToCache(pCatalogReq->pDbInfo, pMetaData->pDbInfo, &pMetaCache->pDbInfo); } if (TSDB_CODE_SUCCESS == code) { - code = putUserAuthToCache(pCatalogReq->pUser, pMetaData->pUser, pMetaCache->pUserAuth); + code = putUserAuthToCache(pCatalogReq->pUser, pMetaData->pUser, &pMetaCache->pUserAuth); } if (TSDB_CODE_SUCCESS == code) { - code = putUdfToCache(pCatalogReq->pUdf, pMetaData->pUdfList, pMetaCache->pUdf); + code = putUdfToCache(pCatalogReq->pUdf, pMetaData->pUdfList, &pMetaCache->pUdf); } if (TSDB_CODE_SUCCESS == code) { - code = putTableDataToCache(pCatalogReq->pTableIndex, pMetaData->pTableIndex, pMetaCache->pTableIndex); + code = putTableDataToCache(pCatalogReq->pTableIndex, pMetaData->pTableIndex, &pMetaCache->pTableIndex); } return code; } @@ -646,7 +654,7 @@ static int32_t reserveTableReqInCacheImpl(const char* pTbFName, int32_t len, SHa return TSDB_CODE_OUT_OF_MEMORY; } } - return taosHashPut(*pTables, pTbFName, len, &pTables, POINTER_BYTES); + return taosHashPut(*pTables, pTbFName, len, &nullPointer, POINTER_BYTES); } static int32_t reserveTableReqInCache(int32_t acctId, const char* pDb, const char* pTable, SHashObj** pTables) { @@ -688,7 +696,7 @@ static int32_t reserveDbReqInCache(int32_t acctId, const char* pDb, SHashObj** p } char fullName[TSDB_TABLE_FNAME_LEN]; int32_t len = snprintf(fullName, sizeof(fullName), "%d.%s", acctId, pDb); - return taosHashPut(*pDbs, fullName, len, &pDbs, POINTER_BYTES); + return taosHashPut(*pDbs, fullName, len, &nullPointer, POINTER_BYTES); } int32_t reserveDbVgInfoInCache(int32_t acctId, const char* pDb, SParseMetaCache* pMetaCache) { @@ -803,7 +811,7 @@ int32_t reserveUdfInCache(const char* pFunc, SParseMetaCache* pMetaCache) { return TSDB_CODE_OUT_OF_MEMORY; } } - return taosHashPut(pMetaCache->pUdf, pFunc, strlen(pFunc), &pMetaCache, POINTER_BYTES); + return taosHashPut(pMetaCache->pUdf, pFunc, strlen(pFunc), &nullPointer, POINTER_BYTES); } int32_t getUdfInfoFromCache(SParseMetaCache* pMetaCache, const char* pFunc, SFuncInfo* pInfo) { @@ -854,3 +862,14 @@ int32_t getTableIndexFromCache(SParseMetaCache* pMetaCache, const SName* pName, } return code; } + +void destoryParseMetaCache(SParseMetaCache* pMetaCache) { + taosHashCleanup(pMetaCache->pTableMeta); + taosHashCleanup(pMetaCache->pDbVgroup); + taosHashCleanup(pMetaCache->pTableVgroup); + taosHashCleanup(pMetaCache->pDbCfg); + taosHashCleanup(pMetaCache->pDbInfo); + taosHashCleanup(pMetaCache->pUserAuth); + taosHashCleanup(pMetaCache->pUdf); + taosHashCleanup(pMetaCache->pTableIndex); +} diff --git a/source/libs/parser/src/parser.c b/source/libs/parser/src/parser.c index edb0d79f02..7c330158fa 100644 --- a/source/libs/parser/src/parser.c +++ b/source/libs/parser/src/parser.c @@ -34,8 +34,8 @@ bool qIsInsertSql(const char* pStr, size_t length) { } while (1); } -static int32_t analyseSemantic(SParseContext* pCxt, SQuery* pQuery) { - int32_t code = authenticate(pCxt, pQuery); +static int32_t analyseSemantic(SParseContext* pCxt, SQuery* pQuery, SParseMetaCache* pMetaCache) { + int32_t code = authenticate(pCxt, pQuery, pMetaCache); if (TSDB_CODE_SUCCESS == code && pQuery->placeholderNum > 0) { TSWAP(pQuery->pPrepareRoot, pQuery->pRoot); @@ -43,7 +43,7 @@ static int32_t analyseSemantic(SParseContext* pCxt, SQuery* pQuery) { } if (TSDB_CODE_SUCCESS == code) { - code = translate(pCxt, pQuery); + code = translate(pCxt, pQuery, pMetaCache); } if (TSDB_CODE_SUCCESS == code) { code = calculateConstant(pCxt, pQuery); @@ -54,15 +54,15 @@ static int32_t analyseSemantic(SParseContext* pCxt, SQuery* pQuery) { static int32_t parseSqlIntoAst(SParseContext* pCxt, SQuery** pQuery) { int32_t code = parse(pCxt, pQuery); if (TSDB_CODE_SUCCESS == code) { - code = analyseSemantic(pCxt, *pQuery); + code = analyseSemantic(pCxt, *pQuery, NULL); } return code; } -static int32_t parseSqlSyntax(SParseContext* pCxt, SQuery** pQuery) { +static int32_t parseSqlSyntax(SParseContext* pCxt, SQuery** pQuery, SParseMetaCache* pMetaCache) { int32_t code = parse(pCxt, pQuery); if (TSDB_CODE_SUCCESS == code) { - code = collectMetaKey(pCxt, *pQuery); + code = collectMetaKey(pCxt, *pQuery, pMetaCache); } return code; } @@ -149,7 +149,7 @@ static void rewriteExprAlias(SNode* pRoot) { int32_t qParseSql(SParseContext* pCxt, SQuery** pQuery) { int32_t code = TSDB_CODE_SUCCESS; if (qIsInsertSql(pCxt->pSql, pCxt->sqlLen)) { - code = parseInsertSql(pCxt, pQuery); + code = parseInsertSql(pCxt, pQuery, NULL); } else { code = parseSqlIntoAst(pCxt, pQuery); } @@ -158,29 +158,38 @@ int32_t qParseSql(SParseContext* pCxt, SQuery** pQuery) { } int32_t qParseSqlSyntax(SParseContext* pCxt, SQuery** pQuery, struct SCatalogReq* pCatalogReq) { - int32_t code = TSDB_CODE_SUCCESS; + SParseMetaCache metaCache = {0}; + int32_t code = TSDB_CODE_SUCCESS; if (qIsInsertSql(pCxt->pSql, pCxt->sqlLen)) { - code = parseInsertSyntax(pCxt, pQuery); + code = parseInsertSyntax(pCxt, pQuery, &metaCache); } else { - code = parseSqlSyntax(pCxt, pQuery); + code = parseSqlSyntax(pCxt, pQuery, &metaCache); } if (TSDB_CODE_SUCCESS == code) { - code = buildCatalogReq((*pQuery)->pMetaCache, pCatalogReq); + code = buildCatalogReq(&metaCache, pCatalogReq); } + destoryParseMetaCache(&metaCache); terrno = code; return code; } int32_t qAnalyseSqlSemantic(SParseContext* pCxt, const struct SCatalogReq* pCatalogReq, const struct SMetaData* pMetaData, SQuery* pQuery) { - int32_t code = putMetaDataToCache(pCatalogReq, pMetaData, pQuery->pMetaCache); - if (NULL == pQuery->pRoot) { - return parseInsertSql(pCxt, &pQuery); + SParseMetaCache metaCache = {0}; + int32_t code = putMetaDataToCache(pCatalogReq, pMetaData, &metaCache); + if (TSDB_CODE_SUCCESS == code) { + if (NULL == pQuery->pRoot) { + code = parseInsertSql(pCxt, &pQuery, &metaCache); + } else { + code = analyseSemantic(pCxt, pQuery, &metaCache); + } } - return analyseSemantic(pCxt, pQuery); + destoryParseMetaCache(&metaCache); + terrno = code; + return code; } -void qDestroyQuery(SQuery* pQueryNode) { nodesDestroyNode(pQueryNode); } +void qDestroyQuery(SQuery* pQueryNode) { nodesDestroyNode((SNode*)pQueryNode); } int32_t qExtractResultSchema(const SNode* pRoot, int32_t* numOfCols, SSchema** pSchema) { return extractResultSchema(pRoot, numOfCols, pSchema); @@ -226,10 +235,9 @@ int32_t qStmtBindParams(SQuery* pQuery, TAOS_MULTI_BIND* pParams, int32_t colIdx } int32_t qStmtParseQuerySql(SParseContext* pCxt, SQuery* pQuery) { - int32_t code = translate(pCxt, pQuery); + int32_t code = translate(pCxt, pQuery, NULL); if (TSDB_CODE_SUCCESS == code) { code = calculateConstant(pCxt, pQuery); } - return code; } diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index 6fbee8cb11..b2de892f30 100644 --- a/source/libs/parser/src/sql.c +++ b/source/libs/parser/src/sql.c @@ -104,25 +104,25 @@ #endif /************* Begin control #defines *****************************************/ #define YYCODETYPE unsigned short int -#define YYNOCODE 359 +#define YYNOCODE 360 #define YYACTIONTYPE unsigned short int #define ParseTOKENTYPE SToken typedef union { int yyinit; ParseTOKENTYPE yy0; - EOperatorType yy28; - int32_t yy42; - ENullOrder yy107; - EFillMode yy320; - SToken yy421; - SNodeList* yy530; - SAlterOption yy557; - EOrder yy610; - bool yy621; - EJoinType yy636; - int64_t yy669; - SNode* yy674; - SDataType yy690; + EFillMode yy54; + int32_t yy100; + bool yy137; + int64_t yy189; + SToken yy209; + ENullOrder yy217; + SDataType yy304; + EOperatorType yy380; + SNodeList* yy424; + EOrder yy578; + SAlterOption yy605; + EJoinType yy612; + SNode* yy632; } YYMINORTYPE; #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 @@ -138,17 +138,17 @@ typedef union { #define ParseCTX_FETCH #define ParseCTX_STORE #define YYFALLBACK 1 -#define YYNSTATE 618 -#define YYNRULE 453 -#define YYNTOKEN 239 -#define YY_MAX_SHIFT 617 -#define YY_MIN_SHIFTREDUCE 904 -#define YY_MAX_SHIFTREDUCE 1356 -#define YY_ERROR_ACTION 1357 -#define YY_ACCEPT_ACTION 1358 -#define YY_NO_ACTION 1359 -#define YY_MIN_REDUCE 1360 -#define YY_MAX_REDUCE 1812 +#define YYNSTATE 619 +#define YYNRULE 454 +#define YYNTOKEN 240 +#define YY_MAX_SHIFT 618 +#define YY_MIN_SHIFTREDUCE 906 +#define YY_MAX_SHIFTREDUCE 1359 +#define YY_ERROR_ACTION 1360 +#define YY_ACCEPT_ACTION 1361 +#define YY_NO_ACTION 1362 +#define YY_MIN_REDUCE 1363 +#define YY_MAX_REDUCE 1816 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -215,602 +215,607 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (2144) +#define YY_ACTTAB_COUNT (2152) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 28, 230, 1659, 1646, 610, 609, 296, 1646, 357, 1482, - /* 10 */ 313, 1480, 35, 33, 351, 36, 34, 32, 31, 30, - /* 20 */ 305, 24, 1170, 1643, 532, 441, 440, 1643, 79, 1643, - /* 30 */ 1675, 36, 34, 32, 31, 30, 152, 492, 516, 1639, - /* 40 */ 1645, 115, 277, 1639, 1645, 1639, 1645, 1168, 515, 1483, - /* 50 */ 535, 532, 1629, 1491, 535, 1790, 535, 496, 14, 1742, - /* 60 */ 35, 33, 1297, 355, 1176, 1659, 114, 147, 305, 1688, - /* 70 */ 1170, 1787, 82, 1660, 518, 1662, 1663, 514, 500, 535, - /* 80 */ 1491, 1, 1728, 1739, 1790, 1311, 278, 1724, 36, 34, - /* 90 */ 32, 31, 30, 1675, 531, 1168, 1789, 1647, 1790, 519, - /* 100 */ 1787, 516, 308, 614, 112, 1580, 14, 409, 35, 33, - /* 110 */ 149, 515, 1176, 1169, 1787, 1629, 305, 1643, 1170, 145, - /* 120 */ 1735, 1736, 1194, 1740, 36, 34, 32, 31, 30, 2, - /* 130 */ 381, 63, 1688, 1639, 1645, 84, 1660, 518, 1662, 1663, - /* 140 */ 514, 1361, 535, 1168, 535, 1728, 531, 1790, 56, 1727, - /* 150 */ 1724, 614, 142, 1487, 14, 391, 1171, 392, 1392, 148, - /* 160 */ 1176, 1169, 96, 1787, 1529, 95, 94, 93, 92, 91, - /* 170 */ 90, 89, 88, 87, 161, 160, 132, 2, 1372, 566, - /* 180 */ 1174, 1175, 934, 1221, 1222, 1224, 1225, 1226, 1227, 1228, - /* 190 */ 511, 533, 1236, 1237, 1238, 1239, 1240, 1241, 565, 614, - /* 200 */ 564, 563, 562, 399, 1171, 392, 1392, 38, 96, 1169, - /* 210 */ 150, 95, 94, 93, 92, 91, 90, 89, 88, 87, - /* 220 */ 938, 939, 65, 294, 1353, 55, 194, 1617, 1174, 1175, - /* 230 */ 1360, 1221, 1222, 1224, 1225, 1226, 1227, 1228, 511, 533, - /* 240 */ 1236, 1237, 1238, 1239, 1240, 1241, 36, 34, 32, 31, - /* 250 */ 30, 531, 1171, 1358, 105, 104, 103, 102, 101, 100, - /* 260 */ 99, 98, 97, 1469, 501, 35, 33, 36, 34, 32, - /* 270 */ 31, 30, 330, 305, 55, 1170, 1174, 1175, 342, 1221, - /* 280 */ 1222, 1224, 1225, 1226, 1227, 1228, 511, 533, 1236, 1237, - /* 290 */ 1238, 1239, 1240, 1241, 468, 532, 444, 443, 344, 340, - /* 300 */ 1168, 442, 486, 1659, 111, 439, 1352, 356, 438, 437, - /* 310 */ 436, 321, 39, 35, 33, 1242, 26, 1176, 133, 63, - /* 320 */ 409, 305, 1448, 1170, 1491, 72, 36, 34, 32, 31, - /* 330 */ 30, 1675, 110, 508, 8, 1790, 150, 1208, 1535, 516, - /* 340 */ 288, 1486, 55, 492, 458, 295, 1484, 147, 1168, 515, - /* 350 */ 1533, 1787, 1790, 1629, 150, 951, 614, 950, 496, 481, - /* 360 */ 1261, 35, 33, 1468, 147, 1176, 1169, 200, 1787, 305, - /* 370 */ 1688, 1170, 114, 82, 1660, 518, 1662, 1663, 514, 129, - /* 380 */ 535, 1266, 9, 1728, 952, 1790, 568, 278, 1724, 289, - /* 390 */ 1196, 287, 286, 55, 432, 66, 1168, 147, 434, 1790, - /* 400 */ 1422, 1787, 78, 150, 614, 1790, 32, 31, 30, 1171, - /* 410 */ 112, 147, 74, 1176, 1169, 1787, 350, 1788, 349, 25, - /* 420 */ 433, 1787, 396, 1467, 494, 144, 1735, 1736, 1192, 1740, - /* 430 */ 9, 487, 482, 1174, 1175, 583, 1221, 1222, 1224, 1225, - /* 440 */ 1226, 1227, 1228, 511, 533, 1236, 1237, 1238, 1239, 1240, - /* 450 */ 1241, 317, 614, 1003, 532, 1251, 566, 1171, 1571, 1573, - /* 460 */ 444, 443, 1169, 150, 1466, 442, 366, 1321, 111, 439, - /* 470 */ 1005, 150, 438, 437, 436, 565, 345, 564, 563, 562, - /* 480 */ 568, 1174, 1175, 1491, 1221, 1222, 1224, 1225, 1226, 1227, - /* 490 */ 1228, 511, 533, 1236, 1237, 1238, 1239, 1240, 1241, 157, - /* 500 */ 11, 10, 1195, 1675, 309, 1171, 478, 1319, 1320, 1322, - /* 510 */ 1323, 485, 130, 1535, 1383, 221, 584, 582, 35, 33, - /* 520 */ 310, 1493, 150, 1382, 61, 1533, 305, 60, 1170, 1174, - /* 530 */ 1175, 1193, 1221, 1222, 1224, 1225, 1226, 1227, 1228, 511, - /* 540 */ 533, 1236, 1237, 1238, 1239, 1240, 1241, 484, 390, 1572, - /* 550 */ 1573, 394, 1304, 1168, 1535, 532, 532, 566, 1194, 532, - /* 560 */ 276, 316, 1192, 1419, 1629, 975, 1533, 106, 106, 374, - /* 570 */ 1176, 367, 386, 1629, 430, 435, 565, 519, 564, 563, - /* 580 */ 562, 1273, 976, 1581, 1491, 1491, 532, 2, 1491, 131, - /* 590 */ 387, 532, 532, 532, 258, 1247, 1381, 1380, 408, 1379, - /* 600 */ 315, 1194, 1535, 1607, 1488, 466, 256, 53, 130, 614, - /* 610 */ 52, 1378, 561, 398, 1534, 1491, 394, 1493, 950, 1169, - /* 620 */ 1491, 1491, 1491, 590, 589, 588, 320, 162, 587, 586, - /* 630 */ 585, 116, 580, 579, 578, 577, 576, 575, 574, 573, - /* 640 */ 123, 569, 318, 428, 1568, 130, 1629, 1629, 1197, 1629, - /* 650 */ 130, 159, 55, 252, 1494, 572, 1521, 1463, 7, 1493, - /* 660 */ 385, 1629, 1171, 380, 379, 378, 377, 376, 373, 372, - /* 670 */ 371, 370, 369, 365, 364, 363, 362, 361, 360, 359, - /* 680 */ 358, 1377, 1376, 54, 492, 503, 1174, 1175, 81, 1221, - /* 690 */ 1222, 1224, 1225, 1226, 1227, 1228, 511, 533, 1236, 1237, - /* 700 */ 1238, 1239, 1240, 1241, 532, 1375, 36, 34, 32, 31, - /* 710 */ 30, 532, 1374, 114, 532, 1194, 529, 938, 939, 59, - /* 720 */ 58, 354, 1223, 530, 156, 1659, 243, 532, 1371, 348, - /* 730 */ 1296, 1629, 1629, 1491, 36, 34, 32, 31, 30, 319, - /* 740 */ 1491, 275, 185, 1491, 338, 183, 336, 332, 328, 153, - /* 750 */ 323, 112, 279, 1675, 1370, 1629, 1491, 1369, 1476, 1742, - /* 760 */ 571, 495, 1629, 1742, 1368, 1223, 146, 1735, 1736, 1367, - /* 770 */ 1740, 515, 1366, 206, 1478, 1629, 1208, 1365, 1629, 1409, - /* 780 */ 279, 150, 1364, 1738, 1259, 1659, 1363, 1737, 1747, 1292, - /* 790 */ 1474, 187, 1688, 434, 186, 83, 1660, 518, 1662, 1663, - /* 800 */ 514, 445, 535, 189, 1629, 1728, 188, 1629, 197, 298, - /* 810 */ 1724, 143, 1259, 1675, 1629, 433, 1404, 191, 1402, 1629, - /* 820 */ 190, 495, 1629, 222, 456, 1153, 1154, 1629, 474, 1755, - /* 830 */ 1292, 515, 1629, 1260, 449, 1629, 1629, 454, 447, 1649, - /* 840 */ 450, 510, 120, 46, 560, 209, 37, 11, 10, 457, - /* 850 */ 1355, 1356, 1688, 465, 1265, 83, 1660, 518, 1662, 1663, - /* 860 */ 514, 1260, 535, 193, 1179, 1728, 37, 37, 232, 298, - /* 870 */ 1724, 143, 1373, 504, 118, 452, 1651, 1170, 1178, 1223, - /* 880 */ 446, 1449, 1265, 470, 1318, 192, 211, 1267, 225, 1756, - /* 890 */ 459, 119, 27, 303, 1254, 1255, 1256, 1257, 1258, 1262, - /* 900 */ 1263, 1264, 1168, 1659, 120, 498, 46, 1229, 1126, 234, - /* 910 */ 51, 540, 479, 50, 216, 524, 119, 1676, 120, 1176, - /* 920 */ 27, 303, 1254, 1255, 1256, 1257, 1258, 1262, 1263, 1264, - /* 930 */ 1182, 1675, 240, 1393, 427, 1659, 1758, 1295, 121, 516, - /* 940 */ 1530, 119, 493, 224, 1181, 1034, 227, 251, 229, 515, - /* 950 */ 3, 5, 1062, 1629, 1192, 322, 325, 1066, 614, 1072, - /* 960 */ 329, 1003, 284, 1675, 285, 1137, 248, 1659, 1169, 368, - /* 970 */ 1688, 516, 1570, 83, 1660, 518, 1662, 1663, 514, 1070, - /* 980 */ 535, 515, 122, 1728, 158, 1629, 383, 298, 1724, 1803, - /* 990 */ 375, 388, 1198, 382, 384, 1675, 389, 397, 1762, 1201, - /* 1000 */ 400, 165, 1688, 516, 401, 83, 1660, 518, 1662, 1663, - /* 1010 */ 514, 1171, 535, 515, 167, 1728, 1200, 1629, 1659, 298, - /* 1020 */ 1724, 1803, 1202, 402, 170, 405, 403, 172, 406, 1199, - /* 1030 */ 1785, 175, 407, 410, 1688, 1174, 1175, 83, 1660, 518, - /* 1040 */ 1662, 1663, 514, 62, 535, 178, 1675, 1728, 1659, 1176, - /* 1050 */ 431, 298, 1724, 1803, 516, 1481, 429, 182, 1477, 86, - /* 1060 */ 184, 1611, 1746, 124, 515, 293, 125, 1479, 1629, 1475, - /* 1070 */ 126, 249, 195, 496, 460, 198, 1675, 127, 467, 469, - /* 1080 */ 461, 472, 464, 1197, 516, 1688, 201, 471, 263, 1660, - /* 1090 */ 518, 1662, 1663, 514, 515, 535, 204, 1759, 1629, 480, - /* 1100 */ 522, 1769, 1768, 496, 6, 1749, 207, 477, 489, 215, - /* 1110 */ 1292, 476, 210, 137, 1790, 1688, 297, 113, 263, 1660, - /* 1120 */ 518, 1662, 1663, 514, 483, 535, 149, 1196, 40, 217, - /* 1130 */ 1787, 505, 502, 1041, 558, 557, 556, 1045, 555, 1047, - /* 1140 */ 1048, 554, 1050, 551, 1790, 1056, 548, 1058, 1059, 545, - /* 1150 */ 542, 1743, 18, 299, 1579, 1578, 147, 180, 520, 521, - /* 1160 */ 1787, 1786, 1709, 1659, 218, 307, 223, 525, 526, 141, - /* 1170 */ 236, 527, 238, 250, 1492, 426, 422, 418, 414, 179, - /* 1180 */ 71, 73, 1659, 538, 1464, 253, 1806, 245, 47, 499, - /* 1190 */ 226, 1675, 613, 506, 228, 136, 264, 274, 255, 516, - /* 1200 */ 257, 265, 1623, 1622, 64, 57, 1621, 177, 324, 515, - /* 1210 */ 1675, 1618, 327, 1629, 326, 1163, 1164, 154, 513, 331, - /* 1220 */ 1616, 333, 334, 335, 1615, 337, 1614, 339, 515, 1613, - /* 1230 */ 1688, 341, 1629, 84, 1660, 518, 1662, 1663, 514, 1612, - /* 1240 */ 535, 1659, 343, 1728, 1597, 155, 346, 507, 1724, 1688, - /* 1250 */ 1659, 347, 272, 1660, 518, 1662, 1663, 514, 512, 535, - /* 1260 */ 509, 1700, 1140, 1591, 176, 1139, 168, 1590, 173, 1675, - /* 1270 */ 404, 352, 353, 1589, 1588, 1109, 1563, 516, 1675, 1562, - /* 1280 */ 1561, 1560, 1559, 1558, 1557, 1556, 516, 515, 166, 1555, - /* 1290 */ 1554, 1629, 1553, 1552, 1551, 1550, 515, 1549, 1548, 1547, - /* 1300 */ 1629, 1546, 117, 1545, 1544, 1543, 1542, 1541, 1688, 1540, - /* 1310 */ 1111, 134, 1660, 518, 1662, 1663, 514, 1688, 535, 1539, - /* 1320 */ 84, 1660, 518, 1662, 1663, 514, 1538, 535, 1537, 1536, - /* 1330 */ 1728, 617, 1659, 1421, 1389, 1725, 163, 108, 941, 940, - /* 1340 */ 1388, 1659, 1605, 140, 1599, 247, 1587, 171, 164, 1586, - /* 1350 */ 109, 1576, 393, 169, 497, 1804, 1470, 107, 395, 174, - /* 1360 */ 1675, 1420, 1418, 606, 602, 598, 594, 246, 516, 1675, - /* 1370 */ 969, 1416, 413, 417, 411, 412, 416, 516, 515, 415, - /* 1380 */ 1414, 1412, 1629, 420, 419, 475, 423, 515, 424, 421, - /* 1390 */ 425, 1629, 80, 1659, 1401, 241, 1400, 1387, 1472, 1688, - /* 1400 */ 1075, 1076, 273, 1660, 518, 1662, 1663, 514, 1688, 535, - /* 1410 */ 45, 268, 1660, 518, 1662, 1663, 514, 1471, 535, 1002, - /* 1420 */ 1001, 1675, 1000, 999, 581, 583, 996, 1410, 528, 516, - /* 1430 */ 290, 1405, 995, 181, 994, 291, 448, 1403, 451, 515, - /* 1440 */ 292, 1386, 453, 1629, 1385, 455, 85, 1604, 488, 1147, - /* 1450 */ 1598, 462, 1659, 473, 1585, 1584, 202, 199, 1583, 1575, - /* 1460 */ 1688, 312, 311, 134, 1660, 518, 1662, 1663, 514, 203, - /* 1470 */ 535, 1184, 208, 67, 1145, 4, 196, 37, 128, 15, - /* 1480 */ 1675, 43, 1317, 1310, 1659, 135, 49, 212, 516, 213, - /* 1490 */ 205, 22, 463, 48, 1289, 214, 1177, 1649, 515, 41, - /* 1500 */ 1659, 23, 1629, 1288, 42, 302, 68, 1805, 220, 138, - /* 1510 */ 1346, 17, 1675, 1176, 1341, 1335, 1340, 10, 300, 1688, - /* 1520 */ 513, 1345, 273, 1660, 518, 1662, 1663, 514, 1675, 535, - /* 1530 */ 515, 1344, 301, 19, 1629, 16, 516, 13, 1231, 1252, - /* 1540 */ 139, 151, 29, 1216, 1230, 517, 515, 12, 523, 20, - /* 1550 */ 1629, 1688, 536, 304, 272, 1660, 518, 1662, 1663, 514, - /* 1560 */ 1659, 535, 1180, 1701, 21, 1574, 237, 1688, 231, 1315, - /* 1570 */ 273, 1660, 518, 1662, 1663, 514, 233, 535, 239, 235, - /* 1580 */ 69, 70, 74, 1648, 242, 1691, 1186, 1233, 1675, 1063, - /* 1590 */ 534, 44, 539, 537, 314, 541, 516, 543, 1060, 544, - /* 1600 */ 1659, 1057, 546, 547, 549, 1185, 515, 1051, 550, 552, - /* 1610 */ 1629, 1659, 1049, 306, 553, 1040, 1055, 1054, 1053, 559, - /* 1620 */ 1071, 1068, 1052, 75, 76, 77, 967, 1688, 1675, 1188, - /* 1630 */ 273, 1660, 518, 1662, 1663, 514, 516, 535, 567, 1675, - /* 1640 */ 533, 1236, 1237, 991, 1069, 1009, 515, 516, 570, 244, - /* 1650 */ 1629, 1659, 989, 988, 987, 984, 986, 515, 1006, 985, - /* 1660 */ 983, 1629, 982, 1004, 1659, 492, 979, 1688, 978, 977, - /* 1670 */ 259, 1660, 518, 1662, 1663, 514, 974, 535, 1688, 1675, - /* 1680 */ 1417, 267, 1660, 518, 1662, 1663, 514, 516, 535, 973, - /* 1690 */ 972, 591, 1675, 592, 114, 593, 1415, 515, 596, 595, - /* 1700 */ 516, 1629, 597, 1413, 599, 600, 601, 1411, 603, 604, - /* 1710 */ 515, 605, 1399, 496, 1629, 607, 608, 1659, 1688, 1398, - /* 1720 */ 1384, 269, 1660, 518, 1662, 1663, 514, 611, 535, 612, - /* 1730 */ 615, 1688, 112, 1172, 260, 1660, 518, 1662, 1663, 514, - /* 1740 */ 254, 535, 616, 1359, 1359, 1675, 1359, 219, 1735, 491, - /* 1750 */ 1659, 490, 1359, 516, 1790, 1359, 1359, 1359, 1359, 1359, - /* 1760 */ 1359, 1359, 1359, 515, 1359, 1659, 149, 1629, 1359, 1359, - /* 1770 */ 1787, 1359, 1359, 1359, 1359, 1359, 1359, 1359, 1675, 1359, - /* 1780 */ 1359, 1359, 1359, 1359, 1688, 1359, 516, 270, 1660, 518, - /* 1790 */ 1662, 1663, 514, 1675, 535, 1359, 515, 1359, 1659, 1359, - /* 1800 */ 1629, 516, 1359, 1359, 1359, 1359, 1359, 1359, 1359, 1359, - /* 1810 */ 1359, 515, 1359, 1659, 1359, 1629, 1359, 1688, 1359, 1359, - /* 1820 */ 261, 1660, 518, 1662, 1663, 514, 1675, 535, 1359, 1359, - /* 1830 */ 1359, 1359, 1688, 1359, 516, 271, 1660, 518, 1662, 1663, - /* 1840 */ 514, 1675, 535, 1359, 515, 1359, 1359, 1359, 1629, 516, - /* 1850 */ 1359, 1359, 1359, 1659, 1359, 1359, 1359, 1359, 1359, 515, - /* 1860 */ 1359, 1359, 1359, 1629, 1359, 1688, 1359, 1359, 262, 1660, - /* 1870 */ 518, 1662, 1663, 514, 1359, 535, 1359, 1359, 1359, 1359, - /* 1880 */ 1688, 1675, 1359, 1671, 1660, 518, 1662, 1663, 514, 516, - /* 1890 */ 535, 1359, 1359, 1659, 1359, 1359, 1359, 1359, 1359, 515, - /* 1900 */ 1359, 1359, 1359, 1629, 1659, 1359, 1359, 1359, 1359, 1359, - /* 1910 */ 1359, 1359, 1359, 1359, 1359, 1359, 1359, 1359, 1359, 1359, - /* 1920 */ 1688, 1675, 1359, 1670, 1660, 518, 1662, 1663, 514, 516, - /* 1930 */ 535, 1359, 1675, 1359, 1359, 1359, 1359, 1359, 1359, 515, - /* 1940 */ 516, 1359, 1359, 1629, 1659, 1359, 1359, 1359, 1359, 1359, - /* 1950 */ 515, 1359, 1359, 1359, 1629, 1359, 1359, 1659, 1359, 1359, - /* 1960 */ 1688, 1359, 1359, 1669, 1660, 518, 1662, 1663, 514, 1359, - /* 1970 */ 535, 1688, 1675, 1359, 282, 1660, 518, 1662, 1663, 514, - /* 1980 */ 516, 535, 1359, 1359, 1359, 1675, 1359, 1359, 1359, 1359, - /* 1990 */ 515, 1359, 1359, 516, 1629, 1359, 1359, 1359, 1359, 1359, - /* 2000 */ 1359, 1359, 1359, 515, 1359, 1359, 1359, 1629, 1659, 1359, - /* 2010 */ 1359, 1688, 1359, 1359, 281, 1660, 518, 1662, 1663, 514, - /* 2020 */ 1359, 535, 1359, 1359, 1688, 1359, 1359, 283, 1660, 518, - /* 2030 */ 1662, 1663, 514, 1359, 535, 1359, 1675, 1359, 492, 1359, - /* 2040 */ 1359, 1659, 1359, 1359, 516, 1359, 1359, 1359, 1359, 1359, - /* 2050 */ 1359, 1359, 1359, 1359, 515, 1359, 1359, 1359, 1629, 1359, - /* 2060 */ 1359, 1359, 1359, 1359, 1359, 1359, 1359, 114, 1359, 1675, - /* 2070 */ 1359, 1359, 1359, 1359, 1359, 1688, 1359, 516, 280, 1660, - /* 2080 */ 518, 1662, 1663, 514, 1359, 535, 496, 515, 1359, 1359, - /* 2090 */ 1359, 1629, 1359, 1359, 1359, 1359, 1359, 1359, 1359, 1359, - /* 2100 */ 1359, 1359, 1359, 1359, 1359, 112, 1359, 1359, 1688, 1359, - /* 2110 */ 1359, 266, 1660, 518, 1662, 1663, 514, 1359, 535, 1359, - /* 2120 */ 219, 1735, 491, 1359, 490, 1359, 1359, 1790, 1359, 1359, - /* 2130 */ 1359, 1359, 1359, 1359, 1359, 1359, 1359, 1359, 1359, 147, - /* 2140 */ 1359, 1359, 1359, 1787, + /* 0 */ 28, 231, 1663, 1650, 611, 610, 297, 1650, 358, 1485, + /* 10 */ 314, 1483, 35, 33, 352, 36, 34, 32, 31, 30, + /* 20 */ 306, 24, 1173, 1647, 533, 442, 441, 1647, 79, 1647, + /* 30 */ 1679, 36, 34, 32, 31, 30, 152, 493, 517, 1643, + /* 40 */ 1649, 115, 278, 1643, 1649, 1643, 1649, 1171, 516, 1486, + /* 50 */ 536, 533, 1633, 1494, 536, 1794, 536, 497, 14, 1746, + /* 60 */ 35, 33, 1300, 356, 1179, 1663, 114, 147, 306, 1692, + /* 70 */ 1173, 1791, 82, 1664, 519, 1666, 1667, 515, 532, 536, + /* 80 */ 1494, 1, 1732, 1743, 1794, 1314, 280, 1728, 36, 34, + /* 90 */ 32, 31, 30, 1679, 410, 1171, 1793, 1651, 1794, 520, + /* 100 */ 1791, 517, 309, 615, 112, 1583, 14, 1746, 35, 33, + /* 110 */ 149, 516, 1179, 1172, 1791, 1633, 306, 1647, 1173, 145, + /* 120 */ 1739, 1740, 532, 1744, 36, 34, 32, 31, 30, 2, + /* 130 */ 63, 1742, 1692, 1643, 1649, 84, 1664, 519, 1666, 1667, + /* 140 */ 515, 1364, 536, 1171, 536, 1732, 953, 1794, 952, 1731, + /* 150 */ 1728, 615, 1490, 72, 14, 392, 1174, 393, 1395, 148, + /* 160 */ 1179, 1172, 96, 1791, 532, 95, 94, 93, 92, 91, + /* 170 */ 90, 89, 88, 87, 1487, 954, 56, 2, 132, 201, + /* 180 */ 1375, 1177, 1178, 39, 1224, 1225, 1227, 1228, 1229, 1230, + /* 190 */ 1231, 512, 534, 1239, 1240, 1241, 1242, 1243, 1244, 615, + /* 200 */ 400, 952, 393, 1395, 1174, 55, 1197, 66, 133, 1172, + /* 210 */ 96, 150, 1451, 95, 94, 93, 92, 91, 90, 89, + /* 220 */ 88, 87, 65, 279, 1356, 38, 429, 194, 567, 1177, + /* 230 */ 1178, 1363, 1224, 1225, 1227, 1228, 1229, 1230, 1231, 512, + /* 240 */ 534, 1239, 1240, 1241, 1242, 1243, 1244, 566, 487, 565, + /* 250 */ 564, 563, 1174, 55, 63, 105, 104, 103, 102, 101, + /* 260 */ 100, 99, 98, 97, 936, 35, 33, 110, 36, 34, + /* 270 */ 32, 31, 30, 306, 1746, 1173, 1489, 1177, 1178, 1198, + /* 280 */ 1224, 1225, 1227, 1228, 1229, 1230, 1231, 512, 534, 1239, + /* 290 */ 1240, 1241, 1242, 1243, 1244, 55, 445, 444, 1741, 1538, + /* 300 */ 1171, 443, 940, 941, 111, 440, 296, 1355, 439, 438, + /* 310 */ 437, 1536, 569, 35, 33, 1245, 1679, 1179, 26, 310, + /* 320 */ 1386, 306, 391, 1173, 486, 395, 290, 130, 36, 34, + /* 330 */ 32, 31, 30, 1196, 8, 150, 1496, 1043, 559, 558, + /* 340 */ 557, 1047, 556, 1049, 1050, 555, 1052, 552, 1171, 1058, + /* 350 */ 549, 1060, 1061, 546, 543, 150, 615, 450, 482, 618, + /* 360 */ 485, 35, 33, 585, 583, 1179, 1172, 142, 397, 306, + /* 370 */ 1633, 1173, 458, 248, 1195, 291, 1324, 289, 288, 1532, + /* 380 */ 433, 318, 9, 150, 435, 107, 193, 399, 1574, 1576, + /* 390 */ 395, 607, 603, 599, 595, 247, 1171, 1472, 453, 157, + /* 400 */ 533, 129, 1361, 447, 615, 1425, 434, 572, 192, 1174, + /* 410 */ 1794, 1385, 357, 1179, 1172, 479, 1322, 1323, 1325, 1326, + /* 420 */ 80, 1571, 1792, 242, 61, 150, 1791, 60, 159, 1494, + /* 430 */ 9, 488, 483, 51, 1177, 1178, 50, 1224, 1225, 1227, + /* 440 */ 1228, 1229, 1230, 1231, 512, 534, 1239, 1240, 1241, 1242, + /* 450 */ 1243, 1244, 615, 55, 410, 316, 529, 1174, 54, 319, + /* 460 */ 322, 1633, 1172, 130, 150, 445, 444, 130, 1538, 562, + /* 470 */ 443, 382, 1496, 111, 440, 311, 1496, 439, 438, 437, + /* 480 */ 1536, 474, 1177, 1178, 203, 1224, 1225, 1227, 1228, 1229, + /* 490 */ 1230, 1231, 512, 534, 1239, 1240, 1241, 1242, 1243, 1244, + /* 500 */ 1384, 1794, 1147, 1199, 197, 1174, 1575, 1576, 36, 34, + /* 510 */ 32, 31, 30, 147, 1307, 161, 160, 1791, 35, 33, + /* 520 */ 1197, 1663, 1155, 1156, 195, 1470, 306, 351, 1173, 350, + /* 530 */ 1177, 1178, 493, 1224, 1225, 1227, 1228, 1229, 1230, 1231, + /* 540 */ 512, 534, 1239, 1240, 1241, 1242, 1243, 1244, 253, 1679, + /* 550 */ 1633, 1524, 533, 1171, 1383, 1621, 533, 517, 1382, 1250, + /* 560 */ 277, 114, 1195, 1005, 367, 1197, 1479, 516, 106, 375, + /* 570 */ 1179, 1633, 387, 466, 533, 431, 497, 1422, 1211, 469, + /* 580 */ 1007, 1494, 569, 150, 1381, 1494, 368, 2, 1692, 343, + /* 590 */ 388, 82, 1664, 519, 1666, 1667, 515, 1481, 536, 112, + /* 600 */ 331, 1732, 1477, 1494, 1633, 280, 1728, 198, 1633, 615, + /* 610 */ 345, 341, 533, 495, 144, 1739, 1740, 1794, 1744, 1172, + /* 620 */ 1794, 940, 941, 1538, 106, 1376, 11, 10, 222, 147, + /* 630 */ 317, 436, 147, 1791, 1633, 1536, 1791, 591, 590, 589, + /* 640 */ 321, 1494, 588, 587, 586, 116, 581, 580, 579, 578, + /* 650 */ 577, 576, 575, 574, 123, 570, 32, 31, 30, 1380, + /* 660 */ 386, 1299, 1174, 381, 380, 379, 378, 377, 374, 373, + /* 670 */ 372, 371, 370, 366, 365, 364, 363, 362, 361, 360, + /* 680 */ 359, 499, 1663, 520, 1379, 1226, 1197, 1177, 1178, 1584, + /* 690 */ 1224, 1225, 1227, 1228, 1229, 1230, 1231, 512, 534, 1239, + /* 700 */ 1240, 1241, 1242, 1243, 1244, 1264, 131, 1276, 1378, 1633, + /* 710 */ 1679, 259, 573, 533, 1466, 7, 511, 533, 496, 1471, + /* 720 */ 1200, 533, 459, 257, 53, 409, 1269, 52, 516, 1491, + /* 730 */ 1226, 533, 1633, 1610, 1633, 533, 36, 34, 32, 31, + /* 740 */ 30, 1377, 1494, 244, 162, 1374, 1494, 467, 1663, 1692, + /* 750 */ 1494, 501, 83, 1664, 519, 1666, 1667, 515, 1633, 536, + /* 760 */ 1494, 1373, 1732, 1794, 1494, 25, 299, 1728, 143, 55, + /* 770 */ 36, 34, 32, 31, 30, 147, 1679, 1469, 533, 1791, + /* 780 */ 223, 533, 281, 130, 517, 475, 1759, 435, 533, 1372, + /* 790 */ 530, 1633, 1497, 531, 516, 1633, 185, 1371, 1633, 183, + /* 800 */ 320, 476, 1370, 1369, 1663, 81, 1211, 1494, 1368, 434, + /* 810 */ 1494, 1633, 567, 504, 1262, 1692, 281, 1494, 274, 1664, + /* 820 */ 519, 1666, 1667, 515, 509, 536, 1751, 1295, 493, 561, + /* 830 */ 457, 566, 1679, 565, 564, 563, 59, 58, 355, 1633, + /* 840 */ 514, 156, 1452, 455, 1538, 207, 349, 1633, 1262, 584, + /* 850 */ 516, 1226, 1633, 1633, 1633, 1367, 1537, 114, 1633, 276, + /* 860 */ 1173, 226, 339, 1263, 337, 333, 329, 153, 324, 1298, + /* 870 */ 567, 1692, 1412, 1182, 273, 1664, 519, 1666, 1667, 515, + /* 880 */ 513, 536, 510, 1704, 1268, 1171, 1366, 1407, 1295, 566, + /* 890 */ 346, 565, 564, 563, 446, 112, 120, 1263, 187, 150, + /* 900 */ 189, 186, 1179, 188, 191, 1633, 1663, 190, 46, 448, + /* 910 */ 146, 1739, 1740, 1405, 1744, 11, 10, 1653, 1268, 1358, + /* 920 */ 1359, 480, 1181, 27, 304, 1257, 1258, 1259, 1260, 1261, + /* 930 */ 1265, 1266, 1267, 210, 1679, 451, 1633, 471, 502, 1185, + /* 940 */ 78, 615, 496, 37, 37, 460, 37, 1254, 233, 1321, + /* 950 */ 74, 1172, 516, 217, 1655, 1680, 1633, 27, 304, 1257, + /* 960 */ 1258, 1259, 1260, 1261, 1265, 1266, 1267, 118, 1663, 1396, + /* 970 */ 119, 1533, 120, 1692, 212, 46, 83, 1664, 519, 1666, + /* 980 */ 1667, 515, 977, 536, 1270, 1232, 1732, 1128, 1184, 235, + /* 990 */ 299, 1728, 143, 541, 1174, 428, 1679, 1762, 494, 978, + /* 1000 */ 1663, 225, 505, 119, 517, 228, 120, 230, 525, 3, + /* 1010 */ 1760, 241, 5, 1036, 516, 121, 252, 119, 1633, 1177, + /* 1020 */ 1178, 323, 1195, 326, 330, 286, 287, 1005, 1679, 249, + /* 1030 */ 1139, 369, 1573, 376, 1064, 1692, 517, 158, 83, 1664, + /* 1040 */ 519, 1666, 1667, 515, 1068, 536, 516, 1074, 1732, 384, + /* 1050 */ 1633, 389, 299, 1728, 1807, 383, 1072, 1201, 122, 385, + /* 1060 */ 1663, 390, 1204, 1766, 401, 398, 165, 1692, 402, 167, + /* 1070 */ 83, 1664, 519, 1666, 1667, 515, 1203, 536, 1205, 404, + /* 1080 */ 1732, 403, 170, 406, 299, 1728, 1807, 172, 1679, 407, + /* 1090 */ 1202, 175, 1663, 408, 62, 1789, 517, 411, 178, 430, + /* 1100 */ 432, 1484, 182, 86, 1480, 184, 516, 295, 124, 1179, + /* 1110 */ 1633, 125, 1482, 1478, 1615, 126, 127, 1614, 196, 461, + /* 1120 */ 1679, 199, 250, 202, 465, 462, 1200, 1692, 517, 468, + /* 1130 */ 83, 1664, 519, 1666, 1667, 515, 472, 536, 516, 205, + /* 1140 */ 1732, 481, 1633, 1663, 299, 1728, 1807, 497, 470, 478, + /* 1150 */ 473, 523, 1773, 1772, 298, 1750, 490, 208, 1763, 1692, + /* 1160 */ 211, 6, 264, 1664, 519, 1666, 1667, 515, 1753, 536, + /* 1170 */ 484, 1679, 216, 1663, 477, 113, 1295, 218, 1199, 517, + /* 1180 */ 40, 300, 1747, 506, 503, 18, 527, 1582, 1794, 516, + /* 1190 */ 137, 521, 522, 1633, 219, 1581, 526, 308, 497, 237, + /* 1200 */ 149, 1679, 528, 224, 1791, 251, 1663, 1495, 1713, 517, + /* 1210 */ 1692, 1810, 1790, 264, 1664, 519, 1666, 1667, 515, 516, + /* 1220 */ 536, 239, 71, 1633, 73, 539, 246, 254, 500, 614, + /* 1230 */ 136, 227, 1467, 229, 1679, 507, 1663, 265, 47, 1794, + /* 1240 */ 1692, 256, 517, 84, 1664, 519, 1666, 1667, 515, 258, + /* 1250 */ 536, 147, 516, 1732, 275, 1791, 1633, 508, 1728, 266, + /* 1260 */ 1627, 1626, 57, 1625, 1679, 325, 1622, 327, 328, 332, + /* 1270 */ 1166, 1167, 517, 1692, 154, 1620, 134, 1664, 519, 1666, + /* 1280 */ 1667, 515, 516, 536, 334, 335, 1633, 1663, 336, 1619, + /* 1290 */ 338, 1618, 340, 1617, 342, 1616, 1663, 344, 1600, 155, + /* 1300 */ 1142, 347, 1141, 1692, 348, 1594, 84, 1664, 519, 1666, + /* 1310 */ 1667, 515, 1593, 536, 353, 1679, 1732, 354, 1592, 498, + /* 1320 */ 1808, 1729, 1591, 517, 1679, 1111, 1566, 1565, 1564, 1563, + /* 1330 */ 1562, 1561, 517, 516, 1560, 1559, 1558, 1633, 1557, 1556, + /* 1340 */ 1555, 1554, 516, 1553, 1552, 1551, 1633, 1550, 1549, 117, + /* 1350 */ 1663, 1548, 1547, 1546, 1692, 1545, 1544, 269, 1664, 519, + /* 1360 */ 1666, 1667, 515, 1692, 536, 1543, 134, 1664, 519, 1666, + /* 1370 */ 1667, 515, 1113, 536, 1542, 1541, 1540, 1539, 1679, 1424, + /* 1380 */ 1392, 943, 163, 108, 942, 1391, 517, 1608, 1602, 1590, + /* 1390 */ 1663, 171, 1589, 394, 489, 140, 516, 164, 109, 169, + /* 1400 */ 1633, 396, 1579, 303, 45, 174, 1663, 1473, 1423, 1421, + /* 1410 */ 1809, 1419, 1417, 412, 413, 414, 417, 1692, 1679, 971, + /* 1420 */ 274, 1664, 519, 1666, 1667, 515, 514, 536, 416, 420, + /* 1430 */ 418, 421, 422, 1415, 1679, 426, 516, 424, 1404, 425, + /* 1440 */ 1633, 1403, 517, 1390, 1475, 1077, 181, 1078, 1474, 1413, + /* 1450 */ 1004, 582, 516, 1003, 1663, 584, 1633, 1692, 292, 305, + /* 1460 */ 273, 1664, 519, 1666, 1667, 515, 1408, 536, 1002, 1705, + /* 1470 */ 449, 1001, 998, 1692, 997, 996, 274, 1664, 519, 1666, + /* 1480 */ 1667, 515, 1679, 536, 293, 1406, 1663, 294, 1389, 452, + /* 1490 */ 517, 180, 1388, 454, 456, 85, 1607, 1149, 1601, 463, + /* 1500 */ 516, 1588, 1587, 141, 1633, 1586, 1578, 307, 49, 427, + /* 1510 */ 423, 419, 415, 179, 1679, 67, 1663, 204, 464, 4, + /* 1520 */ 37, 1692, 517, 206, 274, 1664, 519, 1666, 1667, 515, + /* 1530 */ 15, 536, 516, 128, 209, 43, 1633, 1320, 64, 200, + /* 1540 */ 135, 177, 213, 215, 1679, 22, 48, 1653, 214, 1313, + /* 1550 */ 68, 23, 517, 1692, 42, 1292, 260, 1664, 519, 1666, + /* 1560 */ 1667, 515, 516, 536, 221, 1291, 1633, 1663, 138, 1349, + /* 1570 */ 17, 1338, 1344, 1343, 301, 1348, 10, 1347, 302, 19, + /* 1580 */ 1255, 139, 1234, 1692, 151, 29, 268, 1664, 519, 1666, + /* 1590 */ 1667, 515, 12, 536, 1233, 1679, 20, 1219, 176, 16, + /* 1600 */ 168, 518, 173, 517, 405, 41, 13, 1663, 1577, 238, + /* 1610 */ 74, 524, 1652, 516, 232, 21, 234, 1633, 1318, 1189, + /* 1620 */ 236, 240, 166, 69, 70, 243, 1695, 540, 1236, 535, + /* 1630 */ 44, 1071, 1065, 538, 1692, 1679, 315, 270, 1664, 519, + /* 1640 */ 1666, 1667, 515, 517, 536, 542, 544, 1663, 1062, 1059, + /* 1650 */ 545, 547, 548, 516, 550, 1053, 553, 1633, 551, 1057, + /* 1660 */ 1051, 1056, 1663, 554, 1055, 1054, 75, 1042, 76, 560, + /* 1670 */ 1073, 77, 1070, 568, 1692, 1679, 969, 261, 1664, 519, + /* 1680 */ 1666, 1667, 515, 517, 536, 993, 1011, 245, 991, 571, + /* 1690 */ 1679, 986, 1008, 516, 990, 989, 988, 1633, 517, 987, + /* 1700 */ 985, 984, 1006, 981, 980, 979, 976, 975, 516, 974, + /* 1710 */ 1420, 592, 1633, 1663, 1692, 593, 594, 271, 1664, 519, + /* 1720 */ 1666, 1667, 515, 1418, 536, 1663, 597, 596, 598, 1692, + /* 1730 */ 1416, 600, 262, 1664, 519, 1666, 1667, 515, 601, 536, + /* 1740 */ 602, 1679, 604, 605, 606, 1402, 608, 609, 1401, 517, + /* 1750 */ 1414, 1387, 613, 1679, 612, 1175, 255, 616, 617, 516, + /* 1760 */ 1362, 517, 1362, 1633, 1362, 1663, 1362, 1362, 1362, 1362, + /* 1770 */ 1362, 516, 1362, 1362, 1362, 1633, 1663, 1362, 1362, 1362, + /* 1780 */ 1692, 1362, 1362, 272, 1664, 519, 1666, 1667, 515, 1362, + /* 1790 */ 536, 1362, 1692, 1679, 1362, 263, 1664, 519, 1666, 1667, + /* 1800 */ 515, 517, 536, 1362, 1679, 1362, 1362, 1362, 1362, 1362, + /* 1810 */ 1362, 516, 517, 1362, 1362, 1633, 1362, 1362, 1362, 1362, + /* 1820 */ 1362, 1362, 516, 1362, 1362, 1362, 1633, 1663, 1362, 1362, + /* 1830 */ 1362, 1362, 1692, 1362, 1362, 1675, 1664, 519, 1666, 1667, + /* 1840 */ 515, 1362, 536, 1692, 1362, 1362, 1674, 1664, 519, 1666, + /* 1850 */ 1667, 515, 1362, 536, 1362, 1679, 1362, 1663, 1362, 1362, + /* 1860 */ 1362, 1362, 1362, 517, 1362, 1362, 1362, 1362, 1362, 1362, + /* 1870 */ 1362, 1362, 1362, 516, 1362, 1362, 1362, 1633, 1362, 1362, + /* 1880 */ 1362, 1362, 1362, 1362, 1362, 1679, 1362, 1663, 1362, 1362, + /* 1890 */ 1362, 1362, 1362, 517, 1692, 1362, 1362, 1673, 1664, 519, + /* 1900 */ 1666, 1667, 515, 516, 536, 1362, 1362, 1633, 1362, 1362, + /* 1910 */ 1362, 1362, 1362, 1362, 1362, 1679, 1362, 1362, 1362, 1663, + /* 1920 */ 1362, 1362, 1362, 517, 1692, 1362, 1362, 284, 1664, 519, + /* 1930 */ 1666, 1667, 515, 516, 536, 1362, 1362, 1633, 1362, 1362, + /* 1940 */ 1362, 1362, 1362, 313, 312, 1362, 1362, 1679, 1362, 1362, + /* 1950 */ 1362, 1362, 1663, 1187, 1692, 517, 1362, 283, 1664, 519, + /* 1960 */ 1666, 1667, 515, 1362, 536, 516, 1362, 1362, 1362, 1633, + /* 1970 */ 1362, 1362, 1362, 1362, 1362, 1362, 1362, 1362, 1180, 1362, + /* 1980 */ 1679, 1362, 1362, 1362, 1362, 1663, 1692, 1362, 517, 285, + /* 1990 */ 1664, 519, 1666, 1667, 515, 1179, 536, 1362, 516, 1362, + /* 2000 */ 1362, 1362, 1633, 1362, 1362, 1362, 1362, 1362, 1362, 1362, + /* 2010 */ 1362, 1362, 1362, 1679, 1362, 1362, 493, 1362, 1362, 1692, + /* 2020 */ 1362, 517, 282, 1664, 519, 1666, 1667, 515, 1362, 536, + /* 2030 */ 1362, 516, 1362, 1362, 537, 1633, 1362, 1362, 1362, 1362, + /* 2040 */ 1362, 1362, 1362, 1362, 1183, 114, 493, 1362, 1362, 1362, + /* 2050 */ 1362, 1362, 1692, 1362, 1362, 267, 1664, 519, 1666, 1667, + /* 2060 */ 515, 1362, 536, 1362, 497, 1362, 1362, 1362, 1362, 1362, + /* 2070 */ 1362, 1362, 1362, 1362, 1362, 114, 1362, 1362, 1362, 1362, + /* 2080 */ 1362, 1362, 1362, 112, 1362, 1362, 1362, 1188, 1362, 1362, + /* 2090 */ 1362, 1362, 1362, 1362, 497, 1362, 1362, 1362, 220, 1739, + /* 2100 */ 492, 1362, 491, 1362, 1362, 1794, 1362, 1362, 1362, 1362, + /* 2110 */ 1362, 1362, 1191, 112, 1362, 1362, 1362, 149, 1362, 1362, + /* 2120 */ 1362, 1791, 1362, 534, 1239, 1240, 1362, 1362, 220, 1739, + /* 2130 */ 492, 1362, 491, 1362, 1362, 1794, 1362, 1362, 1362, 1362, + /* 2140 */ 1362, 1362, 1362, 1362, 1362, 1362, 1362, 147, 1362, 1362, + /* 2150 */ 1362, 1791, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 323, 324, 242, 272, 250, 251, 275, 272, 249, 272, - /* 10 */ 275, 271, 12, 13, 297, 12, 13, 14, 15, 16, - /* 20 */ 20, 2, 22, 292, 249, 256, 257, 292, 252, 292, - /* 30 */ 270, 12, 13, 14, 15, 16, 261, 249, 278, 308, - /* 40 */ 309, 265, 283, 308, 309, 308, 309, 47, 288, 273, - /* 50 */ 319, 249, 292, 278, 319, 338, 319, 297, 58, 310, - /* 60 */ 12, 13, 14, 261, 64, 242, 278, 350, 20, 309, - /* 70 */ 22, 354, 312, 313, 314, 315, 316, 317, 41, 319, - /* 80 */ 278, 81, 322, 334, 338, 82, 326, 327, 12, 13, - /* 90 */ 14, 15, 16, 270, 20, 47, 350, 272, 338, 288, - /* 100 */ 354, 278, 291, 103, 316, 294, 58, 57, 12, 13, - /* 110 */ 350, 288, 64, 113, 354, 292, 20, 292, 22, 331, - /* 120 */ 332, 333, 20, 335, 12, 13, 14, 15, 16, 81, - /* 130 */ 75, 254, 309, 308, 309, 312, 313, 314, 315, 316, - /* 140 */ 317, 0, 319, 47, 319, 322, 20, 338, 4, 326, - /* 150 */ 327, 103, 269, 276, 58, 245, 156, 247, 248, 350, - /* 160 */ 64, 113, 21, 354, 281, 24, 25, 26, 27, 28, - /* 170 */ 29, 30, 31, 32, 119, 120, 241, 81, 243, 93, - /* 180 */ 180, 181, 4, 183, 184, 185, 186, 187, 188, 189, - /* 190 */ 190, 191, 192, 193, 194, 195, 196, 197, 112, 103, - /* 200 */ 114, 115, 116, 245, 156, 247, 248, 81, 21, 113, - /* 210 */ 210, 24, 25, 26, 27, 28, 29, 30, 31, 32, - /* 220 */ 42, 43, 165, 166, 148, 81, 169, 0, 180, 181, - /* 230 */ 0, 183, 184, 185, 186, 187, 188, 189, 190, 191, - /* 240 */ 192, 193, 194, 195, 196, 197, 12, 13, 14, 15, - /* 250 */ 16, 20, 156, 239, 24, 25, 26, 27, 28, 29, - /* 260 */ 30, 31, 32, 0, 227, 12, 13, 12, 13, 14, - /* 270 */ 15, 16, 45, 20, 81, 22, 180, 181, 151, 183, + /* 0 */ 324, 325, 243, 273, 251, 252, 276, 273, 250, 273, + /* 10 */ 276, 272, 12, 13, 298, 12, 13, 14, 15, 16, + /* 20 */ 20, 2, 22, 293, 250, 257, 258, 293, 253, 293, + /* 30 */ 271, 12, 13, 14, 15, 16, 262, 250, 279, 309, + /* 40 */ 310, 266, 284, 309, 310, 309, 310, 47, 289, 274, + /* 50 */ 320, 250, 293, 279, 320, 339, 320, 298, 58, 311, + /* 60 */ 12, 13, 14, 262, 64, 243, 279, 351, 20, 310, + /* 70 */ 22, 355, 313, 314, 315, 316, 317, 318, 20, 320, + /* 80 */ 279, 81, 323, 335, 339, 82, 327, 328, 12, 13, + /* 90 */ 14, 15, 16, 271, 57, 47, 351, 273, 339, 289, + /* 100 */ 355, 279, 292, 103, 317, 295, 58, 311, 12, 13, + /* 110 */ 351, 289, 64, 113, 355, 293, 20, 293, 22, 332, + /* 120 */ 333, 334, 20, 336, 12, 13, 14, 15, 16, 81, + /* 130 */ 255, 335, 310, 309, 310, 313, 314, 315, 316, 317, + /* 140 */ 318, 0, 320, 47, 320, 323, 20, 339, 22, 327, + /* 150 */ 328, 103, 277, 253, 58, 246, 156, 248, 249, 351, + /* 160 */ 64, 113, 21, 355, 20, 24, 25, 26, 27, 28, + /* 170 */ 29, 30, 31, 32, 274, 49, 4, 81, 242, 55, + /* 180 */ 244, 181, 182, 81, 184, 185, 186, 187, 188, 189, + /* 190 */ 190, 191, 192, 193, 194, 195, 196, 197, 198, 103, + /* 200 */ 246, 22, 248, 249, 156, 81, 20, 83, 256, 113, + /* 210 */ 21, 211, 260, 24, 25, 26, 27, 28, 29, 30, + /* 220 */ 31, 32, 165, 166, 148, 81, 47, 170, 93, 181, + /* 230 */ 182, 0, 184, 185, 186, 187, 188, 189, 190, 191, + /* 240 */ 192, 193, 194, 195, 196, 197, 198, 112, 20, 114, + /* 250 */ 115, 116, 156, 81, 255, 24, 25, 26, 27, 28, + /* 260 */ 29, 30, 31, 32, 4, 12, 13, 268, 12, 13, + /* 270 */ 14, 15, 16, 20, 311, 22, 277, 181, 182, 20, /* 280 */ 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, - /* 290 */ 194, 195, 196, 197, 297, 249, 60, 61, 171, 172, - /* 300 */ 47, 65, 20, 242, 68, 69, 230, 261, 72, 73, - /* 310 */ 74, 297, 81, 12, 13, 14, 2, 64, 255, 254, - /* 320 */ 57, 20, 259, 22, 278, 252, 12, 13, 14, 15, - /* 330 */ 16, 270, 267, 58, 81, 338, 210, 82, 270, 278, - /* 340 */ 35, 276, 81, 249, 297, 277, 273, 350, 47, 288, - /* 350 */ 282, 354, 338, 292, 210, 20, 103, 22, 297, 143, - /* 360 */ 139, 12, 13, 0, 350, 64, 113, 55, 354, 20, - /* 370 */ 309, 22, 278, 312, 313, 314, 315, 316, 317, 145, - /* 380 */ 319, 160, 81, 322, 49, 338, 57, 326, 327, 84, - /* 390 */ 20, 86, 87, 81, 89, 83, 47, 350, 93, 338, - /* 400 */ 0, 354, 81, 210, 103, 338, 14, 15, 16, 156, - /* 410 */ 316, 350, 91, 64, 113, 354, 155, 350, 157, 198, - /* 420 */ 115, 354, 14, 0, 330, 331, 332, 333, 20, 335, - /* 430 */ 81, 215, 216, 180, 181, 41, 183, 184, 185, 186, + /* 290 */ 194, 195, 196, 197, 198, 81, 60, 61, 335, 271, + /* 300 */ 47, 65, 42, 43, 68, 69, 278, 231, 72, 73, + /* 310 */ 74, 283, 57, 12, 13, 14, 271, 64, 2, 263, + /* 320 */ 243, 20, 247, 22, 279, 250, 35, 271, 12, 13, + /* 330 */ 14, 15, 16, 20, 81, 211, 280, 94, 95, 96, + /* 340 */ 97, 98, 99, 100, 101, 102, 103, 104, 47, 106, + /* 350 */ 107, 108, 109, 110, 111, 211, 103, 4, 143, 19, + /* 360 */ 315, 12, 13, 257, 258, 64, 113, 270, 14, 20, + /* 370 */ 293, 22, 19, 33, 20, 84, 181, 86, 87, 282, + /* 380 */ 89, 281, 81, 211, 93, 45, 33, 247, 288, 289, + /* 390 */ 250, 51, 52, 53, 54, 55, 47, 0, 45, 55, + /* 400 */ 250, 145, 240, 50, 103, 0, 115, 64, 55, 156, + /* 410 */ 339, 243, 262, 64, 113, 220, 221, 222, 223, 224, + /* 420 */ 80, 279, 351, 83, 80, 211, 355, 83, 286, 279, + /* 430 */ 81, 216, 217, 80, 181, 182, 83, 184, 185, 186, /* 440 */ 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, - /* 450 */ 197, 280, 103, 47, 249, 180, 93, 156, 287, 288, - /* 460 */ 60, 61, 113, 210, 0, 65, 261, 180, 68, 69, - /* 470 */ 64, 210, 72, 73, 74, 112, 82, 114, 115, 116, - /* 480 */ 57, 180, 181, 278, 183, 184, 185, 186, 187, 188, - /* 490 */ 189, 190, 191, 192, 193, 194, 195, 196, 197, 55, - /* 500 */ 1, 2, 20, 270, 262, 156, 219, 220, 221, 222, - /* 510 */ 223, 278, 270, 270, 242, 145, 256, 257, 12, 13, - /* 520 */ 277, 279, 210, 242, 80, 282, 20, 83, 22, 180, - /* 530 */ 181, 20, 183, 184, 185, 186, 187, 188, 189, 190, - /* 540 */ 191, 192, 193, 194, 195, 196, 197, 314, 246, 287, - /* 550 */ 288, 249, 14, 47, 270, 249, 249, 93, 20, 249, - /* 560 */ 18, 277, 20, 0, 292, 47, 282, 261, 261, 27, - /* 570 */ 64, 261, 30, 292, 268, 268, 112, 288, 114, 115, - /* 580 */ 116, 82, 64, 294, 278, 278, 249, 81, 278, 18, - /* 590 */ 48, 249, 249, 249, 23, 14, 242, 242, 261, 242, - /* 600 */ 262, 20, 270, 261, 261, 261, 35, 36, 270, 103, - /* 610 */ 39, 242, 92, 246, 282, 278, 249, 279, 22, 113, - /* 620 */ 278, 278, 278, 60, 61, 62, 63, 56, 65, 66, - /* 630 */ 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, - /* 640 */ 77, 78, 262, 47, 278, 270, 292, 292, 20, 292, - /* 650 */ 270, 285, 81, 263, 279, 258, 266, 260, 37, 279, - /* 660 */ 118, 292, 156, 121, 122, 123, 124, 125, 126, 127, + /* 450 */ 197, 198, 103, 81, 57, 263, 116, 156, 3, 263, + /* 460 */ 298, 293, 113, 271, 211, 60, 61, 271, 271, 92, + /* 470 */ 65, 75, 280, 68, 69, 278, 280, 72, 73, 74, + /* 480 */ 283, 141, 181, 182, 144, 184, 185, 186, 187, 188, + /* 490 */ 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, + /* 500 */ 243, 339, 162, 20, 164, 156, 288, 289, 12, 13, + /* 510 */ 14, 15, 16, 351, 14, 119, 120, 355, 12, 13, + /* 520 */ 20, 243, 167, 168, 169, 0, 20, 155, 22, 157, + /* 530 */ 181, 182, 250, 184, 185, 186, 187, 188, 189, 190, + /* 540 */ 191, 192, 193, 194, 195, 196, 197, 198, 264, 271, + /* 550 */ 293, 267, 250, 47, 243, 0, 250, 279, 243, 14, + /* 560 */ 18, 279, 20, 47, 262, 20, 272, 289, 262, 27, + /* 570 */ 64, 293, 30, 302, 250, 269, 298, 0, 82, 298, + /* 580 */ 64, 279, 57, 211, 243, 279, 262, 81, 310, 151, + /* 590 */ 48, 313, 314, 315, 316, 317, 318, 272, 320, 317, + /* 600 */ 45, 323, 272, 279, 293, 327, 328, 272, 293, 103, + /* 610 */ 172, 173, 250, 331, 332, 333, 334, 339, 336, 113, + /* 620 */ 339, 42, 43, 271, 262, 244, 1, 2, 145, 351, + /* 630 */ 278, 269, 351, 355, 293, 283, 355, 60, 61, 62, + /* 640 */ 63, 279, 65, 66, 67, 68, 69, 70, 71, 72, + /* 650 */ 73, 74, 75, 76, 77, 78, 14, 15, 16, 243, + /* 660 */ 118, 4, 156, 121, 122, 123, 124, 125, 126, 127, /* 670 */ 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, - /* 680 */ 138, 242, 242, 3, 249, 41, 180, 181, 117, 183, + /* 680 */ 138, 226, 243, 289, 243, 185, 20, 181, 182, 295, /* 690 */ 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, - /* 700 */ 194, 195, 196, 197, 249, 242, 12, 13, 14, 15, - /* 710 */ 16, 249, 242, 278, 249, 20, 261, 42, 43, 148, - /* 720 */ 149, 150, 184, 261, 153, 242, 261, 249, 242, 158, - /* 730 */ 4, 292, 292, 278, 12, 13, 14, 15, 16, 261, - /* 740 */ 278, 170, 85, 278, 173, 88, 175, 176, 177, 178, - /* 750 */ 179, 316, 58, 270, 242, 292, 278, 242, 271, 310, - /* 760 */ 64, 278, 292, 310, 242, 184, 331, 332, 333, 242, - /* 770 */ 335, 288, 242, 145, 271, 292, 82, 242, 292, 0, - /* 780 */ 58, 210, 242, 334, 90, 242, 242, 334, 208, 209, - /* 790 */ 271, 85, 309, 93, 88, 312, 313, 314, 315, 316, - /* 800 */ 317, 22, 319, 85, 292, 322, 88, 292, 271, 326, - /* 810 */ 327, 328, 90, 270, 292, 115, 0, 85, 0, 292, - /* 820 */ 88, 278, 292, 340, 21, 167, 168, 292, 345, 346, - /* 830 */ 209, 288, 292, 139, 4, 292, 292, 34, 22, 44, - /* 840 */ 22, 271, 41, 41, 271, 41, 41, 1, 2, 19, - /* 850 */ 195, 196, 309, 301, 160, 312, 313, 314, 315, 316, - /* 860 */ 317, 139, 319, 33, 47, 322, 41, 41, 41, 326, - /* 870 */ 327, 328, 243, 229, 41, 45, 81, 22, 47, 184, - /* 880 */ 50, 259, 160, 82, 82, 55, 82, 82, 357, 346, - /* 890 */ 305, 41, 198, 199, 200, 201, 202, 203, 204, 205, - /* 900 */ 206, 207, 47, 242, 41, 225, 41, 82, 82, 82, - /* 910 */ 80, 41, 348, 83, 342, 82, 41, 270, 41, 64, - /* 920 */ 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, - /* 930 */ 113, 270, 82, 248, 250, 242, 311, 211, 41, 278, - /* 940 */ 281, 41, 336, 351, 113, 82, 351, 82, 351, 288, - /* 950 */ 339, 212, 82, 292, 20, 307, 249, 82, 103, 82, - /* 960 */ 45, 47, 306, 270, 256, 154, 299, 242, 113, 249, - /* 970 */ 309, 278, 249, 312, 313, 314, 315, 316, 317, 82, - /* 980 */ 319, 288, 82, 322, 40, 292, 139, 326, 327, 328, - /* 990 */ 286, 249, 20, 284, 284, 270, 244, 244, 337, 20, - /* 1000 */ 303, 254, 309, 278, 288, 312, 313, 314, 315, 316, - /* 1010 */ 317, 156, 319, 288, 254, 322, 20, 292, 242, 326, - /* 1020 */ 327, 328, 20, 296, 254, 296, 298, 254, 278, 20, - /* 1030 */ 337, 254, 289, 249, 309, 180, 181, 312, 313, 314, - /* 1040 */ 315, 316, 317, 254, 319, 254, 270, 322, 242, 64, - /* 1050 */ 270, 326, 327, 328, 278, 270, 244, 270, 270, 249, - /* 1060 */ 270, 292, 337, 270, 288, 244, 270, 270, 292, 270, - /* 1070 */ 270, 303, 252, 297, 163, 252, 270, 270, 249, 296, - /* 1080 */ 302, 289, 288, 20, 278, 309, 252, 278, 312, 313, - /* 1090 */ 314, 315, 316, 317, 288, 319, 252, 311, 292, 218, - /* 1100 */ 217, 347, 347, 297, 224, 344, 293, 292, 147, 343, - /* 1110 */ 209, 213, 293, 341, 338, 309, 292, 278, 312, 313, - /* 1120 */ 314, 315, 316, 317, 292, 319, 350, 20, 40, 307, - /* 1130 */ 354, 228, 226, 94, 95, 96, 97, 98, 99, 100, - /* 1140 */ 101, 102, 103, 104, 338, 106, 107, 108, 109, 110, - /* 1150 */ 111, 310, 81, 231, 293, 293, 350, 33, 292, 292, - /* 1160 */ 354, 353, 325, 242, 329, 292, 352, 142, 290, 45, - /* 1170 */ 278, 289, 252, 266, 278, 51, 52, 53, 54, 55, - /* 1180 */ 252, 81, 242, 274, 260, 249, 358, 252, 300, 353, - /* 1190 */ 352, 270, 244, 353, 352, 304, 264, 264, 253, 278, - /* 1200 */ 240, 264, 0, 0, 80, 40, 0, 83, 72, 288, - /* 1210 */ 270, 0, 174, 292, 47, 47, 47, 47, 278, 174, - /* 1220 */ 0, 47, 47, 174, 0, 174, 0, 47, 288, 0, - /* 1230 */ 309, 47, 292, 312, 313, 314, 315, 316, 317, 0, - /* 1240 */ 319, 242, 47, 322, 0, 81, 160, 326, 327, 309, - /* 1250 */ 242, 159, 312, 313, 314, 315, 316, 317, 318, 319, - /* 1260 */ 320, 321, 113, 0, 140, 156, 142, 0, 144, 270, - /* 1270 */ 146, 152, 151, 0, 0, 44, 0, 278, 270, 0, - /* 1280 */ 0, 0, 0, 0, 0, 0, 278, 288, 164, 0, - /* 1290 */ 0, 292, 0, 0, 0, 0, 288, 0, 0, 0, - /* 1300 */ 292, 0, 40, 0, 0, 0, 0, 0, 309, 0, - /* 1310 */ 22, 312, 313, 314, 315, 316, 317, 309, 319, 0, - /* 1320 */ 312, 313, 314, 315, 316, 317, 0, 319, 0, 0, - /* 1330 */ 322, 19, 242, 0, 0, 327, 40, 37, 14, 14, - /* 1340 */ 0, 242, 0, 41, 0, 33, 0, 147, 38, 0, - /* 1350 */ 37, 0, 44, 37, 355, 356, 0, 45, 44, 37, - /* 1360 */ 270, 0, 0, 51, 52, 53, 54, 55, 278, 270, - /* 1370 */ 59, 0, 37, 37, 47, 45, 45, 278, 288, 47, - /* 1380 */ 0, 0, 292, 45, 47, 295, 47, 288, 45, 37, - /* 1390 */ 37, 292, 80, 242, 0, 83, 0, 0, 0, 309, - /* 1400 */ 22, 47, 312, 313, 314, 315, 316, 317, 309, 319, - /* 1410 */ 90, 312, 313, 314, 315, 316, 317, 0, 319, 47, - /* 1420 */ 47, 270, 47, 47, 41, 41, 47, 0, 116, 278, - /* 1430 */ 22, 0, 47, 88, 47, 22, 48, 0, 47, 288, - /* 1440 */ 22, 0, 22, 292, 0, 22, 20, 0, 349, 47, - /* 1450 */ 0, 22, 242, 141, 0, 0, 144, 142, 0, 0, - /* 1460 */ 309, 12, 13, 312, 313, 314, 315, 316, 317, 37, - /* 1470 */ 319, 22, 82, 81, 162, 41, 164, 41, 161, 214, - /* 1480 */ 270, 41, 82, 82, 242, 81, 145, 81, 278, 41, - /* 1490 */ 140, 81, 145, 145, 82, 44, 47, 44, 288, 208, - /* 1500 */ 242, 41, 292, 82, 41, 295, 81, 356, 44, 44, - /* 1510 */ 82, 41, 270, 64, 47, 82, 47, 2, 47, 309, - /* 1520 */ 278, 47, 312, 313, 314, 315, 316, 317, 270, 319, - /* 1530 */ 288, 47, 47, 41, 292, 214, 278, 214, 82, 180, - /* 1540 */ 44, 44, 81, 22, 82, 182, 288, 81, 143, 81, - /* 1550 */ 292, 309, 103, 295, 312, 313, 314, 315, 316, 317, - /* 1560 */ 242, 319, 113, 321, 81, 0, 37, 309, 82, 82, - /* 1570 */ 312, 313, 314, 315, 316, 317, 81, 319, 140, 81, - /* 1580 */ 81, 81, 91, 44, 44, 81, 22, 82, 270, 82, - /* 1590 */ 81, 81, 47, 92, 47, 81, 278, 47, 82, 81, - /* 1600 */ 242, 82, 47, 81, 47, 156, 288, 82, 81, 47, - /* 1610 */ 292, 242, 82, 295, 81, 22, 105, 105, 105, 93, - /* 1620 */ 47, 22, 105, 81, 81, 81, 59, 309, 270, 180, - /* 1630 */ 312, 313, 314, 315, 316, 317, 278, 319, 58, 270, - /* 1640 */ 191, 192, 193, 47, 113, 64, 288, 278, 79, 41, - /* 1650 */ 292, 242, 47, 47, 47, 22, 47, 288, 64, 47, - /* 1660 */ 47, 292, 47, 47, 242, 249, 47, 309, 47, 47, - /* 1670 */ 312, 313, 314, 315, 316, 317, 47, 319, 309, 270, - /* 1680 */ 0, 312, 313, 314, 315, 316, 317, 278, 319, 47, - /* 1690 */ 47, 47, 270, 45, 278, 37, 0, 288, 45, 47, - /* 1700 */ 278, 292, 37, 0, 47, 45, 37, 0, 47, 45, - /* 1710 */ 288, 37, 0, 297, 292, 47, 46, 242, 309, 0, - /* 1720 */ 0, 312, 313, 314, 315, 316, 317, 22, 319, 21, - /* 1730 */ 21, 309, 316, 22, 312, 313, 314, 315, 316, 317, - /* 1740 */ 22, 319, 20, 359, 359, 270, 359, 331, 332, 333, - /* 1750 */ 242, 335, 359, 278, 338, 359, 359, 359, 359, 359, - /* 1760 */ 359, 359, 359, 288, 359, 242, 350, 292, 359, 359, - /* 1770 */ 354, 359, 359, 359, 359, 359, 359, 359, 270, 359, - /* 1780 */ 359, 359, 359, 359, 309, 359, 278, 312, 313, 314, - /* 1790 */ 315, 316, 317, 270, 319, 359, 288, 359, 242, 359, - /* 1800 */ 292, 278, 359, 359, 359, 359, 359, 359, 359, 359, - /* 1810 */ 359, 288, 359, 242, 359, 292, 359, 309, 359, 359, - /* 1820 */ 312, 313, 314, 315, 316, 317, 270, 319, 359, 359, - /* 1830 */ 359, 359, 309, 359, 278, 312, 313, 314, 315, 316, - /* 1840 */ 317, 270, 319, 359, 288, 359, 359, 359, 292, 278, - /* 1850 */ 359, 359, 359, 242, 359, 359, 359, 359, 359, 288, - /* 1860 */ 359, 359, 359, 292, 359, 309, 359, 359, 312, 313, - /* 1870 */ 314, 315, 316, 317, 359, 319, 359, 359, 359, 359, - /* 1880 */ 309, 270, 359, 312, 313, 314, 315, 316, 317, 278, - /* 1890 */ 319, 359, 359, 242, 359, 359, 359, 359, 359, 288, - /* 1900 */ 359, 359, 359, 292, 242, 359, 359, 359, 359, 359, - /* 1910 */ 359, 359, 359, 359, 359, 359, 359, 359, 359, 359, - /* 1920 */ 309, 270, 359, 312, 313, 314, 315, 316, 317, 278, - /* 1930 */ 319, 359, 270, 359, 359, 359, 359, 359, 359, 288, - /* 1940 */ 278, 359, 359, 292, 242, 359, 359, 359, 359, 359, - /* 1950 */ 288, 359, 359, 359, 292, 359, 359, 242, 359, 359, - /* 1960 */ 309, 359, 359, 312, 313, 314, 315, 316, 317, 359, - /* 1970 */ 319, 309, 270, 359, 312, 313, 314, 315, 316, 317, - /* 1980 */ 278, 319, 359, 359, 359, 270, 359, 359, 359, 359, - /* 1990 */ 288, 359, 359, 278, 292, 359, 359, 359, 359, 359, - /* 2000 */ 359, 359, 359, 288, 359, 359, 359, 292, 242, 359, - /* 2010 */ 359, 309, 359, 359, 312, 313, 314, 315, 316, 317, - /* 2020 */ 359, 319, 359, 359, 309, 359, 359, 312, 313, 314, - /* 2030 */ 315, 316, 317, 359, 319, 359, 270, 359, 249, 359, - /* 2040 */ 359, 242, 359, 359, 278, 359, 359, 359, 359, 359, - /* 2050 */ 359, 359, 359, 359, 288, 359, 359, 359, 292, 359, - /* 2060 */ 359, 359, 359, 359, 359, 359, 359, 278, 359, 270, - /* 2070 */ 359, 359, 359, 359, 359, 309, 359, 278, 312, 313, - /* 2080 */ 314, 315, 316, 317, 359, 319, 297, 288, 359, 359, - /* 2090 */ 359, 292, 359, 359, 359, 359, 359, 359, 359, 359, - /* 2100 */ 359, 359, 359, 359, 359, 316, 359, 359, 309, 359, - /* 2110 */ 359, 312, 313, 314, 315, 316, 317, 359, 319, 359, - /* 2120 */ 331, 332, 333, 359, 335, 359, 359, 338, 359, 359, - /* 2130 */ 359, 359, 359, 359, 359, 359, 359, 359, 359, 350, - /* 2140 */ 359, 359, 359, 354, + /* 700 */ 194, 195, 196, 197, 198, 139, 18, 82, 243, 293, + /* 710 */ 271, 23, 259, 250, 261, 37, 272, 250, 279, 0, + /* 720 */ 20, 250, 298, 35, 36, 262, 160, 39, 289, 262, + /* 730 */ 185, 250, 293, 262, 293, 250, 12, 13, 14, 15, + /* 740 */ 16, 243, 279, 262, 56, 243, 279, 262, 243, 310, + /* 750 */ 279, 41, 313, 314, 315, 316, 317, 318, 293, 320, + /* 760 */ 279, 243, 323, 339, 279, 199, 327, 328, 329, 81, + /* 770 */ 12, 13, 14, 15, 16, 351, 271, 0, 250, 355, + /* 780 */ 341, 250, 58, 271, 279, 346, 347, 93, 250, 243, + /* 790 */ 262, 293, 280, 262, 289, 293, 85, 243, 293, 88, + /* 800 */ 262, 296, 243, 243, 243, 117, 82, 279, 243, 115, + /* 810 */ 279, 293, 93, 41, 90, 310, 58, 279, 313, 314, + /* 820 */ 315, 316, 317, 318, 58, 320, 209, 210, 250, 272, + /* 830 */ 21, 112, 271, 114, 115, 116, 148, 149, 150, 293, + /* 840 */ 279, 153, 260, 34, 271, 145, 158, 293, 90, 41, + /* 850 */ 289, 185, 293, 293, 293, 243, 283, 279, 293, 171, + /* 860 */ 22, 358, 174, 139, 176, 177, 178, 179, 180, 212, + /* 870 */ 93, 310, 0, 47, 313, 314, 315, 316, 317, 318, + /* 880 */ 319, 320, 321, 322, 160, 47, 243, 0, 210, 112, + /* 890 */ 82, 114, 115, 116, 22, 317, 41, 139, 85, 211, + /* 900 */ 85, 88, 64, 88, 85, 293, 243, 88, 41, 22, + /* 910 */ 332, 333, 334, 0, 336, 1, 2, 44, 160, 196, + /* 920 */ 197, 349, 47, 199, 200, 201, 202, 203, 204, 205, + /* 930 */ 206, 207, 208, 41, 271, 22, 293, 82, 228, 113, + /* 940 */ 81, 103, 279, 41, 41, 306, 41, 181, 41, 82, + /* 950 */ 91, 113, 289, 343, 81, 271, 293, 199, 200, 201, + /* 960 */ 202, 203, 204, 205, 206, 207, 208, 41, 243, 249, + /* 970 */ 41, 282, 41, 310, 82, 41, 313, 314, 315, 316, + /* 980 */ 317, 318, 47, 320, 82, 82, 323, 82, 113, 82, + /* 990 */ 327, 328, 329, 41, 156, 251, 271, 312, 337, 64, + /* 1000 */ 243, 352, 230, 41, 279, 352, 41, 352, 82, 340, + /* 1010 */ 347, 82, 213, 82, 289, 41, 82, 41, 293, 181, + /* 1020 */ 182, 308, 20, 250, 45, 307, 257, 47, 271, 300, + /* 1030 */ 154, 250, 250, 287, 82, 310, 279, 40, 313, 314, + /* 1040 */ 315, 316, 317, 318, 82, 320, 289, 82, 323, 139, + /* 1050 */ 293, 250, 327, 328, 329, 285, 82, 20, 82, 285, + /* 1060 */ 243, 245, 20, 338, 304, 245, 255, 310, 289, 255, + /* 1070 */ 313, 314, 315, 316, 317, 318, 20, 320, 20, 299, + /* 1080 */ 323, 297, 255, 297, 327, 328, 329, 255, 271, 279, + /* 1090 */ 20, 255, 243, 290, 255, 338, 279, 250, 255, 245, + /* 1100 */ 271, 271, 271, 250, 271, 271, 289, 245, 271, 64, + /* 1110 */ 293, 271, 271, 271, 293, 271, 271, 293, 253, 163, + /* 1120 */ 271, 253, 304, 253, 289, 303, 20, 310, 279, 250, + /* 1130 */ 313, 314, 315, 316, 317, 318, 279, 320, 289, 253, + /* 1140 */ 323, 219, 293, 243, 327, 328, 329, 298, 297, 293, + /* 1150 */ 290, 218, 348, 348, 293, 338, 147, 294, 312, 310, + /* 1160 */ 294, 225, 313, 314, 315, 316, 317, 318, 345, 320, + /* 1170 */ 293, 271, 344, 243, 214, 279, 210, 308, 20, 279, + /* 1180 */ 40, 232, 311, 229, 227, 81, 291, 294, 339, 289, + /* 1190 */ 342, 293, 293, 293, 330, 294, 142, 293, 298, 279, + /* 1200 */ 351, 271, 290, 353, 355, 267, 243, 279, 326, 279, + /* 1210 */ 310, 359, 354, 313, 314, 315, 316, 317, 318, 289, + /* 1220 */ 320, 253, 253, 293, 81, 275, 253, 250, 354, 245, + /* 1230 */ 305, 353, 261, 353, 271, 354, 243, 265, 301, 339, + /* 1240 */ 310, 254, 279, 313, 314, 315, 316, 317, 318, 241, + /* 1250 */ 320, 351, 289, 323, 265, 355, 293, 327, 328, 265, + /* 1260 */ 0, 0, 40, 0, 271, 72, 0, 47, 175, 175, + /* 1270 */ 47, 47, 279, 310, 47, 0, 313, 314, 315, 316, + /* 1280 */ 317, 318, 289, 320, 47, 47, 293, 243, 175, 0, + /* 1290 */ 175, 0, 47, 0, 47, 0, 243, 47, 0, 81, + /* 1300 */ 113, 160, 156, 310, 159, 0, 313, 314, 315, 316, + /* 1310 */ 317, 318, 0, 320, 152, 271, 323, 151, 0, 356, + /* 1320 */ 357, 328, 0, 279, 271, 44, 0, 0, 0, 0, + /* 1330 */ 0, 0, 279, 289, 0, 0, 0, 293, 0, 0, + /* 1340 */ 0, 0, 289, 0, 0, 0, 293, 0, 0, 40, + /* 1350 */ 243, 0, 0, 0, 310, 0, 0, 313, 314, 315, + /* 1360 */ 316, 317, 318, 310, 320, 0, 313, 314, 315, 316, + /* 1370 */ 317, 318, 22, 320, 0, 0, 0, 0, 271, 0, + /* 1380 */ 0, 14, 40, 37, 14, 0, 279, 0, 0, 0, + /* 1390 */ 243, 147, 0, 44, 350, 41, 289, 38, 37, 37, + /* 1400 */ 293, 44, 0, 296, 90, 37, 243, 0, 0, 0, + /* 1410 */ 357, 0, 0, 47, 45, 37, 45, 310, 271, 59, + /* 1420 */ 313, 314, 315, 316, 317, 318, 279, 320, 47, 47, + /* 1430 */ 37, 45, 37, 0, 271, 37, 289, 47, 0, 45, + /* 1440 */ 293, 0, 279, 0, 0, 22, 88, 47, 0, 0, + /* 1450 */ 47, 41, 289, 47, 243, 41, 293, 310, 22, 296, + /* 1460 */ 313, 314, 315, 316, 317, 318, 0, 320, 47, 322, + /* 1470 */ 48, 47, 47, 310, 47, 47, 313, 314, 315, 316, + /* 1480 */ 317, 318, 271, 320, 22, 0, 243, 22, 0, 47, + /* 1490 */ 279, 33, 0, 22, 22, 20, 0, 47, 0, 22, + /* 1500 */ 289, 0, 0, 45, 293, 0, 0, 296, 145, 51, + /* 1510 */ 52, 53, 54, 55, 271, 81, 243, 37, 145, 41, + /* 1520 */ 41, 310, 279, 140, 313, 314, 315, 316, 317, 318, + /* 1530 */ 215, 320, 289, 161, 82, 41, 293, 82, 80, 142, + /* 1540 */ 81, 83, 81, 44, 271, 81, 145, 44, 41, 82, + /* 1550 */ 81, 41, 279, 310, 41, 82, 313, 314, 315, 316, + /* 1560 */ 317, 318, 289, 320, 44, 82, 293, 243, 44, 82, + /* 1570 */ 41, 82, 47, 47, 47, 47, 2, 47, 47, 41, + /* 1580 */ 181, 44, 82, 310, 44, 81, 313, 314, 315, 316, + /* 1590 */ 317, 318, 81, 320, 82, 271, 81, 22, 140, 215, + /* 1600 */ 142, 183, 144, 279, 146, 209, 215, 243, 0, 37, + /* 1610 */ 91, 143, 44, 289, 82, 81, 81, 293, 82, 22, + /* 1620 */ 81, 140, 164, 81, 81, 44, 81, 47, 82, 81, + /* 1630 */ 81, 113, 82, 92, 310, 271, 47, 313, 314, 315, + /* 1640 */ 316, 317, 318, 279, 320, 81, 47, 243, 82, 82, + /* 1650 */ 81, 47, 81, 289, 47, 82, 47, 293, 81, 105, + /* 1660 */ 82, 105, 243, 81, 105, 105, 81, 22, 81, 93, + /* 1670 */ 47, 81, 22, 58, 310, 271, 59, 313, 314, 315, + /* 1680 */ 316, 317, 318, 279, 320, 47, 64, 41, 47, 79, + /* 1690 */ 271, 22, 64, 289, 47, 47, 47, 293, 279, 47, + /* 1700 */ 47, 47, 47, 47, 47, 47, 47, 47, 289, 47, + /* 1710 */ 0, 47, 293, 243, 310, 45, 37, 313, 314, 315, + /* 1720 */ 316, 317, 318, 0, 320, 243, 45, 47, 37, 310, + /* 1730 */ 0, 47, 313, 314, 315, 316, 317, 318, 45, 320, + /* 1740 */ 37, 271, 47, 45, 37, 0, 47, 46, 0, 279, + /* 1750 */ 0, 0, 21, 271, 22, 22, 22, 21, 20, 289, + /* 1760 */ 360, 279, 360, 293, 360, 243, 360, 360, 360, 360, + /* 1770 */ 360, 289, 360, 360, 360, 293, 243, 360, 360, 360, + /* 1780 */ 310, 360, 360, 313, 314, 315, 316, 317, 318, 360, + /* 1790 */ 320, 360, 310, 271, 360, 313, 314, 315, 316, 317, + /* 1800 */ 318, 279, 320, 360, 271, 360, 360, 360, 360, 360, + /* 1810 */ 360, 289, 279, 360, 360, 293, 360, 360, 360, 360, + /* 1820 */ 360, 360, 289, 360, 360, 360, 293, 243, 360, 360, + /* 1830 */ 360, 360, 310, 360, 360, 313, 314, 315, 316, 317, + /* 1840 */ 318, 360, 320, 310, 360, 360, 313, 314, 315, 316, + /* 1850 */ 317, 318, 360, 320, 360, 271, 360, 243, 360, 360, + /* 1860 */ 360, 360, 360, 279, 360, 360, 360, 360, 360, 360, + /* 1870 */ 360, 360, 360, 289, 360, 360, 360, 293, 360, 360, + /* 1880 */ 360, 360, 360, 360, 360, 271, 360, 243, 360, 360, + /* 1890 */ 360, 360, 360, 279, 310, 360, 360, 313, 314, 315, + /* 1900 */ 316, 317, 318, 289, 320, 360, 360, 293, 360, 360, + /* 1910 */ 360, 360, 360, 360, 360, 271, 360, 360, 360, 243, + /* 1920 */ 360, 360, 360, 279, 310, 360, 360, 313, 314, 315, + /* 1930 */ 316, 317, 318, 289, 320, 360, 360, 293, 360, 360, + /* 1940 */ 360, 360, 360, 12, 13, 360, 360, 271, 360, 360, + /* 1950 */ 360, 360, 243, 22, 310, 279, 360, 313, 314, 315, + /* 1960 */ 316, 317, 318, 360, 320, 289, 360, 360, 360, 293, + /* 1970 */ 360, 360, 360, 360, 360, 360, 360, 360, 47, 360, + /* 1980 */ 271, 360, 360, 360, 360, 243, 310, 360, 279, 313, + /* 1990 */ 314, 315, 316, 317, 318, 64, 320, 360, 289, 360, + /* 2000 */ 360, 360, 293, 360, 360, 360, 360, 360, 360, 360, + /* 2010 */ 360, 360, 360, 271, 360, 360, 250, 360, 360, 310, + /* 2020 */ 360, 279, 313, 314, 315, 316, 317, 318, 360, 320, + /* 2030 */ 360, 289, 360, 360, 103, 293, 360, 360, 360, 360, + /* 2040 */ 360, 360, 360, 360, 113, 279, 250, 360, 360, 360, + /* 2050 */ 360, 360, 310, 360, 360, 313, 314, 315, 316, 317, + /* 2060 */ 318, 360, 320, 360, 298, 360, 360, 360, 360, 360, + /* 2070 */ 360, 360, 360, 360, 360, 279, 360, 360, 360, 360, + /* 2080 */ 360, 360, 360, 317, 360, 360, 360, 156, 360, 360, + /* 2090 */ 360, 360, 360, 360, 298, 360, 360, 360, 332, 333, + /* 2100 */ 334, 360, 336, 360, 360, 339, 360, 360, 360, 360, + /* 2110 */ 360, 360, 181, 317, 360, 360, 360, 351, 360, 360, + /* 2120 */ 360, 355, 360, 192, 193, 194, 360, 360, 332, 333, + /* 2130 */ 334, 360, 336, 360, 360, 339, 360, 360, 360, 360, + /* 2140 */ 360, 360, 360, 360, 360, 360, 360, 351, 360, 360, + /* 2150 */ 360, 355, 360, 360, 360, 360, 360, 360, 360, 360, + /* 2160 */ 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + /* 2170 */ 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + /* 2180 */ 360, 360, 360, 360, }; -#define YY_SHIFT_COUNT (617) +#define YY_SHIFT_COUNT (618) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (1722) +#define YY_SHIFT_MAX (1931) static const unsigned short int yy_shift_ofst[] = { - /* 0 */ 571, 0, 0, 48, 96, 96, 96, 96, 253, 253, + /* 0 */ 688, 0, 0, 48, 96, 96, 96, 96, 253, 253, /* 10 */ 96, 96, 301, 349, 506, 349, 349, 349, 349, 349, /* 20 */ 349, 349, 349, 349, 349, 349, 349, 349, 349, 349, - /* 30 */ 349, 349, 349, 349, 349, 349, 349, 349, 126, 126, - /* 40 */ 231, 231, 231, 1449, 1449, 1449, 1449, 261, 312, 193, - /* 50 */ 74, 74, 178, 178, 144, 193, 193, 74, 74, 74, - /* 60 */ 74, 74, 74, 74, 50, 74, 74, 102, 282, 482, - /* 70 */ 102, 74, 74, 102, 74, 102, 102, 482, 102, 74, - /* 80 */ 329, 542, 694, 722, 722, 187, 236, 855, 855, 855, - /* 90 */ 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, - /* 100 */ 855, 855, 855, 855, 855, 855, 305, 335, 408, 408, - /* 110 */ 263, 406, 370, 370, 370, 423, 406, 511, 482, 102, - /* 120 */ 102, 482, 520, 696, 1039, 1039, 1039, 1039, 1039, 1039, - /* 130 */ 1039, 1312, 141, 400, 76, 287, 57, 216, 538, 581, - /* 140 */ 675, 596, 700, 628, 580, 621, 580, 680, 680, 680, - /* 150 */ 726, 695, 739, 934, 915, 914, 811, 934, 934, 944, - /* 160 */ 847, 847, 934, 972, 972, 979, 50, 482, 50, 996, - /* 170 */ 1002, 50, 996, 50, 511, 1009, 50, 50, 934, 50, - /* 180 */ 972, 102, 102, 102, 102, 102, 102, 102, 102, 102, - /* 190 */ 102, 102, 934, 972, 985, 979, 329, 911, 482, 329, - /* 200 */ 934, 996, 329, 511, 1009, 329, 1063, 881, 883, 985, - /* 210 */ 881, 883, 985, 985, 102, 880, 961, 898, 739, 901, - /* 220 */ 511, 1107, 1088, 903, 906, 922, 903, 906, 903, 906, - /* 230 */ 1071, 883, 985, 985, 883, 985, 1025, 511, 1009, 329, - /* 240 */ 520, 329, 511, 1100, 696, 934, 329, 972, 2144, 2144, - /* 250 */ 2144, 2144, 2144, 2144, 2144, 563, 1124, 230, 830, 3, - /* 260 */ 19, 314, 234, 255, 363, 464, 112, 112, 112, 112, - /* 270 */ 112, 112, 112, 112, 86, 127, 444, 55, 499, 221, - /* 280 */ 392, 392, 392, 392, 227, 394, 657, 706, 718, 732, - /* 290 */ 779, 816, 818, 803, 658, 801, 802, 804, 846, 655, - /* 300 */ 37, 644, 805, 275, 825, 795, 826, 827, 833, 850, - /* 310 */ 863, 817, 831, 865, 870, 875, 877, 897, 900, 321, - /* 320 */ 518, 1202, 1203, 1165, 1206, 1136, 1211, 1167, 1038, 1168, - /* 330 */ 1169, 1170, 1045, 1220, 1174, 1175, 1049, 1224, 1051, 1226, - /* 340 */ 1180, 1229, 1184, 1239, 1195, 1244, 1164, 1086, 1092, 1149, - /* 350 */ 1109, 1263, 1267, 1119, 1121, 1273, 1274, 1231, 1276, 1279, - /* 360 */ 1280, 1281, 1282, 1283, 1284, 1285, 1289, 1290, 1292, 1293, - /* 370 */ 1294, 1295, 1297, 1298, 1299, 1301, 1262, 1303, 1304, 1305, - /* 380 */ 1306, 1307, 1309, 1288, 1319, 1326, 1328, 1329, 1333, 1334, - /* 390 */ 1296, 1300, 1302, 1324, 1308, 1325, 1314, 1340, 1310, 1313, - /* 400 */ 1342, 1344, 1346, 1316, 1200, 1349, 1351, 1322, 1356, 1311, - /* 410 */ 1361, 1362, 1327, 1330, 1335, 1371, 1332, 1331, 1336, 1380, - /* 420 */ 1337, 1338, 1352, 1381, 1339, 1343, 1353, 1394, 1396, 1397, - /* 430 */ 1398, 1320, 1345, 1354, 1378, 1417, 1372, 1373, 1375, 1376, - /* 440 */ 1383, 1384, 1379, 1385, 1387, 1427, 1408, 1431, 1413, 1388, - /* 450 */ 1437, 1418, 1391, 1441, 1420, 1444, 1423, 1426, 1447, 1341, - /* 460 */ 1402, 1450, 1317, 1429, 1347, 1315, 1454, 1455, 1458, 1348, - /* 470 */ 1459, 1392, 1432, 1350, 1434, 1436, 1265, 1390, 1440, 1400, - /* 480 */ 1404, 1406, 1410, 1401, 1448, 1451, 1453, 1425, 1460, 1321, - /* 490 */ 1412, 1421, 1464, 1291, 1463, 1465, 1428, 1470, 1323, 1433, - /* 500 */ 1467, 1469, 1471, 1474, 1484, 1485, 1433, 1515, 1359, 1492, - /* 510 */ 1456, 1461, 1462, 1496, 1466, 1468, 1497, 1521, 1363, 1483, - /* 520 */ 1486, 1487, 1495, 1498, 1405, 1499, 1565, 1529, 1438, 1500, - /* 530 */ 1491, 1539, 1540, 1504, 1505, 1509, 1564, 1510, 1501, 1507, - /* 540 */ 1545, 1547, 1514, 1516, 1550, 1518, 1519, 1555, 1522, 1525, - /* 550 */ 1557, 1527, 1530, 1562, 1533, 1511, 1512, 1513, 1517, 1593, - /* 560 */ 1526, 1542, 1543, 1573, 1544, 1531, 1599, 1567, 1580, 1596, - /* 570 */ 1581, 1569, 1608, 1605, 1606, 1607, 1609, 1612, 1633, 1613, - /* 580 */ 1615, 1594, 1383, 1616, 1384, 1619, 1621, 1622, 1629, 1642, - /* 590 */ 1643, 1680, 1644, 1648, 1658, 1696, 1652, 1653, 1665, 1703, - /* 600 */ 1657, 1660, 1669, 1707, 1661, 1664, 1674, 1712, 1668, 1670, - /* 610 */ 1719, 1720, 1705, 1708, 1711, 1718, 1709, 1722, + /* 30 */ 349, 349, 349, 349, 349, 349, 349, 349, 144, 144, + /* 40 */ 102, 102, 102, 1931, 1931, 1931, 1931, 372, 124, 214, + /* 50 */ 58, 58, 260, 260, 172, 214, 214, 58, 58, 58, + /* 60 */ 58, 58, 58, 58, 37, 58, 58, 186, 228, 259, + /* 70 */ 186, 58, 58, 186, 58, 186, 186, 259, 186, 58, + /* 80 */ 255, 542, 724, 758, 758, 189, 236, 838, 838, 838, + /* 90 */ 838, 838, 838, 838, 838, 838, 838, 838, 838, 838, + /* 100 */ 838, 838, 838, 838, 838, 838, 291, 126, 354, 354, + /* 110 */ 397, 516, 483, 483, 483, 525, 516, 313, 259, 186, + /* 120 */ 186, 259, 377, 343, 243, 243, 243, 243, 243, 243, + /* 130 */ 243, 340, 141, 405, 76, 195, 57, 215, 500, 545, + /* 140 */ 579, 179, 694, 700, 617, 678, 617, 455, 455, 455, + /* 150 */ 657, 666, 799, 1002, 979, 980, 876, 1002, 1002, 997, + /* 160 */ 910, 910, 1002, 1037, 1037, 1042, 37, 259, 37, 1056, + /* 170 */ 1058, 37, 1056, 37, 313, 1070, 37, 37, 1002, 37, + /* 180 */ 1037, 186, 186, 186, 186, 186, 186, 186, 186, 186, + /* 190 */ 186, 186, 1002, 1037, 1045, 1045, 1042, 255, 956, 259, + /* 200 */ 255, 1002, 1056, 255, 313, 1070, 255, 1106, 922, 933, + /* 210 */ 1045, 922, 933, 1045, 1045, 186, 936, 1009, 960, 799, + /* 220 */ 966, 313, 1158, 1140, 954, 957, 949, 954, 957, 954, + /* 230 */ 957, 1104, 933, 1045, 1045, 933, 1045, 1054, 313, 1070, + /* 240 */ 255, 377, 255, 313, 1143, 343, 1002, 255, 1037, 2152, + /* 250 */ 2152, 2152, 2152, 2152, 2152, 2152, 577, 1458, 231, 353, + /* 260 */ 3, 19, 316, 256, 496, 719, 777, 112, 112, 112, + /* 270 */ 112, 112, 112, 112, 112, 135, 438, 344, 396, 355, + /* 280 */ 625, 566, 642, 642, 642, 642, 555, 808, 711, 813, + /* 290 */ 815, 819, 872, 887, 913, 809, 855, 867, 892, 914, + /* 300 */ 723, 710, 772, 902, 766, 903, 873, 905, 907, 926, + /* 310 */ 929, 931, 826, 875, 934, 952, 962, 965, 974, 976, + /* 320 */ 859, 935, 1260, 1261, 1222, 1263, 1193, 1266, 1220, 1093, + /* 330 */ 1223, 1224, 1227, 1094, 1275, 1237, 1238, 1113, 1289, 1115, + /* 340 */ 1291, 1245, 1293, 1247, 1295, 1250, 1298, 1218, 1141, 1145, + /* 350 */ 1187, 1146, 1305, 1312, 1162, 1166, 1318, 1322, 1281, 1326, + /* 360 */ 1327, 1328, 1329, 1330, 1331, 1334, 1335, 1336, 1338, 1339, + /* 370 */ 1340, 1341, 1343, 1344, 1345, 1347, 1348, 1309, 1351, 1352, + /* 380 */ 1353, 1355, 1356, 1365, 1350, 1374, 1375, 1376, 1377, 1379, + /* 390 */ 1380, 1342, 1346, 1354, 1367, 1349, 1370, 1357, 1385, 1359, + /* 400 */ 1361, 1387, 1388, 1389, 1362, 1244, 1392, 1402, 1368, 1407, + /* 410 */ 1360, 1408, 1409, 1366, 1369, 1378, 1411, 1381, 1371, 1393, + /* 420 */ 1412, 1382, 1386, 1395, 1433, 1390, 1394, 1398, 1438, 1441, + /* 430 */ 1443, 1444, 1314, 1358, 1400, 1423, 1448, 1403, 1406, 1421, + /* 440 */ 1424, 1410, 1414, 1425, 1427, 1428, 1449, 1436, 1466, 1462, + /* 450 */ 1422, 1485, 1465, 1442, 1488, 1471, 1492, 1472, 1475, 1496, + /* 460 */ 1363, 1450, 1498, 1372, 1477, 1373, 1397, 1501, 1502, 1505, + /* 470 */ 1401, 1506, 1434, 1480, 1383, 1478, 1479, 1315, 1452, 1494, + /* 480 */ 1455, 1459, 1461, 1464, 1467, 1507, 1499, 1503, 1469, 1510, + /* 490 */ 1384, 1473, 1483, 1520, 1396, 1513, 1524, 1487, 1529, 1391, + /* 500 */ 1489, 1525, 1526, 1527, 1528, 1530, 1531, 1489, 1574, 1399, + /* 510 */ 1538, 1500, 1504, 1512, 1537, 1511, 1515, 1540, 1575, 1418, + /* 520 */ 1534, 1532, 1536, 1535, 1539, 1468, 1542, 1608, 1572, 1481, + /* 530 */ 1543, 1519, 1568, 1581, 1545, 1546, 1548, 1597, 1549, 1541, + /* 540 */ 1550, 1580, 1589, 1564, 1566, 1599, 1569, 1567, 1604, 1571, + /* 550 */ 1573, 1607, 1577, 1578, 1609, 1582, 1554, 1556, 1559, 1560, + /* 560 */ 1645, 1576, 1585, 1587, 1623, 1590, 1518, 1650, 1617, 1615, + /* 570 */ 1638, 1622, 1610, 1646, 1641, 1647, 1648, 1649, 1652, 1669, + /* 580 */ 1653, 1654, 1628, 1410, 1655, 1414, 1656, 1657, 1658, 1659, + /* 590 */ 1660, 1662, 1710, 1664, 1670, 1679, 1723, 1680, 1681, 1691, + /* 600 */ 1730, 1684, 1693, 1703, 1750, 1695, 1698, 1707, 1745, 1699, + /* 610 */ 1701, 1748, 1751, 1732, 1731, 1733, 1734, 1736, 1738, }; -#define YY_REDUCE_COUNT (254) -#define YY_REDUCE_MIN (-323) -#define YY_REDUCE_MAX (1799) +#define YY_REDUCE_COUNT (255) +#define YY_REDUCE_MIN (-324) +#define YY_REDUCE_MAX (1796) static const short yy_reduce_ofst[] = { - /* 0 */ 14, -240, 61, 483, 543, 661, 693, 725, 776, 806, - /* 10 */ -177, 921, 940, 999, 1008, 1090, 1099, 1151, 1210, 1242, - /* 20 */ 1258, 1318, 1358, 1369, 1409, 1422, 1475, 1508, 1523, 1556, - /* 30 */ 1571, 1611, 1651, 1662, 1702, 1715, 1766, 1799, 1416, 1789, - /* 40 */ 94, -212, 435, -269, -265, -263, -175, -283, -3, 47, - /* 50 */ 306, 307, -90, -42, -254, -191, 67, -225, -198, 46, - /* 60 */ 205, 310, 337, 343, 65, 342, 344, 68, 233, -189, - /* 70 */ 242, 455, 462, 243, 465, 338, 284, 171, 380, 478, - /* 80 */ -224, -241, -323, -323, -323, -65, 63, 272, 281, 354, - /* 90 */ 355, 357, 369, 439, 440, 463, 470, 486, 512, 515, - /* 100 */ 522, 527, 530, 535, 540, 544, -117, -246, 302, 367, - /* 110 */ -123, -231, -251, 449, 453, 73, 260, 366, 289, 375, - /* 120 */ 332, 262, 390, 397, -260, 487, 503, 519, 537, 570, - /* 130 */ 573, 552, 629, 622, 531, 564, 585, 572, 647, 647, - /* 140 */ 685, 684, 659, 625, 606, 606, 606, 592, 595, 597, - /* 150 */ 611, 647, 648, 707, 656, 708, 667, 720, 723, 704, - /* 160 */ 709, 710, 742, 752, 753, 697, 747, 716, 760, 727, - /* 170 */ 728, 770, 729, 773, 750, 743, 777, 789, 784, 791, - /* 180 */ 812, 780, 785, 787, 788, 790, 793, 796, 797, 799, - /* 190 */ 800, 807, 810, 821, 769, 768, 820, 778, 794, 823, - /* 200 */ 829, 783, 834, 809, 792, 844, 786, 754, 813, 815, - /* 210 */ 755, 819, 824, 832, 647, 761, 766, 772, 822, 606, - /* 220 */ 839, 841, 835, 808, 814, 828, 836, 838, 840, 842, - /* 230 */ 837, 861, 866, 867, 862, 873, 878, 892, 882, 920, - /* 240 */ 907, 928, 896, 909, 924, 936, 935, 948, 888, 891, - /* 250 */ 932, 933, 937, 945, 960, + /* 0 */ 162, -241, 278, 439, 663, 725, 757, 817, 849, 900, + /* 10 */ -178, 930, 561, 963, 993, 505, 1044, 1053, 1107, 1147, + /* 20 */ 1163, 1211, 1243, 1273, 1324, 1364, 1404, 1419, 1470, 1482, + /* 30 */ 1522, 1533, 1584, 1614, 1644, 1676, 1709, 1742, 1766, 1796, + /* 40 */ 282, -213, 578, -270, -266, -264, -176, -284, 281, 424, + /* 50 */ 306, 362, -91, -46, -255, -192, 71, -226, -199, 150, + /* 60 */ 302, 324, 463, 467, -1, 471, 485, 28, 45, -190, + /* 70 */ 56, 528, 531, 197, 481, 192, 352, 100, 196, 538, + /* 80 */ -225, -242, -324, -324, -324, -64, -48, 77, 168, 257, + /* 90 */ 311, 315, 341, 416, 441, 465, 498, 502, 518, 546, + /* 100 */ 554, 559, 560, 565, 612, 643, 97, -247, 75, 140, + /* 110 */ -125, -232, -252, -204, -37, -100, 106, 142, 394, 512, + /* 120 */ 573, 218, 284, 453, -261, 294, 325, 330, 335, 444, + /* 130 */ 557, 271, 381, 582, 503, 572, 639, 610, 684, 684, + /* 140 */ 720, 744, 689, 685, 661, 661, 661, 649, 653, 655, + /* 150 */ 669, 684, 713, 773, 718, 769, 729, 781, 782, 746, + /* 160 */ 770, 774, 801, 816, 820, 760, 811, 779, 814, 784, + /* 170 */ 780, 827, 786, 832, 810, 803, 836, 839, 847, 843, + /* 180 */ 854, 829, 830, 831, 833, 834, 837, 840, 841, 842, + /* 190 */ 844, 845, 853, 862, 821, 824, 818, 865, 822, 835, + /* 200 */ 868, 879, 851, 870, 857, 860, 886, 846, 804, 863, + /* 210 */ 856, 805, 866, 861, 877, 684, 823, 828, 848, 869, + /* 220 */ 661, 896, 871, 864, 858, 850, 852, 874, 878, 881, + /* 230 */ 880, 882, 893, 898, 899, 901, 904, 895, 920, 912, + /* 240 */ 968, 938, 969, 928, 950, 971, 977, 973, 984, 937, + /* 250 */ 925, 972, 989, 994, 987, 1008, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, - /* 10 */ 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, - /* 20 */ 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, - /* 30 */ 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, - /* 40 */ 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, - /* 50 */ 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, - /* 60 */ 1357, 1357, 1357, 1357, 1426, 1357, 1357, 1357, 1357, 1357, - /* 70 */ 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, - /* 80 */ 1424, 1564, 1357, 1730, 1357, 1357, 1357, 1357, 1357, 1357, - /* 90 */ 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, - /* 100 */ 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, - /* 110 */ 1426, 1357, 1741, 1741, 1741, 1424, 1357, 1357, 1357, 1357, - /* 120 */ 1357, 1357, 1520, 1357, 1357, 1357, 1357, 1357, 1357, 1357, - /* 130 */ 1357, 1600, 1357, 1357, 1807, 1357, 1606, 1765, 1357, 1357, - /* 140 */ 1357, 1357, 1473, 1757, 1733, 1747, 1734, 1792, 1792, 1792, - /* 150 */ 1750, 1357, 1761, 1357, 1357, 1357, 1592, 1357, 1357, 1569, - /* 160 */ 1566, 1566, 1357, 1357, 1357, 1357, 1426, 1357, 1426, 1357, - /* 170 */ 1357, 1426, 1357, 1426, 1357, 1357, 1426, 1426, 1357, 1426, - /* 180 */ 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, - /* 190 */ 1357, 1357, 1357, 1357, 1357, 1357, 1424, 1602, 1357, 1424, - /* 200 */ 1357, 1357, 1424, 1357, 1357, 1424, 1357, 1772, 1770, 1357, - /* 210 */ 1772, 1770, 1357, 1357, 1357, 1784, 1780, 1763, 1761, 1747, - /* 220 */ 1357, 1357, 1357, 1798, 1794, 1810, 1798, 1794, 1798, 1794, - /* 230 */ 1357, 1770, 1357, 1357, 1770, 1357, 1577, 1357, 1357, 1424, - /* 240 */ 1357, 1424, 1357, 1489, 1357, 1357, 1424, 1357, 1594, 1608, - /* 250 */ 1523, 1523, 1523, 1427, 1362, 1357, 1357, 1357, 1357, 1357, - /* 260 */ 1357, 1357, 1357, 1357, 1357, 1357, 1674, 1783, 1782, 1706, - /* 270 */ 1705, 1704, 1702, 1673, 1485, 1357, 1357, 1357, 1357, 1357, - /* 280 */ 1667, 1668, 1666, 1665, 1357, 1357, 1357, 1357, 1357, 1357, - /* 290 */ 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1731, 1357, - /* 300 */ 1795, 1799, 1357, 1357, 1357, 1650, 1357, 1357, 1357, 1357, - /* 310 */ 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, - /* 320 */ 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, - /* 330 */ 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, - /* 340 */ 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, - /* 350 */ 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, - /* 360 */ 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, - /* 370 */ 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, - /* 380 */ 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, - /* 390 */ 1357, 1357, 1391, 1357, 1357, 1357, 1357, 1357, 1357, 1357, - /* 400 */ 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, - /* 410 */ 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, - /* 420 */ 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, - /* 430 */ 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, - /* 440 */ 1454, 1453, 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, - /* 450 */ 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, - /* 460 */ 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, - /* 470 */ 1357, 1357, 1357, 1357, 1754, 1764, 1357, 1357, 1357, 1357, - /* 480 */ 1357, 1357, 1357, 1357, 1357, 1357, 1650, 1357, 1781, 1357, - /* 490 */ 1740, 1736, 1357, 1357, 1732, 1357, 1357, 1793, 1357, 1357, - /* 500 */ 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1726, 1357, 1699, - /* 510 */ 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1661, 1357, - /* 520 */ 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, - /* 530 */ 1357, 1649, 1357, 1690, 1357, 1357, 1357, 1357, 1357, 1357, - /* 540 */ 1357, 1357, 1517, 1357, 1357, 1357, 1357, 1357, 1357, 1357, - /* 550 */ 1357, 1357, 1357, 1357, 1357, 1502, 1500, 1499, 1498, 1357, - /* 560 */ 1495, 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, - /* 570 */ 1357, 1357, 1446, 1357, 1357, 1357, 1357, 1357, 1357, 1357, - /* 580 */ 1357, 1357, 1437, 1357, 1436, 1357, 1357, 1357, 1357, 1357, - /* 590 */ 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, - /* 600 */ 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, - /* 610 */ 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, + /* 0 */ 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, + /* 10 */ 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, + /* 20 */ 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, + /* 30 */ 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, + /* 40 */ 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, + /* 50 */ 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, + /* 60 */ 1360, 1360, 1360, 1360, 1429, 1360, 1360, 1360, 1360, 1360, + /* 70 */ 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, + /* 80 */ 1427, 1567, 1360, 1734, 1360, 1360, 1360, 1360, 1360, 1360, + /* 90 */ 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, + /* 100 */ 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, + /* 110 */ 1429, 1360, 1745, 1745, 1745, 1427, 1360, 1360, 1360, 1360, + /* 120 */ 1360, 1360, 1523, 1360, 1360, 1360, 1360, 1360, 1360, 1360, + /* 130 */ 1360, 1603, 1360, 1360, 1811, 1360, 1609, 1769, 1360, 1360, + /* 140 */ 1360, 1360, 1476, 1761, 1737, 1751, 1738, 1796, 1796, 1796, + /* 150 */ 1754, 1360, 1765, 1360, 1360, 1360, 1595, 1360, 1360, 1572, + /* 160 */ 1569, 1569, 1360, 1360, 1360, 1360, 1429, 1360, 1429, 1360, + /* 170 */ 1360, 1429, 1360, 1429, 1360, 1360, 1429, 1429, 1360, 1429, + /* 180 */ 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, + /* 190 */ 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1427, 1605, 1360, + /* 200 */ 1427, 1360, 1360, 1427, 1360, 1360, 1427, 1360, 1776, 1774, + /* 210 */ 1360, 1776, 1774, 1360, 1360, 1360, 1788, 1784, 1767, 1765, + /* 220 */ 1751, 1360, 1360, 1360, 1802, 1798, 1814, 1802, 1798, 1802, + /* 230 */ 1798, 1360, 1774, 1360, 1360, 1774, 1360, 1580, 1360, 1360, + /* 240 */ 1427, 1360, 1427, 1360, 1492, 1360, 1360, 1427, 1360, 1597, + /* 250 */ 1611, 1526, 1526, 1526, 1430, 1365, 1360, 1360, 1360, 1360, + /* 260 */ 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1678, 1787, 1786, + /* 270 */ 1710, 1709, 1708, 1706, 1677, 1488, 1360, 1360, 1360, 1360, + /* 280 */ 1360, 1360, 1671, 1672, 1670, 1669, 1360, 1360, 1360, 1360, + /* 290 */ 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1735, + /* 300 */ 1360, 1799, 1803, 1360, 1360, 1360, 1654, 1360, 1360, 1360, + /* 310 */ 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, + /* 320 */ 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, + /* 330 */ 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, + /* 340 */ 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, + /* 350 */ 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, + /* 360 */ 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, + /* 370 */ 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, + /* 380 */ 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, + /* 390 */ 1360, 1360, 1360, 1394, 1360, 1360, 1360, 1360, 1360, 1360, + /* 400 */ 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, + /* 410 */ 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, + /* 420 */ 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, + /* 430 */ 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, + /* 440 */ 1360, 1457, 1456, 1360, 1360, 1360, 1360, 1360, 1360, 1360, + /* 450 */ 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, + /* 460 */ 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, + /* 470 */ 1360, 1360, 1360, 1360, 1360, 1758, 1768, 1360, 1360, 1360, + /* 480 */ 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1654, 1360, 1785, + /* 490 */ 1360, 1744, 1740, 1360, 1360, 1736, 1360, 1360, 1797, 1360, + /* 500 */ 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1730, 1360, + /* 510 */ 1703, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1665, + /* 520 */ 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, + /* 530 */ 1360, 1360, 1653, 1360, 1694, 1360, 1360, 1360, 1360, 1360, + /* 540 */ 1360, 1360, 1360, 1520, 1360, 1360, 1360, 1360, 1360, 1360, + /* 550 */ 1360, 1360, 1360, 1360, 1360, 1360, 1505, 1503, 1502, 1501, + /* 560 */ 1360, 1498, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, + /* 570 */ 1360, 1360, 1360, 1449, 1360, 1360, 1360, 1360, 1360, 1360, + /* 580 */ 1360, 1360, 1360, 1440, 1360, 1439, 1360, 1360, 1360, 1360, + /* 590 */ 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, + /* 600 */ 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, + /* 610 */ 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, }; /********** End of lemon-generated parsing tables *****************************/ @@ -999,6 +1004,7 @@ static const YYCODETYPE yyFallback[] = { 0, /* TRIGGER => nothing */ 0, /* AT_ONCE => nothing */ 0, /* WINDOW_CLOSE => nothing */ + 0, /* MAX_DELAY => nothing */ 0, /* WATERMARK => nothing */ 0, /* KILL => nothing */ 0, /* CONNECTION => nothing */ @@ -1063,12 +1069,12 @@ static const YYCODETYPE yyFallback[] = { 0, /* ASC => nothing */ 0, /* NULLS => nothing */ 0, /* ID => nothing */ - 232, /* NK_BITNOT => ID */ - 232, /* INSERT => ID */ - 232, /* VALUES => ID */ - 232, /* IMPORT => ID */ - 232, /* NK_SEMI => ID */ - 232, /* FILE => ID */ + 233, /* NK_BITNOT => ID */ + 233, /* INSERT => ID */ + 233, /* VALUES => ID */ + 233, /* IMPORT => ID */ + 233, /* NK_SEMI => ID */ + 233, /* FILE => ID */ }; #endif /* YYFALLBACK */ @@ -1325,196 +1331,197 @@ static const char *const yyTokenName[] = { /* 166 */ "TRIGGER", /* 167 */ "AT_ONCE", /* 168 */ "WINDOW_CLOSE", - /* 169 */ "WATERMARK", - /* 170 */ "KILL", - /* 171 */ "CONNECTION", - /* 172 */ "TRANSACTION", - /* 173 */ "BALANCE", - /* 174 */ "VGROUP", - /* 175 */ "MERGE", - /* 176 */ "REDISTRIBUTE", - /* 177 */ "SPLIT", - /* 178 */ "SYNCDB", - /* 179 */ "DELETE", - /* 180 */ "NULL", - /* 181 */ "NK_QUESTION", - /* 182 */ "NK_ARROW", - /* 183 */ "ROWTS", - /* 184 */ "TBNAME", - /* 185 */ "QSTARTTS", - /* 186 */ "QENDTS", - /* 187 */ "WSTARTTS", - /* 188 */ "WENDTS", - /* 189 */ "WDURATION", - /* 190 */ "CAST", - /* 191 */ "NOW", - /* 192 */ "TODAY", - /* 193 */ "TIMEZONE", - /* 194 */ "COUNT", - /* 195 */ "FIRST", - /* 196 */ "LAST", - /* 197 */ "LAST_ROW", - /* 198 */ "BETWEEN", - /* 199 */ "IS", - /* 200 */ "NK_LT", - /* 201 */ "NK_GT", - /* 202 */ "NK_LE", - /* 203 */ "NK_GE", - /* 204 */ "NK_NE", - /* 205 */ "MATCH", - /* 206 */ "NMATCH", - /* 207 */ "CONTAINS", - /* 208 */ "JOIN", - /* 209 */ "INNER", - /* 210 */ "SELECT", - /* 211 */ "DISTINCT", - /* 212 */ "WHERE", - /* 213 */ "PARTITION", - /* 214 */ "BY", - /* 215 */ "SESSION", - /* 216 */ "STATE_WINDOW", - /* 217 */ "SLIDING", - /* 218 */ "FILL", - /* 219 */ "VALUE", - /* 220 */ "NONE", - /* 221 */ "PREV", - /* 222 */ "LINEAR", - /* 223 */ "NEXT", - /* 224 */ "HAVING", - /* 225 */ "ORDER", - /* 226 */ "SLIMIT", - /* 227 */ "SOFFSET", - /* 228 */ "LIMIT", - /* 229 */ "OFFSET", - /* 230 */ "ASC", - /* 231 */ "NULLS", - /* 232 */ "ID", - /* 233 */ "NK_BITNOT", - /* 234 */ "INSERT", - /* 235 */ "VALUES", - /* 236 */ "IMPORT", - /* 237 */ "NK_SEMI", - /* 238 */ "FILE", - /* 239 */ "cmd", - /* 240 */ "account_options", - /* 241 */ "alter_account_options", - /* 242 */ "literal", - /* 243 */ "alter_account_option", - /* 244 */ "user_name", - /* 245 */ "privileges", - /* 246 */ "priv_level", - /* 247 */ "priv_type_list", - /* 248 */ "priv_type", - /* 249 */ "db_name", - /* 250 */ "dnode_endpoint", - /* 251 */ "dnode_host_name", - /* 252 */ "not_exists_opt", - /* 253 */ "db_options", - /* 254 */ "exists_opt", - /* 255 */ "alter_db_options", - /* 256 */ "integer_list", - /* 257 */ "variable_list", - /* 258 */ "retention_list", - /* 259 */ "alter_db_option", - /* 260 */ "retention", - /* 261 */ "full_table_name", - /* 262 */ "column_def_list", - /* 263 */ "tags_def_opt", - /* 264 */ "table_options", - /* 265 */ "multi_create_clause", - /* 266 */ "tags_def", - /* 267 */ "multi_drop_clause", - /* 268 */ "alter_table_clause", - /* 269 */ "alter_table_options", - /* 270 */ "column_name", - /* 271 */ "type_name", - /* 272 */ "signed_literal", - /* 273 */ "create_subtable_clause", - /* 274 */ "specific_tags_opt", - /* 275 */ "literal_list", - /* 276 */ "drop_table_clause", - /* 277 */ "col_name_list", - /* 278 */ "table_name", - /* 279 */ "column_def", - /* 280 */ "func_name_list", - /* 281 */ "alter_table_option", - /* 282 */ "col_name", - /* 283 */ "db_name_cond_opt", - /* 284 */ "like_pattern_opt", - /* 285 */ "table_name_cond", - /* 286 */ "from_db_opt", - /* 287 */ "func_name", - /* 288 */ "function_name", - /* 289 */ "index_name", - /* 290 */ "index_options", - /* 291 */ "func_list", - /* 292 */ "duration_literal", - /* 293 */ "sliding_opt", - /* 294 */ "func", - /* 295 */ "expression_list", - /* 296 */ "topic_name", - /* 297 */ "query_expression", - /* 298 */ "cgroup_name", - /* 299 */ "analyze_opt", - /* 300 */ "explain_options", - /* 301 */ "agg_func_opt", - /* 302 */ "bufsize_opt", - /* 303 */ "stream_name", - /* 304 */ "stream_options", - /* 305 */ "into_opt", - /* 306 */ "dnode_list", - /* 307 */ "where_clause_opt", - /* 308 */ "signed", - /* 309 */ "literal_func", - /* 310 */ "table_alias", - /* 311 */ "column_alias", - /* 312 */ "expression", - /* 313 */ "pseudo_column", - /* 314 */ "column_reference", - /* 315 */ "function_expression", - /* 316 */ "subquery", - /* 317 */ "star_func", - /* 318 */ "star_func_para_list", - /* 319 */ "noarg_func", - /* 320 */ "other_para_list", - /* 321 */ "star_func_para", - /* 322 */ "predicate", - /* 323 */ "compare_op", - /* 324 */ "in_op", - /* 325 */ "in_predicate_value", - /* 326 */ "boolean_value_expression", - /* 327 */ "boolean_primary", - /* 328 */ "common_expression", - /* 329 */ "from_clause", - /* 330 */ "table_reference_list", - /* 331 */ "table_reference", - /* 332 */ "table_primary", - /* 333 */ "joined_table", - /* 334 */ "alias_opt", - /* 335 */ "parenthesized_joined_table", - /* 336 */ "join_type", - /* 337 */ "search_condition", - /* 338 */ "query_specification", - /* 339 */ "set_quantifier_opt", - /* 340 */ "select_list", - /* 341 */ "partition_by_clause_opt", - /* 342 */ "twindow_clause_opt", - /* 343 */ "group_by_clause_opt", - /* 344 */ "having_clause_opt", - /* 345 */ "select_sublist", - /* 346 */ "select_item", - /* 347 */ "fill_opt", - /* 348 */ "fill_mode", - /* 349 */ "group_by_list", - /* 350 */ "query_expression_body", - /* 351 */ "order_by_clause_opt", - /* 352 */ "slimit_clause_opt", - /* 353 */ "limit_clause_opt", - /* 354 */ "query_primary", - /* 355 */ "sort_specification_list", - /* 356 */ "sort_specification", - /* 357 */ "ordering_specification_opt", - /* 358 */ "null_ordering_opt", + /* 169 */ "MAX_DELAY", + /* 170 */ "WATERMARK", + /* 171 */ "KILL", + /* 172 */ "CONNECTION", + /* 173 */ "TRANSACTION", + /* 174 */ "BALANCE", + /* 175 */ "VGROUP", + /* 176 */ "MERGE", + /* 177 */ "REDISTRIBUTE", + /* 178 */ "SPLIT", + /* 179 */ "SYNCDB", + /* 180 */ "DELETE", + /* 181 */ "NULL", + /* 182 */ "NK_QUESTION", + /* 183 */ "NK_ARROW", + /* 184 */ "ROWTS", + /* 185 */ "TBNAME", + /* 186 */ "QSTARTTS", + /* 187 */ "QENDTS", + /* 188 */ "WSTARTTS", + /* 189 */ "WENDTS", + /* 190 */ "WDURATION", + /* 191 */ "CAST", + /* 192 */ "NOW", + /* 193 */ "TODAY", + /* 194 */ "TIMEZONE", + /* 195 */ "COUNT", + /* 196 */ "FIRST", + /* 197 */ "LAST", + /* 198 */ "LAST_ROW", + /* 199 */ "BETWEEN", + /* 200 */ "IS", + /* 201 */ "NK_LT", + /* 202 */ "NK_GT", + /* 203 */ "NK_LE", + /* 204 */ "NK_GE", + /* 205 */ "NK_NE", + /* 206 */ "MATCH", + /* 207 */ "NMATCH", + /* 208 */ "CONTAINS", + /* 209 */ "JOIN", + /* 210 */ "INNER", + /* 211 */ "SELECT", + /* 212 */ "DISTINCT", + /* 213 */ "WHERE", + /* 214 */ "PARTITION", + /* 215 */ "BY", + /* 216 */ "SESSION", + /* 217 */ "STATE_WINDOW", + /* 218 */ "SLIDING", + /* 219 */ "FILL", + /* 220 */ "VALUE", + /* 221 */ "NONE", + /* 222 */ "PREV", + /* 223 */ "LINEAR", + /* 224 */ "NEXT", + /* 225 */ "HAVING", + /* 226 */ "ORDER", + /* 227 */ "SLIMIT", + /* 228 */ "SOFFSET", + /* 229 */ "LIMIT", + /* 230 */ "OFFSET", + /* 231 */ "ASC", + /* 232 */ "NULLS", + /* 233 */ "ID", + /* 234 */ "NK_BITNOT", + /* 235 */ "INSERT", + /* 236 */ "VALUES", + /* 237 */ "IMPORT", + /* 238 */ "NK_SEMI", + /* 239 */ "FILE", + /* 240 */ "cmd", + /* 241 */ "account_options", + /* 242 */ "alter_account_options", + /* 243 */ "literal", + /* 244 */ "alter_account_option", + /* 245 */ "user_name", + /* 246 */ "privileges", + /* 247 */ "priv_level", + /* 248 */ "priv_type_list", + /* 249 */ "priv_type", + /* 250 */ "db_name", + /* 251 */ "dnode_endpoint", + /* 252 */ "dnode_host_name", + /* 253 */ "not_exists_opt", + /* 254 */ "db_options", + /* 255 */ "exists_opt", + /* 256 */ "alter_db_options", + /* 257 */ "integer_list", + /* 258 */ "variable_list", + /* 259 */ "retention_list", + /* 260 */ "alter_db_option", + /* 261 */ "retention", + /* 262 */ "full_table_name", + /* 263 */ "column_def_list", + /* 264 */ "tags_def_opt", + /* 265 */ "table_options", + /* 266 */ "multi_create_clause", + /* 267 */ "tags_def", + /* 268 */ "multi_drop_clause", + /* 269 */ "alter_table_clause", + /* 270 */ "alter_table_options", + /* 271 */ "column_name", + /* 272 */ "type_name", + /* 273 */ "signed_literal", + /* 274 */ "create_subtable_clause", + /* 275 */ "specific_tags_opt", + /* 276 */ "literal_list", + /* 277 */ "drop_table_clause", + /* 278 */ "col_name_list", + /* 279 */ "table_name", + /* 280 */ "column_def", + /* 281 */ "func_name_list", + /* 282 */ "alter_table_option", + /* 283 */ "col_name", + /* 284 */ "db_name_cond_opt", + /* 285 */ "like_pattern_opt", + /* 286 */ "table_name_cond", + /* 287 */ "from_db_opt", + /* 288 */ "func_name", + /* 289 */ "function_name", + /* 290 */ "index_name", + /* 291 */ "index_options", + /* 292 */ "func_list", + /* 293 */ "duration_literal", + /* 294 */ "sliding_opt", + /* 295 */ "func", + /* 296 */ "expression_list", + /* 297 */ "topic_name", + /* 298 */ "query_expression", + /* 299 */ "cgroup_name", + /* 300 */ "analyze_opt", + /* 301 */ "explain_options", + /* 302 */ "agg_func_opt", + /* 303 */ "bufsize_opt", + /* 304 */ "stream_name", + /* 305 */ "stream_options", + /* 306 */ "into_opt", + /* 307 */ "dnode_list", + /* 308 */ "where_clause_opt", + /* 309 */ "signed", + /* 310 */ "literal_func", + /* 311 */ "table_alias", + /* 312 */ "column_alias", + /* 313 */ "expression", + /* 314 */ "pseudo_column", + /* 315 */ "column_reference", + /* 316 */ "function_expression", + /* 317 */ "subquery", + /* 318 */ "star_func", + /* 319 */ "star_func_para_list", + /* 320 */ "noarg_func", + /* 321 */ "other_para_list", + /* 322 */ "star_func_para", + /* 323 */ "predicate", + /* 324 */ "compare_op", + /* 325 */ "in_op", + /* 326 */ "in_predicate_value", + /* 327 */ "boolean_value_expression", + /* 328 */ "boolean_primary", + /* 329 */ "common_expression", + /* 330 */ "from_clause", + /* 331 */ "table_reference_list", + /* 332 */ "table_reference", + /* 333 */ "table_primary", + /* 334 */ "joined_table", + /* 335 */ "alias_opt", + /* 336 */ "parenthesized_joined_table", + /* 337 */ "join_type", + /* 338 */ "search_condition", + /* 339 */ "query_specification", + /* 340 */ "set_quantifier_opt", + /* 341 */ "select_list", + /* 342 */ "partition_by_clause_opt", + /* 343 */ "twindow_clause_opt", + /* 344 */ "group_by_clause_opt", + /* 345 */ "having_clause_opt", + /* 346 */ "select_sublist", + /* 347 */ "select_item", + /* 348 */ "fill_opt", + /* 349 */ "fill_mode", + /* 350 */ "group_by_list", + /* 351 */ "query_expression_body", + /* 352 */ "order_by_clause_opt", + /* 353 */ "slimit_clause_opt", + /* 354 */ "limit_clause_opt", + /* 355 */ "query_primary", + /* 356 */ "sort_specification_list", + /* 357 */ "sort_specification", + /* 358 */ "ordering_specification_opt", + /* 359 */ "null_ordering_opt", }; #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ @@ -1773,208 +1780,209 @@ static const char *const yyRuleName[] = { /* 248 */ "stream_options ::=", /* 249 */ "stream_options ::= stream_options TRIGGER AT_ONCE", /* 250 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", - /* 251 */ "stream_options ::= stream_options WATERMARK duration_literal", - /* 252 */ "cmd ::= KILL CONNECTION NK_INTEGER", - /* 253 */ "cmd ::= KILL QUERY NK_INTEGER", - /* 254 */ "cmd ::= KILL TRANSACTION NK_INTEGER", - /* 255 */ "cmd ::= BALANCE VGROUP", - /* 256 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", - /* 257 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", - /* 258 */ "cmd ::= SPLIT VGROUP NK_INTEGER", - /* 259 */ "dnode_list ::= DNODE NK_INTEGER", - /* 260 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", - /* 261 */ "cmd ::= SYNCDB db_name REPLICA", - /* 262 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", - /* 263 */ "cmd ::= query_expression", - /* 264 */ "literal ::= NK_INTEGER", - /* 265 */ "literal ::= NK_FLOAT", - /* 266 */ "literal ::= NK_STRING", - /* 267 */ "literal ::= NK_BOOL", - /* 268 */ "literal ::= TIMESTAMP NK_STRING", - /* 269 */ "literal ::= duration_literal", - /* 270 */ "literal ::= NULL", - /* 271 */ "literal ::= NK_QUESTION", - /* 272 */ "duration_literal ::= NK_VARIABLE", - /* 273 */ "signed ::= NK_INTEGER", - /* 274 */ "signed ::= NK_PLUS NK_INTEGER", - /* 275 */ "signed ::= NK_MINUS NK_INTEGER", - /* 276 */ "signed ::= NK_FLOAT", - /* 277 */ "signed ::= NK_PLUS NK_FLOAT", - /* 278 */ "signed ::= NK_MINUS NK_FLOAT", - /* 279 */ "signed_literal ::= signed", - /* 280 */ "signed_literal ::= NK_STRING", - /* 281 */ "signed_literal ::= NK_BOOL", - /* 282 */ "signed_literal ::= TIMESTAMP NK_STRING", - /* 283 */ "signed_literal ::= duration_literal", - /* 284 */ "signed_literal ::= NULL", - /* 285 */ "signed_literal ::= literal_func", - /* 286 */ "literal_list ::= signed_literal", - /* 287 */ "literal_list ::= literal_list NK_COMMA signed_literal", - /* 288 */ "db_name ::= NK_ID", - /* 289 */ "table_name ::= NK_ID", - /* 290 */ "column_name ::= NK_ID", - /* 291 */ "function_name ::= NK_ID", - /* 292 */ "table_alias ::= NK_ID", - /* 293 */ "column_alias ::= NK_ID", - /* 294 */ "user_name ::= NK_ID", - /* 295 */ "index_name ::= NK_ID", - /* 296 */ "topic_name ::= NK_ID", - /* 297 */ "stream_name ::= NK_ID", - /* 298 */ "cgroup_name ::= NK_ID", - /* 299 */ "expression ::= literal", - /* 300 */ "expression ::= pseudo_column", - /* 301 */ "expression ::= column_reference", - /* 302 */ "expression ::= function_expression", - /* 303 */ "expression ::= subquery", - /* 304 */ "expression ::= NK_LP expression NK_RP", - /* 305 */ "expression ::= NK_PLUS expression", - /* 306 */ "expression ::= NK_MINUS expression", - /* 307 */ "expression ::= expression NK_PLUS expression", - /* 308 */ "expression ::= expression NK_MINUS expression", - /* 309 */ "expression ::= expression NK_STAR expression", - /* 310 */ "expression ::= expression NK_SLASH expression", - /* 311 */ "expression ::= expression NK_REM expression", - /* 312 */ "expression ::= column_reference NK_ARROW NK_STRING", - /* 313 */ "expression_list ::= expression", - /* 314 */ "expression_list ::= expression_list NK_COMMA expression", - /* 315 */ "column_reference ::= column_name", - /* 316 */ "column_reference ::= table_name NK_DOT column_name", - /* 317 */ "pseudo_column ::= ROWTS", - /* 318 */ "pseudo_column ::= TBNAME", - /* 319 */ "pseudo_column ::= table_name NK_DOT TBNAME", - /* 320 */ "pseudo_column ::= QSTARTTS", - /* 321 */ "pseudo_column ::= QENDTS", - /* 322 */ "pseudo_column ::= WSTARTTS", - /* 323 */ "pseudo_column ::= WENDTS", - /* 324 */ "pseudo_column ::= WDURATION", - /* 325 */ "function_expression ::= function_name NK_LP expression_list NK_RP", - /* 326 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", - /* 327 */ "function_expression ::= CAST NK_LP expression AS type_name NK_RP", - /* 328 */ "function_expression ::= literal_func", - /* 329 */ "literal_func ::= noarg_func NK_LP NK_RP", - /* 330 */ "literal_func ::= NOW", - /* 331 */ "noarg_func ::= NOW", - /* 332 */ "noarg_func ::= TODAY", - /* 333 */ "noarg_func ::= TIMEZONE", - /* 334 */ "star_func ::= COUNT", - /* 335 */ "star_func ::= FIRST", - /* 336 */ "star_func ::= LAST", - /* 337 */ "star_func ::= LAST_ROW", - /* 338 */ "star_func_para_list ::= NK_STAR", - /* 339 */ "star_func_para_list ::= other_para_list", - /* 340 */ "other_para_list ::= star_func_para", - /* 341 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", - /* 342 */ "star_func_para ::= expression", - /* 343 */ "star_func_para ::= table_name NK_DOT NK_STAR", - /* 344 */ "predicate ::= expression compare_op expression", - /* 345 */ "predicate ::= expression BETWEEN expression AND expression", - /* 346 */ "predicate ::= expression NOT BETWEEN expression AND expression", - /* 347 */ "predicate ::= expression IS NULL", - /* 348 */ "predicate ::= expression IS NOT NULL", - /* 349 */ "predicate ::= expression in_op in_predicate_value", - /* 350 */ "compare_op ::= NK_LT", - /* 351 */ "compare_op ::= NK_GT", - /* 352 */ "compare_op ::= NK_LE", - /* 353 */ "compare_op ::= NK_GE", - /* 354 */ "compare_op ::= NK_NE", - /* 355 */ "compare_op ::= NK_EQ", - /* 356 */ "compare_op ::= LIKE", - /* 357 */ "compare_op ::= NOT LIKE", - /* 358 */ "compare_op ::= MATCH", - /* 359 */ "compare_op ::= NMATCH", - /* 360 */ "compare_op ::= CONTAINS", - /* 361 */ "in_op ::= IN", - /* 362 */ "in_op ::= NOT IN", - /* 363 */ "in_predicate_value ::= NK_LP expression_list NK_RP", - /* 364 */ "boolean_value_expression ::= boolean_primary", - /* 365 */ "boolean_value_expression ::= NOT boolean_primary", - /* 366 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", - /* 367 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", - /* 368 */ "boolean_primary ::= predicate", - /* 369 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", - /* 370 */ "common_expression ::= expression", - /* 371 */ "common_expression ::= boolean_value_expression", - /* 372 */ "from_clause ::= FROM table_reference_list", - /* 373 */ "table_reference_list ::= table_reference", - /* 374 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", - /* 375 */ "table_reference ::= table_primary", - /* 376 */ "table_reference ::= joined_table", - /* 377 */ "table_primary ::= table_name alias_opt", - /* 378 */ "table_primary ::= db_name NK_DOT table_name alias_opt", - /* 379 */ "table_primary ::= subquery alias_opt", - /* 380 */ "table_primary ::= parenthesized_joined_table", - /* 381 */ "alias_opt ::=", - /* 382 */ "alias_opt ::= table_alias", - /* 383 */ "alias_opt ::= AS table_alias", - /* 384 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", - /* 385 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", - /* 386 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", - /* 387 */ "join_type ::=", - /* 388 */ "join_type ::= INNER", - /* 389 */ "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", - /* 390 */ "set_quantifier_opt ::=", - /* 391 */ "set_quantifier_opt ::= DISTINCT", - /* 392 */ "set_quantifier_opt ::= ALL", - /* 393 */ "select_list ::= NK_STAR", - /* 394 */ "select_list ::= select_sublist", - /* 395 */ "select_sublist ::= select_item", - /* 396 */ "select_sublist ::= select_sublist NK_COMMA select_item", - /* 397 */ "select_item ::= common_expression", - /* 398 */ "select_item ::= common_expression column_alias", - /* 399 */ "select_item ::= common_expression AS column_alias", - /* 400 */ "select_item ::= table_name NK_DOT NK_STAR", - /* 401 */ "where_clause_opt ::=", - /* 402 */ "where_clause_opt ::= WHERE search_condition", - /* 403 */ "partition_by_clause_opt ::=", - /* 404 */ "partition_by_clause_opt ::= PARTITION BY expression_list", - /* 405 */ "twindow_clause_opt ::=", - /* 406 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", - /* 407 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP", - /* 408 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", - /* 409 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", - /* 410 */ "sliding_opt ::=", - /* 411 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", - /* 412 */ "fill_opt ::=", - /* 413 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", - /* 414 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", - /* 415 */ "fill_mode ::= NONE", - /* 416 */ "fill_mode ::= PREV", - /* 417 */ "fill_mode ::= NULL", - /* 418 */ "fill_mode ::= LINEAR", - /* 419 */ "fill_mode ::= NEXT", - /* 420 */ "group_by_clause_opt ::=", - /* 421 */ "group_by_clause_opt ::= GROUP BY group_by_list", - /* 422 */ "group_by_list ::= expression", - /* 423 */ "group_by_list ::= group_by_list NK_COMMA expression", - /* 424 */ "having_clause_opt ::=", - /* 425 */ "having_clause_opt ::= HAVING search_condition", - /* 426 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt", - /* 427 */ "query_expression_body ::= query_primary", - /* 428 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body", - /* 429 */ "query_expression_body ::= query_expression_body UNION query_expression_body", - /* 430 */ "query_primary ::= query_specification", - /* 431 */ "query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP", - /* 432 */ "order_by_clause_opt ::=", - /* 433 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", - /* 434 */ "slimit_clause_opt ::=", - /* 435 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", - /* 436 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", - /* 437 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 438 */ "limit_clause_opt ::=", - /* 439 */ "limit_clause_opt ::= LIMIT NK_INTEGER", - /* 440 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", - /* 441 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 442 */ "subquery ::= NK_LP query_expression NK_RP", - /* 443 */ "search_condition ::= common_expression", - /* 444 */ "sort_specification_list ::= sort_specification", - /* 445 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", - /* 446 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt", - /* 447 */ "ordering_specification_opt ::=", - /* 448 */ "ordering_specification_opt ::= ASC", - /* 449 */ "ordering_specification_opt ::= DESC", - /* 450 */ "null_ordering_opt ::=", - /* 451 */ "null_ordering_opt ::= NULLS FIRST", - /* 452 */ "null_ordering_opt ::= NULLS LAST", + /* 251 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", + /* 252 */ "stream_options ::= stream_options WATERMARK duration_literal", + /* 253 */ "cmd ::= KILL CONNECTION NK_INTEGER", + /* 254 */ "cmd ::= KILL QUERY NK_INTEGER", + /* 255 */ "cmd ::= KILL TRANSACTION NK_INTEGER", + /* 256 */ "cmd ::= BALANCE VGROUP", + /* 257 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", + /* 258 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", + /* 259 */ "cmd ::= SPLIT VGROUP NK_INTEGER", + /* 260 */ "dnode_list ::= DNODE NK_INTEGER", + /* 261 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", + /* 262 */ "cmd ::= SYNCDB db_name REPLICA", + /* 263 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", + /* 264 */ "cmd ::= query_expression", + /* 265 */ "literal ::= NK_INTEGER", + /* 266 */ "literal ::= NK_FLOAT", + /* 267 */ "literal ::= NK_STRING", + /* 268 */ "literal ::= NK_BOOL", + /* 269 */ "literal ::= TIMESTAMP NK_STRING", + /* 270 */ "literal ::= duration_literal", + /* 271 */ "literal ::= NULL", + /* 272 */ "literal ::= NK_QUESTION", + /* 273 */ "duration_literal ::= NK_VARIABLE", + /* 274 */ "signed ::= NK_INTEGER", + /* 275 */ "signed ::= NK_PLUS NK_INTEGER", + /* 276 */ "signed ::= NK_MINUS NK_INTEGER", + /* 277 */ "signed ::= NK_FLOAT", + /* 278 */ "signed ::= NK_PLUS NK_FLOAT", + /* 279 */ "signed ::= NK_MINUS NK_FLOAT", + /* 280 */ "signed_literal ::= signed", + /* 281 */ "signed_literal ::= NK_STRING", + /* 282 */ "signed_literal ::= NK_BOOL", + /* 283 */ "signed_literal ::= TIMESTAMP NK_STRING", + /* 284 */ "signed_literal ::= duration_literal", + /* 285 */ "signed_literal ::= NULL", + /* 286 */ "signed_literal ::= literal_func", + /* 287 */ "literal_list ::= signed_literal", + /* 288 */ "literal_list ::= literal_list NK_COMMA signed_literal", + /* 289 */ "db_name ::= NK_ID", + /* 290 */ "table_name ::= NK_ID", + /* 291 */ "column_name ::= NK_ID", + /* 292 */ "function_name ::= NK_ID", + /* 293 */ "table_alias ::= NK_ID", + /* 294 */ "column_alias ::= NK_ID", + /* 295 */ "user_name ::= NK_ID", + /* 296 */ "index_name ::= NK_ID", + /* 297 */ "topic_name ::= NK_ID", + /* 298 */ "stream_name ::= NK_ID", + /* 299 */ "cgroup_name ::= NK_ID", + /* 300 */ "expression ::= literal", + /* 301 */ "expression ::= pseudo_column", + /* 302 */ "expression ::= column_reference", + /* 303 */ "expression ::= function_expression", + /* 304 */ "expression ::= subquery", + /* 305 */ "expression ::= NK_LP expression NK_RP", + /* 306 */ "expression ::= NK_PLUS expression", + /* 307 */ "expression ::= NK_MINUS expression", + /* 308 */ "expression ::= expression NK_PLUS expression", + /* 309 */ "expression ::= expression NK_MINUS expression", + /* 310 */ "expression ::= expression NK_STAR expression", + /* 311 */ "expression ::= expression NK_SLASH expression", + /* 312 */ "expression ::= expression NK_REM expression", + /* 313 */ "expression ::= column_reference NK_ARROW NK_STRING", + /* 314 */ "expression_list ::= expression", + /* 315 */ "expression_list ::= expression_list NK_COMMA expression", + /* 316 */ "column_reference ::= column_name", + /* 317 */ "column_reference ::= table_name NK_DOT column_name", + /* 318 */ "pseudo_column ::= ROWTS", + /* 319 */ "pseudo_column ::= TBNAME", + /* 320 */ "pseudo_column ::= table_name NK_DOT TBNAME", + /* 321 */ "pseudo_column ::= QSTARTTS", + /* 322 */ "pseudo_column ::= QENDTS", + /* 323 */ "pseudo_column ::= WSTARTTS", + /* 324 */ "pseudo_column ::= WENDTS", + /* 325 */ "pseudo_column ::= WDURATION", + /* 326 */ "function_expression ::= function_name NK_LP expression_list NK_RP", + /* 327 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", + /* 328 */ "function_expression ::= CAST NK_LP expression AS type_name NK_RP", + /* 329 */ "function_expression ::= literal_func", + /* 330 */ "literal_func ::= noarg_func NK_LP NK_RP", + /* 331 */ "literal_func ::= NOW", + /* 332 */ "noarg_func ::= NOW", + /* 333 */ "noarg_func ::= TODAY", + /* 334 */ "noarg_func ::= TIMEZONE", + /* 335 */ "star_func ::= COUNT", + /* 336 */ "star_func ::= FIRST", + /* 337 */ "star_func ::= LAST", + /* 338 */ "star_func ::= LAST_ROW", + /* 339 */ "star_func_para_list ::= NK_STAR", + /* 340 */ "star_func_para_list ::= other_para_list", + /* 341 */ "other_para_list ::= star_func_para", + /* 342 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", + /* 343 */ "star_func_para ::= expression", + /* 344 */ "star_func_para ::= table_name NK_DOT NK_STAR", + /* 345 */ "predicate ::= expression compare_op expression", + /* 346 */ "predicate ::= expression BETWEEN expression AND expression", + /* 347 */ "predicate ::= expression NOT BETWEEN expression AND expression", + /* 348 */ "predicate ::= expression IS NULL", + /* 349 */ "predicate ::= expression IS NOT NULL", + /* 350 */ "predicate ::= expression in_op in_predicate_value", + /* 351 */ "compare_op ::= NK_LT", + /* 352 */ "compare_op ::= NK_GT", + /* 353 */ "compare_op ::= NK_LE", + /* 354 */ "compare_op ::= NK_GE", + /* 355 */ "compare_op ::= NK_NE", + /* 356 */ "compare_op ::= NK_EQ", + /* 357 */ "compare_op ::= LIKE", + /* 358 */ "compare_op ::= NOT LIKE", + /* 359 */ "compare_op ::= MATCH", + /* 360 */ "compare_op ::= NMATCH", + /* 361 */ "compare_op ::= CONTAINS", + /* 362 */ "in_op ::= IN", + /* 363 */ "in_op ::= NOT IN", + /* 364 */ "in_predicate_value ::= NK_LP expression_list NK_RP", + /* 365 */ "boolean_value_expression ::= boolean_primary", + /* 366 */ "boolean_value_expression ::= NOT boolean_primary", + /* 367 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", + /* 368 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", + /* 369 */ "boolean_primary ::= predicate", + /* 370 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", + /* 371 */ "common_expression ::= expression", + /* 372 */ "common_expression ::= boolean_value_expression", + /* 373 */ "from_clause ::= FROM table_reference_list", + /* 374 */ "table_reference_list ::= table_reference", + /* 375 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", + /* 376 */ "table_reference ::= table_primary", + /* 377 */ "table_reference ::= joined_table", + /* 378 */ "table_primary ::= table_name alias_opt", + /* 379 */ "table_primary ::= db_name NK_DOT table_name alias_opt", + /* 380 */ "table_primary ::= subquery alias_opt", + /* 381 */ "table_primary ::= parenthesized_joined_table", + /* 382 */ "alias_opt ::=", + /* 383 */ "alias_opt ::= table_alias", + /* 384 */ "alias_opt ::= AS table_alias", + /* 385 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", + /* 386 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", + /* 387 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", + /* 388 */ "join_type ::=", + /* 389 */ "join_type ::= INNER", + /* 390 */ "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", + /* 391 */ "set_quantifier_opt ::=", + /* 392 */ "set_quantifier_opt ::= DISTINCT", + /* 393 */ "set_quantifier_opt ::= ALL", + /* 394 */ "select_list ::= NK_STAR", + /* 395 */ "select_list ::= select_sublist", + /* 396 */ "select_sublist ::= select_item", + /* 397 */ "select_sublist ::= select_sublist NK_COMMA select_item", + /* 398 */ "select_item ::= common_expression", + /* 399 */ "select_item ::= common_expression column_alias", + /* 400 */ "select_item ::= common_expression AS column_alias", + /* 401 */ "select_item ::= table_name NK_DOT NK_STAR", + /* 402 */ "where_clause_opt ::=", + /* 403 */ "where_clause_opt ::= WHERE search_condition", + /* 404 */ "partition_by_clause_opt ::=", + /* 405 */ "partition_by_clause_opt ::= PARTITION BY expression_list", + /* 406 */ "twindow_clause_opt ::=", + /* 407 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", + /* 408 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP", + /* 409 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", + /* 410 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", + /* 411 */ "sliding_opt ::=", + /* 412 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", + /* 413 */ "fill_opt ::=", + /* 414 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", + /* 415 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", + /* 416 */ "fill_mode ::= NONE", + /* 417 */ "fill_mode ::= PREV", + /* 418 */ "fill_mode ::= NULL", + /* 419 */ "fill_mode ::= LINEAR", + /* 420 */ "fill_mode ::= NEXT", + /* 421 */ "group_by_clause_opt ::=", + /* 422 */ "group_by_clause_opt ::= GROUP BY group_by_list", + /* 423 */ "group_by_list ::= expression", + /* 424 */ "group_by_list ::= group_by_list NK_COMMA expression", + /* 425 */ "having_clause_opt ::=", + /* 426 */ "having_clause_opt ::= HAVING search_condition", + /* 427 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt", + /* 428 */ "query_expression_body ::= query_primary", + /* 429 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body", + /* 430 */ "query_expression_body ::= query_expression_body UNION query_expression_body", + /* 431 */ "query_primary ::= query_specification", + /* 432 */ "query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP", + /* 433 */ "order_by_clause_opt ::=", + /* 434 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", + /* 435 */ "slimit_clause_opt ::=", + /* 436 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", + /* 437 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", + /* 438 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 439 */ "limit_clause_opt ::=", + /* 440 */ "limit_clause_opt ::= LIMIT NK_INTEGER", + /* 441 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", + /* 442 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 443 */ "subquery ::= NK_LP query_expression NK_RP", + /* 444 */ "search_condition ::= common_expression", + /* 445 */ "sort_specification_list ::= sort_specification", + /* 446 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", + /* 447 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt", + /* 448 */ "ordering_specification_opt ::=", + /* 449 */ "ordering_specification_opt ::= ASC", + /* 450 */ "ordering_specification_opt ::= DESC", + /* 451 */ "null_ordering_opt ::=", + /* 452 */ "null_ordering_opt ::= NULLS FIRST", + /* 453 */ "null_ordering_opt ::= NULLS LAST", }; #endif /* NDEBUG */ @@ -2101,174 +2109,174 @@ static void yy_destructor( */ /********* Begin destructor definitions ***************************************/ /* Default NON-TERMINAL Destructor */ - case 239: /* cmd */ - case 242: /* literal */ - case 253: /* db_options */ - case 255: /* alter_db_options */ - case 260: /* retention */ - case 261: /* full_table_name */ - case 264: /* table_options */ - case 268: /* alter_table_clause */ - case 269: /* alter_table_options */ - case 272: /* signed_literal */ - case 273: /* create_subtable_clause */ - case 276: /* drop_table_clause */ - case 279: /* column_def */ - case 282: /* col_name */ - case 283: /* db_name_cond_opt */ - case 284: /* like_pattern_opt */ - case 285: /* table_name_cond */ - case 286: /* from_db_opt */ - case 287: /* func_name */ - case 290: /* index_options */ - case 292: /* duration_literal */ - case 293: /* sliding_opt */ - case 294: /* func */ - case 297: /* query_expression */ - case 300: /* explain_options */ - case 304: /* stream_options */ - case 305: /* into_opt */ - case 307: /* where_clause_opt */ - case 308: /* signed */ - case 309: /* literal_func */ - case 312: /* expression */ - case 313: /* pseudo_column */ - case 314: /* column_reference */ - case 315: /* function_expression */ - case 316: /* subquery */ - case 321: /* star_func_para */ - case 322: /* predicate */ - case 325: /* in_predicate_value */ - case 326: /* boolean_value_expression */ - case 327: /* boolean_primary */ - case 328: /* common_expression */ - case 329: /* from_clause */ - case 330: /* table_reference_list */ - case 331: /* table_reference */ - case 332: /* table_primary */ - case 333: /* joined_table */ - case 335: /* parenthesized_joined_table */ - case 337: /* search_condition */ - case 338: /* query_specification */ - case 342: /* twindow_clause_opt */ - case 344: /* having_clause_opt */ - case 346: /* select_item */ - case 347: /* fill_opt */ - case 350: /* query_expression_body */ - case 352: /* slimit_clause_opt */ - case 353: /* limit_clause_opt */ - case 354: /* query_primary */ - case 356: /* sort_specification */ + case 240: /* cmd */ + case 243: /* literal */ + case 254: /* db_options */ + case 256: /* alter_db_options */ + case 261: /* retention */ + case 262: /* full_table_name */ + case 265: /* table_options */ + case 269: /* alter_table_clause */ + case 270: /* alter_table_options */ + case 273: /* signed_literal */ + case 274: /* create_subtable_clause */ + case 277: /* drop_table_clause */ + case 280: /* column_def */ + case 283: /* col_name */ + case 284: /* db_name_cond_opt */ + case 285: /* like_pattern_opt */ + case 286: /* table_name_cond */ + case 287: /* from_db_opt */ + case 288: /* func_name */ + case 291: /* index_options */ + case 293: /* duration_literal */ + case 294: /* sliding_opt */ + case 295: /* func */ + case 298: /* query_expression */ + case 301: /* explain_options */ + case 305: /* stream_options */ + case 306: /* into_opt */ + case 308: /* where_clause_opt */ + case 309: /* signed */ + case 310: /* literal_func */ + case 313: /* expression */ + case 314: /* pseudo_column */ + case 315: /* column_reference */ + case 316: /* function_expression */ + case 317: /* subquery */ + case 322: /* star_func_para */ + case 323: /* predicate */ + case 326: /* in_predicate_value */ + case 327: /* boolean_value_expression */ + case 328: /* boolean_primary */ + case 329: /* common_expression */ + case 330: /* from_clause */ + case 331: /* table_reference_list */ + case 332: /* table_reference */ + case 333: /* table_primary */ + case 334: /* joined_table */ + case 336: /* parenthesized_joined_table */ + case 338: /* search_condition */ + case 339: /* query_specification */ + case 343: /* twindow_clause_opt */ + case 345: /* having_clause_opt */ + case 347: /* select_item */ + case 348: /* fill_opt */ + case 351: /* query_expression_body */ + case 353: /* slimit_clause_opt */ + case 354: /* limit_clause_opt */ + case 355: /* query_primary */ + case 357: /* sort_specification */ { - nodesDestroyNode((yypminor->yy674)); + nodesDestroyNode((yypminor->yy632)); } break; - case 240: /* account_options */ - case 241: /* alter_account_options */ - case 243: /* alter_account_option */ - case 302: /* bufsize_opt */ + case 241: /* account_options */ + case 242: /* alter_account_options */ + case 244: /* alter_account_option */ + case 303: /* bufsize_opt */ { } break; - case 244: /* user_name */ - case 246: /* priv_level */ - case 249: /* db_name */ - case 250: /* dnode_endpoint */ - case 251: /* dnode_host_name */ - case 270: /* column_name */ - case 278: /* table_name */ - case 288: /* function_name */ - case 289: /* index_name */ - case 296: /* topic_name */ - case 298: /* cgroup_name */ - case 303: /* stream_name */ - case 310: /* table_alias */ - case 311: /* column_alias */ - case 317: /* star_func */ - case 319: /* noarg_func */ - case 334: /* alias_opt */ + case 245: /* user_name */ + case 247: /* priv_level */ + case 250: /* db_name */ + case 251: /* dnode_endpoint */ + case 252: /* dnode_host_name */ + case 271: /* column_name */ + case 279: /* table_name */ + case 289: /* function_name */ + case 290: /* index_name */ + case 297: /* topic_name */ + case 299: /* cgroup_name */ + case 304: /* stream_name */ + case 311: /* table_alias */ + case 312: /* column_alias */ + case 318: /* star_func */ + case 320: /* noarg_func */ + case 335: /* alias_opt */ { } break; - case 245: /* privileges */ - case 247: /* priv_type_list */ - case 248: /* priv_type */ + case 246: /* privileges */ + case 248: /* priv_type_list */ + case 249: /* priv_type */ { } break; - case 252: /* not_exists_opt */ - case 254: /* exists_opt */ - case 299: /* analyze_opt */ - case 301: /* agg_func_opt */ - case 339: /* set_quantifier_opt */ + case 253: /* not_exists_opt */ + case 255: /* exists_opt */ + case 300: /* analyze_opt */ + case 302: /* agg_func_opt */ + case 340: /* set_quantifier_opt */ { } break; - case 256: /* integer_list */ - case 257: /* variable_list */ - case 258: /* retention_list */ - case 262: /* column_def_list */ - case 263: /* tags_def_opt */ - case 265: /* multi_create_clause */ - case 266: /* tags_def */ - case 267: /* multi_drop_clause */ - case 274: /* specific_tags_opt */ - case 275: /* literal_list */ - case 277: /* col_name_list */ - case 280: /* func_name_list */ - case 291: /* func_list */ - case 295: /* expression_list */ - case 306: /* dnode_list */ - case 318: /* star_func_para_list */ - case 320: /* other_para_list */ - case 340: /* select_list */ - case 341: /* partition_by_clause_opt */ - case 343: /* group_by_clause_opt */ - case 345: /* select_sublist */ - case 349: /* group_by_list */ - case 351: /* order_by_clause_opt */ - case 355: /* sort_specification_list */ + case 257: /* integer_list */ + case 258: /* variable_list */ + case 259: /* retention_list */ + case 263: /* column_def_list */ + case 264: /* tags_def_opt */ + case 266: /* multi_create_clause */ + case 267: /* tags_def */ + case 268: /* multi_drop_clause */ + case 275: /* specific_tags_opt */ + case 276: /* literal_list */ + case 278: /* col_name_list */ + case 281: /* func_name_list */ + case 292: /* func_list */ + case 296: /* expression_list */ + case 307: /* dnode_list */ + case 319: /* star_func_para_list */ + case 321: /* other_para_list */ + case 341: /* select_list */ + case 342: /* partition_by_clause_opt */ + case 344: /* group_by_clause_opt */ + case 346: /* select_sublist */ + case 350: /* group_by_list */ + case 352: /* order_by_clause_opt */ + case 356: /* sort_specification_list */ { - nodesDestroyList((yypminor->yy530)); + nodesDestroyList((yypminor->yy424)); } break; - case 259: /* alter_db_option */ - case 281: /* alter_table_option */ + case 260: /* alter_db_option */ + case 282: /* alter_table_option */ { } break; - case 271: /* type_name */ + case 272: /* type_name */ { } break; - case 323: /* compare_op */ - case 324: /* in_op */ + case 324: /* compare_op */ + case 325: /* in_op */ { } break; - case 336: /* join_type */ + case 337: /* join_type */ { } break; - case 348: /* fill_mode */ + case 349: /* fill_mode */ { } break; - case 357: /* ordering_specification_opt */ + case 358: /* ordering_specification_opt */ { } break; - case 358: /* null_ordering_opt */ + case 359: /* null_ordering_opt */ { } @@ -2567,459 +2575,460 @@ static const struct { YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ signed char nrhs; /* Negative of the number of RHS symbols in the rule */ } yyRuleInfo[] = { - { 239, -6 }, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ - { 239, -4 }, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ - { 240, 0 }, /* (2) account_options ::= */ - { 240, -3 }, /* (3) account_options ::= account_options PPS literal */ - { 240, -3 }, /* (4) account_options ::= account_options TSERIES literal */ - { 240, -3 }, /* (5) account_options ::= account_options STORAGE literal */ - { 240, -3 }, /* (6) account_options ::= account_options STREAMS literal */ - { 240, -3 }, /* (7) account_options ::= account_options QTIME literal */ - { 240, -3 }, /* (8) account_options ::= account_options DBS literal */ - { 240, -3 }, /* (9) account_options ::= account_options USERS literal */ - { 240, -3 }, /* (10) account_options ::= account_options CONNS literal */ - { 240, -3 }, /* (11) account_options ::= account_options STATE literal */ - { 241, -1 }, /* (12) alter_account_options ::= alter_account_option */ - { 241, -2 }, /* (13) alter_account_options ::= alter_account_options alter_account_option */ - { 243, -2 }, /* (14) alter_account_option ::= PASS literal */ - { 243, -2 }, /* (15) alter_account_option ::= PPS literal */ - { 243, -2 }, /* (16) alter_account_option ::= TSERIES literal */ - { 243, -2 }, /* (17) alter_account_option ::= STORAGE literal */ - { 243, -2 }, /* (18) alter_account_option ::= STREAMS literal */ - { 243, -2 }, /* (19) alter_account_option ::= QTIME literal */ - { 243, -2 }, /* (20) alter_account_option ::= DBS literal */ - { 243, -2 }, /* (21) alter_account_option ::= USERS literal */ - { 243, -2 }, /* (22) alter_account_option ::= CONNS literal */ - { 243, -2 }, /* (23) alter_account_option ::= STATE literal */ - { 239, -5 }, /* (24) cmd ::= CREATE USER user_name PASS NK_STRING */ - { 239, -5 }, /* (25) cmd ::= ALTER USER user_name PASS NK_STRING */ - { 239, -5 }, /* (26) cmd ::= ALTER USER user_name PRIVILEGE NK_STRING */ - { 239, -3 }, /* (27) cmd ::= DROP USER user_name */ - { 239, -6 }, /* (28) cmd ::= GRANT privileges ON priv_level TO user_name */ - { 239, -6 }, /* (29) cmd ::= REVOKE privileges ON priv_level FROM user_name */ - { 245, -1 }, /* (30) privileges ::= ALL */ - { 245, -1 }, /* (31) privileges ::= priv_type_list */ - { 247, -1 }, /* (32) priv_type_list ::= priv_type */ - { 247, -3 }, /* (33) priv_type_list ::= priv_type_list NK_COMMA priv_type */ - { 248, -1 }, /* (34) priv_type ::= READ */ - { 248, -1 }, /* (35) priv_type ::= WRITE */ - { 246, -3 }, /* (36) priv_level ::= NK_STAR NK_DOT NK_STAR */ - { 246, -3 }, /* (37) priv_level ::= db_name NK_DOT NK_STAR */ - { 239, -3 }, /* (38) cmd ::= CREATE DNODE dnode_endpoint */ - { 239, -5 }, /* (39) cmd ::= CREATE DNODE dnode_host_name PORT NK_INTEGER */ - { 239, -3 }, /* (40) cmd ::= DROP DNODE NK_INTEGER */ - { 239, -3 }, /* (41) cmd ::= DROP DNODE dnode_endpoint */ - { 239, -4 }, /* (42) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ - { 239, -5 }, /* (43) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ - { 239, -4 }, /* (44) cmd ::= ALTER ALL DNODES NK_STRING */ - { 239, -5 }, /* (45) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ - { 250, -1 }, /* (46) dnode_endpoint ::= NK_STRING */ - { 251, -1 }, /* (47) dnode_host_name ::= NK_ID */ - { 251, -1 }, /* (48) dnode_host_name ::= NK_IPTOKEN */ - { 239, -3 }, /* (49) cmd ::= ALTER LOCAL NK_STRING */ - { 239, -4 }, /* (50) cmd ::= ALTER LOCAL NK_STRING NK_STRING */ - { 239, -5 }, /* (51) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ - { 239, -5 }, /* (52) cmd ::= DROP QNODE ON DNODE NK_INTEGER */ - { 239, -5 }, /* (53) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ - { 239, -5 }, /* (54) cmd ::= DROP BNODE ON DNODE NK_INTEGER */ - { 239, -5 }, /* (55) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ - { 239, -5 }, /* (56) cmd ::= DROP SNODE ON DNODE NK_INTEGER */ - { 239, -5 }, /* (57) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ - { 239, -5 }, /* (58) cmd ::= DROP MNODE ON DNODE NK_INTEGER */ - { 239, -5 }, /* (59) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ - { 239, -4 }, /* (60) cmd ::= DROP DATABASE exists_opt db_name */ - { 239, -2 }, /* (61) cmd ::= USE db_name */ - { 239, -4 }, /* (62) cmd ::= ALTER DATABASE db_name alter_db_options */ - { 252, -3 }, /* (63) not_exists_opt ::= IF NOT EXISTS */ - { 252, 0 }, /* (64) not_exists_opt ::= */ - { 254, -2 }, /* (65) exists_opt ::= IF EXISTS */ - { 254, 0 }, /* (66) exists_opt ::= */ - { 253, 0 }, /* (67) db_options ::= */ - { 253, -3 }, /* (68) db_options ::= db_options BUFFER NK_INTEGER */ - { 253, -3 }, /* (69) db_options ::= db_options CACHELAST NK_INTEGER */ - { 253, -3 }, /* (70) db_options ::= db_options COMP NK_INTEGER */ - { 253, -3 }, /* (71) db_options ::= db_options DAYS NK_INTEGER */ - { 253, -3 }, /* (72) db_options ::= db_options DAYS NK_VARIABLE */ - { 253, -3 }, /* (73) db_options ::= db_options FSYNC NK_INTEGER */ - { 253, -3 }, /* (74) db_options ::= db_options MAXROWS NK_INTEGER */ - { 253, -3 }, /* (75) db_options ::= db_options MINROWS NK_INTEGER */ - { 253, -3 }, /* (76) db_options ::= db_options KEEP integer_list */ - { 253, -3 }, /* (77) db_options ::= db_options KEEP variable_list */ - { 253, -3 }, /* (78) db_options ::= db_options PAGES NK_INTEGER */ - { 253, -3 }, /* (79) db_options ::= db_options PAGESIZE NK_INTEGER */ - { 253, -3 }, /* (80) db_options ::= db_options PRECISION NK_STRING */ - { 253, -3 }, /* (81) db_options ::= db_options REPLICA NK_INTEGER */ - { 253, -3 }, /* (82) db_options ::= db_options STRICT NK_INTEGER */ - { 253, -3 }, /* (83) db_options ::= db_options WAL NK_INTEGER */ - { 253, -3 }, /* (84) db_options ::= db_options VGROUPS NK_INTEGER */ - { 253, -3 }, /* (85) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ - { 253, -3 }, /* (86) db_options ::= db_options RETENTIONS retention_list */ - { 253, -3 }, /* (87) db_options ::= db_options SCHEMALESS NK_INTEGER */ - { 255, -1 }, /* (88) alter_db_options ::= alter_db_option */ - { 255, -2 }, /* (89) alter_db_options ::= alter_db_options alter_db_option */ - { 259, -2 }, /* (90) alter_db_option ::= BUFFER NK_INTEGER */ - { 259, -2 }, /* (91) alter_db_option ::= CACHELAST NK_INTEGER */ - { 259, -2 }, /* (92) alter_db_option ::= FSYNC NK_INTEGER */ - { 259, -2 }, /* (93) alter_db_option ::= KEEP integer_list */ - { 259, -2 }, /* (94) alter_db_option ::= KEEP variable_list */ - { 259, -2 }, /* (95) alter_db_option ::= PAGES NK_INTEGER */ - { 259, -2 }, /* (96) alter_db_option ::= REPLICA NK_INTEGER */ - { 259, -2 }, /* (97) alter_db_option ::= STRICT NK_INTEGER */ - { 259, -2 }, /* (98) alter_db_option ::= WAL NK_INTEGER */ - { 256, -1 }, /* (99) integer_list ::= NK_INTEGER */ - { 256, -3 }, /* (100) integer_list ::= integer_list NK_COMMA NK_INTEGER */ - { 257, -1 }, /* (101) variable_list ::= NK_VARIABLE */ - { 257, -3 }, /* (102) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ - { 258, -1 }, /* (103) retention_list ::= retention */ - { 258, -3 }, /* (104) retention_list ::= retention_list NK_COMMA retention */ - { 260, -3 }, /* (105) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ - { 239, -9 }, /* (106) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ - { 239, -3 }, /* (107) cmd ::= CREATE TABLE multi_create_clause */ - { 239, -9 }, /* (108) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ - { 239, -3 }, /* (109) cmd ::= DROP TABLE multi_drop_clause */ - { 239, -4 }, /* (110) cmd ::= DROP STABLE exists_opt full_table_name */ - { 239, -3 }, /* (111) cmd ::= ALTER TABLE alter_table_clause */ - { 239, -3 }, /* (112) cmd ::= ALTER STABLE alter_table_clause */ - { 268, -2 }, /* (113) alter_table_clause ::= full_table_name alter_table_options */ - { 268, -5 }, /* (114) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ - { 268, -4 }, /* (115) alter_table_clause ::= full_table_name DROP COLUMN column_name */ - { 268, -5 }, /* (116) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ - { 268, -5 }, /* (117) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ - { 268, -5 }, /* (118) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ - { 268, -4 }, /* (119) alter_table_clause ::= full_table_name DROP TAG column_name */ - { 268, -5 }, /* (120) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ - { 268, -5 }, /* (121) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ - { 268, -6 }, /* (122) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ - { 265, -1 }, /* (123) multi_create_clause ::= create_subtable_clause */ - { 265, -2 }, /* (124) multi_create_clause ::= multi_create_clause create_subtable_clause */ - { 273, -10 }, /* (125) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP table_options */ - { 267, -1 }, /* (126) multi_drop_clause ::= drop_table_clause */ - { 267, -2 }, /* (127) multi_drop_clause ::= multi_drop_clause drop_table_clause */ - { 276, -2 }, /* (128) drop_table_clause ::= exists_opt full_table_name */ - { 274, 0 }, /* (129) specific_tags_opt ::= */ - { 274, -3 }, /* (130) specific_tags_opt ::= NK_LP col_name_list NK_RP */ - { 261, -1 }, /* (131) full_table_name ::= table_name */ - { 261, -3 }, /* (132) full_table_name ::= db_name NK_DOT table_name */ - { 262, -1 }, /* (133) column_def_list ::= column_def */ - { 262, -3 }, /* (134) column_def_list ::= column_def_list NK_COMMA column_def */ - { 279, -2 }, /* (135) column_def ::= column_name type_name */ - { 279, -4 }, /* (136) column_def ::= column_name type_name COMMENT NK_STRING */ - { 271, -1 }, /* (137) type_name ::= BOOL */ - { 271, -1 }, /* (138) type_name ::= TINYINT */ - { 271, -1 }, /* (139) type_name ::= SMALLINT */ - { 271, -1 }, /* (140) type_name ::= INT */ - { 271, -1 }, /* (141) type_name ::= INTEGER */ - { 271, -1 }, /* (142) type_name ::= BIGINT */ - { 271, -1 }, /* (143) type_name ::= FLOAT */ - { 271, -1 }, /* (144) type_name ::= DOUBLE */ - { 271, -4 }, /* (145) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ - { 271, -1 }, /* (146) type_name ::= TIMESTAMP */ - { 271, -4 }, /* (147) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ - { 271, -2 }, /* (148) type_name ::= TINYINT UNSIGNED */ - { 271, -2 }, /* (149) type_name ::= SMALLINT UNSIGNED */ - { 271, -2 }, /* (150) type_name ::= INT UNSIGNED */ - { 271, -2 }, /* (151) type_name ::= BIGINT UNSIGNED */ - { 271, -1 }, /* (152) type_name ::= JSON */ - { 271, -4 }, /* (153) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ - { 271, -1 }, /* (154) type_name ::= MEDIUMBLOB */ - { 271, -1 }, /* (155) type_name ::= BLOB */ - { 271, -4 }, /* (156) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ - { 271, -1 }, /* (157) type_name ::= DECIMAL */ - { 271, -4 }, /* (158) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ - { 271, -6 }, /* (159) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - { 263, 0 }, /* (160) tags_def_opt ::= */ - { 263, -1 }, /* (161) tags_def_opt ::= tags_def */ - { 266, -4 }, /* (162) tags_def ::= TAGS NK_LP column_def_list NK_RP */ - { 264, 0 }, /* (163) table_options ::= */ - { 264, -3 }, /* (164) table_options ::= table_options COMMENT NK_STRING */ - { 264, -3 }, /* (165) table_options ::= table_options FILE_FACTOR NK_FLOAT */ - { 264, -5 }, /* (166) table_options ::= table_options ROLLUP NK_LP func_name_list NK_RP */ - { 264, -3 }, /* (167) table_options ::= table_options TTL NK_INTEGER */ - { 264, -5 }, /* (168) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ - { 269, -1 }, /* (169) alter_table_options ::= alter_table_option */ - { 269, -2 }, /* (170) alter_table_options ::= alter_table_options alter_table_option */ - { 281, -2 }, /* (171) alter_table_option ::= COMMENT NK_STRING */ - { 281, -2 }, /* (172) alter_table_option ::= TTL NK_INTEGER */ - { 277, -1 }, /* (173) col_name_list ::= col_name */ - { 277, -3 }, /* (174) col_name_list ::= col_name_list NK_COMMA col_name */ - { 282, -1 }, /* (175) col_name ::= column_name */ - { 239, -2 }, /* (176) cmd ::= SHOW DNODES */ - { 239, -2 }, /* (177) cmd ::= SHOW USERS */ - { 239, -2 }, /* (178) cmd ::= SHOW DATABASES */ - { 239, -4 }, /* (179) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ - { 239, -4 }, /* (180) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ - { 239, -3 }, /* (181) cmd ::= SHOW db_name_cond_opt VGROUPS */ - { 239, -2 }, /* (182) cmd ::= SHOW MNODES */ - { 239, -2 }, /* (183) cmd ::= SHOW MODULES */ - { 239, -2 }, /* (184) cmd ::= SHOW QNODES */ - { 239, -2 }, /* (185) cmd ::= SHOW FUNCTIONS */ - { 239, -5 }, /* (186) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ - { 239, -2 }, /* (187) cmd ::= SHOW STREAMS */ - { 239, -2 }, /* (188) cmd ::= SHOW ACCOUNTS */ - { 239, -2 }, /* (189) cmd ::= SHOW APPS */ - { 239, -2 }, /* (190) cmd ::= SHOW CONNECTIONS */ - { 239, -2 }, /* (191) cmd ::= SHOW LICENCE */ - { 239, -2 }, /* (192) cmd ::= SHOW GRANTS */ - { 239, -4 }, /* (193) cmd ::= SHOW CREATE DATABASE db_name */ - { 239, -4 }, /* (194) cmd ::= SHOW CREATE TABLE full_table_name */ - { 239, -4 }, /* (195) cmd ::= SHOW CREATE STABLE full_table_name */ - { 239, -2 }, /* (196) cmd ::= SHOW QUERIES */ - { 239, -2 }, /* (197) cmd ::= SHOW SCORES */ - { 239, -2 }, /* (198) cmd ::= SHOW TOPICS */ - { 239, -2 }, /* (199) cmd ::= SHOW VARIABLES */ - { 239, -2 }, /* (200) cmd ::= SHOW BNODES */ - { 239, -2 }, /* (201) cmd ::= SHOW SNODES */ - { 239, -2 }, /* (202) cmd ::= SHOW CLUSTER */ - { 239, -2 }, /* (203) cmd ::= SHOW TRANSACTIONS */ - { 283, 0 }, /* (204) db_name_cond_opt ::= */ - { 283, -2 }, /* (205) db_name_cond_opt ::= db_name NK_DOT */ - { 284, 0 }, /* (206) like_pattern_opt ::= */ - { 284, -2 }, /* (207) like_pattern_opt ::= LIKE NK_STRING */ - { 285, -1 }, /* (208) table_name_cond ::= table_name */ - { 286, 0 }, /* (209) from_db_opt ::= */ - { 286, -2 }, /* (210) from_db_opt ::= FROM db_name */ - { 280, -1 }, /* (211) func_name_list ::= func_name */ - { 280, -3 }, /* (212) func_name_list ::= func_name_list NK_COMMA func_name */ - { 287, -1 }, /* (213) func_name ::= function_name */ - { 239, -8 }, /* (214) cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ - { 239, -10 }, /* (215) cmd ::= CREATE FULLTEXT INDEX not_exists_opt index_name ON table_name NK_LP col_name_list NK_RP */ - { 239, -6 }, /* (216) cmd ::= DROP INDEX exists_opt index_name ON table_name */ - { 290, 0 }, /* (217) index_options ::= */ - { 290, -9 }, /* (218) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt */ - { 290, -11 }, /* (219) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt */ - { 291, -1 }, /* (220) func_list ::= func */ - { 291, -3 }, /* (221) func_list ::= func_list NK_COMMA func */ - { 294, -4 }, /* (222) func ::= function_name NK_LP expression_list NK_RP */ - { 239, -6 }, /* (223) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ - { 239, -7 }, /* (224) cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ - { 239, -7 }, /* (225) cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ - { 239, -4 }, /* (226) cmd ::= DROP TOPIC exists_opt topic_name */ - { 239, -7 }, /* (227) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ - { 239, -2 }, /* (228) cmd ::= DESC full_table_name */ - { 239, -2 }, /* (229) cmd ::= DESCRIBE full_table_name */ - { 239, -3 }, /* (230) cmd ::= RESET QUERY CACHE */ - { 239, -4 }, /* (231) cmd ::= EXPLAIN analyze_opt explain_options query_expression */ - { 299, 0 }, /* (232) analyze_opt ::= */ - { 299, -1 }, /* (233) analyze_opt ::= ANALYZE */ - { 300, 0 }, /* (234) explain_options ::= */ - { 300, -3 }, /* (235) explain_options ::= explain_options VERBOSE NK_BOOL */ - { 300, -3 }, /* (236) explain_options ::= explain_options RATIO NK_FLOAT */ - { 239, -6 }, /* (237) cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP */ - { 239, -10 }, /* (238) cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ - { 239, -4 }, /* (239) cmd ::= DROP FUNCTION exists_opt function_name */ - { 301, 0 }, /* (240) agg_func_opt ::= */ - { 301, -1 }, /* (241) agg_func_opt ::= AGGREGATE */ - { 302, 0 }, /* (242) bufsize_opt ::= */ - { 302, -2 }, /* (243) bufsize_opt ::= BUFSIZE NK_INTEGER */ - { 239, -8 }, /* (244) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options into_opt AS query_expression */ - { 239, -4 }, /* (245) cmd ::= DROP STREAM exists_opt stream_name */ - { 305, 0 }, /* (246) into_opt ::= */ - { 305, -2 }, /* (247) into_opt ::= INTO full_table_name */ - { 304, 0 }, /* (248) stream_options ::= */ - { 304, -3 }, /* (249) stream_options ::= stream_options TRIGGER AT_ONCE */ - { 304, -3 }, /* (250) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ - { 304, -3 }, /* (251) stream_options ::= stream_options WATERMARK duration_literal */ - { 239, -3 }, /* (252) cmd ::= KILL CONNECTION NK_INTEGER */ - { 239, -3 }, /* (253) cmd ::= KILL QUERY NK_INTEGER */ - { 239, -3 }, /* (254) cmd ::= KILL TRANSACTION NK_INTEGER */ - { 239, -2 }, /* (255) cmd ::= BALANCE VGROUP */ - { 239, -4 }, /* (256) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ - { 239, -4 }, /* (257) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ - { 239, -3 }, /* (258) cmd ::= SPLIT VGROUP NK_INTEGER */ - { 306, -2 }, /* (259) dnode_list ::= DNODE NK_INTEGER */ - { 306, -3 }, /* (260) dnode_list ::= dnode_list DNODE NK_INTEGER */ - { 239, -3 }, /* (261) cmd ::= SYNCDB db_name REPLICA */ - { 239, -4 }, /* (262) cmd ::= DELETE FROM full_table_name where_clause_opt */ - { 239, -1 }, /* (263) cmd ::= query_expression */ - { 242, -1 }, /* (264) literal ::= NK_INTEGER */ - { 242, -1 }, /* (265) literal ::= NK_FLOAT */ - { 242, -1 }, /* (266) literal ::= NK_STRING */ - { 242, -1 }, /* (267) literal ::= NK_BOOL */ - { 242, -2 }, /* (268) literal ::= TIMESTAMP NK_STRING */ - { 242, -1 }, /* (269) literal ::= duration_literal */ - { 242, -1 }, /* (270) literal ::= NULL */ - { 242, -1 }, /* (271) literal ::= NK_QUESTION */ - { 292, -1 }, /* (272) duration_literal ::= NK_VARIABLE */ - { 308, -1 }, /* (273) signed ::= NK_INTEGER */ - { 308, -2 }, /* (274) signed ::= NK_PLUS NK_INTEGER */ - { 308, -2 }, /* (275) signed ::= NK_MINUS NK_INTEGER */ - { 308, -1 }, /* (276) signed ::= NK_FLOAT */ - { 308, -2 }, /* (277) signed ::= NK_PLUS NK_FLOAT */ - { 308, -2 }, /* (278) signed ::= NK_MINUS NK_FLOAT */ - { 272, -1 }, /* (279) signed_literal ::= signed */ - { 272, -1 }, /* (280) signed_literal ::= NK_STRING */ - { 272, -1 }, /* (281) signed_literal ::= NK_BOOL */ - { 272, -2 }, /* (282) signed_literal ::= TIMESTAMP NK_STRING */ - { 272, -1 }, /* (283) signed_literal ::= duration_literal */ - { 272, -1 }, /* (284) signed_literal ::= NULL */ - { 272, -1 }, /* (285) signed_literal ::= literal_func */ - { 275, -1 }, /* (286) literal_list ::= signed_literal */ - { 275, -3 }, /* (287) literal_list ::= literal_list NK_COMMA signed_literal */ - { 249, -1 }, /* (288) db_name ::= NK_ID */ - { 278, -1 }, /* (289) table_name ::= NK_ID */ - { 270, -1 }, /* (290) column_name ::= NK_ID */ - { 288, -1 }, /* (291) function_name ::= NK_ID */ - { 310, -1 }, /* (292) table_alias ::= NK_ID */ - { 311, -1 }, /* (293) column_alias ::= NK_ID */ - { 244, -1 }, /* (294) user_name ::= NK_ID */ - { 289, -1 }, /* (295) index_name ::= NK_ID */ - { 296, -1 }, /* (296) topic_name ::= NK_ID */ - { 303, -1 }, /* (297) stream_name ::= NK_ID */ - { 298, -1 }, /* (298) cgroup_name ::= NK_ID */ - { 312, -1 }, /* (299) expression ::= literal */ - { 312, -1 }, /* (300) expression ::= pseudo_column */ - { 312, -1 }, /* (301) expression ::= column_reference */ - { 312, -1 }, /* (302) expression ::= function_expression */ - { 312, -1 }, /* (303) expression ::= subquery */ - { 312, -3 }, /* (304) expression ::= NK_LP expression NK_RP */ - { 312, -2 }, /* (305) expression ::= NK_PLUS expression */ - { 312, -2 }, /* (306) expression ::= NK_MINUS expression */ - { 312, -3 }, /* (307) expression ::= expression NK_PLUS expression */ - { 312, -3 }, /* (308) expression ::= expression NK_MINUS expression */ - { 312, -3 }, /* (309) expression ::= expression NK_STAR expression */ - { 312, -3 }, /* (310) expression ::= expression NK_SLASH expression */ - { 312, -3 }, /* (311) expression ::= expression NK_REM expression */ - { 312, -3 }, /* (312) expression ::= column_reference NK_ARROW NK_STRING */ - { 295, -1 }, /* (313) expression_list ::= expression */ - { 295, -3 }, /* (314) expression_list ::= expression_list NK_COMMA expression */ - { 314, -1 }, /* (315) column_reference ::= column_name */ - { 314, -3 }, /* (316) column_reference ::= table_name NK_DOT column_name */ - { 313, -1 }, /* (317) pseudo_column ::= ROWTS */ - { 313, -1 }, /* (318) pseudo_column ::= TBNAME */ - { 313, -3 }, /* (319) pseudo_column ::= table_name NK_DOT TBNAME */ - { 313, -1 }, /* (320) pseudo_column ::= QSTARTTS */ - { 313, -1 }, /* (321) pseudo_column ::= QENDTS */ - { 313, -1 }, /* (322) pseudo_column ::= WSTARTTS */ - { 313, -1 }, /* (323) pseudo_column ::= WENDTS */ - { 313, -1 }, /* (324) pseudo_column ::= WDURATION */ - { 315, -4 }, /* (325) function_expression ::= function_name NK_LP expression_list NK_RP */ - { 315, -4 }, /* (326) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ - { 315, -6 }, /* (327) function_expression ::= CAST NK_LP expression AS type_name NK_RP */ - { 315, -1 }, /* (328) function_expression ::= literal_func */ - { 309, -3 }, /* (329) literal_func ::= noarg_func NK_LP NK_RP */ - { 309, -1 }, /* (330) literal_func ::= NOW */ - { 319, -1 }, /* (331) noarg_func ::= NOW */ - { 319, -1 }, /* (332) noarg_func ::= TODAY */ - { 319, -1 }, /* (333) noarg_func ::= TIMEZONE */ - { 317, -1 }, /* (334) star_func ::= COUNT */ - { 317, -1 }, /* (335) star_func ::= FIRST */ - { 317, -1 }, /* (336) star_func ::= LAST */ - { 317, -1 }, /* (337) star_func ::= LAST_ROW */ - { 318, -1 }, /* (338) star_func_para_list ::= NK_STAR */ - { 318, -1 }, /* (339) star_func_para_list ::= other_para_list */ - { 320, -1 }, /* (340) other_para_list ::= star_func_para */ - { 320, -3 }, /* (341) other_para_list ::= other_para_list NK_COMMA star_func_para */ - { 321, -1 }, /* (342) star_func_para ::= expression */ - { 321, -3 }, /* (343) star_func_para ::= table_name NK_DOT NK_STAR */ - { 322, -3 }, /* (344) predicate ::= expression compare_op expression */ - { 322, -5 }, /* (345) predicate ::= expression BETWEEN expression AND expression */ - { 322, -6 }, /* (346) predicate ::= expression NOT BETWEEN expression AND expression */ - { 322, -3 }, /* (347) predicate ::= expression IS NULL */ - { 322, -4 }, /* (348) predicate ::= expression IS NOT NULL */ - { 322, -3 }, /* (349) predicate ::= expression in_op in_predicate_value */ - { 323, -1 }, /* (350) compare_op ::= NK_LT */ - { 323, -1 }, /* (351) compare_op ::= NK_GT */ - { 323, -1 }, /* (352) compare_op ::= NK_LE */ - { 323, -1 }, /* (353) compare_op ::= NK_GE */ - { 323, -1 }, /* (354) compare_op ::= NK_NE */ - { 323, -1 }, /* (355) compare_op ::= NK_EQ */ - { 323, -1 }, /* (356) compare_op ::= LIKE */ - { 323, -2 }, /* (357) compare_op ::= NOT LIKE */ - { 323, -1 }, /* (358) compare_op ::= MATCH */ - { 323, -1 }, /* (359) compare_op ::= NMATCH */ - { 323, -1 }, /* (360) compare_op ::= CONTAINS */ - { 324, -1 }, /* (361) in_op ::= IN */ - { 324, -2 }, /* (362) in_op ::= NOT IN */ - { 325, -3 }, /* (363) in_predicate_value ::= NK_LP expression_list NK_RP */ - { 326, -1 }, /* (364) boolean_value_expression ::= boolean_primary */ - { 326, -2 }, /* (365) boolean_value_expression ::= NOT boolean_primary */ - { 326, -3 }, /* (366) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - { 326, -3 }, /* (367) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - { 327, -1 }, /* (368) boolean_primary ::= predicate */ - { 327, -3 }, /* (369) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - { 328, -1 }, /* (370) common_expression ::= expression */ - { 328, -1 }, /* (371) common_expression ::= boolean_value_expression */ - { 329, -2 }, /* (372) from_clause ::= FROM table_reference_list */ - { 330, -1 }, /* (373) table_reference_list ::= table_reference */ - { 330, -3 }, /* (374) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - { 331, -1 }, /* (375) table_reference ::= table_primary */ - { 331, -1 }, /* (376) table_reference ::= joined_table */ - { 332, -2 }, /* (377) table_primary ::= table_name alias_opt */ - { 332, -4 }, /* (378) table_primary ::= db_name NK_DOT table_name alias_opt */ - { 332, -2 }, /* (379) table_primary ::= subquery alias_opt */ - { 332, -1 }, /* (380) table_primary ::= parenthesized_joined_table */ - { 334, 0 }, /* (381) alias_opt ::= */ - { 334, -1 }, /* (382) alias_opt ::= table_alias */ - { 334, -2 }, /* (383) alias_opt ::= AS table_alias */ - { 335, -3 }, /* (384) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - { 335, -3 }, /* (385) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - { 333, -6 }, /* (386) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ - { 336, 0 }, /* (387) join_type ::= */ - { 336, -1 }, /* (388) join_type ::= INNER */ - { 338, -9 }, /* (389) 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 */ - { 339, 0 }, /* (390) set_quantifier_opt ::= */ - { 339, -1 }, /* (391) set_quantifier_opt ::= DISTINCT */ - { 339, -1 }, /* (392) set_quantifier_opt ::= ALL */ - { 340, -1 }, /* (393) select_list ::= NK_STAR */ - { 340, -1 }, /* (394) select_list ::= select_sublist */ - { 345, -1 }, /* (395) select_sublist ::= select_item */ - { 345, -3 }, /* (396) select_sublist ::= select_sublist NK_COMMA select_item */ - { 346, -1 }, /* (397) select_item ::= common_expression */ - { 346, -2 }, /* (398) select_item ::= common_expression column_alias */ - { 346, -3 }, /* (399) select_item ::= common_expression AS column_alias */ - { 346, -3 }, /* (400) select_item ::= table_name NK_DOT NK_STAR */ - { 307, 0 }, /* (401) where_clause_opt ::= */ - { 307, -2 }, /* (402) where_clause_opt ::= WHERE search_condition */ - { 341, 0 }, /* (403) partition_by_clause_opt ::= */ - { 341, -3 }, /* (404) partition_by_clause_opt ::= PARTITION BY expression_list */ - { 342, 0 }, /* (405) twindow_clause_opt ::= */ - { 342, -6 }, /* (406) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ - { 342, -4 }, /* (407) twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ - { 342, -6 }, /* (408) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ - { 342, -8 }, /* (409) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ - { 293, 0 }, /* (410) sliding_opt ::= */ - { 293, -4 }, /* (411) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ - { 347, 0 }, /* (412) fill_opt ::= */ - { 347, -4 }, /* (413) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - { 347, -6 }, /* (414) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ - { 348, -1 }, /* (415) fill_mode ::= NONE */ - { 348, -1 }, /* (416) fill_mode ::= PREV */ - { 348, -1 }, /* (417) fill_mode ::= NULL */ - { 348, -1 }, /* (418) fill_mode ::= LINEAR */ - { 348, -1 }, /* (419) fill_mode ::= NEXT */ - { 343, 0 }, /* (420) group_by_clause_opt ::= */ - { 343, -3 }, /* (421) group_by_clause_opt ::= GROUP BY group_by_list */ - { 349, -1 }, /* (422) group_by_list ::= expression */ - { 349, -3 }, /* (423) group_by_list ::= group_by_list NK_COMMA expression */ - { 344, 0 }, /* (424) having_clause_opt ::= */ - { 344, -2 }, /* (425) having_clause_opt ::= HAVING search_condition */ - { 297, -4 }, /* (426) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ - { 350, -1 }, /* (427) query_expression_body ::= query_primary */ - { 350, -4 }, /* (428) query_expression_body ::= query_expression_body UNION ALL query_expression_body */ - { 350, -3 }, /* (429) query_expression_body ::= query_expression_body UNION query_expression_body */ - { 354, -1 }, /* (430) query_primary ::= query_specification */ - { 354, -6 }, /* (431) query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP */ - { 351, 0 }, /* (432) order_by_clause_opt ::= */ - { 351, -3 }, /* (433) order_by_clause_opt ::= ORDER BY sort_specification_list */ - { 352, 0 }, /* (434) slimit_clause_opt ::= */ - { 352, -2 }, /* (435) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - { 352, -4 }, /* (436) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - { 352, -4 }, /* (437) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - { 353, 0 }, /* (438) limit_clause_opt ::= */ - { 353, -2 }, /* (439) limit_clause_opt ::= LIMIT NK_INTEGER */ - { 353, -4 }, /* (440) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - { 353, -4 }, /* (441) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - { 316, -3 }, /* (442) subquery ::= NK_LP query_expression NK_RP */ - { 337, -1 }, /* (443) search_condition ::= common_expression */ - { 355, -1 }, /* (444) sort_specification_list ::= sort_specification */ - { 355, -3 }, /* (445) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - { 356, -3 }, /* (446) sort_specification ::= expression ordering_specification_opt null_ordering_opt */ - { 357, 0 }, /* (447) ordering_specification_opt ::= */ - { 357, -1 }, /* (448) ordering_specification_opt ::= ASC */ - { 357, -1 }, /* (449) ordering_specification_opt ::= DESC */ - { 358, 0 }, /* (450) null_ordering_opt ::= */ - { 358, -2 }, /* (451) null_ordering_opt ::= NULLS FIRST */ - { 358, -2 }, /* (452) null_ordering_opt ::= NULLS LAST */ + { 240, -6 }, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ + { 240, -4 }, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ + { 241, 0 }, /* (2) account_options ::= */ + { 241, -3 }, /* (3) account_options ::= account_options PPS literal */ + { 241, -3 }, /* (4) account_options ::= account_options TSERIES literal */ + { 241, -3 }, /* (5) account_options ::= account_options STORAGE literal */ + { 241, -3 }, /* (6) account_options ::= account_options STREAMS literal */ + { 241, -3 }, /* (7) account_options ::= account_options QTIME literal */ + { 241, -3 }, /* (8) account_options ::= account_options DBS literal */ + { 241, -3 }, /* (9) account_options ::= account_options USERS literal */ + { 241, -3 }, /* (10) account_options ::= account_options CONNS literal */ + { 241, -3 }, /* (11) account_options ::= account_options STATE literal */ + { 242, -1 }, /* (12) alter_account_options ::= alter_account_option */ + { 242, -2 }, /* (13) alter_account_options ::= alter_account_options alter_account_option */ + { 244, -2 }, /* (14) alter_account_option ::= PASS literal */ + { 244, -2 }, /* (15) alter_account_option ::= PPS literal */ + { 244, -2 }, /* (16) alter_account_option ::= TSERIES literal */ + { 244, -2 }, /* (17) alter_account_option ::= STORAGE literal */ + { 244, -2 }, /* (18) alter_account_option ::= STREAMS literal */ + { 244, -2 }, /* (19) alter_account_option ::= QTIME literal */ + { 244, -2 }, /* (20) alter_account_option ::= DBS literal */ + { 244, -2 }, /* (21) alter_account_option ::= USERS literal */ + { 244, -2 }, /* (22) alter_account_option ::= CONNS literal */ + { 244, -2 }, /* (23) alter_account_option ::= STATE literal */ + { 240, -5 }, /* (24) cmd ::= CREATE USER user_name PASS NK_STRING */ + { 240, -5 }, /* (25) cmd ::= ALTER USER user_name PASS NK_STRING */ + { 240, -5 }, /* (26) cmd ::= ALTER USER user_name PRIVILEGE NK_STRING */ + { 240, -3 }, /* (27) cmd ::= DROP USER user_name */ + { 240, -6 }, /* (28) cmd ::= GRANT privileges ON priv_level TO user_name */ + { 240, -6 }, /* (29) cmd ::= REVOKE privileges ON priv_level FROM user_name */ + { 246, -1 }, /* (30) privileges ::= ALL */ + { 246, -1 }, /* (31) privileges ::= priv_type_list */ + { 248, -1 }, /* (32) priv_type_list ::= priv_type */ + { 248, -3 }, /* (33) priv_type_list ::= priv_type_list NK_COMMA priv_type */ + { 249, -1 }, /* (34) priv_type ::= READ */ + { 249, -1 }, /* (35) priv_type ::= WRITE */ + { 247, -3 }, /* (36) priv_level ::= NK_STAR NK_DOT NK_STAR */ + { 247, -3 }, /* (37) priv_level ::= db_name NK_DOT NK_STAR */ + { 240, -3 }, /* (38) cmd ::= CREATE DNODE dnode_endpoint */ + { 240, -5 }, /* (39) cmd ::= CREATE DNODE dnode_host_name PORT NK_INTEGER */ + { 240, -3 }, /* (40) cmd ::= DROP DNODE NK_INTEGER */ + { 240, -3 }, /* (41) cmd ::= DROP DNODE dnode_endpoint */ + { 240, -4 }, /* (42) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ + { 240, -5 }, /* (43) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ + { 240, -4 }, /* (44) cmd ::= ALTER ALL DNODES NK_STRING */ + { 240, -5 }, /* (45) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ + { 251, -1 }, /* (46) dnode_endpoint ::= NK_STRING */ + { 252, -1 }, /* (47) dnode_host_name ::= NK_ID */ + { 252, -1 }, /* (48) dnode_host_name ::= NK_IPTOKEN */ + { 240, -3 }, /* (49) cmd ::= ALTER LOCAL NK_STRING */ + { 240, -4 }, /* (50) cmd ::= ALTER LOCAL NK_STRING NK_STRING */ + { 240, -5 }, /* (51) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ + { 240, -5 }, /* (52) cmd ::= DROP QNODE ON DNODE NK_INTEGER */ + { 240, -5 }, /* (53) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ + { 240, -5 }, /* (54) cmd ::= DROP BNODE ON DNODE NK_INTEGER */ + { 240, -5 }, /* (55) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ + { 240, -5 }, /* (56) cmd ::= DROP SNODE ON DNODE NK_INTEGER */ + { 240, -5 }, /* (57) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ + { 240, -5 }, /* (58) cmd ::= DROP MNODE ON DNODE NK_INTEGER */ + { 240, -5 }, /* (59) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ + { 240, -4 }, /* (60) cmd ::= DROP DATABASE exists_opt db_name */ + { 240, -2 }, /* (61) cmd ::= USE db_name */ + { 240, -4 }, /* (62) cmd ::= ALTER DATABASE db_name alter_db_options */ + { 253, -3 }, /* (63) not_exists_opt ::= IF NOT EXISTS */ + { 253, 0 }, /* (64) not_exists_opt ::= */ + { 255, -2 }, /* (65) exists_opt ::= IF EXISTS */ + { 255, 0 }, /* (66) exists_opt ::= */ + { 254, 0 }, /* (67) db_options ::= */ + { 254, -3 }, /* (68) db_options ::= db_options BUFFER NK_INTEGER */ + { 254, -3 }, /* (69) db_options ::= db_options CACHELAST NK_INTEGER */ + { 254, -3 }, /* (70) db_options ::= db_options COMP NK_INTEGER */ + { 254, -3 }, /* (71) db_options ::= db_options DAYS NK_INTEGER */ + { 254, -3 }, /* (72) db_options ::= db_options DAYS NK_VARIABLE */ + { 254, -3 }, /* (73) db_options ::= db_options FSYNC NK_INTEGER */ + { 254, -3 }, /* (74) db_options ::= db_options MAXROWS NK_INTEGER */ + { 254, -3 }, /* (75) db_options ::= db_options MINROWS NK_INTEGER */ + { 254, -3 }, /* (76) db_options ::= db_options KEEP integer_list */ + { 254, -3 }, /* (77) db_options ::= db_options KEEP variable_list */ + { 254, -3 }, /* (78) db_options ::= db_options PAGES NK_INTEGER */ + { 254, -3 }, /* (79) db_options ::= db_options PAGESIZE NK_INTEGER */ + { 254, -3 }, /* (80) db_options ::= db_options PRECISION NK_STRING */ + { 254, -3 }, /* (81) db_options ::= db_options REPLICA NK_INTEGER */ + { 254, -3 }, /* (82) db_options ::= db_options STRICT NK_INTEGER */ + { 254, -3 }, /* (83) db_options ::= db_options WAL NK_INTEGER */ + { 254, -3 }, /* (84) db_options ::= db_options VGROUPS NK_INTEGER */ + { 254, -3 }, /* (85) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ + { 254, -3 }, /* (86) db_options ::= db_options RETENTIONS retention_list */ + { 254, -3 }, /* (87) db_options ::= db_options SCHEMALESS NK_INTEGER */ + { 256, -1 }, /* (88) alter_db_options ::= alter_db_option */ + { 256, -2 }, /* (89) alter_db_options ::= alter_db_options alter_db_option */ + { 260, -2 }, /* (90) alter_db_option ::= BUFFER NK_INTEGER */ + { 260, -2 }, /* (91) alter_db_option ::= CACHELAST NK_INTEGER */ + { 260, -2 }, /* (92) alter_db_option ::= FSYNC NK_INTEGER */ + { 260, -2 }, /* (93) alter_db_option ::= KEEP integer_list */ + { 260, -2 }, /* (94) alter_db_option ::= KEEP variable_list */ + { 260, -2 }, /* (95) alter_db_option ::= PAGES NK_INTEGER */ + { 260, -2 }, /* (96) alter_db_option ::= REPLICA NK_INTEGER */ + { 260, -2 }, /* (97) alter_db_option ::= STRICT NK_INTEGER */ + { 260, -2 }, /* (98) alter_db_option ::= WAL NK_INTEGER */ + { 257, -1 }, /* (99) integer_list ::= NK_INTEGER */ + { 257, -3 }, /* (100) integer_list ::= integer_list NK_COMMA NK_INTEGER */ + { 258, -1 }, /* (101) variable_list ::= NK_VARIABLE */ + { 258, -3 }, /* (102) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ + { 259, -1 }, /* (103) retention_list ::= retention */ + { 259, -3 }, /* (104) retention_list ::= retention_list NK_COMMA retention */ + { 261, -3 }, /* (105) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ + { 240, -9 }, /* (106) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ + { 240, -3 }, /* (107) cmd ::= CREATE TABLE multi_create_clause */ + { 240, -9 }, /* (108) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ + { 240, -3 }, /* (109) cmd ::= DROP TABLE multi_drop_clause */ + { 240, -4 }, /* (110) cmd ::= DROP STABLE exists_opt full_table_name */ + { 240, -3 }, /* (111) cmd ::= ALTER TABLE alter_table_clause */ + { 240, -3 }, /* (112) cmd ::= ALTER STABLE alter_table_clause */ + { 269, -2 }, /* (113) alter_table_clause ::= full_table_name alter_table_options */ + { 269, -5 }, /* (114) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ + { 269, -4 }, /* (115) alter_table_clause ::= full_table_name DROP COLUMN column_name */ + { 269, -5 }, /* (116) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ + { 269, -5 }, /* (117) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ + { 269, -5 }, /* (118) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ + { 269, -4 }, /* (119) alter_table_clause ::= full_table_name DROP TAG column_name */ + { 269, -5 }, /* (120) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ + { 269, -5 }, /* (121) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ + { 269, -6 }, /* (122) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ + { 266, -1 }, /* (123) multi_create_clause ::= create_subtable_clause */ + { 266, -2 }, /* (124) multi_create_clause ::= multi_create_clause create_subtable_clause */ + { 274, -10 }, /* (125) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP table_options */ + { 268, -1 }, /* (126) multi_drop_clause ::= drop_table_clause */ + { 268, -2 }, /* (127) multi_drop_clause ::= multi_drop_clause drop_table_clause */ + { 277, -2 }, /* (128) drop_table_clause ::= exists_opt full_table_name */ + { 275, 0 }, /* (129) specific_tags_opt ::= */ + { 275, -3 }, /* (130) specific_tags_opt ::= NK_LP col_name_list NK_RP */ + { 262, -1 }, /* (131) full_table_name ::= table_name */ + { 262, -3 }, /* (132) full_table_name ::= db_name NK_DOT table_name */ + { 263, -1 }, /* (133) column_def_list ::= column_def */ + { 263, -3 }, /* (134) column_def_list ::= column_def_list NK_COMMA column_def */ + { 280, -2 }, /* (135) column_def ::= column_name type_name */ + { 280, -4 }, /* (136) column_def ::= column_name type_name COMMENT NK_STRING */ + { 272, -1 }, /* (137) type_name ::= BOOL */ + { 272, -1 }, /* (138) type_name ::= TINYINT */ + { 272, -1 }, /* (139) type_name ::= SMALLINT */ + { 272, -1 }, /* (140) type_name ::= INT */ + { 272, -1 }, /* (141) type_name ::= INTEGER */ + { 272, -1 }, /* (142) type_name ::= BIGINT */ + { 272, -1 }, /* (143) type_name ::= FLOAT */ + { 272, -1 }, /* (144) type_name ::= DOUBLE */ + { 272, -4 }, /* (145) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ + { 272, -1 }, /* (146) type_name ::= TIMESTAMP */ + { 272, -4 }, /* (147) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ + { 272, -2 }, /* (148) type_name ::= TINYINT UNSIGNED */ + { 272, -2 }, /* (149) type_name ::= SMALLINT UNSIGNED */ + { 272, -2 }, /* (150) type_name ::= INT UNSIGNED */ + { 272, -2 }, /* (151) type_name ::= BIGINT UNSIGNED */ + { 272, -1 }, /* (152) type_name ::= JSON */ + { 272, -4 }, /* (153) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ + { 272, -1 }, /* (154) type_name ::= MEDIUMBLOB */ + { 272, -1 }, /* (155) type_name ::= BLOB */ + { 272, -4 }, /* (156) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ + { 272, -1 }, /* (157) type_name ::= DECIMAL */ + { 272, -4 }, /* (158) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ + { 272, -6 }, /* (159) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + { 264, 0 }, /* (160) tags_def_opt ::= */ + { 264, -1 }, /* (161) tags_def_opt ::= tags_def */ + { 267, -4 }, /* (162) tags_def ::= TAGS NK_LP column_def_list NK_RP */ + { 265, 0 }, /* (163) table_options ::= */ + { 265, -3 }, /* (164) table_options ::= table_options COMMENT NK_STRING */ + { 265, -3 }, /* (165) table_options ::= table_options FILE_FACTOR NK_FLOAT */ + { 265, -5 }, /* (166) table_options ::= table_options ROLLUP NK_LP func_name_list NK_RP */ + { 265, -3 }, /* (167) table_options ::= table_options TTL NK_INTEGER */ + { 265, -5 }, /* (168) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ + { 270, -1 }, /* (169) alter_table_options ::= alter_table_option */ + { 270, -2 }, /* (170) alter_table_options ::= alter_table_options alter_table_option */ + { 282, -2 }, /* (171) alter_table_option ::= COMMENT NK_STRING */ + { 282, -2 }, /* (172) alter_table_option ::= TTL NK_INTEGER */ + { 278, -1 }, /* (173) col_name_list ::= col_name */ + { 278, -3 }, /* (174) col_name_list ::= col_name_list NK_COMMA col_name */ + { 283, -1 }, /* (175) col_name ::= column_name */ + { 240, -2 }, /* (176) cmd ::= SHOW DNODES */ + { 240, -2 }, /* (177) cmd ::= SHOW USERS */ + { 240, -2 }, /* (178) cmd ::= SHOW DATABASES */ + { 240, -4 }, /* (179) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ + { 240, -4 }, /* (180) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ + { 240, -3 }, /* (181) cmd ::= SHOW db_name_cond_opt VGROUPS */ + { 240, -2 }, /* (182) cmd ::= SHOW MNODES */ + { 240, -2 }, /* (183) cmd ::= SHOW MODULES */ + { 240, -2 }, /* (184) cmd ::= SHOW QNODES */ + { 240, -2 }, /* (185) cmd ::= SHOW FUNCTIONS */ + { 240, -5 }, /* (186) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ + { 240, -2 }, /* (187) cmd ::= SHOW STREAMS */ + { 240, -2 }, /* (188) cmd ::= SHOW ACCOUNTS */ + { 240, -2 }, /* (189) cmd ::= SHOW APPS */ + { 240, -2 }, /* (190) cmd ::= SHOW CONNECTIONS */ + { 240, -2 }, /* (191) cmd ::= SHOW LICENCE */ + { 240, -2 }, /* (192) cmd ::= SHOW GRANTS */ + { 240, -4 }, /* (193) cmd ::= SHOW CREATE DATABASE db_name */ + { 240, -4 }, /* (194) cmd ::= SHOW CREATE TABLE full_table_name */ + { 240, -4 }, /* (195) cmd ::= SHOW CREATE STABLE full_table_name */ + { 240, -2 }, /* (196) cmd ::= SHOW QUERIES */ + { 240, -2 }, /* (197) cmd ::= SHOW SCORES */ + { 240, -2 }, /* (198) cmd ::= SHOW TOPICS */ + { 240, -2 }, /* (199) cmd ::= SHOW VARIABLES */ + { 240, -2 }, /* (200) cmd ::= SHOW BNODES */ + { 240, -2 }, /* (201) cmd ::= SHOW SNODES */ + { 240, -2 }, /* (202) cmd ::= SHOW CLUSTER */ + { 240, -2 }, /* (203) cmd ::= SHOW TRANSACTIONS */ + { 284, 0 }, /* (204) db_name_cond_opt ::= */ + { 284, -2 }, /* (205) db_name_cond_opt ::= db_name NK_DOT */ + { 285, 0 }, /* (206) like_pattern_opt ::= */ + { 285, -2 }, /* (207) like_pattern_opt ::= LIKE NK_STRING */ + { 286, -1 }, /* (208) table_name_cond ::= table_name */ + { 287, 0 }, /* (209) from_db_opt ::= */ + { 287, -2 }, /* (210) from_db_opt ::= FROM db_name */ + { 281, -1 }, /* (211) func_name_list ::= func_name */ + { 281, -3 }, /* (212) func_name_list ::= func_name_list NK_COMMA func_name */ + { 288, -1 }, /* (213) func_name ::= function_name */ + { 240, -8 }, /* (214) cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ + { 240, -10 }, /* (215) cmd ::= CREATE FULLTEXT INDEX not_exists_opt index_name ON table_name NK_LP col_name_list NK_RP */ + { 240, -6 }, /* (216) cmd ::= DROP INDEX exists_opt index_name ON table_name */ + { 291, 0 }, /* (217) index_options ::= */ + { 291, -9 }, /* (218) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt */ + { 291, -11 }, /* (219) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt */ + { 292, -1 }, /* (220) func_list ::= func */ + { 292, -3 }, /* (221) func_list ::= func_list NK_COMMA func */ + { 295, -4 }, /* (222) func ::= function_name NK_LP expression_list NK_RP */ + { 240, -6 }, /* (223) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ + { 240, -7 }, /* (224) cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ + { 240, -7 }, /* (225) cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ + { 240, -4 }, /* (226) cmd ::= DROP TOPIC exists_opt topic_name */ + { 240, -7 }, /* (227) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ + { 240, -2 }, /* (228) cmd ::= DESC full_table_name */ + { 240, -2 }, /* (229) cmd ::= DESCRIBE full_table_name */ + { 240, -3 }, /* (230) cmd ::= RESET QUERY CACHE */ + { 240, -4 }, /* (231) cmd ::= EXPLAIN analyze_opt explain_options query_expression */ + { 300, 0 }, /* (232) analyze_opt ::= */ + { 300, -1 }, /* (233) analyze_opt ::= ANALYZE */ + { 301, 0 }, /* (234) explain_options ::= */ + { 301, -3 }, /* (235) explain_options ::= explain_options VERBOSE NK_BOOL */ + { 301, -3 }, /* (236) explain_options ::= explain_options RATIO NK_FLOAT */ + { 240, -6 }, /* (237) cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP */ + { 240, -10 }, /* (238) cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ + { 240, -4 }, /* (239) cmd ::= DROP FUNCTION exists_opt function_name */ + { 302, 0 }, /* (240) agg_func_opt ::= */ + { 302, -1 }, /* (241) agg_func_opt ::= AGGREGATE */ + { 303, 0 }, /* (242) bufsize_opt ::= */ + { 303, -2 }, /* (243) bufsize_opt ::= BUFSIZE NK_INTEGER */ + { 240, -8 }, /* (244) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options into_opt AS query_expression */ + { 240, -4 }, /* (245) cmd ::= DROP STREAM exists_opt stream_name */ + { 306, 0 }, /* (246) into_opt ::= */ + { 306, -2 }, /* (247) into_opt ::= INTO full_table_name */ + { 305, 0 }, /* (248) stream_options ::= */ + { 305, -3 }, /* (249) stream_options ::= stream_options TRIGGER AT_ONCE */ + { 305, -3 }, /* (250) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ + { 305, -4 }, /* (251) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ + { 305, -3 }, /* (252) stream_options ::= stream_options WATERMARK duration_literal */ + { 240, -3 }, /* (253) cmd ::= KILL CONNECTION NK_INTEGER */ + { 240, -3 }, /* (254) cmd ::= KILL QUERY NK_INTEGER */ + { 240, -3 }, /* (255) cmd ::= KILL TRANSACTION NK_INTEGER */ + { 240, -2 }, /* (256) cmd ::= BALANCE VGROUP */ + { 240, -4 }, /* (257) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + { 240, -4 }, /* (258) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ + { 240, -3 }, /* (259) cmd ::= SPLIT VGROUP NK_INTEGER */ + { 307, -2 }, /* (260) dnode_list ::= DNODE NK_INTEGER */ + { 307, -3 }, /* (261) dnode_list ::= dnode_list DNODE NK_INTEGER */ + { 240, -3 }, /* (262) cmd ::= SYNCDB db_name REPLICA */ + { 240, -4 }, /* (263) cmd ::= DELETE FROM full_table_name where_clause_opt */ + { 240, -1 }, /* (264) cmd ::= query_expression */ + { 243, -1 }, /* (265) literal ::= NK_INTEGER */ + { 243, -1 }, /* (266) literal ::= NK_FLOAT */ + { 243, -1 }, /* (267) literal ::= NK_STRING */ + { 243, -1 }, /* (268) literal ::= NK_BOOL */ + { 243, -2 }, /* (269) literal ::= TIMESTAMP NK_STRING */ + { 243, -1 }, /* (270) literal ::= duration_literal */ + { 243, -1 }, /* (271) literal ::= NULL */ + { 243, -1 }, /* (272) literal ::= NK_QUESTION */ + { 293, -1 }, /* (273) duration_literal ::= NK_VARIABLE */ + { 309, -1 }, /* (274) signed ::= NK_INTEGER */ + { 309, -2 }, /* (275) signed ::= NK_PLUS NK_INTEGER */ + { 309, -2 }, /* (276) signed ::= NK_MINUS NK_INTEGER */ + { 309, -1 }, /* (277) signed ::= NK_FLOAT */ + { 309, -2 }, /* (278) signed ::= NK_PLUS NK_FLOAT */ + { 309, -2 }, /* (279) signed ::= NK_MINUS NK_FLOAT */ + { 273, -1 }, /* (280) signed_literal ::= signed */ + { 273, -1 }, /* (281) signed_literal ::= NK_STRING */ + { 273, -1 }, /* (282) signed_literal ::= NK_BOOL */ + { 273, -2 }, /* (283) signed_literal ::= TIMESTAMP NK_STRING */ + { 273, -1 }, /* (284) signed_literal ::= duration_literal */ + { 273, -1 }, /* (285) signed_literal ::= NULL */ + { 273, -1 }, /* (286) signed_literal ::= literal_func */ + { 276, -1 }, /* (287) literal_list ::= signed_literal */ + { 276, -3 }, /* (288) literal_list ::= literal_list NK_COMMA signed_literal */ + { 250, -1 }, /* (289) db_name ::= NK_ID */ + { 279, -1 }, /* (290) table_name ::= NK_ID */ + { 271, -1 }, /* (291) column_name ::= NK_ID */ + { 289, -1 }, /* (292) function_name ::= NK_ID */ + { 311, -1 }, /* (293) table_alias ::= NK_ID */ + { 312, -1 }, /* (294) column_alias ::= NK_ID */ + { 245, -1 }, /* (295) user_name ::= NK_ID */ + { 290, -1 }, /* (296) index_name ::= NK_ID */ + { 297, -1 }, /* (297) topic_name ::= NK_ID */ + { 304, -1 }, /* (298) stream_name ::= NK_ID */ + { 299, -1 }, /* (299) cgroup_name ::= NK_ID */ + { 313, -1 }, /* (300) expression ::= literal */ + { 313, -1 }, /* (301) expression ::= pseudo_column */ + { 313, -1 }, /* (302) expression ::= column_reference */ + { 313, -1 }, /* (303) expression ::= function_expression */ + { 313, -1 }, /* (304) expression ::= subquery */ + { 313, -3 }, /* (305) expression ::= NK_LP expression NK_RP */ + { 313, -2 }, /* (306) expression ::= NK_PLUS expression */ + { 313, -2 }, /* (307) expression ::= NK_MINUS expression */ + { 313, -3 }, /* (308) expression ::= expression NK_PLUS expression */ + { 313, -3 }, /* (309) expression ::= expression NK_MINUS expression */ + { 313, -3 }, /* (310) expression ::= expression NK_STAR expression */ + { 313, -3 }, /* (311) expression ::= expression NK_SLASH expression */ + { 313, -3 }, /* (312) expression ::= expression NK_REM expression */ + { 313, -3 }, /* (313) expression ::= column_reference NK_ARROW NK_STRING */ + { 296, -1 }, /* (314) expression_list ::= expression */ + { 296, -3 }, /* (315) expression_list ::= expression_list NK_COMMA expression */ + { 315, -1 }, /* (316) column_reference ::= column_name */ + { 315, -3 }, /* (317) column_reference ::= table_name NK_DOT column_name */ + { 314, -1 }, /* (318) pseudo_column ::= ROWTS */ + { 314, -1 }, /* (319) pseudo_column ::= TBNAME */ + { 314, -3 }, /* (320) pseudo_column ::= table_name NK_DOT TBNAME */ + { 314, -1 }, /* (321) pseudo_column ::= QSTARTTS */ + { 314, -1 }, /* (322) pseudo_column ::= QENDTS */ + { 314, -1 }, /* (323) pseudo_column ::= WSTARTTS */ + { 314, -1 }, /* (324) pseudo_column ::= WENDTS */ + { 314, -1 }, /* (325) pseudo_column ::= WDURATION */ + { 316, -4 }, /* (326) function_expression ::= function_name NK_LP expression_list NK_RP */ + { 316, -4 }, /* (327) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ + { 316, -6 }, /* (328) function_expression ::= CAST NK_LP expression AS type_name NK_RP */ + { 316, -1 }, /* (329) function_expression ::= literal_func */ + { 310, -3 }, /* (330) literal_func ::= noarg_func NK_LP NK_RP */ + { 310, -1 }, /* (331) literal_func ::= NOW */ + { 320, -1 }, /* (332) noarg_func ::= NOW */ + { 320, -1 }, /* (333) noarg_func ::= TODAY */ + { 320, -1 }, /* (334) noarg_func ::= TIMEZONE */ + { 318, -1 }, /* (335) star_func ::= COUNT */ + { 318, -1 }, /* (336) star_func ::= FIRST */ + { 318, -1 }, /* (337) star_func ::= LAST */ + { 318, -1 }, /* (338) star_func ::= LAST_ROW */ + { 319, -1 }, /* (339) star_func_para_list ::= NK_STAR */ + { 319, -1 }, /* (340) star_func_para_list ::= other_para_list */ + { 321, -1 }, /* (341) other_para_list ::= star_func_para */ + { 321, -3 }, /* (342) other_para_list ::= other_para_list NK_COMMA star_func_para */ + { 322, -1 }, /* (343) star_func_para ::= expression */ + { 322, -3 }, /* (344) star_func_para ::= table_name NK_DOT NK_STAR */ + { 323, -3 }, /* (345) predicate ::= expression compare_op expression */ + { 323, -5 }, /* (346) predicate ::= expression BETWEEN expression AND expression */ + { 323, -6 }, /* (347) predicate ::= expression NOT BETWEEN expression AND expression */ + { 323, -3 }, /* (348) predicate ::= expression IS NULL */ + { 323, -4 }, /* (349) predicate ::= expression IS NOT NULL */ + { 323, -3 }, /* (350) predicate ::= expression in_op in_predicate_value */ + { 324, -1 }, /* (351) compare_op ::= NK_LT */ + { 324, -1 }, /* (352) compare_op ::= NK_GT */ + { 324, -1 }, /* (353) compare_op ::= NK_LE */ + { 324, -1 }, /* (354) compare_op ::= NK_GE */ + { 324, -1 }, /* (355) compare_op ::= NK_NE */ + { 324, -1 }, /* (356) compare_op ::= NK_EQ */ + { 324, -1 }, /* (357) compare_op ::= LIKE */ + { 324, -2 }, /* (358) compare_op ::= NOT LIKE */ + { 324, -1 }, /* (359) compare_op ::= MATCH */ + { 324, -1 }, /* (360) compare_op ::= NMATCH */ + { 324, -1 }, /* (361) compare_op ::= CONTAINS */ + { 325, -1 }, /* (362) in_op ::= IN */ + { 325, -2 }, /* (363) in_op ::= NOT IN */ + { 326, -3 }, /* (364) in_predicate_value ::= NK_LP expression_list NK_RP */ + { 327, -1 }, /* (365) boolean_value_expression ::= boolean_primary */ + { 327, -2 }, /* (366) boolean_value_expression ::= NOT boolean_primary */ + { 327, -3 }, /* (367) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + { 327, -3 }, /* (368) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + { 328, -1 }, /* (369) boolean_primary ::= predicate */ + { 328, -3 }, /* (370) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + { 329, -1 }, /* (371) common_expression ::= expression */ + { 329, -1 }, /* (372) common_expression ::= boolean_value_expression */ + { 330, -2 }, /* (373) from_clause ::= FROM table_reference_list */ + { 331, -1 }, /* (374) table_reference_list ::= table_reference */ + { 331, -3 }, /* (375) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + { 332, -1 }, /* (376) table_reference ::= table_primary */ + { 332, -1 }, /* (377) table_reference ::= joined_table */ + { 333, -2 }, /* (378) table_primary ::= table_name alias_opt */ + { 333, -4 }, /* (379) table_primary ::= db_name NK_DOT table_name alias_opt */ + { 333, -2 }, /* (380) table_primary ::= subquery alias_opt */ + { 333, -1 }, /* (381) table_primary ::= parenthesized_joined_table */ + { 335, 0 }, /* (382) alias_opt ::= */ + { 335, -1 }, /* (383) alias_opt ::= table_alias */ + { 335, -2 }, /* (384) alias_opt ::= AS table_alias */ + { 336, -3 }, /* (385) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + { 336, -3 }, /* (386) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + { 334, -6 }, /* (387) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ + { 337, 0 }, /* (388) join_type ::= */ + { 337, -1 }, /* (389) join_type ::= INNER */ + { 339, -9 }, /* (390) 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 */ + { 340, 0 }, /* (391) set_quantifier_opt ::= */ + { 340, -1 }, /* (392) set_quantifier_opt ::= DISTINCT */ + { 340, -1 }, /* (393) set_quantifier_opt ::= ALL */ + { 341, -1 }, /* (394) select_list ::= NK_STAR */ + { 341, -1 }, /* (395) select_list ::= select_sublist */ + { 346, -1 }, /* (396) select_sublist ::= select_item */ + { 346, -3 }, /* (397) select_sublist ::= select_sublist NK_COMMA select_item */ + { 347, -1 }, /* (398) select_item ::= common_expression */ + { 347, -2 }, /* (399) select_item ::= common_expression column_alias */ + { 347, -3 }, /* (400) select_item ::= common_expression AS column_alias */ + { 347, -3 }, /* (401) select_item ::= table_name NK_DOT NK_STAR */ + { 308, 0 }, /* (402) where_clause_opt ::= */ + { 308, -2 }, /* (403) where_clause_opt ::= WHERE search_condition */ + { 342, 0 }, /* (404) partition_by_clause_opt ::= */ + { 342, -3 }, /* (405) partition_by_clause_opt ::= PARTITION BY expression_list */ + { 343, 0 }, /* (406) twindow_clause_opt ::= */ + { 343, -6 }, /* (407) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ + { 343, -4 }, /* (408) twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ + { 343, -6 }, /* (409) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ + { 343, -8 }, /* (410) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ + { 294, 0 }, /* (411) sliding_opt ::= */ + { 294, -4 }, /* (412) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ + { 348, 0 }, /* (413) fill_opt ::= */ + { 348, -4 }, /* (414) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + { 348, -6 }, /* (415) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ + { 349, -1 }, /* (416) fill_mode ::= NONE */ + { 349, -1 }, /* (417) fill_mode ::= PREV */ + { 349, -1 }, /* (418) fill_mode ::= NULL */ + { 349, -1 }, /* (419) fill_mode ::= LINEAR */ + { 349, -1 }, /* (420) fill_mode ::= NEXT */ + { 344, 0 }, /* (421) group_by_clause_opt ::= */ + { 344, -3 }, /* (422) group_by_clause_opt ::= GROUP BY group_by_list */ + { 350, -1 }, /* (423) group_by_list ::= expression */ + { 350, -3 }, /* (424) group_by_list ::= group_by_list NK_COMMA expression */ + { 345, 0 }, /* (425) having_clause_opt ::= */ + { 345, -2 }, /* (426) having_clause_opt ::= HAVING search_condition */ + { 298, -4 }, /* (427) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ + { 351, -1 }, /* (428) query_expression_body ::= query_primary */ + { 351, -4 }, /* (429) query_expression_body ::= query_expression_body UNION ALL query_expression_body */ + { 351, -3 }, /* (430) query_expression_body ::= query_expression_body UNION query_expression_body */ + { 355, -1 }, /* (431) query_primary ::= query_specification */ + { 355, -6 }, /* (432) query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP */ + { 352, 0 }, /* (433) order_by_clause_opt ::= */ + { 352, -3 }, /* (434) order_by_clause_opt ::= ORDER BY sort_specification_list */ + { 353, 0 }, /* (435) slimit_clause_opt ::= */ + { 353, -2 }, /* (436) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + { 353, -4 }, /* (437) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + { 353, -4 }, /* (438) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 354, 0 }, /* (439) limit_clause_opt ::= */ + { 354, -2 }, /* (440) limit_clause_opt ::= LIMIT NK_INTEGER */ + { 354, -4 }, /* (441) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + { 354, -4 }, /* (442) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 317, -3 }, /* (443) subquery ::= NK_LP query_expression NK_RP */ + { 338, -1 }, /* (444) search_condition ::= common_expression */ + { 356, -1 }, /* (445) sort_specification_list ::= sort_specification */ + { 356, -3 }, /* (446) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + { 357, -3 }, /* (447) sort_specification ::= expression ordering_specification_opt null_ordering_opt */ + { 358, 0 }, /* (448) ordering_specification_opt ::= */ + { 358, -1 }, /* (449) ordering_specification_opt ::= ASC */ + { 358, -1 }, /* (450) ordering_specification_opt ::= DESC */ + { 359, 0 }, /* (451) null_ordering_opt ::= */ + { 359, -2 }, /* (452) null_ordering_opt ::= NULLS FIRST */ + { 359, -2 }, /* (453) null_ordering_opt ::= NULLS LAST */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -3108,11 +3117,11 @@ static YYACTIONTYPE yy_reduce( YYMINORTYPE yylhsminor; case 0: /* cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } - yy_destructor(yypParser,240,&yymsp[0].minor); + yy_destructor(yypParser,241,&yymsp[0].minor); break; case 1: /* cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } - yy_destructor(yypParser,241,&yymsp[0].minor); + yy_destructor(yypParser,242,&yymsp[0].minor); break; case 2: /* account_options ::= */ { } @@ -3126,20 +3135,20 @@ static YYACTIONTYPE yy_reduce( case 9: /* account_options ::= account_options USERS literal */ yytestcase(yyruleno==9); case 10: /* account_options ::= account_options CONNS literal */ yytestcase(yyruleno==10); case 11: /* account_options ::= account_options STATE literal */ yytestcase(yyruleno==11); -{ yy_destructor(yypParser,240,&yymsp[-2].minor); +{ yy_destructor(yypParser,241,&yymsp[-2].minor); { } - yy_destructor(yypParser,242,&yymsp[0].minor); + yy_destructor(yypParser,243,&yymsp[0].minor); } break; case 12: /* alter_account_options ::= alter_account_option */ -{ yy_destructor(yypParser,243,&yymsp[0].minor); +{ yy_destructor(yypParser,244,&yymsp[0].minor); { } } break; case 13: /* alter_account_options ::= alter_account_options alter_account_option */ -{ yy_destructor(yypParser,241,&yymsp[-1].minor); +{ yy_destructor(yypParser,242,&yymsp[-1].minor); { } - yy_destructor(yypParser,243,&yymsp[0].minor); + yy_destructor(yypParser,244,&yymsp[0].minor); } break; case 14: /* alter_account_option ::= PASS literal */ @@ -3153,63 +3162,63 @@ static YYACTIONTYPE yy_reduce( case 22: /* alter_account_option ::= CONNS literal */ yytestcase(yyruleno==22); case 23: /* alter_account_option ::= STATE literal */ yytestcase(yyruleno==23); { } - yy_destructor(yypParser,242,&yymsp[0].minor); + yy_destructor(yypParser,243,&yymsp[0].minor); break; case 24: /* cmd ::= CREATE USER user_name PASS NK_STRING */ -{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-2].minor.yy421, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-2].minor.yy209, &yymsp[0].minor.yy0); } break; case 25: /* cmd ::= ALTER USER user_name PASS NK_STRING */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy421, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy209, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } break; case 26: /* cmd ::= ALTER USER user_name PRIVILEGE NK_STRING */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy421, TSDB_ALTER_USER_PRIVILEGES, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy209, TSDB_ALTER_USER_PRIVILEGES, &yymsp[0].minor.yy0); } break; case 27: /* cmd ::= DROP USER user_name */ -{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy421); } +{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy209); } break; case 28: /* cmd ::= GRANT privileges ON priv_level TO user_name */ -{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-4].minor.yy669, &yymsp[-2].minor.yy421, &yymsp[0].minor.yy421); } +{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-4].minor.yy189, &yymsp[-2].minor.yy209, &yymsp[0].minor.yy209); } break; case 29: /* cmd ::= REVOKE privileges ON priv_level FROM user_name */ -{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-4].minor.yy669, &yymsp[-2].minor.yy421, &yymsp[0].minor.yy421); } +{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-4].minor.yy189, &yymsp[-2].minor.yy209, &yymsp[0].minor.yy209); } break; case 30: /* privileges ::= ALL */ -{ yymsp[0].minor.yy669 = PRIVILEGE_TYPE_ALL; } +{ yymsp[0].minor.yy189 = PRIVILEGE_TYPE_ALL; } break; case 31: /* privileges ::= priv_type_list */ case 32: /* priv_type_list ::= priv_type */ yytestcase(yyruleno==32); -{ yylhsminor.yy669 = yymsp[0].minor.yy669; } - yymsp[0].minor.yy669 = yylhsminor.yy669; +{ yylhsminor.yy189 = yymsp[0].minor.yy189; } + yymsp[0].minor.yy189 = yylhsminor.yy189; break; case 33: /* priv_type_list ::= priv_type_list NK_COMMA priv_type */ -{ yylhsminor.yy669 = yymsp[-2].minor.yy669 | yymsp[0].minor.yy669; } - yymsp[-2].minor.yy669 = yylhsminor.yy669; +{ yylhsminor.yy189 = yymsp[-2].minor.yy189 | yymsp[0].minor.yy189; } + yymsp[-2].minor.yy189 = yylhsminor.yy189; break; case 34: /* priv_type ::= READ */ -{ yymsp[0].minor.yy669 = PRIVILEGE_TYPE_READ; } +{ yymsp[0].minor.yy189 = PRIVILEGE_TYPE_READ; } break; case 35: /* priv_type ::= WRITE */ -{ yymsp[0].minor.yy669 = PRIVILEGE_TYPE_WRITE; } +{ yymsp[0].minor.yy189 = PRIVILEGE_TYPE_WRITE; } break; case 36: /* priv_level ::= NK_STAR NK_DOT NK_STAR */ -{ yylhsminor.yy421 = yymsp[-2].minor.yy0; } - yymsp[-2].minor.yy421 = yylhsminor.yy421; +{ yylhsminor.yy209 = yymsp[-2].minor.yy0; } + yymsp[-2].minor.yy209 = yylhsminor.yy209; break; case 37: /* priv_level ::= db_name NK_DOT NK_STAR */ -{ yylhsminor.yy421 = yymsp[-2].minor.yy421; } - yymsp[-2].minor.yy421 = yylhsminor.yy421; +{ yylhsminor.yy209 = yymsp[-2].minor.yy209; } + yymsp[-2].minor.yy209 = yylhsminor.yy209; break; case 38: /* cmd ::= CREATE DNODE dnode_endpoint */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy421, NULL); } +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy209, NULL); } break; case 39: /* cmd ::= CREATE DNODE dnode_host_name PORT NK_INTEGER */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy421, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy209, &yymsp[0].minor.yy0); } break; case 40: /* cmd ::= DROP DNODE NK_INTEGER */ { pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy0); } break; case 41: /* cmd ::= DROP DNODE dnode_endpoint */ -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy421); } +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy209); } break; case 42: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); } @@ -3226,26 +3235,26 @@ static YYACTIONTYPE yy_reduce( case 46: /* dnode_endpoint ::= NK_STRING */ case 47: /* dnode_host_name ::= NK_ID */ yytestcase(yyruleno==47); case 48: /* dnode_host_name ::= NK_IPTOKEN */ yytestcase(yyruleno==48); - case 288: /* db_name ::= NK_ID */ yytestcase(yyruleno==288); - case 289: /* table_name ::= NK_ID */ yytestcase(yyruleno==289); - case 290: /* column_name ::= NK_ID */ yytestcase(yyruleno==290); - case 291: /* function_name ::= NK_ID */ yytestcase(yyruleno==291); - case 292: /* table_alias ::= NK_ID */ yytestcase(yyruleno==292); - case 293: /* column_alias ::= NK_ID */ yytestcase(yyruleno==293); - case 294: /* user_name ::= NK_ID */ yytestcase(yyruleno==294); - case 295: /* index_name ::= NK_ID */ yytestcase(yyruleno==295); - case 296: /* topic_name ::= NK_ID */ yytestcase(yyruleno==296); - case 297: /* stream_name ::= NK_ID */ yytestcase(yyruleno==297); - case 298: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==298); - case 331: /* noarg_func ::= NOW */ yytestcase(yyruleno==331); - case 332: /* noarg_func ::= TODAY */ yytestcase(yyruleno==332); - case 333: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==333); - case 334: /* star_func ::= COUNT */ yytestcase(yyruleno==334); - case 335: /* star_func ::= FIRST */ yytestcase(yyruleno==335); - case 336: /* star_func ::= LAST */ yytestcase(yyruleno==336); - case 337: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==337); -{ yylhsminor.yy421 = yymsp[0].minor.yy0; } - yymsp[0].minor.yy421 = yylhsminor.yy421; + case 289: /* db_name ::= NK_ID */ yytestcase(yyruleno==289); + case 290: /* table_name ::= NK_ID */ yytestcase(yyruleno==290); + case 291: /* column_name ::= NK_ID */ yytestcase(yyruleno==291); + case 292: /* function_name ::= NK_ID */ yytestcase(yyruleno==292); + case 293: /* table_alias ::= NK_ID */ yytestcase(yyruleno==293); + case 294: /* column_alias ::= NK_ID */ yytestcase(yyruleno==294); + case 295: /* user_name ::= NK_ID */ yytestcase(yyruleno==295); + case 296: /* index_name ::= NK_ID */ yytestcase(yyruleno==296); + case 297: /* topic_name ::= NK_ID */ yytestcase(yyruleno==297); + case 298: /* stream_name ::= NK_ID */ yytestcase(yyruleno==298); + case 299: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==299); + case 332: /* noarg_func ::= NOW */ yytestcase(yyruleno==332); + case 333: /* noarg_func ::= TODAY */ yytestcase(yyruleno==333); + case 334: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==334); + case 335: /* star_func ::= COUNT */ yytestcase(yyruleno==335); + case 336: /* star_func ::= FIRST */ yytestcase(yyruleno==336); + case 337: /* star_func ::= LAST */ yytestcase(yyruleno==337); + case 338: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==338); +{ yylhsminor.yy209 = yymsp[0].minor.yy0; } + yymsp[0].minor.yy209 = yylhsminor.yy209; break; case 49: /* cmd ::= ALTER LOCAL NK_STRING */ { pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[0].minor.yy0, NULL); } @@ -3278,156 +3287,156 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_MNODE_STMT, &yymsp[0].minor.yy0); } break; case 59: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ -{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy621, &yymsp[-1].minor.yy421, yymsp[0].minor.yy674); } +{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy137, &yymsp[-1].minor.yy209, yymsp[0].minor.yy632); } break; case 60: /* cmd ::= DROP DATABASE exists_opt db_name */ -{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy621, &yymsp[0].minor.yy421); } +{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy137, &yymsp[0].minor.yy209); } break; case 61: /* cmd ::= USE db_name */ -{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy421); } +{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy209); } break; case 62: /* cmd ::= ALTER DATABASE db_name alter_db_options */ -{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy421, yymsp[0].minor.yy674); } +{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy209, yymsp[0].minor.yy632); } break; case 63: /* not_exists_opt ::= IF NOT EXISTS */ -{ yymsp[-2].minor.yy621 = true; } +{ yymsp[-2].minor.yy137 = true; } break; case 64: /* not_exists_opt ::= */ case 66: /* exists_opt ::= */ yytestcase(yyruleno==66); case 232: /* analyze_opt ::= */ yytestcase(yyruleno==232); case 240: /* agg_func_opt ::= */ yytestcase(yyruleno==240); - case 390: /* set_quantifier_opt ::= */ yytestcase(yyruleno==390); -{ yymsp[1].minor.yy621 = false; } + case 391: /* set_quantifier_opt ::= */ yytestcase(yyruleno==391); +{ yymsp[1].minor.yy137 = false; } break; case 65: /* exists_opt ::= IF EXISTS */ -{ yymsp[-1].minor.yy621 = true; } +{ yymsp[-1].minor.yy137 = true; } break; case 67: /* db_options ::= */ -{ yymsp[1].minor.yy674 = createDefaultDatabaseOptions(pCxt); } +{ yymsp[1].minor.yy632 = createDefaultDatabaseOptions(pCxt); } break; case 68: /* db_options ::= db_options BUFFER NK_INTEGER */ -{ yylhsminor.yy674 = setDatabaseOption(pCxt, yymsp[-2].minor.yy674, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy674 = yylhsminor.yy674; +{ yylhsminor.yy632 = setDatabaseOption(pCxt, yymsp[-2].minor.yy632, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy632 = yylhsminor.yy632; break; case 69: /* db_options ::= db_options CACHELAST NK_INTEGER */ -{ yylhsminor.yy674 = setDatabaseOption(pCxt, yymsp[-2].minor.yy674, DB_OPTION_CACHELAST, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy674 = yylhsminor.yy674; +{ yylhsminor.yy632 = setDatabaseOption(pCxt, yymsp[-2].minor.yy632, DB_OPTION_CACHELAST, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy632 = yylhsminor.yy632; break; case 70: /* db_options ::= db_options COMP NK_INTEGER */ -{ yylhsminor.yy674 = setDatabaseOption(pCxt, yymsp[-2].minor.yy674, DB_OPTION_COMP, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy674 = yylhsminor.yy674; +{ yylhsminor.yy632 = setDatabaseOption(pCxt, yymsp[-2].minor.yy632, DB_OPTION_COMP, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy632 = yylhsminor.yy632; break; case 71: /* db_options ::= db_options DAYS NK_INTEGER */ case 72: /* db_options ::= db_options DAYS NK_VARIABLE */ yytestcase(yyruleno==72); -{ yylhsminor.yy674 = setDatabaseOption(pCxt, yymsp[-2].minor.yy674, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy674 = yylhsminor.yy674; +{ yylhsminor.yy632 = setDatabaseOption(pCxt, yymsp[-2].minor.yy632, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy632 = yylhsminor.yy632; break; case 73: /* db_options ::= db_options FSYNC NK_INTEGER */ -{ yylhsminor.yy674 = setDatabaseOption(pCxt, yymsp[-2].minor.yy674, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy674 = yylhsminor.yy674; +{ yylhsminor.yy632 = setDatabaseOption(pCxt, yymsp[-2].minor.yy632, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy632 = yylhsminor.yy632; break; case 74: /* db_options ::= db_options MAXROWS NK_INTEGER */ -{ yylhsminor.yy674 = setDatabaseOption(pCxt, yymsp[-2].minor.yy674, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy674 = yylhsminor.yy674; +{ yylhsminor.yy632 = setDatabaseOption(pCxt, yymsp[-2].minor.yy632, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy632 = yylhsminor.yy632; break; case 75: /* db_options ::= db_options MINROWS NK_INTEGER */ -{ yylhsminor.yy674 = setDatabaseOption(pCxt, yymsp[-2].minor.yy674, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy674 = yylhsminor.yy674; +{ yylhsminor.yy632 = setDatabaseOption(pCxt, yymsp[-2].minor.yy632, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy632 = yylhsminor.yy632; break; case 76: /* db_options ::= db_options KEEP integer_list */ case 77: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==77); -{ yylhsminor.yy674 = setDatabaseOption(pCxt, yymsp[-2].minor.yy674, DB_OPTION_KEEP, yymsp[0].minor.yy530); } - yymsp[-2].minor.yy674 = yylhsminor.yy674; +{ yylhsminor.yy632 = setDatabaseOption(pCxt, yymsp[-2].minor.yy632, DB_OPTION_KEEP, yymsp[0].minor.yy424); } + yymsp[-2].minor.yy632 = yylhsminor.yy632; break; case 78: /* db_options ::= db_options PAGES NK_INTEGER */ -{ yylhsminor.yy674 = setDatabaseOption(pCxt, yymsp[-2].minor.yy674, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy674 = yylhsminor.yy674; +{ yylhsminor.yy632 = setDatabaseOption(pCxt, yymsp[-2].minor.yy632, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy632 = yylhsminor.yy632; break; case 79: /* db_options ::= db_options PAGESIZE NK_INTEGER */ -{ yylhsminor.yy674 = setDatabaseOption(pCxt, yymsp[-2].minor.yy674, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy674 = yylhsminor.yy674; +{ yylhsminor.yy632 = setDatabaseOption(pCxt, yymsp[-2].minor.yy632, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy632 = yylhsminor.yy632; break; case 80: /* db_options ::= db_options PRECISION NK_STRING */ -{ yylhsminor.yy674 = setDatabaseOption(pCxt, yymsp[-2].minor.yy674, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy674 = yylhsminor.yy674; +{ yylhsminor.yy632 = setDatabaseOption(pCxt, yymsp[-2].minor.yy632, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy632 = yylhsminor.yy632; break; case 81: /* db_options ::= db_options REPLICA NK_INTEGER */ -{ yylhsminor.yy674 = setDatabaseOption(pCxt, yymsp[-2].minor.yy674, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy674 = yylhsminor.yy674; +{ yylhsminor.yy632 = setDatabaseOption(pCxt, yymsp[-2].minor.yy632, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy632 = yylhsminor.yy632; break; case 82: /* db_options ::= db_options STRICT NK_INTEGER */ -{ yylhsminor.yy674 = setDatabaseOption(pCxt, yymsp[-2].minor.yy674, DB_OPTION_STRICT, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy674 = yylhsminor.yy674; +{ yylhsminor.yy632 = setDatabaseOption(pCxt, yymsp[-2].minor.yy632, DB_OPTION_STRICT, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy632 = yylhsminor.yy632; break; case 83: /* db_options ::= db_options WAL NK_INTEGER */ -{ yylhsminor.yy674 = setDatabaseOption(pCxt, yymsp[-2].minor.yy674, DB_OPTION_WAL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy674 = yylhsminor.yy674; +{ yylhsminor.yy632 = setDatabaseOption(pCxt, yymsp[-2].minor.yy632, DB_OPTION_WAL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy632 = yylhsminor.yy632; break; case 84: /* db_options ::= db_options VGROUPS NK_INTEGER */ -{ yylhsminor.yy674 = setDatabaseOption(pCxt, yymsp[-2].minor.yy674, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy674 = yylhsminor.yy674; +{ yylhsminor.yy632 = setDatabaseOption(pCxt, yymsp[-2].minor.yy632, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy632 = yylhsminor.yy632; break; case 85: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */ -{ yylhsminor.yy674 = setDatabaseOption(pCxt, yymsp[-2].minor.yy674, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy674 = yylhsminor.yy674; +{ yylhsminor.yy632 = setDatabaseOption(pCxt, yymsp[-2].minor.yy632, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy632 = yylhsminor.yy632; break; case 86: /* db_options ::= db_options RETENTIONS retention_list */ -{ yylhsminor.yy674 = setDatabaseOption(pCxt, yymsp[-2].minor.yy674, DB_OPTION_RETENTIONS, yymsp[0].minor.yy530); } - yymsp[-2].minor.yy674 = yylhsminor.yy674; +{ yylhsminor.yy632 = setDatabaseOption(pCxt, yymsp[-2].minor.yy632, DB_OPTION_RETENTIONS, yymsp[0].minor.yy424); } + yymsp[-2].minor.yy632 = yylhsminor.yy632; break; case 87: /* db_options ::= db_options SCHEMALESS NK_INTEGER */ -{ yylhsminor.yy674 = setDatabaseOption(pCxt, yymsp[-2].minor.yy674, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy674 = yylhsminor.yy674; +{ yylhsminor.yy632 = setDatabaseOption(pCxt, yymsp[-2].minor.yy632, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy632 = yylhsminor.yy632; break; case 88: /* alter_db_options ::= alter_db_option */ -{ yylhsminor.yy674 = createAlterDatabaseOptions(pCxt); yylhsminor.yy674 = setAlterDatabaseOption(pCxt, yylhsminor.yy674, &yymsp[0].minor.yy557); } - yymsp[0].minor.yy674 = yylhsminor.yy674; +{ yylhsminor.yy632 = createAlterDatabaseOptions(pCxt); yylhsminor.yy632 = setAlterDatabaseOption(pCxt, yylhsminor.yy632, &yymsp[0].minor.yy605); } + yymsp[0].minor.yy632 = yylhsminor.yy632; break; case 89: /* alter_db_options ::= alter_db_options alter_db_option */ -{ yylhsminor.yy674 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy674, &yymsp[0].minor.yy557); } - yymsp[-1].minor.yy674 = yylhsminor.yy674; +{ yylhsminor.yy632 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy632, &yymsp[0].minor.yy605); } + yymsp[-1].minor.yy632 = yylhsminor.yy632; break; case 90: /* alter_db_option ::= BUFFER NK_INTEGER */ -{ yymsp[-1].minor.yy557.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy557.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy605.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy605.val = yymsp[0].minor.yy0; } break; case 91: /* alter_db_option ::= CACHELAST NK_INTEGER */ -{ yymsp[-1].minor.yy557.type = DB_OPTION_CACHELAST; yymsp[-1].minor.yy557.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy605.type = DB_OPTION_CACHELAST; yymsp[-1].minor.yy605.val = yymsp[0].minor.yy0; } break; case 92: /* alter_db_option ::= FSYNC NK_INTEGER */ -{ yymsp[-1].minor.yy557.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy557.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy605.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy605.val = yymsp[0].minor.yy0; } break; case 93: /* alter_db_option ::= KEEP integer_list */ case 94: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==94); -{ yymsp[-1].minor.yy557.type = DB_OPTION_KEEP; yymsp[-1].minor.yy557.pList = yymsp[0].minor.yy530; } +{ yymsp[-1].minor.yy605.type = DB_OPTION_KEEP; yymsp[-1].minor.yy605.pList = yymsp[0].minor.yy424; } break; case 95: /* alter_db_option ::= PAGES NK_INTEGER */ -{ yymsp[-1].minor.yy557.type = DB_OPTION_PAGES; yymsp[-1].minor.yy557.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy605.type = DB_OPTION_PAGES; yymsp[-1].minor.yy605.val = yymsp[0].minor.yy0; } break; case 96: /* alter_db_option ::= REPLICA NK_INTEGER */ -{ yymsp[-1].minor.yy557.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy557.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy605.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy605.val = yymsp[0].minor.yy0; } break; case 97: /* alter_db_option ::= STRICT NK_INTEGER */ -{ yymsp[-1].minor.yy557.type = DB_OPTION_STRICT; yymsp[-1].minor.yy557.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy605.type = DB_OPTION_STRICT; yymsp[-1].minor.yy605.val = yymsp[0].minor.yy0; } break; case 98: /* alter_db_option ::= WAL NK_INTEGER */ -{ yymsp[-1].minor.yy557.type = DB_OPTION_WAL; yymsp[-1].minor.yy557.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy605.type = DB_OPTION_WAL; yymsp[-1].minor.yy605.val = yymsp[0].minor.yy0; } break; case 99: /* integer_list ::= NK_INTEGER */ -{ yylhsminor.yy530 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy530 = yylhsminor.yy530; +{ yylhsminor.yy424 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy424 = yylhsminor.yy424; break; case 100: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */ - case 260: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==260); -{ yylhsminor.yy530 = addNodeToList(pCxt, yymsp[-2].minor.yy530, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy530 = yylhsminor.yy530; + case 261: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==261); +{ yylhsminor.yy424 = addNodeToList(pCxt, yymsp[-2].minor.yy424, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy424 = yylhsminor.yy424; break; case 101: /* variable_list ::= NK_VARIABLE */ -{ yylhsminor.yy530 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy530 = yylhsminor.yy530; +{ yylhsminor.yy424 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy424 = yylhsminor.yy424; break; case 102: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */ -{ yylhsminor.yy530 = addNodeToList(pCxt, yymsp[-2].minor.yy530, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy530 = yylhsminor.yy530; +{ yylhsminor.yy424 = addNodeToList(pCxt, yymsp[-2].minor.yy424, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy424 = yylhsminor.yy424; break; case 103: /* retention_list ::= retention */ case 123: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==123); @@ -3436,242 +3445,242 @@ static YYACTIONTYPE yy_reduce( case 173: /* col_name_list ::= col_name */ yytestcase(yyruleno==173); case 211: /* func_name_list ::= func_name */ yytestcase(yyruleno==211); case 220: /* func_list ::= func */ yytestcase(yyruleno==220); - case 286: /* literal_list ::= signed_literal */ yytestcase(yyruleno==286); - case 340: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==340); - case 395: /* select_sublist ::= select_item */ yytestcase(yyruleno==395); - case 444: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==444); -{ yylhsminor.yy530 = createNodeList(pCxt, yymsp[0].minor.yy674); } - yymsp[0].minor.yy530 = yylhsminor.yy530; + case 287: /* literal_list ::= signed_literal */ yytestcase(yyruleno==287); + case 341: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==341); + case 396: /* select_sublist ::= select_item */ yytestcase(yyruleno==396); + case 445: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==445); +{ yylhsminor.yy424 = createNodeList(pCxt, yymsp[0].minor.yy632); } + yymsp[0].minor.yy424 = yylhsminor.yy424; break; case 104: /* retention_list ::= retention_list NK_COMMA retention */ case 134: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==134); case 174: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==174); case 212: /* func_name_list ::= func_name_list NK_COMMA func_name */ yytestcase(yyruleno==212); case 221: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==221); - case 287: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==287); - case 341: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==341); - case 396: /* select_sublist ::= select_sublist NK_COMMA select_item */ yytestcase(yyruleno==396); - case 445: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==445); -{ yylhsminor.yy530 = addNodeToList(pCxt, yymsp[-2].minor.yy530, yymsp[0].minor.yy674); } - yymsp[-2].minor.yy530 = yylhsminor.yy530; + case 288: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==288); + case 342: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==342); + case 397: /* select_sublist ::= select_sublist NK_COMMA select_item */ yytestcase(yyruleno==397); + case 446: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==446); +{ yylhsminor.yy424 = addNodeToList(pCxt, yymsp[-2].minor.yy424, yymsp[0].minor.yy632); } + yymsp[-2].minor.yy424 = yylhsminor.yy424; break; case 105: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ -{ yylhsminor.yy674 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy674 = yylhsminor.yy674; +{ yylhsminor.yy632 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy632 = yylhsminor.yy632; break; case 106: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ case 108: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==108); -{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy621, yymsp[-5].minor.yy674, yymsp[-3].minor.yy530, yymsp[-1].minor.yy530, yymsp[0].minor.yy674); } +{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy137, yymsp[-5].minor.yy632, yymsp[-3].minor.yy424, yymsp[-1].minor.yy424, yymsp[0].minor.yy632); } break; case 107: /* cmd ::= CREATE TABLE multi_create_clause */ -{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy530); } +{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy424); } break; case 109: /* cmd ::= DROP TABLE multi_drop_clause */ -{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy530); } +{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy424); } break; case 110: /* cmd ::= DROP STABLE exists_opt full_table_name */ -{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy621, yymsp[0].minor.yy674); } +{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy137, yymsp[0].minor.yy632); } break; case 111: /* cmd ::= ALTER TABLE alter_table_clause */ case 112: /* cmd ::= ALTER STABLE alter_table_clause */ yytestcase(yyruleno==112); - case 263: /* cmd ::= query_expression */ yytestcase(yyruleno==263); -{ pCxt->pRootNode = yymsp[0].minor.yy674; } + case 264: /* cmd ::= query_expression */ yytestcase(yyruleno==264); +{ pCxt->pRootNode = yymsp[0].minor.yy632; } break; case 113: /* alter_table_clause ::= full_table_name alter_table_options */ -{ yylhsminor.yy674 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy674, yymsp[0].minor.yy674); } - yymsp[-1].minor.yy674 = yylhsminor.yy674; +{ yylhsminor.yy632 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy632, yymsp[0].minor.yy632); } + yymsp[-1].minor.yy632 = yylhsminor.yy632; break; case 114: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ -{ yylhsminor.yy674 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy674, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy421, yymsp[0].minor.yy690); } - yymsp[-4].minor.yy674 = yylhsminor.yy674; +{ yylhsminor.yy632 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy632, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy209, yymsp[0].minor.yy304); } + yymsp[-4].minor.yy632 = yylhsminor.yy632; break; case 115: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ -{ yylhsminor.yy674 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy674, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy421); } - yymsp[-3].minor.yy674 = yylhsminor.yy674; +{ yylhsminor.yy632 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy632, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy209); } + yymsp[-3].minor.yy632 = yylhsminor.yy632; break; case 116: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ -{ yylhsminor.yy674 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy674, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy421, yymsp[0].minor.yy690); } - yymsp[-4].minor.yy674 = yylhsminor.yy674; +{ yylhsminor.yy632 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy632, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy209, yymsp[0].minor.yy304); } + yymsp[-4].minor.yy632 = yylhsminor.yy632; break; case 117: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ -{ yylhsminor.yy674 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy674, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy421, &yymsp[0].minor.yy421); } - yymsp[-4].minor.yy674 = yylhsminor.yy674; +{ yylhsminor.yy632 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy632, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy209, &yymsp[0].minor.yy209); } + yymsp[-4].minor.yy632 = yylhsminor.yy632; break; case 118: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ -{ yylhsminor.yy674 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy674, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy421, yymsp[0].minor.yy690); } - yymsp[-4].minor.yy674 = yylhsminor.yy674; +{ yylhsminor.yy632 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy632, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy209, yymsp[0].minor.yy304); } + yymsp[-4].minor.yy632 = yylhsminor.yy632; break; case 119: /* alter_table_clause ::= full_table_name DROP TAG column_name */ -{ yylhsminor.yy674 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy674, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy421); } - yymsp[-3].minor.yy674 = yylhsminor.yy674; +{ yylhsminor.yy632 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy632, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy209); } + yymsp[-3].minor.yy632 = yylhsminor.yy632; break; case 120: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ -{ yylhsminor.yy674 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy674, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy421, yymsp[0].minor.yy690); } - yymsp[-4].minor.yy674 = yylhsminor.yy674; +{ yylhsminor.yy632 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy632, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy209, yymsp[0].minor.yy304); } + yymsp[-4].minor.yy632 = yylhsminor.yy632; break; case 121: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ -{ yylhsminor.yy674 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy674, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy421, &yymsp[0].minor.yy421); } - yymsp[-4].minor.yy674 = yylhsminor.yy674; +{ yylhsminor.yy632 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy632, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy209, &yymsp[0].minor.yy209); } + yymsp[-4].minor.yy632 = yylhsminor.yy632; break; case 122: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ -{ yylhsminor.yy674 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy674, &yymsp[-2].minor.yy421, yymsp[0].minor.yy674); } - yymsp[-5].minor.yy674 = yylhsminor.yy674; +{ yylhsminor.yy632 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy632, &yymsp[-2].minor.yy209, yymsp[0].minor.yy632); } + yymsp[-5].minor.yy632 = yylhsminor.yy632; break; case 124: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ case 127: /* multi_drop_clause ::= multi_drop_clause drop_table_clause */ yytestcase(yyruleno==127); -{ yylhsminor.yy530 = addNodeToList(pCxt, yymsp[-1].minor.yy530, yymsp[0].minor.yy674); } - yymsp[-1].minor.yy530 = yylhsminor.yy530; +{ yylhsminor.yy424 = addNodeToList(pCxt, yymsp[-1].minor.yy424, yymsp[0].minor.yy632); } + yymsp[-1].minor.yy424 = yylhsminor.yy424; break; case 125: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP table_options */ -{ yylhsminor.yy674 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy621, yymsp[-8].minor.yy674, yymsp[-6].minor.yy674, yymsp[-5].minor.yy530, yymsp[-2].minor.yy530, yymsp[0].minor.yy674); } - yymsp[-9].minor.yy674 = yylhsminor.yy674; +{ yylhsminor.yy632 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy137, yymsp[-8].minor.yy632, yymsp[-6].minor.yy632, yymsp[-5].minor.yy424, yymsp[-2].minor.yy424, yymsp[0].minor.yy632); } + yymsp[-9].minor.yy632 = yylhsminor.yy632; break; case 128: /* drop_table_clause ::= exists_opt full_table_name */ -{ yylhsminor.yy674 = createDropTableClause(pCxt, yymsp[-1].minor.yy621, yymsp[0].minor.yy674); } - yymsp[-1].minor.yy674 = yylhsminor.yy674; +{ yylhsminor.yy632 = createDropTableClause(pCxt, yymsp[-1].minor.yy137, yymsp[0].minor.yy632); } + yymsp[-1].minor.yy632 = yylhsminor.yy632; break; case 129: /* specific_tags_opt ::= */ case 160: /* tags_def_opt ::= */ yytestcase(yyruleno==160); - case 403: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==403); - case 420: /* group_by_clause_opt ::= */ yytestcase(yyruleno==420); - case 432: /* order_by_clause_opt ::= */ yytestcase(yyruleno==432); -{ yymsp[1].minor.yy530 = NULL; } + case 404: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==404); + case 421: /* group_by_clause_opt ::= */ yytestcase(yyruleno==421); + case 433: /* order_by_clause_opt ::= */ yytestcase(yyruleno==433); +{ yymsp[1].minor.yy424 = NULL; } break; case 130: /* specific_tags_opt ::= NK_LP col_name_list NK_RP */ -{ yymsp[-2].minor.yy530 = yymsp[-1].minor.yy530; } +{ yymsp[-2].minor.yy424 = yymsp[-1].minor.yy424; } break; case 131: /* full_table_name ::= table_name */ -{ yylhsminor.yy674 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy421, NULL); } - yymsp[0].minor.yy674 = yylhsminor.yy674; +{ yylhsminor.yy632 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy209, NULL); } + yymsp[0].minor.yy632 = yylhsminor.yy632; break; case 132: /* full_table_name ::= db_name NK_DOT table_name */ -{ yylhsminor.yy674 = createRealTableNode(pCxt, &yymsp[-2].minor.yy421, &yymsp[0].minor.yy421, NULL); } - yymsp[-2].minor.yy674 = yylhsminor.yy674; +{ yylhsminor.yy632 = createRealTableNode(pCxt, &yymsp[-2].minor.yy209, &yymsp[0].minor.yy209, NULL); } + yymsp[-2].minor.yy632 = yylhsminor.yy632; break; case 135: /* column_def ::= column_name type_name */ -{ yylhsminor.yy674 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy421, yymsp[0].minor.yy690, NULL); } - yymsp[-1].minor.yy674 = yylhsminor.yy674; +{ yylhsminor.yy632 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy209, yymsp[0].minor.yy304, NULL); } + yymsp[-1].minor.yy632 = yylhsminor.yy632; break; case 136: /* column_def ::= column_name type_name COMMENT NK_STRING */ -{ yylhsminor.yy674 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy421, yymsp[-2].minor.yy690, &yymsp[0].minor.yy0); } - yymsp[-3].minor.yy674 = yylhsminor.yy674; +{ yylhsminor.yy632 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy209, yymsp[-2].minor.yy304, &yymsp[0].minor.yy0); } + yymsp[-3].minor.yy632 = yylhsminor.yy632; break; case 137: /* type_name ::= BOOL */ -{ yymsp[0].minor.yy690 = createDataType(TSDB_DATA_TYPE_BOOL); } +{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_BOOL); } break; case 138: /* type_name ::= TINYINT */ -{ yymsp[0].minor.yy690 = createDataType(TSDB_DATA_TYPE_TINYINT); } +{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_TINYINT); } break; case 139: /* type_name ::= SMALLINT */ -{ yymsp[0].minor.yy690 = createDataType(TSDB_DATA_TYPE_SMALLINT); } +{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_SMALLINT); } break; case 140: /* type_name ::= INT */ case 141: /* type_name ::= INTEGER */ yytestcase(yyruleno==141); -{ yymsp[0].minor.yy690 = createDataType(TSDB_DATA_TYPE_INT); } +{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_INT); } break; case 142: /* type_name ::= BIGINT */ -{ yymsp[0].minor.yy690 = createDataType(TSDB_DATA_TYPE_BIGINT); } +{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_BIGINT); } break; case 143: /* type_name ::= FLOAT */ -{ yymsp[0].minor.yy690 = createDataType(TSDB_DATA_TYPE_FLOAT); } +{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_FLOAT); } break; case 144: /* type_name ::= DOUBLE */ -{ yymsp[0].minor.yy690 = createDataType(TSDB_DATA_TYPE_DOUBLE); } +{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_DOUBLE); } break; case 145: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy690 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy304 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } break; case 146: /* type_name ::= TIMESTAMP */ -{ yymsp[0].minor.yy690 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } +{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } break; case 147: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy690 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy304 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } break; case 148: /* type_name ::= TINYINT UNSIGNED */ -{ yymsp[-1].minor.yy690 = createDataType(TSDB_DATA_TYPE_UTINYINT); } +{ yymsp[-1].minor.yy304 = createDataType(TSDB_DATA_TYPE_UTINYINT); } break; case 149: /* type_name ::= SMALLINT UNSIGNED */ -{ yymsp[-1].minor.yy690 = createDataType(TSDB_DATA_TYPE_USMALLINT); } +{ yymsp[-1].minor.yy304 = createDataType(TSDB_DATA_TYPE_USMALLINT); } break; case 150: /* type_name ::= INT UNSIGNED */ -{ yymsp[-1].minor.yy690 = createDataType(TSDB_DATA_TYPE_UINT); } +{ yymsp[-1].minor.yy304 = createDataType(TSDB_DATA_TYPE_UINT); } break; case 151: /* type_name ::= BIGINT UNSIGNED */ -{ yymsp[-1].minor.yy690 = createDataType(TSDB_DATA_TYPE_UBIGINT); } +{ yymsp[-1].minor.yy304 = createDataType(TSDB_DATA_TYPE_UBIGINT); } break; case 152: /* type_name ::= JSON */ -{ yymsp[0].minor.yy690 = createDataType(TSDB_DATA_TYPE_JSON); } +{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_JSON); } break; case 153: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy690 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy304 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } break; case 154: /* type_name ::= MEDIUMBLOB */ -{ yymsp[0].minor.yy690 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } +{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } break; case 155: /* type_name ::= BLOB */ -{ yymsp[0].minor.yy690 = createDataType(TSDB_DATA_TYPE_BLOB); } +{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_BLOB); } break; case 156: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy690 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy304 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } break; case 157: /* type_name ::= DECIMAL */ -{ yymsp[0].minor.yy690 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +{ yymsp[0].minor.yy304 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 158: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy690 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +{ yymsp[-3].minor.yy304 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 159: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ -{ yymsp[-5].minor.yy690 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +{ yymsp[-5].minor.yy304 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 161: /* tags_def_opt ::= tags_def */ - case 339: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==339); - case 394: /* select_list ::= select_sublist */ yytestcase(yyruleno==394); -{ yylhsminor.yy530 = yymsp[0].minor.yy530; } - yymsp[0].minor.yy530 = yylhsminor.yy530; + case 340: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==340); + case 395: /* select_list ::= select_sublist */ yytestcase(yyruleno==395); +{ yylhsminor.yy424 = yymsp[0].minor.yy424; } + yymsp[0].minor.yy424 = yylhsminor.yy424; break; case 162: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */ -{ yymsp[-3].minor.yy530 = yymsp[-1].minor.yy530; } +{ yymsp[-3].minor.yy424 = yymsp[-1].minor.yy424; } break; case 163: /* table_options ::= */ -{ yymsp[1].minor.yy674 = createDefaultTableOptions(pCxt); } +{ yymsp[1].minor.yy632 = createDefaultTableOptions(pCxt); } break; case 164: /* table_options ::= table_options COMMENT NK_STRING */ -{ yylhsminor.yy674 = setTableOption(pCxt, yymsp[-2].minor.yy674, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy674 = yylhsminor.yy674; +{ yylhsminor.yy632 = setTableOption(pCxt, yymsp[-2].minor.yy632, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy632 = yylhsminor.yy632; break; case 165: /* table_options ::= table_options FILE_FACTOR NK_FLOAT */ -{ yylhsminor.yy674 = setTableOption(pCxt, yymsp[-2].minor.yy674, TABLE_OPTION_FILE_FACTOR, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy674 = yylhsminor.yy674; +{ yylhsminor.yy632 = setTableOption(pCxt, yymsp[-2].minor.yy632, TABLE_OPTION_FILE_FACTOR, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy632 = yylhsminor.yy632; break; case 166: /* table_options ::= table_options ROLLUP NK_LP func_name_list NK_RP */ -{ yylhsminor.yy674 = setTableOption(pCxt, yymsp[-4].minor.yy674, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy530); } - yymsp[-4].minor.yy674 = yylhsminor.yy674; +{ yylhsminor.yy632 = setTableOption(pCxt, yymsp[-4].minor.yy632, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy424); } + yymsp[-4].minor.yy632 = yylhsminor.yy632; break; case 167: /* table_options ::= table_options TTL NK_INTEGER */ -{ yylhsminor.yy674 = setTableOption(pCxt, yymsp[-2].minor.yy674, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy674 = yylhsminor.yy674; +{ yylhsminor.yy632 = setTableOption(pCxt, yymsp[-2].minor.yy632, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy632 = yylhsminor.yy632; break; case 168: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ -{ yylhsminor.yy674 = setTableOption(pCxt, yymsp[-4].minor.yy674, TABLE_OPTION_SMA, yymsp[-1].minor.yy530); } - yymsp[-4].minor.yy674 = yylhsminor.yy674; +{ yylhsminor.yy632 = setTableOption(pCxt, yymsp[-4].minor.yy632, TABLE_OPTION_SMA, yymsp[-1].minor.yy424); } + yymsp[-4].minor.yy632 = yylhsminor.yy632; break; case 169: /* alter_table_options ::= alter_table_option */ -{ yylhsminor.yy674 = createAlterTableOptions(pCxt); yylhsminor.yy674 = setTableOption(pCxt, yylhsminor.yy674, yymsp[0].minor.yy557.type, &yymsp[0].minor.yy557.val); } - yymsp[0].minor.yy674 = yylhsminor.yy674; +{ yylhsminor.yy632 = createAlterTableOptions(pCxt); yylhsminor.yy632 = setTableOption(pCxt, yylhsminor.yy632, yymsp[0].minor.yy605.type, &yymsp[0].minor.yy605.val); } + yymsp[0].minor.yy632 = yylhsminor.yy632; break; case 170: /* alter_table_options ::= alter_table_options alter_table_option */ -{ yylhsminor.yy674 = setTableOption(pCxt, yymsp[-1].minor.yy674, yymsp[0].minor.yy557.type, &yymsp[0].minor.yy557.val); } - yymsp[-1].minor.yy674 = yylhsminor.yy674; +{ yylhsminor.yy632 = setTableOption(pCxt, yymsp[-1].minor.yy632, yymsp[0].minor.yy605.type, &yymsp[0].minor.yy605.val); } + yymsp[-1].minor.yy632 = yylhsminor.yy632; break; case 171: /* alter_table_option ::= COMMENT NK_STRING */ -{ yymsp[-1].minor.yy557.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy557.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy605.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy605.val = yymsp[0].minor.yy0; } break; case 172: /* alter_table_option ::= TTL NK_INTEGER */ -{ yymsp[-1].minor.yy557.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy557.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy605.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy605.val = yymsp[0].minor.yy0; } break; case 175: /* col_name ::= column_name */ -{ yylhsminor.yy674 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy421); } - yymsp[0].minor.yy674 = yylhsminor.yy674; +{ yylhsminor.yy632 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy209); } + yymsp[0].minor.yy632 = yylhsminor.yy632; break; case 176: /* cmd ::= SHOW DNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT, NULL, NULL); } @@ -3683,13 +3692,13 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT, NULL, NULL); } break; case 179: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy674, yymsp[0].minor.yy674); } +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy632, yymsp[0].minor.yy632); } break; case 180: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy674, yymsp[0].minor.yy674); } +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy632, yymsp[0].minor.yy632); } break; case 181: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy674, NULL); } +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy632, NULL); } break; case 182: /* cmd ::= SHOW MNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT, NULL, NULL); } @@ -3704,7 +3713,7 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT, NULL, NULL); } break; case 186: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[-1].minor.yy674, yymsp[0].minor.yy674); } +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[-1].minor.yy632, yymsp[0].minor.yy632); } break; case 187: /* cmd ::= SHOW STREAMS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT, NULL, NULL); } @@ -3723,13 +3732,13 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCE_STMT, NULL, NULL); } break; case 193: /* cmd ::= SHOW CREATE DATABASE db_name */ -{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy421); } +{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy209); } break; case 194: /* cmd ::= SHOW CREATE TABLE full_table_name */ -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy674); } +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy632); } break; case 195: /* cmd ::= SHOW CREATE STABLE full_table_name */ -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy674); } +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy632); } break; case 196: /* cmd ::= SHOW QUERIES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT, NULL, NULL); } @@ -3757,672 +3766,676 @@ static YYACTIONTYPE yy_reduce( break; case 204: /* db_name_cond_opt ::= */ case 209: /* from_db_opt ::= */ yytestcase(yyruleno==209); -{ yymsp[1].minor.yy674 = createDefaultDatabaseCondValue(pCxt); } +{ yymsp[1].minor.yy632 = createDefaultDatabaseCondValue(pCxt); } break; case 205: /* db_name_cond_opt ::= db_name NK_DOT */ -{ yylhsminor.yy674 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy421); } - yymsp[-1].minor.yy674 = yylhsminor.yy674; +{ yylhsminor.yy632 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy209); } + yymsp[-1].minor.yy632 = yylhsminor.yy632; break; case 206: /* like_pattern_opt ::= */ case 217: /* index_options ::= */ yytestcase(yyruleno==217); case 246: /* into_opt ::= */ yytestcase(yyruleno==246); - case 401: /* where_clause_opt ::= */ yytestcase(yyruleno==401); - case 405: /* twindow_clause_opt ::= */ yytestcase(yyruleno==405); - case 410: /* sliding_opt ::= */ yytestcase(yyruleno==410); - case 412: /* fill_opt ::= */ yytestcase(yyruleno==412); - case 424: /* having_clause_opt ::= */ yytestcase(yyruleno==424); - case 434: /* slimit_clause_opt ::= */ yytestcase(yyruleno==434); - case 438: /* limit_clause_opt ::= */ yytestcase(yyruleno==438); -{ yymsp[1].minor.yy674 = NULL; } + case 402: /* where_clause_opt ::= */ yytestcase(yyruleno==402); + case 406: /* twindow_clause_opt ::= */ yytestcase(yyruleno==406); + case 411: /* sliding_opt ::= */ yytestcase(yyruleno==411); + case 413: /* fill_opt ::= */ yytestcase(yyruleno==413); + case 425: /* having_clause_opt ::= */ yytestcase(yyruleno==425); + case 435: /* slimit_clause_opt ::= */ yytestcase(yyruleno==435); + case 439: /* limit_clause_opt ::= */ yytestcase(yyruleno==439); +{ yymsp[1].minor.yy632 = NULL; } break; case 207: /* like_pattern_opt ::= LIKE NK_STRING */ -{ yymsp[-1].minor.yy674 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } +{ yymsp[-1].minor.yy632 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } break; case 208: /* table_name_cond ::= table_name */ -{ yylhsminor.yy674 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy421); } - yymsp[0].minor.yy674 = yylhsminor.yy674; +{ yylhsminor.yy632 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy209); } + yymsp[0].minor.yy632 = yylhsminor.yy632; break; case 210: /* from_db_opt ::= FROM db_name */ -{ yymsp[-1].minor.yy674 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy421); } +{ yymsp[-1].minor.yy632 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy209); } break; case 213: /* func_name ::= function_name */ -{ yylhsminor.yy674 = createFunctionNode(pCxt, &yymsp[0].minor.yy421, NULL); } - yymsp[0].minor.yy674 = yylhsminor.yy674; +{ yylhsminor.yy632 = createFunctionNode(pCxt, &yymsp[0].minor.yy209, NULL); } + yymsp[0].minor.yy632 = yylhsminor.yy632; break; case 214: /* cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ -{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy621, &yymsp[-3].minor.yy421, &yymsp[-1].minor.yy421, NULL, yymsp[0].minor.yy674); } +{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy137, &yymsp[-3].minor.yy209, &yymsp[-1].minor.yy209, NULL, yymsp[0].minor.yy632); } break; case 215: /* cmd ::= CREATE FULLTEXT INDEX not_exists_opt index_name ON table_name NK_LP col_name_list NK_RP */ -{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_FULLTEXT, yymsp[-6].minor.yy621, &yymsp[-5].minor.yy421, &yymsp[-3].minor.yy421, yymsp[-1].minor.yy530, NULL); } +{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_FULLTEXT, yymsp[-6].minor.yy137, &yymsp[-5].minor.yy209, &yymsp[-3].minor.yy209, yymsp[-1].minor.yy424, NULL); } break; case 216: /* cmd ::= DROP INDEX exists_opt index_name ON table_name */ -{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-3].minor.yy621, &yymsp[-2].minor.yy421, &yymsp[0].minor.yy421); } +{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-3].minor.yy137, &yymsp[-2].minor.yy209, &yymsp[0].minor.yy209); } break; case 218: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt */ -{ yymsp[-8].minor.yy674 = createIndexOption(pCxt, yymsp[-6].minor.yy530, releaseRawExprNode(pCxt, yymsp[-2].minor.yy674), NULL, yymsp[0].minor.yy674); } +{ yymsp[-8].minor.yy632 = createIndexOption(pCxt, yymsp[-6].minor.yy424, releaseRawExprNode(pCxt, yymsp[-2].minor.yy632), NULL, yymsp[0].minor.yy632); } break; case 219: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt */ -{ yymsp[-10].minor.yy674 = createIndexOption(pCxt, yymsp[-8].minor.yy530, releaseRawExprNode(pCxt, yymsp[-4].minor.yy674), releaseRawExprNode(pCxt, yymsp[-2].minor.yy674), yymsp[0].minor.yy674); } +{ yymsp[-10].minor.yy632 = createIndexOption(pCxt, yymsp[-8].minor.yy424, releaseRawExprNode(pCxt, yymsp[-4].minor.yy632), releaseRawExprNode(pCxt, yymsp[-2].minor.yy632), yymsp[0].minor.yy632); } break; case 222: /* func ::= function_name NK_LP expression_list NK_RP */ -{ yylhsminor.yy674 = createFunctionNode(pCxt, &yymsp[-3].minor.yy421, yymsp[-1].minor.yy530); } - yymsp[-3].minor.yy674 = yylhsminor.yy674; +{ yylhsminor.yy632 = createFunctionNode(pCxt, &yymsp[-3].minor.yy209, yymsp[-1].minor.yy424); } + yymsp[-3].minor.yy632 = yylhsminor.yy632; break; case 223: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ -{ pCxt->pRootNode = createCreateTopicStmt(pCxt, yymsp[-3].minor.yy621, &yymsp[-2].minor.yy421, yymsp[0].minor.yy674, NULL, NULL); } +{ pCxt->pRootNode = createCreateTopicStmt(pCxt, yymsp[-3].minor.yy137, &yymsp[-2].minor.yy209, yymsp[0].minor.yy632, NULL, NULL); } break; case 224: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ -{ pCxt->pRootNode = createCreateTopicStmt(pCxt, yymsp[-4].minor.yy621, &yymsp[-3].minor.yy421, NULL, &yymsp[0].minor.yy421, NULL); } +{ pCxt->pRootNode = createCreateTopicStmt(pCxt, yymsp[-4].minor.yy137, &yymsp[-3].minor.yy209, NULL, &yymsp[0].minor.yy209, NULL); } break; case 225: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ -{ pCxt->pRootNode = createCreateTopicStmt(pCxt, yymsp[-4].minor.yy621, &yymsp[-3].minor.yy421, NULL, NULL, yymsp[0].minor.yy674); } +{ pCxt->pRootNode = createCreateTopicStmt(pCxt, yymsp[-4].minor.yy137, &yymsp[-3].minor.yy209, NULL, NULL, yymsp[0].minor.yy632); } break; case 226: /* cmd ::= DROP TOPIC exists_opt topic_name */ -{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy621, &yymsp[0].minor.yy421); } +{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy137, &yymsp[0].minor.yy209); } break; case 227: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ -{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy621, &yymsp[-2].minor.yy421, &yymsp[0].minor.yy421); } +{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy137, &yymsp[-2].minor.yy209, &yymsp[0].minor.yy209); } break; case 228: /* cmd ::= DESC full_table_name */ case 229: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==229); -{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy674); } +{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy632); } break; case 230: /* cmd ::= RESET QUERY CACHE */ { pCxt->pRootNode = createResetQueryCacheStmt(pCxt); } break; case 231: /* cmd ::= EXPLAIN analyze_opt explain_options query_expression */ -{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy621, yymsp[-1].minor.yy674, yymsp[0].minor.yy674); } +{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy137, yymsp[-1].minor.yy632, yymsp[0].minor.yy632); } break; case 233: /* analyze_opt ::= ANALYZE */ case 241: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==241); - case 391: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==391); -{ yymsp[0].minor.yy621 = true; } + case 392: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==392); +{ yymsp[0].minor.yy137 = true; } break; case 234: /* explain_options ::= */ -{ yymsp[1].minor.yy674 = createDefaultExplainOptions(pCxt); } +{ yymsp[1].minor.yy632 = createDefaultExplainOptions(pCxt); } break; case 235: /* explain_options ::= explain_options VERBOSE NK_BOOL */ -{ yylhsminor.yy674 = setExplainVerbose(pCxt, yymsp[-2].minor.yy674, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy674 = yylhsminor.yy674; +{ yylhsminor.yy632 = setExplainVerbose(pCxt, yymsp[-2].minor.yy632, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy632 = yylhsminor.yy632; break; case 236: /* explain_options ::= explain_options RATIO NK_FLOAT */ -{ yylhsminor.yy674 = setExplainRatio(pCxt, yymsp[-2].minor.yy674, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy674 = yylhsminor.yy674; +{ yylhsminor.yy632 = setExplainRatio(pCxt, yymsp[-2].minor.yy632, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy632 = yylhsminor.yy632; break; case 237: /* cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP */ -{ pCxt->pRootNode = createCompactStmt(pCxt, yymsp[-1].minor.yy530); } +{ pCxt->pRootNode = createCompactStmt(pCxt, yymsp[-1].minor.yy424); } break; case 238: /* cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ -{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-6].minor.yy621, yymsp[-8].minor.yy621, &yymsp[-5].minor.yy421, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy690, yymsp[0].minor.yy42); } +{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-6].minor.yy137, yymsp[-8].minor.yy137, &yymsp[-5].minor.yy209, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy304, yymsp[0].minor.yy100); } break; case 239: /* cmd ::= DROP FUNCTION exists_opt function_name */ -{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy621, &yymsp[0].minor.yy421); } +{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy137, &yymsp[0].minor.yy209); } break; case 242: /* bufsize_opt ::= */ -{ yymsp[1].minor.yy42 = 0; } +{ yymsp[1].minor.yy100 = 0; } break; case 243: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ -{ yymsp[-1].minor.yy42 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } +{ yymsp[-1].minor.yy100 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } break; case 244: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options into_opt AS query_expression */ -{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-5].minor.yy621, &yymsp[-4].minor.yy421, yymsp[-2].minor.yy674, yymsp[-3].minor.yy674, yymsp[0].minor.yy674); } +{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-5].minor.yy137, &yymsp[-4].minor.yy209, yymsp[-2].minor.yy632, yymsp[-3].minor.yy632, yymsp[0].minor.yy632); } break; case 245: /* cmd ::= DROP STREAM exists_opt stream_name */ -{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy621, &yymsp[0].minor.yy421); } +{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy137, &yymsp[0].minor.yy209); } break; case 247: /* into_opt ::= INTO full_table_name */ - case 372: /* from_clause ::= FROM table_reference_list */ yytestcase(yyruleno==372); - case 402: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==402); - case 425: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==425); -{ yymsp[-1].minor.yy674 = yymsp[0].minor.yy674; } + case 373: /* from_clause ::= FROM table_reference_list */ yytestcase(yyruleno==373); + case 403: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==403); + case 426: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==426); +{ yymsp[-1].minor.yy632 = yymsp[0].minor.yy632; } break; case 248: /* stream_options ::= */ -{ yymsp[1].minor.yy674 = createStreamOptions(pCxt); } +{ yymsp[1].minor.yy632 = createStreamOptions(pCxt); } break; case 249: /* stream_options ::= stream_options TRIGGER AT_ONCE */ -{ ((SStreamOptions*)yymsp[-2].minor.yy674)->triggerType = STREAM_TRIGGER_AT_ONCE; yylhsminor.yy674 = yymsp[-2].minor.yy674; } - yymsp[-2].minor.yy674 = yylhsminor.yy674; +{ ((SStreamOptions*)yymsp[-2].minor.yy632)->triggerType = STREAM_TRIGGER_AT_ONCE; yylhsminor.yy632 = yymsp[-2].minor.yy632; } + yymsp[-2].minor.yy632 = yylhsminor.yy632; break; case 250: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ -{ ((SStreamOptions*)yymsp[-2].minor.yy674)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; yylhsminor.yy674 = yymsp[-2].minor.yy674; } - yymsp[-2].minor.yy674 = yylhsminor.yy674; +{ ((SStreamOptions*)yymsp[-2].minor.yy632)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; yylhsminor.yy632 = yymsp[-2].minor.yy632; } + yymsp[-2].minor.yy632 = yylhsminor.yy632; break; - case 251: /* stream_options ::= stream_options WATERMARK duration_literal */ -{ ((SStreamOptions*)yymsp[-2].minor.yy674)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy674); yylhsminor.yy674 = yymsp[-2].minor.yy674; } - yymsp[-2].minor.yy674 = yylhsminor.yy674; + case 251: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ +{ ((SStreamOptions*)yymsp[-3].minor.yy632)->triggerType = STREAM_TRIGGER_MAX_DELAY; ((SStreamOptions*)yymsp[-3].minor.yy632)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy632); yylhsminor.yy632 = yymsp[-3].minor.yy632; } + yymsp[-3].minor.yy632 = yylhsminor.yy632; break; - case 252: /* cmd ::= KILL CONNECTION NK_INTEGER */ + case 252: /* stream_options ::= stream_options WATERMARK duration_literal */ +{ ((SStreamOptions*)yymsp[-2].minor.yy632)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy632); yylhsminor.yy632 = yymsp[-2].minor.yy632; } + yymsp[-2].minor.yy632 = yylhsminor.yy632; + break; + case 253: /* cmd ::= KILL CONNECTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); } break; - case 253: /* cmd ::= KILL QUERY NK_INTEGER */ + case 254: /* cmd ::= KILL QUERY NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_QUERY_STMT, &yymsp[0].minor.yy0); } break; - case 254: /* cmd ::= KILL TRANSACTION NK_INTEGER */ + case 255: /* cmd ::= KILL TRANSACTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_TRANSACTION_STMT, &yymsp[0].minor.yy0); } break; - case 255: /* cmd ::= BALANCE VGROUP */ + case 256: /* cmd ::= BALANCE VGROUP */ { pCxt->pRootNode = createBalanceVgroupStmt(pCxt); } break; - case 256: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + case 257: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ { pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } break; - case 257: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ -{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy530); } + case 258: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ +{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy424); } break; - case 258: /* cmd ::= SPLIT VGROUP NK_INTEGER */ + case 259: /* cmd ::= SPLIT VGROUP NK_INTEGER */ { pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); } break; - case 259: /* dnode_list ::= DNODE NK_INTEGER */ -{ yymsp[-1].minor.yy530 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + case 260: /* dnode_list ::= DNODE NK_INTEGER */ +{ yymsp[-1].minor.yy424 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } break; - case 261: /* cmd ::= SYNCDB db_name REPLICA */ -{ pCxt->pRootNode = createSyncdbStmt(pCxt, &yymsp[-1].minor.yy421); } + case 262: /* cmd ::= SYNCDB db_name REPLICA */ +{ pCxt->pRootNode = createSyncdbStmt(pCxt, &yymsp[-1].minor.yy209); } break; - case 262: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ -{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy674, yymsp[0].minor.yy674); } + case 263: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ +{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy632, yymsp[0].minor.yy632); } break; - case 264: /* literal ::= NK_INTEGER */ -{ yylhsminor.yy674 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy674 = yylhsminor.yy674; + case 265: /* literal ::= NK_INTEGER */ +{ yylhsminor.yy632 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy632 = yylhsminor.yy632; break; - case 265: /* literal ::= NK_FLOAT */ -{ yylhsminor.yy674 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy674 = yylhsminor.yy674; + case 266: /* literal ::= NK_FLOAT */ +{ yylhsminor.yy632 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy632 = yylhsminor.yy632; break; - case 266: /* literal ::= NK_STRING */ -{ yylhsminor.yy674 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy674 = yylhsminor.yy674; + case 267: /* literal ::= NK_STRING */ +{ yylhsminor.yy632 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy632 = yylhsminor.yy632; break; - case 267: /* literal ::= NK_BOOL */ -{ yylhsminor.yy674 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy674 = yylhsminor.yy674; + case 268: /* literal ::= NK_BOOL */ +{ yylhsminor.yy632 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy632 = yylhsminor.yy632; break; - case 268: /* literal ::= TIMESTAMP NK_STRING */ -{ yylhsminor.yy674 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } - yymsp[-1].minor.yy674 = yylhsminor.yy674; + case 269: /* literal ::= TIMESTAMP NK_STRING */ +{ yylhsminor.yy632 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } + yymsp[-1].minor.yy632 = yylhsminor.yy632; break; - case 269: /* literal ::= duration_literal */ - case 279: /* signed_literal ::= signed */ yytestcase(yyruleno==279); - case 299: /* expression ::= literal */ yytestcase(yyruleno==299); - case 300: /* expression ::= pseudo_column */ yytestcase(yyruleno==300); - case 301: /* expression ::= column_reference */ yytestcase(yyruleno==301); - case 302: /* expression ::= function_expression */ yytestcase(yyruleno==302); - case 303: /* expression ::= subquery */ yytestcase(yyruleno==303); - case 328: /* function_expression ::= literal_func */ yytestcase(yyruleno==328); - case 364: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==364); - case 368: /* boolean_primary ::= predicate */ yytestcase(yyruleno==368); - case 370: /* common_expression ::= expression */ yytestcase(yyruleno==370); - case 371: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==371); - case 373: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==373); - case 375: /* table_reference ::= table_primary */ yytestcase(yyruleno==375); - case 376: /* table_reference ::= joined_table */ yytestcase(yyruleno==376); - case 380: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==380); - case 427: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==427); - case 430: /* query_primary ::= query_specification */ yytestcase(yyruleno==430); -{ yylhsminor.yy674 = yymsp[0].minor.yy674; } - yymsp[0].minor.yy674 = yylhsminor.yy674; + case 270: /* literal ::= duration_literal */ + case 280: /* signed_literal ::= signed */ yytestcase(yyruleno==280); + case 300: /* expression ::= literal */ yytestcase(yyruleno==300); + case 301: /* expression ::= pseudo_column */ yytestcase(yyruleno==301); + case 302: /* expression ::= column_reference */ yytestcase(yyruleno==302); + case 303: /* expression ::= function_expression */ yytestcase(yyruleno==303); + case 304: /* expression ::= subquery */ yytestcase(yyruleno==304); + case 329: /* function_expression ::= literal_func */ yytestcase(yyruleno==329); + case 365: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==365); + case 369: /* boolean_primary ::= predicate */ yytestcase(yyruleno==369); + case 371: /* common_expression ::= expression */ yytestcase(yyruleno==371); + case 372: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==372); + case 374: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==374); + case 376: /* table_reference ::= table_primary */ yytestcase(yyruleno==376); + case 377: /* table_reference ::= joined_table */ yytestcase(yyruleno==377); + case 381: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==381); + case 428: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==428); + case 431: /* query_primary ::= query_specification */ yytestcase(yyruleno==431); +{ yylhsminor.yy632 = yymsp[0].minor.yy632; } + yymsp[0].minor.yy632 = yylhsminor.yy632; break; - case 270: /* literal ::= NULL */ -{ yylhsminor.yy674 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy674 = yylhsminor.yy674; + case 271: /* literal ::= NULL */ +{ yylhsminor.yy632 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy632 = yylhsminor.yy632; break; - case 271: /* literal ::= NK_QUESTION */ -{ yylhsminor.yy674 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy674 = yylhsminor.yy674; + case 272: /* literal ::= NK_QUESTION */ +{ yylhsminor.yy632 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy632 = yylhsminor.yy632; break; - case 272: /* duration_literal ::= NK_VARIABLE */ -{ yylhsminor.yy674 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy674 = yylhsminor.yy674; + case 273: /* duration_literal ::= NK_VARIABLE */ +{ yylhsminor.yy632 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy632 = yylhsminor.yy632; break; - case 273: /* signed ::= NK_INTEGER */ -{ yylhsminor.yy674 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy674 = yylhsminor.yy674; + case 274: /* signed ::= NK_INTEGER */ +{ yylhsminor.yy632 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy632 = yylhsminor.yy632; break; - case 274: /* signed ::= NK_PLUS NK_INTEGER */ -{ yymsp[-1].minor.yy674 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } + case 275: /* signed ::= NK_PLUS NK_INTEGER */ +{ yymsp[-1].minor.yy632 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } break; - case 275: /* signed ::= NK_MINUS NK_INTEGER */ + case 276: /* signed ::= NK_MINUS NK_INTEGER */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy674 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); + yylhsminor.yy632 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); } - yymsp[-1].minor.yy674 = yylhsminor.yy674; + yymsp[-1].minor.yy632 = yylhsminor.yy632; break; - case 276: /* signed ::= NK_FLOAT */ -{ yylhsminor.yy674 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy674 = yylhsminor.yy674; + case 277: /* signed ::= NK_FLOAT */ +{ yylhsminor.yy632 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy632 = yylhsminor.yy632; break; - case 277: /* signed ::= NK_PLUS NK_FLOAT */ -{ yymsp[-1].minor.yy674 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + case 278: /* signed ::= NK_PLUS NK_FLOAT */ +{ yymsp[-1].minor.yy632 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } break; - case 278: /* signed ::= NK_MINUS NK_FLOAT */ + case 279: /* signed ::= NK_MINUS NK_FLOAT */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy674 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); + yylhsminor.yy632 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); } - yymsp[-1].minor.yy674 = yylhsminor.yy674; + yymsp[-1].minor.yy632 = yylhsminor.yy632; break; - case 280: /* signed_literal ::= NK_STRING */ -{ yylhsminor.yy674 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy674 = yylhsminor.yy674; + case 281: /* signed_literal ::= NK_STRING */ +{ yylhsminor.yy632 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy632 = yylhsminor.yy632; break; - case 281: /* signed_literal ::= NK_BOOL */ -{ yylhsminor.yy674 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy674 = yylhsminor.yy674; + case 282: /* signed_literal ::= NK_BOOL */ +{ yylhsminor.yy632 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy632 = yylhsminor.yy632; break; - case 282: /* signed_literal ::= TIMESTAMP NK_STRING */ -{ yymsp[-1].minor.yy674 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } + case 283: /* signed_literal ::= TIMESTAMP NK_STRING */ +{ yymsp[-1].minor.yy632 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } break; - case 283: /* signed_literal ::= duration_literal */ - case 285: /* signed_literal ::= literal_func */ yytestcase(yyruleno==285); - case 342: /* star_func_para ::= expression */ yytestcase(yyruleno==342); - case 397: /* select_item ::= common_expression */ yytestcase(yyruleno==397); - case 443: /* search_condition ::= common_expression */ yytestcase(yyruleno==443); -{ yylhsminor.yy674 = releaseRawExprNode(pCxt, yymsp[0].minor.yy674); } - yymsp[0].minor.yy674 = yylhsminor.yy674; + case 284: /* signed_literal ::= duration_literal */ + case 286: /* signed_literal ::= literal_func */ yytestcase(yyruleno==286); + case 343: /* star_func_para ::= expression */ yytestcase(yyruleno==343); + case 398: /* select_item ::= common_expression */ yytestcase(yyruleno==398); + case 444: /* search_condition ::= common_expression */ yytestcase(yyruleno==444); +{ yylhsminor.yy632 = releaseRawExprNode(pCxt, yymsp[0].minor.yy632); } + yymsp[0].minor.yy632 = yylhsminor.yy632; break; - case 284: /* signed_literal ::= NULL */ -{ yylhsminor.yy674 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy674 = yylhsminor.yy674; + case 285: /* signed_literal ::= NULL */ +{ yylhsminor.yy632 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy632 = yylhsminor.yy632; break; - case 304: /* expression ::= NK_LP expression NK_RP */ - case 369: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==369); -{ yylhsminor.yy674 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy674)); } - yymsp[-2].minor.yy674 = yylhsminor.yy674; + case 305: /* expression ::= NK_LP expression NK_RP */ + case 370: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==370); +{ yylhsminor.yy632 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy632)); } + yymsp[-2].minor.yy632 = yylhsminor.yy632; break; - case 305: /* expression ::= NK_PLUS expression */ + case 306: /* expression ::= NK_PLUS expression */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy674); - yylhsminor.yy674 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy674)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy632); + yylhsminor.yy632 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy632)); } - yymsp[-1].minor.yy674 = yylhsminor.yy674; + yymsp[-1].minor.yy632 = yylhsminor.yy632; break; - case 306: /* expression ::= NK_MINUS expression */ + case 307: /* expression ::= NK_MINUS expression */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy674); - yylhsminor.yy674 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy674), NULL)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy632); + yylhsminor.yy632 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy632), NULL)); } - yymsp[-1].minor.yy674 = yylhsminor.yy674; + yymsp[-1].minor.yy632 = yylhsminor.yy632; break; - case 307: /* expression ::= expression NK_PLUS expression */ + case 308: /* expression ::= expression NK_PLUS expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy674); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy674); - yylhsminor.yy674 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy674), releaseRawExprNode(pCxt, yymsp[0].minor.yy674))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy632); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy632); + yylhsminor.yy632 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy632), releaseRawExprNode(pCxt, yymsp[0].minor.yy632))); } - yymsp[-2].minor.yy674 = yylhsminor.yy674; + yymsp[-2].minor.yy632 = yylhsminor.yy632; break; - case 308: /* expression ::= expression NK_MINUS expression */ + case 309: /* expression ::= expression NK_MINUS expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy674); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy674); - yylhsminor.yy674 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy674), releaseRawExprNode(pCxt, yymsp[0].minor.yy674))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy632); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy632); + yylhsminor.yy632 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy632), releaseRawExprNode(pCxt, yymsp[0].minor.yy632))); } - yymsp[-2].minor.yy674 = yylhsminor.yy674; + yymsp[-2].minor.yy632 = yylhsminor.yy632; break; - case 309: /* expression ::= expression NK_STAR expression */ + case 310: /* expression ::= expression NK_STAR expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy674); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy674); - yylhsminor.yy674 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy674), releaseRawExprNode(pCxt, yymsp[0].minor.yy674))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy632); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy632); + yylhsminor.yy632 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy632), releaseRawExprNode(pCxt, yymsp[0].minor.yy632))); } - yymsp[-2].minor.yy674 = yylhsminor.yy674; + yymsp[-2].minor.yy632 = yylhsminor.yy632; break; - case 310: /* expression ::= expression NK_SLASH expression */ + case 311: /* expression ::= expression NK_SLASH expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy674); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy674); - yylhsminor.yy674 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy674), releaseRawExprNode(pCxt, yymsp[0].minor.yy674))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy632); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy632); + yylhsminor.yy632 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy632), releaseRawExprNode(pCxt, yymsp[0].minor.yy632))); } - yymsp[-2].minor.yy674 = yylhsminor.yy674; + yymsp[-2].minor.yy632 = yylhsminor.yy632; break; - case 311: /* expression ::= expression NK_REM expression */ + case 312: /* expression ::= expression NK_REM expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy674); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy674); - yylhsminor.yy674 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy674), releaseRawExprNode(pCxt, yymsp[0].minor.yy674))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy632); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy632); + yylhsminor.yy632 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy632), releaseRawExprNode(pCxt, yymsp[0].minor.yy632))); } - yymsp[-2].minor.yy674 = yylhsminor.yy674; + yymsp[-2].minor.yy632 = yylhsminor.yy632; break; - case 312: /* expression ::= column_reference NK_ARROW NK_STRING */ + case 313: /* expression ::= column_reference NK_ARROW NK_STRING */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy674); - yylhsminor.yy674 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy674), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy632); + yylhsminor.yy632 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy632), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); } - yymsp[-2].minor.yy674 = yylhsminor.yy674; + yymsp[-2].minor.yy632 = yylhsminor.yy632; break; - case 313: /* expression_list ::= expression */ -{ yylhsminor.yy530 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy674)); } - yymsp[0].minor.yy530 = yylhsminor.yy530; + case 314: /* expression_list ::= expression */ +{ yylhsminor.yy424 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy632)); } + yymsp[0].minor.yy424 = yylhsminor.yy424; break; - case 314: /* expression_list ::= expression_list NK_COMMA expression */ -{ yylhsminor.yy530 = addNodeToList(pCxt, yymsp[-2].minor.yy530, releaseRawExprNode(pCxt, yymsp[0].minor.yy674)); } - yymsp[-2].minor.yy530 = yylhsminor.yy530; + case 315: /* expression_list ::= expression_list NK_COMMA expression */ +{ yylhsminor.yy424 = addNodeToList(pCxt, yymsp[-2].minor.yy424, releaseRawExprNode(pCxt, yymsp[0].minor.yy632)); } + yymsp[-2].minor.yy424 = yylhsminor.yy424; break; - case 315: /* column_reference ::= column_name */ -{ yylhsminor.yy674 = createRawExprNode(pCxt, &yymsp[0].minor.yy421, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy421)); } - yymsp[0].minor.yy674 = yylhsminor.yy674; + case 316: /* column_reference ::= column_name */ +{ yylhsminor.yy632 = createRawExprNode(pCxt, &yymsp[0].minor.yy209, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy209)); } + yymsp[0].minor.yy632 = yylhsminor.yy632; break; - case 316: /* column_reference ::= table_name NK_DOT column_name */ -{ yylhsminor.yy674 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy421, &yymsp[0].minor.yy421, createColumnNode(pCxt, &yymsp[-2].minor.yy421, &yymsp[0].minor.yy421)); } - yymsp[-2].minor.yy674 = yylhsminor.yy674; + case 317: /* column_reference ::= table_name NK_DOT column_name */ +{ yylhsminor.yy632 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy209, &yymsp[0].minor.yy209, createColumnNode(pCxt, &yymsp[-2].minor.yy209, &yymsp[0].minor.yy209)); } + yymsp[-2].minor.yy632 = yylhsminor.yy632; break; - case 317: /* pseudo_column ::= ROWTS */ - case 318: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==318); - case 320: /* pseudo_column ::= QSTARTTS */ yytestcase(yyruleno==320); - case 321: /* pseudo_column ::= QENDTS */ yytestcase(yyruleno==321); - case 322: /* pseudo_column ::= WSTARTTS */ yytestcase(yyruleno==322); - case 323: /* pseudo_column ::= WENDTS */ yytestcase(yyruleno==323); - case 324: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==324); - case 330: /* literal_func ::= NOW */ yytestcase(yyruleno==330); -{ yylhsminor.yy674 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } - yymsp[0].minor.yy674 = yylhsminor.yy674; + case 318: /* pseudo_column ::= ROWTS */ + case 319: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==319); + case 321: /* pseudo_column ::= QSTARTTS */ yytestcase(yyruleno==321); + case 322: /* pseudo_column ::= QENDTS */ yytestcase(yyruleno==322); + case 323: /* pseudo_column ::= WSTARTTS */ yytestcase(yyruleno==323); + case 324: /* pseudo_column ::= WENDTS */ yytestcase(yyruleno==324); + case 325: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==325); + case 331: /* literal_func ::= NOW */ yytestcase(yyruleno==331); +{ yylhsminor.yy632 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } + yymsp[0].minor.yy632 = yylhsminor.yy632; break; - case 319: /* pseudo_column ::= table_name NK_DOT TBNAME */ -{ yylhsminor.yy674 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy421, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy421)))); } - yymsp[-2].minor.yy674 = yylhsminor.yy674; + case 320: /* pseudo_column ::= table_name NK_DOT TBNAME */ +{ yylhsminor.yy632 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy209, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy209)))); } + yymsp[-2].minor.yy632 = yylhsminor.yy632; break; - case 325: /* function_expression ::= function_name NK_LP expression_list NK_RP */ - case 326: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==326); -{ yylhsminor.yy674 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy421, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy421, yymsp[-1].minor.yy530)); } - yymsp[-3].minor.yy674 = yylhsminor.yy674; + case 326: /* function_expression ::= function_name NK_LP expression_list NK_RP */ + case 327: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==327); +{ yylhsminor.yy632 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy209, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy209, yymsp[-1].minor.yy424)); } + yymsp[-3].minor.yy632 = yylhsminor.yy632; break; - case 327: /* function_expression ::= CAST NK_LP expression AS type_name NK_RP */ -{ yylhsminor.yy674 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy674), yymsp[-1].minor.yy690)); } - yymsp[-5].minor.yy674 = yylhsminor.yy674; + case 328: /* function_expression ::= CAST NK_LP expression AS type_name NK_RP */ +{ yylhsminor.yy632 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy632), yymsp[-1].minor.yy304)); } + yymsp[-5].minor.yy632 = yylhsminor.yy632; break; - case 329: /* literal_func ::= noarg_func NK_LP NK_RP */ -{ yylhsminor.yy674 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy421, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy421, NULL)); } - yymsp[-2].minor.yy674 = yylhsminor.yy674; + case 330: /* literal_func ::= noarg_func NK_LP NK_RP */ +{ yylhsminor.yy632 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy209, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy209, NULL)); } + yymsp[-2].minor.yy632 = yylhsminor.yy632; break; - case 338: /* star_func_para_list ::= NK_STAR */ -{ yylhsminor.yy530 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy530 = yylhsminor.yy530; + case 339: /* star_func_para_list ::= NK_STAR */ +{ yylhsminor.yy424 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy424 = yylhsminor.yy424; break; - case 343: /* star_func_para ::= table_name NK_DOT NK_STAR */ - case 400: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==400); -{ yylhsminor.yy674 = createColumnNode(pCxt, &yymsp[-2].minor.yy421, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy674 = yylhsminor.yy674; + case 344: /* star_func_para ::= table_name NK_DOT NK_STAR */ + case 401: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==401); +{ yylhsminor.yy632 = createColumnNode(pCxt, &yymsp[-2].minor.yy209, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy632 = yylhsminor.yy632; break; - case 344: /* predicate ::= expression compare_op expression */ - case 349: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==349); + case 345: /* predicate ::= expression compare_op expression */ + case 350: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==350); { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy674); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy674); - yylhsminor.yy674 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy28, releaseRawExprNode(pCxt, yymsp[-2].minor.yy674), releaseRawExprNode(pCxt, yymsp[0].minor.yy674))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy632); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy632); + yylhsminor.yy632 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy380, releaseRawExprNode(pCxt, yymsp[-2].minor.yy632), releaseRawExprNode(pCxt, yymsp[0].minor.yy632))); } - yymsp[-2].minor.yy674 = yylhsminor.yy674; + yymsp[-2].minor.yy632 = yylhsminor.yy632; break; - case 345: /* predicate ::= expression BETWEEN expression AND expression */ + case 346: /* predicate ::= expression BETWEEN expression AND expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy674); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy674); - yylhsminor.yy674 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy674), releaseRawExprNode(pCxt, yymsp[-2].minor.yy674), releaseRawExprNode(pCxt, yymsp[0].minor.yy674))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy632); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy632); + yylhsminor.yy632 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy632), releaseRawExprNode(pCxt, yymsp[-2].minor.yy632), releaseRawExprNode(pCxt, yymsp[0].minor.yy632))); } - yymsp[-4].minor.yy674 = yylhsminor.yy674; + yymsp[-4].minor.yy632 = yylhsminor.yy632; break; - case 346: /* predicate ::= expression NOT BETWEEN expression AND expression */ + case 347: /* predicate ::= expression NOT BETWEEN expression AND expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy674); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy674); - yylhsminor.yy674 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy674), releaseRawExprNode(pCxt, yymsp[-2].minor.yy674), releaseRawExprNode(pCxt, yymsp[0].minor.yy674))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy632); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy632); + yylhsminor.yy632 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy632), releaseRawExprNode(pCxt, yymsp[-2].minor.yy632), releaseRawExprNode(pCxt, yymsp[0].minor.yy632))); } - yymsp[-5].minor.yy674 = yylhsminor.yy674; + yymsp[-5].minor.yy632 = yylhsminor.yy632; break; - case 347: /* predicate ::= expression IS NULL */ + case 348: /* predicate ::= expression IS NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy674); - yylhsminor.yy674 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy674), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy632); + yylhsminor.yy632 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy632), NULL)); } - yymsp[-2].minor.yy674 = yylhsminor.yy674; + yymsp[-2].minor.yy632 = yylhsminor.yy632; break; - case 348: /* predicate ::= expression IS NOT NULL */ + case 349: /* predicate ::= expression IS NOT NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy674); - yylhsminor.yy674 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy674), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy632); + yylhsminor.yy632 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy632), NULL)); } - yymsp[-3].minor.yy674 = yylhsminor.yy674; + yymsp[-3].minor.yy632 = yylhsminor.yy632; break; - case 350: /* compare_op ::= NK_LT */ -{ yymsp[0].minor.yy28 = OP_TYPE_LOWER_THAN; } + case 351: /* compare_op ::= NK_LT */ +{ yymsp[0].minor.yy380 = OP_TYPE_LOWER_THAN; } break; - case 351: /* compare_op ::= NK_GT */ -{ yymsp[0].minor.yy28 = OP_TYPE_GREATER_THAN; } + case 352: /* compare_op ::= NK_GT */ +{ yymsp[0].minor.yy380 = OP_TYPE_GREATER_THAN; } break; - case 352: /* compare_op ::= NK_LE */ -{ yymsp[0].minor.yy28 = OP_TYPE_LOWER_EQUAL; } + case 353: /* compare_op ::= NK_LE */ +{ yymsp[0].minor.yy380 = OP_TYPE_LOWER_EQUAL; } break; - case 353: /* compare_op ::= NK_GE */ -{ yymsp[0].minor.yy28 = OP_TYPE_GREATER_EQUAL; } + case 354: /* compare_op ::= NK_GE */ +{ yymsp[0].minor.yy380 = OP_TYPE_GREATER_EQUAL; } break; - case 354: /* compare_op ::= NK_NE */ -{ yymsp[0].minor.yy28 = OP_TYPE_NOT_EQUAL; } + case 355: /* compare_op ::= NK_NE */ +{ yymsp[0].minor.yy380 = OP_TYPE_NOT_EQUAL; } break; - case 355: /* compare_op ::= NK_EQ */ -{ yymsp[0].minor.yy28 = OP_TYPE_EQUAL; } + case 356: /* compare_op ::= NK_EQ */ +{ yymsp[0].minor.yy380 = OP_TYPE_EQUAL; } break; - case 356: /* compare_op ::= LIKE */ -{ yymsp[0].minor.yy28 = OP_TYPE_LIKE; } + case 357: /* compare_op ::= LIKE */ +{ yymsp[0].minor.yy380 = OP_TYPE_LIKE; } break; - case 357: /* compare_op ::= NOT LIKE */ -{ yymsp[-1].minor.yy28 = OP_TYPE_NOT_LIKE; } + case 358: /* compare_op ::= NOT LIKE */ +{ yymsp[-1].minor.yy380 = OP_TYPE_NOT_LIKE; } break; - case 358: /* compare_op ::= MATCH */ -{ yymsp[0].minor.yy28 = OP_TYPE_MATCH; } + case 359: /* compare_op ::= MATCH */ +{ yymsp[0].minor.yy380 = OP_TYPE_MATCH; } break; - case 359: /* compare_op ::= NMATCH */ -{ yymsp[0].minor.yy28 = OP_TYPE_NMATCH; } + case 360: /* compare_op ::= NMATCH */ +{ yymsp[0].minor.yy380 = OP_TYPE_NMATCH; } break; - case 360: /* compare_op ::= CONTAINS */ -{ yymsp[0].minor.yy28 = OP_TYPE_JSON_CONTAINS; } + case 361: /* compare_op ::= CONTAINS */ +{ yymsp[0].minor.yy380 = OP_TYPE_JSON_CONTAINS; } break; - case 361: /* in_op ::= IN */ -{ yymsp[0].minor.yy28 = OP_TYPE_IN; } + case 362: /* in_op ::= IN */ +{ yymsp[0].minor.yy380 = OP_TYPE_IN; } break; - case 362: /* in_op ::= NOT IN */ -{ yymsp[-1].minor.yy28 = OP_TYPE_NOT_IN; } + case 363: /* in_op ::= NOT IN */ +{ yymsp[-1].minor.yy380 = OP_TYPE_NOT_IN; } break; - case 363: /* in_predicate_value ::= NK_LP expression_list NK_RP */ -{ yylhsminor.yy674 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy530)); } - yymsp[-2].minor.yy674 = yylhsminor.yy674; + case 364: /* in_predicate_value ::= NK_LP expression_list NK_RP */ +{ yylhsminor.yy632 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy424)); } + yymsp[-2].minor.yy632 = yylhsminor.yy632; break; - case 365: /* boolean_value_expression ::= NOT boolean_primary */ + case 366: /* boolean_value_expression ::= NOT boolean_primary */ { - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy674); - yylhsminor.yy674 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy674), NULL)); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy632); + yylhsminor.yy632 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy632), NULL)); } - yymsp[-1].minor.yy674 = yylhsminor.yy674; + yymsp[-1].minor.yy632 = yylhsminor.yy632; break; - case 366: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + case 367: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy674); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy674); - yylhsminor.yy674 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy674), releaseRawExprNode(pCxt, yymsp[0].minor.yy674))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy632); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy632); + yylhsminor.yy632 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy632), releaseRawExprNode(pCxt, yymsp[0].minor.yy632))); } - yymsp[-2].minor.yy674 = yylhsminor.yy674; + yymsp[-2].minor.yy632 = yylhsminor.yy632; break; - case 367: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + case 368: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy674); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy674); - yylhsminor.yy674 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy674), releaseRawExprNode(pCxt, yymsp[0].minor.yy674))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy632); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy632); + yylhsminor.yy632 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy632), releaseRawExprNode(pCxt, yymsp[0].minor.yy632))); } - yymsp[-2].minor.yy674 = yylhsminor.yy674; + yymsp[-2].minor.yy632 = yylhsminor.yy632; break; - case 374: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ -{ yylhsminor.yy674 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy674, yymsp[0].minor.yy674, NULL); } - yymsp[-2].minor.yy674 = yylhsminor.yy674; + case 375: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ +{ yylhsminor.yy632 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy632, yymsp[0].minor.yy632, NULL); } + yymsp[-2].minor.yy632 = yylhsminor.yy632; break; - case 377: /* table_primary ::= table_name alias_opt */ -{ yylhsminor.yy674 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy421, &yymsp[0].minor.yy421); } - yymsp[-1].minor.yy674 = yylhsminor.yy674; + case 378: /* table_primary ::= table_name alias_opt */ +{ yylhsminor.yy632 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy209, &yymsp[0].minor.yy209); } + yymsp[-1].minor.yy632 = yylhsminor.yy632; break; - case 378: /* table_primary ::= db_name NK_DOT table_name alias_opt */ -{ yylhsminor.yy674 = createRealTableNode(pCxt, &yymsp[-3].minor.yy421, &yymsp[-1].minor.yy421, &yymsp[0].minor.yy421); } - yymsp[-3].minor.yy674 = yylhsminor.yy674; + case 379: /* table_primary ::= db_name NK_DOT table_name alias_opt */ +{ yylhsminor.yy632 = createRealTableNode(pCxt, &yymsp[-3].minor.yy209, &yymsp[-1].minor.yy209, &yymsp[0].minor.yy209); } + yymsp[-3].minor.yy632 = yylhsminor.yy632; break; - case 379: /* table_primary ::= subquery alias_opt */ -{ yylhsminor.yy674 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy674), &yymsp[0].minor.yy421); } - yymsp[-1].minor.yy674 = yylhsminor.yy674; + case 380: /* table_primary ::= subquery alias_opt */ +{ yylhsminor.yy632 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy632), &yymsp[0].minor.yy209); } + yymsp[-1].minor.yy632 = yylhsminor.yy632; break; - case 381: /* alias_opt ::= */ -{ yymsp[1].minor.yy421 = nil_token; } + case 382: /* alias_opt ::= */ +{ yymsp[1].minor.yy209 = nil_token; } break; - case 382: /* alias_opt ::= table_alias */ -{ yylhsminor.yy421 = yymsp[0].minor.yy421; } - yymsp[0].minor.yy421 = yylhsminor.yy421; + case 383: /* alias_opt ::= table_alias */ +{ yylhsminor.yy209 = yymsp[0].minor.yy209; } + yymsp[0].minor.yy209 = yylhsminor.yy209; break; - case 383: /* alias_opt ::= AS table_alias */ -{ yymsp[-1].minor.yy421 = yymsp[0].minor.yy421; } + case 384: /* alias_opt ::= AS table_alias */ +{ yymsp[-1].minor.yy209 = yymsp[0].minor.yy209; } break; - case 384: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - case 385: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==385); -{ yymsp[-2].minor.yy674 = yymsp[-1].minor.yy674; } + case 385: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + case 386: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==386); +{ yymsp[-2].minor.yy632 = yymsp[-1].minor.yy632; } break; - case 386: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ -{ yylhsminor.yy674 = createJoinTableNode(pCxt, yymsp[-4].minor.yy636, yymsp[-5].minor.yy674, yymsp[-2].minor.yy674, yymsp[0].minor.yy674); } - yymsp[-5].minor.yy674 = yylhsminor.yy674; + case 387: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ +{ yylhsminor.yy632 = createJoinTableNode(pCxt, yymsp[-4].minor.yy612, yymsp[-5].minor.yy632, yymsp[-2].minor.yy632, yymsp[0].minor.yy632); } + yymsp[-5].minor.yy632 = yylhsminor.yy632; break; - case 387: /* join_type ::= */ -{ yymsp[1].minor.yy636 = JOIN_TYPE_INNER; } + case 388: /* join_type ::= */ +{ yymsp[1].minor.yy612 = JOIN_TYPE_INNER; } break; - case 388: /* join_type ::= INNER */ -{ yymsp[0].minor.yy636 = JOIN_TYPE_INNER; } + case 389: /* join_type ::= INNER */ +{ yymsp[0].minor.yy612 = JOIN_TYPE_INNER; } break; - case 389: /* 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 390: /* 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.yy674 = createSelectStmt(pCxt, yymsp[-7].minor.yy621, yymsp[-6].minor.yy530, yymsp[-5].minor.yy674); - yymsp[-8].minor.yy674 = addWhereClause(pCxt, yymsp[-8].minor.yy674, yymsp[-4].minor.yy674); - yymsp[-8].minor.yy674 = addPartitionByClause(pCxt, yymsp[-8].minor.yy674, yymsp[-3].minor.yy530); - yymsp[-8].minor.yy674 = addWindowClauseClause(pCxt, yymsp[-8].minor.yy674, yymsp[-2].minor.yy674); - yymsp[-8].minor.yy674 = addGroupByClause(pCxt, yymsp[-8].minor.yy674, yymsp[-1].minor.yy530); - yymsp[-8].minor.yy674 = addHavingClause(pCxt, yymsp[-8].minor.yy674, yymsp[0].minor.yy674); + yymsp[-8].minor.yy632 = createSelectStmt(pCxt, yymsp[-7].minor.yy137, yymsp[-6].minor.yy424, yymsp[-5].minor.yy632); + yymsp[-8].minor.yy632 = addWhereClause(pCxt, yymsp[-8].minor.yy632, yymsp[-4].minor.yy632); + yymsp[-8].minor.yy632 = addPartitionByClause(pCxt, yymsp[-8].minor.yy632, yymsp[-3].minor.yy424); + yymsp[-8].minor.yy632 = addWindowClauseClause(pCxt, yymsp[-8].minor.yy632, yymsp[-2].minor.yy632); + yymsp[-8].minor.yy632 = addGroupByClause(pCxt, yymsp[-8].minor.yy632, yymsp[-1].minor.yy424); + yymsp[-8].minor.yy632 = addHavingClause(pCxt, yymsp[-8].minor.yy632, yymsp[0].minor.yy632); } break; - case 392: /* set_quantifier_opt ::= ALL */ -{ yymsp[0].minor.yy621 = false; } + case 393: /* set_quantifier_opt ::= ALL */ +{ yymsp[0].minor.yy137 = false; } break; - case 393: /* select_list ::= NK_STAR */ -{ yymsp[0].minor.yy530 = NULL; } + case 394: /* select_list ::= NK_STAR */ +{ yymsp[0].minor.yy424 = NULL; } break; - case 398: /* select_item ::= common_expression column_alias */ -{ yylhsminor.yy674 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy674), &yymsp[0].minor.yy421); } - yymsp[-1].minor.yy674 = yylhsminor.yy674; + case 399: /* select_item ::= common_expression column_alias */ +{ yylhsminor.yy632 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy632), &yymsp[0].minor.yy209); } + yymsp[-1].minor.yy632 = yylhsminor.yy632; break; - case 399: /* select_item ::= common_expression AS column_alias */ -{ yylhsminor.yy674 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy674), &yymsp[0].minor.yy421); } - yymsp[-2].minor.yy674 = yylhsminor.yy674; + case 400: /* select_item ::= common_expression AS column_alias */ +{ yylhsminor.yy632 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy632), &yymsp[0].minor.yy209); } + yymsp[-2].minor.yy632 = yylhsminor.yy632; break; - case 404: /* partition_by_clause_opt ::= PARTITION BY expression_list */ - case 421: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==421); - case 433: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==433); -{ yymsp[-2].minor.yy530 = yymsp[0].minor.yy530; } + case 405: /* partition_by_clause_opt ::= PARTITION BY expression_list */ + case 422: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==422); + case 434: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==434); +{ yymsp[-2].minor.yy424 = yymsp[0].minor.yy424; } break; - case 406: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ -{ yymsp[-5].minor.yy674 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy674), releaseRawExprNode(pCxt, yymsp[-1].minor.yy674)); } + case 407: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ +{ yymsp[-5].minor.yy632 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy632), releaseRawExprNode(pCxt, yymsp[-1].minor.yy632)); } break; - case 407: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ -{ yymsp[-3].minor.yy674 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy674)); } + case 408: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ +{ yymsp[-3].minor.yy632 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy632)); } break; - case 408: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-5].minor.yy674 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy674), NULL, yymsp[-1].minor.yy674, yymsp[0].minor.yy674); } + case 409: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-5].minor.yy632 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy632), NULL, yymsp[-1].minor.yy632, yymsp[0].minor.yy632); } break; - case 409: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-7].minor.yy674 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy674), releaseRawExprNode(pCxt, yymsp[-3].minor.yy674), yymsp[-1].minor.yy674, yymsp[0].minor.yy674); } + case 410: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-7].minor.yy632 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy632), releaseRawExprNode(pCxt, yymsp[-3].minor.yy632), yymsp[-1].minor.yy632, yymsp[0].minor.yy632); } break; - case 411: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ -{ yymsp[-3].minor.yy674 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy674); } + case 412: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ +{ yymsp[-3].minor.yy632 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy632); } break; - case 413: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ -{ yymsp[-3].minor.yy674 = createFillNode(pCxt, yymsp[-1].minor.yy320, NULL); } + case 414: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ +{ yymsp[-3].minor.yy632 = createFillNode(pCxt, yymsp[-1].minor.yy54, NULL); } break; - case 414: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ -{ yymsp[-5].minor.yy674 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy530)); } + case 415: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ +{ yymsp[-5].minor.yy632 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy424)); } break; - case 415: /* fill_mode ::= NONE */ -{ yymsp[0].minor.yy320 = FILL_MODE_NONE; } + case 416: /* fill_mode ::= NONE */ +{ yymsp[0].minor.yy54 = FILL_MODE_NONE; } break; - case 416: /* fill_mode ::= PREV */ -{ yymsp[0].minor.yy320 = FILL_MODE_PREV; } + case 417: /* fill_mode ::= PREV */ +{ yymsp[0].minor.yy54 = FILL_MODE_PREV; } break; - case 417: /* fill_mode ::= NULL */ -{ yymsp[0].minor.yy320 = FILL_MODE_NULL; } + case 418: /* fill_mode ::= NULL */ +{ yymsp[0].minor.yy54 = FILL_MODE_NULL; } break; - case 418: /* fill_mode ::= LINEAR */ -{ yymsp[0].minor.yy320 = FILL_MODE_LINEAR; } + case 419: /* fill_mode ::= LINEAR */ +{ yymsp[0].minor.yy54 = FILL_MODE_LINEAR; } break; - case 419: /* fill_mode ::= NEXT */ -{ yymsp[0].minor.yy320 = FILL_MODE_NEXT; } + case 420: /* fill_mode ::= NEXT */ +{ yymsp[0].minor.yy54 = FILL_MODE_NEXT; } break; - case 422: /* group_by_list ::= expression */ -{ yylhsminor.yy530 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy674))); } - yymsp[0].minor.yy530 = yylhsminor.yy530; + case 423: /* group_by_list ::= expression */ +{ yylhsminor.yy424 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy632))); } + yymsp[0].minor.yy424 = yylhsminor.yy424; break; - case 423: /* group_by_list ::= group_by_list NK_COMMA expression */ -{ yylhsminor.yy530 = addNodeToList(pCxt, yymsp[-2].minor.yy530, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy674))); } - yymsp[-2].minor.yy530 = yylhsminor.yy530; + case 424: /* group_by_list ::= group_by_list NK_COMMA expression */ +{ yylhsminor.yy424 = addNodeToList(pCxt, yymsp[-2].minor.yy424, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy632))); } + yymsp[-2].minor.yy424 = yylhsminor.yy424; break; - case 426: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ + case 427: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ { - yylhsminor.yy674 = addOrderByClause(pCxt, yymsp[-3].minor.yy674, yymsp[-2].minor.yy530); - yylhsminor.yy674 = addSlimitClause(pCxt, yylhsminor.yy674, yymsp[-1].minor.yy674); - yylhsminor.yy674 = addLimitClause(pCxt, yylhsminor.yy674, yymsp[0].minor.yy674); + yylhsminor.yy632 = addOrderByClause(pCxt, yymsp[-3].minor.yy632, yymsp[-2].minor.yy424); + yylhsminor.yy632 = addSlimitClause(pCxt, yylhsminor.yy632, yymsp[-1].minor.yy632); + yylhsminor.yy632 = addLimitClause(pCxt, yylhsminor.yy632, yymsp[0].minor.yy632); } - yymsp[-3].minor.yy674 = yylhsminor.yy674; + yymsp[-3].minor.yy632 = yylhsminor.yy632; break; - case 428: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */ -{ yylhsminor.yy674 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy674, yymsp[0].minor.yy674); } - yymsp[-3].minor.yy674 = yylhsminor.yy674; + case 429: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */ +{ yylhsminor.yy632 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy632, yymsp[0].minor.yy632); } + yymsp[-3].minor.yy632 = yylhsminor.yy632; break; - case 429: /* query_expression_body ::= query_expression_body UNION query_expression_body */ -{ yylhsminor.yy674 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy674, yymsp[0].minor.yy674); } - yymsp[-2].minor.yy674 = yylhsminor.yy674; + case 430: /* query_expression_body ::= query_expression_body UNION query_expression_body */ +{ yylhsminor.yy632 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy632, yymsp[0].minor.yy632); } + yymsp[-2].minor.yy632 = yylhsminor.yy632; break; - case 431: /* query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP */ -{ yymsp[-5].minor.yy674 = yymsp[-4].minor.yy674; } - yy_destructor(yypParser,351,&yymsp[-3].minor); - yy_destructor(yypParser,352,&yymsp[-2].minor); - yy_destructor(yypParser,353,&yymsp[-1].minor); + case 432: /* query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP */ +{ yymsp[-5].minor.yy632 = yymsp[-4].minor.yy632; } + yy_destructor(yypParser,352,&yymsp[-3].minor); + yy_destructor(yypParser,353,&yymsp[-2].minor); + yy_destructor(yypParser,354,&yymsp[-1].minor); break; - case 435: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ - case 439: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==439); -{ yymsp[-1].minor.yy674 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } + case 436: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ + case 440: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==440); +{ yymsp[-1].minor.yy632 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } break; - case 436: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - case 440: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==440); -{ yymsp[-3].minor.yy674 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } + case 437: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + case 441: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==441); +{ yymsp[-3].minor.yy632 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } break; - case 437: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - case 441: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==441); -{ yymsp[-3].minor.yy674 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } + case 438: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + case 442: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==442); +{ yymsp[-3].minor.yy632 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } break; - case 442: /* subquery ::= NK_LP query_expression NK_RP */ -{ yylhsminor.yy674 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy674); } - yymsp[-2].minor.yy674 = yylhsminor.yy674; + case 443: /* subquery ::= NK_LP query_expression NK_RP */ +{ yylhsminor.yy632 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy632); } + yymsp[-2].minor.yy632 = yylhsminor.yy632; break; - case 446: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */ -{ yylhsminor.yy674 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy674), yymsp[-1].minor.yy610, yymsp[0].minor.yy107); } - yymsp[-2].minor.yy674 = yylhsminor.yy674; + case 447: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */ +{ yylhsminor.yy632 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy632), yymsp[-1].minor.yy578, yymsp[0].minor.yy217); } + yymsp[-2].minor.yy632 = yylhsminor.yy632; break; - case 447: /* ordering_specification_opt ::= */ -{ yymsp[1].minor.yy610 = ORDER_ASC; } + case 448: /* ordering_specification_opt ::= */ +{ yymsp[1].minor.yy578 = ORDER_ASC; } break; - case 448: /* ordering_specification_opt ::= ASC */ -{ yymsp[0].minor.yy610 = ORDER_ASC; } + case 449: /* ordering_specification_opt ::= ASC */ +{ yymsp[0].minor.yy578 = ORDER_ASC; } break; - case 449: /* ordering_specification_opt ::= DESC */ -{ yymsp[0].minor.yy610 = ORDER_DESC; } + case 450: /* ordering_specification_opt ::= DESC */ +{ yymsp[0].minor.yy578 = ORDER_DESC; } break; - case 450: /* null_ordering_opt ::= */ -{ yymsp[1].minor.yy107 = NULL_ORDER_DEFAULT; } + case 451: /* null_ordering_opt ::= */ +{ yymsp[1].minor.yy217 = NULL_ORDER_DEFAULT; } break; - case 451: /* null_ordering_opt ::= NULLS FIRST */ -{ yymsp[-1].minor.yy107 = NULL_ORDER_FIRST; } + case 452: /* null_ordering_opt ::= NULLS FIRST */ +{ yymsp[-1].minor.yy217 = NULL_ORDER_FIRST; } break; - case 452: /* null_ordering_opt ::= NULLS LAST */ -{ yymsp[-1].minor.yy107 = NULL_ORDER_LAST; } + case 453: /* null_ordering_opt ::= NULLS LAST */ +{ yymsp[-1].minor.yy217 = NULL_ORDER_LAST; } break; default: break; diff --git a/source/libs/parser/test/mockCatalog.cpp b/source/libs/parser/test/mockCatalog.cpp index 2ba5b97062..3729a2e1dc 100644 --- a/source/libs/parser/test/mockCatalog.cpp +++ b/source/libs/parser/test/mockCatalog.cpp @@ -157,6 +157,28 @@ void generateTestST1(MockCatalogService* mcs) { mcs->createSubTable("test", "st1", "st1s3", 1); } +/* + * Super Table: st2 + * Field | Type | DataType | Bytes | + * ========================================================================== + * ts | column | TIMESTAMP | 8 | + * c1 | column | INT | 4 | + * c2 | column | VARCHAR | 20 | + * jtag | tag | json | -- | + * Child Table: st2s1, st2s2 + */ +void generateTestST2(MockCatalogService* mcs) { + ITableBuilder& builder = mcs->createTableBuilder("test", "st2", TSDB_SUPER_TABLE, 3, 1) + .setPrecision(TSDB_TIME_PRECISION_MILLI) + .addColumn("ts", TSDB_DATA_TYPE_TIMESTAMP) + .addColumn("c1", TSDB_DATA_TYPE_INT) + .addColumn("c2", TSDB_DATA_TYPE_BINARY, 20) + .addTag("jtag", TSDB_DATA_TYPE_JSON); + builder.done(); + mcs->createSubTable("test", "st2", "st2s1", 1); + mcs->createSubTable("test", "st2", "st2s2", 2); +} + void generateFunctions(MockCatalogService* mcs) { mcs->createFunction("udf1", TSDB_FUNC_TYPE_SCALAR, TSDB_DATA_TYPE_INT, tDataTypes[TSDB_DATA_TYPE_INT].bytes, 0); mcs->createFunction("udf2", TSDB_FUNC_TYPE_AGGREGATE, TSDB_DATA_TYPE_DOUBLE, tDataTypes[TSDB_DATA_TYPE_DOUBLE].bytes, @@ -283,6 +305,7 @@ void generateMetaData() { generatePerformanceSchema(g_mockCatalogService.get()); generateTestT1(g_mockCatalogService.get()); generateTestST1(g_mockCatalogService.get()); + generateTestST2(g_mockCatalogService.get()); generateFunctions(g_mockCatalogService.get()); g_mockCatalogService->showTables(); } diff --git a/source/libs/parser/test/mockCatalogService.cpp b/source/libs/parser/test/mockCatalogService.cpp index 010d4a2f72..68f9e9d36d 100644 --- a/source/libs/parser/test/mockCatalogService.cpp +++ b/source/libs/parser/test/mockCatalogService.cpp @@ -584,3 +584,35 @@ int32_t MockCatalogService::catalogGetTableIndex(const SName* pTableName, SArray int32_t MockCatalogService::catalogGetAllMeta(const SCatalogReq* pCatalogReq, SMetaData* pMetaData) const { return impl_->catalogGetAllMeta(pCatalogReq, pMetaData); } + +void MockCatalogService::destoryCatalogReq(SCatalogReq* pReq) { + taosArrayDestroy(pReq->pDbVgroup); + taosArrayDestroy(pReq->pDbCfg); + taosArrayDestroy(pReq->pDbInfo); + taosArrayDestroy(pReq->pTableMeta); + taosArrayDestroy(pReq->pTableHash); + taosArrayDestroy(pReq->pUdf); + taosArrayDestroy(pReq->pIndex); + taosArrayDestroy(pReq->pUser); + taosArrayDestroy(pReq->pTableIndex); + delete pReq; +} + +void MockCatalogService::destoryMetaRes(void* p) { + SMetaRes* pRes = (SMetaRes*)p; + taosMemoryFree(pRes->pRes); +} + +void MockCatalogService::destoryMetaData(SMetaData* pData) { + taosArrayDestroyEx(pData->pDbVgroup, destoryMetaRes); + taosArrayDestroyEx(pData->pDbCfg, destoryMetaRes); + taosArrayDestroyEx(pData->pDbInfo, destoryMetaRes); + taosArrayDestroyEx(pData->pTableMeta, destoryMetaRes); + taosArrayDestroyEx(pData->pTableHash, destoryMetaRes); + taosArrayDestroyEx(pData->pTableIndex, destoryMetaRes); + taosArrayDestroyEx(pData->pUdfList, destoryMetaRes); + taosArrayDestroyEx(pData->pIndex, destoryMetaRes); + taosArrayDestroyEx(pData->pUser, destoryMetaRes); + taosArrayDestroyEx(pData->pQnodeList, destoryMetaRes); + delete pData; +} diff --git a/source/libs/parser/test/mockCatalogService.h b/source/libs/parser/test/mockCatalogService.h index c4ab091b7a..1c98a7d9d5 100644 --- a/source/libs/parser/test/mockCatalogService.h +++ b/source/libs/parser/test/mockCatalogService.h @@ -50,6 +50,10 @@ struct MockTableMeta { class MockCatalogServiceImpl; class MockCatalogService { public: + static void destoryCatalogReq(SCatalogReq* pReq); + static void destoryMetaRes(void* p); + static void destoryMetaData(SMetaData* pData); + MockCatalogService(); ~MockCatalogService(); ITableBuilder& createTableBuilder(const std::string& db, const std::string& tbname, int8_t tableType, diff --git a/source/libs/parser/test/parInitialATest.cpp b/source/libs/parser/test/parInitialATest.cpp index f554651b90..3c1d931f37 100644 --- a/source/libs/parser/test/parInitialATest.cpp +++ b/source/libs/parser/test/parInitialATest.cpp @@ -76,6 +76,11 @@ TEST_F(ParserInitialATest, alterSTable) { SMAlterStbReq expect = {0}; + auto clearAlterStbReq = [&]() { + tFreeSMAltertbReq(&expect); + memset(&expect, 0, sizeof(SMAlterStbReq)); + }; + auto setAlterStbReqFunc = [&](const char* pTbname, int8_t alterType, int32_t numOfFields = 0, const char* pField1Name = nullptr, int8_t field1Type = 0, int32_t field1Bytes = 0, const char* pField2Name = nullptr, const char* pComment = nullptr, @@ -139,39 +144,49 @@ TEST_F(ParserInitialATest, alterSTable) { ASSERT_EQ(pField->type, pExpectField->type); ASSERT_EQ(pField->bytes, pExpectField->bytes); } + tFreeSMAltertbReq(&req); }); setAlterStbReqFunc("st1", TSDB_ALTER_TABLE_UPDATE_OPTIONS, 0, nullptr, 0, 0, nullptr, nullptr, 10); run("ALTER TABLE st1 TTL 10"); + clearAlterStbReq(); setAlterStbReqFunc("st1", TSDB_ALTER_TABLE_UPDATE_OPTIONS, 0, nullptr, 0, 0, nullptr, "test"); run("ALTER TABLE st1 COMMENT 'test'"); + clearAlterStbReq(); setAlterStbReqFunc("st1", TSDB_ALTER_TABLE_ADD_COLUMN, 1, "cc1", TSDB_DATA_TYPE_BIGINT); run("ALTER TABLE st1 ADD COLUMN cc1 BIGINT"); + clearAlterStbReq(); setAlterStbReqFunc("st1", TSDB_ALTER_TABLE_DROP_COLUMN, 1, "c1"); run("ALTER TABLE st1 DROP COLUMN c1"); + clearAlterStbReq(); setAlterStbReqFunc("st1", TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, 1, "c1", TSDB_DATA_TYPE_VARCHAR, 20 + VARSTR_HEADER_SIZE); run("ALTER TABLE st1 MODIFY COLUMN c1 VARCHAR(20)"); + clearAlterStbReq(); // setAlterStbReqFunc("st1", TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, 2, "c1", 0, 0, "cc1"); // run("ALTER TABLE st1 RENAME COLUMN c1 cc1"); setAlterStbReqFunc("st1", TSDB_ALTER_TABLE_ADD_TAG, 1, "tag11", TSDB_DATA_TYPE_BIGINT); run("ALTER TABLE st1 ADD TAG tag11 BIGINT"); + clearAlterStbReq(); setAlterStbReqFunc("st1", TSDB_ALTER_TABLE_DROP_TAG, 1, "tag1"); run("ALTER TABLE st1 DROP TAG tag1"); + clearAlterStbReq(); setAlterStbReqFunc("st1", TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, 1, "tag1", TSDB_DATA_TYPE_VARCHAR, 20 + VARSTR_HEADER_SIZE); run("ALTER TABLE st1 MODIFY TAG tag1 VARCHAR(20)"); + clearAlterStbReq(); setAlterStbReqFunc("st1", TSDB_ALTER_TABLE_UPDATE_TAG_NAME, 2, "tag1", 0, 0, "tag11"); run("ALTER TABLE st1 RENAME TAG tag1 tag11"); + clearAlterStbReq(); // todo // ADD {FULLTEXT | SMA} INDEX index_name (col_name [, col_name] ...) [index_option] @@ -188,9 +203,16 @@ TEST_F(ParserInitialATest, alterTable) { SVAlterTbReq expect = {0}; + auto clearAlterTbReq = [&]() { + free(expect.tbName); + free(expect.colName); + free(expect.colNewName); + free(expect.tagName); + memset(&expect, 0, sizeof(SVAlterTbReq)); + }; + auto setAlterColFunc = [&](const char* pTbname, int8_t alterType, const char* pColName, int8_t dataType = 0, int32_t dataBytes = 0, const char* pNewColName = nullptr) { - memset(&expect, 0, sizeof(SVAlterTbReq)); expect.tbName = strdup(pTbname); expect.action = alterType; expect.colName = strdup(pColName); @@ -213,7 +235,6 @@ TEST_F(ParserInitialATest, alterTable) { }; auto setAlterTagFunc = [&](const char* pTbname, const char* pTagName, uint8_t* pNewVal, uint32_t bytes) { - memset(&expect, 0, sizeof(SVAlterTbReq)); expect.tbName = strdup(pTbname); expect.action = TSDB_ALTER_TABLE_UPDATE_TAG_VAL; expect.tagName = strdup(pTagName); @@ -224,7 +245,6 @@ TEST_F(ParserInitialATest, alterTable) { }; auto setAlterOptionsFunc = [&](const char* pTbname, int32_t ttl, char* pComment = nullptr) { - memset(&expect, 0, sizeof(SVAlterTbReq)); expect.tbName = strdup(pTbname); expect.action = TSDB_ALTER_TABLE_UPDATE_OPTIONS; if (-1 != ttl) { @@ -281,25 +301,32 @@ TEST_F(ParserInitialATest, alterTable) { setAlterOptionsFunc("t1", 10, nullptr); run("ALTER TABLE t1 TTL 10"); + clearAlterTbReq(); setAlterOptionsFunc("t1", -1, (char*)"test"); run("ALTER TABLE t1 COMMENT 'test'"); + clearAlterTbReq(); setAlterColFunc("t1", TSDB_ALTER_TABLE_ADD_COLUMN, "cc1", TSDB_DATA_TYPE_BIGINT); run("ALTER TABLE t1 ADD COLUMN cc1 BIGINT"); + clearAlterTbReq(); setAlterColFunc("t1", TSDB_ALTER_TABLE_DROP_COLUMN, "c1"); run("ALTER TABLE t1 DROP COLUMN c1"); + clearAlterTbReq(); setAlterColFunc("t1", TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, "c2", TSDB_DATA_TYPE_VARCHAR, 30 + VARSTR_HEADER_SIZE); run("ALTER TABLE t1 MODIFY COLUMN c2 VARCHAR(30)"); + clearAlterTbReq(); setAlterColFunc("t1", TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, "c1", 0, 0, "cc1"); run("ALTER TABLE t1 RENAME COLUMN c1 cc1"); + clearAlterTbReq(); int32_t val = 10; setAlterTagFunc("st1s1", "tag1", (uint8_t*)&val, sizeof(val)); run("ALTER TABLE st1s1 SET TAG tag1=10"); + clearAlterTbReq(); // todo // ADD {FULLTEXT | SMA} INDEX index_name (col_name [, col_name] ...) [index_option] diff --git a/source/libs/parser/test/parInitialCTest.cpp b/source/libs/parser/test/parInitialCTest.cpp index f306947f76..919d4c041d 100644 --- a/source/libs/parser/test/parInitialCTest.cpp +++ b/source/libs/parser/test/parInitialCTest.cpp @@ -67,8 +67,12 @@ TEST_F(ParserInitialCTest, createDatabase) { SCreateDbReq expect = {0}; - auto setCreateDbReqFunc = [&](const char* pDbname, int8_t igExists = 0) { + auto clearCreateDbReq = [&]() { + tFreeSCreateDbReq(&expect); memset(&expect, 0, sizeof(SCreateDbReq)); + }; + + auto setCreateDbReqFunc = [&](const char* pDbname, int8_t igExists = 0) { int32_t len = snprintf(expect.db, sizeof(expect.db), "0.%s", pDbname); expect.db[len] = '\0'; expect.ignoreExist = igExists; @@ -166,10 +170,12 @@ TEST_F(ParserInitialCTest, createDatabase) { ASSERT_EQ(pReten->keepUnit, pExpectReten->keepUnit); } } + tFreeSCreateDbReq(&req); }); setCreateDbReqFunc("wxy_db"); run("CREATE DATABASE wxy_db"); + clearCreateDbReq(); setCreateDbReqFunc("wxy_db", 1); setDbBufferFunc(64); @@ -211,6 +217,7 @@ TEST_F(ParserInitialCTest, createDatabase) { "VGROUPS 100 " "SINGLE_STABLE 1 " "SCHEMALESS 1"); + clearCreateDbReq(); setCreateDbReqFunc("wxy_db", 1); setDbDaysFunc(100); @@ -218,6 +225,7 @@ TEST_F(ParserInitialCTest, createDatabase) { run("CREATE DATABASE IF NOT EXISTS wxy_db " "DAYS 100m " "KEEP 1440m,300h,400d "); + clearCreateDbReq(); } TEST_F(ParserInitialCTest, createDatabaseSemanticCheck) { @@ -309,10 +317,14 @@ TEST_F(ParserInitialCTest, createStable) { SMCreateStbReq expect = {0}; + auto clearCreateStbReq = [&]() { + tFreeSMCreateStbReq(&expect); + memset(&expect, 0, sizeof(SMCreateStbReq)); + }; + auto setCreateStbReqFunc = [&](const char* pTbname, int8_t igExists = 0, float xFilesFactor = TSDB_DEFAULT_ROLLUP_FILE_FACTOR, int32_t ttl = TSDB_DEFAULT_TABLE_TTL, const char* pComment = nullptr) { - memset(&expect, 0, sizeof(SMCreateStbReq)); int32_t len = snprintf(expect.name, sizeof(expect.name), "0.test.%s", pTbname); expect.name[len] = '\0'; expect.igExists = igExists; @@ -396,6 +408,7 @@ TEST_F(ParserInitialCTest, createStable) { if (expect.ast2Len > 0) { ASSERT_EQ(std::string(req.pAst2), std::string(expect.pAst2)); } + tFreeSMCreateStbReq(&req); }); setCreateStbReqFunc("t1"); @@ -403,6 +416,7 @@ TEST_F(ParserInitialCTest, createStable) { addFieldToCreateStbReqFunc(true, "c1", TSDB_DATA_TYPE_INT); addFieldToCreateStbReqFunc(false, "id", TSDB_DATA_TYPE_INT); run("CREATE STABLE t1(ts TIMESTAMP, c1 INT) TAGS(id INT)"); + clearCreateStbReq(); setCreateStbReqFunc("t1", 1, 0.1, 100, "test create table"); addFieldToCreateStbReqFunc(true, "ts", TSDB_DATA_TYPE_TIMESTAMP, 0, 0); @@ -443,6 +457,7 @@ TEST_F(ParserInitialCTest, createStable) { "a8 BINARY(20), a9 SMALLINT, a10 SMALLINT UNSIGNED COMMENT 'test column comment', a11 TINYINT, " "a12 TINYINT UNSIGNED, a13 BOOL, a14 NCHAR(30), a15 VARCHAR(50)) " "TTL 100 COMMENT 'test create table' SMA(c1, c2, c3) ROLLUP (MIN) FILE_FACTOR 0.1"); + clearCreateStbReq(); } TEST_F(ParserInitialCTest, createStableSemanticCheck) { @@ -455,13 +470,62 @@ TEST_F(ParserInitialCTest, createStableSemanticCheck) { TEST_F(ParserInitialCTest, createStream) { useDb("root", "test"); + SCMCreateStreamReq expect = {0}; + + auto clearCreateStreamReq = [&]() { + tFreeSCMCreateStreamReq(&expect); + memset(&expect, 0, sizeof(SCMCreateStreamReq)); + }; + + auto setCreateStbReqFunc = + [&](const char* pStream, const char* pSrcDb, const char* pSql, const char* pDstStb = nullptr, int8_t igExists = 0, + int8_t triggerType = STREAM_TRIGGER_AT_ONCE, int64_t maxDelay = 0, int64_t watermark = 0) { + snprintf(expect.name, sizeof(expect.name), "0.%s", pStream); + snprintf(expect.sourceDB, sizeof(expect.sourceDB), "0.%s", pSrcDb); + if (NULL != pDstStb) { + snprintf(expect.targetStbFullName, sizeof(expect.targetStbFullName), "0.test.%s", pDstStb); + } + expect.igExists = igExists; + expect.sql = strdup(pSql); + expect.triggerType = triggerType; + expect.maxDelay = maxDelay; + expect.watermark = watermark; + }; + + setCheckDdlFunc([&](const SQuery* pQuery, ParserStage stage) { + ASSERT_EQ(nodeType(pQuery->pRoot), QUERY_NODE_CREATE_STREAM_STMT); + SCMCreateStreamReq req = {0}; + ASSERT_TRUE(TSDB_CODE_SUCCESS == + tDeserializeSCMCreateStreamReq(pQuery->pCmdMsg->pMsg, pQuery->pCmdMsg->msgLen, &req)); + + ASSERT_EQ(std::string(req.name), std::string(expect.name)); + ASSERT_EQ(std::string(req.sourceDB), std::string(expect.sourceDB)); + ASSERT_EQ(std::string(req.targetStbFullName), std::string(expect.targetStbFullName)); + ASSERT_EQ(req.igExists, expect.igExists); + ASSERT_EQ(std::string(req.sql), std::string(expect.sql)); + ASSERT_EQ(req.triggerType, expect.triggerType); + ASSERT_EQ(req.maxDelay, expect.maxDelay); + ASSERT_EQ(req.watermark, expect.watermark); + tFreeSCMCreateStreamReq(&req); + }); + + setCreateStbReqFunc("s1", "test", "create stream s1 as select * from t1"); run("CREATE STREAM s1 AS SELECT * FROM t1"); + clearCreateStreamReq(); + setCreateStbReqFunc("s1", "test", "create stream if not exists s1 as select * from t1", nullptr, 1); run("CREATE STREAM IF NOT EXISTS s1 AS SELECT * FROM t1"); + clearCreateStreamReq(); + setCreateStbReqFunc("s1", "test", "create stream s1 into st1 as select * from t1", "st1"); run("CREATE STREAM s1 INTO st1 AS SELECT * FROM t1"); + clearCreateStreamReq(); - run("CREATE STREAM IF NOT EXISTS s1 TRIGGER WINDOW_CLOSE WATERMARK 10s INTO st1 AS SELECT * FROM t1"); + setCreateStbReqFunc("s1", "test", + "create stream if not exists s1 trigger max_delay 20s watermark 10s into st1 as select * from t1", + "st1", 1, STREAM_TRIGGER_MAX_DELAY, 20 * MILLISECOND_PER_SECOND, 10 * MILLISECOND_PER_SECOND); + run("CREATE STREAM IF NOT EXISTS s1 TRIGGER MAX_DELAY 20s WATERMARK 10s INTO st1 AS SELECT * FROM t1"); + clearCreateStreamReq(); } TEST_F(ParserInitialCTest, createTable) { @@ -497,9 +561,10 @@ TEST_F(ParserInitialCTest, createTopic) { SCMCreateTopicReq expect = {0}; + auto clearCreateTopicReq = [&]() { memset(&expect, 0, sizeof(SCMCreateTopicReq)); }; + auto setCreateTopicReqFunc = [&](const char* pTopicName, int8_t igExists, const char* pSql, const char* pAst, const char* pDbName = nullptr, const char* pTbname = nullptr) { - memset(&expect, 0, sizeof(SMCreateStbReq)); snprintf(expect.name, sizeof(expect.name), "0.%s", pTopicName); expect.igExists = igExists; expect.sql = (char*)pSql; @@ -538,19 +603,24 @@ TEST_F(ParserInitialCTest, createTopic) { default: ASSERT_TRUE(false); } + tFreeSCMCreateTopicReq(&req); }); setCreateTopicReqFunc("tp1", 0, "create topic tp1 as select * from t1", "ast"); run("CREATE TOPIC tp1 AS SELECT * FROM t1"); + clearCreateTopicReq(); setCreateTopicReqFunc("tp1", 1, "create topic if not exists tp1 as select ts, ceil(c1) from t1", "ast"); run("CREATE TOPIC IF NOT EXISTS tp1 AS SELECT ts, CEIL(c1) FROM t1"); + clearCreateTopicReq(); setCreateTopicReqFunc("tp1", 0, "create topic tp1 as database test", nullptr, "test"); run("CREATE TOPIC tp1 AS DATABASE test"); + clearCreateTopicReq(); setCreateTopicReqFunc("tp1", 1, "create topic if not exists tp1 as stable st1", nullptr, "test", "st1"); run("CREATE TOPIC IF NOT EXISTS tp1 AS STABLE st1"); + clearCreateTopicReq(); } TEST_F(ParserInitialCTest, createUser) { diff --git a/source/libs/parser/test/parInsertTest.cpp b/source/libs/parser/test/parInsertTest.cpp index eae83e2223..29edca0d40 100644 --- a/source/libs/parser/test/parInsertTest.cpp +++ b/source/libs/parser/test/parInsertTest.cpp @@ -35,6 +35,9 @@ string toString(int32_t code) { return tstrerror(code); } // [...]; class InsertTest : public Test { protected: + InsertTest() : res_(nullptr) {} + ~InsertTest() { reset(); } + void setDatabase(const string& acctId, const string& db) { acctId_ = acctId; db_ = db; @@ -51,7 +54,7 @@ class InsertTest : public Test { } int32_t run() { - code_ = parseInsertSql(&cxt_, &res_); + code_ = parseInsertSql(&cxt_, &res_, nullptr); if (code_ != TSDB_CODE_SUCCESS) { cout << "code:" << toString(code_) << ", msg:" << errMagBuf_ << endl; } @@ -60,29 +63,31 @@ class InsertTest : public Test { int32_t runAsync() { cxt_.async = true; - code_ = parseInsertSyntax(&cxt_, &res_); + unique_ptr metaCache(new SParseMetaCache(), _destoryParseMetaCache); + code_ = parseInsertSyntax(&cxt_, &res_, metaCache.get()); if (code_ != TSDB_CODE_SUCCESS) { cout << "parseInsertSyntax code:" << toString(code_) << ", msg:" << errMagBuf_ << endl; return code_; } - SCatalogReq catalogReq = {0}; - code_ = buildCatalogReq(res_->pMetaCache, &catalogReq); + unique_ptr catalogReq(new SCatalogReq(), + MockCatalogService::destoryCatalogReq); + code_ = buildCatalogReq(metaCache.get(), catalogReq.get()); if (code_ != TSDB_CODE_SUCCESS) { cout << "buildCatalogReq code:" << toString(code_) << ", msg:" << errMagBuf_ << endl; return code_; } - SMetaData metaData = {0}; - g_mockCatalogService->catalogGetAllMeta(&catalogReq, &metaData); + unique_ptr metaData(new SMetaData(), MockCatalogService::destoryMetaData); + g_mockCatalogService->catalogGetAllMeta(catalogReq.get(), metaData.get()); - code_ = putMetaDataToCache(&catalogReq, &metaData, res_->pMetaCache); + code_ = putMetaDataToCache(catalogReq.get(), metaData.get(), metaCache.get()); if (code_ != TSDB_CODE_SUCCESS) { cout << "putMetaDataToCache code:" << toString(code_) << ", msg:" << errMagBuf_ << endl; return code_; } - code_ = parseInsertSql(&cxt_, &res_); + code_ = parseInsertSql(&cxt_, &res_, metaCache.get()); if (code_ != TSDB_CODE_SUCCESS) { cout << "parseInsertSql code:" << toString(code_) << ", msg:" << errMagBuf_ << endl; return code_; @@ -139,12 +144,18 @@ class InsertTest : public Test { static const int max_err_len = 1024; static const int max_sql_len = 1024 * 1024; + static void _destoryParseMetaCache(SParseMetaCache* pMetaCache) { + destoryParseMetaCache(pMetaCache); + delete pMetaCache; + } + void reset() { memset(&cxt_, 0, sizeof(cxt_)); memset(errMagBuf_, 0, max_err_len); cxt_.pMsg = errMagBuf_; cxt_.msgLen = max_err_len; code_ = TSDB_CODE_SUCCESS; + qDestroyQuery(res_); res_ = nullptr; } diff --git a/source/libs/parser/test/parTestMain.cpp b/source/libs/parser/test/parTestMain.cpp index ecc535feb0..bcaccbab07 100644 --- a/source/libs/parser/test/parTestMain.cpp +++ b/source/libs/parser/test/parTestMain.cpp @@ -45,6 +45,7 @@ class ParserEnv : public testing::Environment { destroyMetaDataEnv(); taosCleanupKeywordsTable(); fmFuncMgtDestroy(); + taosCloseLog(); } ParserEnv() {} diff --git a/source/libs/parser/test/parTestUtil.cpp b/source/libs/parser/test/parTestUtil.cpp index fab7ed35b1..13ab116552 100644 --- a/source/libs/parser/test/parTestUtil.cpp +++ b/source/libs/parser/test/parTestUtil.cpp @@ -78,33 +78,12 @@ class ParserTestBaseImpl { return; } - reset(expect, checkStage); - try { - SParseContext cxt = {0}; - setParseContext(sql, &cxt); - - SQuery* pQuery = nullptr; - doParse(&cxt, &pQuery); - - doAuthenticate(&cxt, pQuery); - - doTranslate(&cxt, pQuery); - - doCalculateConstant(&cxt, pQuery); - - if (g_dump) { - dump(); - } - } catch (const TerminateFlag& e) { - // success and terminate - return; - } catch (...) { - dump(); - throw; - } + runInternalFuncs(sql, expect, checkStage); + runApis(sql, expect, checkStage); if (g_testAsyncApis) { - runAsync(sql, expect, checkStage); + runAsyncInternalFuncs(sql, expect, checkStage); + runAsyncApis(sql, expect, checkStage); } } @@ -131,34 +110,63 @@ class ParserTestBaseImpl { string calcConstAst_; }; + enum TestInterfaceType { + TEST_INTERFACE_INTERNAL = 1, + TEST_INTERFACE_API, + TEST_INTERFACE_ASYNC_INTERNAL, + TEST_INTERFACE_ASYNC_API + }; + + static void _destoryParseMetaCache(SParseMetaCache* pMetaCache) { + destoryParseMetaCache(pMetaCache); + delete pMetaCache; + } + bool checkResultCode(const string& pFunc, int32_t resultCode) { return !(stmtEnv_.checkFunc_.empty()) - ? (("*" == stmtEnv_.checkFunc_ || stmtEnv_.checkFunc_ == pFunc) ? stmtEnv_.expect_ == resultCode - : TSDB_CODE_SUCCESS == resultCode) + ? ((stmtEnv_.checkFunc_ == pFunc) ? stmtEnv_.expect_ == resultCode : TSDB_CODE_SUCCESS == resultCode) : true; } - string stageFunc(ParserStage stage) { - switch (stage) { - case PARSER_STAGE_PARSE: - return "parse"; - case PARSER_STAGE_TRANSLATE: - return "translate"; - case PARSER_STAGE_CALC_CONST: - return "calculateConstant"; - case PARSER_STAGE_ALL: - return "*"; + string stageFunc(ParserStage stage, TestInterfaceType type) { + switch (type) { + case TEST_INTERFACE_INTERNAL: + case TEST_INTERFACE_ASYNC_INTERNAL: + switch (stage) { + case PARSER_STAGE_PARSE: + return "parse"; + case PARSER_STAGE_TRANSLATE: + return "translate"; + case PARSER_STAGE_CALC_CONST: + return "calculateConstant"; + default: + break; + } + break; + case TEST_INTERFACE_API: + return "qParseSql"; + case TEST_INTERFACE_ASYNC_API: + switch (stage) { + case PARSER_STAGE_PARSE: + return "qParseSqlSyntax"; + case PARSER_STAGE_TRANSLATE: + case PARSER_STAGE_CALC_CONST: + return "qAnalyseSqlSemantic"; + default: + break; + } + break; default: break; } return "unknown"; } - void reset(int32_t expect, ParserStage checkStage) { + void reset(int32_t expect, ParserStage checkStage, TestInterfaceType type) { stmtEnv_.sql_.clear(); stmtEnv_.msgBuf_.fill(0); stmtEnv_.expect_ = expect; - stmtEnv_.checkFunc_ = stageFunc(checkStage); + stmtEnv_.checkFunc_ = stageFunc(checkStage, type); res_.parsedAst_.clear(); res_.translatedAst_.clear(); @@ -167,12 +175,18 @@ class ParserTestBaseImpl { void dump() { cout << "==========================================sql : [" << stmtEnv_.sql_ << "]" << endl; - cout << "raw syntax tree : " << endl; - cout << res_.parsedAst_ << endl; - cout << "translated syntax tree : " << endl; - cout << res_.translatedAst_ << endl; - cout << "optimized syntax tree : " << endl; - cout << res_.calcConstAst_ << endl; + if (!res_.parsedAst_.empty()) { + cout << "raw syntax tree : " << endl; + cout << res_.parsedAst_ << endl; + } + if (!res_.translatedAst_.empty()) { + cout << "translated syntax tree : " << endl; + cout << res_.translatedAst_ << endl; + } + if (!res_.calcConstAst_.empty()) { + cout << "optimized syntax tree : " << endl; + cout << res_.calcConstAst_ << endl; + } } void setParseContext(const string& sql, SParseContext* pCxt, bool async = false) { @@ -196,9 +210,8 @@ class ParserTestBaseImpl { res_.parsedAst_ = toString((*pQuery)->pRoot); } - void doCollectMetaKey(SParseContext* pCxt, SQuery* pQuery) { - DO_WITH_THROW(collectMetaKey, pCxt, pQuery); - ASSERT_NE(pQuery->pMetaCache, nullptr); + void doCollectMetaKey(SParseContext* pCxt, SQuery* pQuery, SParseMetaCache* pMetaCache) { + DO_WITH_THROW(collectMetaKey, pCxt, pQuery, pMetaCache); } void doBuildCatalogReq(const SParseMetaCache* pMetaCache, SCatalogReq* pCatalogReq) { @@ -213,10 +226,12 @@ class ParserTestBaseImpl { DO_WITH_THROW(putMetaDataToCache, pCatalogReq, pMetaData, pMetaCache); } - void doAuthenticate(SParseContext* pCxt, SQuery* pQuery) { DO_WITH_THROW(authenticate, pCxt, pQuery); } + void doAuthenticate(SParseContext* pCxt, SQuery* pQuery, SParseMetaCache* pMetaCache) { + DO_WITH_THROW(authenticate, pCxt, pQuery, pMetaCache); + } - void doTranslate(SParseContext* pCxt, SQuery* pQuery) { - DO_WITH_THROW(translate, pCxt, pQuery); + void doTranslate(SParseContext* pCxt, SQuery* pQuery, SParseMetaCache* pMetaCache) { + DO_WITH_THROW(translate, pCxt, pQuery, pMetaCache); checkQuery(pQuery, PARSER_STAGE_TRANSLATE); res_.translatedAst_ = toString(pQuery->pRoot); } @@ -226,6 +241,24 @@ class ParserTestBaseImpl { res_.calcConstAst_ = toString(pQuery->pRoot); } + void doParseSql(SParseContext* pCxt, SQuery** pQuery) { + DO_WITH_THROW(qParseSql, pCxt, pQuery); + ASSERT_NE(*pQuery, nullptr); + res_.calcConstAst_ = toString((*pQuery)->pRoot); + } + + void doParseSqlSyntax(SParseContext* pCxt, SQuery** pQuery, SCatalogReq* pCatalogReq) { + DO_WITH_THROW(qParseSqlSyntax, pCxt, pQuery, pCatalogReq); + ASSERT_NE(*pQuery, nullptr); + res_.parsedAst_ = toString((*pQuery)->pRoot); + } + + void doAnalyseSqlSemantic(SParseContext* pCxt, const SCatalogReq* pCatalogReq, const SMetaData* pMetaData, + SQuery* pQuery) { + DO_WITH_THROW(qAnalyseSqlSemantic, pCxt, pCatalogReq, pMetaData, pQuery); + res_.calcConstAst_ = toString(pQuery->pRoot); + } + string toString(const SNode* pRoot) { char* pStr = NULL; int32_t len = 0; @@ -237,31 +270,84 @@ class ParserTestBaseImpl { void checkQuery(const SQuery* pQuery, ParserStage stage) { pBase_->checkDdl(pQuery, stage); } - void runAsync(const string& sql, int32_t expect, ParserStage checkStage) { - reset(expect, checkStage); + void runInternalFuncs(const string& sql, int32_t expect, ParserStage checkStage) { + reset(expect, checkStage, TEST_INTERFACE_INTERNAL); + try { + SParseContext cxt = {0}; + setParseContext(sql, &cxt); + + SQuery* pQuery = nullptr; + doParse(&cxt, &pQuery); + unique_ptr query(pQuery, qDestroyQuery); + + doAuthenticate(&cxt, pQuery, nullptr); + + doTranslate(&cxt, pQuery, nullptr); + + doCalculateConstant(&cxt, pQuery); + + if (g_dump) { + dump(); + } + } catch (const TerminateFlag& e) { + // success and terminate + return; + } catch (...) { + dump(); + throw; + } + } + + void runApis(const string& sql, int32_t expect, ParserStage checkStage) { + reset(expect, checkStage, TEST_INTERFACE_API); + try { + SParseContext cxt = {0}; + setParseContext(sql, &cxt); + + SQuery* pQuery = nullptr; + doParseSql(&cxt, &pQuery); + unique_ptr query(pQuery, qDestroyQuery); + + if (g_dump) { + dump(); + } + } catch (const TerminateFlag& e) { + // success and terminate + return; + } catch (...) { + dump(); + throw; + } + } + + void runAsyncInternalFuncs(const string& sql, int32_t expect, ParserStage checkStage) { + reset(expect, checkStage, TEST_INTERFACE_ASYNC_INTERNAL); try { SParseContext cxt = {0}; setParseContext(sql, &cxt, true); SQuery* pQuery = nullptr; doParse(&cxt, &pQuery); + unique_ptr query(pQuery, qDestroyQuery); - doCollectMetaKey(&cxt, pQuery); + unique_ptr metaCache(new SParseMetaCache(), _destoryParseMetaCache); + doCollectMetaKey(&cxt, pQuery, metaCache.get()); - SCatalogReq catalogReq = {0}; - doBuildCatalogReq(pQuery->pMetaCache, &catalogReq); + unique_ptr catalogReq(new SCatalogReq(), + MockCatalogService::destoryCatalogReq); + doBuildCatalogReq(metaCache.get(), catalogReq.get()); string err; thread t1([&]() { try { - SMetaData metaData = {0}; - doGetAllMeta(&catalogReq, &metaData); + unique_ptr metaData(new SMetaData(), MockCatalogService::destoryMetaData); + doGetAllMeta(catalogReq.get(), metaData.get()); - doPutMetaDataToCache(&catalogReq, &metaData, pQuery->pMetaCache); + doPutMetaDataToCache(catalogReq.get(), metaData.get(), metaCache.get()); - doAuthenticate(&cxt, pQuery); + doAuthenticate(&cxt, pQuery, metaCache.get()); - doTranslate(&cxt, pQuery); + doTranslate(&cxt, pQuery, metaCache.get()); doCalculateConstant(&cxt, pQuery); } catch (const TerminateFlag& e) { @@ -290,6 +376,51 @@ class ParserTestBaseImpl { } } + void runAsyncApis(const string& sql, int32_t expect, ParserStage checkStage) { + reset(expect, checkStage, TEST_INTERFACE_ASYNC_API); + try { + SParseContext cxt = {0}; + setParseContext(sql, &cxt); + + unique_ptr catalogReq(new SCatalogReq(), + MockCatalogService::destoryCatalogReq); + SQuery* pQuery = nullptr; + doParseSqlSyntax(&cxt, &pQuery, catalogReq.get()); + unique_ptr query(pQuery, qDestroyQuery); + + string err; + thread t1([&]() { + try { + unique_ptr metaData(new SMetaData(), MockCatalogService::destoryMetaData); + doGetAllMeta(catalogReq.get(), metaData.get()); + + doAnalyseSqlSemantic(&cxt, catalogReq.get(), metaData.get(), pQuery); + } catch (const TerminateFlag& e) { + // success and terminate + } catch (const runtime_error& e) { + err = e.what(); + } catch (...) { + err = "unknown error"; + } + }); + + t1.join(); + if (!err.empty()) { + throw runtime_error(err); + } + + if (g_dump) { + dump(); + } + } catch (const TerminateFlag& e) { + // success and terminate + return; + } catch (...) { + dump(); + throw; + } + } + caseEnv caseEnv_; stmtEnv stmtEnv_; stmtRes res_; diff --git a/source/libs/parser/test/parTestUtil.h b/source/libs/parser/test/parTestUtil.h index ad21252c2b..afdb763448 100644 --- a/source/libs/parser/test/parTestUtil.h +++ b/source/libs/parser/test/parTestUtil.h @@ -27,7 +27,7 @@ namespace ParserTest { class ParserTestBaseImpl; -enum ParserStage { PARSER_STAGE_PARSE, PARSER_STAGE_TRANSLATE, PARSER_STAGE_CALC_CONST, PARSER_STAGE_ALL }; +enum ParserStage { PARSER_STAGE_PARSE = 1, PARSER_STAGE_TRANSLATE, PARSER_STAGE_CALC_CONST }; class ParserTestBase : public testing::Test { public: diff --git a/source/libs/planner/src/planLogicCreater.c b/source/libs/planner/src/planLogicCreater.c index d67b194192..17ab06cac9 100644 --- a/source/libs/planner/src/planLogicCreater.c +++ b/source/libs/planner/src/planLogicCreater.c @@ -138,7 +138,7 @@ static int32_t createRootLogicNode(SLogicPlanContext* pCxt, void* pStmt, uint8_t code = pushLogicNode(pCxt, pRoot, pNode); } if (TSDB_CODE_SUCCESS != code) { - nodesDestroyNode(pNode); + nodesDestroyNode((SNode*)pNode); } return code; } @@ -173,8 +173,8 @@ static EScanType getScanType(SLogicPlanContext* pCxt, SNodeList* pScanPseudoCols return SCAN_TYPE_TAG; } -static SNodeptr createPrimaryKeyCol(uint64_t tableId) { - SColumnNode* pCol = nodesMakeNode(QUERY_NODE_COLUMN); +static SNode* createPrimaryKeyCol(uint64_t tableId) { + SColumnNode* pCol = (SColumnNode*)nodesMakeNode(QUERY_NODE_COLUMN); if (NULL == pCol) { return NULL; } @@ -184,7 +184,7 @@ static SNodeptr createPrimaryKeyCol(uint64_t tableId) { pCol->colId = PRIMARYKEY_TIMESTAMP_COL_ID; pCol->colType = COLUMN_TYPE_COLUMN; strcpy(pCol->colName, "#primarykey"); - return pCol; + return (SNode*)pCol; } static int32_t addPrimaryKeyCol(uint64_t tableId, SNodeList** pCols) { @@ -282,7 +282,7 @@ static int32_t createScanLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect if (TSDB_CODE_SUCCESS == code) { *pLogicNode = (SLogicNode*)pScan; } else { - nodesDestroyNode(pScan); + nodesDestroyNode((SNode*)pScan); } return code; @@ -349,7 +349,7 @@ static int32_t createJoinLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect if (TSDB_CODE_SUCCESS == code) { *pLogicNode = (SLogicNode*)pJoin; } else { - nodesDestroyNode(pJoin); + nodesDestroyNode((SNode*)pJoin); } return code; @@ -377,7 +377,7 @@ static int32_t createLogicNodeByTable(SLogicPlanContext* pCxt, SSelectStmt* pSel if (TSDB_CODE_SUCCESS == code) { pNode->pConditions = nodesCloneNode(pSelect->pWhere); if (NULL != pSelect->pWhere && NULL == pNode->pConditions) { - nodesDestroyNode(pNode); + nodesDestroyNode((SNode*)pNode); return TSDB_CODE_OUT_OF_MEMORY; } pNode->precision = pSelect->precision; @@ -387,7 +387,7 @@ static int32_t createLogicNodeByTable(SLogicPlanContext* pCxt, SSelectStmt* pSel } static SColumnNode* createColumnByExpr(const char* pStmtName, SExprNode* pExpr) { - SColumnNode* pCol = nodesMakeNode(QUERY_NODE_COLUMN); + SColumnNode* pCol = (SColumnNode*)nodesMakeNode(QUERY_NODE_COLUMN); if (NULL == pCol) { return NULL; } @@ -451,7 +451,7 @@ static int32_t createAggLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect, if (TSDB_CODE_SUCCESS == code) { *pLogicNode = (SLogicNode*)pAgg; } else { - nodesDestroyNode(pAgg); + nodesDestroyNode((SNode*)pAgg); } return code; @@ -482,7 +482,7 @@ static int32_t createIndefRowsFuncLogicNode(SLogicPlanContext* pCxt, SSelectStmt if (TSDB_CODE_SUCCESS == code) { *pLogicNode = (SLogicNode*)pIdfRowsFunc; } else { - nodesDestroyNode(pIdfRowsFunc); + nodesDestroyNode((SNode*)pIdfRowsFunc); } return code; @@ -514,7 +514,7 @@ static int32_t createWindowLogicNodeFinalize(SLogicPlanContext* pCxt, SSelectStm if (TSDB_CODE_SUCCESS == code) { *pLogicNode = (SLogicNode*)pWindow; } else { - nodesDestroyNode(pWindow); + nodesDestroyNode((SNode*)pWindow); } return code; @@ -522,7 +522,7 @@ static int32_t createWindowLogicNodeFinalize(SLogicPlanContext* pCxt, SSelectStm static int32_t createWindowLogicNodeByState(SLogicPlanContext* pCxt, SStateWindowNode* pState, SSelectStmt* pSelect, SLogicNode** pLogicNode) { - SWindowLogicNode* pWindow = nodesMakeNode(QUERY_NODE_LOGIC_PLAN_WINDOW); + SWindowLogicNode* pWindow = (SWindowLogicNode*)nodesMakeNode(QUERY_NODE_LOGIC_PLAN_WINDOW); if (NULL == pWindow) { return TSDB_CODE_OUT_OF_MEMORY; } @@ -532,7 +532,7 @@ static int32_t createWindowLogicNodeByState(SLogicPlanContext* pCxt, SStateWindo pWindow->pTspk = nodesCloneNode(pState->pCol); if (NULL == pWindow->pTspk) { - nodesDestroyNode(pWindow); + nodesDestroyNode((SNode*)pWindow); return TSDB_CODE_OUT_OF_MEMORY; } @@ -541,7 +541,7 @@ static int32_t createWindowLogicNodeByState(SLogicPlanContext* pCxt, SStateWindo static int32_t createWindowLogicNodeBySession(SLogicPlanContext* pCxt, SSessionWindowNode* pSession, SSelectStmt* pSelect, SLogicNode** pLogicNode) { - SWindowLogicNode* pWindow = nodesMakeNode(QUERY_NODE_LOGIC_PLAN_WINDOW); + SWindowLogicNode* pWindow = (SWindowLogicNode*)nodesMakeNode(QUERY_NODE_LOGIC_PLAN_WINDOW); if (NULL == pWindow) { return TSDB_CODE_OUT_OF_MEMORY; } @@ -549,9 +549,9 @@ static int32_t createWindowLogicNodeBySession(SLogicPlanContext* pCxt, SSessionW pWindow->winType = WINDOW_TYPE_SESSION; pWindow->sessionGap = ((SValueNode*)pSession->pGap)->datum.i; - pWindow->pTspk = nodesCloneNode(pSession->pCol); + pWindow->pTspk = nodesCloneNode((SNode*)pSession->pCol); if (NULL == pWindow->pTspk) { - nodesDestroyNode(pWindow); + nodesDestroyNode((SNode*)pWindow); return TSDB_CODE_OUT_OF_MEMORY; } @@ -560,7 +560,7 @@ static int32_t createWindowLogicNodeBySession(SLogicPlanContext* pCxt, SSessionW static int32_t createWindowLogicNodeByInterval(SLogicPlanContext* pCxt, SIntervalWindowNode* pInterval, SSelectStmt* pSelect, SLogicNode** pLogicNode) { - SWindowLogicNode* pWindow = nodesMakeNode(QUERY_NODE_LOGIC_PLAN_WINDOW); + SWindowLogicNode* pWindow = (SWindowLogicNode*)nodesMakeNode(QUERY_NODE_LOGIC_PLAN_WINDOW); if (NULL == pWindow) { return TSDB_CODE_OUT_OF_MEMORY; } @@ -576,7 +576,7 @@ static int32_t createWindowLogicNodeByInterval(SLogicPlanContext* pCxt, SInterva pWindow->pTspk = nodesCloneNode(pInterval->pCol); if (NULL == pWindow->pTspk) { - nodesDestroyNode(pWindow); + nodesDestroyNode((SNode*)pWindow); return TSDB_CODE_OUT_OF_MEMORY; } @@ -610,7 +610,7 @@ static int32_t createFillLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect SFillNode* pFillNode = (SFillNode*)(((SIntervalWindowNode*)pSelect->pWindow)->pFill); - SFillLogicNode* pFill = nodesMakeNode(QUERY_NODE_LOGIC_PLAN_FILL); + SFillLogicNode* pFill = (SFillLogicNode*)nodesMakeNode(QUERY_NODE_LOGIC_PLAN_FILL); if (NULL == pFill) { return TSDB_CODE_OUT_OF_MEMORY; } @@ -628,7 +628,7 @@ static int32_t createFillLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect if (TSDB_CODE_SUCCESS == code) { *pLogicNode = (SLogicNode*)pFill; } else { - nodesDestroyNode(pFill); + nodesDestroyNode((SNode*)pFill); } return code; @@ -639,7 +639,7 @@ static int32_t createSortLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect return TSDB_CODE_SUCCESS; } - SSortLogicNode* pSort = nodesMakeNode(QUERY_NODE_LOGIC_PLAN_SORT); + SSortLogicNode* pSort = (SSortLogicNode*)nodesMakeNode(QUERY_NODE_LOGIC_PLAN_SORT); if (NULL == pSort) { return TSDB_CODE_OUT_OF_MEMORY; } @@ -656,7 +656,7 @@ static int32_t createSortLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect if (TSDB_CODE_SUCCESS == code) { *pLogicNode = (SLogicNode*)pSort; } else { - nodesDestroyNode(pSort); + nodesDestroyNode((SNode*)pSort); } return code; @@ -671,7 +671,7 @@ static int32_t createColumnByProjections(SLogicPlanContext* pCxt, const char* pS SNode* pNode; FOREACH(pNode, pExprs) { - if (TSDB_CODE_SUCCESS != nodesListAppend(pList, createColumnByExpr(pStmtName, (SExprNode*)pNode))) { + if (TSDB_CODE_SUCCESS != nodesListAppend(pList, (SNode*)createColumnByExpr(pStmtName, (SExprNode*)pNode))) { nodesDestroyList(pList); return TSDB_CODE_OUT_OF_MEMORY; } @@ -718,7 +718,7 @@ static int32_t createProjectLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSel if (TSDB_CODE_SUCCESS == code) { *pLogicNode = (SLogicNode*)pProject; } else { - nodesDestroyNode(pProject); + nodesDestroyNode((SNode*)pProject); } return code; @@ -729,7 +729,7 @@ static int32_t createPartitionLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pS return TSDB_CODE_SUCCESS; } - SPartitionLogicNode* pPartition = nodesMakeNode(QUERY_NODE_LOGIC_PLAN_PARTITION); + SPartitionLogicNode* pPartition = (SPartitionLogicNode*)nodesMakeNode(QUERY_NODE_LOGIC_PLAN_PARTITION); if (NULL == pPartition) { return TSDB_CODE_OUT_OF_MEMORY; } @@ -747,7 +747,7 @@ static int32_t createPartitionLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pS if (TSDB_CODE_SUCCESS == code) { *pLogicNode = (SLogicNode*)pPartition; } else { - nodesDestroyNode(pPartition); + nodesDestroyNode((SNode*)pPartition); } return code; @@ -783,7 +783,7 @@ static int32_t createDistinctLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSe if (TSDB_CODE_SUCCESS == code) { *pLogicNode = (SLogicNode*)pAgg; } else { - nodesDestroyNode(pAgg); + nodesDestroyNode((SNode*)pAgg); } return code; @@ -820,7 +820,7 @@ static int32_t createSelectLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSele if (TSDB_CODE_SUCCESS == code) { *pLogicNode = pRoot; } else { - nodesDestroyNode(pRoot); + nodesDestroyNode((SNode*)pRoot); } return code; @@ -836,7 +836,7 @@ static int32_t createSetOpSortLogicNode(SLogicPlanContext* pCxt, SSetOperator* p return TSDB_CODE_SUCCESS; } - SSortLogicNode* pSort = nodesMakeNode(QUERY_NODE_LOGIC_PLAN_SORT); + SSortLogicNode* pSort = (SSortLogicNode*)nodesMakeNode(QUERY_NODE_LOGIC_PLAN_SORT); if (NULL == pSort) { return TSDB_CODE_OUT_OF_MEMORY; } @@ -858,7 +858,7 @@ static int32_t createSetOpSortLogicNode(SLogicPlanContext* pCxt, SSetOperator* p if (TSDB_CODE_SUCCESS == code) { *pLogicNode = (SLogicNode*)pSort; } else { - nodesDestroyNode(pSort); + nodesDestroyNode((SNode*)pSort); } return code; @@ -894,7 +894,7 @@ static int32_t createSetOpProjectLogicNode(SLogicPlanContext* pCxt, SSetOperator if (TSDB_CODE_SUCCESS == code) { *pLogicNode = (SLogicNode*)pProject; } else { - nodesDestroyNode(pProject); + nodesDestroyNode((SNode*)pProject); } return code; @@ -925,7 +925,7 @@ static int32_t createSetOpAggLogicNode(SLogicPlanContext* pCxt, SSetOperator* pS if (TSDB_CODE_SUCCESS == code) { *pLogicNode = (SLogicNode*)pAgg; } else { - nodesDestroyNode(pAgg); + nodesDestroyNode((SNode*)pAgg); } return code; @@ -964,7 +964,7 @@ static int32_t createSetOpLogicNode(SLogicPlanContext* pCxt, SSetOperator* pSetO if (TSDB_CODE_SUCCESS == code) { *pLogicNode = (SLogicNode*)pSetOp; } else { - nodesDestroyNode(pSetOp); + nodesDestroyNode((SNode*)pSetOp); } return code; @@ -981,7 +981,7 @@ static int32_t createSetOperatorLogicNode(SLogicPlanContext* pCxt, SSetOperator* if (TSDB_CODE_SUCCESS == code) { *pLogicNode = pRoot; } else { - nodesDestroyNode(pRoot); + nodesDestroyNode((SNode*)pRoot); } return code; @@ -1003,7 +1003,7 @@ static int32_t getMsgType(ENodeType sqlType) { } static int32_t createVnodeModifLogicNode(SLogicPlanContext* pCxt, SVnodeModifOpStmt* pStmt, SLogicNode** pLogicNode) { - SVnodeModifyLogicNode* pModif = nodesMakeNode(QUERY_NODE_LOGIC_PLAN_VNODE_MODIFY); + SVnodeModifyLogicNode* pModif = (SVnodeModifyLogicNode*)nodesMakeNode(QUERY_NODE_LOGIC_PLAN_VNODE_MODIFY); if (NULL == pModif) { return TSDB_CODE_OUT_OF_MEMORY; } @@ -1047,7 +1047,7 @@ static int32_t createDeleteScanLogicNode(SLogicPlanContext* pCxt, SDeleteStmt* p if (TSDB_CODE_SUCCESS == code) { *pLogicNode = (SLogicNode*)pScan; } else { - nodesDestroyNode(pScan); + nodesDestroyNode((SNode*)pScan); } return code; @@ -1071,7 +1071,7 @@ static int32_t createDeleteAggLogicNode(SLogicPlanContext* pCxt, SDeleteStmt* pD if (TSDB_CODE_SUCCESS == code) { *pLogicNode = (SLogicNode*)pAgg; } else { - nodesDestroyNode(pAgg); + nodesDestroyNode((SNode*)pAgg); } return code; @@ -1094,7 +1094,7 @@ static int32_t createVnodeModifLogicNodeByDelete(SLogicPlanContext* pCxt, SDelet pModify->deleteTimeRange = pDelete->timeRange; pModify->pAffectedRows = nodesCloneNode(pDelete->pCountFunc); if (NULL == pModify->pAffectedRows) { - nodesDestroyNode(pModify); + nodesDestroyNode((SNode*)pModify); return TSDB_CODE_OUT_OF_MEMORY; } @@ -1115,7 +1115,7 @@ static int32_t createDeleteLogicNode(SLogicPlanContext* pCxt, SDeleteStmt* pDele if (TSDB_CODE_SUCCESS == code) { *pLogicNode = pRoot; } else { - nodesDestroyNode(pRoot); + nodesDestroyNode((SNode*)pRoot); } return code; @@ -1171,7 +1171,7 @@ int32_t createLogicPlan(SPlanContext* pCxt, SLogicSubplan** pLogicSubplan) { if (TSDB_CODE_SUCCESS == code) { *pLogicSubplan = pSubplan; } else { - nodesDestroyNode(pSubplan); + nodesDestroyNode((SNode*)pSubplan); } return code; diff --git a/source/libs/planner/src/planOptimizer.c b/source/libs/planner/src/planOptimizer.c index ae689c53d6..65d73b4cdb 100644 --- a/source/libs/planner/src/planOptimizer.c +++ b/source/libs/planner/src/planOptimizer.c @@ -247,7 +247,7 @@ static int32_t osdOptimize(SOptimizeContext* pCxt, SLogicSubplan* pLogicSubplan) } static int32_t cpdMergeCond(SNode** pDst, SNode** pSrc) { - SLogicConditionNode* pLogicCond = nodesMakeNode(QUERY_NODE_LOGIC_CONDITION); + SLogicConditionNode* pLogicCond = (SLogicConditionNode*)nodesMakeNode(QUERY_NODE_LOGIC_CONDITION); if (NULL == pLogicCond) { return TSDB_CODE_OUT_OF_MEMORY; } @@ -262,7 +262,7 @@ static int32_t cpdMergeCond(SNode** pDst, SNode** pSrc) { if (TSDB_CODE_SUCCESS == code) { *pDst = (SNode*)pLogicCond; } else { - nodesDestroyNode(pLogicCond); + nodesDestroyNode((SNode*)pLogicCond); } return code; } @@ -662,13 +662,13 @@ static int32_t opkGetScanNodesImpl(SLogicNode* pNode, bool* pNotOptimize, SNodeL switch (nodeType(pNode)) { case QUERY_NODE_LOGIC_PLAN_SCAN: if (TSDB_SUPER_TABLE != ((SScanLogicNode*)pNode)->tableType) { - return nodesListMakeAppend(pScanNodes, pNode); + return nodesListMakeAppend(pScanNodes, (SNode*)pNode); } break; case QUERY_NODE_LOGIC_PLAN_JOIN: - code = opkGetScanNodesImpl(nodesListGetNode(pNode->pChildren, 0), pNotOptimize, pScanNodes); + code = opkGetScanNodesImpl((SLogicNode*)nodesListGetNode(pNode->pChildren, 0), pNotOptimize, pScanNodes); if (TSDB_CODE_SUCCESS == code) { - code = opkGetScanNodesImpl(nodesListGetNode(pNode->pChildren, 1), pNotOptimize, pScanNodes); + code = opkGetScanNodesImpl((SLogicNode*)nodesListGetNode(pNode->pChildren, 1), pNotOptimize, pScanNodes); } return code; case QUERY_NODE_LOGIC_PLAN_AGG: @@ -683,7 +683,7 @@ static int32_t opkGetScanNodesImpl(SLogicNode* pNode, bool* pNotOptimize, SNodeL return TSDB_CODE_SUCCESS; } - return opkGetScanNodesImpl(nodesListGetNode(pNode->pChildren, 0), pNotOptimize, pScanNodes); + return opkGetScanNodesImpl((SLogicNode*)nodesListGetNode(pNode->pChildren, 0), pNotOptimize, pScanNodes); } static int32_t opkGetScanNodes(SLogicNode* pNode, SNodeList** pScanNodes) { @@ -721,12 +721,12 @@ static int32_t opkDoOptimized(SOptimizeContext* pCxt, SSortLogicNode* pSort, SNo SNode* pDownNode = opkRewriteDownNode(pSort); SNode* pNode; FOREACH(pNode, pSort->node.pParent->pChildren) { - if (nodesEqualNode(pNode, pSort)) { + if (nodesEqualNode(pNode, (SNode*)pSort)) { REPLACE_NODE(pDownNode); break; } } - nodesDestroyNode(pSort); + nodesDestroyNode((SNode*)pSort); return TSDB_CODE_SUCCESS; } @@ -736,7 +736,7 @@ static int32_t opkOptimizeImpl(SOptimizeContext* pCxt, SSortLogicNode* pSort) { return TSDB_CODE_SUCCESS; } SNodeList* pScanNodes = NULL; - int32_t code = opkGetScanNodes(nodesListGetNode(pSort->node.pChildren, 0), &pScanNodes); + int32_t code = opkGetScanNodes((SLogicNode*)nodesListGetNode(pSort->node.pChildren, 0), &pScanNodes); if (TSDB_CODE_SUCCESS == code && NULL != pScanNodes) { code = opkDoOptimized(pCxt, pSort, pScanNodes); } @@ -768,7 +768,7 @@ static bool smaOptMayBeOptimized(SLogicNode* pNode) { } static int32_t smaOptCreateMerge(SLogicNode* pChild, SNodeList* pMergeKeys, SNodeList* pTargets, SLogicNode** pOutput) { - SMergeLogicNode* pMerge = nodesMakeNode(QUERY_NODE_LOGIC_PLAN_MERGE); + SMergeLogicNode* pMerge = (SMergeLogicNode*)nodesMakeNode(QUERY_NODE_LOGIC_PLAN_MERGE); if (NULL == pMerge) { return TSDB_CODE_OUT_OF_MEMORY; } @@ -778,7 +778,7 @@ static int32_t smaOptCreateMerge(SLogicNode* pChild, SNodeList* pMergeKeys, SNod pMerge->node.pTargets = pTargets; pMerge->pInputs = nodesCloneList(pChild->pTargets); if (NULL == pMerge->pInputs) { - nodesDestroyNode(pMerge); + nodesDestroyNode((SNode*)pMerge); return TSDB_CODE_OUT_OF_MEMORY; } @@ -788,9 +788,9 @@ static int32_t smaOptCreateMerge(SLogicNode* pChild, SNodeList* pMergeKeys, SNod static int32_t smaOptRecombinationNode(SLogicSubplan* pLogicSubplan, SLogicNode* pInterval, SLogicNode* pMerge, SLogicNode* pSmaScan) { - int32_t code = nodesListMakeAppend(&pMerge->pChildren, pInterval); + int32_t code = nodesListMakeAppend(&pMerge->pChildren, (SNode*)pInterval); if (TSDB_CODE_SUCCESS == code) { - code = nodesListMakeAppend(&pMerge->pChildren, pSmaScan); + code = nodesListMakeAppend(&pMerge->pChildren, (SNode*)pSmaScan); } if (TSDB_CODE_SUCCESS == code) { code = replaceLogicNode(pLogicSubplan, pInterval, pMerge); @@ -802,7 +802,7 @@ static int32_t smaOptRecombinationNode(SLogicSubplan* pLogicSubplan, SLogicNode* static int32_t smaOptCreateSmaScan(SScanLogicNode* pScan, STableIndexInfo* pIndex, SNodeList* pCols, SLogicNode** pOutput) { - SScanLogicNode* pSmaScan = nodesMakeNode(QUERY_NODE_LOGIC_PLAN_SCAN); + SScanLogicNode* pSmaScan = (SScanLogicNode*)nodesMakeNode(QUERY_NODE_LOGIC_PLAN_SCAN); if (NULL == pSmaScan) { return TSDB_CODE_OUT_OF_MEMORY; } @@ -819,7 +819,7 @@ static int32_t smaOptCreateSmaScan(SScanLogicNode* pScan, STableIndexInfo* pInde pSmaScan->pVgroupList = taosMemoryCalloc(1, sizeof(SVgroupsInfo) + sizeof(SVgroupInfo)); pSmaScan->node.pTargets = nodesCloneList(pCols); if (NULL == pSmaScan->pVgroupList || NULL == pSmaScan->node.pTargets) { - nodesDestroyNode(pSmaScan); + nodesDestroyNode((SNode*)pSmaScan); return TSDB_CODE_OUT_OF_MEMORY; } pSmaScan->pVgroupList->numOfVgroups = 1; @@ -851,7 +851,7 @@ static bool smaOptEqualInterval(SScanLogicNode* pScan, SWindowLogicNode* pWindow } static SNode* smaOptCreateSmaCol(SNode* pFunc, uint64_t tableId, int32_t colId) { - SColumnNode* pCol = nodesMakeNode(QUERY_NODE_COLUMN); + SColumnNode* pCol = (SColumnNode*)nodesMakeNode(QUERY_NODE_COLUMN); if (NULL == pCol) { return NULL; } @@ -926,32 +926,32 @@ static int32_t smaOptCouldApplyIndex(SScanLogicNode* pScan, STableIndexInfo* pIn } static SNode* smaOptCreateWStartTs() { - SFunctionNode* pWStart = nodesMakeNode(QUERY_NODE_FUNCTION); + SFunctionNode* pWStart = (SFunctionNode*)nodesMakeNode(QUERY_NODE_FUNCTION); if (NULL == pWStart) { return NULL; } strcpy(pWStart->functionName, "_wstartts"); snprintf(pWStart->node.aliasName, sizeof(pWStart->node.aliasName), "%s.%p", pWStart->functionName, pWStart); if (TSDB_CODE_SUCCESS != fmGetFuncInfo(pWStart, NULL, 0)) { - nodesDestroyNode(pWStart); + nodesDestroyNode((SNode*)pWStart); return NULL; } return (SNode*)pWStart; } static int32_t smaOptCreateMergeKey(SNode* pCol, SNodeList** pMergeKeys) { - SOrderByExprNode* pMergeKey = nodesMakeNode(QUERY_NODE_ORDER_BY_EXPR); + SOrderByExprNode* pMergeKey = (SOrderByExprNode*)nodesMakeNode(QUERY_NODE_ORDER_BY_EXPR); if (NULL == pMergeKey) { return TSDB_CODE_OUT_OF_MEMORY; } pMergeKey->pExpr = nodesCloneNode(pCol); if (NULL == pMergeKey->pExpr) { - nodesDestroyNode(pMergeKey); + nodesDestroyNode((SNode*)pMergeKey); return TSDB_CODE_OUT_OF_MEMORY; } pMergeKey->order = ORDER_ASC; pMergeKey->nullOrder = NULL_ORDER_FIRST; - return nodesListMakeStrictAppend(pMergeKeys, pMergeKey); + return nodesListMakeStrictAppend(pMergeKeys, (SNode*)pMergeKey); } static int32_t smaOptRewriteInterval(SWindowLogicNode* pInterval, int32_t wstrartIndex, SNodeList** pMergeKeys) { diff --git a/source/libs/planner/src/planPhysiCreater.c b/source/libs/planner/src/planPhysiCreater.c index 6391772abe..8502ffc04a 100644 --- a/source/libs/planner/src/planPhysiCreater.c +++ b/source/libs/planner/src/planPhysiCreater.c @@ -56,14 +56,14 @@ static int32_t getSlotKey(SNode* pNode, const char* pStmtName, char* pKey) { return sprintf(pKey, "%s", ((SExprNode*)pNode)->aliasName); } -static SNode* createSlotDesc(SPhysiPlanContext* pCxt, const SNode* pNode, int16_t slotId, bool output) { +static SNode* createSlotDesc(SPhysiPlanContext* pCxt, const SNode* pNode, int16_t slotId, bool output, bool reserve) { SSlotDescNode* pSlot = (SSlotDescNode*)nodesMakeNode(QUERY_NODE_SLOT_DESC); if (NULL == pSlot) { return NULL; } pSlot->slotId = slotId; pSlot->dataType = ((SExprNode*)pNode)->resType; - pSlot->reserve = false; + pSlot->reserve = reserve; pSlot->output = output; return (SNode*)pSlot; } @@ -131,7 +131,7 @@ static int32_t buildDataBlockSlots(SPhysiPlanContext* pCxt, SNodeList* pList, SD int16_t slotId = 0; SNode* pNode = NULL; FOREACH(pNode, pList) { - code = nodesListStrictAppend(pDataBlockDesc->pSlots, createSlotDesc(pCxt, pNode, slotId, true)); + code = nodesListStrictAppend(pDataBlockDesc->pSlots, createSlotDesc(pCxt, pNode, slotId, true, false)); if (TSDB_CODE_SUCCESS == code) { code = putSlotToHash(pDataBlockDesc->dataBlockId, slotId, pNode, pHash); } @@ -147,7 +147,7 @@ static int32_t buildDataBlockSlots(SPhysiPlanContext* pCxt, SNodeList* pList, SD } static int32_t createDataBlockDesc(SPhysiPlanContext* pCxt, SNodeList* pList, SDataBlockDescNode** pDataBlockDesc) { - SDataBlockDescNode* pDesc = nodesMakeNode(QUERY_NODE_DATABLOCK_DESC); + SDataBlockDescNode* pDesc = (SDataBlockDescNode*)nodesMakeNode(QUERY_NODE_DATABLOCK_DESC); if (NULL == pDesc) { return TSDB_CODE_OUT_OF_MEMORY; } @@ -162,7 +162,7 @@ static int32_t createDataBlockDesc(SPhysiPlanContext* pCxt, SNodeList* pList, SD if (TSDB_CODE_SUCCESS == code) { *pDataBlockDesc = pDesc; } else { - nodesDestroyNode(pDesc); + nodesDestroyNode((SNode*)pDesc); } return code; @@ -181,7 +181,7 @@ static int16_t getUnsetSlotId(const SArray* pSlotIdsInfo) { } static int32_t addDataBlockSlotsImpl(SPhysiPlanContext* pCxt, SNodeList* pList, SDataBlockDescNode* pDataBlockDesc, - const char* pStmtName, bool output) { + const char* pStmtName, bool output, bool reserve) { if (NULL == pList) { return TSDB_CODE_SUCCESS; } @@ -196,7 +196,7 @@ static int32_t addDataBlockSlotsImpl(SPhysiPlanContext* pCxt, SNodeList* pList, int32_t len = getSlotKey(pExpr, pStmtName, name); SSlotIndex* pIndex = taosHashGet(pHash, name, len); if (NULL == pIndex) { - code = nodesListStrictAppend(pDataBlockDesc->pSlots, createSlotDesc(pCxt, pExpr, nextSlotId, output)); + code = nodesListStrictAppend(pDataBlockDesc->pSlots, createSlotDesc(pCxt, pExpr, nextSlotId, output, reserve)); if (TSDB_CODE_SUCCESS == code) { code = putSlotToHashImpl(pDataBlockDesc->dataBlockId, nextSlotId, name, len, pHash); } @@ -226,7 +226,7 @@ static int32_t addDataBlockSlotsImpl(SPhysiPlanContext* pCxt, SNodeList* pList, } static int32_t addDataBlockSlots(SPhysiPlanContext* pCxt, SNodeList* pList, SDataBlockDescNode* pDataBlockDesc) { - return addDataBlockSlotsImpl(pCxt, pList, pDataBlockDesc, NULL, false); + return addDataBlockSlotsImpl(pCxt, pList, pDataBlockDesc, NULL, false, false); } static int32_t addDataBlockSlot(SPhysiPlanContext* pCxt, SNode** pNode, SDataBlockDescNode* pDataBlockDesc) { @@ -248,11 +248,11 @@ static int32_t addDataBlockSlot(SPhysiPlanContext* pCxt, SNode** pNode, SDataBlo static int32_t addDataBlockSlotsForProject(SPhysiPlanContext* pCxt, const char* pStmtName, SNodeList* pList, SDataBlockDescNode* pDataBlockDesc) { - return addDataBlockSlotsImpl(pCxt, pList, pDataBlockDesc, pStmtName, true); + return addDataBlockSlotsImpl(pCxt, pList, pDataBlockDesc, pStmtName, true, false); } static int32_t pushdownDataBlockSlots(SPhysiPlanContext* pCxt, SNodeList* pList, SDataBlockDescNode* pDataBlockDesc) { - return addDataBlockSlotsImpl(pCxt, pList, pDataBlockDesc, NULL, true); + return addDataBlockSlotsImpl(pCxt, pList, pDataBlockDesc, NULL, true, true); } typedef struct SSetSlotIdCxt { @@ -350,7 +350,7 @@ static SPhysiNode* makePhysiNode(SPhysiPlanContext* pCxt, SLogicNode* pLogicNode int32_t code = createDataBlockDesc(pCxt, pLogicNode->pTargets, &pPhysiNode->pOutputDataBlockDesc); if (TSDB_CODE_SUCCESS != code) { - nodesDestroyNode(pPhysiNode); + nodesDestroyNode((SNode*)pPhysiNode); return NULL; } pPhysiNode->pOutputDataBlockDesc->precision = pLogicNode->precision; @@ -439,7 +439,7 @@ static int32_t createScanPhysiNodeFinalize(SPhysiPlanContext* pCxt, SSubplan* pS if (TSDB_CODE_SUCCESS == code) { *pPhyNode = (SPhysiNode*)pScanPhysiNode; } else { - nodesDestroyNode(pScanPhysiNode); + nodesDestroyNode((SNode*)pScanPhysiNode); } return code; @@ -486,7 +486,7 @@ static int32_t createTableScanPhysiNode(SPhysiPlanContext* pCxt, SSubplan* pSubp pTableScan->dataRequired = pScanLogicNode->dataRequired; pTableScan->pDynamicScanFuncs = nodesCloneList(pScanLogicNode->pDynamicScanFuncs); if (NULL != pScanLogicNode->pDynamicScanFuncs && NULL == pTableScan->pDynamicScanFuncs) { - nodesDestroyNode(pTableScan); + nodesDestroyNode((SNode*)pTableScan); return TSDB_CODE_OUT_OF_MEMORY; } pTableScan->interval = pScanLogicNode->interval; @@ -584,7 +584,7 @@ static int32_t createJoinPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pChildren if (TSDB_CODE_SUCCESS == code) { *pPhyNode = (SPhysiNode*)pJoin; } else { - nodesDestroyNode(pJoin); + nodesDestroyNode((SNode*)pJoin); } return code; @@ -635,7 +635,7 @@ static int32_t rewriteValueToOperator(SRewritePrecalcExprsCxt* pCxt, SNode** pNo } pOper->pLeft = nodesMakeNode(QUERY_NODE_LEFT_VALUE); if (NULL == pOper->pLeft) { - nodesDestroyNode(pOper); + nodesDestroyNode((SNode*)pOper); return TSDB_CODE_OUT_OF_MEMORY; } SValueNode* pVal = (SValueNode*)*pNode; @@ -782,7 +782,7 @@ static int32_t createAggPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pChildren, if (TSDB_CODE_SUCCESS == code) { *pPhyNode = (SPhysiNode*)pAgg; } else { - nodesDestroyNode(pAgg); + nodesDestroyNode((SNode*)pAgg); } nodesDestroyList(pPrecalcExprs); @@ -823,7 +823,7 @@ static int32_t createIndefRowsFuncPhysiNode(SPhysiPlanContext* pCxt, SNodeList* if (TSDB_CODE_SUCCESS == code) { *pPhyNode = (SPhysiNode*)pIdfRowsFunc; } else { - nodesDestroyNode(pIdfRowsFunc); + nodesDestroyNode((SNode*)pIdfRowsFunc); } return code; @@ -855,7 +855,7 @@ static int32_t createProjectPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pChild if (TSDB_CODE_SUCCESS == code) { *pPhyNode = (SPhysiNode*)pProject; } else { - nodesDestroyNode(pProject); + nodesDestroyNode((SNode*)pProject); } return code; @@ -904,7 +904,7 @@ static int32_t createStreamScanPhysiNodeByExchange(SPhysiPlanContext* pCxt, SExc if (TSDB_CODE_SUCCESS == code) { *pPhyNode = (SPhysiNode*)pScan; } else { - nodesDestroyNode(pScan); + nodesDestroyNode((SNode*)pScan); } return code; @@ -952,7 +952,7 @@ static int32_t createWindowPhysiNodeFinalize(SPhysiPlanContext* pCxt, SNodeList* if (TSDB_CODE_SUCCESS == code) { *pPhyNode = (SPhysiNode*)pWindow; } else { - nodesDestroyNode(pWindow); + nodesDestroyNode((SNode*)pWindow); } return code; @@ -1037,7 +1037,7 @@ static int32_t createStateWindowPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pC } if (TSDB_CODE_SUCCESS != code) { - nodesDestroyNode(pState); + nodesDestroyNode((SNode*)pState); return code; } @@ -1094,7 +1094,7 @@ static int32_t createSortPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pChildren if (TSDB_CODE_SUCCESS == code) { *pPhyNode = (SPhysiNode*)pSort; } else { - nodesDestroyNode(pSort); + nodesDestroyNode((SNode*)pSort); } return code; @@ -1117,7 +1117,7 @@ static int32_t createPartitionPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pChi if (TSDB_CODE_SUCCESS == code && NULL != pPrecalcExprs) { code = setListSlotId(pCxt, pChildTupe->dataBlockId, -1, pPrecalcExprs, &pPart->pExprs); if (TSDB_CODE_SUCCESS == code) { - code = addDataBlockSlots(pCxt, pPart->pExprs, pChildTupe); + code = pushdownDataBlockSlots(pCxt, pPart->pExprs, pChildTupe); } } @@ -1135,7 +1135,7 @@ static int32_t createPartitionPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pChi if (TSDB_CODE_SUCCESS == code) { *pPhyNode = (SPhysiNode*)pPart; } else { - nodesDestroyNode(pPart); + nodesDestroyNode((SNode*)pPart); } return code; @@ -1174,28 +1174,28 @@ static int32_t createFillPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pChildren if (TSDB_CODE_SUCCESS == code) { *pPhyNode = (SPhysiNode*)pFill; } else { - nodesDestroyNode(pFill); + nodesDestroyNode((SNode*)pFill); } return code; } static int32_t createExchangePhysiNodeByMerge(SMergePhysiNode* pMerge) { - SExchangePhysiNode* pExchange = nodesMakeNode(QUERY_NODE_PHYSICAL_PLAN_EXCHANGE); + SExchangePhysiNode* pExchange = (SExchangePhysiNode*)nodesMakeNode(QUERY_NODE_PHYSICAL_PLAN_EXCHANGE); if (NULL == pExchange) { return TSDB_CODE_OUT_OF_MEMORY; } pExchange->srcGroupId = pMerge->srcGroupId; pExchange->singleChannel = true; pExchange->node.pParent = (SPhysiNode*)pMerge; - pExchange->node.pOutputDataBlockDesc = nodesCloneNode(pMerge->node.pOutputDataBlockDesc); + pExchange->node.pOutputDataBlockDesc = (SDataBlockDescNode*)nodesCloneNode((SNode*)pMerge->node.pOutputDataBlockDesc); if (NULL == pExchange->node.pOutputDataBlockDesc) { - nodesDestroyNode(pExchange); + nodesDestroyNode((SNode*)pExchange); return TSDB_CODE_OUT_OF_MEMORY; } SNode* pSlot = NULL; FOREACH(pSlot, pExchange->node.pOutputDataBlockDesc->pSlots) { ((SSlotDescNode*)pSlot)->output = true; } - return nodesListMakeStrictAppend(&pMerge->node.pChildren, pExchange); + return nodesListMakeStrictAppend(&pMerge->node.pChildren, (SNode*)pExchange); } static int32_t createMergePhysiNode(SPhysiPlanContext* pCxt, SMergeLogicNode* pMergeLogicNode, SPhysiNode** pPhyNode) { @@ -1235,7 +1235,7 @@ static int32_t createMergePhysiNode(SPhysiPlanContext* pCxt, SMergeLogicNode* pM if (TSDB_CODE_SUCCESS == code) { *pPhyNode = (SPhysiNode*)pMerge; } else { - nodesDestroyNode(pMerge); + nodesDestroyNode((SNode*)pMerge); } return code; @@ -1287,7 +1287,7 @@ static int32_t createPhysiNode(SPhysiPlanContext* pCxt, SLogicNode* pLogicNode, SPhysiNode* pChild = NULL; code = createPhysiNode(pCxt, (SLogicNode*)pLogicChild, pSubplan, &pChild); if (TSDB_CODE_SUCCESS == code) { - code = nodesListStrictAppend(pChildren, pChild); + code = nodesListStrictAppend(pChildren, (SNode*)pChild); } } @@ -1311,7 +1311,7 @@ static int32_t createPhysiNode(SPhysiPlanContext* pCxt, SLogicNode* pLogicNode, } static int32_t createDataInserter(SPhysiPlanContext* pCxt, SVgDataBlocks* pBlocks, SDataSinkNode** pSink) { - SDataInserterNode* pInserter = nodesMakeNode(QUERY_NODE_PHYSICAL_PLAN_INSERT); + SDataInserterNode* pInserter = (SDataInserterNode*)nodesMakeNode(QUERY_NODE_PHYSICAL_PLAN_INSERT); if (NULL == pInserter) { return TSDB_CODE_OUT_OF_MEMORY; } @@ -1325,14 +1325,14 @@ static int32_t createDataInserter(SPhysiPlanContext* pCxt, SVgDataBlocks* pBlock } static int32_t createDataDispatcher(SPhysiPlanContext* pCxt, const SPhysiNode* pRoot, SDataSinkNode** pSink) { - SDataDispatcherNode* pDispatcher = nodesMakeNode(QUERY_NODE_PHYSICAL_PLAN_DISPATCH); + SDataDispatcherNode* pDispatcher = (SDataDispatcherNode*)nodesMakeNode(QUERY_NODE_PHYSICAL_PLAN_DISPATCH); if (NULL == pDispatcher) { return TSDB_CODE_OUT_OF_MEMORY; } - pDispatcher->sink.pInputDataBlockDesc = nodesCloneNode(pRoot->pOutputDataBlockDesc); + pDispatcher->sink.pInputDataBlockDesc = (SDataBlockDescNode*)nodesCloneNode((SNode*)pRoot->pOutputDataBlockDesc); if (NULL == pDispatcher->sink.pInputDataBlockDesc) { - nodesDestroyNode(pDispatcher); + nodesDestroyNode((SNode*)pDispatcher); return TSDB_CODE_OUT_OF_MEMORY; } @@ -1341,7 +1341,7 @@ static int32_t createDataDispatcher(SPhysiPlanContext* pCxt, const SPhysiNode* p } static SSubplan* makeSubplan(SPhysiPlanContext* pCxt, SLogicSubplan* pLogicSubplan) { - SSubplan* pSubplan = nodesMakeNode(QUERY_NODE_PHYSICAL_SUBPLAN); + SSubplan* pSubplan = (SSubplan*)nodesMakeNode(QUERY_NODE_PHYSICAL_SUBPLAN); if (NULL == pSubplan) { return NULL; } @@ -1361,7 +1361,7 @@ static int32_t buildInsertSubplan(SPhysiPlanContext* pCxt, SVnodeModifyLogicNode static int32_t createDataDeleter(SPhysiPlanContext* pCxt, SVnodeModifyLogicNode* pModify, const SPhysiNode* pRoot, SDataSinkNode** pSink) { - SDataDeleterNode* pDeleter = nodesMakeNode(QUERY_NODE_PHYSICAL_PLAN_DELETE); + SDataDeleterNode* pDeleter = (SDataDeleterNode*)nodesMakeNode(QUERY_NODE_PHYSICAL_PLAN_DELETE); if (NULL == pDeleter) { return TSDB_CODE_OUT_OF_MEMORY; } @@ -1374,7 +1374,7 @@ static int32_t createDataDeleter(SPhysiPlanContext* pCxt, SVnodeModifyLogicNode* int32_t code = setNodeSlotId(pCxt, pRoot->pOutputDataBlockDesc->dataBlockId, -1, pModify->pAffectedRows, &pDeleter->pAffectedRows); if (TSDB_CODE_SUCCESS == code) { - pDeleter->sink.pInputDataBlockDesc = nodesCloneNode(pRoot->pOutputDataBlockDesc); + pDeleter->sink.pInputDataBlockDesc = (SDataBlockDescNode*)nodesCloneNode((SNode*)pRoot->pOutputDataBlockDesc); if (NULL == pDeleter->sink.pInputDataBlockDesc) { code = TSDB_CODE_OUT_OF_MEMORY; } @@ -1383,7 +1383,7 @@ static int32_t createDataDeleter(SPhysiPlanContext* pCxt, SVnodeModifyLogicNode* if (TSDB_CODE_SUCCESS == code) { *pSink = (SDataSinkNode*)pDeleter; } else { - nodesDestroyNode(pDeleter); + nodesDestroyNode((SNode*)pDeleter); } return TSDB_CODE_SUCCESS; @@ -1437,38 +1437,38 @@ static int32_t createPhysiSubplan(SPhysiPlanContext* pCxt, SLogicSubplan* pLogic if (TSDB_CODE_SUCCESS == code) { *pPhysiSubplan = pSubplan; } else { - nodesDestroyNode(pSubplan); + nodesDestroyNode((SNode*)pSubplan); } return code; } static SQueryPlan* makeQueryPhysiPlan(SPhysiPlanContext* pCxt) { - SQueryPlan* pPlan = nodesMakeNode(QUERY_NODE_PHYSICAL_PLAN); + SQueryPlan* pPlan = (SQueryPlan*)nodesMakeNode(QUERY_NODE_PHYSICAL_PLAN); if (NULL == pPlan) { return NULL; } pPlan->pSubplans = nodesMakeList(); if (NULL == pPlan->pSubplans) { - nodesDestroyNode(pPlan); + nodesDestroyNode((SNode*)pPlan); return NULL; } pPlan->queryId = pCxt->pPlanCxt->queryId; return pPlan; } -static int32_t pushSubplan(SPhysiPlanContext* pCxt, SNodeptr pSubplan, int32_t level, SNodeList* pSubplans) { - SNodeListNode* pGroup; +static int32_t pushSubplan(SPhysiPlanContext* pCxt, SNode* pSubplan, int32_t level, SNodeList* pSubplans) { + SNodeListNode* pGroup = NULL; if (level >= LIST_LENGTH(pSubplans)) { - pGroup = nodesMakeNode(QUERY_NODE_NODE_LIST); + pGroup = (SNodeListNode*)nodesMakeNode(QUERY_NODE_NODE_LIST); if (NULL == pGroup) { return TSDB_CODE_OUT_OF_MEMORY; } - if (TSDB_CODE_SUCCESS != nodesListStrictAppend(pSubplans, pGroup)) { + if (TSDB_CODE_SUCCESS != nodesListStrictAppend(pSubplans, (SNode*)pGroup)) { return TSDB_CODE_OUT_OF_MEMORY; } } else { - pGroup = nodesListGetNode(pSubplans, level); + pGroup = (SNodeListNode*)nodesListGetNode(pSubplans, level); } if (NULL == pGroup->pNodeList) { pGroup->pNodeList = nodesMakeList(); @@ -1476,7 +1476,7 @@ static int32_t pushSubplan(SPhysiPlanContext* pCxt, SNodeptr pSubplan, int32_t l return TSDB_CODE_OUT_OF_MEMORY; } } - return nodesListStrictAppend(pGroup->pNodeList, pSubplan); + return nodesListStrictAppend(pGroup->pNodeList, (SNode*)pSubplan); } static int32_t buildPhysiPlan(SPhysiPlanContext* pCxt, SLogicSubplan* pLogicSubplan, SSubplan* pParent, @@ -1485,19 +1485,19 @@ static int32_t buildPhysiPlan(SPhysiPlanContext* pCxt, SLogicSubplan* pLogicSubp int32_t code = createPhysiSubplan(pCxt, pLogicSubplan, &pSubplan); if (TSDB_CODE_SUCCESS == code) { - code = pushSubplan(pCxt, pSubplan, pLogicSubplan->level, pQueryPlan->pSubplans); + code = pushSubplan(pCxt, (SNode*)pSubplan, pLogicSubplan->level, pQueryPlan->pSubplans); ++(pQueryPlan->numOfSubplans); } if (TSDB_CODE_SUCCESS != code) { - nodesDestroyNode(pSubplan); + nodesDestroyNode((SNode*)pSubplan); return code; } if (TSDB_CODE_SUCCESS == code && NULL != pParent) { - code = nodesListMakeAppend(&pParent->pChildren, pSubplan); + code = nodesListMakeAppend(&pParent->pChildren, (SNode*)pSubplan); if (TSDB_CODE_SUCCESS == code) { - code = nodesListMakeAppend(&pSubplan->pParents, pParent); + code = nodesListMakeAppend(&pSubplan->pParents, (SNode*)pParent); } } @@ -1515,7 +1515,7 @@ static int32_t buildPhysiPlan(SPhysiPlanContext* pCxt, SLogicSubplan* pLogicSubp } static int32_t doCreatePhysiPlan(SPhysiPlanContext* pCxt, SQueryLogicPlan* pLogicPlan, SQueryPlan** pPhysiPlan) { - SQueryPlan* pPlan = makeQueryPhysiPlan(pCxt); + SQueryPlan* pPlan = (SQueryPlan*)makeQueryPhysiPlan(pCxt); if (NULL == pPlan) { return TSDB_CODE_OUT_OF_MEMORY; } @@ -1533,7 +1533,7 @@ static int32_t doCreatePhysiPlan(SPhysiPlanContext* pCxt, SQueryLogicPlan* pLogi if (TSDB_CODE_SUCCESS == code) { *pPhysiPlan = pPlan; } else { - nodesDestroyNode(pPlan); + nodesDestroyNode((SNode*)pPlan); } return code; diff --git a/source/libs/planner/src/planScaleOut.c b/source/libs/planner/src/planScaleOut.c index 5dd016afb8..9707b36f4a 100644 --- a/source/libs/planner/src/planScaleOut.c +++ b/source/libs/planner/src/planScaleOut.c @@ -21,13 +21,13 @@ typedef struct SScaleOutContext { } SScaleOutContext; static SLogicSubplan* singleCloneSubLogicPlan(SScaleOutContext* pCxt, SLogicSubplan* pSrc, int32_t level) { - SLogicSubplan* pDst = nodesMakeNode(QUERY_NODE_LOGIC_SUBPLAN); + SLogicSubplan* pDst = (SLogicSubplan*)nodesMakeNode(QUERY_NODE_LOGIC_SUBPLAN); if (NULL == pDst) { return NULL; } - pDst->pNode = nodesCloneNode(pSrc->pNode); + pDst->pNode = (SLogicNode*)nodesCloneNode((SNode*)pSrc->pNode); if (NULL == pDst->pNode) { - nodesDestroyNode(pDst); + nodesDestroyNode((SNode*)pDst); return NULL; } pDst->subplanType = pSrc->subplanType; @@ -73,7 +73,7 @@ static int32_t scaleOutByVgroups(SScaleOutContext* pCxt, SLogicSubplan* pSubplan } code = setScanVgroup(pNewSubplan->pNode, pSubplan->pVgroupList->vgroups + i); if (TSDB_CODE_SUCCESS == code) { - code = nodesListStrictAppend(pGroup, pNewSubplan); + code = nodesListStrictAppend(pGroup, (SNode*)pNewSubplan); } if (TSDB_CODE_SUCCESS != code) { break; @@ -95,7 +95,7 @@ static int32_t scaleOutForModify(SScaleOutContext* pCxt, SLogicSubplan* pSubplan } ((SVnodeModifyLogicNode*)pNewSubplan->pNode)->pVgDataBlocks = (SVgDataBlocks*)taosArrayGetP(pNode->pDataBlocks, i); - if (TSDB_CODE_SUCCESS != nodesListStrictAppend(pGroup, pNewSubplan)) { + if (TSDB_CODE_SUCCESS != nodesListStrictAppend(pGroup, (SNode*)pNewSubplan)) { return TSDB_CODE_OUT_OF_MEMORY; } } @@ -104,7 +104,7 @@ static int32_t scaleOutForModify(SScaleOutContext* pCxt, SLogicSubplan* pSubplan } static int32_t scaleOutForMerge(SScaleOutContext* pCxt, SLogicSubplan* pSubplan, int32_t level, SNodeList* pGroup) { - return nodesListStrictAppend(pGroup, singleCloneSubLogicPlan(pCxt, pSubplan, level)); + return nodesListStrictAppend(pGroup, (SNode*)singleCloneSubLogicPlan(pCxt, pSubplan, level)); } static int32_t scaleOutForScan(SScaleOutContext* pCxt, SLogicSubplan* pSubplan, int32_t level, SNodeList* pGroup) { @@ -189,7 +189,7 @@ static SQueryLogicPlan* makeQueryLogicPlan() { } pLogicPlan->pTopSubplans = nodesMakeList(); if (NULL == pLogicPlan->pTopSubplans) { - nodesDestroyNode(pLogicPlan); + nodesDestroyNode((SNode*)pLogicPlan); return NULL; } return pLogicPlan; @@ -206,7 +206,7 @@ int32_t scaleOutLogicPlan(SPlanContext* pCxt, SLogicSubplan* pLogicSubplan, SQue if (TSDB_CODE_SUCCESS == code) { *pLogicPlan = pPlan; } else { - nodesDestroyNode(pPlan); + nodesDestroyNode((SNode*)pPlan); } return code; diff --git a/source/libs/planner/src/planSpliter.c b/source/libs/planner/src/planSpliter.c index f33856c4ce..2fc79255af 100644 --- a/source/libs/planner/src/planSpliter.c +++ b/source/libs/planner/src/planSpliter.c @@ -50,7 +50,7 @@ static void splSetSubplanVgroups(SLogicSubplan* pSubplan, SLogicNode* pNode) { } static SLogicSubplan* splCreateScanSubplan(SSplitContext* pCxt, SLogicNode* pNode, int32_t flag) { - SLogicSubplan* pSubplan = nodesMakeNode(QUERY_NODE_LOGIC_SUBPLAN); + SLogicSubplan* pSubplan = (SLogicSubplan*)nodesMakeNode(QUERY_NODE_LOGIC_SUBPLAN); if (NULL == pSubplan) { return NULL; } @@ -65,7 +65,7 @@ static SLogicSubplan* splCreateScanSubplan(SSplitContext* pCxt, SLogicNode* pNod } static int32_t splCreateExchangeNode(SSplitContext* pCxt, SLogicNode* pChild, SExchangeLogicNode** pOutput) { - SExchangeLogicNode* pExchange = nodesMakeNode(QUERY_NODE_LOGIC_PLAN_EXCHANGE); + SExchangeLogicNode* pExchange = (SExchangeLogicNode*)nodesMakeNode(QUERY_NODE_LOGIC_PLAN_EXCHANGE); if (NULL == pExchange) { return TSDB_CODE_OUT_OF_MEMORY; } @@ -90,7 +90,7 @@ static int32_t splCreateExchangeNodeForSubplan(SSplitContext* pCxt, SLogicSubpla if (TSDB_CODE_SUCCESS == code) { pSubplan->subplanType = subplanType; } else { - nodesDestroyNode(pExchange); + nodesDestroyNode((SNode*)pExchange); } return code; } @@ -191,21 +191,21 @@ static int32_t stbSplRewriteFuns(const SNodeList* pFuncs, SNodeList** pPartialFu SFunctionNode* pMergeFunc = NULL; int32_t code = TSDB_CODE_SUCCESS; if (fmIsWindowPseudoColumnFunc(pFunc->funcId)) { - pPartFunc = nodesCloneNode(pFunc); - pMergeFunc = nodesCloneNode(pFunc); + pPartFunc = (SFunctionNode*)nodesCloneNode(pNode); + pMergeFunc = (SFunctionNode*)nodesCloneNode(pNode); if (NULL == pPartFunc || NULL == pMergeFunc) { - nodesDestroyNode(pPartFunc); - nodesDestroyNode(pMergeFunc); + nodesDestroyNode((SNode*)pPartFunc); + nodesDestroyNode((SNode*)pMergeFunc); code = TSDB_CODE_OUT_OF_MEMORY; } } else { code = fmGetDistMethod(pFunc, &pPartFunc, &pMergeFunc); } if (TSDB_CODE_SUCCESS == code) { - code = nodesListMakeStrictAppend(pPartialFuncs, pPartFunc); + code = nodesListMakeStrictAppend(pPartialFuncs, (SNode*)pPartFunc); } if (TSDB_CODE_SUCCESS == code) { - code = nodesListMakeStrictAppend(pMergeFuncs, pMergeFunc); + code = nodesListMakeStrictAppend(pMergeFuncs, (SNode*)pMergeFunc); } if (TSDB_CODE_SUCCESS != code) { nodesDestroyList(*pPartialFuncs); @@ -227,7 +227,7 @@ static int32_t stbSplAppendWStart(SNodeList* pFuncs, int32_t* pIndex) { ++index; } - SFunctionNode* pWStart = nodesMakeNode(QUERY_NODE_FUNCTION); + SFunctionNode* pWStart = (SFunctionNode*)nodesMakeNode(QUERY_NODE_FUNCTION); if (NULL == pWStart) { return TSDB_CODE_OUT_OF_MEMORY; } @@ -235,7 +235,7 @@ static int32_t stbSplAppendWStart(SNodeList* pFuncs, int32_t* pIndex) { snprintf(pWStart->node.aliasName, sizeof(pWStart->node.aliasName), "%s.%p", pWStart->functionName, pWStart); int32_t code = fmGetFuncInfo(pWStart, NULL, 0); if (TSDB_CODE_SUCCESS == code) { - code = nodesListStrictAppend(pFuncs, pWStart); + code = nodesListStrictAppend(pFuncs, (SNode*)pWStart); } *pIndex = index; return code; @@ -250,7 +250,7 @@ static int32_t stbSplCreatePartWindowNode(SWindowLogicNode* pMergeWindow, SLogic pMergeWindow->node.pChildren = NULL; int32_t code = TSDB_CODE_SUCCESS; - SWindowLogicNode* pPartWin = nodesCloneNode(pMergeWindow); + SWindowLogicNode* pPartWin = (SWindowLogicNode*)nodesCloneNode((SNode*)pMergeWindow); if (NULL == pPartWin) { code = TSDB_CODE_OUT_OF_MEMORY; } @@ -279,7 +279,7 @@ static int32_t stbSplCreatePartWindowNode(SWindowLogicNode* pMergeWindow, SLogic if (TSDB_CODE_SUCCESS == code) { *pPartWindow = (SLogicNode*)pPartWin; } else { - nodesDestroyNode(pPartWin); + nodesDestroyNode((SNode*)pPartWin); } return code; @@ -287,7 +287,7 @@ static int32_t stbSplCreatePartWindowNode(SWindowLogicNode* pMergeWindow, SLogic static int32_t stbSplCreateMergeNode(SSplitContext* pCxt, SLogicSubplan* pSubplan, SLogicNode* pSplitNode, SNodeList* pMergeKeys, SLogicNode* pPartChild) { - SMergeLogicNode* pMerge = nodesMakeNode(QUERY_NODE_LOGIC_PLAN_MERGE); + SMergeLogicNode* pMerge = (SMergeLogicNode*)nodesMakeNode(QUERY_NODE_LOGIC_PLAN_MERGE); if (NULL == pMerge) { return TSDB_CODE_OUT_OF_MEMORY; } @@ -309,13 +309,13 @@ static int32_t stbSplCreateMergeNode(SSplitContext* pCxt, SLogicSubplan* pSubpla } if (TSDB_CODE_SUCCESS == code) { if (NULL == pSubplan) { - code = nodesListMakeAppend(&pSplitNode->pChildren, pMerge); + code = nodesListMakeAppend(&pSplitNode->pChildren, (SNode*)pMerge); } else { code = replaceLogicNode(pSubplan, pSplitNode, (SLogicNode*)pMerge); } } if (TSDB_CODE_SUCCESS != code) { - nodesDestroyNode(pMerge); + nodesDestroyNode((SNode*)pMerge); } return code; } @@ -324,24 +324,24 @@ static int32_t stbSplCreateExchangeNode(SSplitContext* pCxt, SLogicNode* pParent SExchangeLogicNode* pExchange = NULL; int32_t code = splCreateExchangeNode(pCxt, pPartChild, &pExchange); if (TSDB_CODE_SUCCESS == code) { - code = nodesListMakeAppend(&pParent->pChildren, pExchange); + code = nodesListMakeAppend(&pParent->pChildren, (SNode*)pExchange); } return code; } static int32_t stbSplCreateMergeKeysForInterval(SNode* pWStartTs, SNodeList** pMergeKeys) { - SOrderByExprNode* pMergeKey = nodesMakeNode(QUERY_NODE_ORDER_BY_EXPR); + SOrderByExprNode* pMergeKey = (SOrderByExprNode*)nodesMakeNode(QUERY_NODE_ORDER_BY_EXPR); if (NULL == pMergeKey) { return TSDB_CODE_OUT_OF_MEMORY; } pMergeKey->pExpr = nodesCloneNode(pWStartTs); if (NULL == pMergeKey->pExpr) { - nodesDestroyNode(pMergeKey); + nodesDestroyNode((SNode*)pMergeKey); return TSDB_CODE_OUT_OF_MEMORY; } pMergeKey->order = ORDER_ASC; pMergeKey->nullOrder = NULL_ORDER_FIRST; - return nodesListMakeStrictAppend(pMergeKeys, pMergeKey); + return nodesListMakeStrictAppend(pMergeKeys, (SNode*)pMergeKey); } static int32_t stbSplSplitIntervalForBatch(SSplitContext* pCxt, SStableSplitInfo* pInfo) { @@ -361,7 +361,7 @@ static int32_t stbSplSplitIntervalForBatch(SSplitContext* pCxt, SStableSplitInfo } if (TSDB_CODE_SUCCESS == code) { code = nodesListMakeStrictAppend(&pInfo->pSubplan->pChildren, - splCreateScanSubplan(pCxt, pPartWindow, SPLIT_FLAG_STABLE_SPLIT)); + (SNode*)splCreateScanSubplan(pCxt, pPartWindow, SPLIT_FLAG_STABLE_SPLIT)); } pInfo->pSubplan->subplanType = SUBPLAN_TYPE_MERGE; return code; @@ -377,7 +377,7 @@ static int32_t stbSplSplitIntervalForStream(SSplitContext* pCxt, SStableSplitInf } if (TSDB_CODE_SUCCESS == code) { code = nodesListMakeStrictAppend(&pInfo->pSubplan->pChildren, - splCreateScanSubplan(pCxt, pPartWindow, SPLIT_FLAG_STABLE_SPLIT)); + (SNode*)splCreateScanSubplan(pCxt, pPartWindow, SPLIT_FLAG_STABLE_SPLIT)); } pInfo->pSubplan->subplanType = SUBPLAN_TYPE_MERGE; return code; @@ -418,7 +418,7 @@ static int32_t stbSplCreatePartAggNode(SAggLogicNode* pMergeAgg, SLogicNode** pO pMergeAgg->node.pChildren = NULL; int32_t code = TSDB_CODE_SUCCESS; - SAggLogicNode* pPartAgg = nodesCloneNode(pMergeAgg); + SAggLogicNode* pPartAgg = (SAggLogicNode*)nodesCloneNode((SNode*)pMergeAgg); if (NULL == pPartAgg) { code = TSDB_CODE_OUT_OF_MEMORY; } @@ -447,7 +447,7 @@ static int32_t stbSplCreatePartAggNode(SAggLogicNode* pMergeAgg, SLogicNode** pO if (TSDB_CODE_SUCCESS == code) { *pOutput = (SLogicNode*)pPartAgg; } else { - nodesDestroyNode(pPartAgg); + nodesDestroyNode((SNode*)pPartAgg); } return code; @@ -461,14 +461,14 @@ static int32_t stbSplSplitAggNode(SSplitContext* pCxt, SStableSplitInfo* pInfo) } if (TSDB_CODE_SUCCESS == code) { code = nodesListMakeStrictAppend(&pInfo->pSubplan->pChildren, - splCreateScanSubplan(pCxt, pPartAgg, SPLIT_FLAG_STABLE_SPLIT)); + (SNode*)splCreateScanSubplan(pCxt, pPartAgg, SPLIT_FLAG_STABLE_SPLIT)); } pInfo->pSubplan->subplanType = SUBPLAN_TYPE_MERGE; return code; } static SNode* stbSplCreateColumnNode(SExprNode* pExpr) { - SColumnNode* pCol = nodesMakeNode(QUERY_NODE_COLUMN); + SColumnNode* pCol = (SColumnNode*)nodesMakeNode(QUERY_NODE_COLUMN); if (NULL == pCol) { return NULL; } @@ -482,13 +482,13 @@ static SNode* stbSplCreateColumnNode(SExprNode* pExpr) { } static SNode* stbSplCreateOrderByExpr(SOrderByExprNode* pSortKey, SNode* pCol) { - SOrderByExprNode* pOutput = nodesMakeNode(QUERY_NODE_ORDER_BY_EXPR); + SOrderByExprNode* pOutput = (SOrderByExprNode*)nodesMakeNode(QUERY_NODE_ORDER_BY_EXPR); if (NULL == pOutput) { return NULL; } pOutput->pExpr = nodesCloneNode(pCol); if (NULL == pOutput->pExpr) { - nodesDestroyNode(pOutput); + nodesDestroyNode((SNode*)pOutput); return NULL; } pOutput->order = pSortKey->order; @@ -542,7 +542,7 @@ static int32_t stbSplCreatePartSortNode(SSortLogicNode* pSort, SLogicNode** pOut pSort->node.pChildren = NULL; int32_t code = TSDB_CODE_SUCCESS; - SSortLogicNode* pPartSort = nodesCloneNode(pSort); + SSortLogicNode* pPartSort = (SSortLogicNode*)nodesCloneNode((SNode*)pSort); if (NULL == pPartSort) { code = TSDB_CODE_OUT_OF_MEMORY; } @@ -558,7 +558,7 @@ static int32_t stbSplCreatePartSortNode(SSortLogicNode* pSort, SLogicNode** pOut *pOutputPartSort = (SLogicNode*)pPartSort; *pOutputMergeKeys = pMergeKeys; } else { - nodesDestroyNode(pPartSort); + nodesDestroyNode((SNode*)pPartSort); nodesDestroyList(pMergeKeys); } @@ -574,7 +574,7 @@ static int32_t stbSplSplitSortNode(SSplitContext* pCxt, SStableSplitInfo* pInfo) } if (TSDB_CODE_SUCCESS == code) { code = nodesListMakeStrictAppend(&pInfo->pSubplan->pChildren, - splCreateScanSubplan(pCxt, pPartSort, SPLIT_FLAG_STABLE_SPLIT)); + (SNode*)splCreateScanSubplan(pCxt, pPartSort, SPLIT_FLAG_STABLE_SPLIT)); } pInfo->pSubplan->subplanType = SUBPLAN_TYPE_MERGE; return code; @@ -584,7 +584,7 @@ static int32_t stbSplSplitScanNode(SSplitContext* pCxt, SStableSplitInfo* pInfo) int32_t code = splCreateExchangeNodeForSubplan(pCxt, pInfo->pSubplan, pInfo->pSplitNode, SUBPLAN_TYPE_MERGE); if (TSDB_CODE_SUCCESS == code) { code = nodesListMakeStrictAppend(&pInfo->pSubplan->pChildren, - splCreateScanSubplan(pCxt, pInfo->pSplitNode, SPLIT_FLAG_STABLE_SPLIT)); + (SNode*)splCreateScanSubplan(pCxt, pInfo->pSplitNode, SPLIT_FLAG_STABLE_SPLIT)); } return code; } @@ -654,7 +654,7 @@ static bool sigTbJoinSplFindSplitNode(SSplitContext* pCxt, SLogicSubplan* pSubpl SJoinLogicNode* pJoin = sigTbJoinSplMatchByNode(pSubplan->pNode); if (NULL != pJoin) { pInfo->pJoin = pJoin; - pInfo->pSplitNode = nodesListGetNode(pJoin->node.pChildren, 1); + pInfo->pSplitNode = (SLogicNode*)nodesListGetNode(pJoin->node.pChildren, 1); pInfo->pSubplan = pSubplan; } return NULL != pJoin; @@ -667,7 +667,7 @@ static int32_t singleTableJoinSplit(SSplitContext* pCxt, SLogicSubplan* pSubplan } int32_t code = splCreateExchangeNodeForSubplan(pCxt, info.pSubplan, info.pSplitNode, info.pSubplan->subplanType); if (TSDB_CODE_SUCCESS == code) { - code = nodesListMakeStrictAppend(&info.pSubplan->pChildren, splCreateScanSubplan(pCxt, info.pSplitNode, 0)); + code = nodesListMakeStrictAppend(&info.pSubplan->pChildren, (SNode*)splCreateScanSubplan(pCxt, info.pSplitNode, 0)); } ++(pCxt->groupId); pCxt->split = true; @@ -708,7 +708,7 @@ static int32_t unionMountSubplan(SLogicSubplan* pParent, SNodeList* pChildren) { } static SLogicSubplan* unionCreateSubplan(SSplitContext* pCxt, SLogicNode* pNode) { - SLogicSubplan* pSubplan = nodesMakeNode(QUERY_NODE_LOGIC_SUBPLAN); + SLogicSubplan* pSubplan = (SLogicSubplan*)nodesMakeNode(QUERY_NODE_LOGIC_SUBPLAN); if (NULL == pSubplan) { return NULL; } @@ -729,7 +729,7 @@ static int32_t unionSplitSubplan(SSplitContext* pCxt, SLogicSubplan* pUnionSubpl SNode* pChild = NULL; FOREACH(pChild, pSplitNode->pChildren) { SLogicSubplan* pNewSubplan = unionCreateSubplan(pCxt, (SLogicNode*)pChild); - code = nodesListMakeStrictAppend(&pUnionSubplan->pChildren, pNewSubplan); + code = nodesListMakeStrictAppend(&pUnionSubplan->pChildren, (SNode*)pNewSubplan); if (TSDB_CODE_SUCCESS == code) { REPLACE_NODE(NULL); code = unionMountSubplan(pNewSubplan, pSubplanChildren); @@ -774,7 +774,7 @@ static bool unAllSplFindSplitNode(SSplitContext* pCxt, SLogicSubplan* pSubplan, } static int32_t unAllSplCreateExchangeNode(SSplitContext* pCxt, SLogicSubplan* pSubplan, SProjectLogicNode* pProject) { - SExchangeLogicNode* pExchange = nodesMakeNode(QUERY_NODE_LOGIC_PLAN_EXCHANGE); + SExchangeLogicNode* pExchange = (SExchangeLogicNode*)nodesMakeNode(QUERY_NODE_LOGIC_PLAN_EXCHANGE); if (NULL == pExchange) { return TSDB_CODE_OUT_OF_MEMORY; } @@ -789,20 +789,20 @@ static int32_t unAllSplCreateExchangeNode(SSplitContext* pCxt, SLogicSubplan* pS if (NULL == pProject->node.pParent) { pSubplan->pNode = (SLogicNode*)pExchange; - nodesDestroyNode(pProject); + nodesDestroyNode((SNode*)pProject); return TSDB_CODE_SUCCESS; } SNode* pNode; FOREACH(pNode, pProject->node.pParent->pChildren) { - if (nodesEqualNode(pNode, pProject)) { + if (nodesEqualNode(pNode, (SNode*)pProject)) { REPLACE_NODE(pExchange); nodesDestroyNode(pNode); return TSDB_CODE_SUCCESS; } } - nodesDestroyNode(pExchange); - return TSDB_CODE_FAILED; + nodesDestroyNode((SNode*)pExchange); + return TSDB_CODE_PLAN_INTERNAL_ERROR; } static int32_t unionAllSplit(SSplitContext* pCxt, SLogicSubplan* pSubplan) { @@ -840,7 +840,7 @@ static SLogicNode* unDistSplMatchByNode(SLogicNode* pNode) { } static int32_t unDistSplCreateExchangeNode(SSplitContext* pCxt, SLogicSubplan* pSubplan, SAggLogicNode* pAgg) { - SExchangeLogicNode* pExchange = nodesMakeNode(QUERY_NODE_LOGIC_PLAN_EXCHANGE); + SExchangeLogicNode* pExchange = (SExchangeLogicNode*)nodesMakeNode(QUERY_NODE_LOGIC_PLAN_EXCHANGE); if (NULL == pExchange) { return TSDB_CODE_OUT_OF_MEMORY; } @@ -853,7 +853,7 @@ static int32_t unDistSplCreateExchangeNode(SSplitContext* pCxt, SLogicSubplan* p pSubplan->subplanType = SUBPLAN_TYPE_MERGE; - return nodesListMakeAppend(&pAgg->node.pChildren, pExchange); + return nodesListMakeAppend(&pAgg->node.pChildren, (SNode*)pExchange); } static bool unDistSplFindSplitNode(SSplitContext* pCxt, SLogicSubplan* pSubplan, SUnionDistinctSplitInfo* pInfo) { @@ -937,7 +937,7 @@ static const int32_t splitRuleNum = (sizeof(splitRuleSet) / sizeof(SSplitRule)); static void dumpLogicSubplan(const char* pRuleName, SLogicSubplan* pSubplan) { char* pStr = NULL; - nodesNodeToString(pSubplan, false, &pStr, NULL); + nodesNodeToString((SNode*)pSubplan, false, &pStr, NULL); qDebugL("apply %s rule: %s", pRuleName, pStr); taosMemoryFree(pStr); } diff --git a/source/libs/planner/src/planUtil.c b/source/libs/planner/src/planUtil.c index 232a49ee3a..7f650c7c9a 100644 --- a/source/libs/planner/src/planUtil.c +++ b/source/libs/planner/src/planUtil.c @@ -60,7 +60,8 @@ static EDealRes doCreateColumn(SNode* pNode, void* pContext) { } pCol->node.resType = pExpr->resType; strcpy(pCol->colName, pExpr->aliasName); - return (TSDB_CODE_SUCCESS == nodesListAppend(pCxt->pList, pCol) ? DEAL_RES_IGNORE_CHILD : DEAL_RES_ERROR); + return (TSDB_CODE_SUCCESS == nodesListStrictAppend(pCxt->pList, (SNode*)pCol) ? DEAL_RES_IGNORE_CHILD + : DEAL_RES_ERROR); } default: break; @@ -111,7 +112,7 @@ int32_t replaceLogicNode(SLogicSubplan* pSubplan, SLogicNode* pOld, SLogicNode* SNode* pNode; FOREACH(pNode, pOld->pParent->pChildren) { - if (nodesEqualNode(pNode, pOld)) { + if (nodesEqualNode(pNode, (SNode*)pOld)) { REPLACE_NODE(pNew); pNew->pParent = pOld->pParent; return TSDB_CODE_SUCCESS; diff --git a/source/libs/planner/src/planner.c b/source/libs/planner/src/planner.c index 83657d27d0..c4385d576e 100644 --- a/source/libs/planner/src/planner.c +++ b/source/libs/planner/src/planner.c @@ -20,7 +20,7 @@ static void dumpQueryPlan(SQueryPlan* pPlan) { char* pStr = NULL; - nodesNodeToString(pPlan, false, &pStr, NULL); + nodesNodeToString((SNode*)pPlan, false, &pStr, NULL); planDebugL("Query Plan: %s", pStr); taosMemoryFree(pStr); } @@ -46,8 +46,8 @@ int32_t qCreateQueryPlan(SPlanContext* pCxt, SQueryPlan** pPlan, SArray* pExecNo dumpQueryPlan(*pPlan); } - nodesDestroyNode(pLogicSubplan); - nodesDestroyNode(pLogicPlan); + nodesDestroyNode((SNode*)pLogicSubplan); + nodesDestroyNode((SNode*)pLogicPlan); terrno = code; return code; } @@ -56,7 +56,7 @@ static int32_t setSubplanExecutionNode(SPhysiNode* pNode, int32_t groupId, SDown if (QUERY_NODE_PHYSICAL_PLAN_EXCHANGE == nodeType(pNode)) { SExchangePhysiNode* pExchange = (SExchangePhysiNode*)pNode; if (pExchange->srcGroupId == groupId) { - return nodesListMakeStrictAppend(&pExchange->pSrcEndPoints, nodesCloneNode(pSource)); + return nodesListMakeStrictAppend(&pExchange->pSrcEndPoints, nodesCloneNode((SNode*)pSource)); } } else if (QUERY_NODE_PHYSICAL_PLAN_MERGE == nodeType(pNode)) { SMergePhysiNode* pMerge = (SMergePhysiNode*)pNode; @@ -68,7 +68,7 @@ static int32_t setSubplanExecutionNode(SPhysiNode* pNode, int32_t groupId, SDown } else { --(pMerge->numOfChannels); } - return nodesListMakeStrictAppend(&pExchange->pSrcEndPoints, nodesCloneNode(pSource)); + return nodesListMakeStrictAppend(&pExchange->pSrcEndPoints, nodesCloneNode((SNode*)pSource)); } } @@ -101,7 +101,7 @@ int32_t qStringToSubplan(const char* pStr, SSubplan** pSubplan) { return nodesSt char* qQueryPlanToString(const SQueryPlan* pPlan) { char* pStr = NULL; int32_t len = 0; - if (TSDB_CODE_SUCCESS != nodesNodeToString(pPlan, false, &pStr, &len)) { + if (TSDB_CODE_SUCCESS != nodesNodeToString((SNode*)pPlan, false, &pStr, &len)) { return NULL; } return pStr; @@ -115,4 +115,4 @@ SQueryPlan* qStringToQueryPlan(const char* pStr) { return pPlan; } -void qDestroyQueryPlan(SQueryPlan* pPlan) { nodesDestroyNode(pPlan); } +void qDestroyQueryPlan(SQueryPlan* pPlan) { nodesDestroyNode((SNode*)pPlan); } diff --git a/source/libs/planner/test/planGroupByTest.cpp b/source/libs/planner/test/planGroupByTest.cpp index 201df2efde..78d0f7b21f 100644 --- a/source/libs/planner/test/planGroupByTest.cpp +++ b/source/libs/planner/test/planGroupByTest.cpp @@ -53,6 +53,14 @@ TEST_F(PlanGroupByTest, aggFunc) { run("SELECT SUM(10), COUNT(c1) FROM t1 GROUP BY c2"); } +TEST_F(PlanGroupByTest, rewriteFunc) { + useDb("root", "test"); + + run("SELECT AVG(c1) FROM t1"); + + run("SELECT AVG(c1) FROM t1 GROUP BY c2"); +} + TEST_F(PlanGroupByTest, selectFunc) { useDb("root", "test"); diff --git a/source/libs/planner/test/planPartByTest.cpp b/source/libs/planner/test/planPartByTest.cpp index 230500e702..9437f6ad3f 100644 --- a/source/libs/planner/test/planPartByTest.cpp +++ b/source/libs/planner/test/planPartByTest.cpp @@ -24,6 +24,10 @@ TEST_F(PlanPartitionByTest, basic) { useDb("root", "test"); run("select * from t1 partition by c1"); + + run("select ts, c1 + 1 from st1 partition by c1 + 1"); + + run("select ts, jtag->'tag1' from st2 partition by jtag->'tag1'"); } TEST_F(PlanPartitionByTest, withAggFunc) { diff --git a/source/libs/qworker/src/qwUtil.c b/source/libs/qworker/src/qwUtil.c index b9f394e186..0759cf360a 100644 --- a/source/libs/qworker/src/qwUtil.c +++ b/source/libs/qworker/src/qwUtil.c @@ -308,7 +308,7 @@ void qwFreeTaskCtx(QW_FPARAMS_DEF, SQWTaskCtx *ctx) { } if (ctx->plan) { - nodesDestroyNode(ctx->plan); + nodesDestroyNode((SNode*)ctx->plan); ctx->plan = NULL; } } diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c index bd4d865ed2..22207f8540 100644 --- a/source/libs/sync/src/syncMain.c +++ b/source/libs/sync/src/syncMain.c @@ -1244,7 +1244,7 @@ void syncNodeUpdateTerm(SSyncNode* pSyncNode, SyncTerm term) { void syncNodeBecomeFollower(SSyncNode* pSyncNode, const char* debugStr) { sDebug("vgId:%d sync event become follower, isStandBy:%d, %s", pSyncNode->vgId, pSyncNode->pRaftCfg->isStandBy, - debugStr); + debugStr); // maybe clear leader cache if (pSyncNode->state == TAOS_SYNC_STATE_LEADER) { @@ -1279,7 +1279,7 @@ void syncNodeBecomeFollower(SSyncNode* pSyncNode, const char* debugStr) { // void syncNodeBecomeLeader(SSyncNode* pSyncNode, const char* debugStr) { sDebug("vgId:%d sync event become leader, isStandBy:%d, %s", pSyncNode->vgId, pSyncNode->pRaftCfg->isStandBy, - debugStr); + debugStr); // state change pSyncNode->state = TAOS_SYNC_STATE_LEADER; @@ -1888,7 +1888,7 @@ int32_t syncNodeCommit(SSyncNode* ths, SyncIndex beginIndex, SyncIndex endIndex, int32_t code = 0; ESyncState state = flag; sDebug("vgId:%d sync event commit by wal from index:%" PRId64 " to index:%" PRId64 ", %s", ths->vgId, beginIndex, - endIndex, syncUtilState2String(state)); + endIndex, syncUtilState2String(state)); // execute fsm if (ths->pFsm != NULL) { diff --git a/source/util/src/thash.c b/source/util/src/thash.c index f564ae45b6..8bda59bba7 100644 --- a/source/util/src/thash.c +++ b/source/util/src/thash.c @@ -33,9 +33,9 @@ #define FREE_HASH_NODE(_fp, _n) \ do { \ - /* if (_fp != NULL) { \ - (_fp)(_n); \ - }*/ \ + if (_fp != NULL) { \ + (_fp)(_n); \ + } \ taosMemoryFreeClear(_n); \ } while (0); diff --git a/tests/script/tsim/dnode/redistribute_vgroup_replica3_v1_follower.sim b/tests/script/tsim/dnode/redistribute_vgroup_replica3_v1_follower.sim index a73c140a0c..48c1b7f2d4 100644 --- a/tests/script/tsim/dnode/redistribute_vgroup_replica3_v1_follower.sim +++ b/tests/script/tsim/dnode/redistribute_vgroup_replica3_v1_follower.sim @@ -163,9 +163,12 @@ endi print =============== step32: move follower2 print redistribute vgroup 2 dnode $leaderVnode dnode $follower2 dnode 5 sql redistribute vgroup 2 dnode $leaderVnode dnode $follower2 dnode 5 +<<<<<<< HEAD:tests/script/tsim/dnode/redistribute_vgroup_replica3_v1_leader.sim +======= sql show d1.vgroups print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 +>>>>>>> origin/3.0:tests/script/tsim/dnode/redistribute_vgroup_replica3_v1_follower.sim sql show d1.tables if $rows != 1 then return -1 @@ -174,9 +177,12 @@ endi print =============== step33: move follower1 print redistribute vgroup 2 dnode $leaderVnode dnode $follower1 dnode 5 sql redistribute vgroup 2 dnode $leaderVnode dnode $follower1 dnode 5 +<<<<<<< HEAD:tests/script/tsim/dnode/redistribute_vgroup_replica3_v1_leader.sim +======= sql show d1.vgroups print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 +>>>>>>> origin/3.0:tests/script/tsim/dnode/redistribute_vgroup_replica3_v1_follower.sim sql show d1.tables if $rows != 1 then return -1 @@ -185,9 +191,12 @@ endi print =============== step34: move follower2 print redistribute vgroup 2 dnode $leaderVnode dnode 5 dnode $follower2 sql redistribute vgroup 2 dnode $leaderVnode dnode 5 dnode $follower2 +<<<<<<< HEAD:tests/script/tsim/dnode/redistribute_vgroup_replica3_v1_leader.sim +======= sql show d1.vgroups print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 +>>>>>>> origin/3.0:tests/script/tsim/dnode/redistribute_vgroup_replica3_v1_follower.sim sql show d1.tables if $rows != 1 then return -1 @@ -196,8 +205,15 @@ endi print =============== step35: move follower1 print redistribute vgroup 2 dnode $leaderVnode dnode 5 dnode $follower1 sql redistribute vgroup 2 dnode $leaderVnode dnode 5 dnode $follower1 +<<<<<<< HEAD:tests/script/tsim/dnode/redistribute_vgroup_replica3_v1_leader.sim +sql show d1.tables +if $rows != 1 then + return -1 +endi +======= sql show d1.vgroups print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 +>>>>>>> origin/3.0:tests/script/tsim/dnode/redistribute_vgroup_replica3_v1_follower.sim sql show d1.tables if $rows != 1 then @@ -226,6 +242,8 @@ if $rows != 1 then return -1 endi +<<<<<<< HEAD:tests/script/tsim/dnode/redistribute_vgroup_replica3_v1_leader.sim +======= print =============== step38: move follower2 print redistribute vgroup 2 dnode $leaderVnode dnode 5 dnode $follower2 sql redistribute vgroup 2 dnode $leaderVnode dnode 5 dnode $follower2 @@ -236,6 +254,7 @@ sql show d1.tables if $rows != 1 then return -1 endi +>>>>>>> origin/3.0:tests/script/tsim/dnode/redistribute_vgroup_replica3_v1_follower.sim print =============== step39: move follower1 print redistribute vgroup 2 dnode $leaderVnode dnode 5 dnode $follower1 diff --git a/tests/script/tsim/dnode/redistribute_vgroup_replica3_v1_leader.sim b/tests/script/tsim/dnode/redistribute_vgroup_replica3_v1_leader.sim index 6ce6fb4187..90f7b1ad1f 100644 --- a/tests/script/tsim/dnode/redistribute_vgroup_replica3_v1_leader.sim +++ b/tests/script/tsim/dnode/redistribute_vgroup_replica3_v1_leader.sim @@ -160,53 +160,110 @@ if $rows != 1 then return -1 endi +<<<<<<< HEAD +print =============== step32: move follower2 +print redistribute vgroup 2 dnode $leaderVnode dnode $follower2 dnode 5 +sql redistribute vgroup 2 dnode $leaderVnode dnode $follower2 dnode 5 +<<<<<<< HEAD:tests/script/tsim/dnode/redistribute_vgroup_replica3_v1_leader.sim +======= +sql show d1.vgroups +print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 + +>>>>>>> origin/3.0:tests/script/tsim/dnode/redistribute_vgroup_replica3_v1_follower.sim +======= print =============== step32: move leader print redistribute vgroup 2 dnode $follower1 dnode $follower2 dnode 5 sql redistribute vgroup 2 dnode $follower1 dnode $follower2 dnode 5 sql show d1.vgroups print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 +>>>>>>> origin/3.0 sql show d1.tables if $rows != 1 then return -1 endi +<<<<<<< HEAD +print =============== step33: move follower1 +print redistribute vgroup 2 dnode $leaderVnode dnode $follower1 dnode 5 +sql redistribute vgroup 2 dnode $leaderVnode dnode $follower1 dnode 5 +<<<<<<< HEAD:tests/script/tsim/dnode/redistribute_vgroup_replica3_v1_leader.sim +======= +sql show d1.vgroups +print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 + +>>>>>>> origin/3.0:tests/script/tsim/dnode/redistribute_vgroup_replica3_v1_follower.sim +======= print =============== step33: move follower2 print redistribute vgroup 2 dnode $leaderVnode dnode $follower1 dnode 5 sql redistribute vgroup 2 dnode $leaderVnode dnode $follower1 dnode 5 sql show d1.vgroups print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 +>>>>>>> origin/3.0 sql show d1.tables if $rows != 1 then return -1 endi +<<<<<<< HEAD +print =============== step34: move follower2 +print redistribute vgroup 2 dnode $leaderVnode dnode 5 dnode $follower2 +sql redistribute vgroup 2 dnode $leaderVnode dnode 5 dnode $follower2 +<<<<<<< HEAD:tests/script/tsim/dnode/redistribute_vgroup_replica3_v1_leader.sim +======= +sql show d1.vgroups +print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 + +>>>>>>> origin/3.0:tests/script/tsim/dnode/redistribute_vgroup_replica3_v1_follower.sim +======= print =============== step34: move follower1 print redistribute vgroup 2 dnode $follower2 dnode 5 dnode $leaderVnode sql redistribute vgroup 2 dnode $follower2 dnode 5 dnode $leaderVnode sql show d1.vgroups print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 +>>>>>>> origin/3.0 sql show d1.tables if $rows != 1 then return -1 endi +<<<<<<< HEAD +print =============== step35: move follower1 +print redistribute vgroup 2 dnode $leaderVnode dnode 5 dnode $follower1 +sql redistribute vgroup 2 dnode $leaderVnode dnode 5 dnode $follower1 +<<<<<<< HEAD:tests/script/tsim/dnode/redistribute_vgroup_replica3_v1_leader.sim +sql show d1.tables +if $rows != 1 then + return -1 +endi +======= +sql show d1.vgroups +print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 +>>>>>>> origin/3.0:tests/script/tsim/dnode/redistribute_vgroup_replica3_v1_follower.sim +======= print =============== step35: move 5 print redistribute vgroup 2 dnode $leaderVnode dnode $follower1 dnode $follower2 sql redistribute vgroup 2 dnode $leaderVnode dnode $follower1 dnode $follower2 sql show d1.vgroups print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 +>>>>>>> origin/3.0 sql show d1.tables if $rows != 1 then return -1 endi +<<<<<<< HEAD +print =============== step36: move follower2 +print redistribute vgroup 2 dnode $leaderVnode dnode $follower2 dnode 5 +sql redistribute vgroup 2 dnode $leaderVnode dnode $follower2 dnode 5 +======= print =============== step36: move follower1 print redistribute vgroup 2 dnode $follower1 dnode $follower2 dnode 5 sql redistribute vgroup 2 dnode $follower1 dnode $follower2 dnode 5 +>>>>>>> origin/3.0 sql show d1.vgroups print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 @@ -215,7 +272,11 @@ if $rows != 1 then return -1 endi +<<<<<<< HEAD +print =============== step37: move follower1 +======= print =============== step37: move follower2 +>>>>>>> origin/3.0 print redistribute vgroup 2 dnode $leaderVnode dnode $follower1 dnode 5 sql redistribute vgroup 2 dnode $leaderVnode dnode $follower1 dnode 5 sql show d1.vgroups @@ -226,9 +287,17 @@ if $rows != 1 then return -1 endi +<<<<<<< HEAD +<<<<<<< HEAD:tests/script/tsim/dnode/redistribute_vgroup_replica3_v1_leader.sim +======= +print =============== step38: move follower2 +print redistribute vgroup 2 dnode $leaderVnode dnode 5 dnode $follower2 +sql redistribute vgroup 2 dnode $leaderVnode dnode 5 dnode $follower2 +======= print =============== step38: move leader print redistribute vgroup 2 dnode $follower1 dnode 5 dnode $follower2 sql redistribute vgroup 2 dnode $follower1 dnode 5 dnode $follower2 +>>>>>>> origin/3.0 sql show d1.vgroups print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 @@ -236,10 +305,18 @@ sql show d1.tables if $rows != 1 then return -1 endi +<<<<<<< HEAD +>>>>>>> origin/3.0:tests/script/tsim/dnode/redistribute_vgroup_replica3_v1_follower.sim + +print =============== step39: move follower1 +print redistribute vgroup 2 dnode $leaderVnode dnode 5 dnode $follower1 +sql redistribute vgroup 2 dnode $leaderVnode dnode 5 dnode $follower1 +======= print =============== step39: move 5 print redistribute vgroup 2 dnode $leaderVnode dnode $follower2 dnode $follower1 sql redistribute vgroup 2 dnode $leaderVnode dnode $follower2 dnode $follower1 +>>>>>>> origin/3.0 sql show d1.vgroups print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09