diff --git a/include/common/tdatablock.h b/include/common/tdatablock.h index 248d7d0db6..7978430027 100644 --- a/include/common/tdatablock.h +++ b/include/common/tdatablock.h @@ -113,6 +113,20 @@ static FORCE_INLINE void colDataAppendNULL(SColumnInfoData* pColumnInfoData, uin pColumnInfoData->hasNull = true; } +static FORCE_INLINE void colDataAppendNNULL(SColumnInfoData* pColumnInfoData, uint32_t start, size_t nRows) { + if (IS_VAR_DATA_TYPE(pColumnInfoData->info.type)) { + for(int32_t i = start; i < start + nRows; ++i) { + pColumnInfoData->varmeta.offset[i] = -1; // it is a null value of VAR type. + } + } else { + for(int32_t i = start; i < start + nRows; ++i) { + colDataSetNull_f(pColumnInfoData->nullbitmap, i); + } + } + + pColumnInfoData->hasNull = true; +} + static FORCE_INLINE int32_t colDataAppendInt8(SColumnInfoData* pColumnInfoData, uint32_t currentRow, int8_t* v) { ASSERT(pColumnInfoData->info.type == TSDB_DATA_TYPE_TINYINT || pColumnInfoData->info.type == TSDB_DATA_TYPE_UTINYINT || pColumnInfoData->info.type == TSDB_DATA_TYPE_BOOL); diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 12909875d5..6ec7d8c75b 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -1395,11 +1395,10 @@ typedef struct { } SDDropTopicReq; typedef struct { - float xFilesFactor; - int8_t delayUnit; - int8_t nFuncIds; - int32_t* pFuncIds; - int64_t delay; + float xFilesFactor; + int32_t delay; + int8_t nFuncIds; + func_id_t* pFuncIds; } SRSmaParam; typedef struct SVCreateTbReq { diff --git a/include/common/tmsgcb.h b/include/common/tmsgcb.h index cb59599d9a..6c3671a8d6 100644 --- a/include/common/tmsgcb.h +++ b/include/common/tmsgcb.h @@ -50,7 +50,6 @@ typedef struct { PutToQueueFp queueFps[QUEUE_MAX]; GetQueueSizeFp qsizeFp; SendReqFp sendReqFp; - SendMnodeReqFp sendMnodeReqFp; SendRspFp sendRspFp; RegisterBrokenLinkArgFp registerBrokenLinkArgFp; ReleaseHandleFp releaseHandleFp; @@ -60,7 +59,6 @@ void tmsgSetDefaultMsgCb(const SMsgCb* pMsgCb); int32_t tmsgPutToQueue(const SMsgCb* pMsgCb, EQueueType qtype, SRpcMsg* pReq); int32_t tmsgGetQueueSize(const SMsgCb* pMsgCb, int32_t vgId, EQueueType qtype); int32_t tmsgSendReq(const SMsgCb* pMsgCb, const SEpSet* epSet, SRpcMsg* pReq); -int32_t tmsgSendMnodeReq(const SMsgCb* pMsgCb, SRpcMsg* pReq); void tmsgSendRsp(const SRpcMsg* pRsp); void tmsgRegisterBrokenLinkArg(const SMsgCb* pMsgCb, SRpcMsg* pMsg); void tmsgReleaseHandle(void* handle, int8_t type); diff --git a/include/common/ttokendef.h b/include/common/ttokendef.h index 8d996be21e..afd2a01540 100644 --- a/include/common/ttokendef.h +++ b/include/common/ttokendef.h @@ -172,7 +172,7 @@ #define TK_SYNCDB 154 #define TK_NULL 155 #define TK_NK_VARIABLE 156 -#define TK_NK_UNDERLINE 157 +#define TK_NOW 157 #define TK_ROWTS 158 #define TK_TBNAME 159 #define TK_QSTARTTS 160 @@ -229,7 +229,6 @@ #define TK_NK_COLON 500 #define TK_NK_BITNOT 501 #define TK_INSERT 502 -#define TK_NOW 504 #define TK_VALUES 507 #define TK_IMPORT 509 #define TK_NK_SEMI 508 diff --git a/include/common/ttypes.h b/include/common/ttypes.h index 19442af206..1cb398fb85 100644 --- a/include/common/ttypes.h +++ b/include/common/ttypes.h @@ -31,6 +31,7 @@ typedef int16_t col_id_t; typedef int8_t col_type_t; typedef int32_t col_bytes_t; typedef uint16_t schema_ver_t; +typedef int32_t func_id_t; #pragma pack(push, 1) typedef struct { diff --git a/include/dnode/mnode/mnode.h b/include/dnode/mnode/mnode.h index 5b88a9d6af..08ab63e55a 100644 --- a/include/dnode/mnode/mnode.h +++ b/include/dnode/mnode/mnode.h @@ -29,8 +29,7 @@ extern "C" { typedef struct SMnode SMnode; typedef struct { - int32_t dnodeId; - int64_t clusterId; + bool deploy; int8_t replica; int8_t selfIndex; SReplica replicas[TSDB_MAX_REPLICA]; diff --git a/include/libs/nodes/querynodes.h b/include/libs/nodes/querynodes.h index ddcbaa0bee..dec709535f 100644 --- a/include/libs/nodes/querynodes.h +++ b/include/libs/nodes/querynodes.h @@ -306,6 +306,7 @@ int32_t nodesCollectFuncs(SSelectStmt* pSelect, FFuncClassifier classifier, SNod bool nodesIsExprNode(const SNode* pNode); +bool nodesIsUnaryOp(const SOperatorNode* pOp); bool nodesIsArithmeticOp(const SOperatorNode* pOp); bool nodesIsComparisonOp(const SOperatorNode* pOp); bool nodesIsJsonOp(const SOperatorNode* pOp); diff --git a/include/os/osShm.h b/include/os/osShm.h index d26a99e277..61ffc0f6cc 100644 --- a/include/os/osShm.h +++ b/include/os/osShm.h @@ -26,7 +26,7 @@ typedef struct { void* ptr; } SShm; -int32_t taosCreateShm(SShm *pShm, int32_t shmsize) ; +int32_t taosCreateShm(SShm *pShm, int32_t key, int32_t shmsize) ; void taosDropShm(SShm *pShm); int32_t taosAttachShm(SShm *pShm); diff --git a/include/util/tdef.h b/include/util/tdef.h index 517cb8baee..b1bebcee46 100644 --- a/include/util/tdef.h +++ b/include/util/tdef.h @@ -128,18 +128,20 @@ extern const int32_t TYPE_BYTES[15]; } while (0) typedef enum EOperatorType { - // arithmetic operator + // binary arithmetic operator OP_TYPE_ADD = 1, OP_TYPE_SUB, OP_TYPE_MULTI, OP_TYPE_DIV, OP_TYPE_MOD, + // unary arithmetic operator + OP_TYPE_MINUS, // bit operator OP_TYPE_BIT_AND, OP_TYPE_BIT_OR, - // comparison operator + // binary comparison operator OP_TYPE_GREATER_THAN, OP_TYPE_GREATER_EQUAL, OP_TYPE_LOWER_THAN, @@ -152,6 +154,7 @@ typedef enum EOperatorType { OP_TYPE_NOT_LIKE, OP_TYPE_MATCH, OP_TYPE_NMATCH, + // unary comparison operator OP_TYPE_IS_NULL, OP_TYPE_IS_NOT_NULL, OP_TYPE_IS_TRUE, diff --git a/include/util/tprocess.h b/include/util/tprocess.h index 3a47450eec..bc0c8fe5a4 100644 --- a/include/util/tprocess.h +++ b/include/util/tprocess.h @@ -22,7 +22,7 @@ extern "C" { #endif -typedef enum { PROC_REQ, PROC_RSP, PROC_REG, PROC_RELEASE } ProcFuncType; +typedef enum { PROC_QUEUE, PROC_REQ, PROC_RSP, PROC_REGIST, PROC_RELEASE } ProcFuncType; typedef struct SProcQueue SProcQueue; typedef struct SProcObj SProcObj; @@ -53,7 +53,7 @@ void taosProcCleanup(SProcObj *pProc); int32_t taosProcRun(SProcObj *pProc); int32_t taosProcPutToChildQ(SProcObj *pProc, const void *pHead, int16_t headLen, const void *pBody, int32_t bodyLen, ProcFuncType ftype); -int32_t taosProcPutToParentQ(SProcObj *pProc, const void *pHead, int16_t headLen, const void *pBody, int32_t bodyLen, +void taosProcPutToParentQ(SProcObj *pProc, const void *pHead, int16_t headLen, const void *pBody, int32_t bodyLen, ProcFuncType ftype); #ifdef __cplusplus diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index 4e68b5331f..80559c025f 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -753,6 +753,7 @@ int32_t setResultDataPtr(SReqResultInfo* pResultInfo, TAOS_FIELD* pFields, int32 pStart += colLength[i]; } + // convert UCS4-LE encoded character to native multi-bytes character in current data block. for (int32_t i = 0; i < numOfCols; ++i) { int32_t type = pResultInfo->fields[i].type; int32_t bytes = pResultInfo->fields[i].bytes; @@ -779,6 +780,7 @@ int32_t setResultDataPtr(SReqResultInfo* pResultInfo, TAOS_FIELD* pFields, int32 } pResultInfo->pCol[i].pData = pResultInfo->convertBuf[i]; + pResultInfo->row[i] = pResultInfo->pCol[i].pData; } } diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index d75fa6e9c5..2a16b58565 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -314,13 +314,12 @@ int32_t tSerializeSVCreateTbReq(void **buf, SVCreateTbReq *pReq) { } if (pReq->rollup && pReq->stbCfg.pRSmaParam) { SRSmaParam *param = pReq->stbCfg.pRSmaParam; - tlen += taosEncodeFixedU32(buf, (uint32_t)param->xFilesFactor); - tlen += taosEncodeFixedI8(buf, param->delayUnit); + tlen += taosEncodeBinary(buf, (const void *)¶m->xFilesFactor, sizeof(param->xFilesFactor)); + tlen += taosEncodeFixedI32(buf, param->delay); tlen += taosEncodeFixedI8(buf, param->nFuncIds); for (int8_t i = 0; i < param->nFuncIds; ++i) { tlen += taosEncodeFixedI32(buf, param->pFuncIds[i]); } - tlen += taosEncodeFixedI64(buf, param->delay); } break; case TD_CHILD_TABLE: @@ -339,13 +338,12 @@ int32_t tSerializeSVCreateTbReq(void **buf, SVCreateTbReq *pReq) { } if (pReq->rollup && pReq->ntbCfg.pRSmaParam) { SRSmaParam *param = pReq->ntbCfg.pRSmaParam; - tlen += taosEncodeFixedU32(buf, (uint32_t)param->xFilesFactor); - tlen += taosEncodeFixedI8(buf, param->delayUnit); + tlen += taosEncodeBinary(buf, (const void *)¶m->xFilesFactor, sizeof(param->xFilesFactor)); + tlen += taosEncodeFixedI32(buf, param->delay); tlen += taosEncodeFixedI8(buf, param->nFuncIds); for (int8_t i = 0; i < param->nFuncIds; ++i) { tlen += taosEncodeFixedI32(buf, param->pFuncIds[i]); } - tlen += taosEncodeFixedI64(buf, param->delay); } break; default: @@ -387,17 +385,17 @@ void *tDeserializeSVCreateTbReq(void *buf, SVCreateTbReq *pReq) { if (pReq->rollup) { pReq->stbCfg.pRSmaParam = (SRSmaParam *)taosMemoryMalloc(sizeof(SRSmaParam)); SRSmaParam *param = pReq->stbCfg.pRSmaParam; - buf = taosDecodeFixedU32(buf, (uint32_t *)¶m->xFilesFactor); - buf = taosDecodeFixedI8(buf, ¶m->delayUnit); + buf = taosDecodeBinaryTo(buf, (void*)¶m->xFilesFactor, sizeof(param->xFilesFactor)); + buf = taosDecodeFixedI32(buf, ¶m->delay); buf = taosDecodeFixedI8(buf, ¶m->nFuncIds); if (param->nFuncIds > 0) { + param->pFuncIds = (func_id_t *)taosMemoryMalloc(param->nFuncIds * sizeof(func_id_t)); for (int8_t i = 0; i < param->nFuncIds; ++i) { buf = taosDecodeFixedI32(buf, param->pFuncIds + i); } } else { param->pFuncIds = NULL; } - buf = taosDecodeFixedI64(buf, ¶m->delay); } else { pReq->stbCfg.pRSmaParam = NULL; } @@ -420,17 +418,17 @@ void *tDeserializeSVCreateTbReq(void *buf, SVCreateTbReq *pReq) { if (pReq->rollup) { pReq->ntbCfg.pRSmaParam = (SRSmaParam *)taosMemoryMalloc(sizeof(SRSmaParam)); SRSmaParam *param = pReq->ntbCfg.pRSmaParam; - buf = taosDecodeFixedU32(buf, (uint32_t *)¶m->xFilesFactor); - buf = taosDecodeFixedI8(buf, ¶m->delayUnit); + buf = taosDecodeBinaryTo(buf, (void*)¶m->xFilesFactor, sizeof(param->xFilesFactor)); + buf = taosDecodeFixedI32(buf, ¶m->delay); buf = taosDecodeFixedI8(buf, ¶m->nFuncIds); if (param->nFuncIds > 0) { + param->pFuncIds = (func_id_t *)taosMemoryMalloc(param->nFuncIds * sizeof(func_id_t)); for (int8_t i = 0; i < param->nFuncIds; ++i) { buf = taosDecodeFixedI32(buf, param->pFuncIds + i); } } else { param->pFuncIds = NULL; } - buf = taosDecodeFixedI64(buf, ¶m->delay); } else { pReq->ntbCfg.pRSmaParam = NULL; } diff --git a/source/common/src/tmsgcb.c b/source/common/src/tmsgcb.c index e90634a604..cb5e2b07c1 100644 --- a/source/common/src/tmsgcb.c +++ b/source/common/src/tmsgcb.c @@ -32,10 +32,6 @@ int32_t tmsgSendReq(const SMsgCb* pMsgCb, const SEpSet* epSet, SRpcMsg* pReq) { return (*pMsgCb->sendReqFp)(pMsgCb->pWrapper, epSet, pReq); } -int32_t tmsgSendMnodeReq(const SMsgCb* pMsgCb, SRpcMsg* pReq) { - return (*pMsgCb->sendMnodeReqFp)(pMsgCb->pWrapper, pReq); -} - void tmsgSendRsp(const SRpcMsg* pRsp) { return (*tsDefaultMsgCb.sendRspFp)(tsDefaultMsgCb.pWrapper, pRsp); } void tmsgRegisterBrokenLinkArg(const SMsgCb* pMsgCb, SRpcMsg* pMsg) { diff --git a/source/dnode/mgmt/bm/src/bmInt.c b/source/dnode/mgmt/bm/src/bmInt.c index 4b87f4463c..4ca7afbb6d 100644 --- a/source/dnode/mgmt/bm/src/bmInt.c +++ b/source/dnode/mgmt/bm/src/bmInt.c @@ -19,12 +19,7 @@ static int32_t bmRequire(SMgmtWrapper *pWrapper, bool *required) { return dndReadFile(pWrapper, required); } static void bmInitOption(SBnodeMgmt *pMgmt, SBnodeOpt *pOption) { - SMsgCb msgCb = {0}; - msgCb.pWrapper = pMgmt->pWrapper; - msgCb.sendReqFp = dndSendReqToDnode; - msgCb.sendMnodeReqFp = dndSendReqToMnode; - msgCb.sendRspFp = dndSendRsp; - msgCb.registerBrokenLinkArgFp = dndRegisterBrokenLinkArg; + SMsgCb msgCb = dndCreateMsgcb(pMgmt->pWrapper); pOption->msgCb = msgCb; } diff --git a/source/dnode/mgmt/main/exe/dndMain.c b/source/dnode/mgmt/main/exe/dndMain.c index 0d2ddbfbbc..c6a109d62a 100644 --- a/source/dnode/mgmt/main/exe/dndMain.c +++ b/source/dnode/mgmt/main/exe/dndMain.c @@ -30,7 +30,6 @@ static struct { } global = {0}; static void dndStopDnode(int signum, void *info, void *ctx) { - dInfo("system signal:%d received", signum); SDnode *pDnode = atomic_val_compare_exchange_ptr(&global.pDnode, 0, global.pDnode); if (pDnode != NULL) { dndHandleEvent(pDnode, DND_EVENT_STOP); @@ -41,8 +40,10 @@ static void dndSetSignalHandle() { taosSetSignal(SIGTERM, dndStopDnode); taosSetSignal(SIGHUP, dndStopDnode); taosSetSignal(SIGINT, dndStopDnode); + taosSetSignal(SIGTSTP, dndStopDnode); taosSetSignal(SIGABRT, dndStopDnode); taosSetSignal(SIGBREAK, dndStopDnode); + taosSetSignal(SIGQUIT, dndStopDnode); if (!tsMultiProcess) { } else if (global.ntype == DNODE || global.ntype == NODE_MAX) { @@ -72,7 +73,7 @@ static int32_t dndParseArgs(int32_t argc, char const *argv[]) { } else if (strcmp(argv[i], "-n") == 0) { global.ntype = atoi(argv[++i]); if (global.ntype <= DNODE || global.ntype > NODE_MAX) { - printf("'-n' range is [1-5], default is 0\n"); + printf("'-n' range is [1 - %d], default is 0\n", NODE_MAX - 1); return -1; } } else if (strcmp(argv[i], "-k") == 0) { diff --git a/source/dnode/mgmt/main/inc/dnd.h b/source/dnode/mgmt/main/inc/dnd.h index b9c760c980..255a739add 100644 --- a/source/dnode/mgmt/main/inc/dnd.h +++ b/source/dnode/mgmt/main/inc/dnd.h @@ -149,7 +149,7 @@ int32_t dndInitClient(SDnode *pDnode); void dndCleanupClient(SDnode *pDnode); int32_t dndProcessNodeMsg(SDnode *pDnode, SNodeMsg *pMsg); int32_t dndSendReqToMnode(SMgmtWrapper *pWrapper, SRpcMsg *pMsg); -int32_t dndSendReqToDnode(SMgmtWrapper *pWrapper, const SEpSet *pEpSet, SRpcMsg *pMsg); +int32_t dndSendReq(SMgmtWrapper *pWrapper, const SEpSet *pEpSet, SRpcMsg *pMsg); void dndSendRsp(SMgmtWrapper *pWrapper, const SRpcMsg *pRsp); void dndRegisterBrokenLinkArg(SMgmtWrapper *pWrapper, SRpcMsg *pMsg); SMsgCb dndCreateMsgcb(SMgmtWrapper *pWrapper); diff --git a/source/dnode/mgmt/main/src/dndExec.c b/source/dnode/mgmt/main/src/dndExec.c index b37893aa6f..8837da6d48 100644 --- a/source/dnode/mgmt/main/src/dndExec.c +++ b/source/dnode/mgmt/main/src/dndExec.c @@ -45,7 +45,7 @@ int32_t dndOpenNode(SMgmtWrapper *pWrapper) { } void dndCloseNode(SMgmtWrapper *pWrapper) { - dDebug("node:%s, start to close", pWrapper->name); + dDebug("node:%s, mgmt start to close", pWrapper->name); pWrapper->required = false; taosWLockLatch(&pWrapper->latch); if (pWrapper->deployed) { @@ -62,7 +62,7 @@ void dndCloseNode(SMgmtWrapper *pWrapper) { taosProcCleanup(pWrapper->pProc); pWrapper->pProc = NULL; } - dDebug("node:%s, has been closed", pWrapper->name); + dDebug("node:%s, mgmt has been closed", pWrapper->name); } static void dndConsumeChildQueue(SMgmtWrapper *pWrapper, SNodeMsg *pMsg, int16_t msgLen, void *pCont, int32_t contLen, @@ -90,10 +90,10 @@ static void dndConsumeChildQueue(SMgmtWrapper *pWrapper, SNodeMsg *pMsg, int16_t static void dndConsumeParentQueue(SMgmtWrapper *pWrapper, SRpcMsg *pMsg, int16_t msgLen, void *pCont, int32_t contLen, ProcFuncType ftype) { pMsg->pCont = pCont; - dTrace("msg:%p, get from parent queue, handle:%p app:%p", pMsg, pMsg->handle, pMsg->ahandle); + dTrace("msg:%p, get from parent queue, ftype:%d handle:%p, app:%p", pMsg, ftype, pMsg->handle, pMsg->ahandle); switch (ftype) { - case PROC_REG: + case PROC_REGIST: rpcRegisterBrokenLinkArg(pMsg); break; case PROC_RELEASE: @@ -101,11 +101,14 @@ static void dndConsumeParentQueue(SMgmtWrapper *pWrapper, SRpcMsg *pMsg, int16_t rpcFreeCont(pCont); break; case PROC_REQ: - // todo send to dnode dndSendReqToMnode(pWrapper, pMsg); - default: + // dndSendReq(pWrapper, (const SEpSet *)((char *)pMsg + sizeof(SRpcMsg)), pMsg); + break; + case PROC_RSP: dndSendRpcRsp(pWrapper, pMsg); break; + default: + break; } taosMemoryFree(pMsg); } @@ -180,6 +183,7 @@ static int32_t dndRunInSingleProcess(SDnode *pDnode) { while (1) { if (pDnode->event == DND_EVENT_STOP) { dInfo("dnode is about to stop"); + dndSetStatus(pDnode, DND_STAT_STOPPED); break; } taosMsleep(100); @@ -202,7 +206,7 @@ static int32_t dndRunInParentProcess(SDnode *pDnode) { if (!pWrapper->required) continue; int32_t shmsize = 1024 * 1024 * 2; // size will be a configuration item - if (taosCreateShm(&pWrapper->shm, shmsize) != 0) { + if (taosCreateShm(&pWrapper->shm, n, shmsize) != 0) { terrno = TAOS_SYSTEM_ERROR(terrno); dError("node:%s, failed to create shm size:%d since %s", pWrapper->name, shmsize, terrstr()); return -1; @@ -255,6 +259,8 @@ static int32_t dndRunInParentProcess(SDnode *pDnode) { while (1) { if (pDnode->event == DND_EVENT_STOP) { dInfo("dnode is about to stop"); + dndSetStatus(pDnode, DND_STAT_STOPPED); + for (ENodeType n = DNODE + 1; n < NODE_MAX; ++n) { SMgmtWrapper *pWrapper = &pDnode->wrappers[n]; if (!pWrapper->required) continue; @@ -263,15 +269,6 @@ static int32_t dndRunInParentProcess(SDnode *pDnode) { if (pWrapper->procId > 0 && taosProcExist(pWrapper->procId)) { dInfo("node:%s, send kill signal to the child process:%d", pWrapper->name, pWrapper->procId); taosKillProc(pWrapper->procId); - } - } - - for (ENodeType n = DNODE + 1; n < NODE_MAX; ++n) { - SMgmtWrapper *pWrapper = &pDnode->wrappers[n]; - if (!pWrapper->required) continue; - if (pDnode->ntype == NODE_MAX) continue; - - if (pWrapper->procId > 0 && taosProcExist(pWrapper->procId)) { dInfo("node:%s, wait for child process:%d to stop", pWrapper->name, pWrapper->procId); taosWaitProc(pWrapper->procId); dInfo("node:%s, child process:%d is stopped", pWrapper->name, pWrapper->procId); @@ -331,6 +328,8 @@ static int32_t dndRunInChildProcess(SDnode *pDnode) { } } + dndSetStatus(pDnode, DND_STAT_RUNNING); + if (taosProcRun(pWrapper->pProc) != 0) { dError("node:%s, failed to run proc since %s", pWrapper->name, terrstr()); return -1; @@ -340,11 +339,14 @@ static int32_t dndRunInChildProcess(SDnode *pDnode) { dndReportStartup(pDnode, "TDengine", "initialized successfully"); while (1) { if (pDnode->event == DND_EVENT_STOP) { - dInfo("dnode is about to stop"); + dInfo("%s is about to stop", pWrapper->name); + dndSetStatus(pDnode, DND_STAT_STOPPED); break; } taosMsleep(100); } + + return 0; } int32_t dndRun(SDnode *pDnode) { diff --git a/source/dnode/mgmt/main/src/dndInt.c b/source/dnode/mgmt/main/src/dndInt.c index 602ebc6b3c..6f6e21b983 100644 --- a/source/dnode/mgmt/main/src/dndInt.c +++ b/source/dnode/mgmt/main/src/dndInt.c @@ -133,14 +133,6 @@ _OVER: void dndClose(SDnode *pDnode) { if (pDnode == NULL) return; - if (dndGetStatus(pDnode) == DND_STAT_STOPPED) { - dError("dnode is shutting down, data:%p", pDnode); - return; - } - - dInfo("start to close dnode, data:%p", pDnode); - dndSetStatus(pDnode, DND_STAT_STOPPED); - for (ENodeType n = 0; n < NODE_MAX; ++n) { SMgmtWrapper *pWrapper = &pDnode->wrappers[n]; dndCloseNode(pWrapper); @@ -151,7 +143,6 @@ void dndClose(SDnode *pDnode) { } void dndHandleEvent(SDnode *pDnode, EDndEvent event) { - dInfo("dnode receive %s event, data:%p", dndEventStr(event), pDnode); if (event == DND_EVENT_STOP) { pDnode->event = event; } diff --git a/source/dnode/mgmt/main/src/dndTransport.c b/source/dnode/mgmt/main/src/dndTransport.c index 07ea0309a8..d463f2ba7a 100644 --- a/source/dnode/mgmt/main/src/dndTransport.c +++ b/source/dnode/mgmt/main/src/dndTransport.c @@ -319,22 +319,6 @@ static int32_t dndSendRpcReq(STransMgmt *pMgmt, const SEpSet *pEpSet, SRpcMsg *p return 0; } -int32_t dndSendReqToDnode(SMgmtWrapper *pWrapper, const SEpSet *pEpSet, SRpcMsg *pReq) { - if (pWrapper->procType != PROC_CHILD) { - SDnode *pDnode = pWrapper->pDnode; - if (dndGetStatus(pDnode) != DND_STAT_RUNNING) { - terrno = TSDB_CODE_DND_OFFLINE; - dError("failed to send rpc msg since %s, handle:%p", terrstr(), pReq->handle); - return -1; - } - return dndSendRpcReq(&pDnode->trans, pEpSet, pReq); - } else { - while (taosProcPutToParentQ(pWrapper->pProc, pReq, sizeof(SRpcMsg), pReq->pCont, pReq->contLen, PROC_REQ) != 0) { - taosMsleep(1); - } - } -} - int32_t dndSendReqToMnode(SMgmtWrapper *pWrapper, SRpcMsg *pReq) { SDnode *pDnode = pWrapper->pDnode; STransMgmt *pTrans = &pDnode->trans; @@ -362,13 +346,37 @@ void dndSendRpcRsp(SMgmtWrapper *pWrapper, const SRpcMsg *pRsp) { } } +int32_t dndSendReq(SMgmtWrapper *pWrapper, const SEpSet *pEpSet, SRpcMsg *pReq) { + SDnode *pDnode = pWrapper->pDnode; + if (dndGetStatus(pDnode) != DND_STAT_RUNNING) { + terrno = TSDB_CODE_DND_OFFLINE; + dError("failed to send rpc msg since %s, handle:%p", terrstr(), pReq->handle); + return -1; + } + + if (pWrapper->procType != PROC_CHILD) { + return dndSendRpcReq(&pDnode->trans, pEpSet, pReq); + } else { + int32_t headLen = sizeof(SRpcMsg) + sizeof(SEpSet); + char *pHead = taosMemoryMalloc(headLen); + if (pHead == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + return -1; + } + memcpy(pHead, pReq, sizeof(SRpcMsg)); + memcpy(pHead + sizeof(SRpcMsg), pEpSet, sizeof(SEpSet)); + + taosProcPutToParentQ(pWrapper->pProc, pReq, headLen, pReq->pCont, pReq->contLen, PROC_REQ); + taosMemoryFree(pHead); + return 0; + } +} + void dndSendRsp(SMgmtWrapper *pWrapper, const SRpcMsg *pRsp) { if (pWrapper->procType != PROC_CHILD) { dndSendRpcRsp(pWrapper, pRsp); } else { - while (taosProcPutToParentQ(pWrapper->pProc, pRsp, sizeof(SRpcMsg), pRsp->pCont, pRsp->contLen, PROC_RSP) != 0) { - taosMsleep(1); - } + taosProcPutToParentQ(pWrapper->pProc, pRsp, sizeof(SRpcMsg), pRsp->pCont, pRsp->contLen, PROC_RSP); } } @@ -376,9 +384,7 @@ void dndRegisterBrokenLinkArg(SMgmtWrapper *pWrapper, SRpcMsg *pMsg) { if (pWrapper->procType != PROC_CHILD) { rpcRegisterBrokenLinkArg(pMsg); } else { - while (taosProcPutToParentQ(pWrapper->pProc, pMsg, sizeof(SRpcMsg), pMsg->pCont, pMsg->contLen, PROC_REG) != 0) { - taosMsleep(1); - } + taosProcPutToParentQ(pWrapper->pProc, pMsg, sizeof(SRpcMsg), pMsg->pCont, pMsg->contLen, PROC_REGIST); } } @@ -387,20 +393,17 @@ static void dndReleaseHandle(SMgmtWrapper *pWrapper, void *handle, int8_t type) rpcReleaseHandle(handle, type); } else { SRpcMsg msg = {.handle = handle, .code = type}; - while (taosProcPutToParentQ(pWrapper->pProc, &msg, sizeof(SRpcMsg), NULL, 0, PROC_RELEASE) != 0) { - taosMsleep(1); - } + taosProcPutToParentQ(pWrapper->pProc, &msg, sizeof(SRpcMsg), NULL, 0, PROC_RELEASE); } } SMsgCb dndCreateMsgcb(SMgmtWrapper *pWrapper) { SMsgCb msgCb = { .pWrapper = pWrapper, + .sendReqFp = dndSendReq, + .sendRspFp = dndSendRsp, .registerBrokenLinkArgFp = dndRegisterBrokenLinkArg, .releaseHandleFp = dndReleaseHandle, - .sendMnodeReqFp = dndSendReqToMnode, - .sendReqFp = dndSendReqToDnode, - .sendRspFp = dndSendRsp, }; return msgCb; } \ No newline at end of file diff --git a/source/dnode/mgmt/mm/src/mmFile.c b/source/dnode/mgmt/mm/src/mmFile.c index e5cc0ce087..76aba771cb 100644 --- a/source/dnode/mgmt/mm/src/mmFile.c +++ b/source/dnode/mgmt/mm/src/mmFile.c @@ -111,7 +111,7 @@ int32_t mmWriteFile(SMnodeMgmt *pMgmt, bool deployed) { TdFilePtr pFile = taosOpenFile(file, TD_FILE_CTEATE | TD_FILE_WRITE | TD_FILE_TRUNC); if (pFile == NULL) { - terrno = TAOS_SYSTEM_ERROR(errno);; + terrno = TAOS_SYSTEM_ERROR(errno); dError("failed to write %s since %s", file, terrstr()); return -1; } @@ -145,7 +145,7 @@ int32_t mmWriteFile(SMnodeMgmt *pMgmt, bool deployed) { snprintf(realfile, sizeof(realfile), "%s%smnode.json", pMgmt->path, TD_DIRSEP); if (taosRenameFile(file, realfile) != 0) { - terrno = TAOS_SYSTEM_ERROR(errno);; + terrno = TAOS_SYSTEM_ERROR(errno); dError("failed to rename %s since %s", file, terrstr()); return -1; } diff --git a/source/dnode/mgmt/mm/src/mmInt.c b/source/dnode/mgmt/mm/src/mmInt.c index 3d15c9b9ae..301ca598e6 100644 --- a/source/dnode/mgmt/mm/src/mmInt.c +++ b/source/dnode/mgmt/mm/src/mmInt.c @@ -39,20 +39,11 @@ static int32_t mmRequire(SMgmtWrapper *pWrapper, bool *required) { } static void mmInitOption(SMnodeMgmt *pMgmt, SMnodeOpt *pOption) { - SDnode *pDnode = pMgmt->pDnode; - pOption->dnodeId = pDnode->dnodeId; - pOption->clusterId = pDnode->clusterId; - - SMsgCb msgCb = {0}; - msgCb.pWrapper = pMgmt->pWrapper; + SMsgCb msgCb = dndCreateMsgcb(pMgmt->pWrapper); msgCb.queueFps[QUERY_QUEUE] = mmPutMsgToQueryQueue; msgCb.queueFps[READ_QUEUE] = mmPutMsgToReadQueue; msgCb.queueFps[WRITE_QUEUE] = mmPutMsgToWriteQueue; msgCb.queueFps[SYNC_QUEUE] = mmPutMsgToWriteQueue; - msgCb.sendReqFp = dndSendReqToDnode; - msgCb.sendMnodeReqFp = dndSendReqToMnode; - msgCb.sendRspFp = dndSendRsp; - msgCb.registerBrokenLinkArgFp = dndRegisterBrokenLinkArg; pOption->msgCb = msgCb; } @@ -66,6 +57,7 @@ static void mmBuildOptionForDeploy(SMnodeMgmt *pMgmt, SMnodeOpt *pOption) { pReplica->id = 1; pReplica->port = pDnode->serverPort; tstrncpy(pReplica->fqdn, pDnode->localFqdn, TSDB_FQDN_LEN); + pOption->deploy = true; pMgmt->selfIndex = pOption->selfIndex; pMgmt->replica = pOption->replica; @@ -77,6 +69,7 @@ static void mmBuildOptionForOpen(SMnodeMgmt *pMgmt, SMnodeOpt *pOption) { pOption->selfIndex = pMgmt->selfIndex; pOption->replica = pMgmt->replica; memcpy(&pOption->replicas, pMgmt->replicas, sizeof(SReplica) * TSDB_MAX_REPLICA); + pOption->deploy = false; } static int32_t mmBuildOptionFromReq(SMnodeMgmt *pMgmt, SMnodeOpt *pOption, SDCreateMnodeReq *pCreate) { @@ -89,7 +82,7 @@ static int32_t mmBuildOptionFromReq(SMnodeMgmt *pMgmt, SMnodeOpt *pOption, SDCre pReplica->id = pCreate->replicas[i].id; pReplica->port = pCreate->replicas[i].port; memcpy(pReplica->fqdn, pCreate->replicas[i].fqdn, TSDB_FQDN_LEN); - if (pReplica->id == pOption->dnodeId) { + if (pReplica->id == pMgmt->pDnode->dnodeId) { pOption->selfIndex = i; } } @@ -98,6 +91,7 @@ static int32_t mmBuildOptionFromReq(SMnodeMgmt *pMgmt, SMnodeOpt *pOption, SDCre dError("failed to build mnode options since %s", terrstr()); return -1; } + pOption->deploy = true; pMgmt->selfIndex = pOption->selfIndex; pMgmt->replica = pOption->replica; @@ -225,9 +219,7 @@ int32_t mmOpenFromMsg(SMgmtWrapper *pWrapper, SDCreateMnodeReq *pReq) { return code; } -static int32_t mmOpen(SMgmtWrapper *pWrapper) { - return mmOpenFromMsg(pWrapper, NULL); -} +static int32_t mmOpen(SMgmtWrapper *pWrapper) { return mmOpenFromMsg(pWrapper, NULL); } static int32_t mmStart(SMgmtWrapper *pWrapper) { dDebug("mnode-mgmt start to run"); @@ -258,7 +250,7 @@ int32_t mmGetUserAuth(SMgmtWrapper *pWrapper, char *user, char *spi, char *encry } int32_t mmMonitorMnodeInfo(SMgmtWrapper *pWrapper, SMonClusterInfo *pClusterInfo, SMonVgroupInfo *pVgroupInfo, - SMonGrantInfo *pGrantInfo) { + SMonGrantInfo *pGrantInfo) { SMnodeMgmt *pMgmt = pWrapper->pMgmt; return mndGetMonitorInfo(pMgmt->pMnode, pClusterInfo, pVgroupInfo, pGrantInfo); } diff --git a/source/dnode/mgmt/qm/src/qmInt.c b/source/dnode/mgmt/qm/src/qmInt.c index 11c80a2904..8079859b96 100644 --- a/source/dnode/mgmt/qm/src/qmInt.c +++ b/source/dnode/mgmt/qm/src/qmInt.c @@ -19,15 +19,10 @@ static int32_t qmRequire(SMgmtWrapper *pWrapper, bool *required) { return dndReadFile(pWrapper, required); } static void qmInitOption(SQnodeMgmt *pMgmt, SQnodeOpt *pOption) { - SMsgCb msgCb = {0}; - msgCb.pWrapper = pMgmt->pWrapper; + SMsgCb msgCb = dndCreateMsgcb(pMgmt->pWrapper); msgCb.queueFps[QUERY_QUEUE] = qmPutMsgToQueryQueue; msgCb.queueFps[FETCH_QUEUE] = qmPutMsgToFetchQueue; msgCb.qsizeFp = qmGetQueueSize; - msgCb.sendReqFp = dndSendReqToDnode; - msgCb.sendMnodeReqFp = dndSendReqToMnode; - msgCb.sendRspFp = dndSendRsp; - msgCb.registerBrokenLinkArgFp = dndRegisterBrokenLinkArg; pOption->msgCb = msgCb; } diff --git a/source/dnode/mgmt/sm/src/smInt.c b/source/dnode/mgmt/sm/src/smInt.c index a639fc76bb..6d2e2aaefd 100644 --- a/source/dnode/mgmt/sm/src/smInt.c +++ b/source/dnode/mgmt/sm/src/smInt.c @@ -19,12 +19,7 @@ static int32_t smRequire(SMgmtWrapper *pWrapper, bool *required) { return dndReadFile(pWrapper, required); } static void smInitOption(SSnodeMgmt *pMgmt, SSnodeOpt *pOption) { - SMsgCb msgCb = {0}; - msgCb.pWrapper = pMgmt->pWrapper; - msgCb.sendReqFp = dndSendReqToDnode; - msgCb.sendMnodeReqFp = dndSendReqToMnode; - msgCb.sendRspFp = dndSendRsp; - msgCb.registerBrokenLinkArgFp = dndRegisterBrokenLinkArg; + SMsgCb msgCb = dndCreateMsgcb(pMgmt->pWrapper); pOption->msgCb = msgCb; } diff --git a/source/dnode/mgmt/test/vnode/vnode.cpp b/source/dnode/mgmt/test/vnode/vnode.cpp index 39de533b73..40e7472d42 100644 --- a/source/dnode/mgmt/test/vnode/vnode.cpp +++ b/source/dnode/mgmt/test/vnode/vnode.cpp @@ -70,46 +70,6 @@ TEST_F(DndTestVnode, 01_Create_Vnode) { ASSERT_EQ(pRsp->code, TSDB_CODE_DND_VNODE_ALREADY_DEPLOYED); } } - - { - SCreateVnodeReq createReq = {0}; - createReq.vgId = 2; - createReq.dnodeId = 3; - strcpy(createReq.db, "1.d1"); - createReq.dbUid = 9527; - createReq.vgVersion = 1; - createReq.cacheBlockSize = 16; - createReq.totalBlocks = 10; - createReq.daysPerFile = 10; - createReq.daysToKeep0 = 3650; - createReq.daysToKeep1 = 3650; - createReq.daysToKeep2 = 3650; - createReq.minRows = 100; - createReq.minRows = 4096; - createReq.commitTime = 3600; - createReq.fsyncPeriod = 3000; - createReq.walLevel = 1; - createReq.precision = 0; - createReq.compression = 2; - createReq.replica = 1; - createReq.quorum = 1; - createReq.update = 0; - createReq.cacheLastRow = 0; - createReq.selfIndex = 0; - for (int r = 0; r < createReq.replica; ++r) { - SReplica* pReplica = &createReq.replicas[r]; - pReplica->id = 1; - pReplica->port = 9527; - } - - int32_t contLen = tSerializeSCreateVnodeReq(NULL, 0, &createReq); - void* pReq = rpcMallocCont(contLen); - tSerializeSCreateVnodeReq(pReq, contLen, &createReq); - - SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_VNODE, pReq, contLen); - ASSERT_NE(pRsp, nullptr); - ASSERT_EQ(pRsp->code, TSDB_CODE_DND_VNODE_INVALID_OPTION); - } } TEST_F(DndTestVnode, 02_Alter_Vnode) { diff --git a/source/dnode/mgmt/vm/src/vmInt.c b/source/dnode/mgmt/vm/src/vmInt.c index b52c6253dc..d9ef7b5ae6 100644 --- a/source/dnode/mgmt/vm/src/vmInt.c +++ b/source/dnode/mgmt/vm/src/vmInt.c @@ -128,16 +128,12 @@ static void *vmOpenVnodeFunc(void *param) { pMgmt->state.openVnodes, pMgmt->state.totalVnodes); dndReportStartup(pDnode, "open-vnodes", stepDesc); - SMsgCb msgCb = {0}; + SMsgCb msgCb = dndCreateMsgcb(pMgmt->pWrapper); msgCb.pWrapper = pMgmt->pWrapper; msgCb.queueFps[QUERY_QUEUE] = vmPutMsgToQueryQueue; msgCb.queueFps[FETCH_QUEUE] = vmPutMsgToFetchQueue; msgCb.queueFps[APPLY_QUEUE] = vmPutMsgToApplyQueue; msgCb.qsizeFp = vmGetQueueSize; - msgCb.sendReqFp = dndSendReqToDnode; - msgCb.sendMnodeReqFp = dndSendReqToMnode; - msgCb.sendRspFp = dndSendRsp; - msgCb.registerBrokenLinkArgFp = dndRegisterBrokenLinkArg; SVnodeCfg cfg = {.msgCb = msgCb, .pTfs = pMgmt->pTfs, .vgId = pCfg->vgId, .dbId = pCfg->dbUid}; SVnode *pImpl = vnodeOpen(pCfg->path, &cfg); if (pImpl == NULL) { diff --git a/source/dnode/mgmt/vm/src/vmMsg.c b/source/dnode/mgmt/vm/src/vmMsg.c index f00bb89354..c3ad74d246 100644 --- a/source/dnode/mgmt/vm/src/vmMsg.c +++ b/source/dnode/mgmt/vm/src/vmMsg.c @@ -68,12 +68,6 @@ int32_t vmProcessCreateVnodeReq(SVnodesMgmt *pMgmt, SNodeMsg *pMsg) { SWrapperCfg wrapperCfg = {0}; vmGenerateWrapperCfg(pMgmt, &createReq, &wrapperCfg); - if (createReq.dnodeId != pMgmt->pDnode->dnodeId) { - terrno = TSDB_CODE_DND_VNODE_INVALID_OPTION; - dDebug("vgId:%d, failed to create vnode since %s", createReq.vgId, terrstr()); - return -1; - } - SVnodeObj *pVnode = vmAcquireVnode(pMgmt, createReq.vgId); if (pVnode != NULL) { dDebug("vgId:%d, already exist", createReq.vgId); @@ -82,16 +76,12 @@ int32_t vmProcessCreateVnodeReq(SVnodesMgmt *pMgmt, SNodeMsg *pMsg) { return -1; } - SMsgCb msgCb = {0}; + SMsgCb msgCb = dndCreateMsgcb(pMgmt->pWrapper); msgCb.pWrapper = pMgmt->pWrapper; msgCb.queueFps[QUERY_QUEUE] = vmPutMsgToQueryQueue; msgCb.queueFps[FETCH_QUEUE] = vmPutMsgToFetchQueue; msgCb.queueFps[APPLY_QUEUE] = vmPutMsgToApplyQueue; msgCb.qsizeFp = vmGetQueueSize; - msgCb.sendReqFp = dndSendReqToDnode; - msgCb.sendMnodeReqFp = dndSendReqToMnode; - msgCb.sendRspFp = dndSendRsp; - msgCb.registerBrokenLinkArgFp = dndRegisterBrokenLinkArg; vnodeCfg.msgCb = msgCb; vnodeCfg.pTfs = pMgmt->pTfs; diff --git a/source/dnode/mnode/impl/inc/mndCluster.h b/source/dnode/mnode/impl/inc/mndCluster.h index 0206695b88..5b7bac4486 100644 --- a/source/dnode/mnode/impl/inc/mndCluster.h +++ b/source/dnode/mnode/impl/inc/mndCluster.h @@ -25,6 +25,7 @@ extern "C" { int32_t mndInitCluster(SMnode *pMnode); void mndCleanupCluster(SMnode *pMnode); int32_t mndGetClusterName(SMnode *pMnode, char *clusterName, int32_t len); +int64_t mndGetClusterId(SMnode *pMnode); #ifdef __cplusplus } diff --git a/source/dnode/mnode/impl/inc/mndInt.h b/source/dnode/mnode/impl/inc/mndInt.h index f89e9d8fe0..1cb0c78aa5 100644 --- a/source/dnode/mnode/impl/inc/mndInt.h +++ b/source/dnode/mnode/impl/inc/mndInt.h @@ -100,7 +100,6 @@ typedef struct { } SGrantInfo; typedef struct SMnode { - int32_t dnodeId; int64_t clusterId; int8_t replica; int8_t selfIndex; diff --git a/source/dnode/mnode/impl/src/mndCluster.c b/source/dnode/mnode/impl/src/mndCluster.c index dde7e1fe8f..94e1efde61 100644 --- a/source/dnode/mnode/impl/src/mndCluster.c +++ b/source/dnode/mnode/impl/src/mndCluster.c @@ -17,7 +17,7 @@ #include "mndCluster.h" #include "mndShow.h" -#define TSDB_CLUSTER_VER_NUMBE 1 +#define TSDB_CLUSTER_VER_NUMBE 1 #define TSDB_CLUSTER_RESERVE_SIZE 64 static SSdbRaw *mndClusterActionEncode(SClusterObj *pCluster); @@ -61,6 +61,23 @@ int32_t mndGetClusterName(SMnode *pMnode, char *clusterName, int32_t len) { return 0; } +int64_t mndGetClusterId(SMnode *pMnode) { + SSdb *pSdb = pMnode->pSdb; + void *pIter = NULL; + int64_t clusterId = -1; + + while (1) { + SClusterObj *pCluster = NULL; + pIter = sdbFetch(pSdb, SDB_CLUSTER, pIter, (void **)&pCluster); + if (pIter == NULL) break; + + clusterId = pCluster->id; + sdbRelease(pSdb, pCluster); + } + + return clusterId; +} + static SSdbRaw *mndClusterActionEncode(SClusterObj *pCluster) { terrno = TSDB_CODE_OUT_OF_MEMORY; diff --git a/source/dnode/mnode/impl/src/mndProfile.c b/source/dnode/mnode/impl/src/mndProfile.c index 6c38d8626c..cad89399a3 100644 --- a/source/dnode/mnode/impl/src/mndProfile.c +++ b/source/dnode/mnode/impl/src/mndProfile.c @@ -433,12 +433,6 @@ static int32_t mndProcessHeartBeatReq(SNodeMsg *pReq) { pHeartbeat->connId = htonl(pHeartbeat->connId); pHeartbeat->pid = htonl(pHeartbeat->pid); - SRpcConnInfo info = {0}; - if (rpcGetConnInfo(pReq->rpcMsg.handle, &info) != 0) { - mError("user:%s, connId:%d failed to process hb since %s", pReq->user, pHeartbeat->connId, terrstr()); - return -1; - } - SConnObj *pConn = mndAcquireConn(pMnode, pHeartbeat->connId); if (pConn == NULL) { pConn = mndCreateConn(pMnode, &info, pHeartbeat->pid, pHeartbeat->app, 0); diff --git a/source/dnode/mnode/impl/src/mndQnode.c b/source/dnode/mnode/impl/src/mndQnode.c index 4b19a26bc4..85718e2037 100644 --- a/source/dnode/mnode/impl/src/mndQnode.c +++ b/source/dnode/mnode/impl/src/mndQnode.c @@ -423,7 +423,7 @@ static int32_t mndProcessDropQnodeReq(SNodeMsg *pReq) { DROP_QNODE_OVER: if (code != 0 && code != TSDB_CODE_MND_ACTION_IN_PROGRESS) { - mError("qnode:%d, failed to drop since %s", pMnode->dnodeId, terrstr()); + mError("qnode:%d, failed to drop since %s", dropReq.dnodeId, terrstr()); } mndReleaseQnode(pMnode, pObj); diff --git a/source/dnode/mnode/impl/src/mndSnode.c b/source/dnode/mnode/impl/src/mndSnode.c index 5e0d9fae9a..4f24c6f7eb 100644 --- a/source/dnode/mnode/impl/src/mndSnode.c +++ b/source/dnode/mnode/impl/src/mndSnode.c @@ -433,7 +433,7 @@ static int32_t mndProcessDropSnodeReq(SNodeMsg *pReq) { DROP_SNODE_OVER: if (code != 0 && code != TSDB_CODE_MND_ACTION_IN_PROGRESS) { - mError("snode:%d, failed to drop since %s", pMnode->dnodeId, terrstr()); + mError("snode:%d, failed to drop since %s", dropReq.dnodeId, terrstr()); } mndReleaseSnode(pMnode, pObj); diff --git a/source/dnode/mnode/impl/src/mndStb.c b/source/dnode/mnode/impl/src/mndStb.c index f3fda102f4..85e7ade462 100644 --- a/source/dnode/mnode/impl/src/mndStb.c +++ b/source/dnode/mnode/impl/src/mndStb.c @@ -354,6 +354,7 @@ static void *mndBuildVCreateStbReq(SMnode *pMnode, SVgObj *pVgroup, SStbObj *pSt req.name = (char *)tNameGetTableName(&name); req.ttl = 0; req.keep = 0; + req.rollup = pStb->aggregationMethod > -1 ? 1 : 0; req.type = TD_SUPER_TABLE; req.stbCfg.suid = pStb->uid; req.stbCfg.nCols = pStb->numOfColumns; @@ -365,7 +366,7 @@ static void *mndBuildVCreateStbReq(SMnode *pMnode, SVgObj *pVgroup, SStbObj *pSt terrno = TSDB_CODE_OUT_OF_MEMORY; return NULL; } - + int bSmaStat = 0; // no column has bsma if (pStb->numOfSmas == pStb->numOfColumns) { // assume pColumns > 0 bSmaStat = 1; // all columns have bsma @@ -405,9 +406,38 @@ static void *mndBuildVCreateStbReq(SMnode *pMnode, SVgObj *pVgroup, SStbObj *pSt } } + SRSmaParam *pRSmaParam = NULL; + if (req.rollup) { + pRSmaParam = (SRSmaParam *)taosMemoryCalloc(1, sizeof(SRSmaParam)); + if (pRSmaParam == NULL) { + taosMemoryFreeClear(req.stbCfg.pSchema); + terrno = TSDB_CODE_OUT_OF_MEMORY; + return NULL; + } + + pRSmaParam->xFilesFactor = pStb->xFilesFactor; + pRSmaParam->delay = pStb->delay; + pRSmaParam->nFuncIds = 1; // only 1 aggregation method supported currently + pRSmaParam->pFuncIds = (func_id_t *)taosMemoryCalloc(pRSmaParam->nFuncIds, sizeof(func_id_t)); + if (pRSmaParam->pFuncIds == NULL) { + taosMemoryFreeClear(req.stbCfg.pRSmaParam); + taosMemoryFreeClear(req.stbCfg.pSchema); + terrno = TSDB_CODE_OUT_OF_MEMORY; + return NULL; + } + for (int32_t f = 0; f < pRSmaParam->nFuncIds; ++f) { + *(pRSmaParam->pFuncIds + f) = pStb->aggregationMethod; + } + req.stbCfg.pRSmaParam = pRSmaParam; + } + int32_t contLen = tSerializeSVCreateTbReq(NULL, &req) + sizeof(SMsgHead); SMsgHead *pHead = taosMemoryMalloc(contLen); if (pHead == NULL) { + if (pRSmaParam) { + taosMemoryFreeClear(pRSmaParam->pFuncIds); + taosMemoryFreeClear(pRSmaParam); + } taosMemoryFreeClear(req.stbCfg.pSchema); terrno = TSDB_CODE_OUT_OF_MEMORY; return NULL; @@ -420,6 +450,10 @@ static void *mndBuildVCreateStbReq(SMnode *pMnode, SVgObj *pVgroup, SStbObj *pSt tSerializeSVCreateTbReq(&pBuf, &req); *pContLen = contLen; + if (pRSmaParam) { + taosMemoryFreeClear(pRSmaParam->pFuncIds); + taosMemoryFreeClear(pRSmaParam); + } taosMemoryFreeClear(req.stbCfg.pSchema); return pHead; } @@ -632,6 +666,9 @@ static int32_t mndCreateStb(SMnode *pMnode, SNodeMsg *pReq, SMCreateStbReq *pCre stbObj.dbUid = pDb->uid; stbObj.version = 1; stbObj.nextColId = 1; + stbObj.xFilesFactor = pCreate->xFilesFactor; + stbObj.aggregationMethod = pCreate->aggregationMethod; + stbObj.delay = pCreate->delay; stbObj.ttl = pCreate->ttl; stbObj.numOfColumns = pCreate->numOfColumns; stbObj.numOfTags = pCreate->numOfTags; diff --git a/source/dnode/mnode/impl/src/mnode.c b/source/dnode/mnode/impl/src/mnode.c index 67b7d6dd45..5c3dd778e1 100644 --- a/source/dnode/mnode/impl/src/mnode.c +++ b/source/dnode/mnode/impl/src/mnode.c @@ -187,7 +187,7 @@ static int32_t mndAllocStep(SMnode *pMnode, char *name, MndInitFp initFp, MndCle return 0; } -static int32_t mndInitSteps(SMnode *pMnode) { +static int32_t mndInitSteps(SMnode *pMnode, bool deploy) { if (mndAllocStep(pMnode, "mnode-sdb", mndInitSdb, mndCleanupSdb) != 0) return -1; if (mndAllocStep(pMnode, "mnode-trans", mndInitTrans, mndCleanupTrans) != 0) return -1; if (mndAllocStep(pMnode, "mnode-cluster", mndInitCluster, mndCleanupCluster) != 0) return -1; @@ -210,7 +210,7 @@ static int32_t mndInitSteps(SMnode *pMnode) { if (mndAllocStep(pMnode, "mnode-infos", mndInitInfos, mndCleanupInfos) != 0) return -1; if (mndAllocStep(pMnode, "mnode-db", mndInitDb, mndCleanupDb) != 0) return -1; if (mndAllocStep(pMnode, "mnode-func", mndInitFunc, mndCleanupFunc) != 0) return -1; - if (pMnode->clusterId <= 0) { + if (deploy) { if (mndAllocStep(pMnode, "mnode-sdb-deploy", mndDeploySdb, NULL) != 0) return -1; } else { if (mndAllocStep(pMnode, "mnode-sdb-read", mndReadSdb, NULL) != 0) return -1; @@ -263,23 +263,15 @@ static int32_t mndExecSteps(SMnode *pMnode) { } } + pMnode->clusterId = mndGetClusterId(pMnode); return 0; } -static int32_t mndSetOptions(SMnode *pMnode, const SMnodeOpt *pOption) { - pMnode->dnodeId = pOption->dnodeId; - pMnode->clusterId = pOption->clusterId; +static void mndSetOptions(SMnode *pMnode, const SMnodeOpt *pOption) { pMnode->replica = pOption->replica; pMnode->selfIndex = pOption->selfIndex; memcpy(&pMnode->replicas, pOption->replicas, sizeof(SReplica) * TSDB_MAX_REPLICA); pMnode->msgCb = pOption->msgCb; - - if (pMnode->dnodeId < 0 || pMnode->clusterId < 0) { - terrno = TSDB_CODE_MND_INVALID_OPTIONS; - return -1; - } - - return 0; } SMnode *mndOpen(const char *path, const SMnodeOpt *pOption) { @@ -294,6 +286,7 @@ SMnode *mndOpen(const char *path, const SMnodeOpt *pOption) { char timestr[24] = "1970-01-01 00:00:00.00"; (void)taosParseTime(timestr, &pMnode->checkTime, (int32_t)strlen(timestr), TSDB_TIME_PRECISION_MILLI, 0); + mndSetOptions(pMnode, pOption); pMnode->pSteps = taosArrayInit(24, sizeof(SMnodeStep)); if (pMnode->pSteps == NULL) { @@ -312,16 +305,7 @@ SMnode *mndOpen(const char *path, const SMnodeOpt *pOption) { return NULL; } - code = mndSetOptions(pMnode, pOption); - if (code != 0) { - code = terrno; - mError("failed to open mnode since %s", terrstr()); - mndClose(pMnode); - terrno = code; - return NULL; - } - - code = mndInitSteps(pMnode); + code = mndInitSteps(pMnode, pOption->deploy); if (code != 0) { code = terrno; mError("failed to open mnode since %s", terrstr()); diff --git a/source/dnode/vnode/src/vnd/vnodeWrite.c b/source/dnode/vnode/src/vnd/vnodeWrite.c index 59b027e370..7ef0b50402 100644 --- a/source/dnode/vnode/src/vnd/vnodeWrite.c +++ b/source/dnode/vnode/src/vnd/vnodeWrite.c @@ -78,10 +78,13 @@ int vnodeApplyWMsg(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) { // TODO: handle error } - // TODO: maybe need to clear the request struct + // TODO: to encapsule a free API taosMemoryFree(vCreateTbReq.stbCfg.pSchema); taosMemoryFree(vCreateTbReq.stbCfg.pTagSchema); - taosMemoryFree(vCreateTbReq.stbCfg.pRSmaParam); + if(vCreateTbReq.stbCfg.pRSmaParam) { + taosMemoryFree(vCreateTbReq.stbCfg.pRSmaParam->pFuncIds); + taosMemoryFree(vCreateTbReq.stbCfg.pRSmaParam); + } taosMemoryFree(vCreateTbReq.dbFName); taosMemoryFree(vCreateTbReq.name); break; @@ -110,17 +113,24 @@ int vnodeApplyWMsg(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) { // TODO: handle error vError("vgId:%d, failed to create table: %s", pVnode->vgId, pCreateTbReq->name); } + // TODO: to encapsule a free API taosMemoryFree(pCreateTbReq->name); taosMemoryFree(pCreateTbReq->dbFName); if (pCreateTbReq->type == TD_SUPER_TABLE) { taosMemoryFree(pCreateTbReq->stbCfg.pSchema); taosMemoryFree(pCreateTbReq->stbCfg.pTagSchema); - taosMemoryFree(pCreateTbReq->stbCfg.pRSmaParam); + if (pCreateTbReq->stbCfg.pRSmaParam) { + taosMemoryFree(pCreateTbReq->stbCfg.pRSmaParam->pFuncIds); + taosMemoryFree(pCreateTbReq->stbCfg.pRSmaParam); + } } else if (pCreateTbReq->type == TD_CHILD_TABLE) { taosMemoryFree(pCreateTbReq->ctbCfg.pTag); } else { taosMemoryFree(pCreateTbReq->ntbCfg.pSchema); - taosMemoryFree(pCreateTbReq->ntbCfg.pRSmaParam); + if (pCreateTbReq->ntbCfg.pRSmaParam) { + taosMemoryFree(pCreateTbReq->ntbCfg.pRSmaParam->pFuncIds); + taosMemoryFree(pCreateTbReq->ntbCfg.pRSmaParam); + } } } @@ -145,9 +155,13 @@ int vnodeApplyWMsg(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) { SVCreateTbReq vAlterTbReq = {0}; vTrace("vgId:%d, process alter stb req", pVnode->vgId); tDeserializeSVCreateTbReq(POINTER_SHIFT(pMsg->pCont, sizeof(SMsgHead)), &vAlterTbReq); + // TODO: to encapsule a free API taosMemoryFree(vAlterTbReq.stbCfg.pSchema); taosMemoryFree(vAlterTbReq.stbCfg.pTagSchema); - taosMemoryFree(vAlterTbReq.stbCfg.pRSmaParam); + if (vAlterTbReq.stbCfg.pRSmaParam) { + taosMemoryFree(vAlterTbReq.stbCfg.pRSmaParam->pFuncIds); + taosMemoryFree(vAlterTbReq.stbCfg.pRSmaParam); + } taosMemoryFree(vAlterTbReq.dbFName); taosMemoryFree(vAlterTbReq.name); break; diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index 6cb95b9a3e..b238af06a3 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -3026,11 +3026,27 @@ int32_t loadDataBlock(SExecTaskInfo* pTaskInfo, STableScanInfo* pTableScanInfo, int8_t* rowRes = NULL; bool keep = filterExecute(filter, pBlock, &rowRes, NULL, param1.numOfCols); -// filterSetColFieldData(pQueryAttr->pFilters, pBlock->info.numOfCols, pBlock->pDataBlock); + SSDataBlock* px = createOneDataBlock(pBlock); + blockDataEnsureCapacity(px, pBlock->info.rows); -// if (pQueryAttr->pFilters != NULL) { -// filterColRowsInDataBlock(pRuntimeEnv, pBlock, ascQuery); -// } + int32_t numOfRow = 0; + for (int32_t i = 0; i < pBlock->info.numOfCols; ++i) { + SColumnInfoData* pDst = taosArrayGet(px->pDataBlock, i); + SColumnInfoData* pSrc = taosArrayGet(pBlock->pDataBlock, i); + + numOfRow = 0; + for (int32_t j = 0; j < pBlock->info.rows; ++j) { + if (rowRes[j] == 0) { + continue; + } + + colDataAppend(pDst, numOfRow, colDataGetData(pSrc, j), false); + numOfRow += 1; + } + *pSrc = *pDst; + } + + pBlock->info.rows = numOfRow; } return TSDB_CODE_SUCCESS; diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index c63c67af28..126117f982 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -441,6 +441,16 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .initFunc = NULL, .sprocessFunc = winDurFunction, .finalizeFunc = NULL + }, + { + .name = "now", + .type = FUNCTION_TYPE_NOW, + .classification = FUNC_MGT_SCALAR_FUNC | FUNC_MGT_DATETIME_FUNC, + .checkFunc = stubCheckAndGetResultType, + .getEnvFunc = getTimePseudoFuncEnv, + .initFunc = NULL, + .sprocessFunc = winDurFunction, + .finalizeFunc = NULL } }; @@ -568,6 +578,9 @@ int32_t stubCheckAndGetResultType(SFunctionNode* pFunc) { break; } + case FUNCTION_TYPE_NOW: + // todo + break; default: ASSERT(0); // to found the fault ASAP. } diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index 732d9acfbe..90f06c6c9c 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -860,6 +860,24 @@ bool nodesIsExprNode(const SNode* pNode) { return (QUERY_NODE_COLUMN == type || QUERY_NODE_VALUE == type || QUERY_NODE_OPERATOR == type || QUERY_NODE_FUNCTION == type); } +bool nodesIsUnaryOp(const SOperatorNode* pOp) { + switch (pOp->opType) { + case OP_TYPE_MINUS: + case OP_TYPE_IS_NULL: + case OP_TYPE_IS_NOT_NULL: + case OP_TYPE_IS_TRUE: + case OP_TYPE_IS_FALSE: + case OP_TYPE_IS_UNKNOWN: + case OP_TYPE_IS_NOT_TRUE: + case OP_TYPE_IS_NOT_FALSE: + case OP_TYPE_IS_NOT_UNKNOWN: + return true; + default: + break; + } + return false; +} + bool nodesIsArithmeticOp(const SOperatorNode* pOp) { switch (pOp->opType) { case OP_TYPE_ADD: diff --git a/source/libs/parser/inc/parInsertData.h b/source/libs/parser/inc/parInsertData.h index dbf7d379ec..5894fc88cc 100644 --- a/source/libs/parser/inc/parInsertData.h +++ b/source/libs/parser/inc/parInsertData.h @@ -77,7 +77,6 @@ typedef struct STableDataBlocks { STableMeta *pTableMeta; // the tableMeta of current table, the table meta will be used during submit, keep a ref to avoid to be removed from cache char *pData; bool cloned; - STagData tagData; SParsedDataColInfo boundColumnInfo; SRowBuilder rowBuilder; diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index 29b1d8857a..4ae33e5c5c 100644 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -513,7 +513,7 @@ expression(A) ::= NK_PLUS(B) expression(C). } expression(A) ::= NK_MINUS(B) expression(C). { SToken t = getTokenFromRawExprNode(pCxt, C); - A = createRawExprNodeExt(pCxt, &B, &t, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, C), NULL)); + A = createRawExprNodeExt(pCxt, &B, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, C), NULL)); } expression(A) ::= expression(B) NK_PLUS expression(C). { SToken s = getTokenFromRawExprNode(pCxt, B); @@ -549,38 +549,14 @@ expression_list(A) ::= expression_list(B) NK_COMMA expression(C). column_reference(A) ::= column_name(B). { A = createRawExprNode(pCxt, &B, createColumnNode(pCxt, NULL, &B)); } column_reference(A) ::= table_name(B) NK_DOT column_name(C). { A = createRawExprNodeExt(pCxt, &B, &C, createColumnNode(pCxt, &B, &C)); } -//pseudo_column(A) ::= NK_NOW. { A = createFunctionNode(pCxt, NULL, NULL); } -pseudo_column(A) ::= NK_UNDERLINE(B) ROWTS(C). { - SToken t = B; - t.n = (C.z + C.n) - B.z; - A = createRawExprNode(pCxt, &t, createFunctionNode(pCxt, &t, NULL)); - } +pseudo_column(A) ::= NOW(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } +pseudo_column(A) ::= ROWTS(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } pseudo_column(A) ::= TBNAME(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } -pseudo_column(A) ::= NK_UNDERLINE(B) QSTARTTS(C). { - SToken t = B; - t.n = (C.z + C.n) - B.z; - A = createRawExprNode(pCxt, &t, createFunctionNode(pCxt, &t, NULL)); - } -pseudo_column(A) ::= NK_UNDERLINE(B) QENDTS(C). { - SToken t = B; - t.n = (C.z + C.n) - B.z; - A = createRawExprNode(pCxt, &t, createFunctionNode(pCxt, &t, NULL)); - } -pseudo_column(A) ::= NK_UNDERLINE(B) WSTARTTS(C). { - SToken t = B; - t.n = (C.z + C.n) - B.z; - A = createRawExprNode(pCxt, &t, createFunctionNode(pCxt, &t, NULL)); - } -pseudo_column(A) ::= NK_UNDERLINE(B) WENDTS(C). { - SToken t = B; - t.n = (C.z + C.n) - B.z; - A = createRawExprNode(pCxt, &t, createFunctionNode(pCxt, &t, NULL)); - } -pseudo_column(A) ::= NK_UNDERLINE(B) WDURATION(C). { - SToken t = B; - t.n = (C.z + C.n) - B.z; - A = createRawExprNode(pCxt, &t, createFunctionNode(pCxt, &t, NULL)); - } +pseudo_column(A) ::= QSTARTTS(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } +pseudo_column(A) ::= QENDTS(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } +pseudo_column(A) ::= WSTARTTS(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } +pseudo_column(A) ::= WENDTS(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } +pseudo_column(A) ::= WDURATION(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } /************************************************ predicate ***********************************************************/ predicate(A) ::= expression(B) compare_op(C) expression(D). { diff --git a/source/libs/parser/src/parInsert.c b/source/libs/parser/src/parInsert.c index 11b552fb94..d7eb31b6cd 100644 --- a/source/libs/parser/src/parInsert.c +++ b/source/libs/parser/src/parInsert.c @@ -55,8 +55,10 @@ typedef struct SInsertParseContext { STableMeta* pTableMeta; // each table SParsedDataColInfo tags; // each table SKVRowBuilder tagsBuilder; // each table + SVCreateTbReq createTblReq; // each table SHashObj* pVgroupsHashObj; // global SHashObj* pTableBlockHashObj; // global + SHashObj* pSubTableHashObj; // global SArray* pTableDataBlocks; // global SArray* pVgDataBlocks; // global int32_t totalNum; @@ -738,8 +740,20 @@ static int32_t KvRowAppend(SMsgBuf* pMsgBuf, const void *value, int32_t len, voi return TSDB_CODE_SUCCESS; } +static int32_t buildCreateTbReq(SInsertParseContext* pCxt, const SName* pName, SKVRow row) { + char dbFName[TSDB_DB_FNAME_LEN] = {0}; + tNameGetFullDbName(pName, dbFName); + pCxt->createTblReq.type = TD_CHILD_TABLE; + pCxt->createTblReq.dbFName = strdup(dbFName); + pCxt->createTblReq.name = strdup(pName->tname); + pCxt->createTblReq.ctbCfg.suid = pCxt->pTableMeta->suid; + pCxt->createTblReq.ctbCfg.pTag = row; + + return TSDB_CODE_SUCCESS; +} + // pSql -> tag1_value, ...) -static int32_t parseTagsClause(SInsertParseContext* pCxt, SSchema* pTagsSchema, uint8_t precision) { +static int32_t parseTagsClause(SInsertParseContext* pCxt, SSchema* pTagsSchema, uint8_t precision, const SName* pName) { if (tdInitKVRowBuilder(&pCxt->tagsBuilder) < 0) { return TSDB_CODE_TSC_OUT_OF_MEMORY; } @@ -760,23 +774,46 @@ static int32_t parseTagsClause(SInsertParseContext* pCxt, SSchema* pTagsSchema, } tdSortKVRowByColIdx(row); - // todo construct payload + return buildCreateTbReq(pCxt, pName, row); +} - taosMemoryFreeClear(row); +static int32_t cloneTableMeta(STableMeta* pSrc, STableMeta** pDst) { + *pDst = taosMemoryMalloc(TABLE_META_SIZE(pSrc)); + if (NULL == *pDst) { + return TSDB_CODE_TSC_OUT_OF_MEMORY; + } + memcpy(*pDst, pSrc, TABLE_META_SIZE(pSrc)); + return TSDB_CODE_SUCCESS; +} - return 0; +static int32_t storeTableMeta(SHashObj* pHash, const char* pName, int32_t len, STableMeta* pMeta) { + STableMeta* pBackup = NULL; + if (TSDB_CODE_SUCCESS != cloneTableMeta(pMeta, &pBackup)) { + return TSDB_CODE_TSC_OUT_OF_MEMORY; + } + return taosHashPut(pHash, pName, len, &pBackup, POINTER_BYTES); } // pSql -> stb_name [(tag1_name, ...)] TAGS (tag1_value, ...) static int32_t parseUsingClause(SInsertParseContext* pCxt, SToken* pTbnameToken) { - SToken sToken; + SName name; + createSName(&name, pTbnameToken, pCxt->pComCxt, &pCxt->msg); + char tbFName[TSDB_TABLE_FNAME_LEN]; + tNameExtractFullName(&name, tbFName); + int32_t len = strlen(tbFName); + STableMeta** pMeta = taosHashGet(pCxt->pSubTableHashObj, tbFName, len); + if (NULL != pMeta) { + return cloneTableMeta(*pMeta, &pCxt->pTableMeta); + } + SToken sToken; // pSql -> stb_name [(tag1_name, ...)] TAGS (tag1_value, ...) NEXT_TOKEN(pCxt->pSql, sToken); CHECK_CODE(getTableMeta(pCxt, &sToken)); if (TSDB_SUPER_TABLE != pCxt->pTableMeta->tableType) { return buildInvalidOperationMsg(&pCxt->msg, "create table only from super table is allowed"); } + CHECK_CODE(storeTableMeta(pCxt->pSubTableHashObj, tbFName, len, pCxt->pTableMeta)); SSchema* pTagsSchema = getTableTagSchema(pCxt->pTableMeta); setBoundColumnInfo(&pCxt->tags, pTagsSchema, getNumOfTags(pCxt->pTableMeta)); @@ -796,7 +833,7 @@ static int32_t parseUsingClause(SInsertParseContext* pCxt, SToken* pTbnameToken) if (TK_NK_LP != sToken.type) { return buildSyntaxErrMsg(&pCxt->msg, "( is expected", sToken.z); } - CHECK_CODE(parseTagsClause(pCxt, pTagsSchema, getTableInfo(pCxt->pTableMeta).precision)); + CHECK_CODE(parseTagsClause(pCxt, pTagsSchema, getTableInfo(pCxt->pTableMeta).precision, &name)); return TSDB_CODE_SUCCESS; } @@ -904,10 +941,17 @@ static int32_t parseValuesClause(SInsertParseContext* pCxt, STableDataBlocks* da return TSDB_CODE_SUCCESS; } +static void destroyCreateSubTbReq(SVCreateTbReq* pReq) { + taosMemoryFreeClear(pReq->dbFName); + taosMemoryFreeClear(pReq->name); + taosMemoryFreeClear(pReq->ctbCfg.pTag); +} + static void destroyInsertParseContextForTable(SInsertParseContext* pCxt) { taosMemoryFreeClear(pCxt->pTableMeta); destroyBoundColumnInfo(&pCxt->tags); tdDestroyKVRowBuilder(&pCxt->tagsBuilder); + destroyCreateSubTbReq(&pCxt->createTblReq); } static void destroyDataBlock(STableDataBlocks* pDataBlock) { @@ -972,7 +1016,7 @@ static int32_t parseInsertBody(SInsertParseContext* pCxt) { STableDataBlocks *dataBuf = NULL; CHECK_CODE(getDataBlockFromList(pCxt->pTableBlockHashObj, pCxt->pTableMeta->uid, TSDB_DEFAULT_PAYLOAD_SIZE, sizeof(SSubmitBlk), getTableInfo(pCxt->pTableMeta).rowSize, pCxt->pTableMeta, &dataBuf, NULL)); - + if (TK_NK_LP == sToken.type) { // pSql -> field1_name, ...) CHECK_CODE(parseBoundColumns(pCxt, &dataBuf->boundColumnInfo, getTableColumnSchema(pCxt->pTableMeta))); @@ -1021,11 +1065,13 @@ int32_t parseInsertSql(SParseContext* pContext, SQuery** pQuery) { .pTableMeta = NULL, .pVgroupsHashObj = taosHashInit(128, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, false), .pTableBlockHashObj = taosHashInit(128, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), true, false), + .pSubTableHashObj = taosHashInit(128, taosGetDefaultHashFunction(TSDB_DATA_TYPE_VARCHAR), true, false), .totalNum = 0, .pOutput = (SVnodeModifOpStmt*)nodesMakeNode(QUERY_NODE_VNODE_MODIF_STMT) }; - if (NULL == context.pVgroupsHashObj || NULL == context.pTableBlockHashObj || NULL == context.pOutput) { + if (NULL == context.pVgroupsHashObj || NULL == context.pTableBlockHashObj || + NULL == context.pSubTableHashObj || NULL == context.pOutput) { return TSDB_CODE_TSC_OUT_OF_MEMORY; } diff --git a/source/libs/parser/src/parTokenizer.c b/source/libs/parser/src/parTokenizer.c index d89bee6fdc..21191563e1 100644 --- a/source/libs/parser/src/parTokenizer.c +++ b/source/libs/parser/src/parTokenizer.c @@ -125,10 +125,10 @@ static SKeyword keywordTable[] = { {"PRECISION", TK_PRECISION}, {"PRIVILEGE", TK_PRIVILEGE}, {"PREV", TK_PREV}, - {"QENDTS", TK_QENDTS}, + {"_QENDTS", TK_QENDTS}, {"QNODE", TK_QNODE}, {"QNODES", TK_QNODES}, - {"QSTARTTS", TK_QSTARTTS}, + {"_QSTARTTS", TK_QSTARTTS}, {"QTIME", TK_QTIME}, {"QUERIES", TK_QUERIES}, {"QUERY", TK_QUERY}, @@ -138,7 +138,7 @@ static SKeyword keywordTable[] = { {"RESET", TK_RESET}, {"RETENTIONS", TK_RETENTIONS}, {"ROLLUP", TK_ROLLUP}, - {"ROWTS", TK_ROWTS}, + {"_ROWTS", TK_ROWTS}, {"SCORES", TK_SCORES}, {"SELECT", TK_SELECT}, {"SESSION", TK_SESSION}, @@ -184,10 +184,10 @@ static SKeyword keywordTable[] = { {"VGROUPS", TK_VGROUPS}, {"VNODES", TK_VNODES}, {"WAL", TK_WAL}, - {"WDURATION", TK_WDURATION}, - {"WENDTS", TK_WENDTS}, + {"_WDURATION", TK_WDURATION}, + {"_WENDTS", TK_WENDTS}, {"WHERE", TK_WHERE}, - {"WSTARTTS", TK_WSTARTTS}, + {"_WSTARTTS", TK_WSTARTTS}, // {"ID", TK_ID}, // {"STRING", TK_STRING}, // {"EQ", TK_EQ}, @@ -440,10 +440,6 @@ uint32_t tGetToken(const char* z, uint32_t* tokenId) { *tokenId = TK_NK_QUESTION; return 1; } - case '_': { - *tokenId = TK_NK_UNDERLINE; - return 1; - } case '`': case '\'': case '"': { diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 4191e3dae0..773060beab 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -439,6 +439,9 @@ static EDealRes translateValue(STranslateContext* pCxt, SValueNode* pVal) { } static EDealRes translateOperator(STranslateContext* pCxt, SOperatorNode* pOp) { + if (nodesIsUnaryOp(pOp)) { + return DEAL_RES_CONTINUE; + } SDataType ldt = ((SExprNode*)(pOp->pLeft))->resType; SDataType rdt = ((SExprNode*)(pOp->pRight))->resType; if (nodesIsArithmeticOp(pOp)) { diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index 618e80cbfe..86e564adab 100644 --- a/source/libs/parser/src/sql.c +++ b/source/libs/parser/src/sql.c @@ -132,17 +132,17 @@ typedef union { #define ParseCTX_PARAM #define ParseCTX_FETCH #define ParseCTX_STORE -#define YYNSTATE 512 -#define YYNRULE 389 +#define YYNSTATE 511 +#define YYNRULE 390 #define YYNTOKEN 201 -#define YY_MAX_SHIFT 511 +#define YY_MAX_SHIFT 510 #define YY_MIN_SHIFTREDUCE 762 -#define YY_MAX_SHIFTREDUCE 1150 -#define YY_ERROR_ACTION 1151 -#define YY_ACCEPT_ACTION 1152 -#define YY_NO_ACTION 1153 -#define YY_MIN_REDUCE 1154 -#define YY_MAX_REDUCE 1542 +#define YY_MAX_SHIFTREDUCE 1151 +#define YY_ERROR_ACTION 1152 +#define YY_ACCEPT_ACTION 1153 +#define YY_NO_ACTION 1154 +#define YY_MIN_REDUCE 1155 +#define YY_MAX_REDUCE 1544 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -209,297 +209,300 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (1412) +#define YY_ACTTAB_COUNT (1448) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 1398, 24, 191, 442, 442, 504, 503, 253, 1307, 72, - /* 10 */ 72, 270, 1394, 1401, 252, 307, 349, 355, 233, 1305, - /* 20 */ 1010, 1197, 1155, 442, 1398, 1260, 1260, 319, 1398, 305, - /* 30 */ 331, 31, 29, 27, 26, 25, 1394, 1400, 429, 332, - /* 40 */ 1394, 1400, 234, 84, 1348, 1260, 83, 82, 81, 80, - /* 50 */ 79, 78, 77, 76, 75, 273, 31, 29, 27, 26, - /* 60 */ 25, 429, 1338, 1340, 265, 213, 236, 1347, 1290, 441, - /* 70 */ 496, 495, 494, 493, 492, 491, 490, 489, 207, 486, - /* 80 */ 485, 484, 483, 482, 481, 480, 479, 478, 998, 1026, - /* 90 */ 31, 29, 27, 26, 25, 84, 441, 1056, 83, 82, - /* 100 */ 81, 80, 79, 78, 77, 76, 75, 330, 1154, 442, - /* 110 */ 325, 324, 323, 322, 321, 306, 318, 317, 316, 315, - /* 120 */ 311, 310, 309, 308, 442, 236, 27, 26, 25, 340, - /* 130 */ 312, 1260, 93, 92, 91, 90, 89, 88, 87, 86, - /* 140 */ 85, 1428, 362, 1057, 357, 12, 1260, 361, 426, 1012, - /* 150 */ 160, 442, 358, 356, 1001, 359, 1056, 313, 404, 399, - /* 160 */ 410, 1061, 874, 465, 464, 463, 878, 462, 880, 881, - /* 170 */ 461, 883, 458, 1260, 889, 455, 891, 892, 452, 449, - /* 180 */ 400, 126, 98, 1010, 23, 260, 1051, 1052, 1053, 1054, - /* 190 */ 1055, 1059, 1060, 20, 112, 1412, 300, 1013, 299, 219, - /* 200 */ 385, 266, 1057, 31, 29, 27, 26, 25, 442, 111, - /* 210 */ 111, 217, 405, 401, 339, 96, 1428, 1262, 1263, 292, - /* 220 */ 1061, 136, 1251, 426, 412, 121, 1467, 1468, 1177, 1472, - /* 230 */ 1260, 477, 301, 428, 294, 126, 113, 1385, 1166, 1412, - /* 240 */ 1011, 386, 414, 23, 260, 1051, 1052, 1053, 1054, 1055, - /* 250 */ 1059, 1060, 126, 68, 1413, 1414, 1417, 1460, 30, 28, - /* 260 */ 1428, 235, 1456, 1521, 1385, 442, 262, 426, 990, 468, - /* 270 */ 1385, 1257, 1521, 1521, 1249, 1412, 125, 428, 990, 159, - /* 280 */ 1519, 1385, 67, 352, 988, 125, 125, 1260, 1117, 1519, - /* 290 */ 1519, 1374, 49, 11, 988, 6, 1428, 70, 1413, 1414, - /* 300 */ 1417, 1460, 95, 413, 354, 1459, 1456, 45, 44, 304, - /* 310 */ 1255, 130, 1245, 428, 1200, 1, 298, 1385, 396, 1115, - /* 320 */ 1116, 1118, 1119, 410, 242, 442, 290, 284, 286, 282, - /* 330 */ 127, 439, 441, 69, 1413, 1414, 1417, 1460, 508, 126, - /* 340 */ 326, 255, 1456, 120, 1428, 98, 1247, 1260, 508, 49, - /* 350 */ 989, 426, 126, 442, 1014, 187, 30, 28, 1093, 440, - /* 360 */ 989, 392, 1487, 362, 262, 357, 990, 1256, 361, 30, - /* 370 */ 28, 160, 1412, 358, 356, 1260, 359, 262, 96, 990, - /* 380 */ 1243, 12, 988, 403, 991, 135, 134, 1176, 122, 1467, - /* 390 */ 1468, 11, 1472, 1428, 991, 988, 9, 8, 117, 1238, - /* 400 */ 413, 994, 995, 224, 11, 1039, 114, 272, 1224, 1300, - /* 410 */ 428, 994, 995, 1, 1385, 111, 1412, 31, 29, 27, - /* 420 */ 26, 25, 126, 1262, 65, 1412, 1, 1088, 1152, 1385, - /* 430 */ 69, 1413, 1414, 1417, 1460, 99, 508, 1428, 255, 1456, - /* 440 */ 120, 1307, 1252, 1521, 426, 340, 1428, 267, 989, 508, - /* 450 */ 165, 1307, 1305, 426, 428, 1058, 1520, 274, 1385, 1488, - /* 460 */ 1519, 989, 1305, 428, 186, 1069, 1038, 1385, 1040, 1041, - /* 470 */ 1042, 1043, 1044, 1062, 227, 1413, 1414, 1417, 277, 467, - /* 480 */ 30, 28, 991, 69, 1413, 1414, 1417, 1460, 262, 1412, - /* 490 */ 990, 255, 1456, 1533, 131, 991, 21, 1175, 1236, 994, - /* 500 */ 995, 224, 1494, 1039, 1412, 384, 988, 275, 417, 1521, - /* 510 */ 1428, 1174, 994, 995, 224, 111, 1039, 426, 47, 410, - /* 520 */ 1015, 46, 125, 1262, 1307, 1428, 1519, 428, 1173, 798, - /* 530 */ 1092, 1385, 426, 1412, 1474, 1339, 1147, 7, 799, 1385, - /* 540 */ 798, 98, 428, 1167, 477, 347, 1385, 69, 1413, 1414, - /* 550 */ 1417, 1460, 1471, 1385, 1428, 255, 1456, 1533, 800, 188, - /* 560 */ 508, 426, 230, 1413, 1414, 1417, 1517, 1100, 1225, 1172, - /* 570 */ 1385, 428, 989, 1012, 96, 1385, 442, 1171, 1474, 30, - /* 580 */ 28, 427, 205, 1335, 123, 1467, 1468, 262, 1472, 990, - /* 590 */ 133, 69, 1413, 1414, 1417, 1460, 1470, 1170, 1260, 255, - /* 600 */ 1456, 1533, 1146, 1474, 22, 988, 991, 1412, 1169, 376, - /* 610 */ 1478, 1385, 30, 28, 31, 29, 27, 26, 25, 1385, - /* 620 */ 262, 1469, 990, 994, 995, 224, 442, 1039, 1428, 58, - /* 630 */ 172, 1168, 276, 1165, 1164, 426, 7, 1163, 988, 1385, - /* 640 */ 1521, 1162, 1161, 487, 126, 428, 295, 1253, 1260, 1385, - /* 650 */ 1385, 269, 268, 125, 414, 1479, 1088, 1519, 1160, 508, - /* 660 */ 418, 1003, 30, 28, 511, 225, 1413, 1414, 1417, 7, - /* 670 */ 262, 989, 990, 1385, 421, 1385, 1385, 996, 210, 1385, - /* 680 */ 397, 94, 1307, 1385, 1385, 1521, 1159, 500, 988, 209, - /* 690 */ 1158, 1157, 508, 1306, 9, 8, 152, 416, 125, 150, - /* 700 */ 1385, 1301, 1519, 1091, 989, 991, 1412, 154, 156, 158, - /* 710 */ 153, 155, 157, 66, 1193, 1188, 203, 1186, 104, 1, - /* 720 */ 425, 388, 994, 995, 224, 64, 1039, 1428, 1385, 1149, - /* 730 */ 1150, 443, 1385, 1385, 426, 60, 363, 365, 991, 368, - /* 740 */ 181, 1405, 508, 999, 428, 374, 438, 43, 1385, 175, - /* 750 */ 1114, 997, 177, 1403, 989, 994, 995, 224, 372, 1039, - /* 760 */ 410, 346, 1412, 411, 70, 1413, 1414, 1417, 1460, 1490, - /* 770 */ 1429, 391, 424, 1456, 168, 32, 32, 1004, 1063, 1023, - /* 780 */ 190, 1010, 98, 1428, 2, 279, 283, 419, 991, 974, - /* 790 */ 426, 164, 241, 841, 1007, 995, 32, 243, 966, 957, - /* 800 */ 428, 414, 314, 422, 1385, 994, 995, 224, 211, 1039, - /* 810 */ 1412, 194, 132, 101, 196, 96, 434, 1000, 1337, 320, - /* 820 */ 115, 1413, 1414, 1417, 328, 184, 1467, 409, 1048, 408, - /* 830 */ 333, 1428, 1521, 31, 29, 27, 26, 25, 426, 102, - /* 840 */ 1019, 246, 202, 104, 147, 125, 867, 119, 428, 1519, - /* 850 */ 327, 43, 1385, 345, 862, 146, 329, 447, 415, 1534, - /* 860 */ 895, 334, 102, 159, 1412, 899, 335, 352, 70, 1413, - /* 870 */ 1414, 1417, 1460, 1412, 1018, 336, 139, 1457, 247, 50, - /* 880 */ 245, 244, 144, 351, 103, 1428, 337, 905, 354, 1017, - /* 890 */ 104, 1026, 426, 904, 1428, 102, 338, 142, 105, 48, - /* 900 */ 341, 426, 428, 145, 1016, 348, 1385, 1412, 350, 261, - /* 910 */ 377, 428, 353, 1250, 149, 1385, 74, 1246, 393, 151, - /* 920 */ 106, 107, 229, 1413, 1414, 1417, 1248, 1244, 1428, 108, - /* 930 */ 109, 229, 1413, 1414, 1417, 426, 143, 360, 138, 251, - /* 940 */ 140, 379, 378, 1412, 167, 428, 170, 1015, 389, 1385, - /* 950 */ 398, 1412, 383, 1501, 367, 390, 995, 137, 432, 1500, - /* 960 */ 5, 387, 380, 1481, 1428, 228, 1413, 1414, 1417, 375, - /* 970 */ 407, 426, 1428, 173, 395, 4, 254, 1412, 176, 426, - /* 980 */ 1491, 428, 402, 162, 394, 1385, 370, 1088, 97, 428, - /* 990 */ 1014, 364, 1237, 1385, 161, 33, 259, 406, 1428, 1235, - /* 1000 */ 1475, 115, 1413, 1414, 1417, 426, 1412, 118, 180, 229, - /* 1010 */ 1413, 1414, 1417, 256, 183, 428, 1518, 182, 41, 1385, - /* 1020 */ 423, 40, 263, 420, 189, 1536, 17, 1428, 1442, 1346, - /* 1030 */ 1412, 430, 431, 264, 426, 229, 1413, 1414, 1417, 1345, - /* 1040 */ 1535, 435, 436, 200, 428, 198, 437, 57, 1385, 206, - /* 1050 */ 212, 1428, 59, 473, 1412, 474, 206, 488, 426, 1261, - /* 1060 */ 473, 445, 214, 507, 222, 1413, 1414, 1417, 428, 208, - /* 1070 */ 220, 39, 1385, 216, 475, 1428, 1379, 221, 1412, 218, - /* 1080 */ 1378, 475, 426, 278, 1375, 280, 281, 984, 231, 1413, - /* 1090 */ 1414, 1417, 428, 472, 471, 470, 1385, 469, 985, 1428, - /* 1100 */ 472, 471, 470, 128, 469, 285, 426, 1412, 1373, 287, - /* 1110 */ 288, 289, 223, 1413, 1414, 1417, 428, 1372, 1371, 291, - /* 1120 */ 1385, 293, 1362, 129, 296, 297, 969, 968, 1428, 1356, - /* 1130 */ 1355, 303, 302, 1412, 1354, 426, 232, 1413, 1414, 1417, - /* 1140 */ 1353, 1412, 940, 1330, 1329, 428, 1328, 1327, 1326, 1385, - /* 1150 */ 1325, 1324, 1323, 1322, 1428, 1321, 1320, 1319, 1318, 100, - /* 1160 */ 1317, 426, 1428, 1316, 1315, 1425, 1413, 1414, 1417, 426, - /* 1170 */ 1314, 428, 1313, 1312, 1311, 1385, 1412, 1310, 1309, 428, - /* 1180 */ 1308, 942, 1412, 1385, 1199, 1370, 1364, 1352, 1343, 1239, - /* 1190 */ 811, 1424, 1413, 1414, 1417, 1198, 1196, 1428, 1185, 1423, - /* 1200 */ 1413, 1414, 1417, 1428, 426, 141, 342, 343, 344, 1184, - /* 1210 */ 426, 1412, 1181, 1241, 428, 73, 487, 1412, 1385, 912, - /* 1220 */ 428, 148, 910, 1240, 1385, 1194, 248, 1189, 840, 839, - /* 1230 */ 838, 837, 1428, 249, 239, 1413, 1414, 1417, 1428, 426, - /* 1240 */ 238, 1413, 1414, 1417, 835, 426, 834, 1187, 250, 428, - /* 1250 */ 1180, 371, 369, 1385, 366, 428, 1179, 373, 71, 1385, - /* 1260 */ 1369, 42, 163, 1412, 1363, 381, 976, 110, 382, 240, - /* 1270 */ 1413, 1414, 1417, 1351, 1350, 237, 1413, 1414, 1417, 1342, - /* 1280 */ 169, 166, 14, 1403, 1428, 51, 171, 3, 32, 174, - /* 1290 */ 15, 426, 1113, 116, 34, 54, 36, 37, 185, 124, - /* 1300 */ 178, 428, 1107, 52, 1135, 1385, 1106, 179, 53, 19, - /* 1310 */ 1134, 1085, 35, 10, 1084, 16, 1140, 8, 257, 1139, - /* 1320 */ 1138, 226, 1413, 1414, 1417, 258, 1341, 1024, 13, 433, - /* 1330 */ 1049, 18, 192, 193, 60, 1111, 195, 197, 55, 199, - /* 1340 */ 56, 1005, 1402, 446, 38, 271, 450, 896, 893, 453, - /* 1350 */ 456, 204, 448, 451, 459, 890, 444, 454, 201, 884, - /* 1360 */ 882, 457, 460, 873, 901, 907, 903, 61, 809, 476, - /* 1370 */ 62, 63, 831, 830, 829, 828, 827, 826, 825, 823, - /* 1380 */ 888, 466, 824, 842, 821, 820, 819, 818, 887, 886, - /* 1390 */ 817, 885, 816, 815, 814, 1195, 497, 498, 1183, 1182, - /* 1400 */ 501, 502, 499, 1178, 906, 505, 506, 1153, 992, 215, - /* 1410 */ 509, 510, + /* 0 */ 1250, 441, 441, 265, 441, 1246, 1413, 72, 304, 306, + /* 10 */ 72, 111, 30, 28, 348, 409, 252, 354, 20, 1263, + /* 20 */ 261, 1153, 990, 1261, 1261, 269, 1261, 1429, 31, 29, + /* 30 */ 27, 26, 25, 1399, 412, 441, 233, 98, 988, 117, + /* 40 */ 409, 305, 1399, 1014, 427, 1395, 1401, 11, 1386, 1429, + /* 50 */ 1301, 30, 28, 1094, 1395, 1401, 425, 1261, 799, 261, + /* 60 */ 798, 990, 98, 409, 69, 1414, 1415, 1418, 1462, 1, + /* 70 */ 96, 276, 254, 1458, 120, 1413, 1308, 988, 800, 411, + /* 80 */ 121, 1469, 1470, 1308, 1474, 98, 11, 1340, 399, 251, + /* 90 */ 30, 28, 507, 1490, 1306, 96, 1429, 1252, 261, 325, + /* 100 */ 990, 440, 1523, 425, 989, 122, 1469, 1470, 1, 1474, + /* 110 */ 22, 24, 191, 427, 1399, 125, 988, 1386, 96, 1521, + /* 120 */ 31, 29, 27, 26, 25, 11, 1395, 1402, 123, 1469, + /* 130 */ 1470, 507, 1474, 70, 1414, 1415, 1418, 1462, 991, 1386, + /* 140 */ 440, 1461, 1458, 989, 135, 134, 1413, 1, 31, 29, + /* 150 */ 27, 26, 25, 186, 65, 994, 995, 1038, 1039, 1040, + /* 160 */ 1041, 1042, 1043, 1044, 1045, 99, 232, 1429, 1010, 1406, + /* 170 */ 507, 299, 1253, 298, 425, 318, 126, 991, 330, 1010, + /* 180 */ 428, 1404, 989, 264, 427, 1429, 1348, 331, 1386, 12, + /* 190 */ 1413, 398, 425, 131, 994, 995, 1038, 1039, 1040, 1041, + /* 200 */ 1042, 1043, 1044, 1045, 69, 1414, 1415, 1418, 1462, 441, + /* 210 */ 126, 1429, 254, 1458, 1535, 311, 991, 47, 425, 1308, + /* 220 */ 46, 441, 1336, 1496, 402, 266, 440, 312, 427, 133, + /* 230 */ 1306, 1261, 1386, 994, 995, 1038, 1039, 1040, 1041, 1042, + /* 240 */ 1043, 1044, 1045, 1261, 404, 400, 30, 28, 70, 1414, + /* 250 */ 1415, 1418, 1462, 64, 261, 329, 990, 1459, 324, 323, + /* 260 */ 322, 321, 320, 60, 317, 316, 315, 314, 310, 309, + /* 270 */ 308, 307, 988, 84, 1118, 12, 83, 82, 81, 80, + /* 280 */ 79, 78, 77, 76, 75, 30, 28, 426, 1156, 361, + /* 290 */ 111, 356, 300, 261, 360, 990, 126, 160, 1264, 357, + /* 300 */ 355, 126, 358, 7, 395, 1116, 1117, 1119, 1120, 84, + /* 310 */ 6, 988, 83, 82, 81, 80, 79, 78, 77, 76, + /* 320 */ 75, 441, 1308, 1523, 30, 28, 507, 338, 273, 503, + /* 330 */ 502, 441, 261, 1306, 990, 126, 125, 1258, 989, 114, + /* 340 */ 1521, 1225, 7, 1261, 272, 31, 29, 27, 26, 25, + /* 350 */ 988, 1339, 1341, 1261, 874, 464, 463, 462, 878, 461, + /* 360 */ 880, 881, 460, 883, 457, 507, 889, 454, 891, 892, + /* 370 */ 451, 448, 991, 27, 26, 25, 113, 989, 1167, 213, + /* 380 */ 1413, 7, 1291, 1375, 31, 29, 27, 26, 25, 994, + /* 390 */ 995, 1038, 1039, 1040, 1041, 1042, 1043, 1044, 1045, 441, + /* 400 */ 1523, 1429, 1201, 1026, 507, 438, 339, 384, 425, 1239, + /* 410 */ 126, 991, 1178, 1522, 428, 1012, 989, 1521, 427, 283, + /* 420 */ 1349, 1261, 1386, 31, 29, 27, 26, 25, 994, 995, + /* 430 */ 1038, 1039, 1040, 1041, 1042, 1043, 1044, 1045, 115, 1414, + /* 440 */ 1415, 1418, 1089, 31, 29, 27, 26, 25, 385, 271, + /* 450 */ 991, 361, 1015, 356, 1386, 339, 360, 111, 235, 160, + /* 460 */ 245, 357, 355, 1177, 358, 1263, 1413, 994, 995, 1038, + /* 470 */ 1039, 1040, 1041, 1042, 1043, 1044, 1045, 1537, 235, 1523, + /* 480 */ 30, 28, 159, 9, 8, 403, 351, 1429, 261, 1057, + /* 490 */ 990, 1155, 125, 49, 425, 291, 1521, 246, 375, 244, + /* 500 */ 243, 1026, 350, 1148, 427, 1386, 988, 353, 1386, 1057, + /* 510 */ 293, 1257, 1176, 413, 1175, 93, 92, 91, 90, 89, + /* 520 */ 88, 87, 86, 85, 68, 1414, 1415, 1418, 1462, 1523, + /* 530 */ 49, 274, 234, 1458, 159, 1058, 416, 1, 351, 111, + /* 540 */ 95, 1093, 125, 1174, 1523, 441, 1521, 1263, 1256, 1013, + /* 550 */ 1059, 439, 1070, 1062, 1386, 1058, 1386, 125, 476, 353, + /* 560 */ 507, 1521, 172, 1308, 441, 441, 1173, 1261, 1063, 1147, + /* 570 */ 205, 275, 989, 1062, 1307, 1172, 23, 259, 1052, 1053, + /* 580 */ 1054, 1055, 1056, 1060, 1061, 1386, 1261, 1261, 1011, 1476, + /* 590 */ 1194, 21, 1171, 1170, 1169, 1166, 23, 259, 1052, 1053, + /* 600 */ 1054, 1055, 1056, 1060, 1061, 1198, 991, 1473, 1386, 1101, + /* 610 */ 1165, 147, 362, 1248, 119, 1012, 112, 1386, 1481, 1089, + /* 620 */ 344, 219, 146, 994, 995, 1038, 1039, 1040, 1041, 1042, + /* 630 */ 1043, 1044, 1045, 217, 1386, 1386, 1386, 1386, 1164, 1163, + /* 640 */ 1162, 1161, 1160, 136, 1159, 1158, 50, 9, 8, 144, + /* 650 */ 1237, 1413, 1386, 420, 495, 494, 493, 492, 491, 490, + /* 660 */ 489, 488, 207, 485, 484, 483, 482, 481, 480, 479, + /* 670 */ 478, 477, 1429, 1476, 1476, 486, 58, 467, 294, 425, + /* 680 */ 1386, 1386, 1386, 1386, 1386, 798, 1386, 1386, 417, 427, + /* 690 */ 424, 1472, 1471, 1386, 1254, 152, 476, 154, 150, 1413, + /* 700 */ 153, 346, 373, 143, 67, 138, 998, 140, 383, 69, + /* 710 */ 1414, 1415, 1418, 1462, 1092, 371, 1244, 254, 1458, 1535, + /* 720 */ 1429, 1150, 1151, 165, 137, 415, 466, 412, 1519, 45, + /* 730 */ 44, 303, 156, 130, 1189, 155, 104, 427, 297, 387, + /* 740 */ 158, 1386, 1413, 157, 1168, 1226, 241, 1187, 289, 396, + /* 750 */ 285, 281, 127, 188, 1302, 345, 364, 69, 1414, 1415, + /* 760 */ 1418, 1462, 181, 1429, 1492, 254, 1458, 120, 43, 367, + /* 770 */ 425, 1115, 1001, 175, 126, 997, 177, 1430, 1413, 187, + /* 780 */ 427, 410, 421, 190, 1386, 391, 1489, 32, 32, 32, + /* 790 */ 1064, 1023, 957, 194, 2, 1010, 196, 278, 1049, 1429, + /* 800 */ 69, 1414, 1415, 1418, 1462, 1413, 425, 282, 254, 1458, + /* 810 */ 1535, 101, 240, 242, 433, 418, 427, 841, 102, 1480, + /* 820 */ 1386, 202, 966, 211, 313, 413, 1429, 409, 510, 1338, + /* 830 */ 132, 104, 319, 425, 867, 327, 224, 1414, 1415, 1418, + /* 840 */ 326, 1000, 210, 427, 328, 94, 332, 1386, 1019, 98, + /* 850 */ 333, 499, 43, 209, 446, 862, 1523, 895, 102, 103, + /* 860 */ 1413, 899, 905, 70, 1414, 1415, 1418, 1462, 413, 125, + /* 870 */ 334, 423, 1458, 1521, 1018, 335, 139, 66, 1017, 336, + /* 880 */ 203, 1429, 96, 104, 102, 337, 904, 105, 425, 142, + /* 890 */ 48, 145, 184, 1469, 408, 340, 407, 1016, 427, 1523, + /* 900 */ 347, 349, 1386, 74, 1413, 1251, 376, 149, 1247, 1413, + /* 910 */ 437, 377, 125, 151, 106, 107, 1521, 1249, 115, 1414, + /* 920 */ 1415, 1418, 1245, 108, 109, 1429, 352, 359, 378, 250, + /* 930 */ 1429, 1015, 425, 382, 167, 390, 388, 425, 168, 379, + /* 940 */ 170, 397, 427, 1503, 431, 386, 1386, 427, 1493, 260, + /* 950 */ 389, 1386, 995, 974, 392, 164, 414, 1536, 1502, 5, + /* 960 */ 1483, 173, 228, 1414, 1415, 1418, 1413, 228, 1414, 1415, + /* 970 */ 1418, 1413, 406, 394, 393, 176, 253, 4, 401, 1089, + /* 980 */ 97, 1014, 33, 183, 180, 422, 255, 1429, 118, 1477, + /* 990 */ 419, 429, 1429, 182, 425, 17, 1347, 1346, 430, 425, + /* 1000 */ 263, 434, 1444, 435, 427, 198, 1538, 1413, 1386, 427, + /* 1010 */ 200, 57, 436, 1386, 1520, 1413, 258, 59, 1262, 212, + /* 1020 */ 473, 189, 444, 214, 227, 1414, 1415, 1418, 1429, 228, + /* 1030 */ 1414, 1415, 1418, 487, 208, 425, 1429, 506, 216, 220, + /* 1040 */ 221, 1413, 39, 425, 218, 427, 1380, 1379, 277, 1386, + /* 1050 */ 1413, 279, 262, 427, 1376, 280, 405, 1386, 984, 985, + /* 1060 */ 128, 284, 1429, 1374, 286, 228, 1414, 1415, 1418, 425, + /* 1070 */ 287, 1429, 288, 226, 1414, 1415, 1418, 1413, 425, 427, + /* 1080 */ 1373, 290, 1372, 1386, 1363, 1413, 292, 129, 427, 295, + /* 1090 */ 296, 969, 1386, 968, 1357, 1356, 302, 1355, 1429, 229, + /* 1100 */ 1414, 1415, 1418, 301, 1354, 425, 1429, 1331, 222, 1414, + /* 1110 */ 1415, 1418, 940, 425, 1330, 427, 1329, 1328, 1327, 1386, + /* 1120 */ 1326, 1413, 1325, 427, 1324, 1323, 1413, 1386, 1322, 1321, + /* 1130 */ 1320, 1319, 100, 1318, 1317, 230, 1414, 1415, 1418, 1316, + /* 1140 */ 1315, 1314, 1429, 223, 1414, 1415, 1418, 1429, 1313, 425, + /* 1150 */ 1312, 1311, 1310, 1309, 425, 1200, 1371, 942, 1365, 427, + /* 1160 */ 1353, 1344, 1413, 1386, 427, 1240, 141, 1413, 1386, 811, + /* 1170 */ 1199, 1197, 1186, 1413, 341, 343, 1185, 1182, 342, 231, + /* 1180 */ 1414, 1415, 1418, 1429, 1426, 1414, 1415, 1418, 1429, 1242, + /* 1190 */ 425, 73, 912, 486, 1429, 425, 910, 1241, 1195, 1190, + /* 1200 */ 427, 425, 1238, 148, 1386, 427, 840, 839, 247, 1386, + /* 1210 */ 248, 427, 365, 838, 1413, 1386, 837, 835, 834, 1188, + /* 1220 */ 1425, 1414, 1415, 1418, 1236, 1424, 1414, 1415, 1418, 1413, + /* 1230 */ 249, 238, 1414, 1415, 1418, 1429, 1181, 370, 268, 267, + /* 1240 */ 1413, 368, 425, 1180, 372, 71, 1370, 163, 1003, 42, + /* 1250 */ 1429, 976, 427, 1364, 990, 1413, 1386, 425, 110, 206, + /* 1260 */ 380, 1429, 1352, 472, 996, 166, 1351, 427, 425, 1343, + /* 1270 */ 988, 1386, 237, 1414, 1415, 1418, 1429, 381, 427, 36, + /* 1280 */ 366, 206, 1386, 425, 474, 472, 51, 239, 1414, 1415, + /* 1290 */ 1418, 169, 171, 427, 3, 374, 32, 1386, 236, 1414, + /* 1300 */ 1415, 1418, 37, 471, 470, 469, 474, 468, 116, 162, + /* 1310 */ 174, 1114, 369, 225, 1414, 1415, 1418, 363, 442, 178, + /* 1320 */ 161, 1108, 1107, 14, 507, 471, 470, 469, 52, 468, + /* 1330 */ 999, 179, 53, 34, 19, 1404, 989, 15, 1086, 185, + /* 1340 */ 1085, 35, 124, 1141, 41, 16, 10, 40, 54, 1136, + /* 1350 */ 1135, 256, 1140, 1139, 257, 8, 1050, 1024, 192, 13, + /* 1360 */ 18, 432, 193, 1112, 1004, 195, 197, 55, 1342, 199, + /* 1370 */ 991, 56, 201, 60, 1005, 38, 1403, 896, 445, 270, + /* 1380 */ 204, 1007, 995, 443, 449, 452, 447, 994, 995, 893, + /* 1390 */ 450, 873, 890, 453, 455, 884, 456, 458, 882, 459, + /* 1400 */ 61, 907, 888, 887, 886, 465, 62, 63, 906, 903, + /* 1410 */ 901, 475, 885, 809, 831, 830, 829, 828, 827, 826, + /* 1420 */ 825, 824, 823, 842, 821, 820, 1196, 819, 818, 817, + /* 1430 */ 1184, 816, 815, 814, 496, 497, 500, 1183, 501, 1179, + /* 1440 */ 498, 504, 505, 1154, 992, 215, 508, 509, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 246, 267, 268, 210, 210, 207, 208, 229, 225, 216, - /* 10 */ 216, 229, 258, 259, 231, 210, 223, 223, 18, 236, - /* 20 */ 20, 0, 0, 210, 246, 232, 232, 27, 246, 216, - /* 30 */ 30, 12, 13, 14, 15, 16, 258, 259, 242, 39, - /* 40 */ 258, 259, 237, 21, 248, 232, 24, 25, 26, 27, - /* 50 */ 28, 29, 30, 31, 32, 234, 12, 13, 14, 15, - /* 60 */ 16, 242, 241, 242, 245, 218, 47, 248, 221, 20, - /* 70 */ 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, - /* 80 */ 59, 60, 61, 62, 63, 64, 65, 66, 38, 70, - /* 90 */ 12, 13, 14, 15, 16, 21, 20, 78, 24, 25, - /* 100 */ 26, 27, 28, 29, 30, 31, 32, 107, 0, 210, - /* 110 */ 110, 111, 112, 113, 114, 216, 116, 117, 118, 119, - /* 120 */ 120, 121, 122, 123, 210, 47, 14, 15, 16, 46, - /* 130 */ 216, 232, 24, 25, 26, 27, 28, 29, 30, 31, - /* 140 */ 32, 225, 49, 124, 51, 69, 232, 54, 232, 20, - /* 150 */ 57, 210, 59, 60, 104, 62, 78, 216, 20, 128, - /* 160 */ 210, 142, 83, 84, 85, 86, 87, 88, 89, 90, - /* 170 */ 91, 92, 93, 232, 95, 96, 97, 98, 99, 100, - /* 180 */ 264, 176, 232, 20, 165, 166, 167, 168, 169, 170, - /* 190 */ 171, 172, 173, 2, 18, 204, 137, 20, 139, 23, - /* 200 */ 210, 217, 124, 12, 13, 14, 15, 16, 210, 225, - /* 210 */ 225, 35, 181, 182, 216, 265, 225, 233, 233, 134, - /* 220 */ 142, 45, 204, 232, 274, 275, 276, 277, 204, 279, - /* 230 */ 232, 46, 251, 242, 149, 176, 203, 246, 205, 204, - /* 240 */ 20, 251, 251, 165, 166, 167, 168, 169, 170, 171, - /* 250 */ 172, 173, 176, 262, 263, 264, 265, 266, 12, 13, - /* 260 */ 225, 270, 271, 282, 246, 210, 20, 232, 22, 80, - /* 270 */ 246, 216, 282, 282, 226, 204, 295, 242, 22, 57, - /* 280 */ 299, 246, 106, 61, 38, 295, 295, 232, 155, 299, - /* 290 */ 299, 0, 212, 47, 38, 43, 225, 262, 263, 264, - /* 300 */ 265, 266, 222, 232, 82, 270, 271, 131, 132, 133, - /* 310 */ 230, 135, 226, 242, 0, 69, 140, 246, 185, 186, - /* 320 */ 187, 188, 189, 210, 148, 210, 150, 36, 152, 153, - /* 330 */ 154, 216, 20, 262, 263, 264, 265, 266, 92, 176, - /* 340 */ 63, 270, 271, 272, 225, 232, 226, 232, 92, 212, - /* 350 */ 104, 232, 176, 210, 20, 284, 12, 13, 14, 216, - /* 360 */ 104, 290, 291, 49, 20, 51, 22, 230, 54, 12, - /* 370 */ 13, 57, 204, 59, 60, 232, 62, 20, 265, 22, - /* 380 */ 226, 69, 38, 264, 138, 108, 109, 204, 275, 276, - /* 390 */ 277, 47, 279, 225, 138, 38, 1, 2, 224, 0, - /* 400 */ 232, 155, 156, 157, 47, 159, 213, 217, 215, 235, - /* 410 */ 242, 155, 156, 69, 246, 225, 204, 12, 13, 14, - /* 420 */ 15, 16, 176, 233, 209, 204, 69, 175, 201, 246, - /* 430 */ 262, 263, 264, 265, 266, 220, 92, 225, 270, 271, - /* 440 */ 272, 225, 227, 282, 232, 46, 225, 231, 104, 92, - /* 450 */ 226, 225, 236, 232, 242, 124, 295, 231, 246, 291, - /* 460 */ 299, 104, 236, 242, 130, 70, 158, 246, 160, 161, - /* 470 */ 162, 163, 164, 142, 262, 263, 264, 265, 251, 226, - /* 480 */ 12, 13, 138, 262, 263, 264, 265, 266, 20, 204, - /* 490 */ 22, 270, 271, 272, 44, 138, 165, 204, 0, 155, - /* 500 */ 156, 157, 281, 159, 204, 254, 38, 217, 3, 282, - /* 510 */ 225, 204, 155, 156, 157, 225, 159, 232, 68, 210, - /* 520 */ 20, 71, 295, 233, 225, 225, 299, 242, 204, 22, - /* 530 */ 4, 246, 232, 204, 260, 236, 131, 69, 20, 246, - /* 540 */ 22, 232, 242, 205, 46, 38, 246, 262, 263, 264, - /* 550 */ 265, 266, 278, 246, 225, 270, 271, 272, 40, 302, - /* 560 */ 92, 232, 262, 263, 264, 265, 281, 14, 215, 204, - /* 570 */ 246, 242, 104, 20, 265, 246, 210, 204, 260, 12, - /* 580 */ 13, 14, 216, 232, 275, 276, 277, 20, 279, 22, - /* 590 */ 239, 262, 263, 264, 265, 266, 278, 204, 232, 270, - /* 600 */ 271, 272, 197, 260, 2, 38, 138, 204, 204, 251, - /* 610 */ 281, 246, 12, 13, 12, 13, 14, 15, 16, 246, - /* 620 */ 20, 278, 22, 155, 156, 157, 210, 159, 225, 209, - /* 630 */ 130, 204, 216, 204, 204, 232, 69, 204, 38, 246, - /* 640 */ 282, 204, 204, 67, 176, 242, 70, 227, 232, 246, - /* 650 */ 246, 12, 13, 295, 251, 174, 175, 299, 204, 92, - /* 660 */ 67, 22, 12, 13, 19, 262, 263, 264, 265, 69, - /* 670 */ 20, 104, 22, 246, 67, 246, 246, 38, 33, 246, - /* 680 */ 293, 36, 225, 246, 246, 282, 204, 42, 38, 44, - /* 690 */ 204, 204, 92, 236, 1, 2, 73, 192, 295, 76, - /* 700 */ 246, 235, 299, 177, 104, 138, 204, 73, 73, 73, - /* 710 */ 76, 76, 76, 68, 0, 0, 71, 0, 67, 69, - /* 720 */ 47, 70, 155, 156, 157, 69, 159, 225, 246, 199, - /* 730 */ 200, 92, 246, 246, 232, 79, 22, 22, 138, 22, - /* 740 */ 287, 69, 92, 104, 242, 21, 101, 67, 246, 67, - /* 750 */ 70, 38, 70, 81, 104, 155, 156, 157, 34, 159, - /* 760 */ 210, 207, 204, 280, 262, 263, 264, 265, 266, 261, - /* 770 */ 225, 126, 270, 271, 129, 67, 67, 138, 70, 70, - /* 780 */ 296, 20, 232, 225, 283, 210, 36, 194, 138, 144, - /* 790 */ 232, 146, 257, 38, 155, 156, 67, 214, 136, 70, - /* 800 */ 242, 251, 210, 196, 246, 155, 156, 157, 252, 159, - /* 810 */ 204, 67, 115, 67, 70, 265, 70, 104, 210, 240, - /* 820 */ 262, 263, 264, 265, 124, 275, 276, 277, 155, 279, - /* 830 */ 210, 225, 282, 12, 13, 14, 15, 16, 232, 67, - /* 840 */ 20, 35, 70, 67, 33, 295, 70, 36, 242, 299, - /* 850 */ 238, 67, 246, 42, 70, 44, 238, 67, 300, 301, - /* 860 */ 70, 256, 67, 57, 204, 70, 242, 61, 262, 263, - /* 870 */ 264, 265, 266, 204, 20, 250, 212, 271, 72, 68, - /* 880 */ 74, 75, 71, 77, 67, 225, 232, 70, 82, 20, - /* 890 */ 67, 70, 232, 70, 225, 67, 243, 212, 70, 212, - /* 900 */ 210, 232, 242, 212, 20, 206, 246, 204, 225, 249, - /* 910 */ 232, 242, 214, 225, 225, 246, 210, 225, 249, 225, - /* 920 */ 225, 225, 262, 263, 264, 265, 225, 225, 225, 225, - /* 930 */ 225, 262, 263, 264, 265, 232, 125, 214, 127, 206, - /* 940 */ 129, 145, 256, 204, 209, 242, 209, 20, 232, 246, - /* 950 */ 184, 204, 242, 292, 4, 243, 156, 146, 183, 292, - /* 960 */ 191, 250, 255, 289, 225, 262, 263, 264, 265, 19, - /* 970 */ 190, 232, 225, 247, 246, 178, 246, 204, 247, 232, - /* 980 */ 261, 242, 246, 33, 179, 246, 36, 175, 232, 242, - /* 990 */ 20, 41, 0, 246, 44, 115, 249, 294, 225, 0, - /* 1000 */ 260, 262, 263, 264, 265, 232, 204, 286, 288, 262, - /* 1010 */ 263, 264, 265, 198, 273, 242, 298, 285, 68, 246, - /* 1020 */ 195, 71, 249, 193, 297, 303, 69, 225, 269, 247, - /* 1030 */ 204, 246, 246, 246, 232, 262, 263, 264, 265, 247, - /* 1040 */ 301, 127, 244, 209, 242, 232, 243, 209, 246, 57, - /* 1050 */ 221, 225, 69, 61, 204, 214, 57, 214, 232, 232, - /* 1060 */ 61, 228, 210, 206, 262, 263, 264, 265, 242, 209, - /* 1070 */ 219, 253, 246, 211, 82, 225, 0, 219, 204, 202, - /* 1080 */ 0, 82, 232, 60, 0, 38, 151, 38, 262, 263, - /* 1090 */ 264, 265, 242, 101, 102, 103, 246, 105, 38, 225, - /* 1100 */ 101, 102, 103, 38, 105, 151, 232, 204, 0, 38, - /* 1110 */ 38, 151, 262, 263, 264, 265, 242, 0, 0, 38, - /* 1120 */ 246, 38, 0, 69, 142, 141, 104, 138, 225, 0, - /* 1130 */ 0, 134, 50, 204, 0, 232, 262, 263, 264, 265, - /* 1140 */ 0, 204, 81, 0, 0, 242, 0, 0, 0, 246, - /* 1150 */ 0, 0, 0, 0, 225, 0, 0, 0, 0, 115, - /* 1160 */ 0, 232, 225, 0, 0, 262, 263, 264, 265, 232, - /* 1170 */ 0, 242, 0, 0, 0, 246, 204, 0, 0, 242, - /* 1180 */ 0, 22, 204, 246, 0, 0, 0, 0, 0, 0, - /* 1190 */ 48, 262, 263, 264, 265, 0, 0, 225, 0, 262, - /* 1200 */ 263, 264, 265, 225, 232, 43, 38, 36, 43, 0, - /* 1210 */ 232, 204, 0, 0, 242, 78, 67, 204, 246, 38, - /* 1220 */ 242, 76, 22, 0, 246, 0, 22, 0, 38, 38, - /* 1230 */ 38, 38, 225, 22, 262, 263, 264, 265, 225, 232, - /* 1240 */ 262, 263, 264, 265, 38, 232, 38, 0, 22, 242, - /* 1250 */ 0, 22, 38, 246, 39, 242, 0, 22, 20, 246, - /* 1260 */ 0, 130, 147, 204, 0, 22, 38, 143, 130, 262, - /* 1270 */ 263, 264, 265, 0, 0, 262, 263, 264, 265, 0, - /* 1280 */ 43, 127, 180, 81, 225, 69, 125, 67, 67, 70, - /* 1290 */ 180, 232, 70, 69, 174, 4, 130, 67, 81, 81, - /* 1300 */ 69, 242, 70, 69, 38, 246, 70, 67, 69, 67, - /* 1310 */ 38, 70, 67, 180, 70, 67, 70, 2, 38, 38, - /* 1320 */ 38, 262, 263, 264, 265, 38, 0, 70, 69, 128, - /* 1330 */ 155, 69, 81, 70, 79, 70, 69, 69, 69, 43, - /* 1340 */ 69, 22, 81, 38, 69, 38, 38, 70, 70, 38, - /* 1350 */ 38, 81, 69, 69, 38, 70, 80, 69, 125, 70, - /* 1360 */ 70, 69, 69, 22, 22, 38, 38, 69, 48, 47, - /* 1370 */ 69, 69, 22, 38, 38, 38, 38, 38, 38, 22, - /* 1380 */ 94, 82, 38, 38, 38, 38, 38, 38, 94, 94, - /* 1390 */ 38, 94, 38, 38, 38, 0, 38, 36, 0, 0, - /* 1400 */ 38, 37, 43, 0, 104, 22, 21, 304, 22, 22, - /* 1410 */ 21, 20, 304, 304, 304, 304, 304, 304, 304, 304, - /* 1420 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, - /* 1430 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, - /* 1440 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, + /* 0 */ 226, 210, 210, 217, 210, 226, 204, 216, 216, 210, + /* 10 */ 216, 225, 12, 13, 223, 210, 229, 223, 2, 233, + /* 20 */ 20, 201, 22, 232, 232, 229, 232, 225, 12, 13, + /* 30 */ 14, 15, 16, 246, 232, 210, 237, 232, 38, 224, + /* 40 */ 210, 216, 246, 20, 242, 258, 259, 47, 246, 225, + /* 50 */ 235, 12, 13, 14, 258, 259, 232, 232, 20, 20, + /* 60 */ 22, 22, 232, 210, 262, 263, 264, 265, 266, 69, + /* 70 */ 265, 251, 270, 271, 272, 204, 225, 38, 40, 274, + /* 80 */ 275, 276, 277, 225, 279, 232, 47, 236, 264, 231, + /* 90 */ 12, 13, 92, 291, 236, 265, 225, 204, 20, 63, + /* 100 */ 22, 20, 282, 232, 104, 275, 276, 277, 69, 279, + /* 110 */ 2, 267, 268, 242, 246, 295, 38, 246, 265, 299, + /* 120 */ 12, 13, 14, 15, 16, 47, 258, 259, 275, 276, + /* 130 */ 277, 92, 279, 262, 263, 264, 265, 266, 138, 246, + /* 140 */ 20, 270, 271, 104, 108, 109, 204, 69, 12, 13, + /* 150 */ 14, 15, 16, 130, 209, 155, 156, 157, 158, 159, + /* 160 */ 160, 161, 162, 163, 164, 220, 18, 225, 20, 69, + /* 170 */ 92, 137, 227, 139, 232, 27, 176, 138, 30, 20, + /* 180 */ 242, 81, 104, 245, 242, 225, 248, 39, 246, 69, + /* 190 */ 204, 128, 232, 44, 155, 156, 157, 158, 159, 160, + /* 200 */ 161, 162, 163, 164, 262, 263, 264, 265, 266, 210, + /* 210 */ 176, 225, 270, 271, 272, 216, 138, 68, 232, 225, + /* 220 */ 71, 210, 232, 281, 264, 231, 20, 216, 242, 239, + /* 230 */ 236, 232, 246, 155, 156, 157, 158, 159, 160, 161, + /* 240 */ 162, 163, 164, 232, 181, 182, 12, 13, 262, 263, + /* 250 */ 264, 265, 266, 69, 20, 107, 22, 271, 110, 111, + /* 260 */ 112, 113, 114, 79, 116, 117, 118, 119, 120, 121, + /* 270 */ 122, 123, 38, 21, 155, 69, 24, 25, 26, 27, + /* 280 */ 28, 29, 30, 31, 32, 12, 13, 14, 0, 49, + /* 290 */ 225, 51, 251, 20, 54, 22, 176, 57, 233, 59, + /* 300 */ 60, 176, 62, 69, 185, 186, 187, 188, 189, 21, + /* 310 */ 43, 38, 24, 25, 26, 27, 28, 29, 30, 31, + /* 320 */ 32, 210, 225, 282, 12, 13, 92, 216, 231, 207, + /* 330 */ 208, 210, 20, 236, 22, 176, 295, 216, 104, 213, + /* 340 */ 299, 215, 69, 232, 234, 12, 13, 14, 15, 16, + /* 350 */ 38, 241, 242, 232, 83, 84, 85, 86, 87, 88, + /* 360 */ 89, 90, 91, 92, 93, 92, 95, 96, 97, 98, + /* 370 */ 99, 100, 138, 14, 15, 16, 203, 104, 205, 218, + /* 380 */ 204, 69, 221, 0, 12, 13, 14, 15, 16, 155, + /* 390 */ 156, 157, 158, 159, 160, 161, 162, 163, 164, 210, + /* 400 */ 282, 225, 0, 70, 92, 216, 46, 210, 232, 0, + /* 410 */ 176, 138, 204, 295, 242, 20, 104, 299, 242, 36, + /* 420 */ 248, 232, 246, 12, 13, 14, 15, 16, 155, 156, + /* 430 */ 157, 158, 159, 160, 161, 162, 163, 164, 262, 263, + /* 440 */ 264, 265, 175, 12, 13, 14, 15, 16, 251, 217, + /* 450 */ 138, 49, 20, 51, 246, 46, 54, 225, 47, 57, + /* 460 */ 35, 59, 60, 204, 62, 233, 204, 155, 156, 157, + /* 470 */ 158, 159, 160, 161, 162, 163, 164, 301, 47, 282, + /* 480 */ 12, 13, 57, 1, 2, 20, 61, 225, 20, 78, + /* 490 */ 22, 0, 295, 212, 232, 134, 299, 72, 251, 74, + /* 500 */ 75, 70, 77, 131, 242, 246, 38, 82, 246, 78, + /* 510 */ 149, 230, 204, 251, 204, 24, 25, 26, 27, 28, + /* 520 */ 29, 30, 31, 32, 262, 263, 264, 265, 266, 282, + /* 530 */ 212, 217, 270, 271, 57, 124, 3, 69, 61, 225, + /* 540 */ 222, 4, 295, 204, 282, 210, 299, 233, 230, 20, + /* 550 */ 124, 216, 70, 142, 246, 124, 246, 295, 46, 82, + /* 560 */ 92, 299, 130, 225, 210, 210, 204, 232, 142, 197, + /* 570 */ 216, 216, 104, 142, 236, 204, 165, 166, 167, 168, + /* 580 */ 169, 170, 171, 172, 173, 246, 232, 232, 20, 260, + /* 590 */ 0, 165, 204, 204, 204, 204, 165, 166, 167, 168, + /* 600 */ 169, 170, 171, 172, 173, 0, 138, 278, 246, 14, + /* 610 */ 204, 33, 22, 226, 36, 20, 18, 246, 174, 175, + /* 620 */ 42, 23, 44, 155, 156, 157, 158, 159, 160, 161, + /* 630 */ 162, 163, 164, 35, 246, 246, 246, 246, 204, 204, + /* 640 */ 204, 204, 204, 45, 204, 204, 68, 1, 2, 71, + /* 650 */ 0, 204, 246, 67, 49, 50, 51, 52, 53, 54, + /* 660 */ 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + /* 670 */ 65, 66, 225, 260, 260, 67, 209, 80, 70, 232, + /* 680 */ 246, 246, 246, 246, 246, 22, 246, 246, 67, 242, + /* 690 */ 47, 278, 278, 246, 227, 73, 46, 73, 76, 204, + /* 700 */ 76, 38, 21, 125, 106, 127, 38, 129, 254, 262, + /* 710 */ 263, 264, 265, 266, 177, 34, 226, 270, 271, 272, + /* 720 */ 225, 199, 200, 226, 146, 192, 226, 232, 281, 131, + /* 730 */ 132, 133, 73, 135, 0, 76, 67, 242, 140, 70, + /* 740 */ 73, 246, 204, 76, 205, 215, 148, 0, 150, 293, + /* 750 */ 152, 153, 154, 302, 235, 207, 22, 262, 263, 264, + /* 760 */ 265, 266, 287, 225, 261, 270, 271, 272, 67, 22, + /* 770 */ 232, 70, 104, 67, 176, 38, 70, 225, 204, 284, + /* 780 */ 242, 280, 196, 296, 246, 290, 291, 67, 67, 67, + /* 790 */ 70, 70, 70, 67, 283, 20, 70, 210, 155, 225, + /* 800 */ 262, 263, 264, 265, 266, 204, 232, 36, 270, 271, + /* 810 */ 272, 67, 257, 214, 70, 194, 242, 38, 67, 281, + /* 820 */ 246, 70, 136, 252, 210, 251, 225, 210, 19, 210, + /* 830 */ 115, 67, 240, 232, 70, 124, 262, 263, 264, 265, + /* 840 */ 238, 104, 33, 242, 238, 36, 210, 246, 20, 232, + /* 850 */ 256, 42, 67, 44, 67, 70, 282, 70, 67, 67, + /* 860 */ 204, 70, 70, 262, 263, 264, 265, 266, 251, 295, + /* 870 */ 242, 270, 271, 299, 20, 250, 212, 68, 20, 232, + /* 880 */ 71, 225, 265, 67, 67, 243, 70, 70, 232, 212, + /* 890 */ 212, 212, 275, 276, 277, 210, 279, 20, 242, 282, + /* 900 */ 206, 225, 246, 210, 204, 225, 232, 225, 225, 204, + /* 910 */ 101, 256, 295, 225, 225, 225, 299, 225, 262, 263, + /* 920 */ 264, 265, 225, 225, 225, 225, 214, 214, 145, 206, + /* 930 */ 225, 20, 232, 242, 209, 126, 232, 232, 129, 255, + /* 940 */ 209, 184, 242, 292, 183, 250, 246, 242, 261, 249, + /* 950 */ 243, 246, 156, 144, 249, 146, 300, 301, 292, 191, + /* 960 */ 289, 247, 262, 263, 264, 265, 204, 262, 263, 264, + /* 970 */ 265, 204, 190, 246, 179, 247, 246, 178, 246, 175, + /* 980 */ 232, 20, 115, 273, 288, 195, 198, 225, 286, 260, + /* 990 */ 193, 246, 225, 285, 232, 69, 247, 247, 246, 232, + /* 1000 */ 246, 127, 269, 244, 242, 232, 303, 204, 246, 242, + /* 1010 */ 209, 209, 243, 246, 298, 204, 249, 69, 232, 221, + /* 1020 */ 214, 297, 228, 210, 262, 263, 264, 265, 225, 262, + /* 1030 */ 263, 264, 265, 214, 209, 232, 225, 206, 211, 219, + /* 1040 */ 219, 204, 253, 232, 202, 242, 0, 0, 60, 246, + /* 1050 */ 204, 38, 249, 242, 0, 151, 294, 246, 38, 38, + /* 1060 */ 38, 151, 225, 0, 38, 262, 263, 264, 265, 232, + /* 1070 */ 38, 225, 151, 262, 263, 264, 265, 204, 232, 242, + /* 1080 */ 0, 38, 0, 246, 0, 204, 38, 69, 242, 142, + /* 1090 */ 141, 104, 246, 138, 0, 0, 134, 0, 225, 262, + /* 1100 */ 263, 264, 265, 50, 0, 232, 225, 0, 262, 263, + /* 1110 */ 264, 265, 81, 232, 0, 242, 0, 0, 0, 246, + /* 1120 */ 0, 204, 0, 242, 0, 0, 204, 246, 0, 0, + /* 1130 */ 0, 0, 115, 0, 0, 262, 263, 264, 265, 0, + /* 1140 */ 0, 0, 225, 262, 263, 264, 265, 225, 0, 232, + /* 1150 */ 0, 0, 0, 0, 232, 0, 0, 22, 0, 242, + /* 1160 */ 0, 0, 204, 246, 242, 0, 43, 204, 246, 48, + /* 1170 */ 0, 0, 0, 204, 38, 43, 0, 0, 36, 262, + /* 1180 */ 263, 264, 265, 225, 262, 263, 264, 265, 225, 0, + /* 1190 */ 232, 78, 38, 67, 225, 232, 22, 0, 0, 0, + /* 1200 */ 242, 232, 0, 76, 246, 242, 38, 38, 22, 246, + /* 1210 */ 22, 242, 39, 38, 204, 246, 38, 38, 38, 0, + /* 1220 */ 262, 263, 264, 265, 0, 262, 263, 264, 265, 204, + /* 1230 */ 22, 262, 263, 264, 265, 225, 0, 22, 12, 13, + /* 1240 */ 204, 38, 232, 0, 22, 20, 0, 147, 22, 130, + /* 1250 */ 225, 38, 242, 0, 22, 204, 246, 232, 143, 57, + /* 1260 */ 22, 225, 0, 61, 38, 127, 0, 242, 232, 0, + /* 1270 */ 38, 246, 262, 263, 264, 265, 225, 130, 242, 130, + /* 1280 */ 4, 57, 246, 232, 82, 61, 69, 262, 263, 264, + /* 1290 */ 265, 43, 125, 242, 67, 19, 67, 246, 262, 263, + /* 1300 */ 264, 265, 67, 101, 102, 103, 82, 105, 69, 33, + /* 1310 */ 70, 70, 36, 262, 263, 264, 265, 41, 92, 69, + /* 1320 */ 44, 70, 70, 180, 92, 101, 102, 103, 69, 105, + /* 1330 */ 104, 67, 69, 174, 67, 81, 104, 180, 70, 81, + /* 1340 */ 70, 67, 81, 70, 68, 67, 180, 71, 4, 38, + /* 1350 */ 38, 38, 38, 38, 38, 2, 155, 70, 81, 69, + /* 1360 */ 69, 128, 70, 70, 138, 69, 69, 69, 0, 43, + /* 1370 */ 138, 69, 125, 79, 22, 69, 81, 70, 38, 38, + /* 1380 */ 81, 155, 156, 80, 38, 38, 69, 155, 156, 70, + /* 1390 */ 69, 22, 70, 69, 38, 70, 69, 38, 70, 69, + /* 1400 */ 69, 38, 94, 94, 94, 82, 69, 69, 104, 38, + /* 1410 */ 22, 47, 94, 48, 22, 38, 38, 38, 38, 38, + /* 1420 */ 38, 38, 22, 38, 38, 38, 0, 38, 38, 38, + /* 1430 */ 0, 38, 38, 38, 38, 36, 38, 0, 37, 0, + /* 1440 */ 43, 22, 21, 304, 22, 22, 21, 20, 304, 304, /* 1450 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, /* 1460 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, /* 1470 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, @@ -516,145 +519,148 @@ static const YYCODETYPE yy_lookahead[] = { /* 1580 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, /* 1590 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, /* 1600 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, - /* 1610 */ 304, 304, 304, + /* 1610 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, + /* 1620 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, + /* 1630 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, + /* 1640 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, }; -#define YY_SHIFT_COUNT (511) +#define YY_SHIFT_COUNT (510) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (1403) +#define YY_SHIFT_MAX (1439) static const unsigned short int yy_shift_ofst[] = { - /* 0 */ 176, 246, 344, 357, 357, 357, 357, 468, 357, 357, - /* 10 */ 600, 650, 76, 567, 600, 600, 600, 600, 600, 600, - /* 20 */ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, - /* 30 */ 600, 600, 600, 312, 312, 312, 163, 639, 639, 59, - /* 40 */ 49, 49, 5, 639, 49, 49, 49, 49, 49, 49, - /* 50 */ 83, 129, 138, 138, 5, 177, 129, 49, 49, 129, - /* 60 */ 49, 129, 177, 129, 129, 49, 185, 0, 19, 78, - /* 70 */ 78, 74, 806, 256, 93, 256, 256, 256, 256, 256, - /* 80 */ 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - /* 90 */ 256, 256, 256, 256, 518, 399, 334, 334, 334, 498, - /* 100 */ 220, 177, 129, 129, 129, 189, 79, 79, 79, 79, - /* 110 */ 79, 79, 645, 22, 314, 405, 133, 222, 31, 507, - /* 120 */ 500, 481, 252, 481, 553, 505, 526, 761, 750, 755, - /* 130 */ 662, 761, 761, 697, 700, 700, 761, 820, 177, 854, - /* 140 */ 83, 220, 869, 83, 83, 761, 83, 884, 129, 129, - /* 150 */ 129, 129, 129, 129, 129, 129, 129, 129, 129, 755, - /* 160 */ 755, 761, 884, 220, 820, 796, 177, 854, 185, 220, - /* 170 */ 869, 185, 927, 766, 775, 800, 766, 775, 800, 800, - /* 180 */ 769, 780, 805, 797, 812, 220, 970, 880, 815, 825, - /* 190 */ 830, 957, 129, 775, 800, 800, 775, 800, 914, 220, - /* 200 */ 869, 185, 189, 185, 220, 983, 755, 755, 761, 185, - /* 210 */ 884, 1412, 1412, 1412, 1412, 1412, 21, 811, 108, 950, - /* 220 */ 992, 999, 191, 602, 308, 821, 44, 44, 44, 44, - /* 230 */ 44, 44, 44, 450, 277, 395, 331, 112, 112, 112, - /* 240 */ 112, 291, 85, 576, 623, 634, 635, 636, 714, 715, - /* 250 */ 717, 724, 651, 680, 682, 693, 530, 593, 607, 708, - /* 260 */ 673, 709, 672, 729, 744, 746, 772, 776, 50, 713, - /* 270 */ 784, 790, 795, 817, 823, 828, 656, 1076, 1080, 1023, - /* 280 */ 1084, 1047, 935, 1049, 1060, 1065, 954, 1108, 1071, 1072, - /* 290 */ 960, 1117, 1081, 1118, 1083, 1122, 1054, 982, 984, 1022, - /* 300 */ 989, 1129, 1130, 1082, 997, 1134, 1140, 1061, 1143, 1144, - /* 310 */ 1146, 1147, 1148, 1150, 1151, 1152, 1153, 1155, 1156, 1157, - /* 320 */ 1158, 1044, 1160, 1163, 1164, 1170, 1172, 1173, 1159, 1174, - /* 330 */ 1177, 1178, 1180, 1184, 1185, 1186, 1187, 1188, 1162, 1189, - /* 340 */ 1142, 1195, 1196, 1168, 1171, 1165, 1198, 1209, 1212, 1213, - /* 350 */ 1137, 1145, 1181, 1149, 1200, 1223, 1190, 1191, 1192, 1193, - /* 360 */ 1149, 1206, 1208, 1225, 1204, 1227, 1211, 1215, 1247, 1226, - /* 370 */ 1214, 1250, 1229, 1256, 1235, 1238, 1260, 1131, 1115, 1228, - /* 380 */ 1264, 1124, 1243, 1138, 1154, 1273, 1274, 1166, 1279, 1216, - /* 390 */ 1237, 1161, 1220, 1221, 1102, 1219, 1230, 1222, 1224, 1231, - /* 400 */ 1232, 1234, 1236, 1240, 1202, 1239, 1242, 1110, 1241, 1244, - /* 410 */ 1217, 1120, 1245, 1218, 1246, 1248, 1133, 1291, 1266, 1272, - /* 420 */ 1280, 1281, 1282, 1287, 1315, 1175, 1251, 1257, 1259, 1262, - /* 430 */ 1263, 1265, 1267, 1268, 1201, 1269, 1326, 1296, 1233, 1271, - /* 440 */ 1255, 1261, 1270, 1319, 1275, 1276, 1277, 1305, 1307, 1283, - /* 450 */ 1278, 1308, 1284, 1285, 1311, 1288, 1289, 1312, 1292, 1290, - /* 460 */ 1316, 1293, 1286, 1294, 1295, 1297, 1341, 1299, 1298, 1327, - /* 470 */ 1300, 1301, 1302, 1328, 1149, 1342, 1320, 1322, 1350, 1335, - /* 480 */ 1336, 1337, 1338, 1339, 1340, 1344, 1357, 1345, 1149, 1346, - /* 490 */ 1347, 1348, 1349, 1352, 1354, 1355, 1356, 1395, 1358, 1361, - /* 500 */ 1359, 1398, 1362, 1364, 1399, 1403, 1383, 1385, 1386, 1387, - /* 510 */ 1389, 1391, + /* 0 */ 598, 0, 39, 78, 78, 78, 78, 234, 78, 78, + /* 10 */ 312, 468, 120, 273, 312, 312, 312, 312, 312, 312, + /* 20 */ 312, 312, 312, 312, 312, 312, 312, 312, 312, 312, + /* 30 */ 312, 312, 312, 206, 206, 206, 159, 1226, 1226, 34, + /* 40 */ 81, 81, 125, 1226, 81, 81, 81, 81, 81, 81, + /* 50 */ 360, 395, 465, 465, 125, 529, 395, 81, 81, 395, + /* 60 */ 81, 395, 529, 395, 395, 81, 512, 148, 431, 411, + /* 70 */ 411, 252, 425, 1232, 240, 1232, 1232, 1232, 1232, 1232, + /* 80 */ 1232, 1232, 1232, 1232, 1232, 1232, 1232, 1232, 1232, 1232, + /* 90 */ 1232, 1232, 1232, 1232, 38, 409, 23, 23, 23, 650, + /* 100 */ 568, 529, 395, 395, 395, 597, 271, 271, 271, 271, + /* 110 */ 271, 271, 809, 288, 402, 372, 119, 477, 63, 663, + /* 120 */ 432, 444, 267, 444, 595, 533, 537, 775, 771, 779, + /* 130 */ 686, 775, 775, 715, 711, 711, 775, 828, 529, 854, + /* 140 */ 360, 568, 858, 360, 360, 775, 360, 877, 395, 395, + /* 150 */ 395, 395, 395, 395, 395, 395, 395, 395, 395, 779, + /* 160 */ 779, 775, 877, 568, 828, 783, 529, 854, 512, 568, + /* 170 */ 858, 512, 911, 757, 761, 796, 757, 761, 796, 796, + /* 180 */ 768, 782, 795, 799, 804, 568, 961, 867, 788, 790, + /* 190 */ 797, 926, 395, 761, 796, 796, 761, 796, 874, 568, + /* 200 */ 858, 512, 597, 512, 568, 948, 779, 779, 775, 512, + /* 210 */ 877, 1448, 1448, 1448, 1448, 1448, 605, 578, 491, 1276, + /* 220 */ 1202, 1224, 16, 108, 333, 136, 136, 136, 136, 136, + /* 230 */ 136, 136, 149, 36, 482, 426, 359, 359, 359, 359, + /* 240 */ 383, 361, 608, 622, 624, 659, 667, 590, 734, 747, + /* 250 */ 681, 669, 701, 706, 646, 522, 621, 586, 720, 643, + /* 260 */ 721, 100, 722, 726, 744, 751, 764, 668, 737, 785, + /* 270 */ 787, 791, 792, 816, 817, 184, 1046, 1047, 988, 1054, + /* 280 */ 1013, 904, 1020, 1021, 1022, 910, 1063, 1026, 1032, 921, + /* 290 */ 1080, 1043, 1082, 1048, 1084, 1018, 947, 949, 987, 955, + /* 300 */ 1094, 1095, 1053, 962, 1097, 1104, 1031, 1107, 1114, 1116, + /* 310 */ 1117, 1118, 1120, 1122, 1124, 1125, 1128, 1129, 1130, 1131, + /* 320 */ 1017, 1133, 1134, 1139, 1140, 1141, 1148, 1135, 1150, 1151, + /* 330 */ 1152, 1153, 1155, 1156, 1158, 1160, 1161, 1123, 1165, 1121, + /* 340 */ 1170, 1171, 1136, 1142, 1132, 1172, 1176, 1177, 1189, 1113, + /* 350 */ 1127, 1154, 1126, 1174, 1197, 1168, 1169, 1175, 1178, 1126, + /* 360 */ 1179, 1180, 1198, 1186, 1199, 1188, 1173, 1219, 1208, 1203, + /* 370 */ 1236, 1215, 1243, 1222, 1225, 1246, 1119, 1100, 1213, 1253, + /* 380 */ 1115, 1238, 1147, 1138, 1262, 1266, 1149, 1269, 1217, 1248, + /* 390 */ 1167, 1227, 1229, 1143, 1240, 1235, 1241, 1239, 1250, 1251, + /* 400 */ 1259, 1252, 1264, 1254, 1263, 1267, 1157, 1268, 1270, 1258, + /* 410 */ 1159, 1274, 1261, 1273, 1278, 1166, 1344, 1311, 1312, 1313, + /* 420 */ 1314, 1315, 1316, 1353, 1201, 1277, 1287, 1290, 1291, 1292, + /* 430 */ 1293, 1296, 1297, 1233, 1298, 1368, 1326, 1247, 1302, 1294, + /* 440 */ 1295, 1299, 1352, 1306, 1303, 1307, 1340, 1341, 1317, 1319, + /* 450 */ 1346, 1321, 1322, 1347, 1324, 1325, 1356, 1327, 1328, 1359, + /* 460 */ 1330, 1308, 1309, 1310, 1318, 1369, 1323, 1331, 1363, 1304, + /* 470 */ 1337, 1338, 1371, 1126, 1388, 1365, 1364, 1392, 1377, 1378, + /* 480 */ 1379, 1380, 1381, 1382, 1383, 1400, 1385, 1126, 1386, 1387, + /* 490 */ 1389, 1390, 1391, 1393, 1394, 1395, 1426, 1396, 1399, 1397, + /* 500 */ 1430, 1398, 1401, 1437, 1439, 1419, 1421, 1422, 1423, 1425, + /* 510 */ 1427, }; #define YY_REDUCE_COUNT (215) -#define YY_REDUCE_MIN (-266) -#define YY_REDUCE_MAX (1059) +#define YY_REDUCE_MIN (-226) +#define YY_REDUCE_MAX (1051) static const short yy_reduce_ofst[] = { - /* 0 */ 227, -9, 71, 168, 221, 285, 329, 403, 35, 502, - /* 10 */ 558, 606, 550, 660, 669, 703, 739, 747, 773, 212, - /* 20 */ 300, 802, 826, 850, 874, 903, 929, 937, 972, 978, - /* 30 */ 1007, 1013, 1059, -50, 113, 309, -10, -222, -218, -19, - /* 40 */ -207, -206, 358, -246, -187, -101, -86, -59, -2, 55, - /* 50 */ 80, -217, -84, 119, 161, -181, -16, 115, 143, 216, - /* 60 */ 366, 190, -179, 226, 290, 416, 215, -195, -266, -266, - /* 70 */ -266, 33, 174, 18, 193, 24, 183, 293, 307, 324, - /* 80 */ 365, 373, 393, 404, 427, 429, 430, 433, 437, 438, - /* 90 */ 454, 482, 486, 487, -202, 137, 274, 318, 343, 420, - /* 100 */ 351, -204, -15, 299, 457, -153, 48, 86, 120, 154, - /* 110 */ 224, 253, 251, 338, 353, 257, 387, 466, 453, 554, - /* 120 */ 508, 483, 483, 483, 545, 484, 501, 575, 535, 583, - /* 130 */ 556, 592, 608, 579, 612, 618, 620, 605, 624, 625, - /* 140 */ 664, 654, 653, 685, 687, 690, 691, 699, 683, 688, - /* 150 */ 689, 692, 694, 695, 696, 701, 702, 704, 705, 698, - /* 160 */ 723, 706, 733, 678, 686, 707, 710, 711, 735, 716, - /* 170 */ 712, 737, 719, 661, 726, 728, 667, 731, 730, 736, - /* 180 */ 674, 720, 721, 732, 483, 756, 740, 741, 722, 718, - /* 190 */ 727, 759, 545, 782, 785, 786, 792, 787, 798, 813, - /* 200 */ 803, 834, 829, 838, 827, 833, 841, 843, 852, 860, - /* 210 */ 857, 818, 851, 858, 862, 877, + /* 0 */ -180, 262, 495, -198, -58, 447, 538, 574, -129, 601, + /* 10 */ 656, -14, 617, 700, 705, 762, 176, 767, 803, 811, + /* 20 */ 837, 846, 873, 881, 917, 922, 958, 963, 969, 1010, + /* 30 */ 1025, 1036, 1051, -195, -170, -147, 197, -213, -204, 41, + /* 40 */ -209, -206, 247, -132, -208, -175, -1, 11, 111, 121, + /* 50 */ 318, -142, -176, -40, 118, -62, -214, 189, 335, -6, + /* 60 */ 354, 232, 110, 97, 314, 355, -55, -201, -156, -156, + /* 70 */ -156, 173, -185, -107, 126, 208, 259, 308, 310, 339, + /* 80 */ 362, 371, 388, 389, 390, 391, 406, 434, 435, 436, + /* 90 */ 437, 438, 440, 441, 122, 281, 329, 413, 414, 467, + /* 100 */ -10, 172, 65, -149, 338, 161, -226, -221, 387, 490, + /* 110 */ 497, 500, 454, 539, 530, 451, 456, 519, 475, 548, + /* 120 */ 503, 501, 501, 501, 552, 487, 511, 587, 555, 599, + /* 130 */ 571, 614, 619, 592, 602, 606, 636, 594, 628, 625, + /* 140 */ 664, 647, 642, 677, 678, 685, 679, 694, 676, 680, + /* 150 */ 682, 683, 688, 689, 690, 692, 697, 698, 699, 712, + /* 160 */ 713, 693, 723, 674, 655, 684, 691, 695, 725, 704, + /* 170 */ 707, 731, 687, 651, 714, 727, 666, 728, 730, 732, + /* 180 */ 671, 696, 702, 708, 501, 748, 729, 710, 703, 716, + /* 190 */ 724, 733, 552, 749, 745, 752, 750, 754, 759, 773, + /* 200 */ 769, 801, 798, 802, 786, 794, 806, 819, 813, 825, + /* 210 */ 831, 789, 820, 821, 827, 842, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, - /* 10 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, - /* 20 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, - /* 30 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, - /* 40 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, - /* 50 */ 1204, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, - /* 60 */ 1151, 1151, 1151, 1151, 1151, 1151, 1202, 1331, 1151, 1462, - /* 70 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, - /* 80 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, - /* 90 */ 1151, 1151, 1151, 1151, 1151, 1204, 1473, 1473, 1473, 1202, - /* 100 */ 1151, 1151, 1151, 1151, 1151, 1289, 1151, 1151, 1151, 1151, - /* 110 */ 1151, 1151, 1365, 1151, 1151, 1537, 1151, 1242, 1497, 1151, - /* 120 */ 1489, 1465, 1479, 1466, 1151, 1522, 1482, 1151, 1151, 1151, - /* 130 */ 1357, 1151, 1151, 1336, 1333, 1333, 1151, 1151, 1151, 1151, - /* 140 */ 1204, 1151, 1151, 1204, 1204, 1151, 1204, 1151, 1151, 1151, - /* 150 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, - /* 160 */ 1151, 1151, 1151, 1151, 1151, 1367, 1151, 1151, 1202, 1151, - /* 170 */ 1151, 1202, 1151, 1504, 1502, 1151, 1504, 1502, 1151, 1151, - /* 180 */ 1516, 1512, 1495, 1493, 1479, 1151, 1151, 1151, 1540, 1528, - /* 190 */ 1524, 1151, 1151, 1502, 1151, 1151, 1502, 1151, 1344, 1151, - /* 200 */ 1151, 1202, 1151, 1202, 1151, 1258, 1151, 1151, 1151, 1202, - /* 210 */ 1151, 1359, 1292, 1292, 1205, 1156, 1151, 1151, 1151, 1151, - /* 220 */ 1151, 1151, 1151, 1151, 1151, 1151, 1427, 1515, 1514, 1426, - /* 230 */ 1439, 1438, 1437, 1151, 1151, 1151, 1151, 1421, 1422, 1420, - /* 240 */ 1419, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, - /* 250 */ 1151, 1151, 1151, 1151, 1151, 1463, 1151, 1525, 1529, 1151, - /* 260 */ 1151, 1151, 1404, 1151, 1151, 1151, 1151, 1151, 1151, 1151, - /* 270 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, - /* 280 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, - /* 290 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, - /* 300 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, - /* 310 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, - /* 320 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, - /* 330 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, - /* 340 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, - /* 350 */ 1151, 1151, 1151, 1303, 1151, 1151, 1151, 1151, 1151, 1151, - /* 360 */ 1228, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, - /* 370 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, - /* 380 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, - /* 390 */ 1151, 1151, 1486, 1496, 1151, 1151, 1151, 1151, 1151, 1151, - /* 400 */ 1151, 1151, 1151, 1151, 1404, 1151, 1513, 1151, 1472, 1468, - /* 410 */ 1151, 1151, 1464, 1151, 1151, 1523, 1151, 1151, 1151, 1151, - /* 420 */ 1151, 1151, 1151, 1151, 1458, 1151, 1151, 1151, 1151, 1151, - /* 430 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, - /* 440 */ 1151, 1403, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1286, - /* 450 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, - /* 460 */ 1151, 1151, 1271, 1269, 1268, 1267, 1151, 1264, 1151, 1151, - /* 470 */ 1151, 1151, 1151, 1151, 1294, 1151, 1151, 1151, 1151, 1151, - /* 480 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1214, 1151, - /* 490 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, - /* 500 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, - /* 510 */ 1151, 1151, + /* 0 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, + /* 10 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, + /* 20 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, + /* 30 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, + /* 40 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, + /* 50 */ 1205, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, + /* 60 */ 1152, 1152, 1152, 1152, 1152, 1152, 1203, 1332, 1152, 1464, + /* 70 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, + /* 80 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, + /* 90 */ 1152, 1152, 1152, 1152, 1152, 1205, 1475, 1475, 1475, 1203, + /* 100 */ 1152, 1152, 1152, 1152, 1152, 1290, 1152, 1152, 1152, 1152, + /* 110 */ 1152, 1152, 1366, 1152, 1152, 1539, 1152, 1243, 1499, 1152, + /* 120 */ 1491, 1467, 1481, 1468, 1152, 1524, 1484, 1152, 1152, 1152, + /* 130 */ 1358, 1152, 1152, 1337, 1334, 1334, 1152, 1152, 1152, 1152, + /* 140 */ 1205, 1152, 1152, 1205, 1205, 1152, 1205, 1152, 1152, 1152, + /* 150 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, + /* 160 */ 1152, 1152, 1152, 1152, 1152, 1368, 1152, 1152, 1203, 1152, + /* 170 */ 1152, 1203, 1152, 1506, 1504, 1152, 1506, 1504, 1152, 1152, + /* 180 */ 1518, 1514, 1497, 1495, 1481, 1152, 1152, 1152, 1542, 1530, + /* 190 */ 1526, 1152, 1152, 1504, 1152, 1152, 1504, 1152, 1345, 1152, + /* 200 */ 1152, 1203, 1152, 1203, 1152, 1259, 1152, 1152, 1152, 1203, + /* 210 */ 1152, 1360, 1293, 1293, 1206, 1157, 1152, 1152, 1152, 1152, + /* 220 */ 1152, 1152, 1152, 1152, 1152, 1428, 1517, 1516, 1427, 1441, + /* 230 */ 1440, 1439, 1152, 1152, 1152, 1152, 1422, 1423, 1421, 1420, + /* 240 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, + /* 250 */ 1152, 1152, 1152, 1152, 1465, 1152, 1527, 1531, 1152, 1152, + /* 260 */ 1152, 1405, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, + /* 270 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, + /* 280 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, + /* 290 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, + /* 300 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, + /* 310 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, + /* 320 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, + /* 330 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, + /* 340 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, + /* 350 */ 1152, 1152, 1304, 1152, 1152, 1152, 1152, 1152, 1152, 1229, + /* 360 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, + /* 370 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, + /* 380 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, + /* 390 */ 1152, 1488, 1498, 1152, 1152, 1152, 1152, 1152, 1152, 1152, + /* 400 */ 1152, 1152, 1152, 1405, 1152, 1515, 1152, 1474, 1470, 1152, + /* 410 */ 1152, 1466, 1152, 1152, 1525, 1152, 1152, 1152, 1152, 1152, + /* 420 */ 1152, 1152, 1152, 1460, 1152, 1152, 1152, 1152, 1152, 1152, + /* 430 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, + /* 440 */ 1404, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1287, 1152, + /* 450 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, + /* 460 */ 1152, 1272, 1270, 1269, 1268, 1152, 1265, 1152, 1152, 1152, + /* 470 */ 1152, 1152, 1152, 1295, 1152, 1152, 1152, 1152, 1152, 1152, + /* 480 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1215, 1152, 1152, + /* 490 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, + /* 500 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, + /* 510 */ 1152, }; /********** End of lemon-generated parsing tables *****************************/ @@ -918,7 +924,7 @@ static const char *const yyTokenName[] = { /* 154 */ "SYNCDB", /* 155 */ "NULL", /* 156 */ "NK_VARIABLE", - /* 157 */ "NK_UNDERLINE", + /* 157 */ "NOW", /* 158 */ "ROWTS", /* 159 */ "TBNAME", /* 160 */ "QSTARTTS", @@ -1348,119 +1354,120 @@ static const char *const yyRuleName[] = { /* 273 */ "expression_list ::= expression_list NK_COMMA expression", /* 274 */ "column_reference ::= column_name", /* 275 */ "column_reference ::= table_name NK_DOT column_name", - /* 276 */ "pseudo_column ::= NK_UNDERLINE ROWTS", - /* 277 */ "pseudo_column ::= TBNAME", - /* 278 */ "pseudo_column ::= NK_UNDERLINE QSTARTTS", - /* 279 */ "pseudo_column ::= NK_UNDERLINE QENDTS", - /* 280 */ "pseudo_column ::= NK_UNDERLINE WSTARTTS", - /* 281 */ "pseudo_column ::= NK_UNDERLINE WENDTS", - /* 282 */ "pseudo_column ::= NK_UNDERLINE WDURATION", - /* 283 */ "predicate ::= expression compare_op expression", - /* 284 */ "predicate ::= expression BETWEEN expression AND expression", - /* 285 */ "predicate ::= expression NOT BETWEEN expression AND expression", - /* 286 */ "predicate ::= expression IS NULL", - /* 287 */ "predicate ::= expression IS NOT NULL", - /* 288 */ "predicate ::= expression in_op in_predicate_value", - /* 289 */ "compare_op ::= NK_LT", - /* 290 */ "compare_op ::= NK_GT", - /* 291 */ "compare_op ::= NK_LE", - /* 292 */ "compare_op ::= NK_GE", - /* 293 */ "compare_op ::= NK_NE", - /* 294 */ "compare_op ::= NK_EQ", - /* 295 */ "compare_op ::= LIKE", - /* 296 */ "compare_op ::= NOT LIKE", - /* 297 */ "compare_op ::= MATCH", - /* 298 */ "compare_op ::= NMATCH", - /* 299 */ "in_op ::= IN", - /* 300 */ "in_op ::= NOT IN", - /* 301 */ "in_predicate_value ::= NK_LP expression_list NK_RP", - /* 302 */ "boolean_value_expression ::= boolean_primary", - /* 303 */ "boolean_value_expression ::= NOT boolean_primary", - /* 304 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", - /* 305 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", - /* 306 */ "boolean_primary ::= predicate", - /* 307 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", - /* 308 */ "common_expression ::= expression", - /* 309 */ "common_expression ::= boolean_value_expression", - /* 310 */ "from_clause ::= FROM table_reference_list", - /* 311 */ "table_reference_list ::= table_reference", - /* 312 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", - /* 313 */ "table_reference ::= table_primary", - /* 314 */ "table_reference ::= joined_table", - /* 315 */ "table_primary ::= table_name alias_opt", - /* 316 */ "table_primary ::= db_name NK_DOT table_name alias_opt", - /* 317 */ "table_primary ::= subquery alias_opt", - /* 318 */ "table_primary ::= parenthesized_joined_table", - /* 319 */ "alias_opt ::=", - /* 320 */ "alias_opt ::= table_alias", - /* 321 */ "alias_opt ::= AS table_alias", - /* 322 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", - /* 323 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", - /* 324 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", - /* 325 */ "join_type ::=", - /* 326 */ "join_type ::= INNER", - /* 327 */ "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", - /* 328 */ "set_quantifier_opt ::=", - /* 329 */ "set_quantifier_opt ::= DISTINCT", - /* 330 */ "set_quantifier_opt ::= ALL", - /* 331 */ "select_list ::= NK_STAR", - /* 332 */ "select_list ::= select_sublist", - /* 333 */ "select_sublist ::= select_item", - /* 334 */ "select_sublist ::= select_sublist NK_COMMA select_item", - /* 335 */ "select_item ::= common_expression", - /* 336 */ "select_item ::= common_expression column_alias", - /* 337 */ "select_item ::= common_expression AS column_alias", - /* 338 */ "select_item ::= table_name NK_DOT NK_STAR", - /* 339 */ "where_clause_opt ::=", - /* 340 */ "where_clause_opt ::= WHERE search_condition", - /* 341 */ "partition_by_clause_opt ::=", - /* 342 */ "partition_by_clause_opt ::= PARTITION BY expression_list", - /* 343 */ "twindow_clause_opt ::=", - /* 344 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", - /* 345 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP", - /* 346 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", - /* 347 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", - /* 348 */ "sliding_opt ::=", - /* 349 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", - /* 350 */ "fill_opt ::=", - /* 351 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", - /* 352 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", - /* 353 */ "fill_mode ::= NONE", - /* 354 */ "fill_mode ::= PREV", - /* 355 */ "fill_mode ::= NULL", - /* 356 */ "fill_mode ::= LINEAR", - /* 357 */ "fill_mode ::= NEXT", - /* 358 */ "group_by_clause_opt ::=", - /* 359 */ "group_by_clause_opt ::= GROUP BY group_by_list", - /* 360 */ "group_by_list ::= expression", - /* 361 */ "group_by_list ::= group_by_list NK_COMMA expression", - /* 362 */ "having_clause_opt ::=", - /* 363 */ "having_clause_opt ::= HAVING search_condition", - /* 364 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt", - /* 365 */ "query_expression_body ::= query_primary", - /* 366 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body", - /* 367 */ "query_primary ::= query_specification", - /* 368 */ "order_by_clause_opt ::=", - /* 369 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", - /* 370 */ "slimit_clause_opt ::=", - /* 371 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", - /* 372 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", - /* 373 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 374 */ "limit_clause_opt ::=", - /* 375 */ "limit_clause_opt ::= LIMIT NK_INTEGER", - /* 376 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", - /* 377 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 378 */ "subquery ::= NK_LP query_expression NK_RP", - /* 379 */ "search_condition ::= common_expression", - /* 380 */ "sort_specification_list ::= sort_specification", - /* 381 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", - /* 382 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt", - /* 383 */ "ordering_specification_opt ::=", - /* 384 */ "ordering_specification_opt ::= ASC", - /* 385 */ "ordering_specification_opt ::= DESC", - /* 386 */ "null_ordering_opt ::=", - /* 387 */ "null_ordering_opt ::= NULLS FIRST", - /* 388 */ "null_ordering_opt ::= NULLS LAST", + /* 276 */ "pseudo_column ::= NOW", + /* 277 */ "pseudo_column ::= ROWTS", + /* 278 */ "pseudo_column ::= TBNAME", + /* 279 */ "pseudo_column ::= QSTARTTS", + /* 280 */ "pseudo_column ::= QENDTS", + /* 281 */ "pseudo_column ::= WSTARTTS", + /* 282 */ "pseudo_column ::= WENDTS", + /* 283 */ "pseudo_column ::= WDURATION", + /* 284 */ "predicate ::= expression compare_op expression", + /* 285 */ "predicate ::= expression BETWEEN expression AND expression", + /* 286 */ "predicate ::= expression NOT BETWEEN expression AND expression", + /* 287 */ "predicate ::= expression IS NULL", + /* 288 */ "predicate ::= expression IS NOT NULL", + /* 289 */ "predicate ::= expression in_op in_predicate_value", + /* 290 */ "compare_op ::= NK_LT", + /* 291 */ "compare_op ::= NK_GT", + /* 292 */ "compare_op ::= NK_LE", + /* 293 */ "compare_op ::= NK_GE", + /* 294 */ "compare_op ::= NK_NE", + /* 295 */ "compare_op ::= NK_EQ", + /* 296 */ "compare_op ::= LIKE", + /* 297 */ "compare_op ::= NOT LIKE", + /* 298 */ "compare_op ::= MATCH", + /* 299 */ "compare_op ::= NMATCH", + /* 300 */ "in_op ::= IN", + /* 301 */ "in_op ::= NOT IN", + /* 302 */ "in_predicate_value ::= NK_LP expression_list NK_RP", + /* 303 */ "boolean_value_expression ::= boolean_primary", + /* 304 */ "boolean_value_expression ::= NOT boolean_primary", + /* 305 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", + /* 306 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", + /* 307 */ "boolean_primary ::= predicate", + /* 308 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", + /* 309 */ "common_expression ::= expression", + /* 310 */ "common_expression ::= boolean_value_expression", + /* 311 */ "from_clause ::= FROM table_reference_list", + /* 312 */ "table_reference_list ::= table_reference", + /* 313 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", + /* 314 */ "table_reference ::= table_primary", + /* 315 */ "table_reference ::= joined_table", + /* 316 */ "table_primary ::= table_name alias_opt", + /* 317 */ "table_primary ::= db_name NK_DOT table_name alias_opt", + /* 318 */ "table_primary ::= subquery alias_opt", + /* 319 */ "table_primary ::= parenthesized_joined_table", + /* 320 */ "alias_opt ::=", + /* 321 */ "alias_opt ::= table_alias", + /* 322 */ "alias_opt ::= AS table_alias", + /* 323 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", + /* 324 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", + /* 325 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", + /* 326 */ "join_type ::=", + /* 327 */ "join_type ::= INNER", + /* 328 */ "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", + /* 329 */ "set_quantifier_opt ::=", + /* 330 */ "set_quantifier_opt ::= DISTINCT", + /* 331 */ "set_quantifier_opt ::= ALL", + /* 332 */ "select_list ::= NK_STAR", + /* 333 */ "select_list ::= select_sublist", + /* 334 */ "select_sublist ::= select_item", + /* 335 */ "select_sublist ::= select_sublist NK_COMMA select_item", + /* 336 */ "select_item ::= common_expression", + /* 337 */ "select_item ::= common_expression column_alias", + /* 338 */ "select_item ::= common_expression AS column_alias", + /* 339 */ "select_item ::= table_name NK_DOT NK_STAR", + /* 340 */ "where_clause_opt ::=", + /* 341 */ "where_clause_opt ::= WHERE search_condition", + /* 342 */ "partition_by_clause_opt ::=", + /* 343 */ "partition_by_clause_opt ::= PARTITION BY expression_list", + /* 344 */ "twindow_clause_opt ::=", + /* 345 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", + /* 346 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP", + /* 347 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", + /* 348 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", + /* 349 */ "sliding_opt ::=", + /* 350 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", + /* 351 */ "fill_opt ::=", + /* 352 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", + /* 353 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", + /* 354 */ "fill_mode ::= NONE", + /* 355 */ "fill_mode ::= PREV", + /* 356 */ "fill_mode ::= NULL", + /* 357 */ "fill_mode ::= LINEAR", + /* 358 */ "fill_mode ::= NEXT", + /* 359 */ "group_by_clause_opt ::=", + /* 360 */ "group_by_clause_opt ::= GROUP BY group_by_list", + /* 361 */ "group_by_list ::= expression", + /* 362 */ "group_by_list ::= group_by_list NK_COMMA expression", + /* 363 */ "having_clause_opt ::=", + /* 364 */ "having_clause_opt ::= HAVING search_condition", + /* 365 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt", + /* 366 */ "query_expression_body ::= query_primary", + /* 367 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body", + /* 368 */ "query_primary ::= query_specification", + /* 369 */ "order_by_clause_opt ::=", + /* 370 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", + /* 371 */ "slimit_clause_opt ::=", + /* 372 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", + /* 373 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", + /* 374 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 375 */ "limit_clause_opt ::=", + /* 376 */ "limit_clause_opt ::= LIMIT NK_INTEGER", + /* 377 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", + /* 378 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 379 */ "subquery ::= NK_LP query_expression NK_RP", + /* 380 */ "search_condition ::= common_expression", + /* 381 */ "sort_specification_list ::= sort_specification", + /* 382 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", + /* 383 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt", + /* 384 */ "ordering_specification_opt ::=", + /* 385 */ "ordering_specification_opt ::= ASC", + /* 386 */ "ordering_specification_opt ::= DESC", + /* 387 */ "null_ordering_opt ::=", + /* 388 */ "null_ordering_opt ::= NULLS FIRST", + /* 389 */ "null_ordering_opt ::= NULLS LAST", }; #endif /* NDEBUG */ @@ -2308,119 +2315,120 @@ static const struct { { 249, -3 }, /* (273) expression_list ::= expression_list NK_COMMA expression */ { 264, -1 }, /* (274) column_reference ::= column_name */ { 264, -3 }, /* (275) column_reference ::= table_name NK_DOT column_name */ - { 263, -2 }, /* (276) pseudo_column ::= NK_UNDERLINE ROWTS */ - { 263, -1 }, /* (277) pseudo_column ::= TBNAME */ - { 263, -2 }, /* (278) pseudo_column ::= NK_UNDERLINE QSTARTTS */ - { 263, -2 }, /* (279) pseudo_column ::= NK_UNDERLINE QENDTS */ - { 263, -2 }, /* (280) pseudo_column ::= NK_UNDERLINE WSTARTTS */ - { 263, -2 }, /* (281) pseudo_column ::= NK_UNDERLINE WENDTS */ - { 263, -2 }, /* (282) pseudo_column ::= NK_UNDERLINE WDURATION */ - { 266, -3 }, /* (283) predicate ::= expression compare_op expression */ - { 266, -5 }, /* (284) predicate ::= expression BETWEEN expression AND expression */ - { 266, -6 }, /* (285) predicate ::= expression NOT BETWEEN expression AND expression */ - { 266, -3 }, /* (286) predicate ::= expression IS NULL */ - { 266, -4 }, /* (287) predicate ::= expression IS NOT NULL */ - { 266, -3 }, /* (288) predicate ::= expression in_op in_predicate_value */ - { 267, -1 }, /* (289) compare_op ::= NK_LT */ - { 267, -1 }, /* (290) compare_op ::= NK_GT */ - { 267, -1 }, /* (291) compare_op ::= NK_LE */ - { 267, -1 }, /* (292) compare_op ::= NK_GE */ - { 267, -1 }, /* (293) compare_op ::= NK_NE */ - { 267, -1 }, /* (294) compare_op ::= NK_EQ */ - { 267, -1 }, /* (295) compare_op ::= LIKE */ - { 267, -2 }, /* (296) compare_op ::= NOT LIKE */ - { 267, -1 }, /* (297) compare_op ::= MATCH */ - { 267, -1 }, /* (298) compare_op ::= NMATCH */ - { 268, -1 }, /* (299) in_op ::= IN */ - { 268, -2 }, /* (300) in_op ::= NOT IN */ - { 269, -3 }, /* (301) in_predicate_value ::= NK_LP expression_list NK_RP */ - { 270, -1 }, /* (302) boolean_value_expression ::= boolean_primary */ - { 270, -2 }, /* (303) boolean_value_expression ::= NOT boolean_primary */ - { 270, -3 }, /* (304) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - { 270, -3 }, /* (305) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - { 271, -1 }, /* (306) boolean_primary ::= predicate */ - { 271, -3 }, /* (307) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - { 272, -1 }, /* (308) common_expression ::= expression */ - { 272, -1 }, /* (309) common_expression ::= boolean_value_expression */ - { 273, -2 }, /* (310) from_clause ::= FROM table_reference_list */ - { 274, -1 }, /* (311) table_reference_list ::= table_reference */ - { 274, -3 }, /* (312) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - { 275, -1 }, /* (313) table_reference ::= table_primary */ - { 275, -1 }, /* (314) table_reference ::= joined_table */ - { 276, -2 }, /* (315) table_primary ::= table_name alias_opt */ - { 276, -4 }, /* (316) table_primary ::= db_name NK_DOT table_name alias_opt */ - { 276, -2 }, /* (317) table_primary ::= subquery alias_opt */ - { 276, -1 }, /* (318) table_primary ::= parenthesized_joined_table */ - { 278, 0 }, /* (319) alias_opt ::= */ - { 278, -1 }, /* (320) alias_opt ::= table_alias */ - { 278, -2 }, /* (321) alias_opt ::= AS table_alias */ - { 279, -3 }, /* (322) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - { 279, -3 }, /* (323) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - { 277, -6 }, /* (324) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ - { 280, 0 }, /* (325) join_type ::= */ - { 280, -1 }, /* (326) join_type ::= INNER */ - { 282, -9 }, /* (327) 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 */ - { 283, 0 }, /* (328) set_quantifier_opt ::= */ - { 283, -1 }, /* (329) set_quantifier_opt ::= DISTINCT */ - { 283, -1 }, /* (330) set_quantifier_opt ::= ALL */ - { 284, -1 }, /* (331) select_list ::= NK_STAR */ - { 284, -1 }, /* (332) select_list ::= select_sublist */ - { 290, -1 }, /* (333) select_sublist ::= select_item */ - { 290, -3 }, /* (334) select_sublist ::= select_sublist NK_COMMA select_item */ - { 291, -1 }, /* (335) select_item ::= common_expression */ - { 291, -2 }, /* (336) select_item ::= common_expression column_alias */ - { 291, -3 }, /* (337) select_item ::= common_expression AS column_alias */ - { 291, -3 }, /* (338) select_item ::= table_name NK_DOT NK_STAR */ - { 285, 0 }, /* (339) where_clause_opt ::= */ - { 285, -2 }, /* (340) where_clause_opt ::= WHERE search_condition */ - { 286, 0 }, /* (341) partition_by_clause_opt ::= */ - { 286, -3 }, /* (342) partition_by_clause_opt ::= PARTITION BY expression_list */ - { 287, 0 }, /* (343) twindow_clause_opt ::= */ - { 287, -6 }, /* (344) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ - { 287, -4 }, /* (345) twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP */ - { 287, -6 }, /* (346) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ - { 287, -8 }, /* (347) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ - { 247, 0 }, /* (348) sliding_opt ::= */ - { 247, -4 }, /* (349) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ - { 292, 0 }, /* (350) fill_opt ::= */ - { 292, -4 }, /* (351) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - { 292, -6 }, /* (352) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ - { 293, -1 }, /* (353) fill_mode ::= NONE */ - { 293, -1 }, /* (354) fill_mode ::= PREV */ - { 293, -1 }, /* (355) fill_mode ::= NULL */ - { 293, -1 }, /* (356) fill_mode ::= LINEAR */ - { 293, -1 }, /* (357) fill_mode ::= NEXT */ - { 288, 0 }, /* (358) group_by_clause_opt ::= */ - { 288, -3 }, /* (359) group_by_clause_opt ::= GROUP BY group_by_list */ - { 294, -1 }, /* (360) group_by_list ::= expression */ - { 294, -3 }, /* (361) group_by_list ::= group_by_list NK_COMMA expression */ - { 289, 0 }, /* (362) having_clause_opt ::= */ - { 289, -2 }, /* (363) having_clause_opt ::= HAVING search_condition */ - { 251, -4 }, /* (364) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ - { 295, -1 }, /* (365) query_expression_body ::= query_primary */ - { 295, -4 }, /* (366) query_expression_body ::= query_expression_body UNION ALL query_expression_body */ - { 299, -1 }, /* (367) query_primary ::= query_specification */ - { 296, 0 }, /* (368) order_by_clause_opt ::= */ - { 296, -3 }, /* (369) order_by_clause_opt ::= ORDER BY sort_specification_list */ - { 297, 0 }, /* (370) slimit_clause_opt ::= */ - { 297, -2 }, /* (371) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - { 297, -4 }, /* (372) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - { 297, -4 }, /* (373) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - { 298, 0 }, /* (374) limit_clause_opt ::= */ - { 298, -2 }, /* (375) limit_clause_opt ::= LIMIT NK_INTEGER */ - { 298, -4 }, /* (376) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - { 298, -4 }, /* (377) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - { 265, -3 }, /* (378) subquery ::= NK_LP query_expression NK_RP */ - { 281, -1 }, /* (379) search_condition ::= common_expression */ - { 300, -1 }, /* (380) sort_specification_list ::= sort_specification */ - { 300, -3 }, /* (381) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - { 301, -3 }, /* (382) sort_specification ::= expression ordering_specification_opt null_ordering_opt */ - { 302, 0 }, /* (383) ordering_specification_opt ::= */ - { 302, -1 }, /* (384) ordering_specification_opt ::= ASC */ - { 302, -1 }, /* (385) ordering_specification_opt ::= DESC */ - { 303, 0 }, /* (386) null_ordering_opt ::= */ - { 303, -2 }, /* (387) null_ordering_opt ::= NULLS FIRST */ - { 303, -2 }, /* (388) null_ordering_opt ::= NULLS LAST */ + { 263, -1 }, /* (276) pseudo_column ::= NOW */ + { 263, -1 }, /* (277) pseudo_column ::= ROWTS */ + { 263, -1 }, /* (278) pseudo_column ::= TBNAME */ + { 263, -1 }, /* (279) pseudo_column ::= QSTARTTS */ + { 263, -1 }, /* (280) pseudo_column ::= QENDTS */ + { 263, -1 }, /* (281) pseudo_column ::= WSTARTTS */ + { 263, -1 }, /* (282) pseudo_column ::= WENDTS */ + { 263, -1 }, /* (283) pseudo_column ::= WDURATION */ + { 266, -3 }, /* (284) predicate ::= expression compare_op expression */ + { 266, -5 }, /* (285) predicate ::= expression BETWEEN expression AND expression */ + { 266, -6 }, /* (286) predicate ::= expression NOT BETWEEN expression AND expression */ + { 266, -3 }, /* (287) predicate ::= expression IS NULL */ + { 266, -4 }, /* (288) predicate ::= expression IS NOT NULL */ + { 266, -3 }, /* (289) predicate ::= expression in_op in_predicate_value */ + { 267, -1 }, /* (290) compare_op ::= NK_LT */ + { 267, -1 }, /* (291) compare_op ::= NK_GT */ + { 267, -1 }, /* (292) compare_op ::= NK_LE */ + { 267, -1 }, /* (293) compare_op ::= NK_GE */ + { 267, -1 }, /* (294) compare_op ::= NK_NE */ + { 267, -1 }, /* (295) compare_op ::= NK_EQ */ + { 267, -1 }, /* (296) compare_op ::= LIKE */ + { 267, -2 }, /* (297) compare_op ::= NOT LIKE */ + { 267, -1 }, /* (298) compare_op ::= MATCH */ + { 267, -1 }, /* (299) compare_op ::= NMATCH */ + { 268, -1 }, /* (300) in_op ::= IN */ + { 268, -2 }, /* (301) in_op ::= NOT IN */ + { 269, -3 }, /* (302) in_predicate_value ::= NK_LP expression_list NK_RP */ + { 270, -1 }, /* (303) boolean_value_expression ::= boolean_primary */ + { 270, -2 }, /* (304) boolean_value_expression ::= NOT boolean_primary */ + { 270, -3 }, /* (305) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + { 270, -3 }, /* (306) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + { 271, -1 }, /* (307) boolean_primary ::= predicate */ + { 271, -3 }, /* (308) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + { 272, -1 }, /* (309) common_expression ::= expression */ + { 272, -1 }, /* (310) common_expression ::= boolean_value_expression */ + { 273, -2 }, /* (311) from_clause ::= FROM table_reference_list */ + { 274, -1 }, /* (312) table_reference_list ::= table_reference */ + { 274, -3 }, /* (313) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + { 275, -1 }, /* (314) table_reference ::= table_primary */ + { 275, -1 }, /* (315) table_reference ::= joined_table */ + { 276, -2 }, /* (316) table_primary ::= table_name alias_opt */ + { 276, -4 }, /* (317) table_primary ::= db_name NK_DOT table_name alias_opt */ + { 276, -2 }, /* (318) table_primary ::= subquery alias_opt */ + { 276, -1 }, /* (319) table_primary ::= parenthesized_joined_table */ + { 278, 0 }, /* (320) alias_opt ::= */ + { 278, -1 }, /* (321) alias_opt ::= table_alias */ + { 278, -2 }, /* (322) alias_opt ::= AS table_alias */ + { 279, -3 }, /* (323) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + { 279, -3 }, /* (324) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + { 277, -6 }, /* (325) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ + { 280, 0 }, /* (326) join_type ::= */ + { 280, -1 }, /* (327) join_type ::= INNER */ + { 282, -9 }, /* (328) 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 */ + { 283, 0 }, /* (329) set_quantifier_opt ::= */ + { 283, -1 }, /* (330) set_quantifier_opt ::= DISTINCT */ + { 283, -1 }, /* (331) set_quantifier_opt ::= ALL */ + { 284, -1 }, /* (332) select_list ::= NK_STAR */ + { 284, -1 }, /* (333) select_list ::= select_sublist */ + { 290, -1 }, /* (334) select_sublist ::= select_item */ + { 290, -3 }, /* (335) select_sublist ::= select_sublist NK_COMMA select_item */ + { 291, -1 }, /* (336) select_item ::= common_expression */ + { 291, -2 }, /* (337) select_item ::= common_expression column_alias */ + { 291, -3 }, /* (338) select_item ::= common_expression AS column_alias */ + { 291, -3 }, /* (339) select_item ::= table_name NK_DOT NK_STAR */ + { 285, 0 }, /* (340) where_clause_opt ::= */ + { 285, -2 }, /* (341) where_clause_opt ::= WHERE search_condition */ + { 286, 0 }, /* (342) partition_by_clause_opt ::= */ + { 286, -3 }, /* (343) partition_by_clause_opt ::= PARTITION BY expression_list */ + { 287, 0 }, /* (344) twindow_clause_opt ::= */ + { 287, -6 }, /* (345) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ + { 287, -4 }, /* (346) twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP */ + { 287, -6 }, /* (347) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ + { 287, -8 }, /* (348) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ + { 247, 0 }, /* (349) sliding_opt ::= */ + { 247, -4 }, /* (350) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ + { 292, 0 }, /* (351) fill_opt ::= */ + { 292, -4 }, /* (352) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + { 292, -6 }, /* (353) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ + { 293, -1 }, /* (354) fill_mode ::= NONE */ + { 293, -1 }, /* (355) fill_mode ::= PREV */ + { 293, -1 }, /* (356) fill_mode ::= NULL */ + { 293, -1 }, /* (357) fill_mode ::= LINEAR */ + { 293, -1 }, /* (358) fill_mode ::= NEXT */ + { 288, 0 }, /* (359) group_by_clause_opt ::= */ + { 288, -3 }, /* (360) group_by_clause_opt ::= GROUP BY group_by_list */ + { 294, -1 }, /* (361) group_by_list ::= expression */ + { 294, -3 }, /* (362) group_by_list ::= group_by_list NK_COMMA expression */ + { 289, 0 }, /* (363) having_clause_opt ::= */ + { 289, -2 }, /* (364) having_clause_opt ::= HAVING search_condition */ + { 251, -4 }, /* (365) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ + { 295, -1 }, /* (366) query_expression_body ::= query_primary */ + { 295, -4 }, /* (367) query_expression_body ::= query_expression_body UNION ALL query_expression_body */ + { 299, -1 }, /* (368) query_primary ::= query_specification */ + { 296, 0 }, /* (369) order_by_clause_opt ::= */ + { 296, -3 }, /* (370) order_by_clause_opt ::= ORDER BY sort_specification_list */ + { 297, 0 }, /* (371) slimit_clause_opt ::= */ + { 297, -2 }, /* (372) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + { 297, -4 }, /* (373) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + { 297, -4 }, /* (374) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 298, 0 }, /* (375) limit_clause_opt ::= */ + { 298, -2 }, /* (376) limit_clause_opt ::= LIMIT NK_INTEGER */ + { 298, -4 }, /* (377) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + { 298, -4 }, /* (378) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 265, -3 }, /* (379) subquery ::= NK_LP query_expression NK_RP */ + { 281, -1 }, /* (380) search_condition ::= common_expression */ + { 300, -1 }, /* (381) sort_specification_list ::= sort_specification */ + { 300, -3 }, /* (382) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + { 301, -3 }, /* (383) sort_specification ::= expression ordering_specification_opt null_ordering_opt */ + { 302, 0 }, /* (384) ordering_specification_opt ::= */ + { 302, -1 }, /* (385) ordering_specification_opt ::= ASC */ + { 302, -1 }, /* (386) ordering_specification_opt ::= DESC */ + { 303, 0 }, /* (387) null_ordering_opt ::= */ + { 303, -2 }, /* (388) null_ordering_opt ::= NULLS FIRST */ + { 303, -2 }, /* (389) null_ordering_opt ::= NULLS LAST */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -2639,7 +2647,7 @@ static YYACTIONTYPE yy_reduce( case 50: /* exists_opt ::= */ yytestcase(yyruleno==50); case 203: /* analyze_opt ::= */ yytestcase(yyruleno==203); case 211: /* agg_func_opt ::= */ yytestcase(yyruleno==211); - case 328: /* set_quantifier_opt ::= */ yytestcase(yyruleno==328); + case 329: /* set_quantifier_opt ::= */ yytestcase(yyruleno==329); { yymsp[1].minor.yy185 = false; } break; case 49: /* exists_opt ::= IF EXISTS */ @@ -2823,8 +2831,8 @@ static YYACTIONTYPE yy_reduce( case 184: /* func_name_list ::= func_name */ yytestcase(yyruleno==184); case 193: /* func_list ::= func */ yytestcase(yyruleno==193); case 246: /* literal_list ::= signed_literal */ yytestcase(yyruleno==246); - case 333: /* select_sublist ::= select_item */ yytestcase(yyruleno==333); - case 380: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==380); + case 334: /* select_sublist ::= select_item */ yytestcase(yyruleno==334); + case 381: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==381); { yylhsminor.yy312 = createNodeList(pCxt, yymsp[0].minor.yy104); } yymsp[0].minor.yy312 = yylhsminor.yy312; break; @@ -2843,9 +2851,9 @@ static YYACTIONTYPE yy_reduce( break; case 104: /* specific_tags_opt ::= */ case 135: /* tags_def_opt ::= */ yytestcase(yyruleno==135); - case 341: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==341); - case 358: /* group_by_clause_opt ::= */ yytestcase(yyruleno==358); - case 368: /* order_by_clause_opt ::= */ yytestcase(yyruleno==368); + case 342: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==342); + case 359: /* group_by_clause_opt ::= */ yytestcase(yyruleno==359); + case 369: /* order_by_clause_opt ::= */ yytestcase(yyruleno==369); { yymsp[1].minor.yy312 = NULL; } break; case 105: /* specific_tags_opt ::= NK_LP col_name_list NK_RP */ @@ -2864,8 +2872,8 @@ static YYACTIONTYPE yy_reduce( case 185: /* func_name_list ::= func_name_list NK_COMMA col_name */ yytestcase(yyruleno==185); case 194: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==194); case 247: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==247); - case 334: /* select_sublist ::= select_sublist NK_COMMA select_item */ yytestcase(yyruleno==334); - case 381: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==381); + case 335: /* select_sublist ::= select_sublist NK_COMMA select_item */ yytestcase(yyruleno==335); + case 382: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==382); { yylhsminor.yy312 = addNodeToList(pCxt, yymsp[-2].minor.yy312, yymsp[0].minor.yy104); } yymsp[-2].minor.yy312 = yylhsminor.yy312; break; @@ -2945,7 +2953,7 @@ static YYACTIONTYPE yy_reduce( { yymsp[-5].minor.yy336 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 136: /* tags_def_opt ::= tags_def */ - case 332: /* select_list ::= select_sublist */ yytestcase(yyruleno==332); + case 333: /* select_list ::= select_sublist */ yytestcase(yyruleno==333); { yylhsminor.yy312 = yymsp[0].minor.yy312; } yymsp[0].minor.yy312 = yylhsminor.yy312; break; @@ -3083,13 +3091,13 @@ static YYACTIONTYPE yy_reduce( break; case 179: /* like_pattern_opt ::= */ case 190: /* index_options ::= */ yytestcase(yyruleno==190); - case 339: /* where_clause_opt ::= */ yytestcase(yyruleno==339); - case 343: /* twindow_clause_opt ::= */ yytestcase(yyruleno==343); - case 348: /* sliding_opt ::= */ yytestcase(yyruleno==348); - case 350: /* fill_opt ::= */ yytestcase(yyruleno==350); - case 362: /* having_clause_opt ::= */ yytestcase(yyruleno==362); - case 370: /* slimit_clause_opt ::= */ yytestcase(yyruleno==370); - case 374: /* limit_clause_opt ::= */ yytestcase(yyruleno==374); + case 340: /* where_clause_opt ::= */ yytestcase(yyruleno==340); + case 344: /* twindow_clause_opt ::= */ yytestcase(yyruleno==344); + case 349: /* sliding_opt ::= */ yytestcase(yyruleno==349); + case 351: /* fill_opt ::= */ yytestcase(yyruleno==351); + case 363: /* having_clause_opt ::= */ yytestcase(yyruleno==363); + case 371: /* slimit_clause_opt ::= */ yytestcase(yyruleno==371); + case 375: /* limit_clause_opt ::= */ yytestcase(yyruleno==375); { yymsp[1].minor.yy104 = NULL; } break; case 180: /* like_pattern_opt ::= LIKE NK_STRING */ @@ -3146,7 +3154,7 @@ static YYACTIONTYPE yy_reduce( break; case 204: /* analyze_opt ::= ANALYZE */ case 212: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==212); - case 329: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==329); + case 330: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==330); { yymsp[0].minor.yy185 = true; } break; case 205: /* explain_options ::= */ @@ -3228,16 +3236,16 @@ static YYACTIONTYPE yy_reduce( case 259: /* expression ::= pseudo_column */ yytestcase(yyruleno==259); case 260: /* expression ::= column_reference */ yytestcase(yyruleno==260); case 263: /* expression ::= subquery */ yytestcase(yyruleno==263); - case 302: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==302); - case 306: /* boolean_primary ::= predicate */ yytestcase(yyruleno==306); - case 308: /* common_expression ::= expression */ yytestcase(yyruleno==308); - case 309: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==309); - case 311: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==311); - case 313: /* table_reference ::= table_primary */ yytestcase(yyruleno==313); - case 314: /* table_reference ::= joined_table */ yytestcase(yyruleno==314); - case 318: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==318); - case 365: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==365); - case 367: /* query_primary ::= query_specification */ yytestcase(yyruleno==367); + case 303: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==303); + case 307: /* boolean_primary ::= predicate */ yytestcase(yyruleno==307); + case 309: /* common_expression ::= expression */ yytestcase(yyruleno==309); + case 310: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==310); + case 312: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==312); + case 314: /* table_reference ::= table_primary */ yytestcase(yyruleno==314); + case 315: /* table_reference ::= joined_table */ yytestcase(yyruleno==315); + case 319: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==319); + case 366: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==366); + case 368: /* query_primary ::= query_specification */ yytestcase(yyruleno==368); { yylhsminor.yy104 = yymsp[0].minor.yy104; } yymsp[0].minor.yy104 = yylhsminor.yy104; break; @@ -3291,7 +3299,7 @@ static YYACTIONTYPE yy_reduce( { yymsp[-1].minor.yy104 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } break; case 244: /* signed_literal ::= duration_literal */ - case 379: /* search_condition ::= common_expression */ yytestcase(yyruleno==379); + case 380: /* search_condition ::= common_expression */ yytestcase(yyruleno==380); { yylhsminor.yy104 = releaseRawExprNode(pCxt, yymsp[0].minor.yy104); } yymsp[0].minor.yy104 = yylhsminor.yy104; break; @@ -3307,7 +3315,7 @@ static YYACTIONTYPE yy_reduce( yymsp[-3].minor.yy104 = yylhsminor.yy104; break; case 264: /* expression ::= NK_LP expression NK_RP */ - case 307: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==307); + case 308: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==308); { yylhsminor.yy104 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy104)); } yymsp[-2].minor.yy104 = yylhsminor.yy104; break; @@ -3321,7 +3329,7 @@ static YYACTIONTYPE yy_reduce( case 266: /* expression ::= NK_MINUS expression */ { SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104); - yylhsminor.yy104 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[0].minor.yy104), NULL)); + yylhsminor.yy104 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy104), NULL)); } yymsp[-1].minor.yy104 = yylhsminor.yy104; break; @@ -3381,25 +3389,19 @@ static YYACTIONTYPE yy_reduce( { yylhsminor.yy104 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy129, &yymsp[0].minor.yy129, createColumnNode(pCxt, &yymsp[-2].minor.yy129, &yymsp[0].minor.yy129)); } yymsp[-2].minor.yy104 = yylhsminor.yy104; break; - case 276: /* pseudo_column ::= NK_UNDERLINE ROWTS */ - case 278: /* pseudo_column ::= NK_UNDERLINE QSTARTTS */ yytestcase(yyruleno==278); - case 279: /* pseudo_column ::= NK_UNDERLINE QENDTS */ yytestcase(yyruleno==279); - case 280: /* pseudo_column ::= NK_UNDERLINE WSTARTTS */ yytestcase(yyruleno==280); - case 281: /* pseudo_column ::= NK_UNDERLINE WENDTS */ yytestcase(yyruleno==281); - case 282: /* pseudo_column ::= NK_UNDERLINE WDURATION */ yytestcase(yyruleno==282); -{ - SToken t = yymsp[-1].minor.yy0; - t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy104 = createRawExprNode(pCxt, &t, createFunctionNode(pCxt, &t, NULL)); - } - yymsp[-1].minor.yy104 = yylhsminor.yy104; - break; - case 277: /* pseudo_column ::= TBNAME */ + case 276: /* pseudo_column ::= NOW */ + case 277: /* pseudo_column ::= ROWTS */ yytestcase(yyruleno==277); + case 278: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==278); + case 279: /* pseudo_column ::= QSTARTTS */ yytestcase(yyruleno==279); + case 280: /* pseudo_column ::= QENDTS */ yytestcase(yyruleno==280); + case 281: /* pseudo_column ::= WSTARTTS */ yytestcase(yyruleno==281); + case 282: /* pseudo_column ::= WENDTS */ yytestcase(yyruleno==282); + case 283: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==283); { yylhsminor.yy104 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } yymsp[0].minor.yy104 = yylhsminor.yy104; break; - case 283: /* predicate ::= expression compare_op expression */ - case 288: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==288); + case 284: /* predicate ::= expression compare_op expression */ + case 289: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==289); { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy104); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104); @@ -3407,7 +3409,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy104 = yylhsminor.yy104; break; - case 284: /* predicate ::= expression BETWEEN expression AND expression */ + case 285: /* predicate ::= expression BETWEEN expression AND expression */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy104); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104); @@ -3415,7 +3417,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-4].minor.yy104 = yylhsminor.yy104; break; - case 285: /* predicate ::= expression NOT BETWEEN expression AND expression */ + case 286: /* predicate ::= expression NOT BETWEEN expression AND expression */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy104); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104); @@ -3423,68 +3425,68 @@ static YYACTIONTYPE yy_reduce( } yymsp[-5].minor.yy104 = yylhsminor.yy104; break; - case 286: /* predicate ::= expression IS NULL */ + case 287: /* predicate ::= expression IS NULL */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy104); yylhsminor.yy104 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy104), NULL)); } yymsp[-2].minor.yy104 = yylhsminor.yy104; break; - case 287: /* predicate ::= expression IS NOT NULL */ + case 288: /* predicate ::= expression IS NOT NULL */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy104); yylhsminor.yy104 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy104), NULL)); } yymsp[-3].minor.yy104 = yylhsminor.yy104; break; - case 289: /* compare_op ::= NK_LT */ + case 290: /* compare_op ::= NK_LT */ { yymsp[0].minor.yy60 = OP_TYPE_LOWER_THAN; } break; - case 290: /* compare_op ::= NK_GT */ + case 291: /* compare_op ::= NK_GT */ { yymsp[0].minor.yy60 = OP_TYPE_GREATER_THAN; } break; - case 291: /* compare_op ::= NK_LE */ + case 292: /* compare_op ::= NK_LE */ { yymsp[0].minor.yy60 = OP_TYPE_LOWER_EQUAL; } break; - case 292: /* compare_op ::= NK_GE */ + case 293: /* compare_op ::= NK_GE */ { yymsp[0].minor.yy60 = OP_TYPE_GREATER_EQUAL; } break; - case 293: /* compare_op ::= NK_NE */ + case 294: /* compare_op ::= NK_NE */ { yymsp[0].minor.yy60 = OP_TYPE_NOT_EQUAL; } break; - case 294: /* compare_op ::= NK_EQ */ + case 295: /* compare_op ::= NK_EQ */ { yymsp[0].minor.yy60 = OP_TYPE_EQUAL; } break; - case 295: /* compare_op ::= LIKE */ + case 296: /* compare_op ::= LIKE */ { yymsp[0].minor.yy60 = OP_TYPE_LIKE; } break; - case 296: /* compare_op ::= NOT LIKE */ + case 297: /* compare_op ::= NOT LIKE */ { yymsp[-1].minor.yy60 = OP_TYPE_NOT_LIKE; } break; - case 297: /* compare_op ::= MATCH */ + case 298: /* compare_op ::= MATCH */ { yymsp[0].minor.yy60 = OP_TYPE_MATCH; } break; - case 298: /* compare_op ::= NMATCH */ + case 299: /* compare_op ::= NMATCH */ { yymsp[0].minor.yy60 = OP_TYPE_NMATCH; } break; - case 299: /* in_op ::= IN */ + case 300: /* in_op ::= IN */ { yymsp[0].minor.yy60 = OP_TYPE_IN; } break; - case 300: /* in_op ::= NOT IN */ + case 301: /* in_op ::= NOT IN */ { yymsp[-1].minor.yy60 = OP_TYPE_NOT_IN; } break; - case 301: /* in_predicate_value ::= NK_LP expression_list NK_RP */ + case 302: /* in_predicate_value ::= NK_LP expression_list NK_RP */ { yylhsminor.yy104 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy312)); } yymsp[-2].minor.yy104 = yylhsminor.yy104; break; - case 303: /* boolean_value_expression ::= NOT boolean_primary */ + case 304: /* boolean_value_expression ::= NOT boolean_primary */ { SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104); yylhsminor.yy104 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy104), NULL)); } yymsp[-1].minor.yy104 = yylhsminor.yy104; break; - case 304: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + case 305: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy104); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104); @@ -3492,7 +3494,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy104 = yylhsminor.yy104; break; - case 305: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + case 306: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy104); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104); @@ -3500,52 +3502,52 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy104 = yylhsminor.yy104; break; - case 310: /* from_clause ::= FROM table_reference_list */ - case 340: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==340); - case 363: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==363); + case 311: /* from_clause ::= FROM table_reference_list */ + case 341: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==341); + case 364: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==364); { yymsp[-1].minor.yy104 = yymsp[0].minor.yy104; } break; - case 312: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ + case 313: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ { yylhsminor.yy104 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy104, yymsp[0].minor.yy104, NULL); } yymsp[-2].minor.yy104 = yylhsminor.yy104; break; - case 315: /* table_primary ::= table_name alias_opt */ + case 316: /* table_primary ::= table_name alias_opt */ { yylhsminor.yy104 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy129, &yymsp[0].minor.yy129); } yymsp[-1].minor.yy104 = yylhsminor.yy104; break; - case 316: /* table_primary ::= db_name NK_DOT table_name alias_opt */ + case 317: /* table_primary ::= db_name NK_DOT table_name alias_opt */ { yylhsminor.yy104 = createRealTableNode(pCxt, &yymsp[-3].minor.yy129, &yymsp[-1].minor.yy129, &yymsp[0].minor.yy129); } yymsp[-3].minor.yy104 = yylhsminor.yy104; break; - case 317: /* table_primary ::= subquery alias_opt */ + case 318: /* table_primary ::= subquery alias_opt */ { yylhsminor.yy104 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy104), &yymsp[0].minor.yy129); } yymsp[-1].minor.yy104 = yylhsminor.yy104; break; - case 319: /* alias_opt ::= */ + case 320: /* alias_opt ::= */ { yymsp[1].minor.yy129 = nil_token; } break; - case 320: /* alias_opt ::= table_alias */ + case 321: /* alias_opt ::= table_alias */ { yylhsminor.yy129 = yymsp[0].minor.yy129; } yymsp[0].minor.yy129 = yylhsminor.yy129; break; - case 321: /* alias_opt ::= AS table_alias */ + case 322: /* alias_opt ::= AS table_alias */ { yymsp[-1].minor.yy129 = yymsp[0].minor.yy129; } break; - case 322: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - case 323: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==323); + case 323: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + case 324: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==324); { yymsp[-2].minor.yy104 = yymsp[-1].minor.yy104; } break; - case 324: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ + case 325: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ { yylhsminor.yy104 = createJoinTableNode(pCxt, yymsp[-4].minor.yy532, yymsp[-5].minor.yy104, yymsp[-2].minor.yy104, yymsp[0].minor.yy104); } yymsp[-5].minor.yy104 = yylhsminor.yy104; break; - case 325: /* join_type ::= */ + case 326: /* join_type ::= */ { yymsp[1].minor.yy532 = JOIN_TYPE_INNER; } break; - case 326: /* join_type ::= INNER */ + case 327: /* join_type ::= INNER */ { yymsp[0].minor.yy532 = JOIN_TYPE_INNER; } break; - case 327: /* 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 328: /* 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.yy104 = createSelectStmt(pCxt, yymsp[-7].minor.yy185, yymsp[-6].minor.yy312, yymsp[-5].minor.yy104); yymsp[-8].minor.yy104 = addWhereClause(pCxt, yymsp[-8].minor.yy104, yymsp[-4].minor.yy104); @@ -3555,81 +3557,81 @@ static YYACTIONTYPE yy_reduce( yymsp[-8].minor.yy104 = addHavingClause(pCxt, yymsp[-8].minor.yy104, yymsp[0].minor.yy104); } break; - case 330: /* set_quantifier_opt ::= ALL */ + case 331: /* set_quantifier_opt ::= ALL */ { yymsp[0].minor.yy185 = false; } break; - case 331: /* select_list ::= NK_STAR */ + case 332: /* select_list ::= NK_STAR */ { yymsp[0].minor.yy312 = NULL; } break; - case 335: /* select_item ::= common_expression */ + case 336: /* select_item ::= common_expression */ { SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104); yylhsminor.yy104 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy104), &t); } yymsp[0].minor.yy104 = yylhsminor.yy104; break; - case 336: /* select_item ::= common_expression column_alias */ + case 337: /* select_item ::= common_expression column_alias */ { yylhsminor.yy104 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy104), &yymsp[0].minor.yy129); } yymsp[-1].minor.yy104 = yylhsminor.yy104; break; - case 337: /* select_item ::= common_expression AS column_alias */ + case 338: /* select_item ::= common_expression AS column_alias */ { yylhsminor.yy104 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy104), &yymsp[0].minor.yy129); } yymsp[-2].minor.yy104 = yylhsminor.yy104; break; - case 338: /* select_item ::= table_name NK_DOT NK_STAR */ + case 339: /* select_item ::= table_name NK_DOT NK_STAR */ { yylhsminor.yy104 = createColumnNode(pCxt, &yymsp[-2].minor.yy129, &yymsp[0].minor.yy0); } yymsp[-2].minor.yy104 = yylhsminor.yy104; break; - case 342: /* partition_by_clause_opt ::= PARTITION BY expression_list */ - case 359: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==359); - case 369: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==369); + case 343: /* partition_by_clause_opt ::= PARTITION BY expression_list */ + case 360: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==360); + case 370: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==370); { yymsp[-2].minor.yy312 = yymsp[0].minor.yy312; } break; - case 344: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ + case 345: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ { yymsp[-5].minor.yy104 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy104), releaseRawExprNode(pCxt, yymsp[-1].minor.yy104)); } break; - case 345: /* twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP */ + case 346: /* twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP */ { yymsp[-3].minor.yy104 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy104)); } break; - case 346: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ + case 347: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ { yymsp[-5].minor.yy104 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy104), NULL, yymsp[-1].minor.yy104, yymsp[0].minor.yy104); } break; - case 347: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ + case 348: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ { yymsp[-7].minor.yy104 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy104), releaseRawExprNode(pCxt, yymsp[-3].minor.yy104), yymsp[-1].minor.yy104, yymsp[0].minor.yy104); } break; - case 349: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ + case 350: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ { yymsp[-3].minor.yy104 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy104); } break; - case 351: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ + case 352: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ { yymsp[-3].minor.yy104 = createFillNode(pCxt, yymsp[-1].minor.yy550, NULL); } break; - case 352: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ + case 353: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ { yymsp[-5].minor.yy104 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy312)); } break; - case 353: /* fill_mode ::= NONE */ + case 354: /* fill_mode ::= NONE */ { yymsp[0].minor.yy550 = FILL_MODE_NONE; } break; - case 354: /* fill_mode ::= PREV */ + case 355: /* fill_mode ::= PREV */ { yymsp[0].minor.yy550 = FILL_MODE_PREV; } break; - case 355: /* fill_mode ::= NULL */ + case 356: /* fill_mode ::= NULL */ { yymsp[0].minor.yy550 = FILL_MODE_NULL; } break; - case 356: /* fill_mode ::= LINEAR */ + case 357: /* fill_mode ::= LINEAR */ { yymsp[0].minor.yy550 = FILL_MODE_LINEAR; } break; - case 357: /* fill_mode ::= NEXT */ + case 358: /* fill_mode ::= NEXT */ { yymsp[0].minor.yy550 = FILL_MODE_NEXT; } break; - case 360: /* group_by_list ::= expression */ + case 361: /* group_by_list ::= expression */ { yylhsminor.yy312 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy104))); } yymsp[0].minor.yy312 = yylhsminor.yy312; break; - case 361: /* group_by_list ::= group_by_list NK_COMMA expression */ + case 362: /* group_by_list ::= group_by_list NK_COMMA expression */ { yylhsminor.yy312 = addNodeToList(pCxt, yymsp[-2].minor.yy312, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy104))); } yymsp[-2].minor.yy312 = yylhsminor.yy312; break; - case 364: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ + case 365: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ { yylhsminor.yy104 = addOrderByClause(pCxt, yymsp[-3].minor.yy104, yymsp[-2].minor.yy312); yylhsminor.yy104 = addSlimitClause(pCxt, yylhsminor.yy104, yymsp[-1].minor.yy104); @@ -3637,46 +3639,46 @@ static YYACTIONTYPE yy_reduce( } yymsp[-3].minor.yy104 = yylhsminor.yy104; break; - case 366: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */ + case 367: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */ { yylhsminor.yy104 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy104, yymsp[0].minor.yy104); } yymsp[-3].minor.yy104 = yylhsminor.yy104; break; - case 371: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ - case 375: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==375); + case 372: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ + case 376: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==376); { yymsp[-1].minor.yy104 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } break; - case 372: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - case 376: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==376); + case 373: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + case 377: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==377); { yymsp[-3].minor.yy104 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } break; - case 373: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - case 377: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==377); + case 374: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + case 378: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==378); { yymsp[-3].minor.yy104 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } break; - case 378: /* subquery ::= NK_LP query_expression NK_RP */ + case 379: /* subquery ::= NK_LP query_expression NK_RP */ { yylhsminor.yy104 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy104); } yymsp[-2].minor.yy104 = yylhsminor.yy104; break; - case 382: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */ + case 383: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */ { yylhsminor.yy104 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy104), yymsp[-1].minor.yy354, yymsp[0].minor.yy489); } yymsp[-2].minor.yy104 = yylhsminor.yy104; break; - case 383: /* ordering_specification_opt ::= */ + case 384: /* ordering_specification_opt ::= */ { yymsp[1].minor.yy354 = ORDER_ASC; } break; - case 384: /* ordering_specification_opt ::= ASC */ + case 385: /* ordering_specification_opt ::= ASC */ { yymsp[0].minor.yy354 = ORDER_ASC; } break; - case 385: /* ordering_specification_opt ::= DESC */ + case 386: /* ordering_specification_opt ::= DESC */ { yymsp[0].minor.yy354 = ORDER_DESC; } break; - case 386: /* null_ordering_opt ::= */ + case 387: /* null_ordering_opt ::= */ { yymsp[1].minor.yy489 = NULL_ORDER_DEFAULT; } break; - case 387: /* null_ordering_opt ::= NULLS FIRST */ + case 388: /* null_ordering_opt ::= NULLS FIRST */ { yymsp[-1].minor.yy489 = NULL_ORDER_FIRST; } break; - case 388: /* null_ordering_opt ::= NULLS LAST */ + case 389: /* null_ordering_opt ::= NULLS LAST */ { yymsp[-1].minor.yy489 = NULL_ORDER_LAST; } break; default: diff --git a/source/libs/planner/test/plannerTest.cpp b/source/libs/planner/test/plannerTest.cpp index 00af808078..ad76c8f879 100644 --- a/source/libs/planner/test/plannerTest.cpp +++ b/source/libs/planner/test/plannerTest.cpp @@ -190,14 +190,14 @@ TEST_F(PlannerTest, subquery) { TEST_F(PlannerTest, interval) { setDatabase("root", "test"); - // bind("SELECT count(*) FROM t1 interval(10s)"); - // ASSERT_TRUE(run()); + bind("SELECT count(*) FROM t1 interval(10s)"); + ASSERT_TRUE(run()); - // bind("SELECT _wstartts, _wduration, _wendts, count(*) FROM t1 interval(10s)"); - // ASSERT_TRUE(run()); + bind("SELECT _wstartts, _wduration, _wendts, count(*) FROM t1 interval(10s)"); + ASSERT_TRUE(run()); - // bind("SELECT count(*) FROM t1 interval(10s) fill(linear)"); - // ASSERT_TRUE(run()); + bind("SELECT count(*) FROM t1 interval(10s) fill(linear)"); + ASSERT_TRUE(run()); bind("SELECT count(*), sum(c1) FROM t1 interval(10s) fill(value, 10, 20)"); ASSERT_TRUE(run()); diff --git a/source/libs/scalar/inc/filterInt.h b/source/libs/scalar/inc/filterInt.h index 3e04e7b30a..977fab2e85 100644 --- a/source/libs/scalar/inc/filterInt.h +++ b/source/libs/scalar/inc/filterInt.h @@ -229,7 +229,7 @@ typedef struct SFltBuildGroupCtx { int32_t code; } SFltBuildGroupCtx; -typedef struct SFilterInfo { +struct SFilterInfo { bool scalarMode; SFltScalarCtx sclCtx; uint32_t options; @@ -254,7 +254,7 @@ typedef struct SFilterInfo { SArray *blkList; SFilterPCtx pctx; -} SFilterInfo; +}; #define FILTER_NO_MERGE_DATA_TYPE(t) ((t) == TSDB_DATA_TYPE_BINARY || (t) == TSDB_DATA_TYPE_NCHAR || (t) == TSDB_DATA_TYPE_JSON) #define FILTER_NO_MERGE_OPTR(o) ((o) == OP_TYPE_IS_NULL || (o) == OP_TYPE_IS_NOT_NULL || (o) == FILTER_DUMMY_EMPTY_OPTR) diff --git a/source/libs/scalar/src/filter.c b/source/libs/scalar/src/filter.c index 434316add6..05f9a36551 100644 --- a/source/libs/scalar/src/filter.c +++ b/source/libs/scalar/src/filter.c @@ -3638,16 +3638,16 @@ int32_t filterInitFromNode(SNode* pNode, SFilterInfo **pInfo, uint32_t options) info = *pInfo; info->options = options; - SFltTreeStat stat = {0}; - FLT_ERR_JRET(fltReviseNodes(info, &pNode, &stat)); + SFltTreeStat stat1 = {0}; + FLT_ERR_JRET(fltReviseNodes(info, &pNode, &stat1)); - info->scalarMode = stat.scalarMode; + info->scalarMode = stat1.scalarMode; if (!info->scalarMode) { FLT_ERR_JRET(fltInitFromNode(pNode, info, options)); } else { info->sclCtx.node = pNode; - FLT_ERR_JRET(fltOptimizeNodes(info, &info->sclCtx.node, &stat)); + FLT_ERR_JRET(fltOptimizeNodes(info, &info->sclCtx.node, &stat1)); } return code; @@ -3664,24 +3664,16 @@ _return: bool filterExecute(SFilterInfo *info, SSDataBlock *pSrc, int8_t** p, SColumnDataAgg *statis, int16_t numOfCols) { if (info->scalarMode) { SScalarParam output = {0}; + + SDataType type = {.type = TSDB_DATA_TYPE_BOOL, .bytes = sizeof(bool)}; + output.columnData = createColumnInfoData(&type, pSrc->info.rows); + + *p = (int8_t *)output.columnData->pData; SArray *pList = taosArrayInit(1, POINTER_BYTES); taosArrayPush(pList, &pSrc); - + FLT_ERR_RET(scalarCalculate(info->sclCtx.node, pList, &output)); taosArrayDestroy(pList); - // TODO Fix it -// *p = output.orig.data; -// output.orig.data = NULL; -// -// sclFreeParam(&output); -// -// int8_t *r = output.data; -// for (int32_t i = 0; i < output.num; ++i) { -// if (0 == *(r+i)) { -// return false; -// } -// } - return true; } diff --git a/source/libs/scalar/src/scalar.c b/source/libs/scalar/src/scalar.c index 2b869ba237..629c292ab3 100644 --- a/source/libs/scalar/src/scalar.c +++ b/source/libs/scalar/src/scalar.c @@ -163,7 +163,7 @@ int32_t sclInitParam(SNode* node, SScalarParam *param, SScalarCtx *ctx, int32_t param->numOfRows = 1; param->columnData = createColumnInfoData(&valueNode->node.resType, 1); if (TSDB_DATA_TYPE_NULL == valueNode->node.resType.type) { - colDataAppend(param->columnData, 0, NULL, true); + colDataAppendNULL(param->columnData, 0); } else { colDataAppend(param->columnData, 0, nodesGetValueFromNode(valueNode), false); } @@ -311,12 +311,10 @@ int32_t sclExecFunction(SFunctionNode *node, SScalarCtx *ctx, SScalarParam *outp SCL_ERR_JRET(TSDB_CODE_QRY_OUT_OF_MEMORY); } -// for (int32_t i = 0; i < rowNum; ++i) { - code = (*ffpSet.process)(params, node->pParameterList->length, output); - if (code) { - sclError("scalar function exec failed, funcId:%d, code:%s", node->funcId, tstrerror(code)); - SCL_ERR_JRET(code); -// } + code = (*ffpSet.process)(params, node->pParameterList->length, output); + if (code) { + sclError("scalar function exec failed, funcId:%d, code:%s", node->funcId, tstrerror(code)); + SCL_ERR_JRET(code); } _return: @@ -447,7 +445,6 @@ EDealRes sclRewriteFunction(SNode** pNode, SScalarCtx *ctx) { *pNode = (SNode*)res; sclFreeParam(&output); - return DEAL_RES_CONTINUE; } @@ -689,8 +686,9 @@ int32_t scalarCalculate(SNode *pNode, SArray *pBlockList, SScalarParam *pDst) { int32_t code = 0; SScalarCtx ctx = {.code = 0, .pBlockList = pBlockList}; + // TODO: OPT performance - ctx.pRes = taosHashInit(SCL_DEFAULT_OP_NUM, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_NO_LOCK); + ctx.pRes = taosHashInit(SCL_DEFAULT_OP_NUM, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_NO_LOCK); if (NULL == ctx.pRes) { sclError("taosHashInit failed, num:%d", SCL_DEFAULT_OP_NUM); SCL_ERR_RET(TSDB_CODE_QRY_OUT_OF_MEMORY); diff --git a/source/libs/scalar/src/sclvector.c b/source/libs/scalar/src/sclvector.c index 33be65832c..ef3be80893 100644 --- a/source/libs/scalar/src/sclvector.c +++ b/source/libs/scalar/src/sclvector.c @@ -158,23 +158,23 @@ _getValueAddr_fn_t getVectorValueAddrFn(int32_t srcType) { static FORCE_INLINE void varToSigned(char *buf, SScalarParam* pOut, int32_t rowIndex) { int64_t value = strtoll(buf, NULL, 10); - colDataAppend(pOut->columnData, rowIndex, (char*) &value, false); + colDataAppendInt64(pOut->columnData, rowIndex, &value); } static FORCE_INLINE void varToUnsigned(char *buf, SScalarParam* pOut, int32_t rowIndex) { uint64_t value = strtoull(buf, NULL, 10); - colDataAppend(pOut->columnData, rowIndex, (char*) &value, false); + colDataAppendInt64(pOut->columnData, rowIndex, (int64_t*) &value); } static FORCE_INLINE void varToFloat(char *buf, SScalarParam* pOut, int32_t rowIndex) { double value = strtod(buf, NULL); - colDataAppend(pOut->columnData, rowIndex, (char*) &value, false); + colDataAppendDouble(pOut->columnData, rowIndex, &value); } static FORCE_INLINE void varToBool(char *buf, SScalarParam* pOut, int32_t rowIndex) { int64_t value = strtoll(buf, NULL, 10); bool v = (value != 0)? true:false; - colDataAppend(pOut->columnData, rowIndex, (char*) &v, false); + colDataAppendInt8(pOut->columnData, rowIndex, (int8_t*) &v); } int32_t vectorConvertFromVarData(const SScalarParam* pIn, SScalarParam* pOut, int32_t inType, int32_t outType) { @@ -198,7 +198,7 @@ int32_t vectorConvertFromVarData(const SScalarParam* pIn, SScalarParam* pOut, in pOut->numOfRows = pIn->numOfRows; for (int32_t i = 0; i < pIn->numOfRows; ++i) { if (colDataIsNull(pIn->columnData, pIn->numOfRows, i, NULL)) { - colDataAppend(pOut->columnData, i, NULL, true); + colDataAppendNULL(pOut->columnData, i); continue; } @@ -242,13 +242,13 @@ int32_t vectorConvertImpl(const SScalarParam* pIn, SScalarParam* pOut) { case TSDB_DATA_TYPE_BOOL: { for (int32_t i = 0; i < pIn->numOfRows; ++i) { if (colDataIsNull_f(pInputCol->nullbitmap, i)) { - colDataAppend(pOutputCol, i, NULL, true); + colDataAppendNULL(pOutputCol, i); continue; } bool value = 0; GET_TYPED_DATA(value, int64_t, inType, colDataGetData(pInputCol, i)); - colDataAppend(pOutputCol, i, (char*) &value, false); + colDataAppendInt8(pOutputCol, i, (int8_t*) &value); } break; } @@ -259,13 +259,13 @@ int32_t vectorConvertImpl(const SScalarParam* pIn, SScalarParam* pOut) { case TSDB_DATA_TYPE_TIMESTAMP: { for (int32_t i = 0; i < pIn->numOfRows; ++i) { if (colDataIsNull_f(pInputCol->nullbitmap, i)) { - colDataAppend(pOutputCol, i, NULL, true); + colDataAppendNULL(pOutputCol, i); continue; } int64_t value = 0; GET_TYPED_DATA(value, int64_t, inType, colDataGetData(pInputCol, i)); - colDataAppend(pOutputCol, i, (char *)&value, false); + colDataAppendInt64(pOutputCol, i, &value); } break; } @@ -275,26 +275,26 @@ int32_t vectorConvertImpl(const SScalarParam* pIn, SScalarParam* pOut) { case TSDB_DATA_TYPE_UBIGINT: for (int32_t i = 0; i < pIn->numOfRows; ++i) { if (colDataIsNull_f(pInputCol->nullbitmap, i)) { - colDataAppend(pOutputCol, i, NULL, true); + colDataAppendNULL(pOutputCol, i); continue; } uint64_t value = 0; GET_TYPED_DATA(value, uint64_t, inType, colDataGetData(pInputCol, i)); - colDataAppend(pOutputCol, i, (char*) &value, false); + colDataAppendInt64(pOutputCol, i, (int64_t*)&value); } break; case TSDB_DATA_TYPE_FLOAT: case TSDB_DATA_TYPE_DOUBLE: for (int32_t i = 0; i < pIn->numOfRows; ++i) { if (colDataIsNull_f(pInputCol->nullbitmap, i)) { - colDataAppend(pOutputCol, i, NULL, true); + colDataAppendNULL(pOutputCol, i); continue; } double value = 0; GET_TYPED_DATA(value, double, inType, colDataGetData(pInputCol, i)); - colDataAppend(pOutputCol, i, (char*) &value, false); + colDataAppendDouble(pOutputCol, i, &value); } break; default: @@ -445,7 +445,7 @@ static void vectorMathAddHelper(SColumnInfoData* pLeftCol, SColumnInfoData* pRig double *output = (double *)pOutputCol->pData; if (colDataIsNull_f(pRightCol->nullbitmap, 0)) { // Set pLeft->numOfRows NULL value - // TODO set numOfRows NULL value + colDataAppendNNULL(pOutputCol, 0, numOfRows); } else { for (; i >= 0 && i < numOfRows; i += step, output += 1) { *output = getVectorDoubleValueFnLeft(pLeftCol->pData, i) + getVectorDoubleValueFnRight(pRightCol->pData, 0); @@ -527,7 +527,7 @@ static void vectorMathSubHelper(SColumnInfoData* pLeftCol, SColumnInfoData* pRig double *output = (double *)pOutputCol->pData; if (colDataIsNull_f(pRightCol->nullbitmap, 0)) { // Set pLeft->numOfRows NULL value - // TODO set numOfRows NULL value + colDataAppendNNULL(pOutputCol, 0, numOfRows); } else { for (; i >= 0 && i < numOfRows; i += step, output += 1) { *output = (getVectorDoubleValueFnLeft(pLeftCol->pData, i) - getVectorDoubleValueFnRight(pRightCol->pData, 0)) * factor; @@ -586,7 +586,7 @@ static void vectorMathMultiplyHelper(SColumnInfoData* pLeftCol, SColumnInfoData* double *output = (double *)pOutputCol->pData; if (colDataIsNull_f(pRightCol->nullbitmap, 0)) { // Set pLeft->numOfRows NULL value - // TODO set numOfRows NULL value + colDataAppendNNULL(pOutputCol, 0, numOfRows); } else { for (; i >= 0 && i < numOfRows; i += step, output += 1) { *output = getVectorDoubleValueFnLeft(pLeftCol->pData, i) * getVectorDoubleValueFnRight(pRightCol->pData, 0); @@ -666,7 +666,7 @@ void vectorMathDivide(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *p } else if (pLeft->numOfRows == 1) { if (colDataIsNull_f(pLeftCol->nullbitmap, 0)) { // Set pLeft->numOfRows NULL value - // TODO set numOfRows NULL value + colDataAppendNNULL(pOutputCol, 0, pRight->numOfRows); } else { for (; i >= 0 && i < pRight->numOfRows; i += step, output += 1) { *output = getVectorDoubleValueFnLeft(pLeftCol->pData, 0) / getVectorDoubleValueFnRight(pRightCol->pData, i); @@ -678,7 +678,7 @@ void vectorMathDivide(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *p } } else if (pRight->numOfRows == 1) { if (colDataIsNull_f(pRightCol->nullbitmap, 0)) { // Set pLeft->numOfRows NULL value - // TODO set numOfRows NULL value + colDataAppendNNULL(pOutputCol, 0, pLeft->numOfRows); } else { for (; i >= 0 && i < pLeft->numOfRows; i += step, output += 1) { *output = getVectorDoubleValueFnLeft(pLeftCol->pData, i) / getVectorDoubleValueFnRight(pRightCol->pData, 0); @@ -714,14 +714,14 @@ void vectorMathRemainder(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam if (pLeft->numOfRows == pRight->numOfRows) { for (; i < pRight->numOfRows && i >= 0; i += step, output += 1) { if (colDataIsNull_f(pLeftCol->nullbitmap, i) || colDataIsNull_f(pRightCol->nullbitmap, i)) { - colDataAppend(pOutputCol, i, NULL, true); + colDataAppendNULL(pOutputCol, i); continue; } double lx = getVectorDoubleValueFnLeft(pLeftCol->pData, i); double rx = getVectorDoubleValueFnRight(pRightCol->pData, i); if (isnan(lx) || isinf(lx) || isnan(rx) || isinf(rx)) { - colDataAppend(pOutputCol, i, NULL, true); + colDataAppendNULL(pOutputCol, i); continue; } @@ -730,17 +730,17 @@ void vectorMathRemainder(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam } else if (pLeft->numOfRows == 1) { double lx = getVectorDoubleValueFnLeft(pLeftCol->pData, 0); if (colDataIsNull_f(pLeftCol->nullbitmap, 0) || isnan(lx) || isinf(lx)) { // Set pLeft->numOfRows NULL value - // TODO set numOfRows NULL value + colDataAppendNNULL(pOutputCol, 0, pRight->numOfRows); } else { for (; i >= 0 && i < pRight->numOfRows; i += step, output += 1) { if (colDataIsNull_f(pRightCol->nullbitmap, i)) { - colDataAppend(pOutputCol, i, NULL, true); + colDataAppendNULL(pOutputCol, i); continue; } double rx = getVectorDoubleValueFnRight(pRightCol->pData, i); if (isnan(rx) || isinf(rx) || FLT_EQUAL(rx, 0)) { - colDataAppend(pOutputCol, i, NULL, true); + colDataAppendNULL(pOutputCol, i); continue; } @@ -750,17 +750,17 @@ void vectorMathRemainder(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam } else if (pRight->numOfRows == 1) { double rx = getVectorDoubleValueFnRight(pRightCol->pData, 0); if (colDataIsNull_f(pRightCol->nullbitmap, 0) || FLT_EQUAL(rx, 0)) { // Set pLeft->numOfRows NULL value - // TODO set numOfRows NULL value + colDataAppendNNULL(pOutputCol, 0, pLeft->numOfRows); } else { for (; i >= 0 && i < pLeft->numOfRows; i += step, output += 1) { if (colDataIsNull_f(pLeftCol->nullbitmap, i)) { - colDataAppend(pOutputCol, i, NULL, true); + colDataAppendNULL(pOutputCol, i); continue; } double lx = getVectorDoubleValueFnLeft(pLeftCol->pData, i); if (isnan(lx) || isinf(lx)) { - colDataAppend(pOutputCol, i, NULL, true); + colDataAppendNULL(pOutputCol, i); continue; } @@ -831,7 +831,7 @@ static void vectorBitAndHelper(SColumnInfoData* pLeftCol, SColumnInfoData* pRigh double *output = (double *)pOutputCol->pData; if (colDataIsNull_f(pRightCol->nullbitmap, 0)) { // Set pLeft->numOfRows NULL value - // TODO set numOfRows NULL value + colDataAppendNNULL(pOutputCol, 0, numOfRows); } else { for (; i >= 0 && i < numOfRows; i += step, output += 1) { *output = getVectorBigintValueFnLeft(pLeftCol->pData, i) & getVectorBigintValueFnRight(pRightCol->pData, 0); @@ -888,7 +888,7 @@ static void vectorBitOrHelper(SColumnInfoData* pLeftCol, SColumnInfoData* pRight int64_t *output = (int64_t *)pOutputCol->pData; if (colDataIsNull_f(pRightCol->nullbitmap, 0)) { // Set pLeft->numOfRows NULL value - // TODO set numOfRows NULL value + colDataAppendNNULL(pOutputCol, 0, numOfRows); } else { int64_t rx = getVectorBigintValueFnRight(pRightCol->pData, 0); for (; i >= 0 && i < numOfRows; i += step, output += 1) { @@ -947,56 +947,51 @@ void vectorCompareImpl(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam * if (pRight->pHashFilter != NULL) { for (; i >= 0 && i < pLeft->numOfRows; i += step) { - if (colDataIsNull(pLeft->columnData, pLeft->numOfRows, i, NULL) /*|| - colDataIsNull(pRight->columnData, pRight->numOfRows, i, NULL)*/) { + if (colDataIsNull_s(pLeft->columnData, i)) { continue; } char *pLeftData = colDataGetData(pLeft->columnData, i); bool res = filterDoCompare(fp, optr, pLeftData, pRight->pHashFilter); - colDataAppend(pOut->columnData, i, (char *)&res, false); + colDataAppendInt8(pOut->columnData, i, (int8_t*)&res); } return; } if (pLeft->numOfRows == pRight->numOfRows) { for (; i < pRight->numOfRows && i >= 0; i += step) { - if (colDataIsNull(pLeft->columnData, pLeft->numOfRows, i, NULL) || - colDataIsNull(pRight->columnData, pRight->numOfRows, i, NULL)) { + if (colDataIsNull_s(pLeft->columnData, i) || colDataIsNull_s(pRight->columnData, i)) { continue; // TODO set null or ignore } char *pLeftData = colDataGetData(pLeft->columnData, i); char *pRightData = colDataGetData(pRight->columnData, i); bool res = filterDoCompare(fp, optr, pLeftData, pRightData); - colDataAppend(pOut->columnData, i, (char *)&res, false); + colDataAppendInt8(pOut->columnData, i, (int8_t*)&res); } } else if (pRight->numOfRows == 1) { char *pRightData = colDataGetData(pRight->columnData, 0); ASSERT(pLeft->pHashFilter == NULL); for (; i >= 0 && i < pLeft->numOfRows; i += step) { - if (colDataIsNull(pLeft->columnData, pLeft->numOfRows, i, NULL) /*|| - colDataIsNull(pRight->columnData, pRight->numOfRows, i, NULL)*/) { + if (colDataIsNull_s(pLeft->columnData, i)) { continue; } char *pLeftData = colDataGetData(pLeft->columnData, i); bool res = filterDoCompare(fp, optr, pLeftData, pRightData); - colDataAppend(pOut->columnData, i, (char *)&res, false); + colDataAppendInt8(pOut->columnData, i, (int8_t*)&res); } } else if (pLeft->numOfRows == 1) { char *pLeftData = colDataGetData(pLeft->columnData, 0); - for (; i >= 0 && i < pRight->numOfRows; i += step) { - if (colDataIsNull(pRight->columnData, pRight->numOfRows, i, NULL) /*|| - colDataIsNull(pRight->columnData, pRight->numOfRows, i, NULL)*/) { + if (colDataIsNull_s(pRight->columnData, i)) { continue; } char *pRightData = colDataGetData(pLeft->columnData, i); bool res = filterDoCompare(fp, optr, pLeftData, pRightData); - colDataAppend(pOut->columnData, i, (char *)&res, false); + colDataAppendInt8(pOut->columnData, i, (int8_t*)&res); } } } @@ -1077,23 +1072,16 @@ void vectorNotMatch(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pOu void vectorIsNull(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pOut, int32_t _ord) { for(int32_t i = 0; i < pLeft->numOfRows; ++i) { - int8_t v = 0; - if (colDataIsNull(pLeft->columnData, pLeft->numOfRows, i, NULL)) { - v = 1; - } - colDataAppend(pOut->columnData, i, (char*) &v, false); + int8_t v = colDataIsNull_s(pLeft->columnData, i)? 1:0; + colDataAppendInt8(pOut->columnData, i, &v); } - pOut->numOfRows = pLeft->numOfRows; } void vectorNotNull(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pOut, int32_t _ord) { for(int32_t i = 0; i < pLeft->numOfRows; ++i) { - int8_t v = 1; - if (colDataIsNull(pLeft->columnData, pLeft->numOfRows, i, NULL)) { - v = 0; - } - colDataAppend(pOut->columnData, i, (char*) &v, false); + int8_t v = colDataIsNull_s(pLeft->columnData, i)? 0:1; + colDataAppendInt8(pOut->columnData, i, &v); } pOut->numOfRows = pLeft->numOfRows; } diff --git a/source/os/src/osProc.c b/source/os/src/osProc.c index 6b52fa30be..1cdd41ad78 100644 --- a/source/os/src/osProc.c +++ b/source/os/src/osProc.c @@ -23,9 +23,9 @@ int32_t taosNewProc(char **args) { int32_t pid = fork(); if (pid == 0) { args[0] = tsProcPath; - close(STDIN_FILENO); + // close(STDIN_FILENO); close(STDOUT_FILENO); - close(STDERR_FILENO); + // close(STDERR_FILENO); return execvp(tsProcPath, args); } else { return pid; @@ -33,7 +33,7 @@ int32_t taosNewProc(char **args) { } void taosWaitProc(int32_t pid) { - int32_t status = 0; + int32_t status = -1; waitpid(pid, &status, 0); } diff --git a/source/os/src/osShm.c b/source/os/src/osShm.c index ba184c1f5d..bf784f14ac 100644 --- a/source/os/src/osShm.c +++ b/source/os/src/osShm.c @@ -17,10 +17,10 @@ #define _DEFAULT_SOURCE #include "os.h" -int32_t taosCreateShm(SShm* pShm, int32_t shmsize) { +int32_t taosCreateShm(SShm* pShm, int32_t key, int32_t shmsize) { pShm->id = -1; - int32_t shmid = shmget(0X95279527, shmsize, IPC_CREAT | 0600); + int32_t shmid = shmget(0X95270000 + key, shmsize, IPC_CREAT | 0600); if (shmid < 0) { return -1; } diff --git a/source/os/src/osSignal.c b/source/os/src/osSignal.c index d4e6cb3318..1d7fa517e5 100644 --- a/source/os/src/osSignal.c +++ b/source/os/src/osSignal.c @@ -59,7 +59,7 @@ void taosSetSignal(int32_t signum, FSignalHandler sigfp) { struct sigaction act; memset(&act, 0, sizeof(act)); #if 1 - act.sa_flags = SA_SIGINFO; + act.sa_flags = SA_SIGINFO | SA_RESTART; act.sa_sigaction = (FLinuxSignalHandler)sigfp; #else act.sa_handler = sigfp; diff --git a/source/util/src/tlog.c b/source/util/src/tlog.c index ef15f44f8f..1f26ab7c51 100644 --- a/source/util/src/tlog.c +++ b/source/util/src/tlog.c @@ -347,12 +347,16 @@ static int32_t taosOpenLogFile(char *fn, int32_t maxLines, int32_t maxFileNum) { taosThreadMutexInit(&tsLogObj.logMutex, NULL); taosUmaskFile(0); - tsLogObj.logHandle->pFile = taosOpenFile(fileName, TD_FILE_CTEATE | TD_FILE_WRITE); + TdFilePtr pFile = taosOpenFile(fileName, TD_FILE_CTEATE | TD_FILE_WRITE); - if (tsLogObj.logHandle->pFile == NULL) { + if (pFile == NULL) { printf("\nfailed to open log file:%s, reason:%s\n", fileName, strerror(errno)); return -1; } + TdFilePtr pOldFile = tsLogObj.logHandle->pFile; + tsLogObj.logHandle->pFile = pFile; + taosUnLockLogFile(pOldFile); + taosCloseFile(&pOldFile); taosLockLogFile(tsLogObj.logHandle->pFile); // only an estimate for number of lines diff --git a/source/util/src/tprocess.c b/source/util/src/tprocess.c index 1d41bd4a48..600413068c 100644 --- a/source/util/src/tprocess.c +++ b/source/util/src/tprocess.c @@ -434,7 +434,9 @@ int32_t taosProcPutToChildQ(SProcObj *pProc, const void *pHead, int16_t headLen, return taosProcQueuePush(pProc->pChildQueue, pHead, headLen, pBody, bodyLen, ftype); } -int32_t taosProcPutToParentQ(SProcObj *pProc, const void *pHead, int16_t headLen, const void *pBody, int32_t bodyLen, - ProcFuncType ftype) { - return taosProcQueuePush(pProc->pParentQueue, pHead, headLen, pBody, bodyLen, ftype); +void taosProcPutToParentQ(SProcObj *pProc, const void *pHead, int16_t headLen, const void *pBody, int32_t bodyLen, + ProcFuncType ftype) { + while (taosProcQueuePush(pProc->pParentQueue, pHead, headLen, pBody, bodyLen, ftype) != 0) { + taosMsleep(1); + } } diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index 5c503c39bb..d8fbfce55f 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -52,4 +52,10 @@ ./test.sh -f tsim/stable/values.sim ./test.sh -f tsim/stable/vnode3.sim + +# --- for multi process mode +./test.sh -f tsim/user/basic1.sim -m +./test.sh -f tsim/stable/vnode3.sim -m +./test.sh -f tsim/tmq/basic.sim -m + #======================b1-end=============== diff --git a/tests/script/sh/deploy.sh b/tests/script/sh/deploy.sh index 1bbfccf989..38b6d9aadb 100755 --- a/tests/script/sh/deploy.sh +++ b/tests/script/sh/deploy.sh @@ -5,18 +5,12 @@ set +e echo "Executing deploy.sh" -if [ $# != 4 ]; then - echo "argument list need input : " - echo " -n nodeName" - echo " -i nodePort" - exit 1 -fi - UNAME_BIN=`which uname` OS_TYPE=`$UNAME_BIN` NODE_NAME= NODE= -while getopts "n:i:" arg +MULTIPROCESS=0 +while getopts "n:i:m" arg do case $arg in n) @@ -25,6 +19,9 @@ do i) NODE=$OPTARG ;; + m) + MULTIPROCESS=1 + ;; ?) echo "unkonw argument" ;; @@ -145,5 +142,5 @@ echo "statusInterval 1" >> $TAOS_CFG echo "asyncLog 0" >> $TAOS_CFG echo "locale en_US.UTF-8" >> $TAOS_CFG echo "telemetryReporting 0" >> $TAOS_CFG -echo "multiProcess 0" >> $TAOS_CFG +echo "multiProcess ${MULTIPROCESS}" >> $TAOS_CFG echo " " >> $TAOS_CFG diff --git a/tests/script/test.sh b/tests/script/test.sh index f89b9fb1a2..8b77575e18 100755 --- a/tests/script/test.sh +++ b/tests/script/test.sh @@ -7,7 +7,6 @@ ################################################## set +e -#set -x FILE_NAME= RELEASE=0 @@ -16,7 +15,8 @@ VALGRIND=0 UNIQUE=0 UNAME_BIN=`which uname` OS_TYPE=`$UNAME_BIN` -while getopts "f:avu" arg +MULTIPROCESS=0 +while getopts "f:avum" arg do case $arg in f) @@ -28,6 +28,9 @@ do u) UNIQUE=1 ;; + m) + MULTIPROCESS=1 + ;; ?) echo "unknow argument" ;; @@ -125,8 +128,13 @@ if [ -n "$FILE_NAME" ]; then echo valgrind --tool=memcheck --leak-check=full --show-reachable=no --track-origins=yes --show-leak-kinds=all -v --workaround-gcc296-bugs=yes --log-file=${CODE_DIR}/../script/valgrind.log $PROGRAM -c $CFG_DIR -f $FILE_NAME valgrind --tool=memcheck --leak-check=full --show-reachable=no --track-origins=yes --show-leak-kinds=all -v --workaround-gcc296-bugs=yes --log-file=${CODE_DIR}/../script/valgrind.log $PROGRAM -c $CFG_DIR -f $FILE_NAME else - echo "ExcuteCmd:" $PROGRAM -c $CFG_DIR -f $FILE_NAME - $PROGRAM -c $CFG_DIR -f $FILE_NAME + if [[ $MULTIPROCESS -eq 1 ]];then + echo "ExcuteCmd(multiprocess):" $PROGRAM -m -c $CFG_DIR -f $FILE_NAME + $PROGRAM -m -c $CFG_DIR -f $FILE_NAME + else + echo "ExcuteCmd(singleprocess):" $PROGRAM -c $CFG_DIR -f $FILE_NAME + $PROGRAM -c $CFG_DIR -f $FILE_NAME + fi fi else echo "ExcuteCmd:" $PROGRAM -c $CFG_DIR -f basicSuite.sim diff --git a/tests/script/tsim/query/session.sim b/tests/script/tsim/query/session.sim index 43923fc572..98f63f42e3 100644 --- a/tests/script/tsim/query/session.sim +++ b/tests/script/tsim/query/session.sim @@ -27,7 +27,15 @@ sql connect $vgroups = 4 $dbNamme = d0 -print =============== create database $dbNamme vgroups $vgroups +print ====> create database d1 precision 'us' +sql create database d1 precision 'us' +sql use d1 +sql create table dev_001 (ts timestamp ,i timestamp ,j int) +sql insert into dev_001 values(1623046993681000,now,1)(1623046993681001,now+1s,2)(1623046993681002,now+2s,3)(1623046993681004,now+5s,4) +sql create table secondts(ts timestamp,t2 timestamp,i int) +sql insert into secondts values(1623046993681000,now,1)(1623046993681001,now+1s,2)(1623046993681002,now+2s,3)(1623046993681004,now+5s,4) + +print ====> create database $dbNamme vgroups $vgroups sql create database $dbNamme vgroups $vgroups sql show databases print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 @@ -41,17 +49,33 @@ sql create table if not exists st (ts timestamp, tagtype int) tags(dev nchar(50) sql create table if not exists dev_001 using st tags("dev_01", "tag_01") sql create table if not exists dev_002 using st tags("dev_02", "tag_02") -sql INSERT INTO dev_001 VALUES('2020-05-13 10:00:00.000', 1)('2020-05-13 10:00:00.005', 2)('2020-05-13 10:00:00.011', 3) -sql INSERT INTO dev_001 VALUES('2020-05-13 10:00:01.011', 4)('2020-05-13 10:00:01.611', 5)('2020-05-13 10:00:02.612', 6) -sql INSERT INTO dev_001 VALUES('2020-05-13 10:01:02.612', 7)('2020-05-13 10:02:02.612', 8)('2020-05-13 10:03:02.613', 9) -sql INSERT INTO dev_001 VALUES('2020-05-13 11:00:00.000', 10)('2020-05-13 12:00:00.000', 11)('2020-05-13 13:00:00.001', 12) -sql INSERT INTO dev_001 VALUES('2020-05-14 13:00:00.001', 13)('2020-05-15 14:00:00.000', 14)('2020-05-20 10:00:00.000', 15) +sql INSERT INTO dev_001 VALUES('2020-05-13 10:00:00.000', 1) +sql INSERT INTO dev_001 VALUES('2020-05-13 10:00:00.005', 2) +sql INSERT INTO dev_001 VALUES('2020-05-13 10:00:00.011', 3) +sql INSERT INTO dev_001 VALUES('2020-05-13 10:00:01.011', 4) +sql INSERT INTO dev_001 VALUES('2020-05-13 10:00:01.611', 5) +sql INSERT INTO dev_001 VALUES('2020-05-13 10:00:02.612', 6) +sql INSERT INTO dev_001 VALUES('2020-05-13 10:01:02.612', 7) +sql INSERT INTO dev_001 VALUES('2020-05-13 10:02:02.612', 8) +sql INSERT INTO dev_001 VALUES('2020-05-13 10:03:02.613', 9) +sql INSERT INTO dev_001 VALUES('2020-05-13 11:00:00.000', 10) +sql INSERT INTO dev_001 VALUES('2020-05-13 12:00:00.000', 11) +sql INSERT INTO dev_001 VALUES('2020-05-13 13:00:00.001', 12) +sql INSERT INTO dev_001 VALUES('2020-05-14 13:00:00.001', 13) +sql INSERT INTO dev_001 VALUES('2020-05-15 14:00:00.000', 14) +sql INSERT INTO dev_001 VALUES('2020-05-20 10:00:00.000', 15) sql INSERT INTO dev_001 VALUES('2020-05-27 10:00:00.001', 16) -sql INSERT INTO dev_002 VALUES('2020-05-13 10:00:00.000', 1)('2020-05-13 10:00:00.005', 2)('2020-05-13 10:00:00.009', 3) -sql INSERT INTO dev_002 VALUES('2020-05-13 10:00:00.0021', 4)('2020-05-13 10:00:00.031', 5)('2020-05-13 10:00:00.036', 6)('2020-05-13 10:00:00.51', 7) - +sql INSERT INTO dev_002 VALUES('2020-05-13 10:00:00.000', 1) +sql INSERT INTO dev_002 VALUES('2020-05-13 10:00:00.005', 2) +sql INSERT INTO dev_002 VALUES('2020-05-13 10:00:00.009', 3) +sql INSERT INTO dev_002 VALUES('2020-05-13 10:00:00.0021', 4) +sql INSERT INTO dev_002 VALUES('2020-05-13 10:00:00.031', 5) +sql INSERT INTO dev_002 VALUES('2020-05-13 10:00:00.036', 6) +sql INSERT INTO dev_002 VALUES('2020-05-13 10:00:00.51', 7) +$loop_test = 0 +loop_test_pos: # session(ts,5a) print ====> select count(*) from dev_001 session(ts,5a) @@ -74,156 +98,241 @@ if $data01 != 2 then return -1 endi -return -# -# # session(ts,5a) main query -# tdSql.query("select count(*) from (select * from dev_001) session(ts,5a)") -# tdSql.checkRows(15) -# tdSql.checkData(0, 1, 2) -# -# -# # session(ts,1s) -# tdSql.query("select count(*) from dev_001 session(ts,1s)") -# tdSql.checkRows(12) -# tdSql.checkData(0, 1, 5) -# -# # session(ts,1s) main query -# tdSql.query("select count(*) from (select * from dev_001) session(ts,1s)") -# tdSql.checkRows(12) -# tdSql.checkData(0, 1, 5) -# -# tdSql.query("select count(*) from dev_001 session(ts,1000a)") -# tdSql.checkRows(12) -# tdSql.checkData(0, 1, 5) -# -# tdSql.query("select count(*) from (select * from dev_001) session(ts,1000a)") -# tdSql.checkRows(12) -# tdSql.checkData(0, 1, 5) -# -# # session(ts,1m) -# tdSql.query("select count(*) from dev_001 session(ts,1m)") -# tdSql.checkRows(9) -# tdSql.checkData(0, 1, 8) -# -# # session(ts,1m) -# tdSql.query("select count(*) from (select * from dev_001) session(ts,1m)") -# tdSql.checkRows(9) -# tdSql.checkData(0, 1, 8) -# -# # session(ts,1h) -# tdSql.query("select count(*) from dev_001 session(ts,1h)") -# tdSql.checkRows(6) -# tdSql.checkData(0, 1, 11) -# -# # session(ts,1h) -# tdSql.query("select count(*) from (select * from dev_001) session(ts,1h)") -# tdSql.checkRows(6) -# tdSql.checkData(0, 1, 11) -# -# # session(ts,1d) -# tdSql.query("select count(*) from dev_001 session(ts,1d)") -# tdSql.checkRows(4) -# tdSql.checkData(0, 1, 13) -# -# # session(ts,1d) -# tdSql.query("select count(*) from (select * from dev_001) session(ts,1d)") -# tdSql.checkRows(4) -# tdSql.checkData(0, 1, 13) -# -# # session(ts,1w) -# tdSql.query("select count(*) from dev_001 session(ts,1w)") -# tdSql.checkRows(2) -# tdSql.checkData(0, 1, 15) -# -# # session(ts,1w) -# tdSql.query("select count(*) from (select * from dev_001) session(ts,1w)") -# tdSql.checkRows(2) -# tdSql.checkData(0, 1, 15) -# -# # session with where -# tdSql.query("select count(*),first(tagtype),last(tagtype),avg(tagtype),sum(tagtype),min(tagtype),max(tagtype),leastsquares(tagtype, 1, 1),spread(tagtype),stddev(tagtype),percentile(tagtype,0) from dev_001 where ts <'2020-05-20 0:0:0' session(ts,1d)") -# -# tdSql.checkRows(2) -# tdSql.checkData(0, 1, 13) -# tdSql.checkData(0, 2, 1) -# tdSql.checkData(0, 3, 13) -# tdSql.checkData(0, 4, 7) -# tdSql.checkData(0, 5, 91) -# tdSql.checkData(0, 6, 1) -# tdSql.checkData(0, 7, 13) -# tdSql.checkData(0, 8, '{slop:1.000000, intercept:0.000000}') -# tdSql.checkData(0, 9, 12) -# tdSql.checkData(0, 10, 3.741657387) -# tdSql.checkData(0, 11, 1) -# tdSql.checkData(1, 11, 14) -# -# # session with where main -# -# tdSql.query("select count(*),first(tagtype),last(tagtype),avg(tagtype),sum(tagtype),min(tagtype),max(tagtype),leastsquares(tagtype, 1, 1) from (select * from dev_001 where ts <'2020-05-20 0:0:0') session(ts,1d)") -# -# tdSql.checkRows(2) -# tdSql.checkData(0, 1, 13) -# tdSql.checkData(0, 2, 1) -# tdSql.checkData(0, 3, 13) -# tdSql.checkData(0, 4, 7) -# tdSql.checkData(0, 5, 91) -# tdSql.checkData(0, 6, 1) -# tdSql.checkData(0, 7, 13) -# tdSql.checkData(0, 8, '{slop:1.000000, intercept:0.000000}') -# -# # tdsql err -# tdSql.error("select * from dev_001 session(ts,1w)") -# tdSql.error("select count(*) from st session(ts,1w)") -# tdSql.error("select count(*) from dev_001 group by tagtype session(ts,1w) ") -# tdSql.error("select count(*) from dev_001 session(ts,1n)") -# tdSql.error("select count(*) from dev_001 session(ts,1y)") -# tdSql.error("select count(*) from dev_001 session(ts,0s)") -# tdSql.error("select count(*) from dev_001 session(i,1y)") -# tdSql.error("select count(*) from dev_001 session(ts,1d) where ts <'2020-05-20 0:0:0'") -# -# #test precision us -# tdSql.execute("create database test precision 'us'") -# tdSql.execute("use test") -# tdSql.execute("create table dev_001 (ts timestamp ,i timestamp ,j int)") -# tdSql.execute("insert into dev_001 values(1623046993681000,now,1)(1623046993681001,now+1s,2)(1623046993681002,now+2s,3)(1623046993681004,now+5s,4)") -# -# # session(ts,1u) -# tdSql.query("select count(*) from dev_001 session(ts,1u)") -# tdSql.checkRows(2) -# tdSql.checkData(0, 1, 3) -# tdSql.error("select count(*) from dev_001 session(i,1s)") -# # test second timestamp fileds -# tdSql.execute("create table secondts(ts timestamp,t2 timestamp,i int)") -# tdSql.error("select count(*) from secondts session(t2,2s)") -# -# +print ====> select count(*) from (select * from dev_001) session(ts,5a) +sql select count(*) from (select * from dev_001) session(ts,5a) +if $rows != 15 then + return -1 +endi +if $data01 != 2 then + return -1 +endi + +print ====> select count(*) from dev_001 session(ts,1s) +sql select count(*) from dev_001 session(ts,1s) +if $rows != 12 then + return -1 +endi +if $data01 != 5 then + return -1 +endi + +print ====> select count(*) from (select * from dev_001) session(ts,1s) +sql select count(*) from (select * from dev_001) session(ts,1s) +if $rows != 12 then + return -1 +endi +if $data01 != 5 then + return -1 +endi + +print ====> select count(*) from dev_001 session(ts,1000a) +sql select count(*) from dev_001 session(ts,1000a) +if $rows != 12 then + return -1 +endi +if $data01 != 5 then + return -1 +endi + +print ====> select count(*) from (select * from dev_001) session(ts,1000a) +sql select count(*) from (select * from dev_001) session(ts,1000a) +if $rows != 12 then + return -1 +endi +if $data01 != 5 then + return -1 +endi + +print ====> select count(*) from dev_001 session(ts,1m) +sql select count(*) from dev_001 session(ts,1m) +if $rows != 9 then + return -1 +endi +if $data01 != 8 then + return -1 +endi + +print ====> select count(*) from (select * from dev_001) session(ts,1m) +sql select count(*) from (select * from dev_001) session(ts,1m) +if $rows != 9 then + return -1 +endi +if $data01 != 8 then + return -1 +endi + +print ====> select count(*) from dev_001 session(ts,1h) +sql select count(*) from dev_001 session(ts,1h) +if $rows != 6 then + return -1 +endi +if $data01 != 11 then + return -1 +endi + +print ====> select count(*) from (select * from dev_001) session(ts,1h) +sql select count(*) from (select * from dev_001) session(ts,1h) +if $rows != 6 then + return -1 +endi +if $data01 != 11 then + return -1 +endi + +print ====> select count(*) from dev_001 session(ts,1d) +sql select count(*) from dev_001 session(ts,1d) +if $rows != 4 then + return -1 +endi +if $data01 != 13 then + return -1 +endi + +print ====> select count(*) from (select * from dev_001) session(ts,1d) +sql select count(*) from (select * from dev_001) session(ts,1d) +if $rows != 4 then + return -1 +endi +if $data01 != 13 then + return -1 +endi + +print ====> select count(*) from dev_001 session(ts,1w) +sql select count(*) from dev_001 session(ts,1w) +if $rows != 2 then + return -1 +endi +if $data01 != 15 then + return -1 +endi + +print ====> select count(*) from (select * from dev_001) session(ts,1w) +sql select count(*) from (select * from dev_001) session(ts,1w) +if $rows != 2 then + return -1 +endi +if $data01 != 15 then + return -1 +endi + +print ====> select count(*),first(tagtype),last(tagtype),avg(tagtype),sum(tagtype),min(tagtype),max(tagtype),leastsquares(tagtype, 1, 1),spread(tagtype),stddev(tagtype),percentile(tagtype,0) from dev_001 where ts <'2020-05-20 0:0:0' session(ts,1d) +sql select count(*),first(tagtype),last(tagtype),avg(tagtype),sum(tagtype),min(tagtype),max(tagtype),leastsquares(tagtype, 1, 1),spread(tagtype),stddev(tagtype),percentile(tagtype,0) from dev_001 where ts <'2020-05-20 0:0:0' session(ts,1d) +if $rows != 2 then + return -1 +endi +if $data01 != 13 then + return -1 +endi +if $data02 != 1 then + return -1 +endi +if $data03 != 13 then + return -1 +endi +if $data04 != 7 then + return -1 +endi +if $data05 != 91 then + return -1 +endi +if $data06 != 1 then + return -1 +endi +if $data07 != 13 then + return -1 +endi +if $data08 != @{slop:1.000000, intercept:0.000000}@ then + return -1 +endi +if $data09 != 12 then + return -1 +endi +# $data0-10 != 3.741657387 +# $data0-11 != 1 +# $data1-11 != 14 + +print ====> select count(*),first(tagtype),last(tagtype),avg(tagtype),sum(tagtype),min(tagtype),max(tagtype),leastsquares(tagtype, 1, 1) from (select * from dev_001 where ts <'2020-05-20 0:0:0') session(ts,1d) +sql select count(*),first(tagtype),last(tagtype),avg(tagtype),sum(tagtype),min(tagtype),max(tagtype),leastsquares(tagtype, 1, 1) from (select * from dev_001 where ts <'2020-05-20 0:0:0') session(ts,1d) +if $rows != 2 then + return -1 +endi +if $data01 != 13 then + return -1 +endi +if $data02 != 1 then + return -1 +endi +if $data03 != 13 then + return -1 +endi +if $data04 != 7 then + return -1 +endi +if $data05 != 91 then + return -1 +endi +if $data06 != 1 then + return -1 +endi +if $data07 != 13 then + return -1 +endi +if $data08 != @{slop:1.000000, intercept:0.000000}@ then + return -1 +endi + +sql_error select * from dev_001 session(ts,1w) +sql_error select count(*) from st session(ts,1w) +sql_error select count(*) from dev_001 group by tagtype session(ts,1w) +sql_error select count(*) from dev_001 session(ts,1n) +sql_error select count(*) from dev_001 session(ts,1y) +sql_error select count(*) from dev_001 session(ts,0s) +sql_error select count(*) from dev_001 session(i,1y) +sql_error select count(*) from dev_001 session(ts,1d) where ts <'2020-05-20 0:0:0' + +print ====> create database d1 precision 'us' +sql create database d1 precision 'us' +sql use d1 +sql create table dev_001 (ts timestamp ,i timestamp ,j int) +sql insert into dev_001 values(1623046993681000,now,1)(1623046993681001,now+1s,2)(1623046993681002,now+2s,3)(1623046993681004,now+5s,4) +print ====> select count(*) from dev_001 session(ts,1u) +sql select count(*) from dev_001 session(ts,1u) +if $rows != 2 then + return -1 +endi +if $data01 != 3 then + return -1 +endi +sql_error select count(*) from dev_001 session(i,1s) +sql create table secondts(ts timestamp,t2 timestamp,i int) +sql_error select count(*) from secondts session(t2,2s) -#if $loop_test == 0 then -# print =============== stop and restart taosd -# system sh/exec.sh -n dnode1 -s stop -x SIGINT -# system sh/exec.sh -n dnode1 -s start -# -# $loop_cnt = 0 -# check_dnode_ready_0: -# $loop_cnt = $loop_cnt + 1 -# sleep 200 -# if $loop_cnt == 10 then -# print ====> dnode not ready! -# return -1 -# endi -# sql show dnodes -# print ===> $rows $data00 $data01 $data02 $data03 $data04 $data05 -# if $data00 != 1 then -# return -1 -# endi -# if $data04 != ready then -# goto check_dnode_ready_0 -# endi -# -# $loop_test = 1 -# goto loop_test_pos -#endi -# +if $loop_test == 0 then + print =============== stop and restart taosd + system sh/exec.sh -n dnode1 -s stop -x SIGINT + system sh/exec.sh -n dnode1 -s start + + $loop_cnt = 0 + check_dnode_ready_0: + $loop_cnt = $loop_cnt + 1 + sleep 200 + if $loop_cnt == 10 then + print ====> dnode not ready! + return -1 + endi + sql show dnodes + print ===> $rows $data00 $data01 $data02 $data03 $data04 $data05 + if $data00 != 1 then + return -1 + endi + if $data04 != ready then + goto check_dnode_ready_0 + endi + + $loop_test = 1 + goto loop_test_pos +endi + #system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/test-all.sh b/tests/test-all.sh index aa7c4240bc..ff9905e209 100755 --- a/tests/test-all.sh +++ b/tests/test-all.sh @@ -91,20 +91,23 @@ function runSimCaseOneByOnefq { for ((i=$start;i<=$end;i++)) ; do line=`sed -n "$i"p jenkins/basic.txt` if [[ $line =~ ^./test.sh* ]] || [[ $line =~ ^run* ]]; then - case=`echo $line | grep sim$ |awk '{print $NF}'` + #case=`echo $line | grep sim$ |awk '{print $NF}'` + case=`echo $line | grep -o ".*\.sim" |awk '{print $NF}'` start_time=`date +%s` date +%F\ %T | tee -a out.log if [[ "$tests_dir" == *"$IN_TDINTERNAL"* ]]; then - echo -n $case - ./test.sh -f $case > case.log 2>&1 \ + #echo -n $case + echo -n $line + $line > case.log 2>&1 \ && \ ([ -f ../../../sim/tsim/log/taoslog0.0 ] && grep -q 'script.*'$case'.*failed.*, err.*lineNum' ../../../sim/tsim/log/taoslog0.0 && echo -e "${RED} failed${NC}" | tee -a out.log || echo -e "${GREEN} success${NC}" | tee -a out.log )|| \ ([ -f ../../../sim/tsim/log/taoslog0.0 ] && grep -q 'script.*success.*m$' ../../../sim/tsim/log/taoslog0.0 && echo -e "${GREEN} success${NC}" | tee -a out.log ) || \ ( echo -e "${RED} failed${NC}" | tee -a out.log && echo '=====================log=====================' && cat case.log ) else - echo -n $case - ./test.sh -f $case > ../../sim/case.log 2>&1 && \ + #echo -n $case + echo -n $line + $line > ../../sim/case.log 2>&1 && \ ([ -f ../../sim/tsim/log/taoslog0.0 ] && grep -q 'script.*'$case'.*failed.*, err.*lineNum' ../../sim/tsim/log/taoslog0.0 && echo -e "${RED} failed${NC}" | tee -a out.log || echo -e "${GREEN} success${NC}" | tee -a out.log )|| \ ([ -f ../../sim/tsim/log/taoslog0.0 ] && grep -q 'script.*success.*m$' ../../sim/tsim/log/taoslog0.0 && echo -e "${GREEN} success${NC}" | tee -a out.log ) || \ ( echo -e "${RED} failed${NC}" | tee -a out.log && echo '=====================log=====================' && pwd && cat ../../sim/case.log ) diff --git a/tests/tsim/inc/simInt.h b/tests/tsim/inc/simInt.h index 1e2190e308..a667139de1 100644 --- a/tests/tsim/inc/simInt.h +++ b/tests/tsim/inc/simInt.h @@ -155,6 +155,7 @@ extern int32_t simScriptSucced; extern int32_t simDebugFlag; extern char simScriptDir[]; extern bool abortExecution; +extern bool useMultiProcess; SScript *simParseScript(char *fileName); SScript *simProcessCallOver(SScript *script); diff --git a/tests/tsim/src/simExe.c b/tests/tsim/src/simExe.c index 855705e904..9a0b48197a 100644 --- a/tests/tsim/src/simExe.c +++ b/tests/tsim/src/simExe.c @@ -305,25 +305,24 @@ bool simExecuteRunBackCmd(SScript *script, char *option) { return true; } -void simReplaceShToBat(char *dst) { - char *sh = strstr(dst, ".sh"); - if (sh != NULL) { +void simReplaceStr(char *buf, char *src, char *dst) { + char *begin = strstr(buf, src); + if (begin != NULL) { + int32_t srcLen = (int32_t)strlen(src); int32_t dstLen = (int32_t)strlen(dst); - char *end = dst + dstLen; - *(end + 1) = 0; + int32_t interval = (dstLen - srcLen); + int32_t remainLen = (int32_t)strlen(buf); + char *end = buf + remainLen; + *(end + interval) = 0; - for (char *p = end; p >= sh; p--) { - *(p + 1) = *p; + for (char *p = end; p >= begin; p--) { + *(p + interval) = *p; } - sh[0] = '.'; - sh[1] = 'b'; - sh[2] = 'a'; - sh[3] = 't'; - sh[4] = ' '; + memcpy(begin, dst, dstLen); } - simDebug("system cmd is %s", dst); + simInfo("system cmd is %s", buf); } bool simExecuteSystemCmd(SScript *script, char *option) { @@ -334,9 +333,13 @@ bool simExecuteSystemCmd(SScript *script, char *option) { simVisuallizeOption(script, option, buf + strlen(buf)); #else sprintf(buf, "%s%s", simScriptDir, option); - simReplaceShToBat(buf); + simReplaceStr(buf, ".sh", ".bat"); #endif + if (useMultiProcess) { + simReplaceStr(buf, "deploy.sh", "deploy.sh -m"); + } + simLogSql(buf, true); int32_t code = system(buf); int32_t repeatTimes = 0; diff --git a/tests/tsim/src/simMain.c b/tests/tsim/src/simMain.c index b57299e752..8898f1b201 100644 --- a/tests/tsim/src/simMain.c +++ b/tests/tsim/src/simMain.c @@ -18,6 +18,7 @@ bool simExecSuccess = false; bool abortExecution = false; +bool useMultiProcess = false; void simHandleSignal(int32_t signo, void *sigInfo, void *context) { simSystemCleanUp(); @@ -32,6 +33,8 @@ int32_t main(int32_t argc, char *argv[]) { tstrncpy(configDir, argv[++i], 128); } else if (strcmp(argv[i], "-f") == 0 && i < argc - 1) { strcpy(scriptFile, argv[++i]); + } else if (strcmp(argv[i], "-m") == 0) { + useMultiProcess = true; } else { printf("usage: %s [options] \n", argv[0]); printf(" [-c config]: config directory, default is: %s\n", configDir);