From 5bd37b75dc2230807d59e6250a42f7c73269667e Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 30 Mar 2022 15:57:12 +0800 Subject: [PATCH 01/49] shm --- source/dnode/mgmt/dm/src/dmFile.c | 2 +- source/dnode/mgmt/dm/src/dmInt.c | 14 +++++++++++ source/dnode/mgmt/main/inc/dnd.h | 6 ++++- source/dnode/mgmt/main/inc/dndInt.h | 4 --- source/dnode/mgmt/main/src/dndExec.c | 22 +++++------------ source/dnode/mgmt/main/src/dndInt.c | 4 +-- source/dnode/mgmt/main/src/dndObj.c | 37 +++++++++------------------- 7 files changed, 40 insertions(+), 49 deletions(-) diff --git a/source/dnode/mgmt/dm/src/dmFile.c b/source/dnode/mgmt/dm/src/dmFile.c index d44b1222a3..444f18e6e0 100644 --- a/source/dnode/mgmt/dm/src/dmFile.c +++ b/source/dnode/mgmt/dm/src/dmFile.c @@ -130,7 +130,7 @@ int32_t dmReadFile(SDnodeMgmt *pMgmt) { } code = 0; - dInfo("succcessed to read file %s", file); + dDebug("succcessed to read file %s", file); dmPrintDnodes(pMgmt); PRASE_DNODE_OVER: diff --git a/source/dnode/mgmt/dm/src/dmInt.c b/source/dnode/mgmt/dm/src/dmInt.c index b729888a72..3c5f394d5e 100644 --- a/source/dnode/mgmt/dm/src/dmInt.c +++ b/source/dnode/mgmt/dm/src/dmInt.c @@ -112,6 +112,16 @@ int32_t dmInit(SMgmtWrapper *pWrapper) { return -1; } + if (dndInitServer(pDnode) != 0) { + dError("failed to init trans server since %s", terrstr()); + return -1; + } + + if (dndInitClient(pDnode) != 0) { + dError("failed to init trans client since %s", terrstr()); + return -1; + } + pWrapper->pMgmt = pMgmt; dInfo("dnode-mgmt is initialized"); return 0; @@ -122,6 +132,7 @@ void dmCleanup(SMgmtWrapper *pWrapper) { if (pMgmt == NULL) return; dInfo("dnode-mgmt start to clean up"); + SDnode *pDnode = pMgmt->pDnode; dmStopWorker(pMgmt); taosWLockLatch(&pMgmt->latch); @@ -140,6 +151,9 @@ void dmCleanup(SMgmtWrapper *pWrapper) { taosMemoryFree(pMgmt); pWrapper->pMgmt = NULL; + dndCleanupServer(pDnode); + dndCleanupClient(pDnode); + dInfo("dnode-mgmt is cleaned up"); } diff --git a/source/dnode/mgmt/main/inc/dnd.h b/source/dnode/mgmt/main/inc/dnd.h index b416ee4f7a..d228194237 100644 --- a/source/dnode/mgmt/main/inc/dnd.h +++ b/source/dnode/mgmt/main/inc/dnd.h @@ -141,13 +141,17 @@ void dndSetMsgHandle(SMgmtWrapper *pWrapper, tmsg_t msgType, NodeMsgFp no void dndReportStartup(SDnode *pDnode, const char *pName, const char *pDesc); void dndSendMonitorReport(SDnode *pDnode); +int32_t dndInitServer(SDnode *pDnode); +void dndCleanupServer(SDnode *pDnode); +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); void dndSendRsp(SMgmtWrapper *pWrapper, const SRpcMsg *pRsp); void dndRegisterBrokenLinkArg(SMgmtWrapper *pWrapper, SRpcMsg *pMsg); SMsgCb dndCreateMsgcb(SMgmtWrapper *pWrapper); -int32_t dndProcessNodeMsg(SDnode *pDnode, SNodeMsg *pMsg); int32_t dndReadFile(SMgmtWrapper *pWrapper, bool *pDeployed); int32_t dndWriteFile(SMgmtWrapper *pWrapper, bool deployed); diff --git a/source/dnode/mgmt/main/inc/dndInt.h b/source/dnode/mgmt/main/inc/dndInt.h index 56782f872b..27f716f823 100644 --- a/source/dnode/mgmt/main/inc/dndInt.h +++ b/source/dnode/mgmt/main/inc/dndInt.h @@ -50,10 +50,6 @@ void dndClose(SDnode *pDnode); void dndHandleEvent(SDnode *pDnode, EDndEvent event); // dndTransport.c -int32_t dndInitServer(SDnode *pDnode); -void dndCleanupServer(SDnode *pDnode); -int32_t dndInitClient(SDnode *pDnode); -void dndCleanupClient(SDnode *pDnode); int32_t dndInitMsgHandle(SDnode *pDnode); void dndSendRpcRsp(SMgmtWrapper *pWrapper, const SRpcMsg *pRsp); diff --git a/source/dnode/mgmt/main/src/dndExec.c b/source/dnode/mgmt/main/src/dndExec.c index c41d4f28e4..b289fe91c6 100644 --- a/source/dnode/mgmt/main/src/dndExec.c +++ b/source/dnode/mgmt/main/src/dndExec.c @@ -16,15 +16,6 @@ #define _DEFAULT_SOURCE #include "dndInt.h" -static void dndResetLog(SMgmtWrapper *pMgmt) { - char logname[24] = {0}; - snprintf(logname, sizeof(logname), "%slog", pMgmt->name); - - dInfo("node:%s, reset log to %s in child process", pMgmt->name, logname); - taosCloseLog(); - taosInitLog(logname, 1); -} - static bool dndRequireNode(SMgmtWrapper *pWrapper) { bool required = false; int32_t code =(*pWrapper->fp.requiredFp)(pWrapper, &required); @@ -71,22 +62,21 @@ void dndCloseNode(SMgmtWrapper *pWrapper) { } static int32_t dndRunInSingleProcess(SDnode *pDnode) { - dInfo("dnode run in single process mode"); + dDebug("dnode run in single process mode"); + SMsgCb msgCb = dndCreateMsgcb(&pDnode->wrappers[0]); + tmsgSetDefaultMsgCb(&msgCb); - for (ENodeType n = 0; n < NODE_MAX; ++n) { + for (ENodeType n = DNODE; n < NODE_MAX; ++n) { SMgmtWrapper *pWrapper = &pDnode->wrappers[n]; pWrapper->required = dndRequireNode(pWrapper); if (!pWrapper->required) continue; - SMsgCb msgCb = dndCreateMsgcb(pWrapper); - tmsgSetDefaultMsgCb(&msgCb); if (taosMkDir(pWrapper->path) != 0) { terrno = TAOS_SYSTEM_ERROR(errno); - dError("failed to create dir:%s since %s", pWrapper->path, terrstr()); + dError("node:%s, failed to create dir:%s since %s", pWrapper->name, pWrapper->path, terrstr()); return -1; } - dInfo("node:%s, will start in single process", pWrapper->name); pWrapper->procType = PROC_SINGLE; if (dndOpenNode(pWrapper) != 0) { dError("node:%s, failed to start since %s", pWrapper->name, terrstr()); @@ -215,7 +205,7 @@ static int32_t dndRunInMultiProcess(SDnode *pDnode) { if (taosProcIsChild(pProc)) { dInfo("node:%s, will start in child process", pWrapper->name); pWrapper->procType = PROC_CHILD; - dndResetLog(pWrapper); + // dndResetLog(pWrapper); dInfo("node:%s, clean up resources inherited from parent", pWrapper->name); dndClearNodesExecpt(pDnode, n); diff --git a/source/dnode/mgmt/main/src/dndInt.c b/source/dnode/mgmt/main/src/dndInt.c index 7dde3561fb..8792147822 100644 --- a/source/dnode/mgmt/main/src/dndInt.c +++ b/source/dnode/mgmt/main/src/dndInt.c @@ -41,7 +41,7 @@ int32_t dndInit() { return -1; } - dDebug("dnode env is initialized"); + dInfo("dnode env is initialized"); return 0; } @@ -55,7 +55,7 @@ void dndCleanup() { monCleanup(); walCleanUp(); taosStopCacheRefreshWorker(); - dDebug("dnode env is cleaned up"); + dInfo("dnode env is cleaned up"); } void dndSetMsgHandle(SMgmtWrapper *pWrapper, tmsg_t msgType, NodeMsgFp nodeMsgFp, int8_t vgId) { diff --git a/source/dnode/mgmt/main/src/dndObj.c b/source/dnode/mgmt/main/src/dndObj.c index 99dc782a9b..6afe0c5b5f 100644 --- a/source/dnode/mgmt/main/src/dndObj.c +++ b/source/dnode/mgmt/main/src/dndObj.c @@ -53,7 +53,7 @@ static void dndClearVars(SDnode *pDnode) { } SDnode *dndCreate(const SDnodeOpt *pOption) { - dInfo("start to create dnode object"); + dDebug("start to create dnode object"); int32_t code = -1; char path[PATH_MAX] = {0}; SDnode *pDnode = NULL; @@ -77,25 +77,6 @@ SDnode *dndCreate(const SDnodeOpt *pOption) { smGetMgmtFp(&pDnode->wrappers[SNODE]); bmGetMgmtFp(&pDnode->wrappers[BNODE]); - if (dndOpenRuntimeFile(pDnode) != 0) { - dError("failed to open runtime file since %s", terrstr()); - goto _OVER; - } - - if (dndInitServer(pDnode) != 0) { - dError("failed to init trans server since %s", terrstr()); - goto _OVER; - } - - if (dndInitClient(pDnode) != 0) { - dError("failed to init trans client since %s", terrstr()); - goto _OVER; - } - - if (dndInitMsgHandle(pDnode) != 0) { - goto _OVER; - } - for (ENodeType n = 0; n < NODE_MAX; ++n) { SMgmtWrapper *pWrapper = &pDnode->wrappers[n]; snprintf(path, sizeof(path), "%s%s%s", pDnode->dataDir, TD_DIRSEP, pWrapper->name); @@ -110,6 +91,17 @@ SDnode *dndCreate(const SDnodeOpt *pOption) { taosInitRWLatch(&pWrapper->latch); } + if (dndInitMsgHandle(pDnode) != 0) { + dError("failed to msg handles since %s", terrstr()); + goto _OVER; + } + + if (dndOpenRuntimeFile(pDnode) != 0) { + dError("failed to open runtime file since %s", terrstr()); + goto _OVER; + } + + dInfo("dnode object is created, data:%p", pDnode); code = 0; _OVER: @@ -117,8 +109,6 @@ _OVER: dndClearVars(pDnode); pDnode = NULL; dError("failed to create dnode object since %s", terrstr()); - } else { - dInfo("dnode object is created, data:%p", pDnode); } return pDnode; @@ -135,9 +125,6 @@ void dndClose(SDnode *pDnode) { dInfo("start to close dnode, data:%p", pDnode); dndSetStatus(pDnode, DND_STAT_STOPPED); - dndCleanupServer(pDnode); - dndCleanupClient(pDnode); - for (ENodeType n = 0; n < NODE_MAX; ++n) { SMgmtWrapper *pWrapper = &pDnode->wrappers[n]; dndCloseNode(pWrapper); From 6ece0d9ac1cd7b0060d95a1609e63398bd00da2f Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 30 Mar 2022 16:03:21 +0800 Subject: [PATCH 02/49] shm --- include/util/tprocess.h | 4 +- source/dnode/mgmt/main/src/dndExec.c | 194 +++++++++++++-------------- source/dnode/mgmt/main/src/dndObj.c | 3 + source/util/src/tprocess.c | 4 +- 4 files changed, 102 insertions(+), 103 deletions(-) diff --git a/include/util/tprocess.h b/include/util/tprocess.h index 51ce0243b7..090762b340 100644 --- a/include/util/tprocess.h +++ b/include/util/tprocess.h @@ -32,19 +32,17 @@ typedef void *(*ProcConsumeFp)(void *pParent, void *pHead, int16_t headLen, void ProcFuncType ftype); typedef struct { - int32_t childQueueSize; ProcConsumeFp childConsumeFp; ProcMallocFp childMallocHeadFp; ProcFreeFp childFreeHeadFp; ProcMallocFp childMallocBodyFp; ProcFreeFp childFreeBodyFp; - int32_t parentQueueSize; ProcConsumeFp parentConsumeFp; ProcMallocFp parentdMallocHeadFp; ProcFreeFp parentFreeHeadFp; ProcMallocFp parentMallocBodyFp; ProcFreeFp parentFreeBodyFp; - bool testFlag; + SShm shm; void *pParent; const char *name; } SProcCfg; diff --git a/source/dnode/mgmt/main/src/dndExec.c b/source/dnode/mgmt/main/src/dndExec.c index b289fe91c6..bdce489f76 100644 --- a/source/dnode/mgmt/main/src/dndExec.c +++ b/source/dnode/mgmt/main/src/dndExec.c @@ -28,14 +28,18 @@ static bool dndRequireNode(SMgmtWrapper *pWrapper) { } int32_t dndOpenNode(SMgmtWrapper *pWrapper) { - int32_t code = (*pWrapper->fp.openFp)(pWrapper); - if (code != 0) { - dError("node:%s, failed to open since %s", pWrapper->name, terrstr()); + if (taosMkDir(pWrapper->path) != 0) { + terrno = TAOS_SYSTEM_ERROR(errno); + dError("node:%s, failed to create dir:%s since %s", pWrapper->name, pWrapper->path, terrstr()); return -1; - } else { - dDebug("node:%s, has been opened", pWrapper->name); } + if ((*pWrapper->fp.openFp)(pWrapper) != 0) { + dError("node:%s, failed to open since %s", pWrapper->name, terrstr()); + return -1; + } + + dDebug("node:%s, has been opened", pWrapper->name); pWrapper->deployed = true; return 0; } @@ -62,22 +66,13 @@ void dndCloseNode(SMgmtWrapper *pWrapper) { } static int32_t dndRunInSingleProcess(SDnode *pDnode) { - dDebug("dnode run in single process mode"); - SMsgCb msgCb = dndCreateMsgcb(&pDnode->wrappers[0]); - tmsgSetDefaultMsgCb(&msgCb); + dInfo("dnode start to run in single process"); for (ENodeType n = DNODE; n < NODE_MAX; ++n) { SMgmtWrapper *pWrapper = &pDnode->wrappers[n]; pWrapper->required = dndRequireNode(pWrapper); if (!pWrapper->required) continue; - if (taosMkDir(pWrapper->path) != 0) { - terrno = TAOS_SYSTEM_ERROR(errno); - dError("node:%s, failed to create dir:%s since %s", pWrapper->name, pWrapper->path, terrstr()); - return -1; - } - - pWrapper->procType = PROC_SINGLE; if (dndOpenNode(pWrapper) != 0) { dError("node:%s, failed to start since %s", pWrapper->name, terrstr()); return -1; @@ -96,18 +91,10 @@ static int32_t dndRunInSingleProcess(SDnode *pDnode) { } } + dInfo("dnode running in single process"); return 0; } -static void dndClearNodesExecpt(SDnode *pDnode, ENodeType except) { - // dndCleanupServer(pDnode); - for (ENodeType n = 0; n < NODE_MAX; ++n) { - if (except == n) continue; - SMgmtWrapper *pWrapper = &pDnode->wrappers[n]; - pWrapper->required = false; - } -} - static void dndConsumeChildQueue(SMgmtWrapper *pWrapper, SNodeMsg *pMsg, int16_t msgLen, void *pCont, int32_t contLen, ProcFuncType ftype) { SRpcMsg *pRpc = &pMsg->rpcMsg; @@ -153,115 +140,126 @@ static void dndConsumeParentQueue(SMgmtWrapper *pWrapper, SRpcMsg *pMsg, int16_t taosMemoryFree(pMsg); } -static int32_t dndRunInMultiProcess(SDnode *pDnode) { - dInfo("dnode run in multi process mode"); +static int32_t dndRunInParentProcess(SDnode *pDnode) { + dInfo("dnode start to run in parent process"); + SMgmtWrapper *pDWrapper = &pDnode->wrappers[DNODE]; + if (dndOpenNode(pDWrapper) != 0) { + dError("node:%s, failed to start since %s", pDWrapper->name, terrstr()); + return -1; + } - for (ENodeType n = 0; n < NODE_MAX; ++n) { + for (ENodeType n = DNODE + 1; n < NODE_MAX; ++n) { SMgmtWrapper *pWrapper = &pDnode->wrappers[n]; pWrapper->required = dndRequireNode(pWrapper); if (!pWrapper->required) continue; - SMsgCb msgCb = dndCreateMsgcb(pWrapper); - tmsgSetDefaultMsgCb(&msgCb); - - if (taosMkDir(pWrapper->path) != 0) { - terrno = TAOS_SYSTEM_ERROR(errno); - dError("failed to create dir:%s since %s", pWrapper->path, terrstr()); + int64_t shmsize = 1024 * 1024 * 2; // size will be a configuration item + if (taosCreateShm(&pWrapper->shm, shmsize) != 0) { + terrno = TAOS_SYSTEM_ERROR(terrno); + dError("node:%s, failed to create shm size:%" PRId64 " since %s", pWrapper->name, shmsize, terrstr()); return -1; } - if (n == DNODE) { - dInfo("node:%s, will start in parent process", pWrapper->name); - pWrapper->procType = PROC_SINGLE; - if (dndOpenNode(pWrapper) != 0) { - dError("node:%s, failed to start since %s", pWrapper->name, terrstr()); - return -1; - } - continue; - } + SProcCfg cfg = {.parentConsumeFp = (ProcConsumeFp)dndConsumeParentQueue, + .parentdMallocHeadFp = (ProcMallocFp)taosMemoryMalloc, + .parentFreeHeadFp = (ProcFreeFp)taosMemoryFree, + .parentMallocBodyFp = (ProcMallocFp)rpcMallocCont, + .parentFreeBodyFp = (ProcFreeFp)rpcFreeCont, + .shm = pWrapper->shm, + .pParent = pWrapper, + .name = pWrapper->name}; - SProcCfg cfg = {.childQueueSize = 1024 * 1024 * 2, // size will be a configuration item - .childConsumeFp = (ProcConsumeFp)dndConsumeChildQueue, - .childMallocHeadFp = (ProcMallocFp)taosAllocateQitem, - .childFreeHeadFp = (ProcFreeFp)taosFreeQitem, - .childMallocBodyFp = (ProcMallocFp)rpcMallocCont, - .childFreeBodyFp = (ProcFreeFp)rpcFreeCont, - .parentQueueSize = 1024 * 1024 * 2, // size will be a configuration item - .parentConsumeFp = (ProcConsumeFp)dndConsumeParentQueue, - .parentdMallocHeadFp = (ProcMallocFp)taosMemoryMalloc, - .parentFreeHeadFp = (ProcFreeFp)taosMemoryFree, - .parentMallocBodyFp = (ProcMallocFp)rpcMallocCont, - .parentFreeBodyFp = (ProcFreeFp)rpcFreeCont, - .pParent = pWrapper, - .name = pWrapper->name}; - SProcObj *pProc = taosProcInit(&cfg); - if (pProc == NULL) { - dError("node:%s, failed to fork since %s", pWrapper->name, terrstr()); + pWrapper->pProc = taosProcInit(&cfg); + if (pWrapper->pProc == NULL) { + dError("node:%s, failed to create proc since %s", pWrapper->name, terrstr()); return -1; } + } - pWrapper->pProc = pProc; + if (dndWriteRuntimeFile(pDnode) != 0) { + dError("failed to write runtime file since %s", terrstr()); + return -1; + } - if (taosProcIsChild(pProc)) { - dInfo("node:%s, will start in child process", pWrapper->name); - pWrapper->procType = PROC_CHILD; - // dndResetLog(pWrapper); + for (ENodeType n = DNODE + 1; n < NODE_MAX; ++n) { + SMgmtWrapper *pWrapper = &pDnode->wrappers[n]; + if (!pWrapper->required) continue; - dInfo("node:%s, clean up resources inherited from parent", pWrapper->name); - dndClearNodesExecpt(pDnode, n); + dInfo("node:%s, will not start in parent process", pWrapper->name); + // exec new node - dInfo("node:%s, will be initialized in child process", pWrapper->name); - if (dndOpenNode(pWrapper) != 0) { - dInfo("node:%s, failed to init in child process since %s", pWrapper->name, terrstr()); - return -1; - } - - if (taosProcRun(pProc) != 0) { - dError("node:%s, failed to run proc since %s", pWrapper->name, terrstr()); - return -1; - } - break; - } else { - dInfo("node:%s, will not start in parent process, child pid:%d", pWrapper->name, taosProcChildId(pProc)); - pWrapper->procType = PROC_PARENT; - if (taosProcRun(pProc) != 0) { - dError("node:%s, failed to run proc since %s", pWrapper->name, terrstr()); - return -1; - } + pWrapper->procType = PROC_PARENT; + if (taosProcRun(pWrapper->pProc) != 0) { + dError("node:%s, failed to run proc since %s", pWrapper->name, terrstr()); + return -1; } } dndSetStatus(pDnode, DND_STAT_RUNNING); - for (ENodeType n = 0; n < NODE_MAX; ++n) { - SMgmtWrapper *pWrapper = &pDnode->wrappers[n]; - if (!pWrapper->required) continue; - if (pWrapper->fp.startFp == NULL) continue; - if (pWrapper->procType == PROC_PARENT && n != DNODE) continue; - if (pWrapper->procType == PROC_CHILD && n == DNODE) continue; - if ((*pWrapper->fp.startFp)(pWrapper) != 0) { - dError("node:%s, failed to start since %s", pWrapper->name, terrstr()); - return -1; - } + if ((*pDWrapper->fp.startFp)(pDWrapper) != 0) { + dError("node:%s, failed to start since %s", pDWrapper->name, terrstr()); + return -1; } + dInfo("dnode running in parent process"); return 0; } -int32_t dndRun(SDnode *pDnode) { +static int32_t dndRunInChildProcess(SDnode *pDnode) { + dInfo("dnode start to run in child process"); + + SMgmtWrapper *pWrapper = &pDnode->wrappers[pDnode->ntype]; + if (dndOpenNode(pWrapper) != 0) { + dError("node:%s, failed to start since %s", pWrapper->name, terrstr()); + return -1; + } + + SProcCfg cfg = {.childConsumeFp = (ProcConsumeFp)dndConsumeChildQueue, + .childMallocHeadFp = (ProcMallocFp)taosAllocateQitem, + .childFreeHeadFp = (ProcFreeFp)taosFreeQitem, + .childMallocBodyFp = (ProcMallocFp)rpcMallocCont, + .childFreeBodyFp = (ProcFreeFp)rpcFreeCont, + .shm = pWrapper->shm, + .pParent = pWrapper, + .name = pWrapper->name}; + + pWrapper->pProc = taosProcInit(&cfg); + if (pWrapper->pProc == NULL) { + dError("node:%s, failed to create proc since %s", pWrapper->name, terrstr()); + return -1; + } + + pWrapper->procType = PROC_CHILD; + if (taosProcRun(pWrapper->pProc) != 0) { + dError("node:%s, failed to run proc since %s", pWrapper->name, terrstr()); + return -1; + } + + dInfo("dnode running in child process"); + return 0; +} + +int32_t dndRun(SDnode * pDnode) { if (!tsMultiProcess) { if (dndRunInSingleProcess(pDnode) != 0) { - dError("failed to run dnode in single process mode since %s", terrstr()); + dError("failed to run dnode since %s", terrstr()); + return -1; + } + } else if (pDnode->ntype == DNODE) { + if (dndRunInParentProcess(pDnode) != 0) { + dError("failed to run dnode in parent process since %s", terrstr()); return -1; } } else { - if (dndRunInMultiProcess(pDnode) != 0) { - dError("failed to run dnode in multi process mode since %s", terrstr()); + if (dndRunInChildProcess(pDnode) != 0) { + dError("failed to run dnode in child process since %s", terrstr()); return -1; } } dndReportStartup(pDnode, "TDengine", "initialized successfully"); + dInfo("TDengine initialized successfully"); while (1) { if (pDnode->event == DND_EVENT_STOP) { diff --git a/source/dnode/mgmt/main/src/dndObj.c b/source/dnode/mgmt/main/src/dndObj.c index 6afe0c5b5f..b7e91f3039 100644 --- a/source/dnode/mgmt/main/src/dndObj.c +++ b/source/dnode/mgmt/main/src/dndObj.c @@ -101,6 +101,9 @@ SDnode *dndCreate(const SDnodeOpt *pOption) { goto _OVER; } + SMsgCb msgCb = dndCreateMsgcb(&pDnode->wrappers[0]); + tmsgSetDefaultMsgCb(&msgCb); + dInfo("dnode object is created, data:%p", pDnode); code = 0; diff --git a/source/util/src/tprocess.c b/source/util/src/tprocess.c index 86cec2d271..7afbe56587 100644 --- a/source/util/src/tprocess.c +++ b/source/util/src/tprocess.c @@ -359,8 +359,8 @@ SProcObj *taosProcInit(const SProcCfg *pCfg) { } pProc->name = pCfg->name; - pProc->pChildQueue = taosProcInitQueue(pCfg->childQueueSize); - pProc->pParentQueue = taosProcInitQueue(pCfg->parentQueueSize); + pProc->pChildQueue = taosProcInitQueue(pCfg->shm.size / 2); + pProc->pParentQueue = taosProcInitQueue(pCfg->shm.size / 2); if (pProc->pChildQueue == NULL || pProc->pParentQueue == NULL) { taosProcCleanupQueue(pProc->pChildQueue); taosMemoryFree(pProc); From ae182cd75a5a10f9e142720c86c24c3b02cda755 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 30 Mar 2022 16:52:14 +0800 Subject: [PATCH 03/49] shm --- include/os/osShm.h | 4 +- source/dnode/mgmt/main/inc/dnd.h | 2 +- source/dnode/mgmt/main/inc/dndInt.h | 6 +-- source/dnode/mgmt/main/src/dndExec.c | 14 ++++- source/dnode/mgmt/main/src/dndFile.c | 79 +++++++++++++++------------- source/dnode/mgmt/main/src/dndObj.c | 16 ++++-- source/os/src/osShm.c | 4 +- 7 files changed, 76 insertions(+), 49 deletions(-) diff --git a/include/os/osShm.h b/include/os/osShm.h index 82ee2339f2..a5d6716d0d 100644 --- a/include/os/osShm.h +++ b/include/os/osShm.h @@ -22,11 +22,11 @@ extern "C" { typedef struct { int32_t id; - int32_t size; + int64_t size; void* ptr; } SShm; -int32_t taosCreateShm(SShm *pShm, int32_t shmsize) ; +int32_t taosCreateShm(SShm *pShm, int64_t shmsize) ; void taosDropShm(SShm *pShm); int32_t taosAttachShm(SShm *pShm); void taosDetachShm(SShm *pShm); diff --git a/source/dnode/mgmt/main/inc/dnd.h b/source/dnode/mgmt/main/inc/dnd.h index d228194237..294413a54d 100644 --- a/source/dnode/mgmt/main/inc/dnd.h +++ b/source/dnode/mgmt/main/inc/dnd.h @@ -128,7 +128,7 @@ typedef struct SDnode { EDndStatus status; EDndEvent event; SStartupReq startup; - TdFilePtr runtimeFile; + TdFilePtr lockfile; STransMgmt trans; SMgmtWrapper wrappers[NODE_MAX]; } SDnode; diff --git a/source/dnode/mgmt/main/inc/dndInt.h b/source/dnode/mgmt/main/inc/dndInt.h index 27f716f823..612d35d513 100644 --- a/source/dnode/mgmt/main/inc/dndInt.h +++ b/source/dnode/mgmt/main/inc/dndInt.h @@ -54,9 +54,9 @@ int32_t dndInitMsgHandle(SDnode *pDnode); void dndSendRpcRsp(SMgmtWrapper *pWrapper, const SRpcMsg *pRsp); // dndFile.c -int32_t dndOpenRuntimeFile(SDnode *pDnode); -int32_t dndWriteRuntimeFile(SDnode *pDnode); -void dndCloseRuntimeFile(SDnode *pDnode); +TdFilePtr dndCheckRunning(const char *dataDir); +int32_t dndReadShmFile(SDnode *pDnode); +int32_t dndWriteShmFile(SDnode *pDnode); #ifdef __cplusplus } diff --git a/source/dnode/mgmt/main/src/dndExec.c b/source/dnode/mgmt/main/src/dndExec.c index bdce489f76..d4dfae2d69 100644 --- a/source/dnode/mgmt/main/src/dndExec.c +++ b/source/dnode/mgmt/main/src/dndExec.c @@ -160,7 +160,12 @@ static int32_t dndRunInParentProcess(SDnode *pDnode) { return -1; } - SProcCfg cfg = {.parentConsumeFp = (ProcConsumeFp)dndConsumeParentQueue, + SProcCfg cfg = {.childConsumeFp = (ProcConsumeFp)dndConsumeChildQueue, + .childMallocHeadFp = (ProcMallocFp)taosAllocateQitem, + .childFreeHeadFp = (ProcFreeFp)taosFreeQitem, + .childMallocBodyFp = (ProcMallocFp)rpcMallocCont, + .childFreeBodyFp = (ProcFreeFp)rpcFreeCont, + .parentConsumeFp = (ProcConsumeFp)dndConsumeParentQueue, .parentdMallocHeadFp = (ProcMallocFp)taosMemoryMalloc, .parentFreeHeadFp = (ProcFreeFp)taosMemoryFree, .parentMallocBodyFp = (ProcMallocFp)rpcMallocCont, @@ -176,7 +181,7 @@ static int32_t dndRunInParentProcess(SDnode *pDnode) { } } - if (dndWriteRuntimeFile(pDnode) != 0) { + if (dndWriteShmFile(pDnode) != 0) { dError("failed to write runtime file since %s", terrstr()); return -1; } @@ -220,6 +225,11 @@ static int32_t dndRunInChildProcess(SDnode *pDnode) { .childFreeHeadFp = (ProcFreeFp)taosFreeQitem, .childMallocBodyFp = (ProcMallocFp)rpcMallocCont, .childFreeBodyFp = (ProcFreeFp)rpcFreeCont, + .parentConsumeFp = (ProcConsumeFp)dndConsumeParentQueue, + .parentdMallocHeadFp = (ProcMallocFp)taosMemoryMalloc, + .parentFreeHeadFp = (ProcFreeFp)taosMemoryFree, + .parentMallocBodyFp = (ProcMallocFp)rpcMallocCont, + .parentFreeBodyFp = (ProcFreeFp)rpcFreeCont, .shm = pWrapper->shm, .pParent = pWrapper, .name = pWrapper->name}; diff --git a/source/dnode/mgmt/main/src/dndFile.c b/source/dnode/mgmt/main/src/dndFile.c index 51d4ff3902..bcfb90af13 100644 --- a/source/dnode/mgmt/main/src/dndFile.c +++ b/source/dnode/mgmt/main/src/dndFile.c @@ -117,7 +117,30 @@ _OVER: return code; } -int32_t dndOpenRuntimeFile(SDnode *pDnode) { +TdFilePtr dndCheckRunning(const char *dataDir) { + char filepath[PATH_MAX] = {0}; + snprintf(filepath, sizeof(filepath), "%s%s.running", dataDir, TD_DIRSEP); + + TdFilePtr pFile = taosOpenFile(filepath, TD_FILE_CTEATE | TD_FILE_WRITE | TD_FILE_TRUNC); + if (pFile == NULL) { + terrno = TAOS_SYSTEM_ERROR(errno); + dError("failed to lock file:%s since %s", filepath, terrstr()); + return NULL; + } + + int32_t ret = taosLockFile(pFile); + if (ret != 0) { + terrno = TAOS_SYSTEM_ERROR(errno); + dError("failed to lock file:%s since %s", filepath, terrstr()); + taosCloseFile(&pFile); + return NULL; + } + + dDebug("file:%s is locked", filepath); + return pFile; +} + +int32_t dndReadShmFile(SDnode *pDnode) { int32_t code = -1; char itemName[24] = {0}; char content[MAXLEN + 1] = {0}; @@ -125,17 +148,11 @@ int32_t dndOpenRuntimeFile(SDnode *pDnode) { cJSON *root = NULL; TdFilePtr pFile = NULL; - snprintf(file, sizeof(file), "%s%s.running", pDnode->dataDir, TD_DIRSEP); - pFile = taosOpenFile(file, TD_FILE_CTEATE | TD_FILE_WRITE | TD_FILE_TRUNC); + snprintf(file, sizeof(file), "%s%s.shmfile", pDnode->dataDir, TD_DIRSEP); + pFile = taosOpenFile(file, TD_FILE_READ); if (pFile == NULL) { - terrno = TAOS_SYSTEM_ERROR(errno); - dError("failed to open file:%s since %s", file, terrstr()); - goto _OVER; - } - - if (taosLockFile(pFile) != 0) { - terrno = TAOS_SYSTEM_ERROR(errno); - dError("failed to lock file:%s since %s", file, terrstr()); + dDebug("file %s not exist", file); + code = 0; goto _OVER; } @@ -150,14 +167,14 @@ int32_t dndOpenRuntimeFile(SDnode *pDnode) { for (ENodeType ntype = DNODE + 1; ntype < NODE_MAX; ++ntype) { snprintf(itemName, sizeof(itemName), "%s_shmid", dndNodeProcStr(ntype)); cJSON *shmid = cJSON_GetObjectItem(root, itemName); - if (shmid && shmid->type == cJSON_Number) { - pDnode->wrappers[ntype].shm.id = shmid->valueint; + if (shmid && shmid->type == cJSON_String) { + pDnode->wrappers[ntype].shm.id = atoi(shmid->valuestring); } snprintf(itemName, sizeof(itemName), "%s_shmsize", dndNodeProcStr(ntype)); cJSON *shmsize = cJSON_GetObjectItem(root, itemName); - if (shmsize && shmsize->type == cJSON_Number) { - pDnode->wrappers[ntype].shm.size = shmsize->valueint; + if (shmsize && shmsize->type == cJSON_String) { + pDnode->wrappers[ntype].shm.size = atoll(shmsize->valuestring); } } } @@ -166,7 +183,7 @@ int32_t dndOpenRuntimeFile(SDnode *pDnode) { for (ENodeType ntype = DNODE; ntype < NODE_MAX; ++ntype) { SMgmtWrapper *pWrapper = &pDnode->wrappers[pDnode->ntype]; if (pWrapper->shm.id > 0) { - dDebug("shmid:%d, is closed, size:%d", pWrapper->shm.id, pWrapper->shm.size); + dDebug("shmid:%d, is closed, size:%" PRId64, pWrapper->shm.id, pWrapper->shm.size); taosDropShm(&pWrapper->shm); } } @@ -177,7 +194,7 @@ int32_t dndOpenRuntimeFile(SDnode *pDnode) { dError("shmid:%d, failed to attach since %s", pWrapper->shm.id, terrstr()); goto _OVER; } - dDebug("shmid:%d, is attached, size:%d", pWrapper->shm.id, pWrapper->shm.size); + dDebug("shmid:%d, is attached, size:%" PRId64, pWrapper->shm.id, pWrapper->shm.size); } dDebug("successed to open %s", file); @@ -185,16 +202,12 @@ int32_t dndOpenRuntimeFile(SDnode *pDnode) { _OVER: if (root != NULL) cJSON_Delete(root); - if (code != 0) { - if (pFile != NULL) taosCloseFile(&pFile); - } else { - pDnode->runtimeFile = pFile; - } + if (pFile != NULL) taosCloseFile(&pFile); return code; } -int32_t dndWriteRuntimeFile(SDnode *pDnode) { +int32_t dndWriteShmFile(SDnode *pDnode) { int32_t code = -1; int32_t len = 0; char content[MAXLEN + 1] = {0}; @@ -202,8 +215,8 @@ int32_t dndWriteRuntimeFile(SDnode *pDnode) { char realfile[PATH_MAX] = {0}; TdFilePtr pFile = NULL; - snprintf(file, sizeof(file), "%s%s.running.bak", pDnode->dataDir, TD_DIRSEP); - snprintf(realfile, sizeof(realfile), "%s%s.running", pDnode->dataDir, TD_DIRSEP); + snprintf(file, sizeof(file), "%s%s.shmfile.bak", pDnode->dataDir, TD_DIRSEP); + snprintf(realfile, sizeof(realfile), "%s%s.shmfile", pDnode->dataDir, TD_DIRSEP); pFile = taosOpenFile(file, TD_FILE_CTEATE | TD_FILE_WRITE | TD_FILE_TRUNC); if (pFile == NULL) { @@ -215,11 +228,13 @@ int32_t dndWriteRuntimeFile(SDnode *pDnode) { len += snprintf(content + len, MAXLEN - len, "{\n"); for (ENodeType ntype = DNODE + 1; ntype < NODE_MAX; ++ntype) { SMgmtWrapper *pWrapper = &pDnode->wrappers[pDnode->ntype]; - len += snprintf(content + len, MAXLEN - len, " \"%s_shmid\": %d,\n", dndNodeProcStr(ntype), pWrapper->shm.id); + len += snprintf(content + len, MAXLEN - len, " \"%s_shmid\": \"%d\",\n", dndNodeProcStr(ntype), pWrapper->shm.id); if (ntype == NODE_MAX - 1) { - len += snprintf(content + len, MAXLEN - len, " \"%s_shmsize\": %d\n", dndNodeProcStr(ntype), pWrapper->shm.size); + len += snprintf(content + len, MAXLEN - len, " \"%s_shmsize\": \"%" PRId64 "\"\n", dndNodeProcStr(ntype), + pWrapper->shm.size); } else { - len += snprintf(content + len, MAXLEN - len, " \"%s_shmsize\": %d,\n", dndNodeProcStr(ntype), pWrapper->shm.size); + len += snprintf(content + len, MAXLEN - len, " \"%s_shmsize\": \"%" PRId64 "\",\n", dndNodeProcStr(ntype), + pWrapper->shm.size); } } len += snprintf(content + len, MAXLEN - len, "}\n"); @@ -254,11 +269,3 @@ _OVER: return code; } - -void dndCloseRuntimeFile(SDnode *pDnode) { - if (pDnode->runtimeFile) { - taosUnLockFile(pDnode->runtimeFile); - taosCloseFile(&pDnode->runtimeFile); - pDnode->runtimeFile = NULL; - } -} \ No newline at end of file diff --git a/source/dnode/mgmt/main/src/dndObj.c b/source/dnode/mgmt/main/src/dndObj.c index b7e91f3039..91f2cb233b 100644 --- a/source/dnode/mgmt/main/src/dndObj.c +++ b/source/dnode/mgmt/main/src/dndObj.c @@ -34,6 +34,12 @@ static int32_t dndInitVars(SDnode *pDnode, const SDnodeOpt *pOption) { terrno = TSDB_CODE_OUT_OF_MEMORY; return -1; } + + pDnode->lockfile = dndCheckRunning(pDnode->dataDir); + if (pDnode->lockfile == NULL) { + return -1; + } + return 0; } @@ -42,7 +48,11 @@ static void dndClearVars(SDnode *pDnode) { SMgmtWrapper *pMgmt = &pDnode->wrappers[n]; taosMemoryFreeClear(pMgmt->path); } - dndCloseRuntimeFile(pDnode); + if (pDnode->lockfile != NULL) { + taosUnLockFile(pDnode->lockfile); + taosCloseFile(&pDnode->lockfile); + pDnode->lockfile = NULL; + } taosMemoryFreeClear(pDnode->localEp); taosMemoryFreeClear(pDnode->localFqdn); taosMemoryFreeClear(pDnode->firstEp); @@ -96,8 +106,8 @@ SDnode *dndCreate(const SDnodeOpt *pOption) { goto _OVER; } - if (dndOpenRuntimeFile(pDnode) != 0) { - dError("failed to open runtime file since %s", terrstr()); + if (dndReadShmFile(pDnode) != 0) { + dError("failed to read shm file since %s", terrstr()); goto _OVER; } diff --git a/source/os/src/osShm.c b/source/os/src/osShm.c index e7a22c3da1..cb80aeb5f3 100644 --- a/source/os/src/osShm.c +++ b/source/os/src/osShm.c @@ -17,8 +17,8 @@ #define _DEFAULT_SOURCE #include "os.h" -int32_t taosCreateShm(SShm* pShm, int32_t shmsize) { - int32_t shmid = shmget(IPC_PRIVATE, shmsize, IPC_CREAT | 0600); +int32_t taosCreateShm(SShm* pShm, int64_t shmsize) { + int32_t shmid = shmget(IPC_PRIVATE, (size_t)shmsize, IPC_CREAT | 0600); if (shmid < 0) { return -1; } From c39595639c94bab4ae1cb7df9e44190eb3780e92 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Wed, 30 Mar 2022 17:09:06 +0800 Subject: [PATCH 04/49] [td-14392] fix show bug. --- source/dnode/mnode/impl/src/mndShow.c | 4 +++- source/dnode/mnode/impl/src/mndStb.c | 1 - source/libs/executor/inc/executil.h | 2 ++ source/libs/executor/src/executil.c | 10 ++++++++++ source/libs/executor/src/executorimpl.c | 19 +++++++++++++------ 5 files changed, 28 insertions(+), 8 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndShow.c b/source/dnode/mnode/impl/src/mndShow.c index dff918f135..5c3167dd79 100644 --- a/source/dnode/mnode/impl/src/mndShow.c +++ b/source/dnode/mnode/impl/src/mndShow.c @@ -310,6 +310,8 @@ static int32_t mndProcessRetrieveSysTableReq(SNodeMsg *pReq) { mError("failed to process show-retrieve req:%p since %s", pShow, terrstr()); return -1; } + + pShow->numOfReads = 0; } ShowRetrieveFp retrieveFp = pMgmt->retrieveFps[pShow->type]; @@ -374,7 +376,7 @@ static int32_t mndProcessRetrieveSysTableReq(SNodeMsg *pReq) { pReq->pRsp = pRsp; pReq->rspLen = size; - if (rowsRead == 0 || rowsToRead == 0 || (rowsRead == rowsToRead && pShow->numOfRows == pShow->numOfReads)) { + if (rowsRead == 0 || rowsToRead == 0 || (rowsRead < rowsToRead)) { pRsp->completed = 1; mDebug("show:0x%" PRIx64 ", retrieve completed", pShow->id); mndReleaseShowObj((SShowObj*) pShow, true); diff --git a/source/dnode/mnode/impl/src/mndStb.c b/source/dnode/mnode/impl/src/mndStb.c index 7799ac7562..02e09252f9 100644 --- a/source/dnode/mnode/impl/src/mndStb.c +++ b/source/dnode/mnode/impl/src/mndStb.c @@ -1608,7 +1608,6 @@ static int32_t mndRetrieveStb(SNodeMsg *pReq, SShowObj *pShow, char *data, int32 SStbObj *pStb = NULL; int32_t cols = 0; char *pWrite; - char prefix[TSDB_DB_FNAME_LEN] = {0}; SDbObj* pDb = NULL; if (strlen(pShow->db) > 0) { diff --git a/source/libs/executor/inc/executil.h b/source/libs/executor/inc/executil.h index bcbfeb7015..5d5e0cae88 100644 --- a/source/libs/executor/inc/executil.h +++ b/source/libs/executor/inc/executil.h @@ -156,6 +156,8 @@ SArray* interResFromBinary(const char* data, int32_t len); void freeInterResult(void* param); void initGroupResInfo(SGroupResInfo* pGroupResInfo, SResultRowInfo* pResultInfo); +void initMultiResInfoFromArrayList(SGroupResInfo* pGroupResInfo, SArray* pArrayList); + void cleanupGroupResInfo(SGroupResInfo* pGroupResInfo); bool hasRemainDataInCurrentGroup(SGroupResInfo* pGroupResInfo); bool hasRemainData(SGroupResInfo* pGroupResInfo); diff --git a/source/libs/executor/src/executil.c b/source/libs/executor/src/executil.c index 2c6468a13f..9fb009c917 100644 --- a/source/libs/executor/src/executil.c +++ b/source/libs/executor/src/executil.c @@ -222,6 +222,16 @@ void initGroupResInfo(SGroupResInfo* pGroupResInfo, SResultRowInfo* pResultInfo) assert(pGroupResInfo->index <= getNumOfTotalRes(pGroupResInfo)); } +void initMultiResInfoFromArrayList(SGroupResInfo* pGroupResInfo, SArray* pArrayList) { + if (pGroupResInfo->pRows != NULL) { + taosArrayDestroy(pGroupResInfo->pRows); + } + + pGroupResInfo->pRows = pArrayList->pData; + pGroupResInfo->index = 0; + ASSERT(pGroupResInfo->index <= getNumOfTotalRes(pGroupResInfo)); +} + bool hasRemainDataInCurrentGroup(SGroupResInfo* pGroupResInfo) { if (pGroupResInfo->pRows == NULL) { return false; diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index 2df18f135c..f734c81858 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -5665,9 +5665,9 @@ static int32_t loadSysTableContentCb(void* param, const SDataBuf* pMsg, int32_t SRetrieveMetaTableRsp* pRsp = pScanResInfo->pRsp; pRsp->numOfRows = htonl(pRsp->numOfRows); - pRsp->useconds = htobe64(pRsp->useconds); - pRsp->handle = htobe64(pRsp->handle); - pRsp->compLen = htonl(pRsp->compLen); + pRsp->useconds = htobe64(pRsp->useconds); + pRsp->handle = htobe64(pRsp->handle); + pRsp->compLen = htonl(pRsp->compLen); } else { operator->pTaskInfo->code = code; } @@ -5824,6 +5824,10 @@ static SSDataBlock* doSysTableScan(SOperatorInfo* pOperator, bool* newgroup) { // pInfo->totalBytes; return (pInfo->pRes->info.rows == 0) ? NULL : pInfo->pRes; } else { // load the meta from mnode of the given epset + if (pOperator->status == OP_EXEC_DONE) { + return NULL; + } + int64_t startTs = taosGetTimestampUs(); pInfo->req.type = pInfo->type; @@ -5863,6 +5867,10 @@ static SSDataBlock* doSysTableScan(SOperatorInfo* pOperator, bool* newgroup) { SRetrieveMetaTableRsp* pRsp = pInfo->pRsp; pInfo->req.showId = pRsp->handle; + if (pRsp->numOfRows == 0 || pRsp->completed) { + pOperator->status = OP_EXEC_DONE; + } + if (pRsp->numOfRows == 0) { // qDebug("%s vgId:%d, taskID:0x%"PRIx64" %d of total completed, rowsOfSource:%"PRIu64", totalRows:%"PRIu64" // try next", @@ -6993,6 +7001,7 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo *pOperator, bool* newgroup finalizeUpdatedResult(pInfo->binfo.pCtx, pOperator->numOfOutput, pInfo->aggSup.pResultBuf, pUpdated, pInfo->binfo.rowCellInfoOffset); + initMultiResInfoFromArrayList(&pInfo->groupResInfo, pUpdated); blockDataEnsureCapacity(pInfo->binfo.pRes, pInfo->binfo.capacity); toSDatablock(&pInfo->groupResInfo, pInfo->aggSup.pResultBuf, pInfo->binfo.pRes, pInfo->binfo.capacity, pInfo->binfo.rowCellInfoOffset); @@ -8793,9 +8802,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo SSDataBlock* pResBlock = createOutputBuf_rv1(pScanPhyNode->node.pOutputDataBlockDesc); SArray* colList = extractScanColumnId(pScanPhyNode->pScanCols); - - SOperatorInfo* pOperator = - createStreamScanOperatorInfo(pHandle->reader, pResBlock, colList, tableIdList, pTaskInfo); + SOperatorInfo* pOperator = createStreamScanOperatorInfo(pHandle->reader, pResBlock, colList, tableIdList, pTaskInfo); taosArrayDestroy(tableIdList); return pOperator; } else if (QUERY_NODE_PHYSICAL_PLAN_SYSTABLE_SCAN == nodeType(pPhyNode)) { From 6fabf8e9b107a71719019ea9b922efd4d95f8997 Mon Sep 17 00:00:00 2001 From: afwerar <1296468573@qq.com> Date: Wed, 30 Mar 2022 10:53:13 +0800 Subject: [PATCH 05/49] [TD-13759]: add pthread func. --- include/os/osThread.h | 7 +++++++ include/os/osTime.h | 2 ++ source/os/src/osThread.c | 9 +++++++++ 3 files changed, 18 insertions(+) diff --git a/include/os/osThread.h b/include/os/osThread.h index 6d8ff1de3e..8a0ace3e77 100644 --- a/include/os/osThread.h +++ b/include/os/osThread.h @@ -32,6 +32,9 @@ typedef pthread_once_t TdThreadOnce; typedef pthread_rwlockattr_t TdThreadRwlockAttr; typedef pthread_cond_t TdThreadCond; typedef pthread_condattr_t TdThreadCondAttr; +typedef pthread_key_t TdThreadKey; +typedef pthread_barrier_t TdThreadBarrier; +typedef pthread_barrierattr_t TdThreadBarrierAttr; #define taosThreadCleanupPush pthread_cleanup_push #define taosThreadCleanupPop pthread_cleanup_pop @@ -79,6 +82,7 @@ typedef pthread_condattr_t TdThreadCondAttr; #define pthread_sigmask PTHREAD_SIGMASK_FUNC_TAOS_FORBID #define pthread_cancel PTHREAD_CANCEL_FUNC_TAOS_FORBID #define pthread_kill PTHREAD_KILL_FUNC_TAOS_FORBID + #define pthread_setname_np PTHREAD_SETNAME_FUNC_TAOS_FORBID #endif int32_t taosThreadSpinInit(TdThreadSpinlock *lock, int pshared); @@ -86,6 +90,7 @@ int32_t taosThreadMutexInit(TdThreadMutex *mutex, const TdThreadMutexAttr *attr) int32_t taosThreadSpinDestroy(TdThreadSpinlock *lock); int32_t taosThreadMutexDestroy(TdThreadMutex * mutex); int32_t taosThreadSpinLock(TdThreadSpinlock *lock); +int32_t taosThreadSpinTryLock(TdThreadSpinlock *lock); int32_t taosThreadMutexLock(TdThreadMutex *mutex); int32_t taosThreadRwlockRdlock(TdThreadRwlock *rwlock); int32_t taosThreadSpinUnlock(TdThreadSpinlock *lock); @@ -111,6 +116,8 @@ int32_t taosThreadEqual(TdThread t1, TdThread t2); int32_t taosThreadSigmask(int how, sigset_t const *set, sigset_t *oset); int32_t taosThreadCancel(TdThread thread); int32_t taosThreadKill(TdThread thread, int sig); +int32_t taosThreadDetach(TdThread thread); + #ifdef __cplusplus } #endif diff --git a/include/os/osTime.h b/include/os/osTime.h index 031b9d28f9..9e426455dc 100644 --- a/include/os/osTime.h +++ b/include/os/osTime.h @@ -20,6 +20,8 @@ extern "C" { #endif +#include + // If the error is in a third-party library, place this header file under the third-party library header file. // When you want to use this feature, you should find or add the same function in the following section. #ifndef ALLOW_FORBID_FUNC diff --git a/source/os/src/osThread.c b/source/os/src/osThread.c index 716080274b..386534500f 100644 --- a/source/os/src/osThread.c +++ b/source/os/src/osThread.c @@ -14,6 +14,7 @@ */ #define ALLOW_FORBID_FUNC +#include #include "os.h" // int32_t taosThreadSetnameNp(TdThread thread, const char *name) { @@ -40,6 +41,10 @@ int32_t taosThreadSpinLock(TdThreadSpinlock *lock) { return pthread_spin_lock(lock); } +int32_t taosThreadSpinTryLock(TdThreadSpinlock *lock) { + return pthread_spin_trylock(lock); +} + int32_t taosThreadMutexLock(TdThreadMutex *mutex) { return pthread_mutex_lock(mutex); } @@ -142,4 +147,8 @@ int32_t taosThreadCancel(TdThread thread) { int32_t taosThreadKill(TdThread thread, int sig) { return pthread_kill(thread, sig); +} + +int32_t taosThreadDetach(TdThread thread) { + return pthread_detach(thread); } \ No newline at end of file From a5121e0b5e54752e818a2fa62ed940ad13a67a15 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Wed, 30 Mar 2022 05:20:03 +0000 Subject: [PATCH 06/49] start new refact --- source/libs/tdb/src/db/tdbBtree.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/source/libs/tdb/src/db/tdbBtree.c b/source/libs/tdb/src/db/tdbBtree.c index b133e1fcbc..d3b9230293 100644 --- a/source/libs/tdb/src/db/tdbBtree.c +++ b/source/libs/tdb/src/db/tdbBtree.c @@ -40,7 +40,7 @@ struct SBTree { #define TDB_BTREE_PAGE_COMMON_HDR u8 flags; -#define TDB_BTREE_PAGE_GET_FLAGS(PAGE) (PAGE)->pData[0] +#define TDB_BTREE_PAGE_GET_FLAGS(PAGE) (PAGE)->pData[0] #define TDB_BTREE_PAGE_SET_FLAGS(PAGE, flags) ((PAGE)->pData[0] = (flags)) typedef struct __attribute__((__packed__)) { @@ -892,7 +892,7 @@ static int tdbBtreeBalance(SBTC *pBtc) { } #endif -#ifndef TDB_BTREE_CELL // ========================================================= +// TDB_BTREE_CELL ===================== static int tdbBtreeEncodePayload(SPage *pPage, u8 *pPayload, const void *pKey, int kLen, const void *pVal, int vLen, int *szPayload) { int nPayload; @@ -923,7 +923,6 @@ static int tdbBtreeEncodePayload(SPage *pPage, u8 *pPayload, const void *pKey, i return 0; } -// TODO: allow vLen = 0 static int tdbBtreeEncodeCell(SPage *pPage, const void *pKey, int kLen, const void *pVal, int vLen, SCell *pCell, int *szCell) { u8 flags; @@ -1079,8 +1078,7 @@ static int tdbBtreeCellSize(const SPage *pPage, SCell *pCell) { return szCell; } - -#endif +// TDB_BTREE_CELL int tdbBtcOpen(SBTC *pBtc, SBTree *pBt) { pBtc->pBt = pBt; From fa98cc768d81196a69f2e38fabf0fe1a301286ff Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Wed, 30 Mar 2022 05:36:34 +0000 Subject: [PATCH 07/49] refact --- source/libs/tdb/src/db/tdbBtree.c | 76 ++++++++++++------------------- 1 file changed, 28 insertions(+), 48 deletions(-) diff --git a/source/libs/tdb/src/db/tdbBtree.c b/source/libs/tdb/src/db/tdbBtree.c index d3b9230293..dc8518e80f 100644 --- a/source/libs/tdb/src/db/tdbBtree.c +++ b/source/libs/tdb/src/db/tdbBtree.c @@ -18,12 +18,6 @@ #define TDB_BTREE_ROOT 0x1 #define TDB_BTREE_LEAF 0x2 -#define TDB_BTREE_PAGE_IS_ROOT(flags) TDB_FLAG_HAS(flags, TDB_BTREE_ROOT) -#define TDB_BTREE_PAGE_IS_LEAF(flags) TDB_FLAG_HAS(flags, TDB_BTREE_LEAF) -#define TDB_BTREE_ASSERT_FLAG(flags) \ - ASSERT(TDB_FLAG_IS(flags, TDB_BTREE_ROOT) || TDB_FLAG_IS(flags, TDB_BTREE_LEAF) || \ - TDB_FLAG_IS(flags, TDB_BTREE_ROOT | TDB_BTREE_LEAF) || TDB_FLAG_IS(flags, 0)) - struct SBTree { SPgno root; int keyLen; @@ -42,6 +36,11 @@ struct SBTree { #define TDB_BTREE_PAGE_GET_FLAGS(PAGE) (PAGE)->pData[0] #define TDB_BTREE_PAGE_SET_FLAGS(PAGE, flags) ((PAGE)->pData[0] = (flags)) +#define TDB_BTREE_PAGE_IS_ROOT(PAGE) (TDB_BTREE_PAGE_GET_FLAGS(PAGE) & TDB_BTREE_ROOT) +#define TDB_BTREE_PAGE_IS_LEAF(PAGE) (TDB_BTREE_PAGE_GET_FLAGS(PAGE) & TDB_BTREE_LEAF) +#define TDB_BTREE_ASSERT_FLAG(flags) \ + ASSERT(TDB_FLAG_IS(flags, TDB_BTREE_ROOT) || TDB_FLAG_IS(flags, TDB_BTREE_LEAF) || \ + TDB_FLAG_IS(flags, TDB_BTREE_ROOT | TDB_BTREE_LEAF) || TDB_FLAG_IS(flags, 0)) typedef struct __attribute__((__packed__)) { TDB_BTREE_PAGE_COMMON_HDR @@ -325,8 +324,7 @@ static int tdbBtCursorMoveTo(SBTC *pBtc, const void *pKey, int kLen, int *pCRst) } // Move downward or break - u8 flags = TDB_BTREE_PAGE_GET_FLAGS(pPage); - u8 leaf = TDB_BTREE_PAGE_IS_LEAF(flags); + u8 leaf = TDB_BTREE_PAGE_IS_LEAF(pPage); if (leaf) { pBtc->idx = midx; *pCRst = c; @@ -416,7 +414,7 @@ static int tdbBtreeInitPage(SPage *pPage, void *arg) { pBt = (SBTree *)arg; flags = TDB_BTREE_PAGE_GET_FLAGS(pPage); - isLeaf = TDB_BTREE_PAGE_IS_LEAF(flags); + isLeaf = TDB_BTREE_PAGE_IS_LEAF(pPage); ASSERT(flags == TDB_BTREE_PAGE_GET_FLAGS(pPage)); @@ -442,15 +440,15 @@ static int tdbBtreeInitPage(SPage *pPage, void *arg) { static int tdbBtreeZeroPage(SPage *pPage, void *arg) { u8 flags; SBTree *pBt; - u8 isLeaf; + u8 leaf; flags = ((SBtreeInitPageArg *)arg)->flags; pBt = ((SBtreeInitPageArg *)arg)->pBt; - isLeaf = TDB_BTREE_PAGE_IS_LEAF(flags); + leaf = flags & TDB_BTREE_LEAF; - tdbPageZero(pPage, isLeaf ? sizeof(SLeafHdr) : sizeof(SIntHdr), tdbBtreeCellSize); + tdbPageZero(pPage, leaf ? sizeof(SLeafHdr) : sizeof(SIntHdr), tdbBtreeCellSize); - if (isLeaf) { + if (leaf) { SLeafHdr *pLeafHdr = (SLeafHdr *)(pPage->pData); pLeafHdr->flags = flags; @@ -495,7 +493,7 @@ static int tdbBtreeBalanceDeeper(SBTree *pBt, SPage *pRoot, SPage **ppChild) { pPager = pRoot->pPager; flags = TDB_BTREE_PAGE_GET_FLAGS(pRoot); - leaf = TDB_BTREE_PAGE_IS_LEAF(flags); + leaf = TDB_BTREE_PAGE_IS_LEAF(pRoot); // Allocate a new child page zArg.flags = TDB_FLAG_REMOVE(flags, TDB_BTREE_ROOT); @@ -561,7 +559,7 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx) { SPgno pgno; if (sIdx + i == nCells) { - ASSERT(!TDB_BTREE_PAGE_IS_LEAF(TDB_BTREE_PAGE_GET_FLAGS(pParent))); + ASSERT(!TDB_BTREE_PAGE_IS_LEAF(pParent)); pgno = ((SIntHdr *)(pParent->pData))->pgno; } else { pCell = tdbPageGetCell(pParent, sIdx + i); @@ -575,7 +573,7 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx) { } } // copy the parent key out if child pages are not leaf page - childNotLeaf = !TDB_BTREE_PAGE_IS_LEAF(TDB_BTREE_PAGE_GET_FLAGS(pOlds[0])); + childNotLeaf = !TDB_BTREE_PAGE_IS_LEAF(pOlds[0]); if (childNotLeaf) { for (int i = 0; i < nOlds; i++) { if (sIdx + i < TDB_PAGE_TOTAL_CELLS(pParent)) { @@ -849,9 +847,8 @@ static int tdbBtreeBalance(SBTC *pBtc) { for (;;) { iPage = pBtc->iPage; pPage = pBtc->pPage; - flags = TDB_BTREE_PAGE_GET_FLAGS(pPage); - leaf = TDB_BTREE_PAGE_IS_LEAF(flags); - root = TDB_BTREE_PAGE_IS_ROOT(flags); + leaf = TDB_BTREE_PAGE_IS_LEAF(pPage); + root = TDB_BTREE_PAGE_IS_ROOT(pPage); // when the page is not overflow and not too empty, the balance work // is finished. Just break out the balance loop. @@ -925,7 +922,6 @@ static int tdbBtreeEncodePayload(SPage *pPage, u8 *pPayload, const void *pKey, i static int tdbBtreeEncodeCell(SPage *pPage, const void *pKey, int kLen, const void *pVal, int vLen, SCell *pCell, int *szCell) { - u8 flags; u8 leaf; int nHeader; int nPayload; @@ -936,8 +932,7 @@ static int tdbBtreeEncodeCell(SPage *pPage, const void *pKey, int kLen, const vo nPayload = 0; nHeader = 0; - flags = TDB_BTREE_PAGE_GET_FLAGS(pPage); - leaf = TDB_BTREE_PAGE_IS_LEAF(flags); + leaf = TDB_BTREE_PAGE_IS_LEAF(pPage); // 1. Encode Header part /* Encode SPgno if interior page */ @@ -1000,14 +995,12 @@ static int tdbBtreeDecodePayload(SPage *pPage, const u8 *pPayload, SCellDecoder // TODO: here has problem static int tdbBtreeDecodeCell(SPage *pPage, const SCell *pCell, SCellDecoder *pDecoder) { - u8 flags; u8 leaf; int nHeader; int ret; nHeader = 0; - flags = TDB_BTREE_PAGE_GET_FLAGS(pPage); - leaf = TDB_BTREE_PAGE_IS_LEAF(flags); + leaf = TDB_BTREE_PAGE_IS_LEAF(pPage); // Clear the state of decoder pDecoder->kLen = -1; @@ -1047,16 +1040,14 @@ static int tdbBtreeDecodeCell(SPage *pPage, const SCell *pCell, SCellDecoder *pD } static int tdbBtreeCellSize(const SPage *pPage, SCell *pCell) { - u8 flags; - u8 isLeaf; + u8 leaf; int szCell; int kLen = 0, vLen = 0; - flags = TDB_BTREE_PAGE_GET_FLAGS(pPage); - isLeaf = TDB_BTREE_PAGE_IS_LEAF(flags); + leaf = TDB_BTREE_PAGE_IS_LEAF(pPage); szCell = 0; - if (!isLeaf) { + if (!leaf) { szCell += sizeof(SPgno); } @@ -1066,7 +1057,7 @@ static int tdbBtreeCellSize(const SPage *pPage, SCell *pCell) { kLen = pPage->kLen; } - if (isLeaf) { + if (leaf) { if (pPage->vLen == TDB_VARIANT_LEN) { szCell += tdbGetVarInt(pCell + szCell, &vLen); } else { @@ -1093,7 +1084,6 @@ int tdbBtcMoveToFirst(SBTC *pBtc) { int ret; SBTree *pBt; SPager *pPager; - u8 flags; SCell *pCell; SPgno pgno; @@ -1117,9 +1107,7 @@ int tdbBtcMoveToFirst(SBTC *pBtc) { // move downward for (;;) { - flags = TDB_BTREE_PAGE_GET_FLAGS(pBtc->pPage); - - if (TDB_BTREE_PAGE_IS_LEAF(flags)) break; + if (TDB_BTREE_PAGE_IS_LEAF(pBtc->pPage)) break; pCell = tdbPageGetCell(pBtc->pPage, 0); pgno = *(SPgno *)pCell; @@ -1140,7 +1128,6 @@ int tdbBtcMoveToLast(SBTC *pBtc) { int ret; SBTree *pBt; SPager *pPager; - u8 flags; SPgno pgno; pBt = pBtc->pBt; @@ -1162,9 +1149,7 @@ int tdbBtcMoveToLast(SBTC *pBtc) { // move downward for (;;) { - flags = TDB_BTREE_PAGE_GET_FLAGS(pBtc->pPage); - - if (TDB_BTREE_PAGE_IS_LEAF(flags)) { + if (TDB_BTREE_PAGE_IS_LEAF(pBtc->pPage)) { // TODO: handle empty case ASSERT(TDB_PAGE_TOTAL_CELLS(pBtc->pPage) > 0); pBtc->idx = TDB_PAGE_TOTAL_CELLS(pBtc->pPage) - 1; @@ -1233,9 +1218,8 @@ static int tdbBtcMoveToNext(SBTC *pBtc) { int nCells; SPgno pgno; SCell *pCell; - u8 flags; - ASSERT(TDB_BTREE_PAGE_IS_LEAF(TDB_BTREE_PAGE_GET_FLAGS(pBtc->pPage))); + ASSERT(TDB_BTREE_PAGE_IS_LEAF(pBtc->pPage)); if (pBtc->idx < 0) return -1; @@ -1278,8 +1262,7 @@ static int tdbBtcMoveToNext(SBTC *pBtc) { tdbBtcMoveDownward(pBtc, pgno); pBtc->idx = 0; - flags = TDB_BTREE_PAGE_GET_FLAGS(pBtc->pPage); - if (TDB_BTREE_PAGE_IS_LEAF(flags)) { + if (TDB_BTREE_PAGE_IS_LEAF(pBtc->pPage)) { break; } } @@ -1334,17 +1317,14 @@ typedef struct { SBtPageInfo btPageInfos[20]; void tdbBtPageInfo(SPage *pPage, int idx) { - u8 flags; SBtPageInfo *pBtPageInfo; pBtPageInfo = btPageInfos + idx; pBtPageInfo->pgno = TDB_PAGE_PGNO(pPage); - flags = TDB_BTREE_PAGE_GET_FLAGS(pPage); - - pBtPageInfo->root = TDB_BTREE_PAGE_IS_ROOT(flags); - pBtPageInfo->leaf = TDB_BTREE_PAGE_IS_LEAF(flags); + pBtPageInfo->root = TDB_BTREE_PAGE_IS_ROOT(pPage); + pBtPageInfo->leaf = TDB_BTREE_PAGE_IS_LEAF(pPage); pBtPageInfo->rChild = 0; if (!pBtPageInfo->leaf) { From d7a8b0933b9a5fbc74845b414a816da8fbdb142a Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Wed, 30 Mar 2022 06:17:49 +0000 Subject: [PATCH 08/49] refact encode cell --- source/libs/tdb/src/db/tdbBtree.c | 37 ++++++++++++++----------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/source/libs/tdb/src/db/tdbBtree.c b/source/libs/tdb/src/db/tdbBtree.c index dc8518e80f..0a411a3a7c 100644 --- a/source/libs/tdb/src/db/tdbBtree.c +++ b/source/libs/tdb/src/db/tdbBtree.c @@ -93,9 +93,9 @@ int tdbBtreeOpen(int keyLen, int valLen, SPager *pPager, FKeyComparator kcmpr, S } // pBt->keyLen - pBt->keyLen = keyLen; + pBt->keyLen = keyLen < 0 ? TDB_VARIANT_LEN : keyLen; // pBt->valLen - pBt->valLen = valLen; + pBt->valLen = valLen < 0 ? TDB_VARIANT_LEN : valLen; // pBt->pPager pBt->pPager = pPager; // pBt->kcmpr @@ -890,22 +890,16 @@ static int tdbBtreeBalance(SBTC *pBtc) { #endif // TDB_BTREE_CELL ===================== -static int tdbBtreeEncodePayload(SPage *pPage, u8 *pPayload, const void *pKey, int kLen, const void *pVal, int vLen, - int *szPayload) { +static int tdbBtreeEncodePayload(SPage *pPage, SCell *pCell, int nHeader, const void *pKey, int kLen, const void *pVal, + int vLen, int *szPayload) { int nPayload; - ASSERT(pKey != NULL); - - if (pVal == NULL) { - vLen = 0; - } - nPayload = kLen + vLen; - if (nPayload <= pPage->maxLocal) { - // General case without overflow - memcpy(pPayload, pKey, kLen); + if (nPayload + nHeader <= pPage->maxLocal) { + // no overflow page is needed + memcpy(pCell + nHeader, pKey, kLen); if (pVal) { - memcpy(pPayload + kLen, pVal, vLen); + memcpy(pCell + nHeader + kLen, pVal, vLen); } *szPayload = nPayload; @@ -929,6 +923,7 @@ static int tdbBtreeEncodeCell(SPage *pPage, const void *pKey, int kLen, const vo ASSERT(pPage->kLen == TDB_VARIANT_LEN || pPage->kLen == kLen); ASSERT(pPage->vLen == TDB_VARIANT_LEN || pPage->vLen == vLen); + ASSERT(pKey != NULL && kLen > 0); nPayload = 0; nHeader = 0; @@ -954,14 +949,16 @@ static int tdbBtreeEncodeCell(SPage *pPage, const void *pKey, int kLen, const vo } // 2. Encode payload part - if (leaf && vLen > 0) { - ret = tdbBtreeEncodePayload(pPage, pCell + nHeader, pKey, kLen, pVal, vLen, &nPayload); - } else { - ret = tdbBtreeEncodePayload(pPage, pCell + nHeader, pKey, kLen, NULL, 0, &nPayload); + if ((!leaf) || pPage->vLen == 0) { + pVal = NULL; + vLen = 0; } + + ret = tdbBtreeEncodePayload(pPage, pCell, nHeader, pKey, kLen, pVal, vLen, &nPayload); if (ret < 0) { - // TODO: handle error - return -1; + // TODO + ASSERT(0); + return 0; } *szCell = nHeader + nPayload; From 051438e6d403dfd553b317d59a54c622df53d06f Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Wed, 30 Mar 2022 06:36:55 +0000 Subject: [PATCH 09/49] refact btree encode and decode --- source/libs/tdb/src/db/tdbBtree.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/source/libs/tdb/src/db/tdbBtree.c b/source/libs/tdb/src/db/tdbBtree.c index 0a411a3a7c..61f01fd65a 100644 --- a/source/libs/tdb/src/db/tdbBtree.c +++ b/source/libs/tdb/src/db/tdbBtree.c @@ -62,7 +62,7 @@ typedef struct { int vLen; u8 *pVal; SPgno pgno; - u8 *pTmpSpace; + u8 *pBuf; } SCellDecoder; static int tdbBtCursorMoveTo(SBTC *pBtc, const void *pKey, int kLen, int *pCRst); @@ -965,24 +965,26 @@ static int tdbBtreeEncodeCell(SPage *pPage, const void *pKey, int kLen, const vo return 0; } -static int tdbBtreeDecodePayload(SPage *pPage, const u8 *pPayload, SCellDecoder *pDecoder) { +static int tdbBtreeDecodePayload(SPage *pPage, const SCell *pCell, int nHeader, SCellDecoder *pDecoder) { int nPayload; - ASSERT(pDecoder->pKey == NULL); - if (pDecoder->pVal) { - nPayload = pDecoder->kLen + pDecoder->vLen; - } else { + ASSERT(!TDB_BTREE_PAGE_IS_LEAF(pPage)); nPayload = pDecoder->kLen; + } else { + nPayload = pDecoder->kLen + pDecoder->vLen; } - if (nPayload <= pPage->maxLocal) { - // General case without overflow - pDecoder->pKey = (void *)pPayload; - if (!pDecoder->pVal) { - pDecoder->pVal = (void *)(pPayload + pDecoder->kLen); + if (nHeader + nPayload <= pPage->maxLocal) { + // no over flow case + pDecoder->pKey = pCell + nHeader; + if (pDecoder->pVal == NULL && pDecoder->vLen > 0) { + pDecoder->pVal = pCell + nHeader + pDecoder->kLen; } - } else { + return 0; + } + + { // TODO: handle overflow case ASSERT(0); } @@ -990,7 +992,6 @@ static int tdbBtreeDecodePayload(SPage *pPage, const u8 *pPayload, SCellDecoder return 0; } -// TODO: here has problem static int tdbBtreeDecodeCell(SPage *pPage, const SCell *pCell, SCellDecoder *pDecoder) { u8 leaf; int nHeader; @@ -1022,13 +1023,14 @@ static int tdbBtreeDecodeCell(SPage *pPage, const SCell *pCell, SCellDecoder *pD } if (pPage->vLen == TDB_VARIANT_LEN) { + ASSERT(leaf); nHeader += tdbGetVarInt(pCell + nHeader, &(pDecoder->vLen)); } else { pDecoder->vLen = pPage->vLen; } // 2. Decode payload part - ret = tdbBtreeDecodePayload(pPage, pCell + nHeader, pDecoder); + ret = tdbBtreeDecodePayload(pPage, pCell, nHeader, pDecoder); if (ret < 0) { return -1; } From afc75c81ea60f24ea4348f7c9f542738408656d2 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Wed, 30 Mar 2022 06:49:39 +0000 Subject: [PATCH 10/49] refact --- source/libs/tdb/src/db/tdbBtree.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/source/libs/tdb/src/db/tdbBtree.c b/source/libs/tdb/src/db/tdbBtree.c index 61f01fd65a..e22f8b8ba6 100644 --- a/source/libs/tdb/src/db/tdbBtree.c +++ b/source/libs/tdb/src/db/tdbBtree.c @@ -1056,17 +1056,24 @@ static int tdbBtreeCellSize(const SPage *pPage, SCell *pCell) { kLen = pPage->kLen; } - if (leaf) { - if (pPage->vLen == TDB_VARIANT_LEN) { - szCell += tdbGetVarInt(pCell + szCell, &vLen); - } else { - vLen = pPage->vLen; - } + if (pPage->vLen == TDB_VARIANT_LEN) { + ASSERT(leaf); + szCell += tdbGetVarInt(pCell + szCell, &vLen); + } else if (leaf) { + vLen = pPage->vLen; } szCell = szCell + kLen + vLen; - return szCell; + if (szCell <= pPage->maxLocal) { + return szCell; + } + + { + // TODO + ASSERT(0); + return 0; + } } // TDB_BTREE_CELL From c6c60e3e09877f232827032c09591949cdd1f5fb Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Wed, 30 Mar 2022 02:50:50 -0400 Subject: [PATCH 11/49] TD-14396 explain parser and planner implement --- include/common/ttokendef.h | 102 +- include/libs/nodes/nodes.h | 2 + include/libs/nodes/plannodes.h | 19 +- include/libs/nodes/querynodes.h | 14 + include/util/tdef.h | 8 + source/libs/nodes/src/nodesUtilFuncs.c | 4 + source/libs/parser/inc/parAst.h | 4 + source/libs/parser/inc/sql.y | 12 + source/libs/parser/src/parAstCreater.c | 27 + source/libs/parser/src/parTokenizer.c | 5 +- source/libs/parser/src/parTranslater.c | 32 +- source/libs/parser/src/sql.c | 3463 ++++++++++---------- source/libs/parser/test/parserAstTest.cpp | 13 + source/libs/planner/src/planLogicCreater.c | 3 + source/libs/planner/src/planPhysiCreater.c | 16 + source/libs/planner/test/plannerTest.cpp | 13 + 16 files changed, 1965 insertions(+), 1772 deletions(-) diff --git a/include/common/ttokendef.h b/include/common/ttokendef.h index 83de5b6918..73c15d508c 100644 --- a/include/common/ttokendef.h +++ b/include/common/ttokendef.h @@ -138,55 +138,59 @@ #define TK_INTERVAL 120 #define TK_TOPIC 121 #define TK_AS 122 -#define TK_NK_BOOL 123 -#define TK_NULL 124 -#define TK_NK_VARIABLE 125 -#define TK_NK_UNDERLINE 126 -#define TK_ROWTS 127 -#define TK_TBNAME 128 -#define TK_QSTARTTS 129 -#define TK_QENDTS 130 -#define TK_WSTARTTS 131 -#define TK_WENDTS 132 -#define TK_WDURATION 133 -#define TK_BETWEEN 134 -#define TK_IS 135 -#define TK_NK_LT 136 -#define TK_NK_GT 137 -#define TK_NK_LE 138 -#define TK_NK_GE 139 -#define TK_NK_NE 140 -#define TK_MATCH 141 -#define TK_NMATCH 142 -#define TK_IN 143 -#define TK_JOIN 144 -#define TK_INNER 145 -#define TK_SELECT 146 -#define TK_DISTINCT 147 -#define TK_WHERE 148 -#define TK_PARTITION 149 -#define TK_BY 150 -#define TK_SESSION 151 -#define TK_STATE_WINDOW 152 -#define TK_SLIDING 153 -#define TK_FILL 154 -#define TK_VALUE 155 -#define TK_NONE 156 -#define TK_PREV 157 -#define TK_LINEAR 158 -#define TK_NEXT 159 -#define TK_GROUP 160 -#define TK_HAVING 161 -#define TK_ORDER 162 -#define TK_SLIMIT 163 -#define TK_SOFFSET 164 -#define TK_LIMIT 165 -#define TK_OFFSET 166 -#define TK_ASC 167 -#define TK_DESC 168 -#define TK_NULLS 169 -#define TK_FIRST 170 -#define TK_LAST 171 +#define TK_EXPLAIN 123 +#define TK_ANALYZE 124 +#define TK_VERBOSE 125 +#define TK_NK_BOOL 126 +#define TK_RATIO 127 +#define TK_NULL 128 +#define TK_NK_VARIABLE 129 +#define TK_NK_UNDERLINE 130 +#define TK_ROWTS 131 +#define TK_TBNAME 132 +#define TK_QSTARTTS 133 +#define TK_QENDTS 134 +#define TK_WSTARTTS 135 +#define TK_WENDTS 136 +#define TK_WDURATION 137 +#define TK_BETWEEN 138 +#define TK_IS 139 +#define TK_NK_LT 140 +#define TK_NK_GT 141 +#define TK_NK_LE 142 +#define TK_NK_GE 143 +#define TK_NK_NE 144 +#define TK_MATCH 145 +#define TK_NMATCH 146 +#define TK_IN 147 +#define TK_JOIN 148 +#define TK_INNER 149 +#define TK_SELECT 150 +#define TK_DISTINCT 151 +#define TK_WHERE 152 +#define TK_PARTITION 153 +#define TK_BY 154 +#define TK_SESSION 155 +#define TK_STATE_WINDOW 156 +#define TK_SLIDING 157 +#define TK_FILL 158 +#define TK_VALUE 159 +#define TK_NONE 160 +#define TK_PREV 161 +#define TK_LINEAR 162 +#define TK_NEXT 163 +#define TK_GROUP 164 +#define TK_HAVING 165 +#define TK_ORDER 166 +#define TK_SLIMIT 167 +#define TK_SOFFSET 168 +#define TK_LIMIT 169 +#define TK_OFFSET 170 +#define TK_ASC 171 +#define TK_DESC 172 +#define TK_NULLS 173 +#define TK_FIRST 174 +#define TK_LAST 175 #define TK_NK_SPACE 300 #define TK_NK_COMMENT 301 diff --git a/include/libs/nodes/nodes.h b/include/libs/nodes/nodes.h index 411d34063c..83c0bccaaf 100644 --- a/include/libs/nodes/nodes.h +++ b/include/libs/nodes/nodes.h @@ -70,6 +70,7 @@ typedef enum ENodeType { QUERY_NODE_DATABASE_OPTIONS, QUERY_NODE_TABLE_OPTIONS, QUERY_NODE_INDEX_OPTIONS, + QUERY_NODE_EXPLAIN_OPTIONS, // Statement nodes are used in parser and planner module. QUERY_NODE_SET_OPERATOR, @@ -99,6 +100,7 @@ typedef enum ENodeType { QUERY_NODE_CREATE_TOPIC_STMT, QUERY_NODE_DROP_TOPIC_STMT, QUERY_NODE_ALTER_LOCAL_STMT, + QUERY_NODE_EXPLAIN_STMT, QUERY_NODE_SHOW_DATABASES_STMT, QUERY_NODE_SHOW_TABLES_STMT, QUERY_NODE_SHOW_STABLES_STMT, diff --git a/include/libs/nodes/plannodes.h b/include/libs/nodes/plannodes.h index a41f10068a..f41e049196 100644 --- a/include/libs/nodes/plannodes.h +++ b/include/libs/nodes/plannodes.h @@ -49,6 +49,7 @@ typedef struct SScanLogicNode { STimeWindow scanRange; SName tableName; bool showRewrite; + double ratio; } SScanLogicNode; typedef struct SJoinLogicNode { @@ -197,6 +198,7 @@ typedef struct STableScanPhysiNode { SScanPhysiNode scan; uint8_t scanFlag; // denotes reversed scan of data or not STimeWindow scanRange; + double ratio; } STableScanPhysiNode; typedef STableScanPhysiNode STableSeqScanPhysiNode; @@ -297,18 +299,23 @@ typedef struct SSubplan { SDataSinkNode* pDataSink; // data of the subplan flow into the datasink } SSubplan; -typedef enum EQueryMode { - QUERY_MODE_NORMAL = 1, - QUERY_MODE_EXPLAIN, - QUERY_MODE_EXPLAIN_AN -} EQueryMode; +typedef enum EExplainMode { + EXPLAIN_MODE_DISABLE = 1, + EXPLAIN_MODE_STATIC, + EXPLAIN_MODE_ANALYZE +} EExplainMode; + +typedef struct SExplainInfo { + EExplainMode mode; + bool verbose; +} SExplainInfo; typedef struct SQueryPlan { ENodeType type; uint64_t queryId; int32_t numOfSubplans; - SNodeList* pSubplans; // Element is SNodeListNode. The execution level of subplan, starting from 0. + SExplainInfo explainInfo; } SQueryPlan; #ifdef __cplusplus diff --git a/include/libs/nodes/querynodes.h b/include/libs/nodes/querynodes.h index 5dc2cd35b7..23a63c1a0b 100644 --- a/include/libs/nodes/querynodes.h +++ b/include/libs/nodes/querynodes.h @@ -131,6 +131,7 @@ typedef struct SRealTableNode { struct STableMeta* pMeta; SVgroupsInfo* pVgroupList; char useDbName[TSDB_DB_NAME_LEN]; + double ratio; } SRealTableNode; typedef struct STempTableNode { @@ -282,6 +283,19 @@ typedef struct SVnodeModifOpStmt { const char* sql; // current sql statement position } SVnodeModifOpStmt; +typedef struct SExplainOptions { + ENodeType type; + bool verbose; + double ratio; +} SExplainOptions; + +typedef struct SExplainStmt { + ENodeType type; + bool analyze; + SExplainOptions* pOptions; + SNode* pQuery; +} SExplainStmt; + void nodesWalkSelectStmt(SSelectStmt* pSelect, ESqlClause clause, FNodeWalker walker, void* pContext); void nodesRewriteSelectStmt(SSelectStmt* pSelect, ESqlClause clause, FNodeRewriter rewriter, void* pContext); diff --git a/include/util/tdef.h b/include/util/tdef.h index 193be4a3e6..43981adea2 100644 --- a/include/util/tdef.h +++ b/include/util/tdef.h @@ -381,6 +381,14 @@ typedef enum ELogicConditionType { #define TSDB_MAX_DB_DELAY 10 #define TSDB_DEFAULT_DB_DELAY 2 +#define TSDB_DEFAULT_EXPLAIN_VERBOSE false + +#define TSDB_MIN_EXPLAIN_RATIO 0 +#define TSDB_MAX_EXPLAIN_RATIO 1 +#define TSDB_DEFAULT_EXPLAIN_RATIO 0.001 + +#define TSDB_EXPLAIN_RESULT_ROW_SIZE 1024 + #define TSDB_MAX_JOIN_TABLE_NUM 10 #define TSDB_MAX_UNION_CLAUSE 5 diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index fdfef6434b..89b4476899 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -82,6 +82,8 @@ SNodeptr nodesMakeNode(ENodeType type) { return makeNode(type, sizeof(STableOptions)); case QUERY_NODE_INDEX_OPTIONS: return makeNode(type, sizeof(SIndexOptions)); + case QUERY_NODE_EXPLAIN_OPTIONS: + return makeNode(type, sizeof(SExplainOptions)); case QUERY_NODE_SET_OPERATOR: return makeNode(type, sizeof(SSetOperator)); case QUERY_NODE_SELECT_STMT: @@ -132,6 +134,8 @@ SNodeptr nodesMakeNode(ENodeType type) { return makeNode(type, sizeof(SCreateTopicStmt)); case QUERY_NODE_DROP_TOPIC_STMT: return makeNode(type, sizeof(SDropTopicStmt)); + case QUERY_NODE_EXPLAIN_STMT: + return makeNode(type, sizeof(SExplainStmt)); case QUERY_NODE_SHOW_DATABASES_STMT: case QUERY_NODE_SHOW_TABLES_STMT: case QUERY_NODE_SHOW_STABLES_STMT: diff --git a/source/libs/parser/inc/parAst.h b/source/libs/parser/inc/parAst.h index 0fe5df183d..029ae7e91f 100644 --- a/source/libs/parser/inc/parAst.h +++ b/source/libs/parser/inc/parAst.h @@ -159,6 +159,10 @@ SNode* createDropQnodeStmt(SAstCreateContext* pCxt, const SToken* pDnodeId); SNode* createCreateTopicStmt(SAstCreateContext* pCxt, bool ignoreExists, const SToken* pTopicName, SNode* pQuery, const SToken* pSubscribeDbName); SNode* createDropTopicStmt(SAstCreateContext* pCxt, bool ignoreNotExists, const SToken* pTopicName); SNode* createAlterLocalStmt(SAstCreateContext* pCxt, const SToken* pConfig, const SToken* pValue); +SNode* createDefaultExplainOptions(SAstCreateContext* pCxt); +SNode* setExplainVerbose(SAstCreateContext* pCxt, SNode* pOptions, const SToken* pVal); +SNode* setExplainRatio(SAstCreateContext* pCxt, SNode* pOptions, const SToken* pVal); +SNode* createExplainStmt(SAstCreateContext* pCxt, bool analyze, SNode* pOptions, SNode* pQuery); #ifdef __cplusplus } diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index 7556684e8b..5e2f8e4241 100644 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -339,6 +339,18 @@ cmd ::= CREATE TOPIC not_exists_opt(A) topic_name(B) AS query_expression(C). cmd ::= CREATE TOPIC not_exists_opt(A) topic_name(B) AS db_name(C). { pCxt->pRootNode = createCreateTopicStmt(pCxt, A, &B, NULL, &C); } cmd ::= DROP TOPIC exists_opt(A) topic_name(B). { pCxt->pRootNode = createDropTopicStmt(pCxt, A, &B); } +/************************************************ select **************************************************************/ +cmd ::= EXPLAIN analyze_opt(A) explain_options(B) query_expression(C). { pCxt->pRootNode = createExplainStmt(pCxt, A, B, C); } + +%type analyze_opt { bool } +%destructor analyze_opt { } +analyze_opt(A) ::= . { A = false; } +analyze_opt(A) ::= ANALYZE. { A = true; } + +explain_options(A) ::= . { A = createDefaultExplainOptions(pCxt); } +explain_options(A) ::= explain_options(B) VERBOSE NK_BOOL(C). { A = setExplainVerbose(pCxt, B, &C); } +explain_options(A) ::= explain_options(B) RATIO NK_FLOAT(C). { A = setExplainRatio(pCxt, B, &C); } + /************************************************ select **************************************************************/ cmd ::= query_expression(A). { pCxt->pRootNode = A; } diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c index fcabd4614c..8783872ad8 100644 --- a/source/libs/parser/src/parAstCreater.c +++ b/source/libs/parser/src/parAstCreater.c @@ -1316,3 +1316,30 @@ SNode* createAlterLocalStmt(SAstCreateContext* pCxt, const SToken* pConfig, cons } return (SNode*)pStmt; } + +SNode* createDefaultExplainOptions(SAstCreateContext* pCxt) { + SExplainOptions* pOptions = nodesMakeNode(QUERY_NODE_EXPLAIN_OPTIONS); + CHECK_OUT_OF_MEM(pOptions); + pOptions->verbose = TSDB_DEFAULT_EXPLAIN_VERBOSE; + pOptions->ratio = TSDB_DEFAULT_EXPLAIN_RATIO; + return (SNode*)pOptions; +} + +SNode* setExplainVerbose(SAstCreateContext* pCxt, SNode* pOptions, const SToken* pVal) { + ((SExplainOptions*)pOptions)->verbose = (0 == strncasecmp(pVal->z, "true", pVal->n)); + return pOptions; +} + +SNode* setExplainRatio(SAstCreateContext* pCxt, SNode* pOptions, const SToken* pVal) { + ((SExplainOptions*)pOptions)->ratio = strtod(pVal->z, NULL); + return pOptions; +} + +SNode* createExplainStmt(SAstCreateContext* pCxt, bool analyze, SNode* pOptions, SNode* pQuery) { + SExplainStmt* pStmt = nodesMakeNode(QUERY_NODE_EXPLAIN_STMT); + CHECK_OUT_OF_MEM(pStmt); + pStmt->analyze = analyze; + pStmt->pOptions = (SExplainOptions*)pOptions; + pStmt->pQuery = pQuery; + return (SNode*)pStmt; +} diff --git a/source/libs/parser/src/parTokenizer.c b/source/libs/parser/src/parTokenizer.c index 3751041ef7..213b14ae5d 100644 --- a/source/libs/parser/src/parTokenizer.c +++ b/source/libs/parser/src/parTokenizer.c @@ -31,6 +31,7 @@ static SKeyword keywordTable[] = { {"ACCOUNT", TK_ACCOUNT}, {"ALL", TK_ALL}, {"ALTER", TK_ALTER}, + {"ANALYZE", TK_ANALYZE}, {"AND", TK_AND}, {"AS", TK_AS}, {"ASC", TK_ASC}, @@ -56,6 +57,7 @@ static SKeyword keywordTable[] = { {"DOUBLE", TK_DOUBLE}, {"DROP", TK_DROP}, {"EXISTS", TK_EXISTS}, + {"EXPLAIN", TK_EXPLAIN}, {"FILE_FACTOR", TK_FILE_FACTOR}, {"FILL", TK_FILL}, {"FLOAT", TK_FLOAT}, @@ -110,6 +112,7 @@ static SKeyword keywordTable[] = { {"QNODES", TK_QNODES}, {"QSTARTTS", TK_QSTARTTS}, {"QUORUM", TK_QUORUM}, + {"RATIO", TK_RATIO}, {"REPLICA", TK_REPLICA}, {"RETENTIONS", TK_RETENTIONS}, {"ROLLUP", TK_ROLLUP}, @@ -144,6 +147,7 @@ static SKeyword keywordTable[] = { {"USING", TK_USING}, {"VALUES", TK_VALUES}, {"VARCHAR", TK_VARCHAR}, + {"VERBOSE", TK_VERBOSE}, {"VGROUPS", TK_VGROUPS}, {"WAL", TK_WAL}, {"WDURATION", TK_WDURATION}, @@ -224,7 +228,6 @@ static SKeyword keywordTable[] = { // {"DETACH", TK_DETACH}, // {"EACH", TK_EACH}, // {"END", TK_END}, - // {"EXPLAIN", TK_EXPLAIN}, // {"FAIL", TK_FAIL}, // {"FOR", TK_FOR}, // {"IGNORE", TK_IGNORE}, diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index e3fa2fc631..d453193d0f 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -32,6 +32,7 @@ typedef struct STranslateContext { SCmdMsgInfo* pCmdMsg; SHashObj* pDbs; SHashObj* pTables; + SExplainOptions* pExplainOpt; } STranslateContext; typedef struct SFullDatabaseName { @@ -673,6 +674,7 @@ static int32_t translateTable(STranslateContext* pCxt, SNode* pTable) { switch (nodeType(pTable)) { case QUERY_NODE_REAL_TABLE: { SRealTableNode* pRealTable = (SRealTableNode*)pTable; + pRealTable->ratio = (NULL != pCxt->pExplainOpt ? pCxt->pExplainOpt->ratio : 1.0); SName name; code = getTableMetaImpl(pCxt, toName(pCxt->pParseCxt->acctId, pRealTable->table.dbName, pRealTable->table.tableName, &name), &(pRealTable->pMeta)); @@ -680,10 +682,9 @@ static int32_t translateTable(STranslateContext* pCxt, SNode* pTable) { return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_TABLE_NOT_EXIST, pRealTable->table.tableName); } code = setTableVgroupList(pCxt, &name, pRealTable); - if (TSDB_CODE_SUCCESS != code) { - return code; + if (TSDB_CODE_SUCCESS == code) { + code = addNamespace(pCxt, pRealTable); } - code = addNamespace(pCxt, pRealTable); break; } case QUERY_NODE_TEMP_TABLE: { @@ -1804,6 +1805,13 @@ static int32_t translateAlterLocal(STranslateContext* pCxt, SAlterLocalStmt* pSt return TSDB_CODE_SUCCESS; } +static int32_t translateExplain(STranslateContext* pCxt, SExplainStmt* pStmt) { + if (pStmt->analyze) { + pCxt->pExplainOpt = pStmt->pOptions; + } + return translateQuery(pCxt, pStmt->pQuery); +} + static int32_t translateQuery(STranslateContext* pCxt, SNode* pNode) { int32_t code = TSDB_CODE_SUCCESS; switch (nodeType(pNode)) { @@ -1885,6 +1893,9 @@ static int32_t translateQuery(STranslateContext* pCxt, SNode* pNode) { case QUERY_NODE_ALTER_LOCAL_STMT: code = translateAlterLocal(pCxt, (SAlterLocalStmt*)pNode); break; + case QUERY_NODE_EXPLAIN_STMT: + code = translateExplain(pCxt, (SExplainStmt*)pNode); + break; default: break; } @@ -1903,7 +1914,11 @@ static int32_t translateSubquery(STranslateContext* pCxt, SNode* pNode) { } int32_t qExtractResultSchema(const SNode* pRoot, int32_t* numOfCols, SSchema** pSchema) { - if (NULL != pRoot && QUERY_NODE_SELECT_STMT == nodeType(pRoot)) { + if (NULL == pRoot) { + return TSDB_CODE_SUCCESS; + } + + if (QUERY_NODE_SELECT_STMT == nodeType(pRoot)) { SSelectStmt* pSelect = (SSelectStmt*) pRoot; *numOfCols = LIST_LENGTH(pSelect->pProjectionList); *pSchema = taosMemoryCalloc((*numOfCols), sizeof(SSchema)); @@ -1921,6 +1936,14 @@ int32_t qExtractResultSchema(const SNode* pRoot, int32_t* numOfCols, SSchema** p strcpy((*pSchema)[index].name, pExpr->aliasName); index +=1; } + } else if (QUERY_NODE_EXPLAIN_STMT == nodeType(pRoot)) { + *numOfCols = 1; + *pSchema = taosMemoryCalloc((*numOfCols), sizeof(SSchema)); + if (NULL == (*pSchema)) { + return TSDB_CODE_OUT_OF_MEMORY; + } + (*pSchema)[0].type = TSDB_DATA_TYPE_BINARY; + (*pSchema)[0].bytes = TSDB_EXPLAIN_RESULT_ROW_SIZE; } return TSDB_CODE_SUCCESS; @@ -2505,6 +2528,7 @@ static int32_t rewriteQuery(STranslateContext* pCxt, SQuery* pQuery) { static int32_t setQuery(STranslateContext* pCxt, SQuery* pQuery) { switch (nodeType(pQuery->pRoot)) { case QUERY_NODE_SELECT_STMT: + case QUERY_NODE_EXPLAIN_STMT: pQuery->haveResultSet = true; pQuery->directRpc = false; pQuery->msgType = TDMT_VND_QUERY; diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index ef2c547e44..154b87ba4b 100644 --- a/source/libs/parser/src/sql.c +++ b/source/libs/parser/src/sql.c @@ -100,24 +100,24 @@ #endif /************* Begin control #defines *****************************************/ #define YYCODETYPE unsigned short int -#define YYNOCODE 268 +#define YYNOCODE 274 #define YYACTIONTYPE unsigned short int #define ParseTOKENTYPE SToken typedef union { int yyinit; ParseTOKENTYPE yy0; - EOrder yy106; - EFillMode yy142; - SNode* yy176; - SToken yy225; - EJoinType yy236; - SAlterOption yy325; - EOperatorType yy404; - SDataType yy448; - ENullOrder yy465; - bool yy505; - int32_t yy508; - SNodeList* yy512; + SAlterOption yy29; + SNodeList* yy40; + ENullOrder yy177; + EOrder yy210; + EOperatorType yy328; + SNode* yy364; + EJoinType yy392; + SDataType yy420; + SToken yy437; + int32_t yy460; + EFillMode yy478; + bool yy493; } YYMINORTYPE; #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 @@ -132,17 +132,17 @@ typedef union { #define ParseCTX_PARAM #define ParseCTX_FETCH #define ParseCTX_STORE -#define YYNSTATE 432 -#define YYNRULE 348 -#define YYNTOKEN 172 -#define YY_MAX_SHIFT 431 -#define YY_MIN_SHIFTREDUCE 675 -#define YY_MAX_SHIFTREDUCE 1022 -#define YY_ERROR_ACTION 1023 -#define YY_ACCEPT_ACTION 1024 -#define YY_NO_ACTION 1025 -#define YY_MIN_REDUCE 1026 -#define YY_MAX_REDUCE 1373 +#define YYNSTATE 438 +#define YYNRULE 354 +#define YYNTOKEN 176 +#define YY_MAX_SHIFT 437 +#define YY_MIN_SHIFTREDUCE 684 +#define YY_MAX_SHIFTREDUCE 1037 +#define YY_ERROR_ACTION 1038 +#define YY_ACCEPT_ACTION 1039 +#define YY_NO_ACTION 1040 +#define YY_MIN_REDUCE 1041 +#define YY_MAX_REDUCE 1394 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -209,405 +209,408 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (1282) +#define YY_ACTTAB_COUNT (1305) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 1230, 43, 306, 1243, 1118, 350, 1226, 1233, 238, 1114, - /* 10 */ 89, 1205, 31, 29, 27, 26, 25, 1259, 1124, 24, - /* 20 */ 170, 1352, 226, 1259, 347, 31, 29, 27, 26, 25, - /* 30 */ 347, 363, 363, 251, 1351, 362, 66, 270, 1350, 1230, - /* 40 */ 349, 1243, 307, 280, 1217, 1226, 1232, 212, 1069, 335, - /* 50 */ 321, 362, 1129, 1129, 61, 1244, 1245, 1248, 1291, 210, - /* 60 */ 212, 1259, 211, 1287, 246, 363, 1065, 1352, 347, 898, - /* 70 */ 1126, 1196, 1198, 239, 1352, 106, 1096, 928, 349, 350, - /* 80 */ 117, 104, 1217, 12, 1350, 1206, 1129, 117, 293, 1131, - /* 90 */ 928, 1350, 107, 1244, 1245, 1248, 1027, 416, 415, 414, - /* 100 */ 413, 412, 411, 410, 409, 408, 407, 406, 405, 404, - /* 110 */ 403, 402, 401, 400, 399, 189, 929, 77, 1159, 1120, - /* 120 */ 76, 75, 74, 73, 72, 71, 70, 69, 68, 929, - /* 130 */ 336, 1365, 424, 423, 23, 233, 923, 924, 925, 926, - /* 140 */ 927, 931, 932, 933, 27, 26, 25, 23, 233, 923, - /* 150 */ 924, 925, 926, 927, 931, 932, 933, 9, 8, 1243, - /* 160 */ 1217, 784, 386, 385, 384, 788, 383, 790, 791, 382, - /* 170 */ 793, 379, 883, 799, 376, 801, 802, 373, 370, 1259, - /* 180 */ 30, 28, 105, 1176, 1038, 243, 334, 1049, 235, 225, - /* 190 */ 863, 30, 28, 965, 1174, 271, 349, 362, 1259, 235, - /* 200 */ 1217, 863, 1230, 1243, 885, 347, 861, 1107, 1226, 1232, - /* 210 */ 62, 1244, 1245, 1248, 1291, 11, 363, 861, 228, 1287, - /* 220 */ 112, 360, 712, 1259, 711, 941, 11, 339, 1217, 1105, - /* 230 */ 347, 324, 166, 30, 28, 1024, 1, 1129, 313, 1318, - /* 240 */ 349, 235, 713, 863, 1217, 12, 320, 1, 31, 29, - /* 250 */ 27, 26, 25, 271, 62, 1244, 1245, 1248, 1291, 861, - /* 260 */ 428, 338, 228, 1287, 1364, 1310, 960, 1048, 11, 363, - /* 270 */ 930, 428, 862, 1325, 66, 398, 1176, 326, 322, 1243, - /* 280 */ 1047, 286, 240, 862, 250, 242, 241, 1174, 21, 1, - /* 290 */ 1129, 864, 867, 868, 201, 876, 911, 934, 118, 1259, - /* 300 */ 325, 109, 864, 867, 868, 201, 334, 911, 1217, 1352, - /* 310 */ 340, 869, 1169, 428, 118, 1243, 349, 1046, 1176, 1045, - /* 320 */ 1217, 1217, 117, 118, 247, 862, 1350, 259, 1060, 1174, - /* 330 */ 62, 1244, 1245, 1248, 1291, 1259, 363, 1305, 228, 1287, - /* 340 */ 112, 361, 347, 363, 864, 867, 868, 201, 184, 911, - /* 350 */ 295, 1243, 349, 30, 28, 1302, 1217, 1129, 1217, 1319, - /* 360 */ 1217, 235, 1305, 863, 1129, 364, 62, 1244, 1245, 1248, - /* 370 */ 1291, 1259, 122, 121, 228, 1287, 1364, 872, 347, 861, - /* 380 */ 1301, 30, 28, 348, 972, 1348, 1044, 389, 349, 235, - /* 390 */ 885, 863, 1217, 118, 363, 331, 877, 880, 868, 249, - /* 400 */ 1043, 1042, 62, 1244, 1245, 1248, 1291, 861, 1041, 7, - /* 410 */ 228, 1287, 1364, 964, 245, 1129, 92, 886, 30, 28, - /* 420 */ 337, 1309, 104, 398, 30, 28, 235, 1217, 863, 59, - /* 430 */ 1131, 1243, 235, 428, 863, 1040, 1176, 7, 1037, 93, - /* 440 */ 248, 1217, 1217, 90, 861, 862, 1121, 1197, 104, 1217, - /* 450 */ 861, 1259, 333, 113, 1298, 1299, 1131, 1303, 347, 1036, - /* 460 */ 1035, 428, 884, 1193, 864, 867, 868, 201, 349, 911, - /* 470 */ 120, 1034, 1217, 862, 7, 887, 1217, 335, 1176, 1217, - /* 480 */ 1, 1033, 202, 1244, 1245, 1248, 284, 118, 297, 1175, - /* 490 */ 283, 1116, 864, 867, 868, 201, 43, 911, 428, 1112, - /* 500 */ 1217, 1217, 1352, 305, 428, 1032, 1243, 1106, 1031, 1030, - /* 510 */ 862, 285, 1217, 1125, 1029, 117, 862, 145, 888, 1350, - /* 520 */ 300, 1305, 1217, 9, 8, 294, 1259, 52, 144, 864, - /* 530 */ 867, 868, 201, 347, 911, 864, 867, 868, 201, 1300, - /* 540 */ 911, 989, 1243, 349, 1122, 104, 1217, 1217, 6, 1217, - /* 550 */ 1217, 40, 342, 1132, 39, 1217, 963, 63, 1244, 1245, - /* 560 */ 1248, 1291, 1259, 331, 395, 1290, 1287, 304, 394, 347, - /* 570 */ 863, 388, 317, 987, 988, 990, 991, 165, 1243, 349, - /* 580 */ 302, 871, 137, 1217, 92, 135, 861, 194, 139, 396, - /* 590 */ 1039, 138, 196, 63, 1244, 1245, 1248, 1291, 1259, 318, - /* 600 */ 711, 345, 1287, 335, 195, 347, 309, 1243, 393, 392, - /* 610 */ 391, 90, 390, 1058, 123, 349, 278, 346, 98, 1217, - /* 620 */ 151, 163, 1298, 330, 1104, 329, 1243, 1259, 1352, 63, - /* 630 */ 1244, 1245, 1248, 1291, 347, 298, 141, 343, 1288, 140, - /* 640 */ 428, 117, 986, 156, 349, 1350, 1259, 874, 1217, 1243, - /* 650 */ 960, 234, 862, 347, 41, 154, 1021, 1022, 206, 1244, - /* 660 */ 1245, 1248, 143, 349, 58, 142, 1097, 1217, 1243, 1259, - /* 670 */ 314, 864, 867, 868, 54, 64, 347, 206, 1244, 1245, - /* 680 */ 1248, 395, 870, 1170, 935, 394, 349, 895, 1259, 167, - /* 690 */ 1217, 160, 277, 1321, 920, 347, 32, 883, 1237, 32, - /* 700 */ 205, 1244, 1245, 1248, 252, 349, 396, 264, 1243, 1217, - /* 710 */ 1235, 856, 175, 1243, 332, 118, 265, 169, 355, 107, - /* 720 */ 1244, 1245, 1248, 32, 173, 393, 392, 391, 1259, 390, - /* 730 */ 95, 1260, 327, 1259, 2, 347, 883, 1195, 119, 253, - /* 740 */ 347, 181, 261, 260, 266, 349, 891, 262, 873, 1217, - /* 750 */ 349, 777, 232, 96, 1217, 1072, 268, 236, 1366, 206, - /* 760 */ 1244, 1245, 1248, 98, 206, 1244, 1245, 1248, 1026, 267, - /* 770 */ 124, 77, 890, 772, 76, 75, 74, 73, 72, 71, - /* 780 */ 70, 69, 68, 127, 263, 41, 42, 258, 257, 256, - /* 790 */ 255, 254, 86, 85, 84, 83, 82, 81, 80, 79, - /* 800 */ 78, 431, 1243, 272, 292, 269, 287, 1243, 130, 291, - /* 810 */ 889, 805, 290, 279, 288, 187, 281, 289, 88, 87, - /* 820 */ 809, 308, 1259, 368, 420, 224, 186, 1259, 292, 347, - /* 830 */ 287, 310, 96, 291, 347, 815, 290, 1243, 288, 349, - /* 840 */ 1119, 289, 134, 1217, 349, 1243, 1115, 97, 1217, 60, - /* 850 */ 814, 136, 182, 204, 1244, 1245, 1248, 1259, 207, 1244, - /* 860 */ 1245, 1248, 98, 99, 347, 1259, 31, 29, 27, 26, - /* 870 */ 25, 100, 347, 101, 349, 96, 1117, 146, 1217, 1113, - /* 880 */ 102, 1243, 349, 359, 103, 149, 1217, 311, 199, 1244, - /* 890 */ 1245, 1248, 888, 1322, 319, 1332, 208, 1244, 1245, 1248, - /* 900 */ 312, 1259, 353, 147, 1243, 152, 316, 227, 347, 1243, - /* 910 */ 31, 29, 27, 26, 25, 1331, 868, 155, 349, 323, - /* 920 */ 5, 328, 1217, 898, 1259, 315, 1312, 159, 4, 1259, - /* 930 */ 110, 347, 200, 1244, 1245, 1248, 347, 960, 91, 887, - /* 940 */ 33, 349, 161, 1306, 1243, 1217, 349, 162, 344, 341, - /* 950 */ 1217, 17, 1243, 229, 1367, 209, 1244, 1245, 1248, 331, - /* 960 */ 1256, 1244, 1245, 1248, 1259, 1273, 356, 357, 179, 1349, - /* 970 */ 168, 347, 1259, 1204, 1243, 1203, 351, 177, 352, 347, - /* 980 */ 92, 349, 51, 237, 358, 1217, 188, 1130, 53, 349, - /* 990 */ 190, 366, 185, 1217, 1259, 1255, 1244, 1245, 1248, 427, - /* 1000 */ 197, 347, 1243, 1254, 1244, 1245, 1248, 90, 198, 193, - /* 1010 */ 1243, 349, 192, 1211, 839, 1217, 1188, 114, 1298, 1299, - /* 1020 */ 94, 1303, 1259, 1187, 1186, 215, 1244, 1245, 1248, 347, - /* 1030 */ 1259, 1185, 1243, 1184, 1183, 1182, 1181, 347, 126, 349, - /* 1040 */ 1243, 841, 1180, 1217, 1179, 1178, 1177, 349, 1071, 1210, - /* 1050 */ 1201, 1217, 1259, 214, 1244, 1245, 1248, 1108, 724, 347, - /* 1060 */ 1259, 216, 1244, 1245, 1248, 1018, 1019, 347, 1070, 349, - /* 1070 */ 1068, 132, 275, 1217, 111, 219, 1057, 349, 331, 273, - /* 1080 */ 276, 1217, 131, 213, 1244, 1245, 1248, 274, 1056, 1053, - /* 1090 */ 1110, 203, 1244, 1245, 1248, 67, 133, 284, 822, 92, - /* 1100 */ 821, 283, 820, 1109, 752, 44, 1066, 751, 129, 750, - /* 1110 */ 749, 220, 748, 218, 217, 747, 282, 20, 221, 1061, - /* 1120 */ 222, 296, 285, 1059, 223, 299, 90, 31, 29, 27, - /* 1130 */ 26, 25, 22, 1052, 301, 1051, 115, 1298, 1299, 303, - /* 1140 */ 1303, 65, 31, 29, 27, 26, 25, 910, 1209, 912, - /* 1150 */ 913, 914, 915, 916, 1208, 128, 1200, 148, 14, 125, - /* 1160 */ 45, 36, 3, 153, 150, 32, 37, 158, 985, 108, - /* 1170 */ 34, 1235, 157, 164, 979, 46, 19, 978, 47, 48, - /* 1180 */ 15, 35, 957, 1007, 1006, 956, 8, 1012, 230, 116, - /* 1190 */ 1011, 1010, 16, 10, 896, 231, 13, 921, 172, 18, - /* 1200 */ 171, 983, 174, 354, 176, 49, 1199, 178, 50, 878, - /* 1210 */ 38, 367, 244, 806, 180, 369, 54, 371, 803, 1234, - /* 1220 */ 800, 183, 365, 372, 374, 783, 375, 377, 794, 378, - /* 1230 */ 380, 792, 817, 381, 813, 812, 811, 55, 722, 56, - /* 1240 */ 57, 744, 397, 743, 736, 742, 741, 740, 739, 738, - /* 1250 */ 387, 737, 1067, 735, 798, 734, 733, 797, 732, 731, - /* 1260 */ 796, 795, 730, 729, 728, 727, 417, 418, 1055, 1054, - /* 1270 */ 421, 422, 419, 1050, 816, 425, 426, 1025, 865, 191, - /* 1280 */ 429, 430, + /* 0 */ 1251, 337, 24, 172, 356, 356, 256, 241, 1247, 1254, + /* 10 */ 1220, 1221, 31, 29, 27, 26, 25, 1264, 369, 369, + /* 20 */ 9, 8, 93, 67, 67, 31, 29, 27, 26, 25, + /* 30 */ 286, 292, 337, 1373, 106, 60, 1053, 1280, 369, 1144, + /* 40 */ 1144, 341, 1135, 276, 353, 94, 118, 215, 1084, 249, + /* 50 */ 1371, 91, 1136, 93, 355, 979, 1211, 1213, 1238, 1144, + /* 60 */ 215, 165, 1319, 336, 110, 335, 1087, 44, 1373, 913, + /* 70 */ 63, 1265, 1266, 1269, 1312, 1184, 90, 943, 231, 1308, + /* 80 */ 1385, 118, 91, 1238, 1139, 1371, 107, 1111, 956, 1346, + /* 90 */ 943, 339, 114, 1319, 1320, 257, 1324, 422, 421, 420, + /* 100 */ 419, 418, 417, 416, 415, 414, 413, 412, 411, 410, + /* 110 */ 409, 408, 407, 406, 405, 298, 944, 293, 105, 242, + /* 120 */ 297, 213, 898, 296, 368, 294, 1147, 105, 295, 944, + /* 130 */ 31, 29, 27, 26, 25, 1146, 368, 1122, 23, 236, + /* 140 */ 938, 939, 940, 941, 942, 946, 947, 948, 27, 26, + /* 150 */ 25, 23, 236, 938, 939, 940, 941, 942, 946, 947, + /* 160 */ 948, 793, 392, 391, 390, 797, 389, 799, 800, 388, + /* 170 */ 802, 385, 1264, 808, 382, 810, 811, 379, 376, 229, + /* 180 */ 30, 28, 337, 277, 12, 30, 28, 980, 238, 277, + /* 190 */ 878, 246, 1280, 238, 1264, 878, 1251, 310, 255, 353, + /* 200 */ 254, 1191, 978, 93, 1247, 1253, 876, 228, 1251, 355, + /* 210 */ 308, 876, 1189, 1238, 1280, 11, 1247, 1253, 341, 369, + /* 220 */ 11, 340, 248, 119, 1141, 62, 1265, 1266, 1269, 1312, + /* 230 */ 105, 355, 91, 214, 1308, 1238, 1, 265, 1146, 1120, + /* 240 */ 1144, 1, 115, 1319, 1320, 1373, 1324, 63, 1265, 1266, + /* 250 */ 1269, 1312, 119, 1191, 720, 231, 1308, 113, 118, 243, + /* 260 */ 434, 6, 1371, 902, 1189, 434, 119, 430, 429, 168, + /* 270 */ 284, 312, 877, 1280, 1280, 319, 1339, 877, 30, 28, + /* 280 */ 353, 353, 124, 123, 222, 404, 238, 1264, 878, 1033, + /* 290 */ 1034, 326, 1331, 975, 879, 53, 882, 883, 204, 879, + /* 300 */ 926, 882, 883, 204, 876, 926, 290, 1280, 327, 330, + /* 310 */ 289, 313, 1137, 11, 340, 721, 1373, 720, 119, 1264, + /* 320 */ 223, 1191, 221, 220, 355, 288, 332, 328, 1238, 1372, + /* 330 */ 1064, 291, 1212, 1371, 1, 722, 119, 368, 1373, 1280, + /* 340 */ 63, 1265, 1266, 1269, 1312, 404, 353, 369, 231, 1308, + /* 350 */ 113, 118, 366, 30, 28, 1371, 355, 369, 434, 900, + /* 360 */ 1238, 238, 367, 878, 395, 167, 1264, 975, 1144, 1340, + /* 370 */ 877, 1238, 63, 1265, 1266, 1269, 1312, 1191, 1144, 876, + /* 380 */ 231, 1308, 1385, 250, 1063, 12, 1280, 192, 1189, 331, + /* 390 */ 1174, 1369, 879, 353, 882, 883, 204, 337, 926, 139, + /* 400 */ 251, 1062, 137, 355, 30, 28, 354, 1238, 105, 7, + /* 410 */ 369, 303, 238, 348, 878, 186, 1146, 44, 93, 63, + /* 420 */ 1265, 1266, 1269, 1312, 1061, 1238, 311, 231, 1308, 1385, + /* 430 */ 876, 1144, 945, 434, 1140, 987, 30, 28, 1330, 345, + /* 440 */ 147, 900, 1238, 306, 238, 877, 878, 91, 300, 1060, + /* 450 */ 1326, 146, 1264, 1059, 21, 1191, 901, 116, 1319, 1320, + /* 460 */ 7, 1324, 876, 949, 899, 1238, 1190, 879, 1323, 882, + /* 470 */ 883, 204, 1280, 926, 41, 30, 28, 40, 1004, 353, + /* 480 */ 1121, 1326, 369, 238, 434, 878, 1058, 252, 1208, 355, + /* 490 */ 1238, 119, 7, 1238, 1238, 122, 877, 1039, 341, 1322, + /* 500 */ 344, 876, 349, 1144, 1057, 205, 1265, 1266, 1269, 323, + /* 510 */ 1002, 1003, 1005, 1006, 1326, 290, 434, 1056, 879, 289, + /* 520 */ 882, 883, 204, 1055, 926, 1373, 346, 1238, 877, 898, + /* 530 */ 1052, 1, 1321, 9, 8, 903, 258, 401, 118, 270, + /* 540 */ 291, 400, 1371, 1264, 141, 1238, 253, 140, 271, 1133, + /* 550 */ 879, 352, 882, 883, 204, 434, 926, 143, 1238, 886, + /* 560 */ 142, 1051, 402, 1280, 1238, 20, 1050, 877, 1049, 1112, + /* 570 */ 353, 1238, 1129, 1373, 1264, 31, 29, 27, 26, 25, + /* 580 */ 355, 399, 398, 397, 1238, 396, 118, 1036, 1037, 879, + /* 590 */ 1371, 882, 883, 204, 1280, 926, 64, 1265, 1266, 1269, + /* 600 */ 1312, 353, 1238, 145, 1311, 1308, 144, 1238, 1131, 1238, + /* 610 */ 1048, 355, 1047, 1264, 315, 1238, 269, 1046, 1264, 264, + /* 620 */ 263, 262, 261, 260, 1045, 889, 99, 64, 1265, 1266, + /* 630 */ 1269, 1312, 935, 1280, 1001, 351, 1308, 153, 1280, 298, + /* 640 */ 353, 293, 1080, 1127, 297, 353, 42, 296, 1075, 294, + /* 650 */ 355, 1238, 295, 1238, 1238, 355, 1264, 1119, 1238, 1238, + /* 660 */ 1042, 885, 1044, 343, 299, 1238, 108, 1265, 1266, 1269, + /* 670 */ 301, 64, 1265, 1266, 1269, 1312, 1280, 169, 394, 1054, + /* 680 */ 1309, 78, 158, 353, 77, 76, 75, 74, 73, 72, + /* 690 */ 71, 70, 69, 355, 156, 324, 1264, 1238, 1073, 878, + /* 700 */ 237, 1264, 1185, 1238, 342, 1386, 162, 950, 283, 209, + /* 710 */ 1265, 1266, 1269, 1258, 401, 876, 1280, 1342, 400, 32, + /* 720 */ 304, 1280, 910, 353, 865, 1256, 338, 888, 353, 1281, + /* 730 */ 171, 871, 177, 355, 32, 361, 32, 1238, 355, 402, + /* 740 */ 320, 183, 1238, 1264, 175, 2, 190, 96, 898, 209, + /* 750 */ 1265, 1266, 1269, 97, 208, 1265, 1266, 1269, 399, 398, + /* 760 */ 397, 1210, 396, 1280, 121, 22, 259, 267, 266, 434, + /* 770 */ 353, 786, 268, 1264, 272, 31, 29, 27, 26, 25, + /* 780 */ 355, 877, 781, 99, 1238, 906, 333, 126, 31, 29, + /* 790 */ 27, 26, 25, 1280, 42, 1264, 108, 1265, 1266, 1269, + /* 800 */ 353, 273, 274, 879, 814, 882, 883, 818, 905, 824, + /* 810 */ 355, 823, 100, 129, 1238, 1280, 374, 235, 275, 97, + /* 820 */ 437, 98, 353, 99, 97, 278, 209, 1265, 1266, 1269, + /* 830 */ 43, 132, 355, 904, 189, 1387, 1238, 89, 287, 239, + /* 840 */ 285, 314, 227, 426, 317, 188, 59, 88, 209, 1265, + /* 850 */ 1266, 1269, 1041, 1134, 78, 136, 55, 77, 76, 75, + /* 860 */ 74, 73, 72, 71, 70, 69, 1130, 138, 61, 101, + /* 870 */ 1264, 184, 102, 1132, 1128, 103, 87, 86, 85, 84, + /* 880 */ 83, 82, 81, 80, 79, 104, 316, 148, 151, 925, + /* 890 */ 1280, 927, 928, 929, 930, 931, 903, 353, 1353, 325, + /* 900 */ 197, 1264, 365, 359, 154, 199, 883, 355, 322, 1343, + /* 910 */ 157, 1238, 1352, 230, 329, 5, 161, 198, 334, 318, + /* 920 */ 321, 1280, 149, 207, 1265, 1266, 1269, 125, 353, 975, + /* 930 */ 1333, 1264, 31, 29, 27, 26, 25, 111, 355, 4, + /* 940 */ 163, 902, 1238, 92, 1327, 33, 232, 17, 164, 347, + /* 950 */ 350, 1280, 1388, 1264, 210, 1265, 1266, 1269, 353, 1294, + /* 960 */ 1370, 362, 170, 179, 191, 1219, 1218, 357, 355, 358, + /* 970 */ 364, 240, 1238, 1280, 363, 1264, 181, 52, 1145, 54, + /* 980 */ 353, 372, 193, 187, 202, 1265, 1266, 1269, 65, 913, + /* 990 */ 355, 433, 195, 39, 1238, 1280, 200, 1264, 201, 196, + /* 1000 */ 1232, 874, 353, 873, 1226, 120, 211, 1265, 1266, 1269, + /* 1010 */ 848, 1203, 355, 1202, 95, 1201, 1238, 1280, 1200, 1264, + /* 1020 */ 1199, 1198, 1197, 1196, 353, 850, 1195, 1194, 203, 1265, + /* 1030 */ 1266, 1269, 119, 1193, 355, 1192, 1086, 1225, 1238, 1280, + /* 1040 */ 1216, 1264, 128, 1123, 733, 1085, 353, 1083, 279, 281, + /* 1050 */ 212, 1265, 1266, 1269, 1072, 280, 355, 1071, 1068, 1125, + /* 1060 */ 1238, 1280, 68, 1264, 135, 1124, 831, 830, 353, 761, + /* 1070 */ 829, 1081, 1277, 1265, 1266, 1269, 760, 759, 355, 758, + /* 1080 */ 757, 1076, 1238, 1280, 756, 224, 225, 1264, 302, 1074, + /* 1090 */ 353, 226, 1067, 305, 1276, 1265, 1266, 1269, 307, 1066, + /* 1100 */ 355, 309, 66, 1224, 1238, 1223, 36, 1280, 152, 150, + /* 1110 */ 14, 1264, 1215, 3, 353, 32, 1275, 1265, 1266, 1269, + /* 1120 */ 245, 244, 155, 15, 355, 37, 34, 10, 1238, 46, + /* 1130 */ 891, 1280, 160, 1264, 49, 1022, 1000, 994, 353, 993, + /* 1140 */ 218, 1265, 1266, 1269, 972, 109, 884, 1021, 355, 233, + /* 1150 */ 8, 159, 1238, 1280, 47, 1264, 48, 1026, 1256, 971, + /* 1160 */ 353, 19, 1025, 1027, 217, 1265, 1266, 1269, 35, 234, + /* 1170 */ 355, 166, 13, 117, 1238, 1280, 16, 1264, 936, 911, + /* 1180 */ 173, 18, 353, 174, 998, 176, 219, 1265, 1266, 1269, + /* 1190 */ 178, 50, 355, 360, 1214, 180, 1238, 1280, 55, 893, + /* 1200 */ 370, 182, 51, 38, 353, 1255, 185, 371, 216, 1265, + /* 1210 */ 1266, 1269, 887, 815, 355, 375, 134, 373, 1238, 112, + /* 1220 */ 247, 807, 812, 377, 378, 282, 809, 133, 380, 381, + /* 1230 */ 206, 1265, 1266, 1269, 892, 803, 895, 883, 383, 384, + /* 1240 */ 386, 801, 387, 806, 805, 804, 792, 393, 56, 826, + /* 1250 */ 45, 822, 57, 131, 58, 821, 820, 731, 825, 403, + /* 1260 */ 753, 752, 745, 751, 750, 749, 748, 747, 746, 744, + /* 1270 */ 743, 742, 1082, 741, 740, 739, 1070, 738, 1069, 737, + /* 1280 */ 736, 423, 424, 427, 428, 1065, 431, 425, 432, 1040, + /* 1290 */ 880, 194, 435, 436, 1040, 1040, 1040, 1040, 1040, 1040, + /* 1300 */ 130, 1040, 1040, 1040, 127, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 216, 183, 181, 175, 196, 212, 222, 223, 215, 196, - /* 10 */ 192, 218, 12, 13, 14, 15, 16, 195, 200, 231, - /* 20 */ 232, 246, 199, 195, 202, 12, 13, 14, 15, 16, - /* 30 */ 202, 181, 181, 181, 259, 20, 186, 186, 263, 216, - /* 40 */ 212, 175, 221, 193, 216, 222, 223, 47, 0, 221, - /* 50 */ 228, 20, 202, 202, 226, 227, 228, 229, 230, 207, - /* 60 */ 47, 195, 234, 235, 204, 181, 0, 246, 202, 69, - /* 70 */ 186, 211, 212, 187, 246, 184, 185, 77, 212, 212, - /* 80 */ 259, 195, 216, 68, 263, 218, 202, 259, 22, 203, - /* 90 */ 77, 263, 226, 227, 228, 229, 0, 49, 50, 51, + /* 0 */ 220, 185, 237, 238, 216, 216, 225, 219, 228, 229, + /* 10 */ 222, 222, 12, 13, 14, 15, 16, 179, 185, 185, + /* 20 */ 1, 2, 206, 190, 190, 12, 13, 14, 15, 16, + /* 30 */ 197, 197, 185, 252, 178, 184, 180, 199, 185, 206, + /* 40 */ 206, 225, 179, 190, 206, 194, 265, 47, 0, 208, + /* 50 */ 269, 235, 201, 206, 216, 4, 215, 216, 220, 206, + /* 60 */ 47, 245, 246, 247, 198, 249, 0, 187, 252, 69, + /* 70 */ 232, 233, 234, 235, 236, 209, 196, 77, 240, 241, + /* 80 */ 242, 265, 235, 220, 204, 269, 188, 189, 69, 251, + /* 90 */ 77, 244, 245, 246, 247, 185, 249, 49, 50, 51, /* 100 */ 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, - /* 110 */ 62, 63, 64, 65, 66, 188, 116, 21, 191, 175, - /* 120 */ 24, 25, 26, 27, 28, 29, 30, 31, 32, 116, - /* 130 */ 264, 265, 178, 179, 134, 135, 136, 137, 138, 139, - /* 140 */ 140, 141, 142, 143, 14, 15, 16, 134, 135, 136, - /* 150 */ 137, 138, 139, 140, 141, 142, 143, 1, 2, 175, - /* 160 */ 216, 83, 84, 85, 86, 87, 88, 89, 90, 91, - /* 170 */ 92, 93, 20, 95, 96, 97, 98, 99, 100, 195, - /* 180 */ 12, 13, 174, 195, 176, 199, 202, 175, 20, 201, - /* 190 */ 22, 12, 13, 14, 206, 46, 212, 20, 195, 20, - /* 200 */ 216, 22, 216, 175, 20, 202, 38, 0, 222, 223, - /* 210 */ 226, 227, 228, 229, 230, 47, 181, 38, 234, 235, - /* 220 */ 236, 186, 20, 195, 22, 69, 47, 81, 216, 0, - /* 230 */ 202, 228, 248, 12, 13, 172, 68, 202, 254, 255, - /* 240 */ 212, 20, 40, 22, 216, 68, 120, 68, 12, 13, - /* 250 */ 14, 15, 16, 46, 226, 227, 228, 229, 230, 38, - /* 260 */ 92, 3, 234, 235, 236, 144, 145, 175, 47, 181, - /* 270 */ 116, 92, 104, 245, 186, 46, 195, 151, 152, 175, - /* 280 */ 175, 193, 201, 104, 221, 12, 13, 206, 134, 68, - /* 290 */ 202, 123, 124, 125, 126, 22, 128, 143, 146, 195, - /* 300 */ 20, 194, 123, 124, 125, 126, 202, 128, 216, 246, - /* 310 */ 164, 38, 205, 92, 146, 175, 212, 175, 195, 175, - /* 320 */ 216, 216, 259, 146, 201, 104, 263, 63, 0, 206, - /* 330 */ 226, 227, 228, 229, 230, 195, 181, 224, 234, 235, - /* 340 */ 236, 186, 202, 181, 123, 124, 125, 126, 186, 128, - /* 350 */ 22, 175, 212, 12, 13, 242, 216, 202, 216, 255, - /* 360 */ 216, 20, 224, 22, 202, 92, 226, 227, 228, 229, - /* 370 */ 230, 195, 108, 109, 234, 235, 236, 104, 202, 38, - /* 380 */ 242, 12, 13, 14, 14, 245, 175, 79, 212, 20, - /* 390 */ 20, 22, 216, 146, 181, 181, 123, 124, 125, 186, - /* 400 */ 175, 175, 226, 227, 228, 229, 230, 38, 175, 68, - /* 410 */ 234, 235, 236, 4, 187, 202, 202, 20, 12, 13, - /* 420 */ 162, 245, 195, 46, 12, 13, 20, 216, 22, 180, - /* 430 */ 203, 175, 20, 92, 22, 175, 195, 68, 175, 190, - /* 440 */ 187, 216, 216, 229, 38, 104, 197, 206, 195, 216, - /* 450 */ 38, 195, 238, 239, 240, 241, 203, 243, 202, 175, - /* 460 */ 175, 92, 20, 202, 123, 124, 125, 126, 212, 128, - /* 470 */ 209, 175, 216, 104, 68, 20, 216, 221, 195, 216, - /* 480 */ 68, 175, 226, 227, 228, 229, 57, 146, 4, 206, - /* 490 */ 61, 196, 123, 124, 125, 126, 183, 128, 92, 196, - /* 500 */ 216, 216, 246, 19, 92, 175, 175, 0, 175, 175, - /* 510 */ 104, 82, 216, 200, 175, 259, 104, 33, 20, 263, - /* 520 */ 36, 224, 216, 1, 2, 41, 195, 180, 44, 123, - /* 530 */ 124, 125, 126, 202, 128, 123, 124, 125, 126, 242, - /* 540 */ 128, 124, 175, 212, 197, 195, 216, 216, 43, 216, - /* 550 */ 216, 67, 81, 203, 70, 216, 147, 226, 227, 228, - /* 560 */ 229, 230, 195, 181, 57, 234, 235, 21, 61, 202, - /* 570 */ 22, 196, 155, 156, 157, 158, 159, 122, 175, 212, - /* 580 */ 34, 38, 72, 216, 202, 75, 38, 18, 72, 82, - /* 590 */ 176, 75, 23, 226, 227, 228, 229, 230, 195, 257, - /* 600 */ 22, 234, 235, 221, 35, 202, 69, 175, 101, 102, - /* 610 */ 103, 229, 105, 0, 45, 212, 38, 47, 81, 216, - /* 620 */ 122, 239, 240, 241, 0, 243, 175, 195, 246, 226, - /* 630 */ 227, 228, 229, 230, 202, 22, 72, 166, 235, 75, - /* 640 */ 92, 259, 69, 69, 212, 263, 195, 104, 216, 175, - /* 650 */ 145, 219, 104, 202, 81, 81, 170, 171, 226, 227, - /* 660 */ 228, 229, 72, 212, 68, 75, 185, 216, 175, 195, - /* 670 */ 219, 123, 124, 125, 78, 106, 202, 226, 227, 228, - /* 680 */ 229, 57, 38, 205, 69, 61, 212, 69, 195, 266, - /* 690 */ 216, 251, 178, 225, 124, 202, 81, 20, 68, 81, - /* 700 */ 226, 227, 228, 229, 27, 212, 82, 30, 175, 216, - /* 710 */ 80, 69, 69, 175, 244, 146, 39, 260, 69, 226, - /* 720 */ 227, 228, 229, 81, 81, 101, 102, 103, 195, 105, - /* 730 */ 81, 195, 258, 195, 247, 202, 20, 181, 115, 210, - /* 740 */ 202, 69, 116, 208, 181, 212, 20, 208, 104, 216, - /* 750 */ 212, 69, 219, 81, 216, 0, 202, 219, 265, 226, - /* 760 */ 227, 228, 229, 81, 226, 227, 228, 229, 0, 220, - /* 770 */ 183, 21, 20, 69, 24, 25, 26, 27, 28, 29, - /* 780 */ 30, 31, 32, 183, 107, 81, 183, 110, 111, 112, - /* 790 */ 113, 114, 24, 25, 26, 27, 28, 29, 30, 31, - /* 800 */ 32, 19, 175, 181, 49, 213, 51, 175, 183, 54, - /* 810 */ 20, 69, 57, 177, 59, 33, 195, 62, 36, 181, - /* 820 */ 69, 220, 195, 81, 42, 177, 44, 195, 49, 202, - /* 830 */ 51, 202, 81, 54, 202, 69, 57, 175, 59, 212, - /* 840 */ 195, 62, 195, 216, 212, 175, 195, 81, 216, 67, - /* 850 */ 69, 195, 70, 226, 227, 228, 229, 195, 226, 227, - /* 860 */ 228, 229, 81, 69, 202, 195, 12, 13, 14, 15, - /* 870 */ 16, 195, 202, 195, 212, 81, 195, 180, 216, 195, - /* 880 */ 195, 175, 212, 101, 195, 180, 216, 213, 226, 227, - /* 890 */ 228, 229, 20, 225, 154, 256, 226, 227, 228, 229, - /* 900 */ 118, 195, 153, 121, 175, 217, 216, 216, 202, 175, - /* 910 */ 12, 13, 14, 15, 16, 256, 125, 217, 212, 216, - /* 920 */ 161, 160, 216, 69, 195, 149, 253, 252, 148, 195, - /* 930 */ 250, 202, 226, 227, 228, 229, 202, 145, 202, 20, - /* 940 */ 115, 212, 249, 224, 175, 216, 212, 237, 165, 163, - /* 950 */ 216, 68, 175, 169, 267, 226, 227, 228, 229, 181, - /* 960 */ 226, 227, 228, 229, 195, 233, 119, 214, 180, 262, - /* 970 */ 261, 202, 195, 217, 175, 217, 216, 202, 216, 202, - /* 980 */ 202, 212, 180, 216, 213, 216, 191, 202, 68, 212, - /* 990 */ 181, 198, 180, 216, 195, 226, 227, 228, 229, 177, - /* 1000 */ 189, 202, 175, 226, 227, 228, 229, 229, 189, 173, - /* 1010 */ 175, 212, 182, 0, 80, 216, 0, 239, 240, 241, - /* 1020 */ 115, 243, 195, 0, 0, 226, 227, 228, 229, 202, - /* 1030 */ 195, 0, 175, 0, 0, 0, 0, 202, 43, 212, - /* 1040 */ 175, 22, 0, 216, 0, 0, 0, 212, 0, 0, - /* 1050 */ 0, 216, 195, 226, 227, 228, 229, 0, 48, 202, - /* 1060 */ 195, 226, 227, 228, 229, 167, 168, 202, 0, 212, - /* 1070 */ 0, 33, 43, 216, 36, 35, 0, 212, 181, 38, - /* 1080 */ 42, 216, 44, 226, 227, 228, 229, 36, 0, 0, - /* 1090 */ 0, 226, 227, 228, 229, 77, 75, 57, 38, 202, - /* 1100 */ 38, 61, 22, 0, 38, 67, 0, 38, 70, 38, - /* 1110 */ 38, 71, 38, 73, 74, 38, 76, 2, 22, 0, - /* 1120 */ 22, 39, 82, 0, 22, 38, 229, 12, 13, 14, - /* 1130 */ 15, 16, 2, 0, 22, 0, 239, 240, 241, 22, - /* 1140 */ 243, 20, 12, 13, 14, 15, 16, 127, 0, 129, - /* 1150 */ 130, 131, 132, 133, 0, 117, 0, 43, 150, 121, - /* 1160 */ 68, 122, 81, 69, 117, 81, 81, 81, 69, 68, - /* 1170 */ 144, 80, 68, 80, 69, 68, 81, 69, 68, 4, - /* 1180 */ 150, 81, 69, 38, 38, 69, 2, 69, 38, 80, - /* 1190 */ 38, 38, 81, 150, 69, 38, 68, 124, 69, 68, - /* 1200 */ 80, 69, 68, 120, 68, 68, 0, 43, 68, 22, - /* 1210 */ 68, 38, 38, 69, 117, 68, 78, 38, 69, 80, - /* 1220 */ 69, 80, 79, 68, 38, 22, 68, 38, 69, 68, - /* 1230 */ 38, 69, 38, 68, 38, 38, 22, 68, 48, 68, - /* 1240 */ 68, 22, 47, 38, 22, 38, 38, 38, 38, 38, - /* 1250 */ 82, 38, 0, 38, 94, 38, 38, 94, 38, 38, - /* 1260 */ 94, 94, 38, 38, 38, 38, 38, 36, 0, 0, - /* 1270 */ 38, 37, 43, 0, 104, 22, 21, 268, 22, 22, - /* 1280 */ 21, 20, 268, 268, 268, 268, 268, 268, 268, 268, - /* 1290 */ 268, 268, 268, 268, 268, 268, 268, 268, 268, 268, - /* 1300 */ 268, 268, 268, 268, 268, 268, 268, 268, 268, 268, - /* 1310 */ 268, 268, 268, 268, 268, 268, 268, 268, 268, 268, - /* 1320 */ 268, 268, 268, 268, 268, 268, 268, 268, 268, 268, - /* 1330 */ 268, 268, 268, 268, 268, 268, 268, 268, 268, 268, - /* 1340 */ 268, 268, 268, 268, 268, 268, 268, 268, 268, 268, - /* 1350 */ 268, 268, 268, 268, 268, 268, 268, 268, 268, 268, - /* 1360 */ 268, 268, 268, 268, 268, 268, 268, 268, 268, 268, - /* 1370 */ 268, 268, 268, 268, 268, 268, 268, 268, 268, 268, - /* 1380 */ 268, 268, 268, 268, 268, 268, 268, 268, 268, 268, - /* 1390 */ 268, 268, 268, 268, 268, 268, 268, 268, 268, 268, - /* 1400 */ 268, 268, 268, 268, 268, 268, 268, 268, 268, 268, - /* 1410 */ 268, 268, 268, 268, 268, 268, 268, 268, 268, 268, - /* 1420 */ 268, 268, 268, 268, 268, 268, 268, 268, 268, 268, - /* 1430 */ 268, 268, 268, 268, 268, 268, 268, 268, 268, 268, - /* 1440 */ 268, 268, 268, 268, 268, 268, 268, 268, 268, 268, - /* 1450 */ 268, 268, 268, 268, + /* 110 */ 62, 63, 64, 65, 66, 49, 116, 51, 199, 191, + /* 120 */ 54, 211, 20, 57, 20, 59, 207, 199, 62, 116, + /* 130 */ 12, 13, 14, 15, 16, 207, 20, 0, 138, 139, + /* 140 */ 140, 141, 142, 143, 144, 145, 146, 147, 14, 15, + /* 150 */ 16, 138, 139, 140, 141, 142, 143, 144, 145, 146, + /* 160 */ 147, 83, 84, 85, 86, 87, 88, 89, 90, 91, + /* 170 */ 92, 93, 179, 95, 96, 97, 98, 99, 100, 203, + /* 180 */ 12, 13, 185, 46, 68, 12, 13, 14, 20, 46, + /* 190 */ 22, 203, 199, 20, 179, 22, 220, 21, 125, 206, + /* 200 */ 127, 199, 151, 206, 228, 229, 38, 205, 220, 216, + /* 210 */ 34, 38, 210, 220, 199, 47, 228, 229, 225, 185, + /* 220 */ 47, 206, 191, 150, 190, 232, 233, 234, 235, 236, + /* 230 */ 199, 216, 235, 240, 241, 220, 68, 63, 207, 0, + /* 240 */ 206, 68, 245, 246, 247, 252, 249, 232, 233, 234, + /* 250 */ 235, 236, 150, 199, 22, 240, 241, 242, 265, 205, + /* 260 */ 92, 43, 269, 20, 210, 92, 150, 182, 183, 254, + /* 270 */ 38, 185, 104, 199, 199, 260, 261, 104, 12, 13, + /* 280 */ 206, 206, 108, 109, 35, 46, 20, 179, 22, 171, + /* 290 */ 172, 120, 148, 149, 126, 184, 128, 129, 130, 126, + /* 300 */ 132, 128, 129, 130, 38, 132, 57, 199, 234, 234, + /* 310 */ 61, 225, 201, 47, 206, 20, 252, 22, 150, 179, + /* 320 */ 71, 199, 73, 74, 216, 76, 155, 156, 220, 265, + /* 330 */ 179, 82, 210, 269, 68, 40, 150, 20, 252, 199, + /* 340 */ 232, 233, 234, 235, 236, 46, 206, 185, 240, 241, + /* 350 */ 242, 265, 190, 12, 13, 269, 216, 185, 92, 20, + /* 360 */ 220, 20, 190, 22, 79, 122, 179, 149, 206, 261, + /* 370 */ 104, 220, 232, 233, 234, 235, 236, 199, 206, 38, + /* 380 */ 240, 241, 242, 205, 179, 68, 199, 192, 210, 20, + /* 390 */ 195, 251, 126, 206, 128, 129, 130, 185, 132, 72, + /* 400 */ 191, 179, 75, 216, 12, 13, 14, 220, 199, 68, + /* 410 */ 185, 4, 20, 81, 22, 190, 207, 187, 206, 232, + /* 420 */ 233, 234, 235, 236, 179, 220, 19, 240, 241, 242, + /* 430 */ 38, 206, 116, 92, 204, 14, 12, 13, 251, 81, + /* 440 */ 33, 20, 220, 36, 20, 104, 22, 235, 41, 179, + /* 450 */ 230, 44, 179, 179, 138, 199, 20, 245, 246, 247, + /* 460 */ 68, 249, 38, 147, 20, 220, 210, 126, 248, 128, + /* 470 */ 129, 130, 199, 132, 67, 12, 13, 70, 128, 206, + /* 480 */ 0, 230, 185, 20, 92, 22, 179, 190, 206, 216, + /* 490 */ 220, 150, 68, 220, 220, 213, 104, 176, 225, 248, + /* 500 */ 3, 38, 170, 206, 179, 232, 233, 234, 235, 159, + /* 510 */ 160, 161, 162, 163, 230, 57, 92, 179, 126, 61, + /* 520 */ 128, 129, 130, 179, 132, 252, 168, 220, 104, 20, + /* 530 */ 179, 68, 248, 1, 2, 20, 27, 57, 265, 30, + /* 540 */ 82, 61, 269, 179, 72, 220, 225, 75, 39, 200, + /* 550 */ 126, 47, 128, 129, 130, 92, 132, 72, 220, 38, + /* 560 */ 75, 179, 82, 199, 220, 2, 179, 104, 179, 189, + /* 570 */ 206, 220, 200, 252, 179, 12, 13, 14, 15, 16, + /* 580 */ 216, 101, 102, 103, 220, 105, 265, 174, 175, 126, + /* 590 */ 269, 128, 129, 130, 199, 132, 232, 233, 234, 235, + /* 600 */ 236, 206, 220, 72, 240, 241, 75, 220, 200, 220, + /* 610 */ 179, 216, 179, 179, 69, 220, 107, 179, 179, 110, + /* 620 */ 111, 112, 113, 114, 179, 104, 81, 232, 233, 234, + /* 630 */ 235, 236, 128, 199, 69, 240, 241, 122, 199, 49, + /* 640 */ 206, 51, 0, 200, 54, 206, 81, 57, 0, 59, + /* 650 */ 216, 220, 62, 220, 220, 216, 179, 0, 220, 220, + /* 660 */ 0, 38, 179, 166, 22, 220, 232, 233, 234, 235, + /* 670 */ 22, 232, 233, 234, 235, 236, 199, 272, 200, 180, + /* 680 */ 241, 21, 69, 206, 24, 25, 26, 27, 28, 29, + /* 690 */ 30, 31, 32, 216, 81, 263, 179, 220, 0, 22, + /* 700 */ 223, 179, 209, 220, 270, 271, 257, 69, 182, 232, + /* 710 */ 233, 234, 235, 68, 57, 38, 199, 231, 61, 81, + /* 720 */ 22, 199, 69, 206, 69, 80, 250, 104, 206, 199, + /* 730 */ 266, 124, 69, 216, 81, 69, 81, 220, 216, 82, + /* 740 */ 223, 69, 220, 179, 81, 253, 226, 81, 20, 232, + /* 750 */ 233, 234, 235, 81, 232, 233, 234, 235, 101, 102, + /* 760 */ 103, 185, 105, 199, 115, 2, 214, 116, 212, 92, + /* 770 */ 206, 69, 212, 179, 185, 12, 13, 14, 15, 16, + /* 780 */ 216, 104, 69, 81, 220, 20, 264, 187, 12, 13, + /* 790 */ 14, 15, 16, 199, 81, 179, 232, 233, 234, 235, + /* 800 */ 206, 224, 206, 126, 69, 128, 129, 69, 20, 69, + /* 810 */ 216, 69, 69, 187, 220, 199, 81, 223, 217, 81, + /* 820 */ 19, 81, 206, 81, 81, 185, 232, 233, 234, 235, + /* 830 */ 187, 187, 216, 20, 33, 271, 220, 36, 199, 223, + /* 840 */ 181, 224, 181, 42, 217, 44, 68, 185, 232, 233, + /* 850 */ 234, 235, 0, 199, 21, 199, 78, 24, 25, 26, + /* 860 */ 27, 28, 29, 30, 31, 32, 199, 199, 67, 199, + /* 870 */ 179, 70, 199, 199, 199, 199, 24, 25, 26, 27, + /* 880 */ 28, 29, 30, 31, 32, 199, 206, 184, 184, 131, + /* 890 */ 199, 133, 134, 135, 136, 137, 20, 206, 262, 158, + /* 900 */ 18, 179, 101, 157, 221, 23, 129, 216, 220, 231, + /* 910 */ 221, 220, 262, 220, 220, 165, 258, 35, 164, 118, + /* 920 */ 153, 199, 121, 232, 233, 234, 235, 45, 206, 149, + /* 930 */ 259, 179, 12, 13, 14, 15, 16, 256, 216, 152, + /* 940 */ 255, 20, 220, 206, 230, 115, 173, 68, 243, 167, + /* 950 */ 169, 199, 273, 179, 232, 233, 234, 235, 206, 239, + /* 960 */ 268, 119, 267, 206, 195, 221, 221, 220, 216, 220, + /* 970 */ 217, 220, 220, 199, 218, 179, 184, 184, 206, 68, + /* 980 */ 206, 202, 185, 184, 232, 233, 234, 235, 106, 69, + /* 990 */ 216, 181, 186, 227, 220, 199, 193, 179, 193, 177, + /* 1000 */ 0, 104, 206, 126, 0, 123, 232, 233, 234, 235, + /* 1010 */ 80, 0, 216, 0, 115, 0, 220, 199, 0, 179, + /* 1020 */ 0, 0, 0, 0, 206, 22, 0, 0, 232, 233, + /* 1030 */ 234, 235, 150, 0, 216, 0, 0, 0, 220, 199, + /* 1040 */ 0, 179, 43, 0, 48, 0, 206, 0, 38, 43, + /* 1050 */ 232, 233, 234, 235, 0, 36, 216, 0, 0, 0, + /* 1060 */ 220, 199, 77, 179, 75, 0, 38, 38, 206, 38, + /* 1070 */ 22, 0, 232, 233, 234, 235, 38, 38, 216, 38, + /* 1080 */ 38, 0, 220, 199, 38, 22, 22, 179, 39, 0, + /* 1090 */ 206, 22, 0, 38, 232, 233, 234, 235, 22, 0, + /* 1100 */ 216, 22, 20, 0, 220, 0, 122, 199, 117, 43, + /* 1110 */ 154, 179, 0, 81, 206, 81, 232, 233, 234, 235, + /* 1120 */ 12, 13, 69, 154, 216, 81, 148, 154, 220, 68, + /* 1130 */ 22, 199, 81, 179, 4, 38, 69, 69, 206, 69, + /* 1140 */ 232, 233, 234, 235, 69, 68, 38, 38, 216, 38, + /* 1150 */ 2, 68, 220, 199, 68, 179, 68, 38, 80, 69, + /* 1160 */ 206, 81, 38, 69, 232, 233, 234, 235, 81, 38, + /* 1170 */ 216, 80, 68, 80, 220, 199, 81, 179, 128, 69, + /* 1180 */ 80, 68, 206, 69, 69, 68, 232, 233, 234, 235, + /* 1190 */ 68, 68, 216, 120, 0, 43, 220, 199, 78, 22, + /* 1200 */ 92, 117, 68, 68, 206, 80, 80, 79, 232, 233, + /* 1210 */ 234, 235, 104, 69, 216, 68, 33, 38, 220, 36, + /* 1220 */ 38, 94, 69, 38, 68, 42, 69, 44, 38, 68, + /* 1230 */ 232, 233, 234, 235, 126, 69, 128, 129, 38, 68, + /* 1240 */ 38, 69, 68, 94, 94, 94, 22, 82, 68, 38, + /* 1250 */ 67, 38, 68, 70, 68, 38, 22, 48, 104, 47, + /* 1260 */ 22, 38, 22, 38, 38, 38, 38, 38, 38, 38, + /* 1270 */ 38, 38, 0, 38, 38, 38, 0, 38, 0, 38, + /* 1280 */ 38, 38, 36, 38, 37, 0, 22, 43, 21, 274, + /* 1290 */ 22, 22, 21, 20, 274, 274, 274, 274, 274, 274, + /* 1300 */ 117, 274, 274, 274, 121, 274, 274, 274, 274, 274, + /* 1310 */ 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + /* 1320 */ 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + /* 1330 */ 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + /* 1340 */ 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + /* 1350 */ 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + /* 1360 */ 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + /* 1370 */ 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + /* 1380 */ 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + /* 1390 */ 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + /* 1400 */ 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + /* 1410 */ 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + /* 1420 */ 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + /* 1430 */ 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + /* 1440 */ 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + /* 1450 */ 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + /* 1460 */ 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, }; -#define YY_SHIFT_COUNT (431) +#define YY_SHIFT_COUNT (437) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (1273) +#define YY_SHIFT_MAX (1285) static const unsigned short int yy_shift_ofst[] = { - /* 0 */ 569, 168, 179, 221, 221, 221, 221, 341, 221, 221, - /* 10 */ 406, 412, 177, 369, 406, 406, 406, 406, 406, 406, - /* 20 */ 406, 406, 406, 406, 406, 406, 406, 406, 406, 406, - /* 30 */ 406, 406, 406, 15, 15, 15, 152, 273, 273, 31, - /* 40 */ 31, 273, 31, 31, 149, 184, 280, 280, 247, 397, - /* 50 */ 184, 31, 31, 184, 31, 184, 397, 184, 184, 31, - /* 60 */ 377, 0, 13, 13, 677, 750, 1040, 548, 548, 548, - /* 70 */ 548, 548, 548, 548, 548, 548, 548, 548, 548, 548, - /* 80 */ 548, 548, 548, 548, 548, 548, 548, 779, 202, 207, - /* 90 */ 455, 455, 455, 229, 442, 397, 184, 184, 184, 308, - /* 100 */ 78, 78, 78, 78, 78, 96, 755, 898, 417, 429, - /* 110 */ 126, 578, 498, 121, 505, 121, 370, 258, 409, 716, - /* 120 */ 623, 626, 626, 716, 726, 149, 442, 752, 149, 149, - /* 130 */ 716, 149, 790, 184, 184, 184, 184, 184, 184, 184, - /* 140 */ 184, 184, 184, 184, 716, 790, 726, 377, 442, 752, - /* 150 */ 377, 872, 740, 749, 791, 740, 749, 791, 791, 759, - /* 160 */ 761, 776, 780, 792, 442, 919, 825, 784, 783, 786, - /* 170 */ 883, 184, 749, 791, 791, 749, 791, 847, 442, 752, - /* 180 */ 377, 308, 377, 442, 920, 716, 377, 790, 1282, 1282, - /* 190 */ 1282, 1282, 48, 768, 782, 1038, 484, 507, 624, 1115, - /* 200 */ 1130, 1020, 854, 236, 236, 236, 236, 236, 236, 236, - /* 210 */ 264, 156, 154, 130, 130, 130, 130, 510, 516, 564, - /* 220 */ 590, 66, 328, 613, 546, 537, 573, 574, 522, 486, - /* 230 */ 146, 471, 615, 570, 618, 630, 642, 643, 649, 672, - /* 240 */ 682, 543, 644, 704, 742, 751, 766, 781, 794, 596, - /* 250 */ 1013, 934, 1016, 1023, 905, 1024, 1031, 1033, 1034, 1035, - /* 260 */ 1036, 1019, 1042, 1044, 1045, 1046, 1048, 1049, 1050, 995, - /* 270 */ 1057, 1010, 1068, 1070, 1041, 1051, 1029, 1076, 1088, 1089, - /* 280 */ 1090, 1018, 1021, 1060, 1062, 1080, 1103, 1066, 1069, 1071, - /* 290 */ 1072, 1074, 1077, 1106, 1096, 1119, 1098, 1082, 1123, 1102, - /* 300 */ 1087, 1133, 1112, 1135, 1117, 1121, 1148, 1154, 1039, 1156, - /* 310 */ 1092, 1114, 1047, 1081, 1084, 1008, 1094, 1085, 1099, 1101, - /* 320 */ 1104, 1105, 1107, 1108, 1086, 1091, 1110, 1095, 1030, 1113, - /* 330 */ 1116, 1093, 1026, 1100, 1109, 1118, 1111, 1043, 1175, 1145, - /* 340 */ 1146, 1150, 1152, 1153, 1157, 1184, 1073, 1120, 1125, 1128, - /* 350 */ 1131, 1129, 1132, 1134, 1136, 1083, 1137, 1206, 1164, 1097, - /* 360 */ 1140, 1138, 1139, 1141, 1187, 1142, 1143, 1144, 1173, 1174, - /* 370 */ 1147, 1149, 1179, 1155, 1151, 1186, 1158, 1159, 1189, 1161, - /* 380 */ 1162, 1192, 1165, 1160, 1163, 1166, 1167, 1203, 1168, 1169, - /* 390 */ 1194, 1170, 1171, 1172, 1196, 1197, 1214, 1190, 1195, 1219, - /* 400 */ 1205, 1207, 1208, 1209, 1210, 1211, 1213, 1222, 1215, 1217, - /* 410 */ 1218, 1220, 1221, 1224, 1225, 1226, 1227, 1252, 1228, 1231, - /* 420 */ 1229, 1268, 1232, 1234, 1269, 1273, 1253, 1255, 1256, 1257, - /* 430 */ 1259, 1261, + /* 0 */ 882, 168, 173, 266, 266, 266, 266, 341, 266, 266, + /* 10 */ 424, 463, 116, 392, 424, 424, 424, 424, 424, 424, + /* 20 */ 424, 424, 424, 424, 424, 424, 424, 424, 424, 424, + /* 30 */ 424, 424, 424, 317, 317, 317, 102, 1108, 1108, 73, + /* 40 */ 104, 104, 1108, 104, 104, 143, 339, 369, 369, 186, + /* 50 */ 436, 339, 104, 104, 339, 104, 339, 436, 339, 339, + /* 60 */ 104, 299, 0, 13, 13, 509, 833, 249, 677, 677, + /* 70 */ 677, 677, 677, 677, 677, 677, 677, 677, 677, 677, + /* 80 */ 677, 677, 677, 677, 677, 677, 677, 677, 590, 295, + /* 90 */ 137, 243, 243, 243, 239, 444, 436, 339, 339, 339, + /* 100 */ 285, 78, 78, 78, 78, 78, 660, 66, 118, 350, + /* 110 */ 458, 171, 232, 515, 144, 218, 144, 421, 497, 51, + /* 120 */ 607, 728, 649, 651, 651, 728, 765, 143, 444, 788, + /* 130 */ 143, 143, 728, 143, 813, 339, 339, 339, 339, 339, + /* 140 */ 339, 339, 339, 339, 339, 339, 728, 813, 765, 299, + /* 150 */ 444, 788, 299, 876, 741, 746, 777, 741, 746, 777, + /* 160 */ 777, 750, 754, 767, 787, 780, 444, 921, 830, 773, + /* 170 */ 781, 782, 879, 339, 746, 777, 777, 746, 777, 842, + /* 180 */ 444, 788, 299, 285, 299, 444, 911, 728, 299, 813, + /* 190 */ 1305, 1305, 1305, 1305, 1305, 48, 852, 801, 1183, 407, + /* 200 */ 480, 657, 563, 763, 758, 920, 776, 776, 776, 776, + /* 210 */ 776, 776, 776, 174, 19, 316, 134, 134, 134, 134, + /* 220 */ 327, 472, 485, 531, 642, 648, 698, 176, 545, 565, + /* 230 */ 613, 532, 413, 358, 332, 638, 504, 653, 645, 655, + /* 240 */ 663, 666, 672, 702, 521, 623, 713, 735, 738, 740, + /* 250 */ 742, 743, 778, 1000, 897, 877, 1004, 930, 1011, 1013, + /* 260 */ 899, 1015, 1018, 1020, 1021, 1022, 1023, 1003, 1026, 1027, + /* 270 */ 1033, 1035, 1036, 1037, 1040, 999, 1043, 996, 1045, 1047, + /* 280 */ 1010, 1019, 1006, 1054, 1057, 1058, 1059, 985, 989, 1028, + /* 290 */ 1029, 1048, 1065, 1031, 1038, 1039, 1041, 1042, 1046, 1071, + /* 300 */ 1063, 1081, 1064, 1049, 1089, 1069, 1055, 1092, 1076, 1099, + /* 310 */ 1079, 1082, 1103, 1105, 984, 1112, 1061, 1066, 991, 1032, + /* 320 */ 1034, 956, 1053, 1044, 1067, 1077, 1083, 1068, 1086, 1070, + /* 330 */ 1051, 1078, 1088, 1080, 969, 1075, 1090, 1091, 978, 1087, + /* 340 */ 1093, 1094, 1095, 973, 1130, 1097, 1109, 1111, 1119, 1124, + /* 350 */ 1131, 1148, 1050, 1100, 1110, 1104, 1113, 1114, 1115, 1117, + /* 360 */ 1122, 1073, 1123, 1194, 1152, 1084, 1134, 1120, 1125, 1126, + /* 370 */ 1177, 1135, 1128, 1144, 1179, 1182, 1147, 1153, 1185, 1156, + /* 380 */ 1157, 1190, 1161, 1166, 1200, 1171, 1172, 1202, 1174, 1127, + /* 390 */ 1149, 1150, 1151, 1224, 1165, 1180, 1211, 1154, 1184, 1186, + /* 400 */ 1213, 1217, 1234, 1209, 1212, 1238, 1223, 1225, 1226, 1227, + /* 410 */ 1228, 1229, 1230, 1240, 1231, 1232, 1233, 1235, 1236, 1237, + /* 420 */ 1239, 1241, 1242, 1272, 1243, 1246, 1244, 1276, 1245, 1247, + /* 430 */ 1278, 1285, 1264, 1267, 1268, 1269, 1271, 1273, }; -#define YY_REDUCE_COUNT (191) -#define YY_REDUCE_MIN (-225) -#define YY_REDUCE_MAX (897) +#define YY_REDUCE_COUNT (194) +#define YY_REDUCE_MIN (-235) +#define YY_REDUCE_MAX (998) static const short yy_reduce_ofst[] = { - /* 0 */ 63, -172, -16, 104, 28, 140, 176, 256, 331, 367, - /* 10 */ -134, 403, 382, 432, 451, 474, 493, 533, 538, 627, - /* 20 */ 632, 662, 670, 706, 729, 734, 769, 777, 799, 827, - /* 30 */ 835, 857, 865, 214, 778, 897, -179, -177, -14, -150, - /* 40 */ 88, -216, -149, -116, -182, -12, -178, 3, -225, -207, - /* 50 */ -114, 35, 155, 81, 162, 227, -140, 123, 253, 213, - /* 60 */ 249, -212, -212, -212, -148, 8, 107, -56, 12, 92, - /* 70 */ 105, 142, 144, 211, 225, 226, 233, 260, 263, 284, - /* 80 */ 285, 296, 306, 330, 333, 334, 339, -109, -46, 313, - /* 90 */ 113, 138, 297, 347, 261, -133, 350, 241, 283, -73, - /* 100 */ -192, -187, 295, 303, 375, 414, 481, 423, 342, 478, - /* 110 */ 440, 514, 468, 470, 470, 470, 536, 457, 487, 556, - /* 120 */ 529, 535, 539, 563, 549, 587, 554, 592, 600, 603, - /* 130 */ 622, 625, 636, 621, 645, 647, 651, 656, 676, 678, - /* 140 */ 681, 684, 685, 689, 638, 648, 601, 697, 629, 674, - /* 150 */ 705, 668, 639, 688, 690, 659, 700, 691, 703, 673, - /* 160 */ 675, 680, 693, 470, 736, 719, 710, 687, 707, 709, - /* 170 */ 732, 536, 756, 760, 762, 758, 767, 753, 775, 771, - /* 180 */ 788, 795, 802, 785, 793, 809, 812, 822, 811, 819, - /* 190 */ 830, 836, + /* 0 */ 321, -7, 15, 108, -162, 140, 187, 273, 364, 395, + /* 10 */ 434, 439, -184, 477, 517, 522, 564, 594, 616, 691, + /* 20 */ 722, 752, 774, 796, 818, 840, 862, 884, 908, 932, + /* 30 */ 954, 976, 998, -153, -3, 212, 86, -24, -12, -219, + /* 40 */ -167, -166, -220, -147, 34, -120, 2, 74, 75, 64, + /* 50 */ -212, -72, 162, 172, 54, 225, 31, -159, 178, 209, + /* 60 */ 297, -149, -235, -235, -235, -90, -144, -134, -137, 151, + /* 70 */ 205, 222, 245, 270, 274, 307, 325, 338, 344, 351, + /* 80 */ 382, 387, 389, 431, 433, 438, 445, 483, -102, 85, + /* 90 */ 230, 220, 251, 284, 111, 282, -211, -81, 122, 256, + /* 100 */ 195, 349, 372, 408, 443, 478, 499, 380, 405, 432, + /* 110 */ 493, 449, 526, 486, 476, 476, 476, 530, 464, 492, + /* 120 */ 520, 576, 552, 556, 560, 589, 577, 600, 596, 601, + /* 130 */ 626, 643, 640, 644, 659, 639, 654, 656, 667, 668, + /* 140 */ 670, 673, 674, 675, 676, 686, 662, 661, 617, 703, + /* 150 */ 680, 627, 704, 678, 636, 683, 688, 650, 689, 693, + /* 160 */ 694, 671, 658, 681, 685, 476, 737, 714, 705, 679, + /* 170 */ 692, 695, 720, 530, 744, 747, 749, 745, 751, 756, + /* 180 */ 757, 753, 792, 769, 793, 772, 779, 797, 799, 810, + /* 190 */ 766, 803, 805, 806, 822, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, - /* 10 */ 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, - /* 20 */ 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, - /* 30 */ 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, - /* 40 */ 1023, 1023, 1023, 1023, 1076, 1023, 1023, 1023, 1023, 1023, - /* 50 */ 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, - /* 60 */ 1074, 1023, 1293, 1023, 1189, 1023, 1023, 1023, 1023, 1023, - /* 70 */ 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, - /* 80 */ 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1076, - /* 90 */ 1304, 1304, 1304, 1074, 1023, 1023, 1023, 1023, 1023, 1158, - /* 100 */ 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1368, 1023, 1111, - /* 110 */ 1328, 1023, 1320, 1296, 1310, 1297, 1023, 1353, 1313, 1023, - /* 120 */ 1194, 1191, 1191, 1023, 1023, 1076, 1023, 1023, 1076, 1076, - /* 130 */ 1023, 1076, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, - /* 140 */ 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1074, 1023, 1023, - /* 150 */ 1074, 1023, 1335, 1333, 1023, 1335, 1333, 1023, 1023, 1347, - /* 160 */ 1343, 1326, 1324, 1310, 1023, 1023, 1023, 1371, 1359, 1355, - /* 170 */ 1023, 1023, 1333, 1023, 1023, 1333, 1023, 1202, 1023, 1023, - /* 180 */ 1074, 1023, 1074, 1023, 1127, 1023, 1074, 1023, 1161, 1161, - /* 190 */ 1077, 1028, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, - /* 200 */ 1023, 1023, 1023, 1258, 1346, 1345, 1257, 1270, 1269, 1268, - /* 210 */ 1023, 1023, 1023, 1252, 1253, 1251, 1250, 1023, 1023, 1023, - /* 220 */ 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1294, 1023, - /* 230 */ 1356, 1360, 1023, 1023, 1023, 1236, 1023, 1023, 1023, 1023, - /* 240 */ 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, - /* 250 */ 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, - /* 260 */ 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, - /* 270 */ 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, - /* 280 */ 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, - /* 290 */ 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, - /* 300 */ 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, - /* 310 */ 1023, 1023, 1023, 1317, 1327, 1023, 1023, 1023, 1023, 1023, - /* 320 */ 1023, 1023, 1023, 1023, 1023, 1236, 1023, 1344, 1023, 1303, - /* 330 */ 1299, 1023, 1023, 1295, 1023, 1023, 1354, 1023, 1023, 1023, - /* 340 */ 1023, 1023, 1023, 1023, 1023, 1289, 1023, 1023, 1023, 1023, - /* 350 */ 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, - /* 360 */ 1023, 1023, 1235, 1023, 1023, 1023, 1023, 1023, 1023, 1023, - /* 370 */ 1155, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, - /* 380 */ 1023, 1023, 1023, 1140, 1138, 1137, 1136, 1023, 1133, 1023, - /* 390 */ 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, - /* 400 */ 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, - /* 410 */ 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, - /* 420 */ 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, - /* 430 */ 1023, 1023, + /* 0 */ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, + /* 10 */ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, + /* 20 */ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, + /* 30 */ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, + /* 40 */ 1038, 1038, 1038, 1038, 1038, 1091, 1038, 1038, 1038, 1038, + /* 50 */ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, + /* 60 */ 1038, 1089, 1038, 1314, 1038, 1204, 1038, 1038, 1038, 1038, + /* 70 */ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, + /* 80 */ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, + /* 90 */ 1091, 1325, 1325, 1325, 1089, 1038, 1038, 1038, 1038, 1038, + /* 100 */ 1173, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1389, 1038, + /* 110 */ 1126, 1349, 1038, 1341, 1317, 1331, 1318, 1038, 1374, 1334, + /* 120 */ 1227, 1038, 1209, 1206, 1206, 1038, 1038, 1091, 1038, 1038, + /* 130 */ 1091, 1091, 1038, 1091, 1038, 1038, 1038, 1038, 1038, 1038, + /* 140 */ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1089, + /* 150 */ 1038, 1038, 1089, 1038, 1356, 1354, 1038, 1356, 1354, 1038, + /* 160 */ 1038, 1368, 1364, 1347, 1345, 1331, 1038, 1038, 1038, 1392, + /* 170 */ 1380, 1376, 1038, 1038, 1354, 1038, 1038, 1354, 1038, 1217, + /* 180 */ 1038, 1038, 1089, 1038, 1089, 1038, 1142, 1038, 1089, 1038, + /* 190 */ 1229, 1176, 1176, 1092, 1043, 1038, 1038, 1038, 1038, 1038, + /* 200 */ 1038, 1038, 1038, 1038, 1038, 1038, 1279, 1367, 1366, 1278, + /* 210 */ 1291, 1290, 1289, 1038, 1038, 1038, 1273, 1274, 1272, 1271, + /* 220 */ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, + /* 230 */ 1038, 1315, 1038, 1377, 1381, 1038, 1038, 1038, 1257, 1038, + /* 240 */ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, + /* 250 */ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, + /* 260 */ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, + /* 270 */ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, + /* 280 */ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, + /* 290 */ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, + /* 300 */ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, + /* 310 */ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1338, + /* 320 */ 1348, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, + /* 330 */ 1038, 1257, 1038, 1365, 1038, 1324, 1320, 1038, 1038, 1316, + /* 340 */ 1038, 1038, 1375, 1038, 1038, 1038, 1038, 1038, 1038, 1038, + /* 350 */ 1038, 1310, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, + /* 360 */ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1256, 1038, + /* 370 */ 1038, 1038, 1038, 1038, 1038, 1038, 1170, 1038, 1038, 1038, + /* 380 */ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1155, + /* 390 */ 1153, 1152, 1151, 1038, 1148, 1038, 1038, 1038, 1038, 1038, + /* 400 */ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, + /* 410 */ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, + /* 420 */ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, + /* 430 */ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, }; /********** End of lemon-generated parsing tables *****************************/ @@ -837,151 +840,157 @@ static const char *const yyTokenName[] = { /* 120 */ "INTERVAL", /* 121 */ "TOPIC", /* 122 */ "AS", - /* 123 */ "NK_BOOL", - /* 124 */ "NULL", - /* 125 */ "NK_VARIABLE", - /* 126 */ "NK_UNDERLINE", - /* 127 */ "ROWTS", - /* 128 */ "TBNAME", - /* 129 */ "QSTARTTS", - /* 130 */ "QENDTS", - /* 131 */ "WSTARTTS", - /* 132 */ "WENDTS", - /* 133 */ "WDURATION", - /* 134 */ "BETWEEN", - /* 135 */ "IS", - /* 136 */ "NK_LT", - /* 137 */ "NK_GT", - /* 138 */ "NK_LE", - /* 139 */ "NK_GE", - /* 140 */ "NK_NE", - /* 141 */ "MATCH", - /* 142 */ "NMATCH", - /* 143 */ "IN", - /* 144 */ "JOIN", - /* 145 */ "INNER", - /* 146 */ "SELECT", - /* 147 */ "DISTINCT", - /* 148 */ "WHERE", - /* 149 */ "PARTITION", - /* 150 */ "BY", - /* 151 */ "SESSION", - /* 152 */ "STATE_WINDOW", - /* 153 */ "SLIDING", - /* 154 */ "FILL", - /* 155 */ "VALUE", - /* 156 */ "NONE", - /* 157 */ "PREV", - /* 158 */ "LINEAR", - /* 159 */ "NEXT", - /* 160 */ "GROUP", - /* 161 */ "HAVING", - /* 162 */ "ORDER", - /* 163 */ "SLIMIT", - /* 164 */ "SOFFSET", - /* 165 */ "LIMIT", - /* 166 */ "OFFSET", - /* 167 */ "ASC", - /* 168 */ "DESC", - /* 169 */ "NULLS", - /* 170 */ "FIRST", - /* 171 */ "LAST", - /* 172 */ "cmd", - /* 173 */ "account_options", - /* 174 */ "alter_account_options", - /* 175 */ "literal", - /* 176 */ "alter_account_option", - /* 177 */ "user_name", - /* 178 */ "dnode_endpoint", - /* 179 */ "dnode_host_name", - /* 180 */ "not_exists_opt", - /* 181 */ "db_name", - /* 182 */ "db_options", - /* 183 */ "exists_opt", - /* 184 */ "alter_db_options", - /* 185 */ "alter_db_option", - /* 186 */ "full_table_name", - /* 187 */ "column_def_list", - /* 188 */ "tags_def_opt", - /* 189 */ "table_options", - /* 190 */ "multi_create_clause", - /* 191 */ "tags_def", - /* 192 */ "multi_drop_clause", - /* 193 */ "alter_table_clause", - /* 194 */ "alter_table_options", - /* 195 */ "column_name", - /* 196 */ "type_name", - /* 197 */ "create_subtable_clause", - /* 198 */ "specific_tags_opt", - /* 199 */ "literal_list", - /* 200 */ "drop_table_clause", - /* 201 */ "col_name_list", - /* 202 */ "table_name", - /* 203 */ "column_def", - /* 204 */ "func_name_list", - /* 205 */ "alter_table_option", - /* 206 */ "col_name", - /* 207 */ "db_name_cond_opt", - /* 208 */ "like_pattern_opt", - /* 209 */ "table_name_cond", - /* 210 */ "from_db_opt", - /* 211 */ "func_name", - /* 212 */ "function_name", - /* 213 */ "index_name", - /* 214 */ "index_options", - /* 215 */ "func_list", - /* 216 */ "duration_literal", - /* 217 */ "sliding_opt", - /* 218 */ "func", - /* 219 */ "expression_list", - /* 220 */ "topic_name", - /* 221 */ "query_expression", - /* 222 */ "signed", - /* 223 */ "signed_literal", - /* 224 */ "table_alias", - /* 225 */ "column_alias", - /* 226 */ "expression", - /* 227 */ "pseudo_column", - /* 228 */ "column_reference", - /* 229 */ "subquery", - /* 230 */ "predicate", - /* 231 */ "compare_op", - /* 232 */ "in_op", - /* 233 */ "in_predicate_value", - /* 234 */ "boolean_value_expression", - /* 235 */ "boolean_primary", - /* 236 */ "common_expression", - /* 237 */ "from_clause", - /* 238 */ "table_reference_list", - /* 239 */ "table_reference", - /* 240 */ "table_primary", - /* 241 */ "joined_table", - /* 242 */ "alias_opt", - /* 243 */ "parenthesized_joined_table", - /* 244 */ "join_type", - /* 245 */ "search_condition", - /* 246 */ "query_specification", - /* 247 */ "set_quantifier_opt", - /* 248 */ "select_list", - /* 249 */ "where_clause_opt", - /* 250 */ "partition_by_clause_opt", - /* 251 */ "twindow_clause_opt", - /* 252 */ "group_by_clause_opt", - /* 253 */ "having_clause_opt", - /* 254 */ "select_sublist", - /* 255 */ "select_item", - /* 256 */ "fill_opt", - /* 257 */ "fill_mode", - /* 258 */ "group_by_list", - /* 259 */ "query_expression_body", - /* 260 */ "order_by_clause_opt", - /* 261 */ "slimit_clause_opt", - /* 262 */ "limit_clause_opt", - /* 263 */ "query_primary", - /* 264 */ "sort_specification_list", - /* 265 */ "sort_specification", - /* 266 */ "ordering_specification_opt", - /* 267 */ "null_ordering_opt", + /* 123 */ "EXPLAIN", + /* 124 */ "ANALYZE", + /* 125 */ "VERBOSE", + /* 126 */ "NK_BOOL", + /* 127 */ "RATIO", + /* 128 */ "NULL", + /* 129 */ "NK_VARIABLE", + /* 130 */ "NK_UNDERLINE", + /* 131 */ "ROWTS", + /* 132 */ "TBNAME", + /* 133 */ "QSTARTTS", + /* 134 */ "QENDTS", + /* 135 */ "WSTARTTS", + /* 136 */ "WENDTS", + /* 137 */ "WDURATION", + /* 138 */ "BETWEEN", + /* 139 */ "IS", + /* 140 */ "NK_LT", + /* 141 */ "NK_GT", + /* 142 */ "NK_LE", + /* 143 */ "NK_GE", + /* 144 */ "NK_NE", + /* 145 */ "MATCH", + /* 146 */ "NMATCH", + /* 147 */ "IN", + /* 148 */ "JOIN", + /* 149 */ "INNER", + /* 150 */ "SELECT", + /* 151 */ "DISTINCT", + /* 152 */ "WHERE", + /* 153 */ "PARTITION", + /* 154 */ "BY", + /* 155 */ "SESSION", + /* 156 */ "STATE_WINDOW", + /* 157 */ "SLIDING", + /* 158 */ "FILL", + /* 159 */ "VALUE", + /* 160 */ "NONE", + /* 161 */ "PREV", + /* 162 */ "LINEAR", + /* 163 */ "NEXT", + /* 164 */ "GROUP", + /* 165 */ "HAVING", + /* 166 */ "ORDER", + /* 167 */ "SLIMIT", + /* 168 */ "SOFFSET", + /* 169 */ "LIMIT", + /* 170 */ "OFFSET", + /* 171 */ "ASC", + /* 172 */ "DESC", + /* 173 */ "NULLS", + /* 174 */ "FIRST", + /* 175 */ "LAST", + /* 176 */ "cmd", + /* 177 */ "account_options", + /* 178 */ "alter_account_options", + /* 179 */ "literal", + /* 180 */ "alter_account_option", + /* 181 */ "user_name", + /* 182 */ "dnode_endpoint", + /* 183 */ "dnode_host_name", + /* 184 */ "not_exists_opt", + /* 185 */ "db_name", + /* 186 */ "db_options", + /* 187 */ "exists_opt", + /* 188 */ "alter_db_options", + /* 189 */ "alter_db_option", + /* 190 */ "full_table_name", + /* 191 */ "column_def_list", + /* 192 */ "tags_def_opt", + /* 193 */ "table_options", + /* 194 */ "multi_create_clause", + /* 195 */ "tags_def", + /* 196 */ "multi_drop_clause", + /* 197 */ "alter_table_clause", + /* 198 */ "alter_table_options", + /* 199 */ "column_name", + /* 200 */ "type_name", + /* 201 */ "create_subtable_clause", + /* 202 */ "specific_tags_opt", + /* 203 */ "literal_list", + /* 204 */ "drop_table_clause", + /* 205 */ "col_name_list", + /* 206 */ "table_name", + /* 207 */ "column_def", + /* 208 */ "func_name_list", + /* 209 */ "alter_table_option", + /* 210 */ "col_name", + /* 211 */ "db_name_cond_opt", + /* 212 */ "like_pattern_opt", + /* 213 */ "table_name_cond", + /* 214 */ "from_db_opt", + /* 215 */ "func_name", + /* 216 */ "function_name", + /* 217 */ "index_name", + /* 218 */ "index_options", + /* 219 */ "func_list", + /* 220 */ "duration_literal", + /* 221 */ "sliding_opt", + /* 222 */ "func", + /* 223 */ "expression_list", + /* 224 */ "topic_name", + /* 225 */ "query_expression", + /* 226 */ "analyze_opt", + /* 227 */ "explain_options", + /* 228 */ "signed", + /* 229 */ "signed_literal", + /* 230 */ "table_alias", + /* 231 */ "column_alias", + /* 232 */ "expression", + /* 233 */ "pseudo_column", + /* 234 */ "column_reference", + /* 235 */ "subquery", + /* 236 */ "predicate", + /* 237 */ "compare_op", + /* 238 */ "in_op", + /* 239 */ "in_predicate_value", + /* 240 */ "boolean_value_expression", + /* 241 */ "boolean_primary", + /* 242 */ "common_expression", + /* 243 */ "from_clause", + /* 244 */ "table_reference_list", + /* 245 */ "table_reference", + /* 246 */ "table_primary", + /* 247 */ "joined_table", + /* 248 */ "alias_opt", + /* 249 */ "parenthesized_joined_table", + /* 250 */ "join_type", + /* 251 */ "search_condition", + /* 252 */ "query_specification", + /* 253 */ "set_quantifier_opt", + /* 254 */ "select_list", + /* 255 */ "where_clause_opt", + /* 256 */ "partition_by_clause_opt", + /* 257 */ "twindow_clause_opt", + /* 258 */ "group_by_clause_opt", + /* 259 */ "having_clause_opt", + /* 260 */ "select_sublist", + /* 261 */ "select_item", + /* 262 */ "fill_opt", + /* 263 */ "fill_mode", + /* 264 */ "group_by_list", + /* 265 */ "query_expression_body", + /* 266 */ "order_by_clause_opt", + /* 267 */ "slimit_clause_opt", + /* 268 */ "limit_clause_opt", + /* 269 */ "query_primary", + /* 270 */ "sort_specification_list", + /* 271 */ "sort_specification", + /* 272 */ "ordering_specification_opt", + /* 273 */ "null_ordering_opt", }; #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ @@ -1174,169 +1183,175 @@ static const char *const yyRuleName[] = { /* 182 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression", /* 183 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS db_name", /* 184 */ "cmd ::= DROP TOPIC exists_opt topic_name", - /* 185 */ "cmd ::= query_expression", - /* 186 */ "literal ::= NK_INTEGER", - /* 187 */ "literal ::= NK_FLOAT", - /* 188 */ "literal ::= NK_STRING", - /* 189 */ "literal ::= NK_BOOL", - /* 190 */ "literal ::= TIMESTAMP NK_STRING", - /* 191 */ "literal ::= duration_literal", - /* 192 */ "literal ::= NULL", - /* 193 */ "duration_literal ::= NK_VARIABLE", - /* 194 */ "signed ::= NK_INTEGER", - /* 195 */ "signed ::= NK_PLUS NK_INTEGER", - /* 196 */ "signed ::= NK_MINUS NK_INTEGER", - /* 197 */ "signed ::= NK_FLOAT", - /* 198 */ "signed ::= NK_PLUS NK_FLOAT", - /* 199 */ "signed ::= NK_MINUS NK_FLOAT", - /* 200 */ "signed_literal ::= signed", - /* 201 */ "signed_literal ::= NK_STRING", - /* 202 */ "signed_literal ::= NK_BOOL", - /* 203 */ "signed_literal ::= TIMESTAMP NK_STRING", - /* 204 */ "signed_literal ::= duration_literal", - /* 205 */ "signed_literal ::= NULL", - /* 206 */ "literal_list ::= signed_literal", - /* 207 */ "literal_list ::= literal_list NK_COMMA signed_literal", - /* 208 */ "db_name ::= NK_ID", - /* 209 */ "table_name ::= NK_ID", - /* 210 */ "column_name ::= NK_ID", - /* 211 */ "function_name ::= NK_ID", - /* 212 */ "table_alias ::= NK_ID", - /* 213 */ "column_alias ::= NK_ID", - /* 214 */ "user_name ::= NK_ID", - /* 215 */ "index_name ::= NK_ID", - /* 216 */ "topic_name ::= NK_ID", - /* 217 */ "expression ::= literal", - /* 218 */ "expression ::= pseudo_column", - /* 219 */ "expression ::= column_reference", - /* 220 */ "expression ::= function_name NK_LP expression_list NK_RP", - /* 221 */ "expression ::= function_name NK_LP NK_STAR NK_RP", - /* 222 */ "expression ::= subquery", - /* 223 */ "expression ::= NK_LP expression NK_RP", - /* 224 */ "expression ::= NK_PLUS expression", - /* 225 */ "expression ::= NK_MINUS expression", - /* 226 */ "expression ::= expression NK_PLUS expression", - /* 227 */ "expression ::= expression NK_MINUS expression", - /* 228 */ "expression ::= expression NK_STAR expression", - /* 229 */ "expression ::= expression NK_SLASH expression", - /* 230 */ "expression ::= expression NK_REM expression", - /* 231 */ "expression_list ::= expression", - /* 232 */ "expression_list ::= expression_list NK_COMMA expression", - /* 233 */ "column_reference ::= column_name", - /* 234 */ "column_reference ::= table_name NK_DOT column_name", - /* 235 */ "pseudo_column ::= NK_UNDERLINE ROWTS", - /* 236 */ "pseudo_column ::= TBNAME", - /* 237 */ "pseudo_column ::= NK_UNDERLINE QSTARTTS", - /* 238 */ "pseudo_column ::= NK_UNDERLINE QENDTS", - /* 239 */ "pseudo_column ::= NK_UNDERLINE WSTARTTS", - /* 240 */ "pseudo_column ::= NK_UNDERLINE WENDTS", - /* 241 */ "pseudo_column ::= NK_UNDERLINE WDURATION", - /* 242 */ "predicate ::= expression compare_op expression", - /* 243 */ "predicate ::= expression BETWEEN expression AND expression", - /* 244 */ "predicate ::= expression NOT BETWEEN expression AND expression", - /* 245 */ "predicate ::= expression IS NULL", - /* 246 */ "predicate ::= expression IS NOT NULL", - /* 247 */ "predicate ::= expression in_op in_predicate_value", - /* 248 */ "compare_op ::= NK_LT", - /* 249 */ "compare_op ::= NK_GT", - /* 250 */ "compare_op ::= NK_LE", - /* 251 */ "compare_op ::= NK_GE", - /* 252 */ "compare_op ::= NK_NE", - /* 253 */ "compare_op ::= NK_EQ", - /* 254 */ "compare_op ::= LIKE", - /* 255 */ "compare_op ::= NOT LIKE", - /* 256 */ "compare_op ::= MATCH", - /* 257 */ "compare_op ::= NMATCH", - /* 258 */ "in_op ::= IN", - /* 259 */ "in_op ::= NOT IN", - /* 260 */ "in_predicate_value ::= NK_LP expression_list NK_RP", - /* 261 */ "boolean_value_expression ::= boolean_primary", - /* 262 */ "boolean_value_expression ::= NOT boolean_primary", - /* 263 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", - /* 264 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", - /* 265 */ "boolean_primary ::= predicate", - /* 266 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", - /* 267 */ "common_expression ::= expression", - /* 268 */ "common_expression ::= boolean_value_expression", - /* 269 */ "from_clause ::= FROM table_reference_list", - /* 270 */ "table_reference_list ::= table_reference", - /* 271 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", - /* 272 */ "table_reference ::= table_primary", - /* 273 */ "table_reference ::= joined_table", - /* 274 */ "table_primary ::= table_name alias_opt", - /* 275 */ "table_primary ::= db_name NK_DOT table_name alias_opt", - /* 276 */ "table_primary ::= subquery alias_opt", - /* 277 */ "table_primary ::= parenthesized_joined_table", - /* 278 */ "alias_opt ::=", - /* 279 */ "alias_opt ::= table_alias", - /* 280 */ "alias_opt ::= AS table_alias", - /* 281 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", - /* 282 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", - /* 283 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", - /* 284 */ "join_type ::=", - /* 285 */ "join_type ::= INNER", - /* 286 */ "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", - /* 287 */ "set_quantifier_opt ::=", - /* 288 */ "set_quantifier_opt ::= DISTINCT", - /* 289 */ "set_quantifier_opt ::= ALL", - /* 290 */ "select_list ::= NK_STAR", - /* 291 */ "select_list ::= select_sublist", - /* 292 */ "select_sublist ::= select_item", - /* 293 */ "select_sublist ::= select_sublist NK_COMMA select_item", - /* 294 */ "select_item ::= common_expression", - /* 295 */ "select_item ::= common_expression column_alias", - /* 296 */ "select_item ::= common_expression AS column_alias", - /* 297 */ "select_item ::= table_name NK_DOT NK_STAR", - /* 298 */ "where_clause_opt ::=", - /* 299 */ "where_clause_opt ::= WHERE search_condition", - /* 300 */ "partition_by_clause_opt ::=", - /* 301 */ "partition_by_clause_opt ::= PARTITION BY expression_list", - /* 302 */ "twindow_clause_opt ::=", - /* 303 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", - /* 304 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP", - /* 305 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", - /* 306 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", - /* 307 */ "sliding_opt ::=", - /* 308 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", - /* 309 */ "fill_opt ::=", - /* 310 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", - /* 311 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", - /* 312 */ "fill_mode ::= NONE", - /* 313 */ "fill_mode ::= PREV", - /* 314 */ "fill_mode ::= NULL", - /* 315 */ "fill_mode ::= LINEAR", - /* 316 */ "fill_mode ::= NEXT", - /* 317 */ "group_by_clause_opt ::=", - /* 318 */ "group_by_clause_opt ::= GROUP BY group_by_list", - /* 319 */ "group_by_list ::= expression", - /* 320 */ "group_by_list ::= group_by_list NK_COMMA expression", - /* 321 */ "having_clause_opt ::=", - /* 322 */ "having_clause_opt ::= HAVING search_condition", - /* 323 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt", - /* 324 */ "query_expression_body ::= query_primary", - /* 325 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body", - /* 326 */ "query_primary ::= query_specification", - /* 327 */ "order_by_clause_opt ::=", - /* 328 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", - /* 329 */ "slimit_clause_opt ::=", - /* 330 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", - /* 331 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", - /* 332 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 333 */ "limit_clause_opt ::=", - /* 334 */ "limit_clause_opt ::= LIMIT NK_INTEGER", - /* 335 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", - /* 336 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 337 */ "subquery ::= NK_LP query_expression NK_RP", - /* 338 */ "search_condition ::= common_expression", - /* 339 */ "sort_specification_list ::= sort_specification", - /* 340 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", - /* 341 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt", - /* 342 */ "ordering_specification_opt ::=", - /* 343 */ "ordering_specification_opt ::= ASC", - /* 344 */ "ordering_specification_opt ::= DESC", - /* 345 */ "null_ordering_opt ::=", - /* 346 */ "null_ordering_opt ::= NULLS FIRST", - /* 347 */ "null_ordering_opt ::= NULLS LAST", + /* 185 */ "cmd ::= EXPLAIN analyze_opt explain_options query_expression", + /* 186 */ "analyze_opt ::=", + /* 187 */ "analyze_opt ::= ANALYZE", + /* 188 */ "explain_options ::=", + /* 189 */ "explain_options ::= explain_options VERBOSE NK_BOOL", + /* 190 */ "explain_options ::= explain_options RATIO NK_FLOAT", + /* 191 */ "cmd ::= query_expression", + /* 192 */ "literal ::= NK_INTEGER", + /* 193 */ "literal ::= NK_FLOAT", + /* 194 */ "literal ::= NK_STRING", + /* 195 */ "literal ::= NK_BOOL", + /* 196 */ "literal ::= TIMESTAMP NK_STRING", + /* 197 */ "literal ::= duration_literal", + /* 198 */ "literal ::= NULL", + /* 199 */ "duration_literal ::= NK_VARIABLE", + /* 200 */ "signed ::= NK_INTEGER", + /* 201 */ "signed ::= NK_PLUS NK_INTEGER", + /* 202 */ "signed ::= NK_MINUS NK_INTEGER", + /* 203 */ "signed ::= NK_FLOAT", + /* 204 */ "signed ::= NK_PLUS NK_FLOAT", + /* 205 */ "signed ::= NK_MINUS NK_FLOAT", + /* 206 */ "signed_literal ::= signed", + /* 207 */ "signed_literal ::= NK_STRING", + /* 208 */ "signed_literal ::= NK_BOOL", + /* 209 */ "signed_literal ::= TIMESTAMP NK_STRING", + /* 210 */ "signed_literal ::= duration_literal", + /* 211 */ "signed_literal ::= NULL", + /* 212 */ "literal_list ::= signed_literal", + /* 213 */ "literal_list ::= literal_list NK_COMMA signed_literal", + /* 214 */ "db_name ::= NK_ID", + /* 215 */ "table_name ::= NK_ID", + /* 216 */ "column_name ::= NK_ID", + /* 217 */ "function_name ::= NK_ID", + /* 218 */ "table_alias ::= NK_ID", + /* 219 */ "column_alias ::= NK_ID", + /* 220 */ "user_name ::= NK_ID", + /* 221 */ "index_name ::= NK_ID", + /* 222 */ "topic_name ::= NK_ID", + /* 223 */ "expression ::= literal", + /* 224 */ "expression ::= pseudo_column", + /* 225 */ "expression ::= column_reference", + /* 226 */ "expression ::= function_name NK_LP expression_list NK_RP", + /* 227 */ "expression ::= function_name NK_LP NK_STAR NK_RP", + /* 228 */ "expression ::= subquery", + /* 229 */ "expression ::= NK_LP expression NK_RP", + /* 230 */ "expression ::= NK_PLUS expression", + /* 231 */ "expression ::= NK_MINUS expression", + /* 232 */ "expression ::= expression NK_PLUS expression", + /* 233 */ "expression ::= expression NK_MINUS expression", + /* 234 */ "expression ::= expression NK_STAR expression", + /* 235 */ "expression ::= expression NK_SLASH expression", + /* 236 */ "expression ::= expression NK_REM expression", + /* 237 */ "expression_list ::= expression", + /* 238 */ "expression_list ::= expression_list NK_COMMA expression", + /* 239 */ "column_reference ::= column_name", + /* 240 */ "column_reference ::= table_name NK_DOT column_name", + /* 241 */ "pseudo_column ::= NK_UNDERLINE ROWTS", + /* 242 */ "pseudo_column ::= TBNAME", + /* 243 */ "pseudo_column ::= NK_UNDERLINE QSTARTTS", + /* 244 */ "pseudo_column ::= NK_UNDERLINE QENDTS", + /* 245 */ "pseudo_column ::= NK_UNDERLINE WSTARTTS", + /* 246 */ "pseudo_column ::= NK_UNDERLINE WENDTS", + /* 247 */ "pseudo_column ::= NK_UNDERLINE WDURATION", + /* 248 */ "predicate ::= expression compare_op expression", + /* 249 */ "predicate ::= expression BETWEEN expression AND expression", + /* 250 */ "predicate ::= expression NOT BETWEEN expression AND expression", + /* 251 */ "predicate ::= expression IS NULL", + /* 252 */ "predicate ::= expression IS NOT NULL", + /* 253 */ "predicate ::= expression in_op in_predicate_value", + /* 254 */ "compare_op ::= NK_LT", + /* 255 */ "compare_op ::= NK_GT", + /* 256 */ "compare_op ::= NK_LE", + /* 257 */ "compare_op ::= NK_GE", + /* 258 */ "compare_op ::= NK_NE", + /* 259 */ "compare_op ::= NK_EQ", + /* 260 */ "compare_op ::= LIKE", + /* 261 */ "compare_op ::= NOT LIKE", + /* 262 */ "compare_op ::= MATCH", + /* 263 */ "compare_op ::= NMATCH", + /* 264 */ "in_op ::= IN", + /* 265 */ "in_op ::= NOT IN", + /* 266 */ "in_predicate_value ::= NK_LP expression_list NK_RP", + /* 267 */ "boolean_value_expression ::= boolean_primary", + /* 268 */ "boolean_value_expression ::= NOT boolean_primary", + /* 269 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", + /* 270 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", + /* 271 */ "boolean_primary ::= predicate", + /* 272 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", + /* 273 */ "common_expression ::= expression", + /* 274 */ "common_expression ::= boolean_value_expression", + /* 275 */ "from_clause ::= FROM table_reference_list", + /* 276 */ "table_reference_list ::= table_reference", + /* 277 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", + /* 278 */ "table_reference ::= table_primary", + /* 279 */ "table_reference ::= joined_table", + /* 280 */ "table_primary ::= table_name alias_opt", + /* 281 */ "table_primary ::= db_name NK_DOT table_name alias_opt", + /* 282 */ "table_primary ::= subquery alias_opt", + /* 283 */ "table_primary ::= parenthesized_joined_table", + /* 284 */ "alias_opt ::=", + /* 285 */ "alias_opt ::= table_alias", + /* 286 */ "alias_opt ::= AS table_alias", + /* 287 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", + /* 288 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", + /* 289 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", + /* 290 */ "join_type ::=", + /* 291 */ "join_type ::= INNER", + /* 292 */ "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", + /* 293 */ "set_quantifier_opt ::=", + /* 294 */ "set_quantifier_opt ::= DISTINCT", + /* 295 */ "set_quantifier_opt ::= ALL", + /* 296 */ "select_list ::= NK_STAR", + /* 297 */ "select_list ::= select_sublist", + /* 298 */ "select_sublist ::= select_item", + /* 299 */ "select_sublist ::= select_sublist NK_COMMA select_item", + /* 300 */ "select_item ::= common_expression", + /* 301 */ "select_item ::= common_expression column_alias", + /* 302 */ "select_item ::= common_expression AS column_alias", + /* 303 */ "select_item ::= table_name NK_DOT NK_STAR", + /* 304 */ "where_clause_opt ::=", + /* 305 */ "where_clause_opt ::= WHERE search_condition", + /* 306 */ "partition_by_clause_opt ::=", + /* 307 */ "partition_by_clause_opt ::= PARTITION BY expression_list", + /* 308 */ "twindow_clause_opt ::=", + /* 309 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", + /* 310 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP", + /* 311 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", + /* 312 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", + /* 313 */ "sliding_opt ::=", + /* 314 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", + /* 315 */ "fill_opt ::=", + /* 316 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", + /* 317 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", + /* 318 */ "fill_mode ::= NONE", + /* 319 */ "fill_mode ::= PREV", + /* 320 */ "fill_mode ::= NULL", + /* 321 */ "fill_mode ::= LINEAR", + /* 322 */ "fill_mode ::= NEXT", + /* 323 */ "group_by_clause_opt ::=", + /* 324 */ "group_by_clause_opt ::= GROUP BY group_by_list", + /* 325 */ "group_by_list ::= expression", + /* 326 */ "group_by_list ::= group_by_list NK_COMMA expression", + /* 327 */ "having_clause_opt ::=", + /* 328 */ "having_clause_opt ::= HAVING search_condition", + /* 329 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt", + /* 330 */ "query_expression_body ::= query_primary", + /* 331 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body", + /* 332 */ "query_primary ::= query_specification", + /* 333 */ "order_by_clause_opt ::=", + /* 334 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", + /* 335 */ "slimit_clause_opt ::=", + /* 336 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", + /* 337 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", + /* 338 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 339 */ "limit_clause_opt ::=", + /* 340 */ "limit_clause_opt ::= LIMIT NK_INTEGER", + /* 341 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", + /* 342 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 343 */ "subquery ::= NK_LP query_expression NK_RP", + /* 344 */ "search_condition ::= common_expression", + /* 345 */ "sort_specification_list ::= sort_specification", + /* 346 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", + /* 347 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt", + /* 348 */ "ordering_specification_opt ::=", + /* 349 */ "ordering_specification_opt ::= ASC", + /* 350 */ "ordering_specification_opt ::= DESC", + /* 351 */ "null_ordering_opt ::=", + /* 352 */ "null_ordering_opt ::= NULLS FIRST", + /* 353 */ "null_ordering_opt ::= NULLS LAST", }; #endif /* NDEBUG */ @@ -1463,146 +1478,148 @@ static void yy_destructor( */ /********* Begin destructor definitions ***************************************/ /* Default NON-TERMINAL Destructor */ - case 172: /* cmd */ - case 175: /* literal */ - case 182: /* db_options */ - case 184: /* alter_db_options */ - case 186: /* full_table_name */ - case 189: /* table_options */ - case 193: /* alter_table_clause */ - case 194: /* alter_table_options */ - case 197: /* create_subtable_clause */ - case 200: /* drop_table_clause */ - case 203: /* column_def */ - case 206: /* col_name */ - case 207: /* db_name_cond_opt */ - case 208: /* like_pattern_opt */ - case 209: /* table_name_cond */ - case 210: /* from_db_opt */ - case 211: /* func_name */ - case 214: /* index_options */ - case 216: /* duration_literal */ - case 217: /* sliding_opt */ - case 218: /* func */ - case 221: /* query_expression */ - case 222: /* signed */ - case 223: /* signed_literal */ - case 226: /* expression */ - case 227: /* pseudo_column */ - case 228: /* column_reference */ - case 229: /* subquery */ - case 230: /* predicate */ - case 233: /* in_predicate_value */ - case 234: /* boolean_value_expression */ - case 235: /* boolean_primary */ - case 236: /* common_expression */ - case 237: /* from_clause */ - case 238: /* table_reference_list */ - case 239: /* table_reference */ - case 240: /* table_primary */ - case 241: /* joined_table */ - case 243: /* parenthesized_joined_table */ - case 245: /* search_condition */ - case 246: /* query_specification */ - case 249: /* where_clause_opt */ - case 251: /* twindow_clause_opt */ - case 253: /* having_clause_opt */ - case 255: /* select_item */ - case 256: /* fill_opt */ - case 259: /* query_expression_body */ - case 261: /* slimit_clause_opt */ - case 262: /* limit_clause_opt */ - case 263: /* query_primary */ - case 265: /* sort_specification */ + case 176: /* cmd */ + case 179: /* literal */ + case 186: /* db_options */ + case 188: /* alter_db_options */ + case 190: /* full_table_name */ + case 193: /* table_options */ + case 197: /* alter_table_clause */ + case 198: /* alter_table_options */ + case 201: /* create_subtable_clause */ + case 204: /* drop_table_clause */ + case 207: /* column_def */ + case 210: /* col_name */ + case 211: /* db_name_cond_opt */ + case 212: /* like_pattern_opt */ + case 213: /* table_name_cond */ + case 214: /* from_db_opt */ + case 215: /* func_name */ + case 218: /* index_options */ + case 220: /* duration_literal */ + case 221: /* sliding_opt */ + case 222: /* func */ + case 225: /* query_expression */ + case 227: /* explain_options */ + case 228: /* signed */ + case 229: /* signed_literal */ + case 232: /* expression */ + case 233: /* pseudo_column */ + case 234: /* column_reference */ + case 235: /* subquery */ + case 236: /* predicate */ + case 239: /* in_predicate_value */ + case 240: /* boolean_value_expression */ + case 241: /* boolean_primary */ + case 242: /* common_expression */ + case 243: /* from_clause */ + case 244: /* table_reference_list */ + case 245: /* table_reference */ + case 246: /* table_primary */ + case 247: /* joined_table */ + case 249: /* parenthesized_joined_table */ + case 251: /* search_condition */ + case 252: /* query_specification */ + case 255: /* where_clause_opt */ + case 257: /* twindow_clause_opt */ + case 259: /* having_clause_opt */ + case 261: /* select_item */ + case 262: /* fill_opt */ + case 265: /* query_expression_body */ + case 267: /* slimit_clause_opt */ + case 268: /* limit_clause_opt */ + case 269: /* query_primary */ + case 271: /* sort_specification */ { - nodesDestroyNode((yypminor->yy176)); + nodesDestroyNode((yypminor->yy364)); } break; - case 173: /* account_options */ - case 174: /* alter_account_options */ - case 176: /* alter_account_option */ + case 177: /* account_options */ + case 178: /* alter_account_options */ + case 180: /* alter_account_option */ { } break; - case 177: /* user_name */ - case 178: /* dnode_endpoint */ - case 179: /* dnode_host_name */ - case 181: /* db_name */ - case 195: /* column_name */ - case 202: /* table_name */ - case 212: /* function_name */ - case 213: /* index_name */ - case 220: /* topic_name */ - case 224: /* table_alias */ - case 225: /* column_alias */ - case 242: /* alias_opt */ + case 181: /* user_name */ + case 182: /* dnode_endpoint */ + case 183: /* dnode_host_name */ + case 185: /* db_name */ + case 199: /* column_name */ + case 206: /* table_name */ + case 216: /* function_name */ + case 217: /* index_name */ + case 224: /* topic_name */ + case 230: /* table_alias */ + case 231: /* column_alias */ + case 248: /* alias_opt */ { } break; - case 180: /* not_exists_opt */ - case 183: /* exists_opt */ - case 247: /* set_quantifier_opt */ + case 184: /* not_exists_opt */ + case 187: /* exists_opt */ + case 226: /* analyze_opt */ + case 253: /* set_quantifier_opt */ { } break; - case 185: /* alter_db_option */ - case 205: /* alter_table_option */ + case 189: /* alter_db_option */ + case 209: /* alter_table_option */ { } break; - case 187: /* column_def_list */ - case 188: /* tags_def_opt */ - case 190: /* multi_create_clause */ - case 191: /* tags_def */ - case 192: /* multi_drop_clause */ - case 198: /* specific_tags_opt */ - case 199: /* literal_list */ - case 201: /* col_name_list */ - case 204: /* func_name_list */ - case 215: /* func_list */ - case 219: /* expression_list */ - case 248: /* select_list */ - case 250: /* partition_by_clause_opt */ - case 252: /* group_by_clause_opt */ - case 254: /* select_sublist */ - case 258: /* group_by_list */ - case 260: /* order_by_clause_opt */ - case 264: /* sort_specification_list */ + case 191: /* column_def_list */ + case 192: /* tags_def_opt */ + case 194: /* multi_create_clause */ + case 195: /* tags_def */ + case 196: /* multi_drop_clause */ + case 202: /* specific_tags_opt */ + case 203: /* literal_list */ + case 205: /* col_name_list */ + case 208: /* func_name_list */ + case 219: /* func_list */ + case 223: /* expression_list */ + case 254: /* select_list */ + case 256: /* partition_by_clause_opt */ + case 258: /* group_by_clause_opt */ + case 260: /* select_sublist */ + case 264: /* group_by_list */ + case 266: /* order_by_clause_opt */ + case 270: /* sort_specification_list */ { - nodesDestroyList((yypminor->yy512)); + nodesDestroyList((yypminor->yy40)); } break; - case 196: /* type_name */ + case 200: /* type_name */ { } break; - case 231: /* compare_op */ - case 232: /* in_op */ + case 237: /* compare_op */ + case 238: /* in_op */ { } break; - case 244: /* join_type */ + case 250: /* join_type */ { } break; - case 257: /* fill_mode */ + case 263: /* fill_mode */ { } break; - case 266: /* ordering_specification_opt */ + case 272: /* ordering_specification_opt */ { } break; - case 267: /* null_ordering_opt */ + case 273: /* null_ordering_opt */ { } @@ -1901,354 +1918,360 @@ static const struct { YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ signed char nrhs; /* Negative of the number of RHS symbols in the rule */ } yyRuleInfo[] = { - { 172, -6 }, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ - { 172, -4 }, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ - { 173, 0 }, /* (2) account_options ::= */ - { 173, -3 }, /* (3) account_options ::= account_options PPS literal */ - { 173, -3 }, /* (4) account_options ::= account_options TSERIES literal */ - { 173, -3 }, /* (5) account_options ::= account_options STORAGE literal */ - { 173, -3 }, /* (6) account_options ::= account_options STREAMS literal */ - { 173, -3 }, /* (7) account_options ::= account_options QTIME literal */ - { 173, -3 }, /* (8) account_options ::= account_options DBS literal */ - { 173, -3 }, /* (9) account_options ::= account_options USERS literal */ - { 173, -3 }, /* (10) account_options ::= account_options CONNS literal */ - { 173, -3 }, /* (11) account_options ::= account_options STATE literal */ - { 174, -1 }, /* (12) alter_account_options ::= alter_account_option */ - { 174, -2 }, /* (13) alter_account_options ::= alter_account_options alter_account_option */ - { 176, -2 }, /* (14) alter_account_option ::= PASS literal */ - { 176, -2 }, /* (15) alter_account_option ::= PPS literal */ - { 176, -2 }, /* (16) alter_account_option ::= TSERIES literal */ - { 176, -2 }, /* (17) alter_account_option ::= STORAGE literal */ - { 176, -2 }, /* (18) alter_account_option ::= STREAMS literal */ - { 176, -2 }, /* (19) alter_account_option ::= QTIME literal */ - { 176, -2 }, /* (20) alter_account_option ::= DBS literal */ - { 176, -2 }, /* (21) alter_account_option ::= USERS literal */ - { 176, -2 }, /* (22) alter_account_option ::= CONNS literal */ - { 176, -2 }, /* (23) alter_account_option ::= STATE literal */ - { 172, -5 }, /* (24) cmd ::= CREATE USER user_name PASS NK_STRING */ - { 172, -5 }, /* (25) cmd ::= ALTER USER user_name PASS NK_STRING */ - { 172, -5 }, /* (26) cmd ::= ALTER USER user_name PRIVILEGE NK_STRING */ - { 172, -3 }, /* (27) cmd ::= DROP USER user_name */ - { 172, -3 }, /* (28) cmd ::= CREATE DNODE dnode_endpoint */ - { 172, -5 }, /* (29) cmd ::= CREATE DNODE dnode_host_name PORT NK_INTEGER */ - { 172, -3 }, /* (30) cmd ::= DROP DNODE NK_INTEGER */ - { 172, -3 }, /* (31) cmd ::= DROP DNODE dnode_endpoint */ - { 172, -4 }, /* (32) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ - { 172, -5 }, /* (33) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ - { 172, -4 }, /* (34) cmd ::= ALTER ALL DNODES NK_STRING */ - { 172, -5 }, /* (35) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ - { 178, -1 }, /* (36) dnode_endpoint ::= NK_STRING */ - { 179, -1 }, /* (37) dnode_host_name ::= NK_ID */ - { 179, -1 }, /* (38) dnode_host_name ::= NK_IPTOKEN */ - { 172, -3 }, /* (39) cmd ::= ALTER LOCAL NK_STRING */ - { 172, -4 }, /* (40) cmd ::= ALTER LOCAL NK_STRING NK_STRING */ - { 172, -5 }, /* (41) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ - { 172, -5 }, /* (42) cmd ::= DROP QNODE ON DNODE NK_INTEGER */ - { 172, -5 }, /* (43) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ - { 172, -4 }, /* (44) cmd ::= DROP DATABASE exists_opt db_name */ - { 172, -2 }, /* (45) cmd ::= USE db_name */ - { 172, -4 }, /* (46) cmd ::= ALTER DATABASE db_name alter_db_options */ - { 180, -3 }, /* (47) not_exists_opt ::= IF NOT EXISTS */ - { 180, 0 }, /* (48) not_exists_opt ::= */ - { 183, -2 }, /* (49) exists_opt ::= IF EXISTS */ - { 183, 0 }, /* (50) exists_opt ::= */ - { 182, 0 }, /* (51) db_options ::= */ - { 182, -3 }, /* (52) db_options ::= db_options BLOCKS NK_INTEGER */ - { 182, -3 }, /* (53) db_options ::= db_options CACHE NK_INTEGER */ - { 182, -3 }, /* (54) db_options ::= db_options CACHELAST NK_INTEGER */ - { 182, -3 }, /* (55) db_options ::= db_options COMP NK_INTEGER */ - { 182, -3 }, /* (56) db_options ::= db_options DAYS NK_INTEGER */ - { 182, -3 }, /* (57) db_options ::= db_options FSYNC NK_INTEGER */ - { 182, -3 }, /* (58) db_options ::= db_options MAXROWS NK_INTEGER */ - { 182, -3 }, /* (59) db_options ::= db_options MINROWS NK_INTEGER */ - { 182, -3 }, /* (60) db_options ::= db_options KEEP NK_INTEGER */ - { 182, -3 }, /* (61) db_options ::= db_options PRECISION NK_STRING */ - { 182, -3 }, /* (62) db_options ::= db_options QUORUM NK_INTEGER */ - { 182, -3 }, /* (63) db_options ::= db_options REPLICA NK_INTEGER */ - { 182, -3 }, /* (64) db_options ::= db_options TTL NK_INTEGER */ - { 182, -3 }, /* (65) db_options ::= db_options WAL NK_INTEGER */ - { 182, -3 }, /* (66) db_options ::= db_options VGROUPS NK_INTEGER */ - { 182, -3 }, /* (67) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ - { 182, -3 }, /* (68) db_options ::= db_options STREAM_MODE NK_INTEGER */ - { 182, -3 }, /* (69) db_options ::= db_options RETENTIONS NK_STRING */ - { 184, -1 }, /* (70) alter_db_options ::= alter_db_option */ - { 184, -2 }, /* (71) alter_db_options ::= alter_db_options alter_db_option */ - { 185, -2 }, /* (72) alter_db_option ::= BLOCKS NK_INTEGER */ - { 185, -2 }, /* (73) alter_db_option ::= FSYNC NK_INTEGER */ - { 185, -2 }, /* (74) alter_db_option ::= KEEP NK_INTEGER */ - { 185, -2 }, /* (75) alter_db_option ::= WAL NK_INTEGER */ - { 185, -2 }, /* (76) alter_db_option ::= QUORUM NK_INTEGER */ - { 185, -2 }, /* (77) alter_db_option ::= CACHELAST NK_INTEGER */ - { 172, -9 }, /* (78) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ - { 172, -3 }, /* (79) cmd ::= CREATE TABLE multi_create_clause */ - { 172, -9 }, /* (80) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ - { 172, -3 }, /* (81) cmd ::= DROP TABLE multi_drop_clause */ - { 172, -4 }, /* (82) cmd ::= DROP STABLE exists_opt full_table_name */ - { 172, -3 }, /* (83) cmd ::= ALTER TABLE alter_table_clause */ - { 172, -3 }, /* (84) cmd ::= ALTER STABLE alter_table_clause */ - { 193, -2 }, /* (85) alter_table_clause ::= full_table_name alter_table_options */ - { 193, -5 }, /* (86) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ - { 193, -4 }, /* (87) alter_table_clause ::= full_table_name DROP COLUMN column_name */ - { 193, -5 }, /* (88) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ - { 193, -5 }, /* (89) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ - { 193, -5 }, /* (90) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ - { 193, -4 }, /* (91) alter_table_clause ::= full_table_name DROP TAG column_name */ - { 193, -5 }, /* (92) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ - { 193, -5 }, /* (93) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ - { 193, -6 }, /* (94) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ literal */ - { 190, -1 }, /* (95) multi_create_clause ::= create_subtable_clause */ - { 190, -2 }, /* (96) multi_create_clause ::= multi_create_clause create_subtable_clause */ - { 197, -9 }, /* (97) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP */ - { 192, -1 }, /* (98) multi_drop_clause ::= drop_table_clause */ - { 192, -2 }, /* (99) multi_drop_clause ::= multi_drop_clause drop_table_clause */ - { 200, -2 }, /* (100) drop_table_clause ::= exists_opt full_table_name */ - { 198, 0 }, /* (101) specific_tags_opt ::= */ - { 198, -3 }, /* (102) specific_tags_opt ::= NK_LP col_name_list NK_RP */ - { 186, -1 }, /* (103) full_table_name ::= table_name */ - { 186, -3 }, /* (104) full_table_name ::= db_name NK_DOT table_name */ - { 187, -1 }, /* (105) column_def_list ::= column_def */ - { 187, -3 }, /* (106) column_def_list ::= column_def_list NK_COMMA column_def */ - { 203, -2 }, /* (107) column_def ::= column_name type_name */ - { 203, -4 }, /* (108) column_def ::= column_name type_name COMMENT NK_STRING */ - { 196, -1 }, /* (109) type_name ::= BOOL */ - { 196, -1 }, /* (110) type_name ::= TINYINT */ - { 196, -1 }, /* (111) type_name ::= SMALLINT */ - { 196, -1 }, /* (112) type_name ::= INT */ - { 196, -1 }, /* (113) type_name ::= INTEGER */ - { 196, -1 }, /* (114) type_name ::= BIGINT */ - { 196, -1 }, /* (115) type_name ::= FLOAT */ - { 196, -1 }, /* (116) type_name ::= DOUBLE */ - { 196, -4 }, /* (117) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ - { 196, -1 }, /* (118) type_name ::= TIMESTAMP */ - { 196, -4 }, /* (119) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ - { 196, -2 }, /* (120) type_name ::= TINYINT UNSIGNED */ - { 196, -2 }, /* (121) type_name ::= SMALLINT UNSIGNED */ - { 196, -2 }, /* (122) type_name ::= INT UNSIGNED */ - { 196, -2 }, /* (123) type_name ::= BIGINT UNSIGNED */ - { 196, -1 }, /* (124) type_name ::= JSON */ - { 196, -4 }, /* (125) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ - { 196, -1 }, /* (126) type_name ::= MEDIUMBLOB */ - { 196, -1 }, /* (127) type_name ::= BLOB */ - { 196, -4 }, /* (128) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ - { 196, -1 }, /* (129) type_name ::= DECIMAL */ - { 196, -4 }, /* (130) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ - { 196, -6 }, /* (131) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - { 188, 0 }, /* (132) tags_def_opt ::= */ - { 188, -1 }, /* (133) tags_def_opt ::= tags_def */ - { 191, -4 }, /* (134) tags_def ::= TAGS NK_LP column_def_list NK_RP */ - { 189, 0 }, /* (135) table_options ::= */ - { 189, -3 }, /* (136) table_options ::= table_options COMMENT NK_STRING */ - { 189, -3 }, /* (137) table_options ::= table_options KEEP NK_INTEGER */ - { 189, -3 }, /* (138) table_options ::= table_options TTL NK_INTEGER */ - { 189, -5 }, /* (139) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ - { 189, -5 }, /* (140) table_options ::= table_options ROLLUP NK_LP func_name_list NK_RP */ - { 189, -3 }, /* (141) table_options ::= table_options FILE_FACTOR NK_FLOAT */ - { 189, -3 }, /* (142) table_options ::= table_options DELAY NK_INTEGER */ - { 194, -1 }, /* (143) alter_table_options ::= alter_table_option */ - { 194, -2 }, /* (144) alter_table_options ::= alter_table_options alter_table_option */ - { 205, -2 }, /* (145) alter_table_option ::= COMMENT NK_STRING */ - { 205, -2 }, /* (146) alter_table_option ::= KEEP NK_INTEGER */ - { 205, -2 }, /* (147) alter_table_option ::= TTL NK_INTEGER */ - { 201, -1 }, /* (148) col_name_list ::= col_name */ - { 201, -3 }, /* (149) col_name_list ::= col_name_list NK_COMMA col_name */ - { 206, -1 }, /* (150) col_name ::= column_name */ - { 172, -2 }, /* (151) cmd ::= SHOW DNODES */ - { 172, -2 }, /* (152) cmd ::= SHOW USERS */ - { 172, -2 }, /* (153) cmd ::= SHOW DATABASES */ - { 172, -4 }, /* (154) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ - { 172, -4 }, /* (155) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ - { 172, -3 }, /* (156) cmd ::= SHOW db_name_cond_opt VGROUPS */ - { 172, -2 }, /* (157) cmd ::= SHOW MNODES */ - { 172, -2 }, /* (158) cmd ::= SHOW MODULES */ - { 172, -2 }, /* (159) cmd ::= SHOW QNODES */ - { 172, -2 }, /* (160) cmd ::= SHOW FUNCTIONS */ - { 172, -5 }, /* (161) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ - { 172, -2 }, /* (162) cmd ::= SHOW STREAMS */ - { 207, 0 }, /* (163) db_name_cond_opt ::= */ - { 207, -2 }, /* (164) db_name_cond_opt ::= db_name NK_DOT */ - { 208, 0 }, /* (165) like_pattern_opt ::= */ - { 208, -2 }, /* (166) like_pattern_opt ::= LIKE NK_STRING */ - { 209, -1 }, /* (167) table_name_cond ::= table_name */ - { 210, 0 }, /* (168) from_db_opt ::= */ - { 210, -2 }, /* (169) from_db_opt ::= FROM db_name */ - { 204, -1 }, /* (170) func_name_list ::= func_name */ - { 204, -3 }, /* (171) func_name_list ::= func_name_list NK_COMMA col_name */ - { 211, -1 }, /* (172) func_name ::= function_name */ - { 172, -8 }, /* (173) cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ - { 172, -10 }, /* (174) cmd ::= CREATE FULLTEXT INDEX not_exists_opt index_name ON table_name NK_LP col_name_list NK_RP */ - { 172, -6 }, /* (175) cmd ::= DROP INDEX exists_opt index_name ON table_name */ - { 214, 0 }, /* (176) index_options ::= */ - { 214, -9 }, /* (177) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt */ - { 214, -11 }, /* (178) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt */ - { 215, -1 }, /* (179) func_list ::= func */ - { 215, -3 }, /* (180) func_list ::= func_list NK_COMMA func */ - { 218, -4 }, /* (181) func ::= function_name NK_LP expression_list NK_RP */ - { 172, -6 }, /* (182) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ - { 172, -6 }, /* (183) cmd ::= CREATE TOPIC not_exists_opt topic_name AS db_name */ - { 172, -4 }, /* (184) cmd ::= DROP TOPIC exists_opt topic_name */ - { 172, -1 }, /* (185) cmd ::= query_expression */ - { 175, -1 }, /* (186) literal ::= NK_INTEGER */ - { 175, -1 }, /* (187) literal ::= NK_FLOAT */ - { 175, -1 }, /* (188) literal ::= NK_STRING */ - { 175, -1 }, /* (189) literal ::= NK_BOOL */ - { 175, -2 }, /* (190) literal ::= TIMESTAMP NK_STRING */ - { 175, -1 }, /* (191) literal ::= duration_literal */ - { 175, -1 }, /* (192) literal ::= NULL */ - { 216, -1 }, /* (193) duration_literal ::= NK_VARIABLE */ - { 222, -1 }, /* (194) signed ::= NK_INTEGER */ - { 222, -2 }, /* (195) signed ::= NK_PLUS NK_INTEGER */ - { 222, -2 }, /* (196) signed ::= NK_MINUS NK_INTEGER */ - { 222, -1 }, /* (197) signed ::= NK_FLOAT */ - { 222, -2 }, /* (198) signed ::= NK_PLUS NK_FLOAT */ - { 222, -2 }, /* (199) signed ::= NK_MINUS NK_FLOAT */ - { 223, -1 }, /* (200) signed_literal ::= signed */ - { 223, -1 }, /* (201) signed_literal ::= NK_STRING */ - { 223, -1 }, /* (202) signed_literal ::= NK_BOOL */ - { 223, -2 }, /* (203) signed_literal ::= TIMESTAMP NK_STRING */ - { 223, -1 }, /* (204) signed_literal ::= duration_literal */ - { 223, -1 }, /* (205) signed_literal ::= NULL */ - { 199, -1 }, /* (206) literal_list ::= signed_literal */ - { 199, -3 }, /* (207) literal_list ::= literal_list NK_COMMA signed_literal */ - { 181, -1 }, /* (208) db_name ::= NK_ID */ - { 202, -1 }, /* (209) table_name ::= NK_ID */ - { 195, -1 }, /* (210) column_name ::= NK_ID */ - { 212, -1 }, /* (211) function_name ::= NK_ID */ - { 224, -1 }, /* (212) table_alias ::= NK_ID */ - { 225, -1 }, /* (213) column_alias ::= NK_ID */ - { 177, -1 }, /* (214) user_name ::= NK_ID */ - { 213, -1 }, /* (215) index_name ::= NK_ID */ - { 220, -1 }, /* (216) topic_name ::= NK_ID */ - { 226, -1 }, /* (217) expression ::= literal */ - { 226, -1 }, /* (218) expression ::= pseudo_column */ - { 226, -1 }, /* (219) expression ::= column_reference */ - { 226, -4 }, /* (220) expression ::= function_name NK_LP expression_list NK_RP */ - { 226, -4 }, /* (221) expression ::= function_name NK_LP NK_STAR NK_RP */ - { 226, -1 }, /* (222) expression ::= subquery */ - { 226, -3 }, /* (223) expression ::= NK_LP expression NK_RP */ - { 226, -2 }, /* (224) expression ::= NK_PLUS expression */ - { 226, -2 }, /* (225) expression ::= NK_MINUS expression */ - { 226, -3 }, /* (226) expression ::= expression NK_PLUS expression */ - { 226, -3 }, /* (227) expression ::= expression NK_MINUS expression */ - { 226, -3 }, /* (228) expression ::= expression NK_STAR expression */ - { 226, -3 }, /* (229) expression ::= expression NK_SLASH expression */ - { 226, -3 }, /* (230) expression ::= expression NK_REM expression */ - { 219, -1 }, /* (231) expression_list ::= expression */ - { 219, -3 }, /* (232) expression_list ::= expression_list NK_COMMA expression */ - { 228, -1 }, /* (233) column_reference ::= column_name */ - { 228, -3 }, /* (234) column_reference ::= table_name NK_DOT column_name */ - { 227, -2 }, /* (235) pseudo_column ::= NK_UNDERLINE ROWTS */ - { 227, -1 }, /* (236) pseudo_column ::= TBNAME */ - { 227, -2 }, /* (237) pseudo_column ::= NK_UNDERLINE QSTARTTS */ - { 227, -2 }, /* (238) pseudo_column ::= NK_UNDERLINE QENDTS */ - { 227, -2 }, /* (239) pseudo_column ::= NK_UNDERLINE WSTARTTS */ - { 227, -2 }, /* (240) pseudo_column ::= NK_UNDERLINE WENDTS */ - { 227, -2 }, /* (241) pseudo_column ::= NK_UNDERLINE WDURATION */ - { 230, -3 }, /* (242) predicate ::= expression compare_op expression */ - { 230, -5 }, /* (243) predicate ::= expression BETWEEN expression AND expression */ - { 230, -6 }, /* (244) predicate ::= expression NOT BETWEEN expression AND expression */ - { 230, -3 }, /* (245) predicate ::= expression IS NULL */ - { 230, -4 }, /* (246) predicate ::= expression IS NOT NULL */ - { 230, -3 }, /* (247) predicate ::= expression in_op in_predicate_value */ - { 231, -1 }, /* (248) compare_op ::= NK_LT */ - { 231, -1 }, /* (249) compare_op ::= NK_GT */ - { 231, -1 }, /* (250) compare_op ::= NK_LE */ - { 231, -1 }, /* (251) compare_op ::= NK_GE */ - { 231, -1 }, /* (252) compare_op ::= NK_NE */ - { 231, -1 }, /* (253) compare_op ::= NK_EQ */ - { 231, -1 }, /* (254) compare_op ::= LIKE */ - { 231, -2 }, /* (255) compare_op ::= NOT LIKE */ - { 231, -1 }, /* (256) compare_op ::= MATCH */ - { 231, -1 }, /* (257) compare_op ::= NMATCH */ - { 232, -1 }, /* (258) in_op ::= IN */ - { 232, -2 }, /* (259) in_op ::= NOT IN */ - { 233, -3 }, /* (260) in_predicate_value ::= NK_LP expression_list NK_RP */ - { 234, -1 }, /* (261) boolean_value_expression ::= boolean_primary */ - { 234, -2 }, /* (262) boolean_value_expression ::= NOT boolean_primary */ - { 234, -3 }, /* (263) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - { 234, -3 }, /* (264) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - { 235, -1 }, /* (265) boolean_primary ::= predicate */ - { 235, -3 }, /* (266) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - { 236, -1 }, /* (267) common_expression ::= expression */ - { 236, -1 }, /* (268) common_expression ::= boolean_value_expression */ - { 237, -2 }, /* (269) from_clause ::= FROM table_reference_list */ - { 238, -1 }, /* (270) table_reference_list ::= table_reference */ - { 238, -3 }, /* (271) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - { 239, -1 }, /* (272) table_reference ::= table_primary */ - { 239, -1 }, /* (273) table_reference ::= joined_table */ - { 240, -2 }, /* (274) table_primary ::= table_name alias_opt */ - { 240, -4 }, /* (275) table_primary ::= db_name NK_DOT table_name alias_opt */ - { 240, -2 }, /* (276) table_primary ::= subquery alias_opt */ - { 240, -1 }, /* (277) table_primary ::= parenthesized_joined_table */ - { 242, 0 }, /* (278) alias_opt ::= */ - { 242, -1 }, /* (279) alias_opt ::= table_alias */ - { 242, -2 }, /* (280) alias_opt ::= AS table_alias */ - { 243, -3 }, /* (281) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - { 243, -3 }, /* (282) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - { 241, -6 }, /* (283) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ - { 244, 0 }, /* (284) join_type ::= */ - { 244, -1 }, /* (285) join_type ::= INNER */ - { 246, -9 }, /* (286) 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 */ - { 247, 0 }, /* (287) set_quantifier_opt ::= */ - { 247, -1 }, /* (288) set_quantifier_opt ::= DISTINCT */ - { 247, -1 }, /* (289) set_quantifier_opt ::= ALL */ - { 248, -1 }, /* (290) select_list ::= NK_STAR */ - { 248, -1 }, /* (291) select_list ::= select_sublist */ - { 254, -1 }, /* (292) select_sublist ::= select_item */ - { 254, -3 }, /* (293) select_sublist ::= select_sublist NK_COMMA select_item */ - { 255, -1 }, /* (294) select_item ::= common_expression */ - { 255, -2 }, /* (295) select_item ::= common_expression column_alias */ - { 255, -3 }, /* (296) select_item ::= common_expression AS column_alias */ - { 255, -3 }, /* (297) select_item ::= table_name NK_DOT NK_STAR */ - { 249, 0 }, /* (298) where_clause_opt ::= */ - { 249, -2 }, /* (299) where_clause_opt ::= WHERE search_condition */ - { 250, 0 }, /* (300) partition_by_clause_opt ::= */ - { 250, -3 }, /* (301) partition_by_clause_opt ::= PARTITION BY expression_list */ - { 251, 0 }, /* (302) twindow_clause_opt ::= */ - { 251, -6 }, /* (303) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ - { 251, -4 }, /* (304) twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP */ - { 251, -6 }, /* (305) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ - { 251, -8 }, /* (306) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ - { 217, 0 }, /* (307) sliding_opt ::= */ - { 217, -4 }, /* (308) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ - { 256, 0 }, /* (309) fill_opt ::= */ - { 256, -4 }, /* (310) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - { 256, -6 }, /* (311) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ - { 257, -1 }, /* (312) fill_mode ::= NONE */ - { 257, -1 }, /* (313) fill_mode ::= PREV */ - { 257, -1 }, /* (314) fill_mode ::= NULL */ - { 257, -1 }, /* (315) fill_mode ::= LINEAR */ - { 257, -1 }, /* (316) fill_mode ::= NEXT */ - { 252, 0 }, /* (317) group_by_clause_opt ::= */ - { 252, -3 }, /* (318) group_by_clause_opt ::= GROUP BY group_by_list */ - { 258, -1 }, /* (319) group_by_list ::= expression */ - { 258, -3 }, /* (320) group_by_list ::= group_by_list NK_COMMA expression */ - { 253, 0 }, /* (321) having_clause_opt ::= */ - { 253, -2 }, /* (322) having_clause_opt ::= HAVING search_condition */ - { 221, -4 }, /* (323) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ - { 259, -1 }, /* (324) query_expression_body ::= query_primary */ - { 259, -4 }, /* (325) query_expression_body ::= query_expression_body UNION ALL query_expression_body */ - { 263, -1 }, /* (326) query_primary ::= query_specification */ - { 260, 0 }, /* (327) order_by_clause_opt ::= */ - { 260, -3 }, /* (328) order_by_clause_opt ::= ORDER BY sort_specification_list */ - { 261, 0 }, /* (329) slimit_clause_opt ::= */ - { 261, -2 }, /* (330) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - { 261, -4 }, /* (331) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - { 261, -4 }, /* (332) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - { 262, 0 }, /* (333) limit_clause_opt ::= */ - { 262, -2 }, /* (334) limit_clause_opt ::= LIMIT NK_INTEGER */ - { 262, -4 }, /* (335) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - { 262, -4 }, /* (336) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - { 229, -3 }, /* (337) subquery ::= NK_LP query_expression NK_RP */ - { 245, -1 }, /* (338) search_condition ::= common_expression */ - { 264, -1 }, /* (339) sort_specification_list ::= sort_specification */ - { 264, -3 }, /* (340) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - { 265, -3 }, /* (341) sort_specification ::= expression ordering_specification_opt null_ordering_opt */ - { 266, 0 }, /* (342) ordering_specification_opt ::= */ - { 266, -1 }, /* (343) ordering_specification_opt ::= ASC */ - { 266, -1 }, /* (344) ordering_specification_opt ::= DESC */ - { 267, 0 }, /* (345) null_ordering_opt ::= */ - { 267, -2 }, /* (346) null_ordering_opt ::= NULLS FIRST */ - { 267, -2 }, /* (347) null_ordering_opt ::= NULLS LAST */ + { 176, -6 }, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ + { 176, -4 }, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ + { 177, 0 }, /* (2) account_options ::= */ + { 177, -3 }, /* (3) account_options ::= account_options PPS literal */ + { 177, -3 }, /* (4) account_options ::= account_options TSERIES literal */ + { 177, -3 }, /* (5) account_options ::= account_options STORAGE literal */ + { 177, -3 }, /* (6) account_options ::= account_options STREAMS literal */ + { 177, -3 }, /* (7) account_options ::= account_options QTIME literal */ + { 177, -3 }, /* (8) account_options ::= account_options DBS literal */ + { 177, -3 }, /* (9) account_options ::= account_options USERS literal */ + { 177, -3 }, /* (10) account_options ::= account_options CONNS literal */ + { 177, -3 }, /* (11) account_options ::= account_options STATE literal */ + { 178, -1 }, /* (12) alter_account_options ::= alter_account_option */ + { 178, -2 }, /* (13) alter_account_options ::= alter_account_options alter_account_option */ + { 180, -2 }, /* (14) alter_account_option ::= PASS literal */ + { 180, -2 }, /* (15) alter_account_option ::= PPS literal */ + { 180, -2 }, /* (16) alter_account_option ::= TSERIES literal */ + { 180, -2 }, /* (17) alter_account_option ::= STORAGE literal */ + { 180, -2 }, /* (18) alter_account_option ::= STREAMS literal */ + { 180, -2 }, /* (19) alter_account_option ::= QTIME literal */ + { 180, -2 }, /* (20) alter_account_option ::= DBS literal */ + { 180, -2 }, /* (21) alter_account_option ::= USERS literal */ + { 180, -2 }, /* (22) alter_account_option ::= CONNS literal */ + { 180, -2 }, /* (23) alter_account_option ::= STATE literal */ + { 176, -5 }, /* (24) cmd ::= CREATE USER user_name PASS NK_STRING */ + { 176, -5 }, /* (25) cmd ::= ALTER USER user_name PASS NK_STRING */ + { 176, -5 }, /* (26) cmd ::= ALTER USER user_name PRIVILEGE NK_STRING */ + { 176, -3 }, /* (27) cmd ::= DROP USER user_name */ + { 176, -3 }, /* (28) cmd ::= CREATE DNODE dnode_endpoint */ + { 176, -5 }, /* (29) cmd ::= CREATE DNODE dnode_host_name PORT NK_INTEGER */ + { 176, -3 }, /* (30) cmd ::= DROP DNODE NK_INTEGER */ + { 176, -3 }, /* (31) cmd ::= DROP DNODE dnode_endpoint */ + { 176, -4 }, /* (32) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ + { 176, -5 }, /* (33) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ + { 176, -4 }, /* (34) cmd ::= ALTER ALL DNODES NK_STRING */ + { 176, -5 }, /* (35) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ + { 182, -1 }, /* (36) dnode_endpoint ::= NK_STRING */ + { 183, -1 }, /* (37) dnode_host_name ::= NK_ID */ + { 183, -1 }, /* (38) dnode_host_name ::= NK_IPTOKEN */ + { 176, -3 }, /* (39) cmd ::= ALTER LOCAL NK_STRING */ + { 176, -4 }, /* (40) cmd ::= ALTER LOCAL NK_STRING NK_STRING */ + { 176, -5 }, /* (41) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ + { 176, -5 }, /* (42) cmd ::= DROP QNODE ON DNODE NK_INTEGER */ + { 176, -5 }, /* (43) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ + { 176, -4 }, /* (44) cmd ::= DROP DATABASE exists_opt db_name */ + { 176, -2 }, /* (45) cmd ::= USE db_name */ + { 176, -4 }, /* (46) cmd ::= ALTER DATABASE db_name alter_db_options */ + { 184, -3 }, /* (47) not_exists_opt ::= IF NOT EXISTS */ + { 184, 0 }, /* (48) not_exists_opt ::= */ + { 187, -2 }, /* (49) exists_opt ::= IF EXISTS */ + { 187, 0 }, /* (50) exists_opt ::= */ + { 186, 0 }, /* (51) db_options ::= */ + { 186, -3 }, /* (52) db_options ::= db_options BLOCKS NK_INTEGER */ + { 186, -3 }, /* (53) db_options ::= db_options CACHE NK_INTEGER */ + { 186, -3 }, /* (54) db_options ::= db_options CACHELAST NK_INTEGER */ + { 186, -3 }, /* (55) db_options ::= db_options COMP NK_INTEGER */ + { 186, -3 }, /* (56) db_options ::= db_options DAYS NK_INTEGER */ + { 186, -3 }, /* (57) db_options ::= db_options FSYNC NK_INTEGER */ + { 186, -3 }, /* (58) db_options ::= db_options MAXROWS NK_INTEGER */ + { 186, -3 }, /* (59) db_options ::= db_options MINROWS NK_INTEGER */ + { 186, -3 }, /* (60) db_options ::= db_options KEEP NK_INTEGER */ + { 186, -3 }, /* (61) db_options ::= db_options PRECISION NK_STRING */ + { 186, -3 }, /* (62) db_options ::= db_options QUORUM NK_INTEGER */ + { 186, -3 }, /* (63) db_options ::= db_options REPLICA NK_INTEGER */ + { 186, -3 }, /* (64) db_options ::= db_options TTL NK_INTEGER */ + { 186, -3 }, /* (65) db_options ::= db_options WAL NK_INTEGER */ + { 186, -3 }, /* (66) db_options ::= db_options VGROUPS NK_INTEGER */ + { 186, -3 }, /* (67) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ + { 186, -3 }, /* (68) db_options ::= db_options STREAM_MODE NK_INTEGER */ + { 186, -3 }, /* (69) db_options ::= db_options RETENTIONS NK_STRING */ + { 188, -1 }, /* (70) alter_db_options ::= alter_db_option */ + { 188, -2 }, /* (71) alter_db_options ::= alter_db_options alter_db_option */ + { 189, -2 }, /* (72) alter_db_option ::= BLOCKS NK_INTEGER */ + { 189, -2 }, /* (73) alter_db_option ::= FSYNC NK_INTEGER */ + { 189, -2 }, /* (74) alter_db_option ::= KEEP NK_INTEGER */ + { 189, -2 }, /* (75) alter_db_option ::= WAL NK_INTEGER */ + { 189, -2 }, /* (76) alter_db_option ::= QUORUM NK_INTEGER */ + { 189, -2 }, /* (77) alter_db_option ::= CACHELAST NK_INTEGER */ + { 176, -9 }, /* (78) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ + { 176, -3 }, /* (79) cmd ::= CREATE TABLE multi_create_clause */ + { 176, -9 }, /* (80) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ + { 176, -3 }, /* (81) cmd ::= DROP TABLE multi_drop_clause */ + { 176, -4 }, /* (82) cmd ::= DROP STABLE exists_opt full_table_name */ + { 176, -3 }, /* (83) cmd ::= ALTER TABLE alter_table_clause */ + { 176, -3 }, /* (84) cmd ::= ALTER STABLE alter_table_clause */ + { 197, -2 }, /* (85) alter_table_clause ::= full_table_name alter_table_options */ + { 197, -5 }, /* (86) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ + { 197, -4 }, /* (87) alter_table_clause ::= full_table_name DROP COLUMN column_name */ + { 197, -5 }, /* (88) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ + { 197, -5 }, /* (89) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ + { 197, -5 }, /* (90) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ + { 197, -4 }, /* (91) alter_table_clause ::= full_table_name DROP TAG column_name */ + { 197, -5 }, /* (92) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ + { 197, -5 }, /* (93) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ + { 197, -6 }, /* (94) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ literal */ + { 194, -1 }, /* (95) multi_create_clause ::= create_subtable_clause */ + { 194, -2 }, /* (96) multi_create_clause ::= multi_create_clause create_subtable_clause */ + { 201, -9 }, /* (97) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP */ + { 196, -1 }, /* (98) multi_drop_clause ::= drop_table_clause */ + { 196, -2 }, /* (99) multi_drop_clause ::= multi_drop_clause drop_table_clause */ + { 204, -2 }, /* (100) drop_table_clause ::= exists_opt full_table_name */ + { 202, 0 }, /* (101) specific_tags_opt ::= */ + { 202, -3 }, /* (102) specific_tags_opt ::= NK_LP col_name_list NK_RP */ + { 190, -1 }, /* (103) full_table_name ::= table_name */ + { 190, -3 }, /* (104) full_table_name ::= db_name NK_DOT table_name */ + { 191, -1 }, /* (105) column_def_list ::= column_def */ + { 191, -3 }, /* (106) column_def_list ::= column_def_list NK_COMMA column_def */ + { 207, -2 }, /* (107) column_def ::= column_name type_name */ + { 207, -4 }, /* (108) column_def ::= column_name type_name COMMENT NK_STRING */ + { 200, -1 }, /* (109) type_name ::= BOOL */ + { 200, -1 }, /* (110) type_name ::= TINYINT */ + { 200, -1 }, /* (111) type_name ::= SMALLINT */ + { 200, -1 }, /* (112) type_name ::= INT */ + { 200, -1 }, /* (113) type_name ::= INTEGER */ + { 200, -1 }, /* (114) type_name ::= BIGINT */ + { 200, -1 }, /* (115) type_name ::= FLOAT */ + { 200, -1 }, /* (116) type_name ::= DOUBLE */ + { 200, -4 }, /* (117) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ + { 200, -1 }, /* (118) type_name ::= TIMESTAMP */ + { 200, -4 }, /* (119) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ + { 200, -2 }, /* (120) type_name ::= TINYINT UNSIGNED */ + { 200, -2 }, /* (121) type_name ::= SMALLINT UNSIGNED */ + { 200, -2 }, /* (122) type_name ::= INT UNSIGNED */ + { 200, -2 }, /* (123) type_name ::= BIGINT UNSIGNED */ + { 200, -1 }, /* (124) type_name ::= JSON */ + { 200, -4 }, /* (125) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ + { 200, -1 }, /* (126) type_name ::= MEDIUMBLOB */ + { 200, -1 }, /* (127) type_name ::= BLOB */ + { 200, -4 }, /* (128) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ + { 200, -1 }, /* (129) type_name ::= DECIMAL */ + { 200, -4 }, /* (130) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ + { 200, -6 }, /* (131) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + { 192, 0 }, /* (132) tags_def_opt ::= */ + { 192, -1 }, /* (133) tags_def_opt ::= tags_def */ + { 195, -4 }, /* (134) tags_def ::= TAGS NK_LP column_def_list NK_RP */ + { 193, 0 }, /* (135) table_options ::= */ + { 193, -3 }, /* (136) table_options ::= table_options COMMENT NK_STRING */ + { 193, -3 }, /* (137) table_options ::= table_options KEEP NK_INTEGER */ + { 193, -3 }, /* (138) table_options ::= table_options TTL NK_INTEGER */ + { 193, -5 }, /* (139) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ + { 193, -5 }, /* (140) table_options ::= table_options ROLLUP NK_LP func_name_list NK_RP */ + { 193, -3 }, /* (141) table_options ::= table_options FILE_FACTOR NK_FLOAT */ + { 193, -3 }, /* (142) table_options ::= table_options DELAY NK_INTEGER */ + { 198, -1 }, /* (143) alter_table_options ::= alter_table_option */ + { 198, -2 }, /* (144) alter_table_options ::= alter_table_options alter_table_option */ + { 209, -2 }, /* (145) alter_table_option ::= COMMENT NK_STRING */ + { 209, -2 }, /* (146) alter_table_option ::= KEEP NK_INTEGER */ + { 209, -2 }, /* (147) alter_table_option ::= TTL NK_INTEGER */ + { 205, -1 }, /* (148) col_name_list ::= col_name */ + { 205, -3 }, /* (149) col_name_list ::= col_name_list NK_COMMA col_name */ + { 210, -1 }, /* (150) col_name ::= column_name */ + { 176, -2 }, /* (151) cmd ::= SHOW DNODES */ + { 176, -2 }, /* (152) cmd ::= SHOW USERS */ + { 176, -2 }, /* (153) cmd ::= SHOW DATABASES */ + { 176, -4 }, /* (154) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ + { 176, -4 }, /* (155) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ + { 176, -3 }, /* (156) cmd ::= SHOW db_name_cond_opt VGROUPS */ + { 176, -2 }, /* (157) cmd ::= SHOW MNODES */ + { 176, -2 }, /* (158) cmd ::= SHOW MODULES */ + { 176, -2 }, /* (159) cmd ::= SHOW QNODES */ + { 176, -2 }, /* (160) cmd ::= SHOW FUNCTIONS */ + { 176, -5 }, /* (161) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ + { 176, -2 }, /* (162) cmd ::= SHOW STREAMS */ + { 211, 0 }, /* (163) db_name_cond_opt ::= */ + { 211, -2 }, /* (164) db_name_cond_opt ::= db_name NK_DOT */ + { 212, 0 }, /* (165) like_pattern_opt ::= */ + { 212, -2 }, /* (166) like_pattern_opt ::= LIKE NK_STRING */ + { 213, -1 }, /* (167) table_name_cond ::= table_name */ + { 214, 0 }, /* (168) from_db_opt ::= */ + { 214, -2 }, /* (169) from_db_opt ::= FROM db_name */ + { 208, -1 }, /* (170) func_name_list ::= func_name */ + { 208, -3 }, /* (171) func_name_list ::= func_name_list NK_COMMA col_name */ + { 215, -1 }, /* (172) func_name ::= function_name */ + { 176, -8 }, /* (173) cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ + { 176, -10 }, /* (174) cmd ::= CREATE FULLTEXT INDEX not_exists_opt index_name ON table_name NK_LP col_name_list NK_RP */ + { 176, -6 }, /* (175) cmd ::= DROP INDEX exists_opt index_name ON table_name */ + { 218, 0 }, /* (176) index_options ::= */ + { 218, -9 }, /* (177) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt */ + { 218, -11 }, /* (178) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt */ + { 219, -1 }, /* (179) func_list ::= func */ + { 219, -3 }, /* (180) func_list ::= func_list NK_COMMA func */ + { 222, -4 }, /* (181) func ::= function_name NK_LP expression_list NK_RP */ + { 176, -6 }, /* (182) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ + { 176, -6 }, /* (183) cmd ::= CREATE TOPIC not_exists_opt topic_name AS db_name */ + { 176, -4 }, /* (184) cmd ::= DROP TOPIC exists_opt topic_name */ + { 176, -4 }, /* (185) cmd ::= EXPLAIN analyze_opt explain_options query_expression */ + { 226, 0 }, /* (186) analyze_opt ::= */ + { 226, -1 }, /* (187) analyze_opt ::= ANALYZE */ + { 227, 0 }, /* (188) explain_options ::= */ + { 227, -3 }, /* (189) explain_options ::= explain_options VERBOSE NK_BOOL */ + { 227, -3 }, /* (190) explain_options ::= explain_options RATIO NK_FLOAT */ + { 176, -1 }, /* (191) cmd ::= query_expression */ + { 179, -1 }, /* (192) literal ::= NK_INTEGER */ + { 179, -1 }, /* (193) literal ::= NK_FLOAT */ + { 179, -1 }, /* (194) literal ::= NK_STRING */ + { 179, -1 }, /* (195) literal ::= NK_BOOL */ + { 179, -2 }, /* (196) literal ::= TIMESTAMP NK_STRING */ + { 179, -1 }, /* (197) literal ::= duration_literal */ + { 179, -1 }, /* (198) literal ::= NULL */ + { 220, -1 }, /* (199) duration_literal ::= NK_VARIABLE */ + { 228, -1 }, /* (200) signed ::= NK_INTEGER */ + { 228, -2 }, /* (201) signed ::= NK_PLUS NK_INTEGER */ + { 228, -2 }, /* (202) signed ::= NK_MINUS NK_INTEGER */ + { 228, -1 }, /* (203) signed ::= NK_FLOAT */ + { 228, -2 }, /* (204) signed ::= NK_PLUS NK_FLOAT */ + { 228, -2 }, /* (205) signed ::= NK_MINUS NK_FLOAT */ + { 229, -1 }, /* (206) signed_literal ::= signed */ + { 229, -1 }, /* (207) signed_literal ::= NK_STRING */ + { 229, -1 }, /* (208) signed_literal ::= NK_BOOL */ + { 229, -2 }, /* (209) signed_literal ::= TIMESTAMP NK_STRING */ + { 229, -1 }, /* (210) signed_literal ::= duration_literal */ + { 229, -1 }, /* (211) signed_literal ::= NULL */ + { 203, -1 }, /* (212) literal_list ::= signed_literal */ + { 203, -3 }, /* (213) literal_list ::= literal_list NK_COMMA signed_literal */ + { 185, -1 }, /* (214) db_name ::= NK_ID */ + { 206, -1 }, /* (215) table_name ::= NK_ID */ + { 199, -1 }, /* (216) column_name ::= NK_ID */ + { 216, -1 }, /* (217) function_name ::= NK_ID */ + { 230, -1 }, /* (218) table_alias ::= NK_ID */ + { 231, -1 }, /* (219) column_alias ::= NK_ID */ + { 181, -1 }, /* (220) user_name ::= NK_ID */ + { 217, -1 }, /* (221) index_name ::= NK_ID */ + { 224, -1 }, /* (222) topic_name ::= NK_ID */ + { 232, -1 }, /* (223) expression ::= literal */ + { 232, -1 }, /* (224) expression ::= pseudo_column */ + { 232, -1 }, /* (225) expression ::= column_reference */ + { 232, -4 }, /* (226) expression ::= function_name NK_LP expression_list NK_RP */ + { 232, -4 }, /* (227) expression ::= function_name NK_LP NK_STAR NK_RP */ + { 232, -1 }, /* (228) expression ::= subquery */ + { 232, -3 }, /* (229) expression ::= NK_LP expression NK_RP */ + { 232, -2 }, /* (230) expression ::= NK_PLUS expression */ + { 232, -2 }, /* (231) expression ::= NK_MINUS expression */ + { 232, -3 }, /* (232) expression ::= expression NK_PLUS expression */ + { 232, -3 }, /* (233) expression ::= expression NK_MINUS expression */ + { 232, -3 }, /* (234) expression ::= expression NK_STAR expression */ + { 232, -3 }, /* (235) expression ::= expression NK_SLASH expression */ + { 232, -3 }, /* (236) expression ::= expression NK_REM expression */ + { 223, -1 }, /* (237) expression_list ::= expression */ + { 223, -3 }, /* (238) expression_list ::= expression_list NK_COMMA expression */ + { 234, -1 }, /* (239) column_reference ::= column_name */ + { 234, -3 }, /* (240) column_reference ::= table_name NK_DOT column_name */ + { 233, -2 }, /* (241) pseudo_column ::= NK_UNDERLINE ROWTS */ + { 233, -1 }, /* (242) pseudo_column ::= TBNAME */ + { 233, -2 }, /* (243) pseudo_column ::= NK_UNDERLINE QSTARTTS */ + { 233, -2 }, /* (244) pseudo_column ::= NK_UNDERLINE QENDTS */ + { 233, -2 }, /* (245) pseudo_column ::= NK_UNDERLINE WSTARTTS */ + { 233, -2 }, /* (246) pseudo_column ::= NK_UNDERLINE WENDTS */ + { 233, -2 }, /* (247) pseudo_column ::= NK_UNDERLINE WDURATION */ + { 236, -3 }, /* (248) predicate ::= expression compare_op expression */ + { 236, -5 }, /* (249) predicate ::= expression BETWEEN expression AND expression */ + { 236, -6 }, /* (250) predicate ::= expression NOT BETWEEN expression AND expression */ + { 236, -3 }, /* (251) predicate ::= expression IS NULL */ + { 236, -4 }, /* (252) predicate ::= expression IS NOT NULL */ + { 236, -3 }, /* (253) predicate ::= expression in_op in_predicate_value */ + { 237, -1 }, /* (254) compare_op ::= NK_LT */ + { 237, -1 }, /* (255) compare_op ::= NK_GT */ + { 237, -1 }, /* (256) compare_op ::= NK_LE */ + { 237, -1 }, /* (257) compare_op ::= NK_GE */ + { 237, -1 }, /* (258) compare_op ::= NK_NE */ + { 237, -1 }, /* (259) compare_op ::= NK_EQ */ + { 237, -1 }, /* (260) compare_op ::= LIKE */ + { 237, -2 }, /* (261) compare_op ::= NOT LIKE */ + { 237, -1 }, /* (262) compare_op ::= MATCH */ + { 237, -1 }, /* (263) compare_op ::= NMATCH */ + { 238, -1 }, /* (264) in_op ::= IN */ + { 238, -2 }, /* (265) in_op ::= NOT IN */ + { 239, -3 }, /* (266) in_predicate_value ::= NK_LP expression_list NK_RP */ + { 240, -1 }, /* (267) boolean_value_expression ::= boolean_primary */ + { 240, -2 }, /* (268) boolean_value_expression ::= NOT boolean_primary */ + { 240, -3 }, /* (269) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + { 240, -3 }, /* (270) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + { 241, -1 }, /* (271) boolean_primary ::= predicate */ + { 241, -3 }, /* (272) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + { 242, -1 }, /* (273) common_expression ::= expression */ + { 242, -1 }, /* (274) common_expression ::= boolean_value_expression */ + { 243, -2 }, /* (275) from_clause ::= FROM table_reference_list */ + { 244, -1 }, /* (276) table_reference_list ::= table_reference */ + { 244, -3 }, /* (277) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + { 245, -1 }, /* (278) table_reference ::= table_primary */ + { 245, -1 }, /* (279) table_reference ::= joined_table */ + { 246, -2 }, /* (280) table_primary ::= table_name alias_opt */ + { 246, -4 }, /* (281) table_primary ::= db_name NK_DOT table_name alias_opt */ + { 246, -2 }, /* (282) table_primary ::= subquery alias_opt */ + { 246, -1 }, /* (283) table_primary ::= parenthesized_joined_table */ + { 248, 0 }, /* (284) alias_opt ::= */ + { 248, -1 }, /* (285) alias_opt ::= table_alias */ + { 248, -2 }, /* (286) alias_opt ::= AS table_alias */ + { 249, -3 }, /* (287) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + { 249, -3 }, /* (288) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + { 247, -6 }, /* (289) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ + { 250, 0 }, /* (290) join_type ::= */ + { 250, -1 }, /* (291) join_type ::= INNER */ + { 252, -9 }, /* (292) 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 */ + { 253, 0 }, /* (293) set_quantifier_opt ::= */ + { 253, -1 }, /* (294) set_quantifier_opt ::= DISTINCT */ + { 253, -1 }, /* (295) set_quantifier_opt ::= ALL */ + { 254, -1 }, /* (296) select_list ::= NK_STAR */ + { 254, -1 }, /* (297) select_list ::= select_sublist */ + { 260, -1 }, /* (298) select_sublist ::= select_item */ + { 260, -3 }, /* (299) select_sublist ::= select_sublist NK_COMMA select_item */ + { 261, -1 }, /* (300) select_item ::= common_expression */ + { 261, -2 }, /* (301) select_item ::= common_expression column_alias */ + { 261, -3 }, /* (302) select_item ::= common_expression AS column_alias */ + { 261, -3 }, /* (303) select_item ::= table_name NK_DOT NK_STAR */ + { 255, 0 }, /* (304) where_clause_opt ::= */ + { 255, -2 }, /* (305) where_clause_opt ::= WHERE search_condition */ + { 256, 0 }, /* (306) partition_by_clause_opt ::= */ + { 256, -3 }, /* (307) partition_by_clause_opt ::= PARTITION BY expression_list */ + { 257, 0 }, /* (308) twindow_clause_opt ::= */ + { 257, -6 }, /* (309) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ + { 257, -4 }, /* (310) twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP */ + { 257, -6 }, /* (311) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ + { 257, -8 }, /* (312) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ + { 221, 0 }, /* (313) sliding_opt ::= */ + { 221, -4 }, /* (314) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ + { 262, 0 }, /* (315) fill_opt ::= */ + { 262, -4 }, /* (316) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + { 262, -6 }, /* (317) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ + { 263, -1 }, /* (318) fill_mode ::= NONE */ + { 263, -1 }, /* (319) fill_mode ::= PREV */ + { 263, -1 }, /* (320) fill_mode ::= NULL */ + { 263, -1 }, /* (321) fill_mode ::= LINEAR */ + { 263, -1 }, /* (322) fill_mode ::= NEXT */ + { 258, 0 }, /* (323) group_by_clause_opt ::= */ + { 258, -3 }, /* (324) group_by_clause_opt ::= GROUP BY group_by_list */ + { 264, -1 }, /* (325) group_by_list ::= expression */ + { 264, -3 }, /* (326) group_by_list ::= group_by_list NK_COMMA expression */ + { 259, 0 }, /* (327) having_clause_opt ::= */ + { 259, -2 }, /* (328) having_clause_opt ::= HAVING search_condition */ + { 225, -4 }, /* (329) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ + { 265, -1 }, /* (330) query_expression_body ::= query_primary */ + { 265, -4 }, /* (331) query_expression_body ::= query_expression_body UNION ALL query_expression_body */ + { 269, -1 }, /* (332) query_primary ::= query_specification */ + { 266, 0 }, /* (333) order_by_clause_opt ::= */ + { 266, -3 }, /* (334) order_by_clause_opt ::= ORDER BY sort_specification_list */ + { 267, 0 }, /* (335) slimit_clause_opt ::= */ + { 267, -2 }, /* (336) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + { 267, -4 }, /* (337) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + { 267, -4 }, /* (338) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 268, 0 }, /* (339) limit_clause_opt ::= */ + { 268, -2 }, /* (340) limit_clause_opt ::= LIMIT NK_INTEGER */ + { 268, -4 }, /* (341) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + { 268, -4 }, /* (342) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 235, -3 }, /* (343) subquery ::= NK_LP query_expression NK_RP */ + { 251, -1 }, /* (344) search_condition ::= common_expression */ + { 270, -1 }, /* (345) sort_specification_list ::= sort_specification */ + { 270, -3 }, /* (346) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + { 271, -3 }, /* (347) sort_specification ::= expression ordering_specification_opt null_ordering_opt */ + { 272, 0 }, /* (348) ordering_specification_opt ::= */ + { 272, -1 }, /* (349) ordering_specification_opt ::= ASC */ + { 272, -1 }, /* (350) ordering_specification_opt ::= DESC */ + { 273, 0 }, /* (351) null_ordering_opt ::= */ + { 273, -2 }, /* (352) null_ordering_opt ::= NULLS FIRST */ + { 273, -2 }, /* (353) null_ordering_opt ::= NULLS LAST */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -2337,11 +2360,11 @@ static YYACTIONTYPE yy_reduce( YYMINORTYPE yylhsminor; case 0: /* cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ { pCxt->valid = false; generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } - yy_destructor(yypParser,173,&yymsp[0].minor); + yy_destructor(yypParser,177,&yymsp[0].minor); break; case 1: /* cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ { pCxt->valid = false; generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } - yy_destructor(yypParser,174,&yymsp[0].minor); + yy_destructor(yypParser,178,&yymsp[0].minor); break; case 2: /* account_options ::= */ { } @@ -2355,20 +2378,20 @@ static YYACTIONTYPE yy_reduce( case 9: /* account_options ::= account_options USERS literal */ yytestcase(yyruleno==9); case 10: /* account_options ::= account_options CONNS literal */ yytestcase(yyruleno==10); case 11: /* account_options ::= account_options STATE literal */ yytestcase(yyruleno==11); -{ yy_destructor(yypParser,173,&yymsp[-2].minor); +{ yy_destructor(yypParser,177,&yymsp[-2].minor); { } - yy_destructor(yypParser,175,&yymsp[0].minor); + yy_destructor(yypParser,179,&yymsp[0].minor); } break; case 12: /* alter_account_options ::= alter_account_option */ -{ yy_destructor(yypParser,176,&yymsp[0].minor); +{ yy_destructor(yypParser,180,&yymsp[0].minor); { } } break; case 13: /* alter_account_options ::= alter_account_options alter_account_option */ -{ yy_destructor(yypParser,174,&yymsp[-1].minor); +{ yy_destructor(yypParser,178,&yymsp[-1].minor); { } - yy_destructor(yypParser,176,&yymsp[0].minor); + yy_destructor(yypParser,180,&yymsp[0].minor); } break; case 14: /* alter_account_option ::= PASS literal */ @@ -2382,31 +2405,31 @@ static YYACTIONTYPE yy_reduce( case 22: /* alter_account_option ::= CONNS literal */ yytestcase(yyruleno==22); case 23: /* alter_account_option ::= STATE literal */ yytestcase(yyruleno==23); { } - yy_destructor(yypParser,175,&yymsp[0].minor); + yy_destructor(yypParser,179,&yymsp[0].minor); break; case 24: /* cmd ::= CREATE USER user_name PASS NK_STRING */ -{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-2].minor.yy225, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-2].minor.yy437, &yymsp[0].minor.yy0); } break; case 25: /* cmd ::= ALTER USER user_name PASS NK_STRING */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy225, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy437, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } break; case 26: /* cmd ::= ALTER USER user_name PRIVILEGE NK_STRING */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy225, TSDB_ALTER_USER_PRIVILEGES, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy437, TSDB_ALTER_USER_PRIVILEGES, &yymsp[0].minor.yy0); } break; case 27: /* cmd ::= DROP USER user_name */ -{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy225); } +{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy437); } break; case 28: /* cmd ::= CREATE DNODE dnode_endpoint */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy225, NULL); } +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy437, NULL); } break; case 29: /* cmd ::= CREATE DNODE dnode_host_name PORT NK_INTEGER */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy225, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy437, &yymsp[0].minor.yy0); } break; case 30: /* cmd ::= DROP DNODE NK_INTEGER */ { pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy0); } break; case 31: /* cmd ::= DROP DNODE dnode_endpoint */ -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy225); } +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy437); } break; case 32: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); } @@ -2423,17 +2446,17 @@ static YYACTIONTYPE yy_reduce( case 36: /* dnode_endpoint ::= NK_STRING */ case 37: /* dnode_host_name ::= NK_ID */ yytestcase(yyruleno==37); case 38: /* dnode_host_name ::= NK_IPTOKEN */ yytestcase(yyruleno==38); - case 208: /* db_name ::= NK_ID */ yytestcase(yyruleno==208); - case 209: /* table_name ::= NK_ID */ yytestcase(yyruleno==209); - case 210: /* column_name ::= NK_ID */ yytestcase(yyruleno==210); - case 211: /* function_name ::= NK_ID */ yytestcase(yyruleno==211); - case 212: /* table_alias ::= NK_ID */ yytestcase(yyruleno==212); - case 213: /* column_alias ::= NK_ID */ yytestcase(yyruleno==213); - case 214: /* user_name ::= NK_ID */ yytestcase(yyruleno==214); - case 215: /* index_name ::= NK_ID */ yytestcase(yyruleno==215); - case 216: /* topic_name ::= NK_ID */ yytestcase(yyruleno==216); -{ yylhsminor.yy225 = yymsp[0].minor.yy0; } - yymsp[0].minor.yy225 = yylhsminor.yy225; + case 214: /* db_name ::= NK_ID */ yytestcase(yyruleno==214); + case 215: /* table_name ::= NK_ID */ yytestcase(yyruleno==215); + case 216: /* column_name ::= NK_ID */ yytestcase(yyruleno==216); + case 217: /* function_name ::= NK_ID */ yytestcase(yyruleno==217); + case 218: /* table_alias ::= NK_ID */ yytestcase(yyruleno==218); + case 219: /* column_alias ::= NK_ID */ yytestcase(yyruleno==219); + case 220: /* user_name ::= NK_ID */ yytestcase(yyruleno==220); + case 221: /* index_name ::= NK_ID */ yytestcase(yyruleno==221); + case 222: /* topic_name ::= NK_ID */ yytestcase(yyruleno==222); +{ yylhsminor.yy437 = yymsp[0].minor.yy0; } + yymsp[0].minor.yy437 = yylhsminor.yy437; break; case 39: /* cmd ::= ALTER LOCAL NK_STRING */ { pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[0].minor.yy0, NULL); } @@ -2448,186 +2471,187 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createDropQnodeStmt(pCxt, &yymsp[0].minor.yy0); } break; case 43: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ -{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy505, &yymsp[-1].minor.yy225, yymsp[0].minor.yy176); } +{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy493, &yymsp[-1].minor.yy437, yymsp[0].minor.yy364); } break; case 44: /* cmd ::= DROP DATABASE exists_opt db_name */ -{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy505, &yymsp[0].minor.yy225); } +{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy493, &yymsp[0].minor.yy437); } break; case 45: /* cmd ::= USE db_name */ -{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy225); } +{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy437); } break; case 46: /* cmd ::= ALTER DATABASE db_name alter_db_options */ -{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy225, yymsp[0].minor.yy176); } +{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy437, yymsp[0].minor.yy364); } break; case 47: /* not_exists_opt ::= IF NOT EXISTS */ -{ yymsp[-2].minor.yy505 = true; } +{ yymsp[-2].minor.yy493 = true; } break; case 48: /* not_exists_opt ::= */ case 50: /* exists_opt ::= */ yytestcase(yyruleno==50); - case 287: /* set_quantifier_opt ::= */ yytestcase(yyruleno==287); -{ yymsp[1].minor.yy505 = false; } + case 186: /* analyze_opt ::= */ yytestcase(yyruleno==186); + case 293: /* set_quantifier_opt ::= */ yytestcase(yyruleno==293); +{ yymsp[1].minor.yy493 = false; } break; case 49: /* exists_opt ::= IF EXISTS */ -{ yymsp[-1].minor.yy505 = true; } +{ yymsp[-1].minor.yy493 = true; } break; case 51: /* db_options ::= */ -{ yymsp[1].minor.yy176 = createDefaultDatabaseOptions(pCxt); } +{ yymsp[1].minor.yy364 = createDefaultDatabaseOptions(pCxt); } break; case 52: /* db_options ::= db_options BLOCKS NK_INTEGER */ -{ yylhsminor.yy176 = setDatabaseOption(pCxt, yymsp[-2].minor.yy176, DB_OPTION_BLOCKS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy176 = yylhsminor.yy176; +{ yylhsminor.yy364 = setDatabaseOption(pCxt, yymsp[-2].minor.yy364, DB_OPTION_BLOCKS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy364 = yylhsminor.yy364; break; case 53: /* db_options ::= db_options CACHE NK_INTEGER */ -{ yylhsminor.yy176 = setDatabaseOption(pCxt, yymsp[-2].minor.yy176, DB_OPTION_CACHE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy176 = yylhsminor.yy176; +{ yylhsminor.yy364 = setDatabaseOption(pCxt, yymsp[-2].minor.yy364, DB_OPTION_CACHE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy364 = yylhsminor.yy364; break; case 54: /* db_options ::= db_options CACHELAST NK_INTEGER */ -{ yylhsminor.yy176 = setDatabaseOption(pCxt, yymsp[-2].minor.yy176, DB_OPTION_CACHELAST, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy176 = yylhsminor.yy176; +{ yylhsminor.yy364 = setDatabaseOption(pCxt, yymsp[-2].minor.yy364, DB_OPTION_CACHELAST, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy364 = yylhsminor.yy364; break; case 55: /* db_options ::= db_options COMP NK_INTEGER */ -{ yylhsminor.yy176 = setDatabaseOption(pCxt, yymsp[-2].minor.yy176, DB_OPTION_COMP, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy176 = yylhsminor.yy176; +{ yylhsminor.yy364 = setDatabaseOption(pCxt, yymsp[-2].minor.yy364, DB_OPTION_COMP, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy364 = yylhsminor.yy364; break; case 56: /* db_options ::= db_options DAYS NK_INTEGER */ -{ yylhsminor.yy176 = setDatabaseOption(pCxt, yymsp[-2].minor.yy176, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy176 = yylhsminor.yy176; +{ yylhsminor.yy364 = setDatabaseOption(pCxt, yymsp[-2].minor.yy364, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy364 = yylhsminor.yy364; break; case 57: /* db_options ::= db_options FSYNC NK_INTEGER */ -{ yylhsminor.yy176 = setDatabaseOption(pCxt, yymsp[-2].minor.yy176, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy176 = yylhsminor.yy176; +{ yylhsminor.yy364 = setDatabaseOption(pCxt, yymsp[-2].minor.yy364, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy364 = yylhsminor.yy364; break; case 58: /* db_options ::= db_options MAXROWS NK_INTEGER */ -{ yylhsminor.yy176 = setDatabaseOption(pCxt, yymsp[-2].minor.yy176, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy176 = yylhsminor.yy176; +{ yylhsminor.yy364 = setDatabaseOption(pCxt, yymsp[-2].minor.yy364, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy364 = yylhsminor.yy364; break; case 59: /* db_options ::= db_options MINROWS NK_INTEGER */ -{ yylhsminor.yy176 = setDatabaseOption(pCxt, yymsp[-2].minor.yy176, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy176 = yylhsminor.yy176; +{ yylhsminor.yy364 = setDatabaseOption(pCxt, yymsp[-2].minor.yy364, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy364 = yylhsminor.yy364; break; case 60: /* db_options ::= db_options KEEP NK_INTEGER */ -{ yylhsminor.yy176 = setDatabaseOption(pCxt, yymsp[-2].minor.yy176, DB_OPTION_KEEP, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy176 = yylhsminor.yy176; +{ yylhsminor.yy364 = setDatabaseOption(pCxt, yymsp[-2].minor.yy364, DB_OPTION_KEEP, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy364 = yylhsminor.yy364; break; case 61: /* db_options ::= db_options PRECISION NK_STRING */ -{ yylhsminor.yy176 = setDatabaseOption(pCxt, yymsp[-2].minor.yy176, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy176 = yylhsminor.yy176; +{ yylhsminor.yy364 = setDatabaseOption(pCxt, yymsp[-2].minor.yy364, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy364 = yylhsminor.yy364; break; case 62: /* db_options ::= db_options QUORUM NK_INTEGER */ -{ yylhsminor.yy176 = setDatabaseOption(pCxt, yymsp[-2].minor.yy176, DB_OPTION_QUORUM, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy176 = yylhsminor.yy176; +{ yylhsminor.yy364 = setDatabaseOption(pCxt, yymsp[-2].minor.yy364, DB_OPTION_QUORUM, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy364 = yylhsminor.yy364; break; case 63: /* db_options ::= db_options REPLICA NK_INTEGER */ -{ yylhsminor.yy176 = setDatabaseOption(pCxt, yymsp[-2].minor.yy176, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy176 = yylhsminor.yy176; +{ yylhsminor.yy364 = setDatabaseOption(pCxt, yymsp[-2].minor.yy364, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy364 = yylhsminor.yy364; break; case 64: /* db_options ::= db_options TTL NK_INTEGER */ -{ yylhsminor.yy176 = setDatabaseOption(pCxt, yymsp[-2].minor.yy176, DB_OPTION_TTL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy176 = yylhsminor.yy176; +{ yylhsminor.yy364 = setDatabaseOption(pCxt, yymsp[-2].minor.yy364, DB_OPTION_TTL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy364 = yylhsminor.yy364; break; case 65: /* db_options ::= db_options WAL NK_INTEGER */ -{ yylhsminor.yy176 = setDatabaseOption(pCxt, yymsp[-2].minor.yy176, DB_OPTION_WAL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy176 = yylhsminor.yy176; +{ yylhsminor.yy364 = setDatabaseOption(pCxt, yymsp[-2].minor.yy364, DB_OPTION_WAL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy364 = yylhsminor.yy364; break; case 66: /* db_options ::= db_options VGROUPS NK_INTEGER */ -{ yylhsminor.yy176 = setDatabaseOption(pCxt, yymsp[-2].minor.yy176, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy176 = yylhsminor.yy176; +{ yylhsminor.yy364 = setDatabaseOption(pCxt, yymsp[-2].minor.yy364, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy364 = yylhsminor.yy364; break; case 67: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */ -{ yylhsminor.yy176 = setDatabaseOption(pCxt, yymsp[-2].minor.yy176, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy176 = yylhsminor.yy176; +{ yylhsminor.yy364 = setDatabaseOption(pCxt, yymsp[-2].minor.yy364, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy364 = yylhsminor.yy364; break; case 68: /* db_options ::= db_options STREAM_MODE NK_INTEGER */ -{ yylhsminor.yy176 = setDatabaseOption(pCxt, yymsp[-2].minor.yy176, DB_OPTION_STREAM_MODE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy176 = yylhsminor.yy176; +{ yylhsminor.yy364 = setDatabaseOption(pCxt, yymsp[-2].minor.yy364, DB_OPTION_STREAM_MODE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy364 = yylhsminor.yy364; break; case 69: /* db_options ::= db_options RETENTIONS NK_STRING */ -{ yylhsminor.yy176 = setDatabaseOption(pCxt, yymsp[-2].minor.yy176, DB_OPTION_RETENTIONS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy176 = yylhsminor.yy176; +{ yylhsminor.yy364 = setDatabaseOption(pCxt, yymsp[-2].minor.yy364, DB_OPTION_RETENTIONS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy364 = yylhsminor.yy364; break; case 70: /* alter_db_options ::= alter_db_option */ -{ yylhsminor.yy176 = createDefaultAlterDatabaseOptions(pCxt); yylhsminor.yy176 = setDatabaseOption(pCxt, yylhsminor.yy176, yymsp[0].minor.yy325.type, &yymsp[0].minor.yy325.val); } - yymsp[0].minor.yy176 = yylhsminor.yy176; +{ yylhsminor.yy364 = createDefaultAlterDatabaseOptions(pCxt); yylhsminor.yy364 = setDatabaseOption(pCxt, yylhsminor.yy364, yymsp[0].minor.yy29.type, &yymsp[0].minor.yy29.val); } + yymsp[0].minor.yy364 = yylhsminor.yy364; break; case 71: /* alter_db_options ::= alter_db_options alter_db_option */ -{ yylhsminor.yy176 = setDatabaseOption(pCxt, yymsp[-1].minor.yy176, yymsp[0].minor.yy325.type, &yymsp[0].minor.yy325.val); } - yymsp[-1].minor.yy176 = yylhsminor.yy176; +{ yylhsminor.yy364 = setDatabaseOption(pCxt, yymsp[-1].minor.yy364, yymsp[0].minor.yy29.type, &yymsp[0].minor.yy29.val); } + yymsp[-1].minor.yy364 = yylhsminor.yy364; break; case 72: /* alter_db_option ::= BLOCKS NK_INTEGER */ -{ yymsp[-1].minor.yy325.type = DB_OPTION_BLOCKS; yymsp[-1].minor.yy325.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy29.type = DB_OPTION_BLOCKS; yymsp[-1].minor.yy29.val = yymsp[0].minor.yy0; } break; case 73: /* alter_db_option ::= FSYNC NK_INTEGER */ -{ yymsp[-1].minor.yy325.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy325.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy29.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy29.val = yymsp[0].minor.yy0; } break; case 74: /* alter_db_option ::= KEEP NK_INTEGER */ -{ yymsp[-1].minor.yy325.type = DB_OPTION_KEEP; yymsp[-1].minor.yy325.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy29.type = DB_OPTION_KEEP; yymsp[-1].minor.yy29.val = yymsp[0].minor.yy0; } break; case 75: /* alter_db_option ::= WAL NK_INTEGER */ -{ yymsp[-1].minor.yy325.type = DB_OPTION_WAL; yymsp[-1].minor.yy325.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy29.type = DB_OPTION_WAL; yymsp[-1].minor.yy29.val = yymsp[0].minor.yy0; } break; case 76: /* alter_db_option ::= QUORUM NK_INTEGER */ -{ yymsp[-1].minor.yy325.type = DB_OPTION_QUORUM; yymsp[-1].minor.yy325.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy29.type = DB_OPTION_QUORUM; yymsp[-1].minor.yy29.val = yymsp[0].minor.yy0; } break; case 77: /* alter_db_option ::= CACHELAST NK_INTEGER */ -{ yymsp[-1].minor.yy325.type = DB_OPTION_CACHELAST; yymsp[-1].minor.yy325.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy29.type = DB_OPTION_CACHELAST; yymsp[-1].minor.yy29.val = yymsp[0].minor.yy0; } break; case 78: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ case 80: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==80); -{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy505, yymsp[-5].minor.yy176, yymsp[-3].minor.yy512, yymsp[-1].minor.yy512, yymsp[0].minor.yy176); } +{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy493, yymsp[-5].minor.yy364, yymsp[-3].minor.yy40, yymsp[-1].minor.yy40, yymsp[0].minor.yy364); } break; case 79: /* cmd ::= CREATE TABLE multi_create_clause */ -{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy512); } +{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy40); } break; case 81: /* cmd ::= DROP TABLE multi_drop_clause */ -{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy512); } +{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy40); } break; case 82: /* cmd ::= DROP STABLE exists_opt full_table_name */ -{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy505, yymsp[0].minor.yy176); } +{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy493, yymsp[0].minor.yy364); } break; case 83: /* cmd ::= ALTER TABLE alter_table_clause */ case 84: /* cmd ::= ALTER STABLE alter_table_clause */ yytestcase(yyruleno==84); - case 185: /* cmd ::= query_expression */ yytestcase(yyruleno==185); -{ pCxt->pRootNode = yymsp[0].minor.yy176; } + case 191: /* cmd ::= query_expression */ yytestcase(yyruleno==191); +{ pCxt->pRootNode = yymsp[0].minor.yy364; } break; case 85: /* alter_table_clause ::= full_table_name alter_table_options */ -{ yylhsminor.yy176 = createAlterTableOption(pCxt, yymsp[-1].minor.yy176, yymsp[0].minor.yy176); } - yymsp[-1].minor.yy176 = yylhsminor.yy176; +{ yylhsminor.yy364 = createAlterTableOption(pCxt, yymsp[-1].minor.yy364, yymsp[0].minor.yy364); } + yymsp[-1].minor.yy364 = yylhsminor.yy364; break; case 86: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ -{ yylhsminor.yy176 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy176, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy225, yymsp[0].minor.yy448); } - yymsp[-4].minor.yy176 = yylhsminor.yy176; +{ yylhsminor.yy364 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy364, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy437, yymsp[0].minor.yy420); } + yymsp[-4].minor.yy364 = yylhsminor.yy364; break; case 87: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ -{ yylhsminor.yy176 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy176, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy225); } - yymsp[-3].minor.yy176 = yylhsminor.yy176; +{ yylhsminor.yy364 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy364, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy437); } + yymsp[-3].minor.yy364 = yylhsminor.yy364; break; case 88: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ -{ yylhsminor.yy176 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy176, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy225, yymsp[0].minor.yy448); } - yymsp[-4].minor.yy176 = yylhsminor.yy176; +{ yylhsminor.yy364 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy364, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy437, yymsp[0].minor.yy420); } + yymsp[-4].minor.yy364 = yylhsminor.yy364; break; case 89: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ -{ yylhsminor.yy176 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy176, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy225, &yymsp[0].minor.yy225); } - yymsp[-4].minor.yy176 = yylhsminor.yy176; +{ yylhsminor.yy364 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy364, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy437, &yymsp[0].minor.yy437); } + yymsp[-4].minor.yy364 = yylhsminor.yy364; break; case 90: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ -{ yylhsminor.yy176 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy176, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy225, yymsp[0].minor.yy448); } - yymsp[-4].minor.yy176 = yylhsminor.yy176; +{ yylhsminor.yy364 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy364, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy437, yymsp[0].minor.yy420); } + yymsp[-4].minor.yy364 = yylhsminor.yy364; break; case 91: /* alter_table_clause ::= full_table_name DROP TAG column_name */ -{ yylhsminor.yy176 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy176, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy225); } - yymsp[-3].minor.yy176 = yylhsminor.yy176; +{ yylhsminor.yy364 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy364, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy437); } + yymsp[-3].minor.yy364 = yylhsminor.yy364; break; case 92: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ -{ yylhsminor.yy176 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy176, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy225, yymsp[0].minor.yy448); } - yymsp[-4].minor.yy176 = yylhsminor.yy176; +{ yylhsminor.yy364 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy364, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy437, yymsp[0].minor.yy420); } + yymsp[-4].minor.yy364 = yylhsminor.yy364; break; case 93: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ -{ yylhsminor.yy176 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy176, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy225, &yymsp[0].minor.yy225); } - yymsp[-4].minor.yy176 = yylhsminor.yy176; +{ yylhsminor.yy364 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy364, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy437, &yymsp[0].minor.yy437); } + yymsp[-4].minor.yy364 = yylhsminor.yy364; break; case 94: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ literal */ -{ yylhsminor.yy176 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy176, &yymsp[-2].minor.yy225, yymsp[0].minor.yy176); } - yymsp[-5].minor.yy176 = yylhsminor.yy176; +{ yylhsminor.yy364 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy364, &yymsp[-2].minor.yy437, yymsp[0].minor.yy364); } + yymsp[-5].minor.yy364 = yylhsminor.yy364; break; case 95: /* multi_create_clause ::= create_subtable_clause */ case 98: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==98); @@ -2635,187 +2659,187 @@ static YYACTIONTYPE yy_reduce( case 148: /* col_name_list ::= col_name */ yytestcase(yyruleno==148); case 170: /* func_name_list ::= func_name */ yytestcase(yyruleno==170); case 179: /* func_list ::= func */ yytestcase(yyruleno==179); - case 206: /* literal_list ::= signed_literal */ yytestcase(yyruleno==206); - case 292: /* select_sublist ::= select_item */ yytestcase(yyruleno==292); - case 339: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==339); -{ yylhsminor.yy512 = createNodeList(pCxt, yymsp[0].minor.yy176); } - yymsp[0].minor.yy512 = yylhsminor.yy512; + case 212: /* literal_list ::= signed_literal */ yytestcase(yyruleno==212); + case 298: /* select_sublist ::= select_item */ yytestcase(yyruleno==298); + case 345: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==345); +{ yylhsminor.yy40 = createNodeList(pCxt, yymsp[0].minor.yy364); } + yymsp[0].minor.yy40 = yylhsminor.yy40; break; case 96: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ case 99: /* multi_drop_clause ::= multi_drop_clause drop_table_clause */ yytestcase(yyruleno==99); -{ yylhsminor.yy512 = addNodeToList(pCxt, yymsp[-1].minor.yy512, yymsp[0].minor.yy176); } - yymsp[-1].minor.yy512 = yylhsminor.yy512; +{ yylhsminor.yy40 = addNodeToList(pCxt, yymsp[-1].minor.yy40, yymsp[0].minor.yy364); } + yymsp[-1].minor.yy40 = yylhsminor.yy40; break; case 97: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP */ -{ yylhsminor.yy176 = createCreateSubTableClause(pCxt, yymsp[-8].minor.yy505, yymsp[-7].minor.yy176, yymsp[-5].minor.yy176, yymsp[-4].minor.yy512, yymsp[-1].minor.yy512); } - yymsp[-8].minor.yy176 = yylhsminor.yy176; +{ yylhsminor.yy364 = createCreateSubTableClause(pCxt, yymsp[-8].minor.yy493, yymsp[-7].minor.yy364, yymsp[-5].minor.yy364, yymsp[-4].minor.yy40, yymsp[-1].minor.yy40); } + yymsp[-8].minor.yy364 = yylhsminor.yy364; break; case 100: /* drop_table_clause ::= exists_opt full_table_name */ -{ yylhsminor.yy176 = createDropTableClause(pCxt, yymsp[-1].minor.yy505, yymsp[0].minor.yy176); } - yymsp[-1].minor.yy176 = yylhsminor.yy176; +{ yylhsminor.yy364 = createDropTableClause(pCxt, yymsp[-1].minor.yy493, yymsp[0].minor.yy364); } + yymsp[-1].minor.yy364 = yylhsminor.yy364; break; case 101: /* specific_tags_opt ::= */ case 132: /* tags_def_opt ::= */ yytestcase(yyruleno==132); - case 300: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==300); - case 317: /* group_by_clause_opt ::= */ yytestcase(yyruleno==317); - case 327: /* order_by_clause_opt ::= */ yytestcase(yyruleno==327); -{ yymsp[1].minor.yy512 = NULL; } + case 306: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==306); + case 323: /* group_by_clause_opt ::= */ yytestcase(yyruleno==323); + case 333: /* order_by_clause_opt ::= */ yytestcase(yyruleno==333); +{ yymsp[1].minor.yy40 = NULL; } break; case 102: /* specific_tags_opt ::= NK_LP col_name_list NK_RP */ -{ yymsp[-2].minor.yy512 = yymsp[-1].minor.yy512; } +{ yymsp[-2].minor.yy40 = yymsp[-1].minor.yy40; } break; case 103: /* full_table_name ::= table_name */ -{ yylhsminor.yy176 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy225, NULL); } - yymsp[0].minor.yy176 = yylhsminor.yy176; +{ yylhsminor.yy364 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy437, NULL); } + yymsp[0].minor.yy364 = yylhsminor.yy364; break; case 104: /* full_table_name ::= db_name NK_DOT table_name */ -{ yylhsminor.yy176 = createRealTableNode(pCxt, &yymsp[-2].minor.yy225, &yymsp[0].minor.yy225, NULL); } - yymsp[-2].minor.yy176 = yylhsminor.yy176; +{ yylhsminor.yy364 = createRealTableNode(pCxt, &yymsp[-2].minor.yy437, &yymsp[0].minor.yy437, NULL); } + yymsp[-2].minor.yy364 = yylhsminor.yy364; break; case 106: /* column_def_list ::= column_def_list NK_COMMA column_def */ case 149: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==149); case 171: /* func_name_list ::= func_name_list NK_COMMA col_name */ yytestcase(yyruleno==171); case 180: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==180); - case 207: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==207); - case 293: /* select_sublist ::= select_sublist NK_COMMA select_item */ yytestcase(yyruleno==293); - case 340: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==340); -{ yylhsminor.yy512 = addNodeToList(pCxt, yymsp[-2].minor.yy512, yymsp[0].minor.yy176); } - yymsp[-2].minor.yy512 = yylhsminor.yy512; + case 213: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==213); + case 299: /* select_sublist ::= select_sublist NK_COMMA select_item */ yytestcase(yyruleno==299); + case 346: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==346); +{ yylhsminor.yy40 = addNodeToList(pCxt, yymsp[-2].minor.yy40, yymsp[0].minor.yy364); } + yymsp[-2].minor.yy40 = yylhsminor.yy40; break; case 107: /* column_def ::= column_name type_name */ -{ yylhsminor.yy176 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy225, yymsp[0].minor.yy448, NULL); } - yymsp[-1].minor.yy176 = yylhsminor.yy176; +{ yylhsminor.yy364 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy437, yymsp[0].minor.yy420, NULL); } + yymsp[-1].minor.yy364 = yylhsminor.yy364; break; case 108: /* column_def ::= column_name type_name COMMENT NK_STRING */ -{ yylhsminor.yy176 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy225, yymsp[-2].minor.yy448, &yymsp[0].minor.yy0); } - yymsp[-3].minor.yy176 = yylhsminor.yy176; +{ yylhsminor.yy364 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy437, yymsp[-2].minor.yy420, &yymsp[0].minor.yy0); } + yymsp[-3].minor.yy364 = yylhsminor.yy364; break; case 109: /* type_name ::= BOOL */ -{ yymsp[0].minor.yy448 = createDataType(TSDB_DATA_TYPE_BOOL); } +{ yymsp[0].minor.yy420 = createDataType(TSDB_DATA_TYPE_BOOL); } break; case 110: /* type_name ::= TINYINT */ -{ yymsp[0].minor.yy448 = createDataType(TSDB_DATA_TYPE_TINYINT); } +{ yymsp[0].minor.yy420 = createDataType(TSDB_DATA_TYPE_TINYINT); } break; case 111: /* type_name ::= SMALLINT */ -{ yymsp[0].minor.yy448 = createDataType(TSDB_DATA_TYPE_SMALLINT); } +{ yymsp[0].minor.yy420 = createDataType(TSDB_DATA_TYPE_SMALLINT); } break; case 112: /* type_name ::= INT */ case 113: /* type_name ::= INTEGER */ yytestcase(yyruleno==113); -{ yymsp[0].minor.yy448 = createDataType(TSDB_DATA_TYPE_INT); } +{ yymsp[0].minor.yy420 = createDataType(TSDB_DATA_TYPE_INT); } break; case 114: /* type_name ::= BIGINT */ -{ yymsp[0].minor.yy448 = createDataType(TSDB_DATA_TYPE_BIGINT); } +{ yymsp[0].minor.yy420 = createDataType(TSDB_DATA_TYPE_BIGINT); } break; case 115: /* type_name ::= FLOAT */ -{ yymsp[0].minor.yy448 = createDataType(TSDB_DATA_TYPE_FLOAT); } +{ yymsp[0].minor.yy420 = createDataType(TSDB_DATA_TYPE_FLOAT); } break; case 116: /* type_name ::= DOUBLE */ -{ yymsp[0].minor.yy448 = createDataType(TSDB_DATA_TYPE_DOUBLE); } +{ yymsp[0].minor.yy420 = createDataType(TSDB_DATA_TYPE_DOUBLE); } break; case 117: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy448 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy420 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } break; case 118: /* type_name ::= TIMESTAMP */ -{ yymsp[0].minor.yy448 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } +{ yymsp[0].minor.yy420 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } break; case 119: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy448 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy420 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } break; case 120: /* type_name ::= TINYINT UNSIGNED */ -{ yymsp[-1].minor.yy448 = createDataType(TSDB_DATA_TYPE_UTINYINT); } +{ yymsp[-1].minor.yy420 = createDataType(TSDB_DATA_TYPE_UTINYINT); } break; case 121: /* type_name ::= SMALLINT UNSIGNED */ -{ yymsp[-1].minor.yy448 = createDataType(TSDB_DATA_TYPE_USMALLINT); } +{ yymsp[-1].minor.yy420 = createDataType(TSDB_DATA_TYPE_USMALLINT); } break; case 122: /* type_name ::= INT UNSIGNED */ -{ yymsp[-1].minor.yy448 = createDataType(TSDB_DATA_TYPE_UINT); } +{ yymsp[-1].minor.yy420 = createDataType(TSDB_DATA_TYPE_UINT); } break; case 123: /* type_name ::= BIGINT UNSIGNED */ -{ yymsp[-1].minor.yy448 = createDataType(TSDB_DATA_TYPE_UBIGINT); } +{ yymsp[-1].minor.yy420 = createDataType(TSDB_DATA_TYPE_UBIGINT); } break; case 124: /* type_name ::= JSON */ -{ yymsp[0].minor.yy448 = createDataType(TSDB_DATA_TYPE_JSON); } +{ yymsp[0].minor.yy420 = createDataType(TSDB_DATA_TYPE_JSON); } break; case 125: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy448 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy420 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } break; case 126: /* type_name ::= MEDIUMBLOB */ -{ yymsp[0].minor.yy448 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } +{ yymsp[0].minor.yy420 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } break; case 127: /* type_name ::= BLOB */ -{ yymsp[0].minor.yy448 = createDataType(TSDB_DATA_TYPE_BLOB); } +{ yymsp[0].minor.yy420 = createDataType(TSDB_DATA_TYPE_BLOB); } break; case 128: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy448 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy420 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } break; case 129: /* type_name ::= DECIMAL */ -{ yymsp[0].minor.yy448 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +{ yymsp[0].minor.yy420 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 130: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy448 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +{ yymsp[-3].minor.yy420 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 131: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ -{ yymsp[-5].minor.yy448 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +{ yymsp[-5].minor.yy420 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 133: /* tags_def_opt ::= tags_def */ - case 291: /* select_list ::= select_sublist */ yytestcase(yyruleno==291); -{ yylhsminor.yy512 = yymsp[0].minor.yy512; } - yymsp[0].minor.yy512 = yylhsminor.yy512; + case 297: /* select_list ::= select_sublist */ yytestcase(yyruleno==297); +{ yylhsminor.yy40 = yymsp[0].minor.yy40; } + yymsp[0].minor.yy40 = yylhsminor.yy40; break; case 134: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */ -{ yymsp[-3].minor.yy512 = yymsp[-1].minor.yy512; } +{ yymsp[-3].minor.yy40 = yymsp[-1].minor.yy40; } break; case 135: /* table_options ::= */ -{ yymsp[1].minor.yy176 = createDefaultTableOptions(pCxt); } +{ yymsp[1].minor.yy364 = createDefaultTableOptions(pCxt); } break; case 136: /* table_options ::= table_options COMMENT NK_STRING */ -{ yylhsminor.yy176 = setTableOption(pCxt, yymsp[-2].minor.yy176, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy176 = yylhsminor.yy176; +{ yylhsminor.yy364 = setTableOption(pCxt, yymsp[-2].minor.yy364, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy364 = yylhsminor.yy364; break; case 137: /* table_options ::= table_options KEEP NK_INTEGER */ -{ yylhsminor.yy176 = setTableOption(pCxt, yymsp[-2].minor.yy176, TABLE_OPTION_KEEP, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy176 = yylhsminor.yy176; +{ yylhsminor.yy364 = setTableOption(pCxt, yymsp[-2].minor.yy364, TABLE_OPTION_KEEP, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy364 = yylhsminor.yy364; break; case 138: /* table_options ::= table_options TTL NK_INTEGER */ -{ yylhsminor.yy176 = setTableOption(pCxt, yymsp[-2].minor.yy176, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy176 = yylhsminor.yy176; +{ yylhsminor.yy364 = setTableOption(pCxt, yymsp[-2].minor.yy364, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy364 = yylhsminor.yy364; break; case 139: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ -{ yylhsminor.yy176 = setTableSmaOption(pCxt, yymsp[-4].minor.yy176, yymsp[-1].minor.yy512); } - yymsp[-4].minor.yy176 = yylhsminor.yy176; +{ yylhsminor.yy364 = setTableSmaOption(pCxt, yymsp[-4].minor.yy364, yymsp[-1].minor.yy40); } + yymsp[-4].minor.yy364 = yylhsminor.yy364; break; case 140: /* table_options ::= table_options ROLLUP NK_LP func_name_list NK_RP */ -{ yylhsminor.yy176 = setTableRollupOption(pCxt, yymsp[-4].minor.yy176, yymsp[-1].minor.yy512); } - yymsp[-4].minor.yy176 = yylhsminor.yy176; +{ yylhsminor.yy364 = setTableRollupOption(pCxt, yymsp[-4].minor.yy364, yymsp[-1].minor.yy40); } + yymsp[-4].minor.yy364 = yylhsminor.yy364; break; case 141: /* table_options ::= table_options FILE_FACTOR NK_FLOAT */ -{ yylhsminor.yy176 = setTableOption(pCxt, yymsp[-2].minor.yy176, TABLE_OPTION_FILE_FACTOR, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy176 = yylhsminor.yy176; +{ yylhsminor.yy364 = setTableOption(pCxt, yymsp[-2].minor.yy364, TABLE_OPTION_FILE_FACTOR, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy364 = yylhsminor.yy364; break; case 142: /* table_options ::= table_options DELAY NK_INTEGER */ -{ yylhsminor.yy176 = setTableOption(pCxt, yymsp[-2].minor.yy176, TABLE_OPTION_DELAY, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy176 = yylhsminor.yy176; +{ yylhsminor.yy364 = setTableOption(pCxt, yymsp[-2].minor.yy364, TABLE_OPTION_DELAY, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy364 = yylhsminor.yy364; break; case 143: /* alter_table_options ::= alter_table_option */ -{ yylhsminor.yy176 = createDefaultAlterTableOptions(pCxt); yylhsminor.yy176 = setTableOption(pCxt, yylhsminor.yy176, yymsp[0].minor.yy325.type, &yymsp[0].minor.yy325.val); } - yymsp[0].minor.yy176 = yylhsminor.yy176; +{ yylhsminor.yy364 = createDefaultAlterTableOptions(pCxt); yylhsminor.yy364 = setTableOption(pCxt, yylhsminor.yy364, yymsp[0].minor.yy29.type, &yymsp[0].minor.yy29.val); } + yymsp[0].minor.yy364 = yylhsminor.yy364; break; case 144: /* alter_table_options ::= alter_table_options alter_table_option */ -{ yylhsminor.yy176 = setTableOption(pCxt, yymsp[-1].minor.yy176, yymsp[0].minor.yy325.type, &yymsp[0].minor.yy325.val); } - yymsp[-1].minor.yy176 = yylhsminor.yy176; +{ yylhsminor.yy364 = setTableOption(pCxt, yymsp[-1].minor.yy364, yymsp[0].minor.yy29.type, &yymsp[0].minor.yy29.val); } + yymsp[-1].minor.yy364 = yylhsminor.yy364; break; case 145: /* alter_table_option ::= COMMENT NK_STRING */ -{ yymsp[-1].minor.yy325.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy325.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy29.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy29.val = yymsp[0].minor.yy0; } break; case 146: /* alter_table_option ::= KEEP NK_INTEGER */ -{ yymsp[-1].minor.yy325.type = TABLE_OPTION_KEEP; yymsp[-1].minor.yy325.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy29.type = TABLE_OPTION_KEEP; yymsp[-1].minor.yy29.val = yymsp[0].minor.yy0; } break; case 147: /* alter_table_option ::= TTL NK_INTEGER */ -{ yymsp[-1].minor.yy325.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy325.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy29.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy29.val = yymsp[0].minor.yy0; } break; case 150: /* col_name ::= column_name */ -{ yylhsminor.yy176 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy225); } - yymsp[0].minor.yy176 = yylhsminor.yy176; +{ yylhsminor.yy364 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy437); } + yymsp[0].minor.yy364 = yylhsminor.yy364; break; case 151: /* cmd ::= SHOW DNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT, NULL, NULL); } @@ -2827,13 +2851,13 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT, NULL, NULL); } break; case 154: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy176, yymsp[0].minor.yy176); } +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy364, yymsp[0].minor.yy364); } break; case 155: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy176, yymsp[0].minor.yy176); } +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy364, yymsp[0].minor.yy364); } break; case 156: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy176, NULL); } +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy364, NULL); } break; case 157: /* cmd ::= SHOW MNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT, NULL, NULL); } @@ -2848,551 +2872,566 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT, NULL, NULL); } break; case 161: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[-1].minor.yy176, yymsp[0].minor.yy176); } +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[-1].minor.yy364, yymsp[0].minor.yy364); } break; case 162: /* cmd ::= SHOW STREAMS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT, NULL, NULL); } break; case 163: /* db_name_cond_opt ::= */ case 168: /* from_db_opt ::= */ yytestcase(yyruleno==168); -{ yymsp[1].minor.yy176 = createDefaultDatabaseCondValue(pCxt); } +{ yymsp[1].minor.yy364 = createDefaultDatabaseCondValue(pCxt); } break; case 164: /* db_name_cond_opt ::= db_name NK_DOT */ -{ yylhsminor.yy176 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy225); } - yymsp[-1].minor.yy176 = yylhsminor.yy176; +{ yylhsminor.yy364 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy437); } + yymsp[-1].minor.yy364 = yylhsminor.yy364; break; case 165: /* like_pattern_opt ::= */ case 176: /* index_options ::= */ yytestcase(yyruleno==176); - case 298: /* where_clause_opt ::= */ yytestcase(yyruleno==298); - case 302: /* twindow_clause_opt ::= */ yytestcase(yyruleno==302); - case 307: /* sliding_opt ::= */ yytestcase(yyruleno==307); - case 309: /* fill_opt ::= */ yytestcase(yyruleno==309); - case 321: /* having_clause_opt ::= */ yytestcase(yyruleno==321); - case 329: /* slimit_clause_opt ::= */ yytestcase(yyruleno==329); - case 333: /* limit_clause_opt ::= */ yytestcase(yyruleno==333); -{ yymsp[1].minor.yy176 = NULL; } + case 304: /* where_clause_opt ::= */ yytestcase(yyruleno==304); + case 308: /* twindow_clause_opt ::= */ yytestcase(yyruleno==308); + case 313: /* sliding_opt ::= */ yytestcase(yyruleno==313); + case 315: /* fill_opt ::= */ yytestcase(yyruleno==315); + case 327: /* having_clause_opt ::= */ yytestcase(yyruleno==327); + case 335: /* slimit_clause_opt ::= */ yytestcase(yyruleno==335); + case 339: /* limit_clause_opt ::= */ yytestcase(yyruleno==339); +{ yymsp[1].minor.yy364 = NULL; } break; case 166: /* like_pattern_opt ::= LIKE NK_STRING */ -{ yymsp[-1].minor.yy176 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } +{ yymsp[-1].minor.yy364 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } break; case 167: /* table_name_cond ::= table_name */ -{ yylhsminor.yy176 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy225); } - yymsp[0].minor.yy176 = yylhsminor.yy176; +{ yylhsminor.yy364 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy437); } + yymsp[0].minor.yy364 = yylhsminor.yy364; break; case 169: /* from_db_opt ::= FROM db_name */ -{ yymsp[-1].minor.yy176 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy225); } +{ yymsp[-1].minor.yy364 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy437); } break; case 172: /* func_name ::= function_name */ -{ yylhsminor.yy176 = createFunctionNode(pCxt, &yymsp[0].minor.yy225, NULL); } - yymsp[0].minor.yy176 = yylhsminor.yy176; +{ yylhsminor.yy364 = createFunctionNode(pCxt, &yymsp[0].minor.yy437, NULL); } + yymsp[0].minor.yy364 = yylhsminor.yy364; break; case 173: /* cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ -{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy505, &yymsp[-3].minor.yy225, &yymsp[-1].minor.yy225, NULL, yymsp[0].minor.yy176); } +{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy493, &yymsp[-3].minor.yy437, &yymsp[-1].minor.yy437, NULL, yymsp[0].minor.yy364); } break; case 174: /* cmd ::= CREATE FULLTEXT INDEX not_exists_opt index_name ON table_name NK_LP col_name_list NK_RP */ -{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_FULLTEXT, yymsp[-6].minor.yy505, &yymsp[-5].minor.yy225, &yymsp[-3].minor.yy225, yymsp[-1].minor.yy512, NULL); } +{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_FULLTEXT, yymsp[-6].minor.yy493, &yymsp[-5].minor.yy437, &yymsp[-3].minor.yy437, yymsp[-1].minor.yy40, NULL); } break; case 175: /* cmd ::= DROP INDEX exists_opt index_name ON table_name */ -{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-3].minor.yy505, &yymsp[-2].minor.yy225, &yymsp[0].minor.yy225); } +{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-3].minor.yy493, &yymsp[-2].minor.yy437, &yymsp[0].minor.yy437); } break; case 177: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt */ -{ yymsp[-8].minor.yy176 = createIndexOption(pCxt, yymsp[-6].minor.yy512, releaseRawExprNode(pCxt, yymsp[-2].minor.yy176), NULL, yymsp[0].minor.yy176); } +{ yymsp[-8].minor.yy364 = createIndexOption(pCxt, yymsp[-6].minor.yy40, releaseRawExprNode(pCxt, yymsp[-2].minor.yy364), NULL, yymsp[0].minor.yy364); } break; case 178: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt */ -{ yymsp[-10].minor.yy176 = createIndexOption(pCxt, yymsp[-8].minor.yy512, releaseRawExprNode(pCxt, yymsp[-4].minor.yy176), releaseRawExprNode(pCxt, yymsp[-2].minor.yy176), yymsp[0].minor.yy176); } +{ yymsp[-10].minor.yy364 = createIndexOption(pCxt, yymsp[-8].minor.yy40, releaseRawExprNode(pCxt, yymsp[-4].minor.yy364), releaseRawExprNode(pCxt, yymsp[-2].minor.yy364), yymsp[0].minor.yy364); } break; case 181: /* func ::= function_name NK_LP expression_list NK_RP */ -{ yylhsminor.yy176 = createFunctionNode(pCxt, &yymsp[-3].minor.yy225, yymsp[-1].minor.yy512); } - yymsp[-3].minor.yy176 = yylhsminor.yy176; +{ yylhsminor.yy364 = createFunctionNode(pCxt, &yymsp[-3].minor.yy437, yymsp[-1].minor.yy40); } + yymsp[-3].minor.yy364 = yylhsminor.yy364; break; case 182: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ -{ pCxt->pRootNode = createCreateTopicStmt(pCxt, yymsp[-3].minor.yy505, &yymsp[-2].minor.yy225, yymsp[0].minor.yy176, NULL); } +{ pCxt->pRootNode = createCreateTopicStmt(pCxt, yymsp[-3].minor.yy493, &yymsp[-2].minor.yy437, yymsp[0].minor.yy364, NULL); } break; case 183: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS db_name */ -{ pCxt->pRootNode = createCreateTopicStmt(pCxt, yymsp[-3].minor.yy505, &yymsp[-2].minor.yy225, NULL, &yymsp[0].minor.yy225); } +{ pCxt->pRootNode = createCreateTopicStmt(pCxt, yymsp[-3].minor.yy493, &yymsp[-2].minor.yy437, NULL, &yymsp[0].minor.yy437); } break; case 184: /* cmd ::= DROP TOPIC exists_opt topic_name */ -{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy505, &yymsp[0].minor.yy225); } +{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy493, &yymsp[0].minor.yy437); } break; - case 186: /* literal ::= NK_INTEGER */ -{ yylhsminor.yy176 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy176 = yylhsminor.yy176; + case 185: /* cmd ::= EXPLAIN analyze_opt explain_options query_expression */ +{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy493, yymsp[-1].minor.yy364, yymsp[0].minor.yy364); } break; - case 187: /* literal ::= NK_FLOAT */ -{ yylhsminor.yy176 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy176 = yylhsminor.yy176; + case 187: /* analyze_opt ::= ANALYZE */ + case 294: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==294); +{ yymsp[0].minor.yy493 = true; } break; - case 188: /* literal ::= NK_STRING */ -{ yylhsminor.yy176 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy176 = yylhsminor.yy176; + case 188: /* explain_options ::= */ +{ yymsp[1].minor.yy364 = createDefaultExplainOptions(pCxt); } break; - case 189: /* literal ::= NK_BOOL */ -{ yylhsminor.yy176 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy176 = yylhsminor.yy176; + case 189: /* explain_options ::= explain_options VERBOSE NK_BOOL */ +{ yylhsminor.yy364 = setExplainVerbose(pCxt, yymsp[-2].minor.yy364, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy364 = yylhsminor.yy364; break; - case 190: /* literal ::= TIMESTAMP NK_STRING */ -{ yylhsminor.yy176 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } - yymsp[-1].minor.yy176 = yylhsminor.yy176; + case 190: /* explain_options ::= explain_options RATIO NK_FLOAT */ +{ yylhsminor.yy364 = setExplainRatio(pCxt, yymsp[-2].minor.yy364, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy364 = yylhsminor.yy364; break; - case 191: /* literal ::= duration_literal */ - case 200: /* signed_literal ::= signed */ yytestcase(yyruleno==200); - case 217: /* expression ::= literal */ yytestcase(yyruleno==217); - case 218: /* expression ::= pseudo_column */ yytestcase(yyruleno==218); - case 219: /* expression ::= column_reference */ yytestcase(yyruleno==219); - case 222: /* expression ::= subquery */ yytestcase(yyruleno==222); - case 261: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==261); - case 265: /* boolean_primary ::= predicate */ yytestcase(yyruleno==265); - case 267: /* common_expression ::= expression */ yytestcase(yyruleno==267); - case 268: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==268); - case 270: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==270); - case 272: /* table_reference ::= table_primary */ yytestcase(yyruleno==272); - case 273: /* table_reference ::= joined_table */ yytestcase(yyruleno==273); - case 277: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==277); - case 324: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==324); - case 326: /* query_primary ::= query_specification */ yytestcase(yyruleno==326); -{ yylhsminor.yy176 = yymsp[0].minor.yy176; } - yymsp[0].minor.yy176 = yylhsminor.yy176; + case 192: /* literal ::= NK_INTEGER */ +{ yylhsminor.yy364 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy364 = yylhsminor.yy364; break; - case 192: /* literal ::= NULL */ -{ yylhsminor.yy176 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, NULL)); } - yymsp[0].minor.yy176 = yylhsminor.yy176; + case 193: /* literal ::= NK_FLOAT */ +{ yylhsminor.yy364 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy364 = yylhsminor.yy364; break; - case 193: /* duration_literal ::= NK_VARIABLE */ -{ yylhsminor.yy176 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy176 = yylhsminor.yy176; + case 194: /* literal ::= NK_STRING */ +{ yylhsminor.yy364 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy364 = yylhsminor.yy364; break; - case 194: /* signed ::= NK_INTEGER */ -{ yylhsminor.yy176 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy176 = yylhsminor.yy176; + case 195: /* literal ::= NK_BOOL */ +{ yylhsminor.yy364 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy364 = yylhsminor.yy364; break; - case 195: /* signed ::= NK_PLUS NK_INTEGER */ -{ yymsp[-1].minor.yy176 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } + case 196: /* literal ::= TIMESTAMP NK_STRING */ +{ yylhsminor.yy364 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } + yymsp[-1].minor.yy364 = yylhsminor.yy364; break; - case 196: /* signed ::= NK_MINUS NK_INTEGER */ + case 197: /* literal ::= duration_literal */ + case 206: /* signed_literal ::= signed */ yytestcase(yyruleno==206); + case 223: /* expression ::= literal */ yytestcase(yyruleno==223); + case 224: /* expression ::= pseudo_column */ yytestcase(yyruleno==224); + case 225: /* expression ::= column_reference */ yytestcase(yyruleno==225); + case 228: /* expression ::= subquery */ yytestcase(yyruleno==228); + case 267: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==267); + case 271: /* boolean_primary ::= predicate */ yytestcase(yyruleno==271); + case 273: /* common_expression ::= expression */ yytestcase(yyruleno==273); + case 274: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==274); + case 276: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==276); + case 278: /* table_reference ::= table_primary */ yytestcase(yyruleno==278); + case 279: /* table_reference ::= joined_table */ yytestcase(yyruleno==279); + case 283: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==283); + case 330: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==330); + case 332: /* query_primary ::= query_specification */ yytestcase(yyruleno==332); +{ yylhsminor.yy364 = yymsp[0].minor.yy364; } + yymsp[0].minor.yy364 = yylhsminor.yy364; + break; + case 198: /* literal ::= NULL */ +{ yylhsminor.yy364 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, NULL)); } + yymsp[0].minor.yy364 = yylhsminor.yy364; + break; + case 199: /* duration_literal ::= NK_VARIABLE */ +{ yylhsminor.yy364 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy364 = yylhsminor.yy364; + break; + case 200: /* signed ::= NK_INTEGER */ +{ yylhsminor.yy364 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy364 = yylhsminor.yy364; + break; + case 201: /* signed ::= NK_PLUS NK_INTEGER */ +{ yymsp[-1].minor.yy364 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } + break; + case 202: /* signed ::= NK_MINUS NK_INTEGER */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy176 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); + yylhsminor.yy364 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); } - yymsp[-1].minor.yy176 = yylhsminor.yy176; + yymsp[-1].minor.yy364 = yylhsminor.yy364; break; - case 197: /* signed ::= NK_FLOAT */ -{ yylhsminor.yy176 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy176 = yylhsminor.yy176; + case 203: /* signed ::= NK_FLOAT */ +{ yylhsminor.yy364 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy364 = yylhsminor.yy364; break; - case 198: /* signed ::= NK_PLUS NK_FLOAT */ -{ yymsp[-1].minor.yy176 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + case 204: /* signed ::= NK_PLUS NK_FLOAT */ +{ yymsp[-1].minor.yy364 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } break; - case 199: /* signed ::= NK_MINUS NK_FLOAT */ + case 205: /* signed ::= NK_MINUS NK_FLOAT */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy176 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); + yylhsminor.yy364 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); } - yymsp[-1].minor.yy176 = yylhsminor.yy176; + yymsp[-1].minor.yy364 = yylhsminor.yy364; break; - case 201: /* signed_literal ::= NK_STRING */ -{ yylhsminor.yy176 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy176 = yylhsminor.yy176; + case 207: /* signed_literal ::= NK_STRING */ +{ yylhsminor.yy364 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy364 = yylhsminor.yy364; break; - case 202: /* signed_literal ::= NK_BOOL */ -{ yylhsminor.yy176 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy176 = yylhsminor.yy176; + case 208: /* signed_literal ::= NK_BOOL */ +{ yylhsminor.yy364 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy364 = yylhsminor.yy364; break; - case 203: /* signed_literal ::= TIMESTAMP NK_STRING */ -{ yymsp[-1].minor.yy176 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } + case 209: /* signed_literal ::= TIMESTAMP NK_STRING */ +{ yymsp[-1].minor.yy364 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } break; - case 204: /* signed_literal ::= duration_literal */ - case 338: /* search_condition ::= common_expression */ yytestcase(yyruleno==338); -{ yylhsminor.yy176 = releaseRawExprNode(pCxt, yymsp[0].minor.yy176); } - yymsp[0].minor.yy176 = yylhsminor.yy176; + case 210: /* signed_literal ::= duration_literal */ + case 344: /* search_condition ::= common_expression */ yytestcase(yyruleno==344); +{ yylhsminor.yy364 = releaseRawExprNode(pCxt, yymsp[0].minor.yy364); } + yymsp[0].minor.yy364 = yylhsminor.yy364; break; - case 205: /* signed_literal ::= NULL */ -{ yymsp[0].minor.yy176 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, NULL); } + case 211: /* signed_literal ::= NULL */ +{ yymsp[0].minor.yy364 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, NULL); } break; - case 220: /* expression ::= function_name NK_LP expression_list NK_RP */ -{ yylhsminor.yy176 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy225, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy225, yymsp[-1].minor.yy512)); } - yymsp[-3].minor.yy176 = yylhsminor.yy176; + case 226: /* expression ::= function_name NK_LP expression_list NK_RP */ +{ yylhsminor.yy364 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy437, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy437, yymsp[-1].minor.yy40)); } + yymsp[-3].minor.yy364 = yylhsminor.yy364; break; - case 221: /* expression ::= function_name NK_LP NK_STAR NK_RP */ -{ yylhsminor.yy176 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy225, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy225, createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy0)))); } - yymsp[-3].minor.yy176 = yylhsminor.yy176; + case 227: /* expression ::= function_name NK_LP NK_STAR NK_RP */ +{ yylhsminor.yy364 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy437, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy437, createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy0)))); } + yymsp[-3].minor.yy364 = yylhsminor.yy364; break; - case 223: /* expression ::= NK_LP expression NK_RP */ - case 266: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==266); -{ yylhsminor.yy176 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy176)); } - yymsp[-2].minor.yy176 = yylhsminor.yy176; + case 229: /* expression ::= NK_LP expression NK_RP */ + case 272: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==272); +{ yylhsminor.yy364 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy364)); } + yymsp[-2].minor.yy364 = yylhsminor.yy364; break; - case 224: /* expression ::= NK_PLUS expression */ + case 230: /* expression ::= NK_PLUS expression */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy176); - yylhsminor.yy176 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy176)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy364); + yylhsminor.yy364 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy364)); } - yymsp[-1].minor.yy176 = yylhsminor.yy176; + yymsp[-1].minor.yy364 = yylhsminor.yy364; break; - case 225: /* expression ::= NK_MINUS expression */ + case 231: /* expression ::= NK_MINUS expression */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy176); - yylhsminor.yy176 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[0].minor.yy176), NULL)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy364); + yylhsminor.yy364 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[0].minor.yy364), NULL)); } - yymsp[-1].minor.yy176 = yylhsminor.yy176; + yymsp[-1].minor.yy364 = yylhsminor.yy364; break; - case 226: /* expression ::= expression NK_PLUS expression */ + case 232: /* expression ::= expression NK_PLUS expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy176); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy176); - yylhsminor.yy176 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy176), releaseRawExprNode(pCxt, yymsp[0].minor.yy176))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy364); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy364); + yylhsminor.yy364 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy364), releaseRawExprNode(pCxt, yymsp[0].minor.yy364))); } - yymsp[-2].minor.yy176 = yylhsminor.yy176; + yymsp[-2].minor.yy364 = yylhsminor.yy364; break; - case 227: /* expression ::= expression NK_MINUS expression */ + case 233: /* expression ::= expression NK_MINUS expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy176); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy176); - yylhsminor.yy176 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy176), releaseRawExprNode(pCxt, yymsp[0].minor.yy176))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy364); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy364); + yylhsminor.yy364 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy364), releaseRawExprNode(pCxt, yymsp[0].minor.yy364))); } - yymsp[-2].minor.yy176 = yylhsminor.yy176; + yymsp[-2].minor.yy364 = yylhsminor.yy364; break; - case 228: /* expression ::= expression NK_STAR expression */ + case 234: /* expression ::= expression NK_STAR expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy176); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy176); - yylhsminor.yy176 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy176), releaseRawExprNode(pCxt, yymsp[0].minor.yy176))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy364); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy364); + yylhsminor.yy364 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy364), releaseRawExprNode(pCxt, yymsp[0].minor.yy364))); } - yymsp[-2].minor.yy176 = yylhsminor.yy176; + yymsp[-2].minor.yy364 = yylhsminor.yy364; break; - case 229: /* expression ::= expression NK_SLASH expression */ + case 235: /* expression ::= expression NK_SLASH expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy176); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy176); - yylhsminor.yy176 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy176), releaseRawExprNode(pCxt, yymsp[0].minor.yy176))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy364); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy364); + yylhsminor.yy364 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy364), releaseRawExprNode(pCxt, yymsp[0].minor.yy364))); } - yymsp[-2].minor.yy176 = yylhsminor.yy176; + yymsp[-2].minor.yy364 = yylhsminor.yy364; break; - case 230: /* expression ::= expression NK_REM expression */ + case 236: /* expression ::= expression NK_REM expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy176); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy176); - yylhsminor.yy176 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MOD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy176), releaseRawExprNode(pCxt, yymsp[0].minor.yy176))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy364); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy364); + yylhsminor.yy364 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MOD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy364), releaseRawExprNode(pCxt, yymsp[0].minor.yy364))); } - yymsp[-2].minor.yy176 = yylhsminor.yy176; + yymsp[-2].minor.yy364 = yylhsminor.yy364; break; - case 231: /* expression_list ::= expression */ -{ yylhsminor.yy512 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy176)); } - yymsp[0].minor.yy512 = yylhsminor.yy512; + case 237: /* expression_list ::= expression */ +{ yylhsminor.yy40 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy364)); } + yymsp[0].minor.yy40 = yylhsminor.yy40; break; - case 232: /* expression_list ::= expression_list NK_COMMA expression */ -{ yylhsminor.yy512 = addNodeToList(pCxt, yymsp[-2].minor.yy512, releaseRawExprNode(pCxt, yymsp[0].minor.yy176)); } - yymsp[-2].minor.yy512 = yylhsminor.yy512; + case 238: /* expression_list ::= expression_list NK_COMMA expression */ +{ yylhsminor.yy40 = addNodeToList(pCxt, yymsp[-2].minor.yy40, releaseRawExprNode(pCxt, yymsp[0].minor.yy364)); } + yymsp[-2].minor.yy40 = yylhsminor.yy40; break; - case 233: /* column_reference ::= column_name */ -{ yylhsminor.yy176 = createRawExprNode(pCxt, &yymsp[0].minor.yy225, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy225)); } - yymsp[0].minor.yy176 = yylhsminor.yy176; + case 239: /* column_reference ::= column_name */ +{ yylhsminor.yy364 = createRawExprNode(pCxt, &yymsp[0].minor.yy437, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy437)); } + yymsp[0].minor.yy364 = yylhsminor.yy364; break; - case 234: /* column_reference ::= table_name NK_DOT column_name */ -{ yylhsminor.yy176 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy225, &yymsp[0].minor.yy225, createColumnNode(pCxt, &yymsp[-2].minor.yy225, &yymsp[0].minor.yy225)); } - yymsp[-2].minor.yy176 = yylhsminor.yy176; + case 240: /* column_reference ::= table_name NK_DOT column_name */ +{ yylhsminor.yy364 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy437, &yymsp[0].minor.yy437, createColumnNode(pCxt, &yymsp[-2].minor.yy437, &yymsp[0].minor.yy437)); } + yymsp[-2].minor.yy364 = yylhsminor.yy364; break; - case 235: /* pseudo_column ::= NK_UNDERLINE ROWTS */ - case 237: /* pseudo_column ::= NK_UNDERLINE QSTARTTS */ yytestcase(yyruleno==237); - case 238: /* pseudo_column ::= NK_UNDERLINE QENDTS */ yytestcase(yyruleno==238); - case 239: /* pseudo_column ::= NK_UNDERLINE WSTARTTS */ yytestcase(yyruleno==239); - case 240: /* pseudo_column ::= NK_UNDERLINE WENDTS */ yytestcase(yyruleno==240); - case 241: /* pseudo_column ::= NK_UNDERLINE WDURATION */ yytestcase(yyruleno==241); + case 241: /* pseudo_column ::= NK_UNDERLINE ROWTS */ + case 243: /* pseudo_column ::= NK_UNDERLINE QSTARTTS */ yytestcase(yyruleno==243); + case 244: /* pseudo_column ::= NK_UNDERLINE QENDTS */ yytestcase(yyruleno==244); + case 245: /* pseudo_column ::= NK_UNDERLINE WSTARTTS */ yytestcase(yyruleno==245); + case 246: /* pseudo_column ::= NK_UNDERLINE WENDTS */ yytestcase(yyruleno==246); + case 247: /* pseudo_column ::= NK_UNDERLINE WDURATION */ yytestcase(yyruleno==247); { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy176 = createRawExprNode(pCxt, &t, createFunctionNode(pCxt, &t, NULL)); + yylhsminor.yy364 = createRawExprNode(pCxt, &t, createFunctionNode(pCxt, &t, NULL)); } - yymsp[-1].minor.yy176 = yylhsminor.yy176; + yymsp[-1].minor.yy364 = yylhsminor.yy364; break; - case 236: /* pseudo_column ::= TBNAME */ -{ yylhsminor.yy176 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } - yymsp[0].minor.yy176 = yylhsminor.yy176; + case 242: /* pseudo_column ::= TBNAME */ +{ yylhsminor.yy364 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } + yymsp[0].minor.yy364 = yylhsminor.yy364; break; - case 242: /* predicate ::= expression compare_op expression */ - case 247: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==247); + case 248: /* predicate ::= expression compare_op expression */ + case 253: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==253); { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy176); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy176); - yylhsminor.yy176 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy404, releaseRawExprNode(pCxt, yymsp[-2].minor.yy176), releaseRawExprNode(pCxt, yymsp[0].minor.yy176))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy364); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy364); + yylhsminor.yy364 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy328, releaseRawExprNode(pCxt, yymsp[-2].minor.yy364), releaseRawExprNode(pCxt, yymsp[0].minor.yy364))); } - yymsp[-2].minor.yy176 = yylhsminor.yy176; + yymsp[-2].minor.yy364 = yylhsminor.yy364; break; - case 243: /* predicate ::= expression BETWEEN expression AND expression */ + case 249: /* predicate ::= expression BETWEEN expression AND expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy176); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy176); - yylhsminor.yy176 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy176), releaseRawExprNode(pCxt, yymsp[-2].minor.yy176), releaseRawExprNode(pCxt, yymsp[0].minor.yy176))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy364); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy364); + yylhsminor.yy364 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy364), releaseRawExprNode(pCxt, yymsp[-2].minor.yy364), releaseRawExprNode(pCxt, yymsp[0].minor.yy364))); } - yymsp[-4].minor.yy176 = yylhsminor.yy176; + yymsp[-4].minor.yy364 = yylhsminor.yy364; break; - case 244: /* predicate ::= expression NOT BETWEEN expression AND expression */ + case 250: /* predicate ::= expression NOT BETWEEN expression AND expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy176); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy176); - yylhsminor.yy176 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy176), releaseRawExprNode(pCxt, yymsp[-5].minor.yy176), releaseRawExprNode(pCxt, yymsp[0].minor.yy176))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy364); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy364); + yylhsminor.yy364 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy364), releaseRawExprNode(pCxt, yymsp[-5].minor.yy364), releaseRawExprNode(pCxt, yymsp[0].minor.yy364))); } - yymsp[-5].minor.yy176 = yylhsminor.yy176; + yymsp[-5].minor.yy364 = yylhsminor.yy364; break; - case 245: /* predicate ::= expression IS NULL */ + case 251: /* predicate ::= expression IS NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy176); - yylhsminor.yy176 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy176), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy364); + yylhsminor.yy364 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy364), NULL)); } - yymsp[-2].minor.yy176 = yylhsminor.yy176; + yymsp[-2].minor.yy364 = yylhsminor.yy364; break; - case 246: /* predicate ::= expression IS NOT NULL */ + case 252: /* predicate ::= expression IS NOT NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy176); - yylhsminor.yy176 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy176), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy364); + yylhsminor.yy364 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy364), NULL)); } - yymsp[-3].minor.yy176 = yylhsminor.yy176; + yymsp[-3].minor.yy364 = yylhsminor.yy364; break; - case 248: /* compare_op ::= NK_LT */ -{ yymsp[0].minor.yy404 = OP_TYPE_LOWER_THAN; } + case 254: /* compare_op ::= NK_LT */ +{ yymsp[0].minor.yy328 = OP_TYPE_LOWER_THAN; } break; - case 249: /* compare_op ::= NK_GT */ -{ yymsp[0].minor.yy404 = OP_TYPE_GREATER_THAN; } + case 255: /* compare_op ::= NK_GT */ +{ yymsp[0].minor.yy328 = OP_TYPE_GREATER_THAN; } break; - case 250: /* compare_op ::= NK_LE */ -{ yymsp[0].minor.yy404 = OP_TYPE_LOWER_EQUAL; } + case 256: /* compare_op ::= NK_LE */ +{ yymsp[0].minor.yy328 = OP_TYPE_LOWER_EQUAL; } break; - case 251: /* compare_op ::= NK_GE */ -{ yymsp[0].minor.yy404 = OP_TYPE_GREATER_EQUAL; } + case 257: /* compare_op ::= NK_GE */ +{ yymsp[0].minor.yy328 = OP_TYPE_GREATER_EQUAL; } break; - case 252: /* compare_op ::= NK_NE */ -{ yymsp[0].minor.yy404 = OP_TYPE_NOT_EQUAL; } + case 258: /* compare_op ::= NK_NE */ +{ yymsp[0].minor.yy328 = OP_TYPE_NOT_EQUAL; } break; - case 253: /* compare_op ::= NK_EQ */ -{ yymsp[0].minor.yy404 = OP_TYPE_EQUAL; } + case 259: /* compare_op ::= NK_EQ */ +{ yymsp[0].minor.yy328 = OP_TYPE_EQUAL; } break; - case 254: /* compare_op ::= LIKE */ -{ yymsp[0].minor.yy404 = OP_TYPE_LIKE; } + case 260: /* compare_op ::= LIKE */ +{ yymsp[0].minor.yy328 = OP_TYPE_LIKE; } break; - case 255: /* compare_op ::= NOT LIKE */ -{ yymsp[-1].minor.yy404 = OP_TYPE_NOT_LIKE; } + case 261: /* compare_op ::= NOT LIKE */ +{ yymsp[-1].minor.yy328 = OP_TYPE_NOT_LIKE; } break; - case 256: /* compare_op ::= MATCH */ -{ yymsp[0].minor.yy404 = OP_TYPE_MATCH; } + case 262: /* compare_op ::= MATCH */ +{ yymsp[0].minor.yy328 = OP_TYPE_MATCH; } break; - case 257: /* compare_op ::= NMATCH */ -{ yymsp[0].minor.yy404 = OP_TYPE_NMATCH; } + case 263: /* compare_op ::= NMATCH */ +{ yymsp[0].minor.yy328 = OP_TYPE_NMATCH; } break; - case 258: /* in_op ::= IN */ -{ yymsp[0].minor.yy404 = OP_TYPE_IN; } + case 264: /* in_op ::= IN */ +{ yymsp[0].minor.yy328 = OP_TYPE_IN; } break; - case 259: /* in_op ::= NOT IN */ -{ yymsp[-1].minor.yy404 = OP_TYPE_NOT_IN; } + case 265: /* in_op ::= NOT IN */ +{ yymsp[-1].minor.yy328 = OP_TYPE_NOT_IN; } break; - case 260: /* in_predicate_value ::= NK_LP expression_list NK_RP */ -{ yylhsminor.yy176 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy512)); } - yymsp[-2].minor.yy176 = yylhsminor.yy176; + case 266: /* in_predicate_value ::= NK_LP expression_list NK_RP */ +{ yylhsminor.yy364 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy40)); } + yymsp[-2].minor.yy364 = yylhsminor.yy364; break; - case 262: /* boolean_value_expression ::= NOT boolean_primary */ + case 268: /* boolean_value_expression ::= NOT boolean_primary */ { - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy176); - yylhsminor.yy176 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy176), NULL)); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy364); + yylhsminor.yy364 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy364), NULL)); } - yymsp[-1].minor.yy176 = yylhsminor.yy176; + yymsp[-1].minor.yy364 = yylhsminor.yy364; break; - case 263: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + case 269: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy176); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy176); - yylhsminor.yy176 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy176), releaseRawExprNode(pCxt, yymsp[0].minor.yy176))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy364); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy364); + yylhsminor.yy364 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy364), releaseRawExprNode(pCxt, yymsp[0].minor.yy364))); } - yymsp[-2].minor.yy176 = yylhsminor.yy176; + yymsp[-2].minor.yy364 = yylhsminor.yy364; break; - case 264: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + case 270: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy176); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy176); - yylhsminor.yy176 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy176), releaseRawExprNode(pCxt, yymsp[0].minor.yy176))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy364); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy364); + yylhsminor.yy364 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy364), releaseRawExprNode(pCxt, yymsp[0].minor.yy364))); } - yymsp[-2].minor.yy176 = yylhsminor.yy176; + yymsp[-2].minor.yy364 = yylhsminor.yy364; break; - case 269: /* from_clause ::= FROM table_reference_list */ - case 299: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==299); - case 322: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==322); -{ yymsp[-1].minor.yy176 = yymsp[0].minor.yy176; } + case 275: /* from_clause ::= FROM table_reference_list */ + case 305: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==305); + case 328: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==328); +{ yymsp[-1].minor.yy364 = yymsp[0].minor.yy364; } break; - case 271: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ -{ yylhsminor.yy176 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy176, yymsp[0].minor.yy176, NULL); } - yymsp[-2].minor.yy176 = yylhsminor.yy176; + case 277: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ +{ yylhsminor.yy364 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy364, yymsp[0].minor.yy364, NULL); } + yymsp[-2].minor.yy364 = yylhsminor.yy364; break; - case 274: /* table_primary ::= table_name alias_opt */ -{ yylhsminor.yy176 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy225, &yymsp[0].minor.yy225); } - yymsp[-1].minor.yy176 = yylhsminor.yy176; + case 280: /* table_primary ::= table_name alias_opt */ +{ yylhsminor.yy364 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy437, &yymsp[0].minor.yy437); } + yymsp[-1].minor.yy364 = yylhsminor.yy364; break; - case 275: /* table_primary ::= db_name NK_DOT table_name alias_opt */ -{ yylhsminor.yy176 = createRealTableNode(pCxt, &yymsp[-3].minor.yy225, &yymsp[-1].minor.yy225, &yymsp[0].minor.yy225); } - yymsp[-3].minor.yy176 = yylhsminor.yy176; + case 281: /* table_primary ::= db_name NK_DOT table_name alias_opt */ +{ yylhsminor.yy364 = createRealTableNode(pCxt, &yymsp[-3].minor.yy437, &yymsp[-1].minor.yy437, &yymsp[0].minor.yy437); } + yymsp[-3].minor.yy364 = yylhsminor.yy364; break; - case 276: /* table_primary ::= subquery alias_opt */ -{ yylhsminor.yy176 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy176), &yymsp[0].minor.yy225); } - yymsp[-1].minor.yy176 = yylhsminor.yy176; + case 282: /* table_primary ::= subquery alias_opt */ +{ yylhsminor.yy364 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy364), &yymsp[0].minor.yy437); } + yymsp[-1].minor.yy364 = yylhsminor.yy364; break; - case 278: /* alias_opt ::= */ -{ yymsp[1].minor.yy225 = nil_token; } + case 284: /* alias_opt ::= */ +{ yymsp[1].minor.yy437 = nil_token; } break; - case 279: /* alias_opt ::= table_alias */ -{ yylhsminor.yy225 = yymsp[0].minor.yy225; } - yymsp[0].minor.yy225 = yylhsminor.yy225; + case 285: /* alias_opt ::= table_alias */ +{ yylhsminor.yy437 = yymsp[0].minor.yy437; } + yymsp[0].minor.yy437 = yylhsminor.yy437; break; - case 280: /* alias_opt ::= AS table_alias */ -{ yymsp[-1].minor.yy225 = yymsp[0].minor.yy225; } + case 286: /* alias_opt ::= AS table_alias */ +{ yymsp[-1].minor.yy437 = yymsp[0].minor.yy437; } break; - case 281: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - case 282: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==282); -{ yymsp[-2].minor.yy176 = yymsp[-1].minor.yy176; } + case 287: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + case 288: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==288); +{ yymsp[-2].minor.yy364 = yymsp[-1].minor.yy364; } break; - case 283: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ -{ yylhsminor.yy176 = createJoinTableNode(pCxt, yymsp[-4].minor.yy236, yymsp[-5].minor.yy176, yymsp[-2].minor.yy176, yymsp[0].minor.yy176); } - yymsp[-5].minor.yy176 = yylhsminor.yy176; + case 289: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ +{ yylhsminor.yy364 = createJoinTableNode(pCxt, yymsp[-4].minor.yy392, yymsp[-5].minor.yy364, yymsp[-2].minor.yy364, yymsp[0].minor.yy364); } + yymsp[-5].minor.yy364 = yylhsminor.yy364; break; - case 284: /* join_type ::= */ -{ yymsp[1].minor.yy236 = JOIN_TYPE_INNER; } + case 290: /* join_type ::= */ +{ yymsp[1].minor.yy392 = JOIN_TYPE_INNER; } break; - case 285: /* join_type ::= INNER */ -{ yymsp[0].minor.yy236 = JOIN_TYPE_INNER; } + case 291: /* join_type ::= INNER */ +{ yymsp[0].minor.yy392 = JOIN_TYPE_INNER; } break; - case 286: /* 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 292: /* 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.yy176 = createSelectStmt(pCxt, yymsp[-7].minor.yy505, yymsp[-6].minor.yy512, yymsp[-5].minor.yy176); - yymsp[-8].minor.yy176 = addWhereClause(pCxt, yymsp[-8].minor.yy176, yymsp[-4].minor.yy176); - yymsp[-8].minor.yy176 = addPartitionByClause(pCxt, yymsp[-8].minor.yy176, yymsp[-3].minor.yy512); - yymsp[-8].minor.yy176 = addWindowClauseClause(pCxt, yymsp[-8].minor.yy176, yymsp[-2].minor.yy176); - yymsp[-8].minor.yy176 = addGroupByClause(pCxt, yymsp[-8].minor.yy176, yymsp[-1].minor.yy512); - yymsp[-8].minor.yy176 = addHavingClause(pCxt, yymsp[-8].minor.yy176, yymsp[0].minor.yy176); + yymsp[-8].minor.yy364 = createSelectStmt(pCxt, yymsp[-7].minor.yy493, yymsp[-6].minor.yy40, yymsp[-5].minor.yy364); + yymsp[-8].minor.yy364 = addWhereClause(pCxt, yymsp[-8].minor.yy364, yymsp[-4].minor.yy364); + yymsp[-8].minor.yy364 = addPartitionByClause(pCxt, yymsp[-8].minor.yy364, yymsp[-3].minor.yy40); + yymsp[-8].minor.yy364 = addWindowClauseClause(pCxt, yymsp[-8].minor.yy364, yymsp[-2].minor.yy364); + yymsp[-8].minor.yy364 = addGroupByClause(pCxt, yymsp[-8].minor.yy364, yymsp[-1].minor.yy40); + yymsp[-8].minor.yy364 = addHavingClause(pCxt, yymsp[-8].minor.yy364, yymsp[0].minor.yy364); } break; - case 288: /* set_quantifier_opt ::= DISTINCT */ -{ yymsp[0].minor.yy505 = true; } + case 295: /* set_quantifier_opt ::= ALL */ +{ yymsp[0].minor.yy493 = false; } break; - case 289: /* set_quantifier_opt ::= ALL */ -{ yymsp[0].minor.yy505 = false; } + case 296: /* select_list ::= NK_STAR */ +{ yymsp[0].minor.yy40 = NULL; } break; - case 290: /* select_list ::= NK_STAR */ -{ yymsp[0].minor.yy512 = NULL; } - break; - case 294: /* select_item ::= common_expression */ + case 300: /* select_item ::= common_expression */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy176); - yylhsminor.yy176 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy176), &t); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy364); + yylhsminor.yy364 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy364), &t); } - yymsp[0].minor.yy176 = yylhsminor.yy176; + yymsp[0].minor.yy364 = yylhsminor.yy364; break; - case 295: /* select_item ::= common_expression column_alias */ -{ yylhsminor.yy176 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy176), &yymsp[0].minor.yy225); } - yymsp[-1].minor.yy176 = yylhsminor.yy176; + case 301: /* select_item ::= common_expression column_alias */ +{ yylhsminor.yy364 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy364), &yymsp[0].minor.yy437); } + yymsp[-1].minor.yy364 = yylhsminor.yy364; break; - case 296: /* select_item ::= common_expression AS column_alias */ -{ yylhsminor.yy176 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy176), &yymsp[0].minor.yy225); } - yymsp[-2].minor.yy176 = yylhsminor.yy176; + case 302: /* select_item ::= common_expression AS column_alias */ +{ yylhsminor.yy364 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy364), &yymsp[0].minor.yy437); } + yymsp[-2].minor.yy364 = yylhsminor.yy364; break; - case 297: /* select_item ::= table_name NK_DOT NK_STAR */ -{ yylhsminor.yy176 = createColumnNode(pCxt, &yymsp[-2].minor.yy225, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy176 = yylhsminor.yy176; + case 303: /* select_item ::= table_name NK_DOT NK_STAR */ +{ yylhsminor.yy364 = createColumnNode(pCxt, &yymsp[-2].minor.yy437, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy364 = yylhsminor.yy364; break; - case 301: /* partition_by_clause_opt ::= PARTITION BY expression_list */ - case 318: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==318); - case 328: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==328); -{ yymsp[-2].minor.yy512 = yymsp[0].minor.yy512; } + case 307: /* partition_by_clause_opt ::= PARTITION BY expression_list */ + case 324: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==324); + case 334: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==334); +{ yymsp[-2].minor.yy40 = yymsp[0].minor.yy40; } break; - case 303: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ -{ yymsp[-5].minor.yy176 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy176), releaseRawExprNode(pCxt, yymsp[-1].minor.yy176)); } + case 309: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ +{ yymsp[-5].minor.yy364 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy364), releaseRawExprNode(pCxt, yymsp[-1].minor.yy364)); } break; - case 304: /* twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP */ -{ yymsp[-3].minor.yy176 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy176)); } + case 310: /* twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP */ +{ yymsp[-3].minor.yy364 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy364)); } break; - case 305: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-5].minor.yy176 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy176), NULL, yymsp[-1].minor.yy176, yymsp[0].minor.yy176); } + case 311: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-5].minor.yy364 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy364), NULL, yymsp[-1].minor.yy364, yymsp[0].minor.yy364); } break; - case 306: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-7].minor.yy176 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy176), releaseRawExprNode(pCxt, yymsp[-3].minor.yy176), yymsp[-1].minor.yy176, yymsp[0].minor.yy176); } + case 312: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-7].minor.yy364 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy364), releaseRawExprNode(pCxt, yymsp[-3].minor.yy364), yymsp[-1].minor.yy364, yymsp[0].minor.yy364); } break; - case 308: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ -{ yymsp[-3].minor.yy176 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy176); } + case 314: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ +{ yymsp[-3].minor.yy364 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy364); } break; - case 310: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ -{ yymsp[-3].minor.yy176 = createFillNode(pCxt, yymsp[-1].minor.yy142, NULL); } + case 316: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ +{ yymsp[-3].minor.yy364 = createFillNode(pCxt, yymsp[-1].minor.yy478, NULL); } break; - case 311: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ -{ yymsp[-5].minor.yy176 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy512)); } + case 317: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ +{ yymsp[-5].minor.yy364 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy40)); } break; - case 312: /* fill_mode ::= NONE */ -{ yymsp[0].minor.yy142 = FILL_MODE_NONE; } + case 318: /* fill_mode ::= NONE */ +{ yymsp[0].minor.yy478 = FILL_MODE_NONE; } break; - case 313: /* fill_mode ::= PREV */ -{ yymsp[0].minor.yy142 = FILL_MODE_PREV; } + case 319: /* fill_mode ::= PREV */ +{ yymsp[0].minor.yy478 = FILL_MODE_PREV; } break; - case 314: /* fill_mode ::= NULL */ -{ yymsp[0].minor.yy142 = FILL_MODE_NULL; } + case 320: /* fill_mode ::= NULL */ +{ yymsp[0].minor.yy478 = FILL_MODE_NULL; } break; - case 315: /* fill_mode ::= LINEAR */ -{ yymsp[0].minor.yy142 = FILL_MODE_LINEAR; } + case 321: /* fill_mode ::= LINEAR */ +{ yymsp[0].minor.yy478 = FILL_MODE_LINEAR; } break; - case 316: /* fill_mode ::= NEXT */ -{ yymsp[0].minor.yy142 = FILL_MODE_NEXT; } + case 322: /* fill_mode ::= NEXT */ +{ yymsp[0].minor.yy478 = FILL_MODE_NEXT; } break; - case 319: /* group_by_list ::= expression */ -{ yylhsminor.yy512 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy176))); } - yymsp[0].minor.yy512 = yylhsminor.yy512; + case 325: /* group_by_list ::= expression */ +{ yylhsminor.yy40 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy364))); } + yymsp[0].minor.yy40 = yylhsminor.yy40; break; - case 320: /* group_by_list ::= group_by_list NK_COMMA expression */ -{ yylhsminor.yy512 = addNodeToList(pCxt, yymsp[-2].minor.yy512, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy176))); } - yymsp[-2].minor.yy512 = yylhsminor.yy512; + case 326: /* group_by_list ::= group_by_list NK_COMMA expression */ +{ yylhsminor.yy40 = addNodeToList(pCxt, yymsp[-2].minor.yy40, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy364))); } + yymsp[-2].minor.yy40 = yylhsminor.yy40; break; - case 323: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ + case 329: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ { - yylhsminor.yy176 = addOrderByClause(pCxt, yymsp[-3].minor.yy176, yymsp[-2].minor.yy512); - yylhsminor.yy176 = addSlimitClause(pCxt, yylhsminor.yy176, yymsp[-1].minor.yy176); - yylhsminor.yy176 = addLimitClause(pCxt, yylhsminor.yy176, yymsp[0].minor.yy176); + yylhsminor.yy364 = addOrderByClause(pCxt, yymsp[-3].minor.yy364, yymsp[-2].minor.yy40); + yylhsminor.yy364 = addSlimitClause(pCxt, yylhsminor.yy364, yymsp[-1].minor.yy364); + yylhsminor.yy364 = addLimitClause(pCxt, yylhsminor.yy364, yymsp[0].minor.yy364); } - yymsp[-3].minor.yy176 = yylhsminor.yy176; + yymsp[-3].minor.yy364 = yylhsminor.yy364; break; - case 325: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */ -{ yylhsminor.yy176 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy176, yymsp[0].minor.yy176); } - yymsp[-3].minor.yy176 = yylhsminor.yy176; + case 331: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */ +{ yylhsminor.yy364 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy364, yymsp[0].minor.yy364); } + yymsp[-3].minor.yy364 = yylhsminor.yy364; break; - case 330: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ - case 334: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==334); -{ yymsp[-1].minor.yy176 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } + case 336: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ + case 340: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==340); +{ yymsp[-1].minor.yy364 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } break; - case 331: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - case 335: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==335); -{ yymsp[-3].minor.yy176 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } + case 337: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + case 341: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==341); +{ yymsp[-3].minor.yy364 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } break; - case 332: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - case 336: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==336); -{ yymsp[-3].minor.yy176 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } + case 338: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + case 342: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==342); +{ yymsp[-3].minor.yy364 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } break; - case 337: /* subquery ::= NK_LP query_expression NK_RP */ -{ yylhsminor.yy176 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy176); } - yymsp[-2].minor.yy176 = yylhsminor.yy176; + case 343: /* subquery ::= NK_LP query_expression NK_RP */ +{ yylhsminor.yy364 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy364); } + yymsp[-2].minor.yy364 = yylhsminor.yy364; break; - case 341: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */ -{ yylhsminor.yy176 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy176), yymsp[-1].minor.yy106, yymsp[0].minor.yy465); } - yymsp[-2].minor.yy176 = yylhsminor.yy176; + case 347: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */ +{ yylhsminor.yy364 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy364), yymsp[-1].minor.yy210, yymsp[0].minor.yy177); } + yymsp[-2].minor.yy364 = yylhsminor.yy364; break; - case 342: /* ordering_specification_opt ::= */ -{ yymsp[1].minor.yy106 = ORDER_ASC; } + case 348: /* ordering_specification_opt ::= */ +{ yymsp[1].minor.yy210 = ORDER_ASC; } break; - case 343: /* ordering_specification_opt ::= ASC */ -{ yymsp[0].minor.yy106 = ORDER_ASC; } + case 349: /* ordering_specification_opt ::= ASC */ +{ yymsp[0].minor.yy210 = ORDER_ASC; } break; - case 344: /* ordering_specification_opt ::= DESC */ -{ yymsp[0].minor.yy106 = ORDER_DESC; } + case 350: /* ordering_specification_opt ::= DESC */ +{ yymsp[0].minor.yy210 = ORDER_DESC; } break; - case 345: /* null_ordering_opt ::= */ -{ yymsp[1].minor.yy465 = NULL_ORDER_DEFAULT; } + case 351: /* null_ordering_opt ::= */ +{ yymsp[1].minor.yy177 = NULL_ORDER_DEFAULT; } break; - case 346: /* null_ordering_opt ::= NULLS FIRST */ -{ yymsp[-1].minor.yy465 = NULL_ORDER_FIRST; } + case 352: /* null_ordering_opt ::= NULLS FIRST */ +{ yymsp[-1].minor.yy177 = NULL_ORDER_FIRST; } break; - case 347: /* null_ordering_opt ::= NULLS LAST */ -{ yymsp[-1].minor.yy465 = NULL_ORDER_LAST; } + case 353: /* null_ordering_opt ::= NULLS LAST */ +{ yymsp[-1].minor.yy177 = NULL_ORDER_LAST; } break; default: break; diff --git a/source/libs/parser/test/parserAstTest.cpp b/source/libs/parser/test/parserAstTest.cpp index 87f20e8d25..6dc3b53ae3 100644 --- a/source/libs/parser/test/parserAstTest.cpp +++ b/source/libs/parser/test/parserAstTest.cpp @@ -647,3 +647,16 @@ TEST_F(ParserTest, dropTopic) { bind("drop topic if exists tp1"); ASSERT_TRUE(run()); } + +TEST_F(ParserTest, explain) { + setDatabase("root", "test"); + + bind("explain SELECT * FROM t1"); + ASSERT_TRUE(run()); + + bind("explain analyze SELECT * FROM t1"); + ASSERT_TRUE(run()); + + bind("explain analyze verbose true ratio 0.01 SELECT * FROM t1"); + ASSERT_TRUE(run()); +} diff --git a/source/libs/planner/src/planLogicCreater.c b/source/libs/planner/src/planLogicCreater.c index c0d7ff238e..7f6d8826e6 100644 --- a/source/libs/planner/src/planLogicCreater.c +++ b/source/libs/planner/src/planLogicCreater.c @@ -197,6 +197,7 @@ static int32_t createScanLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect strcpy(pScan->tableName.dbname, pRealTable->table.dbName); strcpy(pScan->tableName.tname, pRealTable->table.tableName); pScan->showRewrite = pCxt->pPlanCxt->showRewrite; + pScan->ratio = pRealTable->ratio; // set columns to scan SNodeList* pCols = NULL; @@ -704,6 +705,8 @@ static int32_t createQueryLogicNode(SLogicPlanContext* pCxt, SNode* pStmt, SLogi return createSelectLogicNode(pCxt, (SSelectStmt*)pStmt, pLogicNode); case QUERY_NODE_VNODE_MODIF_STMT: return createVnodeModifLogicNode(pCxt, (SVnodeModifOpStmt*)pStmt, pLogicNode); + case QUERY_NODE_EXPLAIN_STMT: + return createQueryLogicNode(pCxt, ((SExplainStmt*)pStmt)->pQuery, pLogicNode); default: break; } diff --git a/source/libs/planner/src/planPhysiCreater.c b/source/libs/planner/src/planPhysiCreater.c index d5e35fa594..9ef1c01cd1 100644 --- a/source/libs/planner/src/planPhysiCreater.c +++ b/source/libs/planner/src/planPhysiCreater.c @@ -398,6 +398,7 @@ static int32_t createTableScanPhysiNode(SPhysiPlanContext* pCxt, SSubplan* pSubp pTableScan->scanFlag = pScanLogicNode->scanFlag; pTableScan->scanRange = pScanLogicNode->scanRange; + pTableScan->ratio = pScanLogicNode->ratio; vgroupInfoToNodeAddr(pScanLogicNode->pVgroupList->vgroups, &pSubplan->execNode); taosArrayPush(pCxt->pExecNodeList, &pSubplan->execNode); pSubplan->execNodeStat.tableNum = pScanLogicNode->pVgroupList->vgroups[0].numOfTable; @@ -1095,6 +1096,16 @@ static void destoryPhysiPlanContext(SPhysiPlanContext* pCxt) { taosArrayDestroyEx(pCxt->pLocationHelper, destoryLocationHash); } +static void setExplainInfo(SPlanContext* pCxt, SQueryPlan* pPlan) { + if (QUERY_NODE_EXPLAIN_STMT == nodeType(pCxt->pAstRoot)) { + SExplainStmt* pStmt = (SExplainStmt*)pCxt->pAstRoot; + pPlan->explainInfo.mode = pStmt->analyze ? EXPLAIN_MODE_ANALYZE : EXPLAIN_MODE_STATIC; + pPlan->explainInfo.verbose = pStmt->pOptions->verbose; + } else { + pPlan->explainInfo.mode = EXPLAIN_MODE_DISABLE; + } +} + int32_t createPhysiPlan(SPlanContext* pCxt, SQueryLogicPlan* pLogicPlan, SQueryPlan** pPlan, SArray* pExecNodeList) { SPhysiPlanContext cxt = { .pPlanCxt = pCxt, @@ -1106,7 +1117,12 @@ int32_t createPhysiPlan(SPlanContext* pCxt, SQueryLogicPlan* pLogicPlan, SQueryP if (NULL == cxt.pLocationHelper) { return TSDB_CODE_OUT_OF_MEMORY; } + int32_t code = doCreatePhysiPlan(&cxt, pLogicPlan, pPlan); + if (TSDB_CODE_SUCCESS == code) { + setExplainInfo(pCxt, *pPlan); + } + destoryPhysiPlanContext(&cxt); return code; } diff --git a/source/libs/planner/test/plannerTest.cpp b/source/libs/planner/test/plannerTest.cpp index 7b706242e5..d19d88f455 100644 --- a/source/libs/planner/test/plannerTest.cpp +++ b/source/libs/planner/test/plannerTest.cpp @@ -282,3 +282,16 @@ TEST_F(PlannerTest, createSmaIndex) { bind("create sma index index1 on t1 function(max(c1), min(c3 + 10), sum(c4)) INTERVAL(10s)"); ASSERT_TRUE(run()); } + +TEST_F(PlannerTest, explain) { + setDatabase("root", "test"); + + bind("explain SELECT * FROM t1"); + ASSERT_TRUE(run()); + + bind("explain analyze SELECT * FROM t1"); + ASSERT_TRUE(run()); + + bind("explain analyze verbose true ratio 0.01 SELECT * FROM t1"); + ASSERT_TRUE(run()); +} From b63e26ff7a34c9d3bd863044c3770ce8123a9959 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Wed, 30 Mar 2022 06:50:59 +0000 Subject: [PATCH 12/49] make compile --- source/libs/tdb/src/db/tdbBtree.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source/libs/tdb/src/db/tdbBtree.c b/source/libs/tdb/src/db/tdbBtree.c index e22f8b8ba6..fa1c968a97 100644 --- a/source/libs/tdb/src/db/tdbBtree.c +++ b/source/libs/tdb/src/db/tdbBtree.c @@ -57,12 +57,12 @@ typedef struct { } SBtreeInitPageArg; typedef struct { - int kLen; - u8 *pKey; - int vLen; - u8 *pVal; - SPgno pgno; - u8 *pBuf; + int kLen; + const u8 *pKey; + int vLen; + const u8 *pVal; + SPgno pgno; + u8 *pBuf; } SCellDecoder; static int tdbBtCursorMoveTo(SBTC *pBtc, const void *pKey, int kLen, int *pCRst); From c4f813af2c419db77eeadfd70251da23b6e95851 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Wed, 30 Mar 2022 14:54:00 +0800 Subject: [PATCH 13/49] [td-13039] support stream execution interval query. --- include/libs/executor/executor.h | 7 ++++++- source/libs/executor/inc/executorimpl.h | 18 +++++++----------- source/libs/executor/src/executor.c | 2 +- source/libs/executor/src/executorMain.c | 5 +++-- source/libs/executor/src/executorimpl.c | 23 +++++++++++++++-------- source/libs/qworker/src/qworker.c | 2 +- 6 files changed, 33 insertions(+), 24 deletions(-) diff --git a/include/libs/executor/executor.h b/include/libs/executor/executor.h index fbdb1d66b4..d3cd828cf5 100644 --- a/include/libs/executor/executor.h +++ b/include/libs/executor/executor.h @@ -37,6 +37,11 @@ typedef struct SReadHandle { #define STREAM_DATA_TYPE_SUBMIT_BLOCK 0x1 #define STREAM_DATA_TYPE_SSDATA_BLOCK 0x2 +typedef enum { + OPTR_EXEC_MODEL_BATCH = 0x1, + OPTR_EXEC_MODEL_STREAM = 0x2, +} EOPTR_EXEC_MODEL; + /** * Create the exec task for streaming mode * @param pMsg @@ -84,7 +89,7 @@ int32_t qUpdateQualifiedTableId(qTaskInfo_t tinfo, SArray* tableIdList, bool isA * @return */ int32_t qCreateExecTask(SReadHandle* readHandle, int32_t vgId, uint64_t taskId, struct SSubplan* pPlan, - qTaskInfo_t* pTaskInfo, DataSinkHandle* handle); + qTaskInfo_t* pTaskInfo, DataSinkHandle* handle, EOPTR_EXEC_MODEL model); /** * The main task execution function, including query on both table and multiple tables, diff --git a/source/libs/executor/inc/executorimpl.h b/source/libs/executor/inc/executorimpl.h index bc55f46986..1d7023930d 100644 --- a/source/libs/executor/inc/executorimpl.h +++ b/source/libs/executor/inc/executorimpl.h @@ -233,8 +233,8 @@ struct SOperatorInfo; typedef void (*__optr_encode_fn_t)(struct SOperatorInfo* pOperator, char **result, int32_t *length); typedef bool (*__optr_decode_fn_t)(struct SOperatorInfo* pOperator, char *result, int32_t length); -typedef int32_t (*__optr_open_fn_t)(struct SOperatorInfo* param); -typedef SSDataBlock* (*__optr_fn_t)(struct SOperatorInfo* param, bool* newgroup); +typedef int32_t (*__optr_open_fn_t)(struct SOperatorInfo* pOptr); +typedef SSDataBlock* (*__optr_fn_t)(struct SOperatorInfo* pOptr, bool* newgroup); typedef void (*__optr_close_fn_t)(void* param, int32_t num); typedef struct STaskIdInfo { @@ -255,7 +255,8 @@ typedef struct SExecTaskInfo { uint64_t totalRows; // total number of rows STableGroupInfo tableqinfoGroupInfo; // this is a group array list, including SArray structure char* sql; // query sql string - jmp_buf env; // + jmp_buf env; // jump to this position when error happens. + EOPTR_EXEC_MODEL execModel; // operator execution model [batch model|stream model] struct SOperatorInfo* pRoot; } SExecTaskInfo; @@ -466,11 +467,6 @@ typedef struct SAggSupporter { int32_t resultRowSize; // the result buffer size for each result row, with the meta data size for each row } SAggSupporter; -typedef enum { - OPTR_EXEC_MODEL_BATCH = 0x1, - OPTR_EXEC_MODEL_STREAM = 0x2, -} OPTR_EXEC_MODEL; - typedef struct STableIntervalOperatorInfo { SOptrBasicInfo binfo; // basic info SGroupResInfo groupResInfo; // multiple results build supporter @@ -481,9 +477,9 @@ typedef struct STableIntervalOperatorInfo { SAggSupporter aggSup; // aggregate supporter STableQueryInfo *pCurrent; // current tableQueryInfo struct int32_t order; // current SSDataBlock scan order - OPTR_EXEC_MODEL execModel; // operator execution model [batch model|stream model] + EOPTR_EXEC_MODEL execModel; // operator execution model [batch model|stream model] SArray *pUpdatedWindow; // updated time window due to the input data block from the downstream operator. - SColumnInfoData timeWindowData; // query time window info for scalar function execution. + SColumnInfoData timeWindowData; // query time window info for scalar function execution. } STableIntervalOperatorInfo; typedef struct SAggOperatorInfo { @@ -718,7 +714,7 @@ int32_t getMaximumIdleDurationSec(); void doInvokeUdf(struct SUdfInfo* pUdfInfo, SqlFunctionCtx* pCtx, int32_t idx, int32_t type); void setTaskStatus(SExecTaskInfo* pTaskInfo, int8_t status); -int32_t createExecTaskInfoImpl(SSubplan* pPlan, SExecTaskInfo** pTaskInfo, SReadHandle* pHandle, uint64_t taskId); +int32_t createExecTaskInfoImpl(SSubplan* pPlan, SExecTaskInfo** pTaskInfo, SReadHandle* pHandle, uint64_t taskId, EOPTR_EXEC_MODEL model); #ifdef __cplusplus } diff --git a/source/libs/executor/src/executor.c b/source/libs/executor/src/executor.c index 615bcdcdbb..15203d91ca 100644 --- a/source/libs/executor/src/executor.c +++ b/source/libs/executor/src/executor.c @@ -113,7 +113,7 @@ qTaskInfo_t qCreateStreamExecTaskInfo(void* msg, void* streamReadHandle) { } qTaskInfo_t pTaskInfo = NULL; - code = qCreateExecTask(streamReadHandle, 0, 0, plan, &pTaskInfo, NULL); + code = qCreateExecTask(streamReadHandle, 0, 0, plan, &pTaskInfo, NULL, OPTR_EXEC_MODEL_STREAM); if (code != TSDB_CODE_SUCCESS) { // TODO: destroy SSubplan & pTaskInfo terrno = code; diff --git a/source/libs/executor/src/executorMain.c b/source/libs/executor/src/executorMain.c index cc9921ce73..6d78fa835a 100644 --- a/source/libs/executor/src/executorMain.c +++ b/source/libs/executor/src/executorMain.c @@ -51,11 +51,12 @@ static void freeqinfoFn(void *qhandle) { qDestroyTask(*handle); } -int32_t qCreateExecTask(SReadHandle* readHandle, int32_t vgId, uint64_t taskId, SSubplan* pSubplan, qTaskInfo_t* pTaskInfo, DataSinkHandle* handle) { +int32_t qCreateExecTask(SReadHandle* readHandle, int32_t vgId, uint64_t taskId, SSubplan* pSubplan, + qTaskInfo_t* pTaskInfo, DataSinkHandle* handle, EOPTR_EXEC_MODEL model) { assert(readHandle != NULL && pSubplan != NULL); SExecTaskInfo** pTask = (SExecTaskInfo**)pTaskInfo; - int32_t code = createExecTaskInfoImpl(pSubplan, pTask, readHandle, taskId); + int32_t code = createExecTaskInfoImpl(pSubplan, pTask, readHandle, taskId, model); if (code != TSDB_CODE_SUCCESS) { goto _error; } diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index 55def79958..2df18f135c 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -6930,6 +6930,10 @@ static SSDataBlock* doBuildIntervalResult(SOperatorInfo* pOperator, bool* newgro return NULL; } + if (pInfo->execModel == OPTR_EXEC_MODEL_STREAM) { + return pOperator->getStreamResFn(pOperator, newgroup); + } + pTaskInfo->code = pOperator->_openFn(pOperator); if (pTaskInfo->code != TSDB_CODE_SUCCESS) { return NULL; @@ -6946,7 +6950,7 @@ static SSDataBlock* doBuildIntervalResult(SOperatorInfo* pOperator, bool* newgro return pInfo->binfo.pRes->info.rows == 0 ? NULL : pInfo->binfo.pRes; } -static SSDataBlock* doStreamIntervalAgg(SOperatorInfo *pOperator) { +static SSDataBlock* doStreamIntervalAgg(SOperatorInfo *pOperator, bool* newgroup) { STableIntervalOperatorInfo* pInfo = pOperator->info; int32_t order = TSDB_ORDER_ASC; @@ -6964,14 +6968,14 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo *pOperator) { } // STimeWindow win = {0}; - bool newgroup = false; + *newgroup = false; SOperatorInfo* downstream = pOperator->pDownstream[0]; SArray* pUpdated = NULL; while (1) { publishOperatorProfEvent(downstream, QUERY_PROF_BEFORE_OPERATOR_EXEC); - SSDataBlock* pBlock = downstream->getNextFn(downstream, &newgroup); + SSDataBlock* pBlock = downstream->getNextFn(downstream, newgroup); publishOperatorProfEvent(downstream, QUERY_PROF_AFTER_OPERATOR_EXEC); if (pBlock == NULL) { @@ -7882,9 +7886,10 @@ SOperatorInfo* createIntervalOperatorInfo(SOperatorInfo* downstream, SExprInfo* } pInfo->order = TSDB_ORDER_ASC; - pInfo->win = pTaskInfo->window; pInfo->interval = *pInterval; - pInfo->execModel = OPTR_EXEC_MODEL_BATCH; + pInfo->execModel = pTaskInfo->execModel; + + pInfo->win = pTaskInfo->window; pInfo->win.skey = 0; pInfo->win.ekey = INT64_MAX; @@ -7909,6 +7914,7 @@ SOperatorInfo* createIntervalOperatorInfo(SOperatorInfo* downstream, SExprInfo* pOperator->info = pInfo; pOperator->_openFn = doOpenIntervalAgg; pOperator->getNextFn = doBuildIntervalResult; + pOperator->getStreamResFn= doStreamIntervalAgg; pOperator->closeFn = destroyIntervalOperatorInfo; code = appendDownstream(pOperator, &downstream, 1); @@ -8736,12 +8742,13 @@ SExprInfo* createExprInfo(SNodeList* pNodeList, SNodeList* pGroupKeys, int32_t* return pExprs; } -static SExecTaskInfo* createExecTaskInfo(uint64_t queryId, uint64_t taskId) { +static SExecTaskInfo* createExecTaskInfo(uint64_t queryId, uint64_t taskId, EOPTR_EXEC_MODEL model) { SExecTaskInfo* pTaskInfo = taosMemoryCalloc(1, sizeof(SExecTaskInfo)); setTaskStatus(pTaskInfo, TASK_NOT_COMPLETED); pTaskInfo->cost.created = taosGetTimestampMs(); pTaskInfo->id.queryId = queryId; + pTaskInfo->execModel = model; char* p = taosMemoryCalloc(1, 128); snprintf(p, 128, "TID:0x%" PRIx64 " QID:0x%" PRIx64, taskId, queryId); @@ -9102,11 +9109,11 @@ _error: return NULL; } -int32_t createExecTaskInfoImpl(SSubplan* pPlan, SExecTaskInfo** pTaskInfo, SReadHandle* pHandle, uint64_t taskId) { +int32_t createExecTaskInfoImpl(SSubplan* pPlan, SExecTaskInfo** pTaskInfo, SReadHandle* pHandle, uint64_t taskId, EOPTR_EXEC_MODEL model) { uint64_t queryId = pPlan->id.queryId; int32_t code = TSDB_CODE_SUCCESS; - *pTaskInfo = createExecTaskInfo(queryId, taskId); + *pTaskInfo = createExecTaskInfo(queryId, taskId, model); if (*pTaskInfo == NULL) { code = TSDB_CODE_QRY_OUT_OF_MEMORY; goto _complete; diff --git a/source/libs/qworker/src/qworker.c b/source/libs/qworker/src/qworker.c index 34159a1355..42d10a2361 100644 --- a/source/libs/qworker/src/qworker.c +++ b/source/libs/qworker/src/qworker.c @@ -959,7 +959,7 @@ int32_t qwProcessQuery(QW_FPARAMS_DEF, SQWMsg *qwMsg, int8_t taskType) { QW_ERR_JRET(code); } - code = qCreateExecTask(qwMsg->node, mgmt->nodeId, tId, plan, &pTaskInfo, &sinkHandle); + code = qCreateExecTask(qwMsg->node, mgmt->nodeId, tId, plan, &pTaskInfo, &sinkHandle, OPTR_EXEC_MODEL_BATCH); if (code) { QW_TASK_ELOG("qCreateExecTask failed, code:%x - %s", code, tstrerror(code)); QW_ERR_JRET(code); From 1a2506afaa4c32342739b5afe4006431a83fd539 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Wed, 30 Mar 2022 06:58:56 +0000 Subject: [PATCH 14/49] refact --- source/libs/tdb/src/db/tdbBtree.c | 200 +++++++++++++++--------------- 1 file changed, 101 insertions(+), 99 deletions(-) diff --git a/source/libs/tdb/src/db/tdbBtree.c b/source/libs/tdb/src/db/tdbBtree.c index fa1c968a97..9b63849705 100644 --- a/source/libs/tdb/src/db/tdbBtree.c +++ b/source/libs/tdb/src/db/tdbBtree.c @@ -256,105 +256,6 @@ int tdbBtreePGet(SBTree *pBt, const void *pKey, int kLen, void **ppKey, int *pkL return 0; } -static int tdbBtCursorMoveTo(SBTC *pBtc, const void *pKey, int kLen, int *pCRst) { - int ret; - SBTree *pBt; - SPager *pPager; - - pBt = pBtc->pBt; - pPager = pBt->pPager; - - if (pBtc->iPage < 0) { - ASSERT(pBtc->iPage == -1); - ASSERT(pBtc->idx == -1); - - // Move from the root - ret = tdbPagerFetchPage(pPager, pBt->root, &(pBtc->pPage), tdbBtreeInitPage, pBt); - if (ret < 0) { - ASSERT(0); - return -1; - } - - pBtc->iPage = 0; - - if (TDB_PAGE_TOTAL_CELLS(pBtc->pPage) == 0) { - // Current page is empty - // ASSERT(TDB_FLAG_IS(TDB_PAGE_FLAGS(pBtc->pPage), TDB_BTREE_ROOT | TDB_BTREE_LEAF)); - return 0; - } - - for (;;) { - int lidx, ridx, midx, c, nCells; - SCell *pCell; - SPage *pPage; - SCellDecoder cd = {0}; - - pPage = pBtc->pPage; - nCells = TDB_PAGE_TOTAL_CELLS(pPage); - lidx = 0; - ridx = nCells - 1; - - ASSERT(nCells > 0); - - for (;;) { - if (lidx > ridx) break; - - midx = (lidx + ridx) >> 1; - - pCell = tdbPageGetCell(pPage, midx); - ret = tdbBtreeDecodeCell(pPage, pCell, &cd); - if (ret < 0) { - // TODO: handle error - ASSERT(0); - return -1; - } - - // Compare the key values - c = pBt->kcmpr(pKey, kLen, cd.pKey, cd.kLen); - if (c < 0) { - /* input-key < cell-key */ - ridx = midx - 1; - } else if (c > 0) { - /* input-key > cell-key */ - lidx = midx + 1; - } else { - /* input-key == cell-key */ - break; - } - } - - // Move downward or break - u8 leaf = TDB_BTREE_PAGE_IS_LEAF(pPage); - if (leaf) { - pBtc->idx = midx; - *pCRst = c; - break; - } else { - if (c <= 0) { - pBtc->idx = midx; - tdbBtcMoveDownward(pBtc, cd.pgno); - } else { - pBtc->idx = midx + 1; - if (midx == nCells - 1) { - /* Move to right-most child */ - tdbBtcMoveDownward(pBtc, ((SIntHdr *)pBtc->pPage->pData)->pgno); - } else { - pCell = tdbPageGetCell(pPage, pBtc->idx); - tdbBtreeDecodeCell(pPage, pCell, &cd); - tdbBtcMoveDownward(pBtc, cd.pgno); - } - } - } - } - - } else { - // TODO: Move the cursor from a some position instead of a clear state - ASSERT(0); - } - - return 0; -} - static int tdbDefaultKeyCmprFn(const void *pKey1, int keyLen1, const void *pKey2, int keyLen2) { int mlen; int cret; @@ -1077,6 +978,7 @@ static int tdbBtreeCellSize(const SPage *pPage, SCell *pCell) { } // TDB_BTREE_CELL +// TDB_BTREE_CURSOR ===================== int tdbBtcOpen(SBTC *pBtc, SBTree *pBt) { pBtc->pBt = pBt; pBtc->iPage = -1; @@ -1086,6 +988,105 @@ int tdbBtcOpen(SBTC *pBtc, SBTree *pBt) { return 0; } +static int tdbBtCursorMoveTo(SBTC *pBtc, const void *pKey, int kLen, int *pCRst) { + int ret; + SBTree *pBt; + SPager *pPager; + + pBt = pBtc->pBt; + pPager = pBt->pPager; + + if (pBtc->iPage < 0) { + ASSERT(pBtc->iPage == -1); + ASSERT(pBtc->idx == -1); + + // Move from the root + ret = tdbPagerFetchPage(pPager, pBt->root, &(pBtc->pPage), tdbBtreeInitPage, pBt); + if (ret < 0) { + ASSERT(0); + return -1; + } + + pBtc->iPage = 0; + + if (TDB_PAGE_TOTAL_CELLS(pBtc->pPage) == 0) { + // Current page is empty + // ASSERT(TDB_FLAG_IS(TDB_PAGE_FLAGS(pBtc->pPage), TDB_BTREE_ROOT | TDB_BTREE_LEAF)); + return 0; + } + + for (;;) { + int lidx, ridx, midx, c, nCells; + SCell *pCell; + SPage *pPage; + SCellDecoder cd = {0}; + + pPage = pBtc->pPage; + nCells = TDB_PAGE_TOTAL_CELLS(pPage); + lidx = 0; + ridx = nCells - 1; + + ASSERT(nCells > 0); + + for (;;) { + if (lidx > ridx) break; + + midx = (lidx + ridx) >> 1; + + pCell = tdbPageGetCell(pPage, midx); + ret = tdbBtreeDecodeCell(pPage, pCell, &cd); + if (ret < 0) { + // TODO: handle error + ASSERT(0); + return -1; + } + + // Compare the key values + c = pBt->kcmpr(pKey, kLen, cd.pKey, cd.kLen); + if (c < 0) { + /* input-key < cell-key */ + ridx = midx - 1; + } else if (c > 0) { + /* input-key > cell-key */ + lidx = midx + 1; + } else { + /* input-key == cell-key */ + break; + } + } + + // Move downward or break + u8 leaf = TDB_BTREE_PAGE_IS_LEAF(pPage); + if (leaf) { + pBtc->idx = midx; + *pCRst = c; + break; + } else { + if (c <= 0) { + pBtc->idx = midx; + tdbBtcMoveDownward(pBtc, cd.pgno); + } else { + pBtc->idx = midx + 1; + if (midx == nCells - 1) { + /* Move to right-most child */ + tdbBtcMoveDownward(pBtc, ((SIntHdr *)pBtc->pPage->pData)->pgno); + } else { + pCell = tdbPageGetCell(pPage, pBtc->idx); + tdbBtreeDecodeCell(pPage, pCell, &cd); + tdbBtcMoveDownward(pBtc, cd.pgno); + } + } + } + } + + } else { + // TODO: Move the cursor from a some position instead of a clear state + ASSERT(0); + } + + return 0; +} + int tdbBtcMoveToFirst(SBTC *pBtc) { int ret; SBTree *pBt; @@ -1309,6 +1310,7 @@ static int tdbBtcMoveUpward(SBTC *pBtc) { return 0; } +// TDB_BTREE_CURSOR #ifndef NODEBUG typedef struct { From 1e8e6e32e4b26ca3fdbf2427e24ea239fac77861 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Wed, 30 Mar 2022 07:14:55 +0000 Subject: [PATCH 15/49] refact --- source/libs/tdb/src/db/tdbBtree.c | 27 +++++++++++++++++++++------ source/libs/tdb/src/inc/tdbBtree.h | 1 - 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/source/libs/tdb/src/db/tdbBtree.c b/source/libs/tdb/src/db/tdbBtree.c index 9b63849705..6c7f7e2471 100644 --- a/source/libs/tdb/src/db/tdbBtree.c +++ b/source/libs/tdb/src/db/tdbBtree.c @@ -1277,11 +1277,6 @@ static int tdbBtcMoveToNext(SBTC *pBtc) { return 0; } -int tdbBtcClose(SBTC *pBtc) { - // TODO - return 0; -} - static int tdbBtcMoveDownward(SBTC *pBtc, SPgno pgno) { int ret; @@ -1310,8 +1305,27 @@ static int tdbBtcMoveUpward(SBTC *pBtc) { return 0; } + +int tdbBtcClose(SBTC *pBtc) { + if (pBtc->iPage < 0) return 0; + + for (;;) { + ASSERT(pBtc->pPage); + + tdbPagerReturnPage(pBtc->pBt->pPager, pBtc->pPage); + + pBtc->iPage--; + if (pBtc->iPage < 0) break; + + pBtc->pPage = pBtc->pgStack[pBtc->iPage]; + pBtc->idx = pBtc->idxStack[pBtc->iPage]; + } + + return 0; +} // TDB_BTREE_CURSOR +// TDB_BTREE_DEBUG ===================== #ifndef NODEBUG typedef struct { SPgno pgno; @@ -1342,4 +1356,5 @@ void tdbBtPageInfo(SPage *pPage, int idx) { pBtPageInfo->nCells = TDB_PAGE_TOTAL_CELLS(pPage) - pPage->nOverflow; pBtPageInfo->nOvfl = pPage->nOverflow; } -#endif \ No newline at end of file +#endif +// TDB_BTREE_DEBUG \ No newline at end of file diff --git a/source/libs/tdb/src/inc/tdbBtree.h b/source/libs/tdb/src/inc/tdbBtree.h index 0e8ca0c803..a320401a48 100644 --- a/source/libs/tdb/src/inc/tdbBtree.h +++ b/source/libs/tdb/src/inc/tdbBtree.h @@ -35,7 +35,6 @@ struct SBTC { int idx; int idxStack[BTREE_MAX_DEPTH + 1]; SPage *pgStack[BTREE_MAX_DEPTH + 1]; - void *pBuf; }; // SBTree From 9c6c6516d5d2bde2632d7a3e7d3d03d38155b107 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Wed, 30 Mar 2022 07:22:14 +0000 Subject: [PATCH 16/49] refact --- source/libs/tdb/src/db/tdbBtree.c | 15 +++++---------- source/libs/tdb/src/inc/tdbBtree.h | 1 - 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/source/libs/tdb/src/db/tdbBtree.c b/source/libs/tdb/src/db/tdbBtree.c index 6c7f7e2471..6372216dd0 100644 --- a/source/libs/tdb/src/db/tdbBtree.c +++ b/source/libs/tdb/src/db/tdbBtree.c @@ -65,7 +65,7 @@ typedef struct { u8 *pBuf; } SCellDecoder; -static int tdbBtCursorMoveTo(SBTC *pBtc, const void *pKey, int kLen, int *pCRst); +static int tdbBtcMoveTo(SBTC *pBtc, const void *pKey, int kLen, int *pCRst); static int tdbDefaultKeyCmprFn(const void *pKey1, int keyLen1, const void *pKey2, int keyLen2); static int tdbBtreeOpenImpl(SBTree *pBt); static int tdbBtreeZeroPage(SPage *pPage, void *arg); @@ -136,7 +136,7 @@ int tdbBtCursorInsert(SBTC *pBtc, const void *pKey, int kLen, const void *pVal, int cret; SBTree *pBt; - ret = tdbBtCursorMoveTo(pBtc, pKey, kLen, &cret); + ret = tdbBtcMoveTo(pBtc, pKey, kLen, &cret); if (ret < 0) { // TODO: handle error return -1; @@ -199,7 +199,7 @@ int tdbBtreeGet(SBTree *pBt, const void *pKey, int kLen, void **ppVal, int *vLen tdbBtcOpen(&btc, pBt); - tdbBtCursorMoveTo(&btc, pKey, kLen, &cret); + tdbBtcMoveTo(&btc, pKey, kLen, &cret); if (cret) { return cret; @@ -229,7 +229,7 @@ int tdbBtreePGet(SBTree *pBt, const void *pKey, int kLen, void **ppKey, int *pkL tdbBtcOpen(&btc, pBt); - tdbBtCursorMoveTo(&btc, pKey, kLen, &cret); + tdbBtcMoveTo(&btc, pKey, kLen, &cret); if (cret) { return cret; } @@ -988,7 +988,7 @@ int tdbBtcOpen(SBTC *pBtc, SBTree *pBt) { return 0; } -static int tdbBtCursorMoveTo(SBTC *pBtc, const void *pKey, int kLen, int *pCRst) { +static int tdbBtcMoveTo(SBTC *pBtc, const void *pKey, int kLen, int *pCRst) { int ret; SBTree *pBt; SPager *pPager; @@ -1176,11 +1176,6 @@ int tdbBtcMoveToLast(SBTC *pBtc) { return 0; } -int tdbBtcMoveTo(SBTC *pBtc, const void *pKey, int kLen) { - // TODO - return 0; -} - int tdbBtreeNext(SBTC *pBtc, void **ppKey, int *kLen, void **ppVal, int *vLen) { SCell *pCell; SCellDecoder cd; diff --git a/source/libs/tdb/src/inc/tdbBtree.h b/source/libs/tdb/src/inc/tdbBtree.h index a320401a48..2797b5ea5e 100644 --- a/source/libs/tdb/src/inc/tdbBtree.h +++ b/source/libs/tdb/src/inc/tdbBtree.h @@ -48,7 +48,6 @@ int tdbBtreePGet(SBTree *pBt, const void *pKey, int kLen, void **ppKey, int *pkL int tdbBtcOpen(SBTC *pCur, SBTree *pBt); int tdbBtcMoveToFirst(SBTC *pBtc); int tdbBtcMoveToLast(SBTC *pBtc); -int tdbBtcMoveTo(SBTC *pBtc, const void *pKey, int kLen); int tdbBtreeNext(SBTC *pBtc, void **ppKey, int *kLen, void **ppVal, int *vLen); int tdbBtcClose(SBTC *pBtc); From 1cce35c0a56ebe3018ce9436383546fa46b0f7b5 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Wed, 30 Mar 2022 15:31:20 +0800 Subject: [PATCH 17/49] [td-13039] fix error found by the compiler. --- source/libs/executor/test/executorTests.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/executor/test/executorTests.cpp b/source/libs/executor/test/executorTests.cpp index c9b0b62013..870a0b71fc 100644 --- a/source/libs/executor/test/executorTests.cpp +++ b/source/libs/executor/test/executorTests.cpp @@ -944,7 +944,7 @@ TEST(testCase, build_executor_tree_Test) { int32_t code = qStringToSubplan(msg, &plan); ASSERT_EQ(code, 0); - code = qCreateExecTask(&handle, 2, 1, plan, (void**) &pTaskInfo, &sinkHandle); + code = qCreateExecTask(&handle, 2, 1, plan, (void**) &pTaskInfo, &sinkHandle, OPTR_EXEC_MODEL_BATCH); ASSERT_EQ(code, 0); } From 640b2f4d1b30a1ad35e69f9eccc1f166e8336abd Mon Sep 17 00:00:00 2001 From: Cary Xu Date: Wed, 30 Mar 2022 15:48:51 +0800 Subject: [PATCH 18/49] insert tSma by SSDataBlock --- include/common/tmsg.h | 27 -- source/dnode/vnode/inc/tsdb.h | 10 +- source/dnode/vnode/src/inc/tsdbSma.h | 5 +- source/dnode/vnode/src/tsdb/tsdbSma.c | 335 ++++++++++++++---------- source/dnode/vnode/src/vnd/vnodeWrite.c | 4 +- source/dnode/vnode/test/tsdbSmaTest.cpp | 138 ++++++++-- 6 files changed, 310 insertions(+), 209 deletions(-) diff --git a/include/common/tmsg.h b/include/common/tmsg.h index ca46657473..cd16bbf862 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -2016,7 +2016,6 @@ typedef struct { int8_t slidingUnit; // MACRO: TIME_UNIT_XXX int8_t timezoneInt; // sma data expired if timezone changes. char indexName[TSDB_INDEX_NAME_LEN]; - char timezone[TD_TIMEZONE_LEN]; int32_t exprLen; int32_t tagsFilterLen; int64_t indexUid; @@ -2054,32 +2053,6 @@ void* tDeserializeSVCreateTSmaReq(void* buf, SVCreateTSmaReq* pReq); int32_t tSerializeSVDropTSmaReq(void** buf, SVDropTSmaReq* pReq); void* tDeserializeSVDropTSmaReq(void* buf, SVDropTSmaReq* pReq); -typedef struct { - col_id_t colId; - uint16_t blockSize; // sma data block size - char data[]; -} STSmaColData; - -typedef struct { - tb_uid_t tableUid; // super/child/normal table uid - int32_t dataLen; // not including head - char data[]; -} STSmaTbData; - -typedef struct { - int64_t indexUid; - TSKEY skey; // startKey of one interval/sliding window - int64_t interval; - int32_t dataLen; // not including head - int8_t intervalUnit; - char data[]; -} STSmaDataWrapper; // sma data for a interval/sliding window - -// interval/sliding => window - -// => window->table->colId -// => 当一个window下所有的表均计算完成时,流计算告知tsdb清除window的过期标记 - // RSma: Rollup SMA typedef struct { int64_t interval; diff --git a/source/dnode/vnode/inc/tsdb.h b/source/dnode/vnode/inc/tsdb.h index f1083c0d91..0d3fcffe7d 100644 --- a/source/dnode/vnode/inc/tsdb.h +++ b/source/dnode/vnode/inc/tsdb.h @@ -100,10 +100,11 @@ int32_t tsdbUpdateSmaWindow(STsdb *pTsdb, const char *msg); * @brief Insert tSma(Time-range-wise SMA) data from stream computing engine * * @param pTsdb + * @param indexUid * @param msg * @return int32_t */ -int32_t tsdbInsertTSmaData(STsdb *pTsdb, char *msg); +int32_t tsdbInsertTSmaData(STsdb *pTsdb, int64_t indexUid, const char *msg); /** * @brief Drop tSma data and local cache. @@ -130,16 +131,11 @@ int32_t tsdbInsertRSmaData(STsdb *pTsdb, char *msg); * @param pTsdb * @param pData * @param indexUid - * @param interval - * @param intervalUnit - * @param tableUid - * @param colId * @param querySKey * @param nMaxResult * @return int32_t */ -int32_t tsdbGetTSmaData(STsdb *pTsdb, STSmaDataWrapper *pData, int64_t indexUid, int64_t interval, int8_t intervalUnit, - tb_uid_t tableUid, col_id_t colId, TSKEY querySKey, int32_t nMaxResult); +int32_t tsdbGetTSmaData(STsdb *pTsdb, char *pData, int64_t indexUid, TSKEY querySKey, int32_t nMaxResult); // STsdbCfg int tsdbOptionsInit(STsdbCfg *); diff --git a/source/dnode/vnode/src/inc/tsdbSma.h b/source/dnode/vnode/src/inc/tsdbSma.h index e0170c90e7..ffb9869914 100644 --- a/source/dnode/vnode/src/inc/tsdbSma.h +++ b/source/dnode/vnode/src/inc/tsdbSma.h @@ -44,11 +44,10 @@ int32_t tsdbRemoveTSmaData(STsdb *pTsdb, STSma *param, STimeWindow *pWin); #endif // internal func -static FORCE_INLINE int32_t tsdbEncodeTSmaKey(tb_uid_t tableUid, col_id_t colId, TSKEY tsKey, void **pData) { +static FORCE_INLINE int32_t tsdbEncodeTSmaKey(int64_t groupId, TSKEY tsKey, void **pData) { int32_t len = 0; - len += taosEncodeFixedI64(pData, tableUid); - len += taosEncodeFixedU16(pData, colId); len += taosEncodeFixedI64(pData, tsKey); + len += taosEncodeFixedI64(pData, groupId); return len; } diff --git a/source/dnode/vnode/src/tsdb/tsdbSma.c b/source/dnode/vnode/src/tsdb/tsdbSma.c index 07eafd6df0..91b4e83dd0 100644 --- a/source/dnode/vnode/src/tsdb/tsdbSma.c +++ b/source/dnode/vnode/src/tsdb/tsdbSma.c @@ -24,7 +24,7 @@ static const char *TSDB_SMA_DNAME[] = { #define SMA_STORAGE_TSDB_DAYS 30 #define SMA_STORAGE_TSDB_TIMES 10 #define SMA_STORAGE_SPLIT_HOURS 24 -#define SMA_KEY_LEN 18 // tableUid_colId_TSKEY 8+2+8 +#define SMA_KEY_LEN 16 // TSKEY+groupId 8+8 #define SMA_DROP_EXPIRED_TIME 10 // default is 10 seconds #define SMA_STATE_HASH_SLOT 4 @@ -38,10 +38,10 @@ typedef enum { } ESmaStorageLevel; typedef struct { - STsdb *pTsdb; - SDBFile dFile; - SSDataBlock *pData; // sma data - int32_t interval; // interval with the precision of DB + STsdb *pTsdb; + SDBFile dFile; + const SArray *pDataBlocks; // sma data + int32_t interval; // interval with the precision of DB } STSmaWriteH; typedef struct { @@ -94,26 +94,24 @@ static int32_t tsdbUnRefSmaStat(STsdb *pTsdb, SSmaStat *pStat); // read data // TODO: This is the basic params, and should wrap the params to a queryHandle. -static int32_t tsdbGetTSmaDataImpl(STsdb *pTsdb, STSmaDataWrapper *pData, int64_t indexUid, int64_t interval, - int8_t intervalUnit, tb_uid_t tableUid, col_id_t colId, TSKEY querySKey, - int32_t nMaxResult); +static int32_t tsdbGetTSmaDataImpl(STsdb *pTsdb, char *pData, int64_t indexUid, TSKEY querySKey, int32_t nMaxResult); // insert data -static int32_t tsdbInitTSmaWriteH(STSmaWriteH *pSmaH, STsdb *pTsdb, SSDataBlock *pData, int64_t interval, +static int32_t tsdbInitTSmaWriteH(STSmaWriteH *pSmaH, STsdb *pTsdb, const SArray *pDataBlocks, int64_t interval, int8_t intervalUnit); static void tsdbDestroyTSmaWriteH(STSmaWriteH *pSmaH); static int32_t tsdbInitTSmaReadH(STSmaReadH *pSmaH, STsdb *pTsdb, int64_t interval, int8_t intervalUnit); static int32_t tsdbGetSmaStorageLevel(int64_t interval, int8_t intervalUnit); -static int32_t tsdbInsertTSmaDataSection(STSmaWriteH *pSmaH, STSmaDataWrapper *pData); +static int32_t tsdbSetRSmaDataFile(STSmaWriteH *pSmaH, int32_t fid); static int32_t tsdbInsertTSmaBlocks(STSmaWriteH *pSmaH, void *smaKey, uint32_t keyLen, void *pData, uint32_t dataLen); -static int64_t tsdbGetIntervalByPrecision(int64_t interval, uint8_t intervalUnit, int8_t precision); +static int64_t tsdbGetIntervalByPrecision(int64_t interval, uint8_t intervalUnit, int8_t precision, bool adjusted); static int32_t tsdbGetTSmaDays(STsdb *pTsdb, int64_t interval, int32_t storageLevel); -static int32_t tsdbSetTSmaDataFile(STSmaWriteH *pSmaH, STSmaDataWrapper *pData, int64_t indexUid, int32_t fid); +static int32_t tsdbSetTSmaDataFile(STSmaWriteH *pSmaH, int64_t indexUid, int32_t fid); static int32_t tsdbInitTSmaFile(STSmaReadH *pSmaH, int64_t indexUid, TSKEY skey); static bool tsdbSetAndOpenTSmaFile(STSmaReadH *pReadH, TSKEY *queryKey); static void tsdbGetSmaDir(int32_t vgId, ETsdbSmaType smaType, char dirName[]); -static int32_t tsdbInsertTSmaDataImpl(STsdb *pTsdb, char *msg); -static int32_t tsdbInsertRSmaDataImpl(STsdb *pTsdb, char *msg); +static int32_t tsdbInsertTSmaDataImpl(STsdb *pTsdb, int64_t indexUid, const char *msg); +static int32_t tsdbInsertRSmaDataImpl(STsdb *pTsdb, const char *msg); // mgmt interface static int32_t tsdbDropTSmaDataImpl(STsdb *pTsdb, int64_t indexUid); @@ -387,7 +385,6 @@ static int32_t tsdbCheckAndInitSmaEnv(STsdb *pTsdb, int8_t smaType) { return TSDB_CODE_SUCCESS; }; - static int32_t tsdbSetExpiredWindow(STsdb *pTsdb, SHashObj *pItemsHash, int64_t indexUid, int64_t winSKey) { SSmaStatItem *pItem = taosHashGet(pItemsHash, &indexUid, sizeof(indexUid)); if (pItem == NULL) { @@ -480,18 +477,15 @@ int32_t tsdbUpdateExpiredWindowImpl(STsdb *pTsdb, const char *msg) { TSKEY expiredWindows[SMA_TEST_EXPIRED_WINDOW_SIZE]; #endif - // Firstly, assume that tSma can only be created on super table/normal table. // getActiveTimeWindow - - SSmaEnv *pEnv = REPO_SMA_ENV(pTsdb, TSDB_SMA_TYPE_TIME_RANGE); + SSmaEnv *pEnv = REPO_SMA_ENV(pTsdb, TSDB_SMA_TYPE_TIME_RANGE); SSmaStat *pStat = SMA_ENV_STAT(pEnv); SHashObj *pItemsHash = SMA_ENV_STAT_ITEMS(pEnv); TASSERT(pEnv != NULL && pStat != NULL && pItemsHash != NULL); - // basic procedure // TODO: optimization tsdbRefSmaStat(pTsdb, pStat); @@ -523,11 +517,11 @@ int32_t tsdbUpdateExpiredWindowImpl(STsdb *pTsdb, const char *msg) { tdFreeTSmaWrapper(pSW); break; } - if(pSW == NULL) { - if((pSW =metaGetSmaInfoByTable(REPO_META(pTsdb), pBlock->suid)) == NULL) { + if (pSW == NULL) { + if ((pSW = metaGetSmaInfoByTable(REPO_META(pTsdb), pBlock->suid)) == NULL) { break; } - if((pSW->number) <= 0 || (pSW->tSma == NULL)) { + if ((pSW->number) <= 0 || (pSW->tSma == NULL)) { tdFreeTSmaWrapper(pSW); break; } @@ -683,9 +677,15 @@ static int32_t tsdbInsertTSmaBlocks(STSmaWriteH *pSmaH, void *smaKey, uint32_t k * @param interval * @param intervalUnit * @param precision + * @param adjusted Interval already adjusted according to DB precision * @return int64_t */ -static int64_t tsdbGetIntervalByPrecision(int64_t interval, uint8_t intervalUnit, int8_t precision) { +static int64_t tsdbGetIntervalByPrecision(int64_t interval, uint8_t intervalUnit, int8_t precision, bool adjusted) { + + if (adjusted) { + return interval; + } + switch (intervalUnit) { case TIME_UNIT_YEAR: // approximate value interval *= 365 * 86400 * 1e3; @@ -753,59 +753,12 @@ static int64_t tsdbGetIntervalByPrecision(int64_t interval, uint8_t intervalUnit return interval; } -/** - * @brief Split the TSma data blocks into expected size and insert into B+Tree. - * - * @param pSmaH - * @param pData - * @param nOffset The nOffset of blocks since fid changes. - * @param nBlocks The nBlocks with the same fid since nOffset. - * @return int32_t - */ -static int32_t tsdbInsertTSmaDataSection(STSmaWriteH *pSmaH, STSmaDataWrapper *pData) { - STsdb *pTsdb = pSmaH->pTsdb; - - tsdbDebug("tsdbInsertTSmaDataSection: index %" PRIi64 ", skey %" PRIi64, pData->indexUid, pData->skey); - - // TODO: check the data integrity - - int32_t len = 0; - while (true) { - if (len >= pData->dataLen) { - break; - } - assert(pData->dataLen > 0); - STSmaTbData *pTbData = (STSmaTbData *)POINTER_SHIFT(pData->data, len); - - int32_t tbLen = 0; - while (true) { - if (tbLen >= pTbData->dataLen) { - break; - } - assert(pTbData->dataLen > 0); - STSmaColData *pColData = (STSmaColData *)POINTER_SHIFT(pTbData->data, tbLen); - char smaKey[SMA_KEY_LEN] = {0}; - void *pSmaKey = &smaKey; -#if 0 - printf("tsdbInsertTSmaDataSection: index %" PRIi64 ", skey %" PRIi64 " table[%" PRIi64 "]col[%" PRIu16 "]\n", - pData->indexUid, pData->skey, pTbData->tableUid, pColData->colId); -#endif - tsdbEncodeTSmaKey(pTbData->tableUid, pColData->colId, pData->skey, (void **)&pSmaKey); - if (tsdbInsertTSmaBlocks(pSmaH, smaKey, SMA_KEY_LEN, pColData->data, pColData->blockSize) < 0) { - tsdbWarn("vgId:%d insert tSma blocks failed since %s", REPO_ID(pTsdb), tstrerror(terrno)); - } - tbLen += (sizeof(STSmaColData) + pColData->blockSize); - } - len += (sizeof(STSmaTbData) + pTbData->dataLen); - } - - return TSDB_CODE_SUCCESS; -} - -static int32_t tsdbInitTSmaWriteH(STSmaWriteH *pSmaH, STsdb *pTsdb, SSDataBlock *pData, int64_t interval, int8_t intervalUnit) { +static int32_t tsdbInitTSmaWriteH(STSmaWriteH *pSmaH, STsdb *pTsdb, const SArray *pDataBlocks, int64_t interval, + int8_t intervalUnit) { pSmaH->pTsdb = pTsdb; - pSmaH->interval = tsdbGetIntervalByPrecision(interval, intervalUnit, REPO_CFG(pTsdb)->precision); - pSmaH->pData = pData; + pSmaH->interval = tsdbGetIntervalByPrecision(interval, intervalUnit, REPO_CFG(pTsdb)->precision, true); + pSmaH->pDataBlocks = pDataBlocks; + pSmaH->dFile.fid = TSDB_IVLD_FID; return TSDB_CODE_SUCCESS; } @@ -815,7 +768,7 @@ static void tsdbDestroyTSmaWriteH(STSmaWriteH *pSmaH) { } } -static int32_t tsdbSetTSmaDataFile(STSmaWriteH *pSmaH, STSmaDataWrapper *pData, int64_t indexUid, int32_t fid) { +static int32_t tsdbSetTSmaDataFile(STSmaWriteH *pSmaH, int64_t indexUid, int32_t fid) { STsdb *pTsdb = pSmaH->pTsdb; ASSERT(pSmaH->dFile.path == NULL && pSmaH->dFile.pDB == NULL); @@ -859,11 +812,10 @@ static int32_t tsdbGetTSmaDays(STsdb *pTsdb, int64_t interval, int32_t storageLe * @param msg * @return int32_t */ -static int32_t tsdbInsertTSmaDataImpl(STsdb *pTsdb, char *msg) { - STsdbCfg *pCfg = REPO_CFG(pTsdb); - SSDataBlock *pData = (SSDataBlock *)msg; - SSmaEnv *pEnv = atomic_load_ptr(&pTsdb->pTSmaEnv); - int64_t indexUid = SMA_TEST_INDEX_UID; +static int32_t tsdbInsertTSmaDataImpl(STsdb *pTsdb, int64_t indexUid, const char *msg) { + STsdbCfg *pCfg = REPO_CFG(pTsdb); + const SArray *pDataBlocks = (const SArray *)msg; + SSmaEnv *pEnv = atomic_load_ptr(&pTsdb->pTSmaEnv); if (pEnv == NULL) { terrno = TSDB_CODE_INVALID_PTR; @@ -871,15 +823,15 @@ static int32_t tsdbInsertTSmaDataImpl(STsdb *pTsdb, char *msg) { return terrno; } - if (pData == NULL) { + if (pDataBlocks == NULL) { terrno = TSDB_CODE_INVALID_PTR; - tsdbWarn("vgId:%d insert tSma data failed since pData is NULL", REPO_ID(pTsdb)); + tsdbWarn("vgId:%d insert tSma data failed since pDataBlocks is NULL", REPO_ID(pTsdb)); return terrno; } - if (taosArrayGetSize(pData->pDataBlock) <= 0) { + if (taosArrayGetSize(pDataBlocks) <= 0) { terrno = TSDB_CODE_INVALID_PARA; - tsdbWarn("vgId:%d insert tSma data failed since pDataBlock is empty", REPO_ID(pTsdb)); + tsdbWarn("vgId:%d insert tSma data failed since pDataBlocks is empty", REPO_ID(pTsdb)); return TSDB_CODE_FAILED; } @@ -899,10 +851,9 @@ static int32_t tsdbInsertTSmaDataImpl(STsdb *pTsdb, char *msg) { } STSma *pSma = pItem->pSma; - STSmaWriteH tSmaH = {0}; - if (tsdbInitTSmaWriteH(&tSmaH, pTsdb, pData, pSma->interval, pSma->intervalUnit) != 0) { + if (tsdbInitTSmaWriteH(&tSmaH, pTsdb, pDataBlocks, pSma->interval, pSma->intervalUnit) != 0) { return TSDB_CODE_FAILED; } @@ -921,33 +872,134 @@ static int32_t tsdbInsertTSmaDataImpl(STsdb *pTsdb, char *msg) { int32_t storageLevel = tsdbGetSmaStorageLevel(pSma->interval, pSma->intervalUnit); int32_t daysPerFile = tsdbGetTSmaDays(pTsdb, tSmaH.interval, storageLevel); + // key: skey + groupId + char smaKey[SMA_KEY_LEN] = {0}; + void *pSmaKey = &smaKey; + char dataBuf[512] = {0}; + void *pDataBuf = &dataBuf; + int32_t sz = taosArrayGetSize(pDataBlocks); + for (int32_t i = 0; i < sz; ++i) { + SSDataBlock *pDataBlock = *(SSDataBlock **)taosArrayGet(pDataBlocks, i); + int32_t colNum = pDataBlock->info.numOfCols; + int32_t rows = pDataBlock->info.rows; + int32_t rowSize = pDataBlock->info.rowSize; + int64_t groupId = pDataBlock->info.groupId; + for (int32_t j = 0; j < rows; ++j) { + printf("|"); + TSKEY skey = TSKEY_INITIAL_VAL; // the start key of TS window by interval + int32_t tlen = 0; + for (int32_t k = 0; k < colNum; ++k) { + SColumnInfoData *pColInfoData = *(SColumnInfoData **)taosArrayGet(pDataBlock->pDataBlock, k); + void *var = POINTER_SHIFT(pColInfoData->pData, j * pColInfoData->info.bytes); + switch (pColInfoData->info.type) { + case TSDB_DATA_TYPE_TIMESTAMP: + skey = *(TSKEY *)var; + printf(" skey = %" PRIi64 " groupId = %" PRId64 "|", skey, groupId); + tsdbEncodeTSmaKey(groupId, skey, &pSmaKey); + break; + case TSDB_DATA_TYPE_BOOL: + case TSDB_DATA_TYPE_UTINYINT: + printf(" %15d |", *(uint8_t *)var); + tlen += taosEncodeFixedU8(&pDataBuf, *(uint8_t *)var); + break; + case TSDB_DATA_TYPE_TINYINT: + printf(" %15d |", *(int8_t *)var); + tlen += taosEncodeFixedI8(&pDataBuf, *(int8_t *)var); + break; + case TSDB_DATA_TYPE_SMALLINT: + printf(" %15d |", *(int16_t *)var); + tlen += taosEncodeFixedI16(&pDataBuf, *(int16_t *)var); + break; + case TSDB_DATA_TYPE_USMALLINT: + printf(" %15d |", *(uint16_t *)var); + tlen += taosEncodeFixedU16(&pDataBuf, *(uint16_t *)var); + break; + case TSDB_DATA_TYPE_INT: + printf(" %15d |", *(int32_t *)var); + tlen += taosEncodeFixedI32(&pDataBuf, *(int32_t *)var); + break; + case TSDB_DATA_TYPE_FLOAT: + case TSDB_DATA_TYPE_UINT: + printf(" %15u |", *(uint32_t *)var); + tlen += taosEncodeFixedU32(&pDataBuf, *(uint32_t *)var); + break; + case TSDB_DATA_TYPE_BIGINT: + printf(" %15ld |", *(int64_t *)var); + tlen += taosEncodeFixedI64(&pDataBuf, *(int64_t *)var); + break; + case TSDB_DATA_TYPE_DOUBLE: + case TSDB_DATA_TYPE_UBIGINT: + printf(" %15lu |", *(uint64_t *)var); + tlen += taosEncodeFixedU64(&pDataBuf, *(uint64_t *)var); + break; + case TSDB_DATA_TYPE_NCHAR: { + char tmpChar[100] = {0}; + strncpy(tmpChar, varDataVal(var), varDataLen(var)); + printf(" %s |", tmpChar); + tlen += taosEncodeBinary(&pDataBuf, varDataVal(var), varDataLen(var)); + break; + } + case TSDB_DATA_TYPE_VARCHAR: { // TSDB_DATA_TYPE_BINARY + char tmpChar[100] = {0}; + strncpy(tmpChar, varDataVal(var), varDataLen(var)); + printf(" %s |", tmpChar); + tlen += taosEncodeBinary(&pDataBuf, varDataVal(var), varDataLen(var)); + break; + } + case TSDB_DATA_TYPE_VARBINARY: + // TODO: add binary/varbinary + TASSERT(0); + default: + printf("the column type %" PRIi16 " is undefined\n", pColInfoData->info.type); + TASSERT(0); + break; + } + } + if ((tlen > 0) && (skey != TSKEY_INITIAL_VAL)) { + int32_t fid = (int32_t)(TSDB_KEY_FID(skey, daysPerFile, pCfg->precision)); -#if 0 - int32_t fid = (int32_t)(TSDB_KEY_FID(pData->skey, daysPerFile, pCfg->precision)); + // Step 2: Set the DFile for storage of SMA index, and iterate/split the TSma data and store to B+Tree index + // file + // - Set and open the DFile or the B+Tree file + // TODO: tsdbStartTSmaCommit(); + if (fid != tSmaH.dFile.fid) { + if (tSmaH.dFile.fid != TSDB_IVLD_FID) { + tsdbCloseDBF(&tSmaH.dFile); + } + tsdbSetTSmaDataFile(&tSmaH, indexUid, fid); + if (tsdbOpenDBF(pTsdb->pTSmaEnv->dbEnv, &tSmaH.dFile) != 0) { + tsdbWarn("vgId:%d open DB file %s failed since %s", REPO_ID(pTsdb), + tSmaH.dFile.path ? tSmaH.dFile.path : "path is NULL", tstrerror(terrno)); + tsdbDestroyTSmaWriteH(&tSmaH); + tsdbUnRefSmaStat(pTsdb, pStat); + return TSDB_CODE_FAILED; + } + } - // Step 2: Set the DFile for storage of SMA index, and iterate/split the TSma data and store to B+Tree index file - // - Set and open the DFile or the B+Tree file - // TODO: tsdbStartTSmaCommit(); - tsdbSetTSmaDataFile(&tSmaH, pData, indexUid, fid); - if (tsdbOpenDBF(pTsdb->pTSmaEnv->dbEnv, &tSmaH.dFile) != 0) { - tsdbWarn("vgId:%d open DB file %s failed since %s", REPO_ID(pTsdb), - tSmaH.dFile.path ? tSmaH.dFile.path : "path is NULL", tstrerror(terrno)); - tsdbDestroyTSmaWriteH(&tSmaH); - tsdbUnRefSmaStat(pTsdb, pStat); - return TSDB_CODE_FAILED; + if (tsdbInsertTSmaBlocks(&tSmaH, pSmaKey, SMA_KEY_LEN, pDataBuf, tlen) != 0) { + tsdbWarn("vgId:%d insert tSma data blocks failed for index %" PRIi64 ", skey %" PRIi64 ", groupId %" PRIi64 + " since %s", + REPO_ID(pTsdb), indexUid, skey, groupId, tstrerror(terrno)); + tsdbDestroyTSmaWriteH(&tSmaH); + tsdbUnRefSmaStat(pTsdb, pStat); + return TSDB_CODE_FAILED; + } else { + tsdbWarn("vgId:%d insert tSma data blocks success for index %" PRIi64 ", skey %" PRIi64 ", groupId %" PRIi64, + REPO_ID(pTsdb), indexUid, skey, groupId); + } + // TODO:tsdbEndTSmaCommit(); + + // Step 3: reset the SSmaStat + tsdbResetExpiredWindow(pTsdb, SMA_ENV_STAT(pTsdb->pTSmaEnv), indexUid, skey); + } else { + tsdbWarn("vgId:%d invalid data skey:%" PRIi64 ", tlen %" PRIi32 " during insert tSma data for %" PRIi64, + REPO_ID(pTsdb), skey, tlen, indexUid); + } + + printf("\n"); + } } - if (tsdbInsertTSmaDataSection(&tSmaH, pData) != 0) { - tsdbWarn("vgId:%d insert tSma data section failed since %s", REPO_ID(pTsdb), tstrerror(terrno)); - tsdbDestroyTSmaWriteH(&tSmaH); - tsdbUnRefSmaStat(pTsdb, pStat); - return TSDB_CODE_FAILED; - } - // TODO:tsdbEndTSmaCommit(); - - // Step 3: reset the SSmaStat - tsdbResetExpiredWindow(pTsdb, SMA_ENV_STAT(pTsdb->pTSmaEnv), pData->indexUid, pData->skey); -#endif tsdbDestroyTSmaWriteH(&tSmaH); tsdbUnRefSmaStat(pTsdb, pStat); return TSDB_CODE_SUCCESS; @@ -1002,7 +1054,7 @@ static int32_t tsdbDropTSmaDataImpl(STsdb *pTsdb, int64_t indexUid) { // TODO: } -static int32_t tsdbSetRSmaDataFile(STSmaWriteH *pSmaH, STSmaDataWrapper *pData, int32_t fid) { +static int32_t tsdbSetRSmaDataFile(STSmaWriteH *pSmaH, int32_t fid) { STsdb *pTsdb = pSmaH->pTsdb; char tSmaFile[TSDB_FILENAME_LEN] = {0}; @@ -1012,11 +1064,11 @@ static int32_t tsdbSetRSmaDataFile(STSmaWriteH *pSmaH, STSmaDataWrapper *pData, return TSDB_CODE_SUCCESS; } -static int32_t tsdbInsertRSmaDataImpl(STsdb *pTsdb, char *msg) { - STsdbCfg *pCfg = REPO_CFG(pTsdb); - SSDataBlock *pData = (SSDataBlock *)msg; - SSmaEnv *pEnv = atomic_load_ptr(&pTsdb->pRSmaEnv); - int64_t indexUid = SMA_TEST_INDEX_UID; +static int32_t tsdbInsertRSmaDataImpl(STsdb *pTsdb, const char *msg) { + STsdbCfg *pCfg = REPO_CFG(pTsdb); + const SArray *pDataBlocks = (const SArray *)msg; + SSmaEnv *pEnv = atomic_load_ptr(&pTsdb->pRSmaEnv); + int64_t indexUid = SMA_TEST_INDEX_UID; if (pEnv == NULL) { terrno = TSDB_CODE_INVALID_PTR; @@ -1030,15 +1082,15 @@ static int32_t tsdbInsertRSmaDataImpl(STsdb *pTsdb, char *msg) { return terrno; } - if (pData == NULL) { + if (pDataBlocks == NULL) { terrno = TSDB_CODE_INVALID_PTR; - tsdbWarn("vgId:%d insert rSma data failed since pData is NULL", REPO_ID(pTsdb)); + tsdbWarn("vgId:%d insert rSma data failed since pDataBlocks is NULL", REPO_ID(pTsdb)); return terrno; } - if (taosArrayGetSize(pData->pDataBlock) <= 0) { + if (taosArrayGetSize(pDataBlocks) <= 0) { terrno = TSDB_CODE_INVALID_PARA; - tsdbWarn("vgId:%d insert rSma data failed since pDataBlock is empty", REPO_ID(pTsdb)); + tsdbWarn("vgId:%d insert rSma data failed since pDataBlocks is empty", REPO_ID(pTsdb)); return TSDB_CODE_FAILED; } @@ -1061,12 +1113,12 @@ static int32_t tsdbInsertRSmaDataImpl(STsdb *pTsdb, char *msg) { STSmaWriteH tSmaH = {0}; - if (tsdbInitTSmaWriteH(&tSmaH, pTsdb, pData, pSma->interval, pSma->intervalUnit) != 0) { + if (tsdbInitTSmaWriteH(&tSmaH, pTsdb, pDataBlocks, pSma->interval, pSma->intervalUnit) != 0) { return TSDB_CODE_FAILED; } - char rPath[TSDB_FILENAME_LEN] = {0}; - char aPath[TSDB_FILENAME_LEN] = {0}; + char rPath[TSDB_FILENAME_LEN] = {0}; + char aPath[TSDB_FILENAME_LEN] = {0}; snprintf(rPath, TSDB_FILENAME_LEN, "%s%s%" PRIi64, SMA_ENV_PATH(pEnv), TD_DIRSEP, indexUid); tfsAbsoluteName(REPO_TFS(pTsdb), SMA_ENV_DID(pEnv), rPath, aPath); if (!taosCheckExistFile(aPath)) { @@ -1078,7 +1130,7 @@ static int32_t tsdbInsertRSmaDataImpl(STsdb *pTsdb, char *msg) { // Step 1: Judge the storage level and days int32_t storageLevel = tsdbGetSmaStorageLevel(pSma->interval, pSma->intervalUnit); int32_t daysPerFile = tsdbGetTSmaDays(pTsdb, tSmaH.interval, storageLevel); - #if 0 +#if 0 int32_t fid = (int32_t)(TSDB_KEY_FID(pData->skey, daysPerFile, pCfg->precision)); // Step 2: Set the DFile for storage of SMA index, and iterate/split the TSma data and store to B+Tree index file @@ -1119,7 +1171,7 @@ static int32_t tsdbInsertRSmaDataImpl(STsdb *pTsdb, char *msg) { */ static int32_t tsdbInitTSmaReadH(STSmaReadH *pSmaH, STsdb *pTsdb, int64_t interval, int8_t intervalUnit) { pSmaH->pTsdb = pTsdb; - pSmaH->interval = tsdbGetIntervalByPrecision(interval, intervalUnit, REPO_CFG(pTsdb)->precision); + pSmaH->interval = tsdbGetIntervalByPrecision(interval, intervalUnit, REPO_CFG(pTsdb)->precision, true); pSmaH->storageLevel = tsdbGetSmaStorageLevel(interval, intervalUnit); pSmaH->days = tsdbGetTSmaDays(pTsdb, pSmaH->interval, pSmaH->storageLevel); } @@ -1185,17 +1237,11 @@ static bool tsdbSetAndOpenTSmaFile(STSmaReadH *pReadH, TSKEY *queryKey) { * @param pTsdb Return the data between queryWin and fill the pData. * @param pData * @param indexUid - * @param interval - * @param intervalUnit - * @param tableUid - * @param colId * @param pQuerySKey * @param nMaxResult The query invoker should control the nMaxResult need to return to avoid OOM. * @return int32_t */ -static int32_t tsdbGetTSmaDataImpl(STsdb *pTsdb, STSmaDataWrapper *pData, int64_t indexUid, int64_t interval, - int8_t intervalUnit, tb_uid_t tableUid, col_id_t colId, TSKEY querySKey, - int32_t nMaxResult) { +static int32_t tsdbGetTSmaDataImpl(STsdb *pTsdb, char *pData, int64_t indexUid, TSKEY querySKey, int32_t nMaxResult) { SSmaEnv *pEnv = atomic_load_ptr(&pTsdb->pTSmaEnv); if (!pEnv) { @@ -1243,13 +1289,18 @@ static int32_t tsdbGetTSmaDataImpl(STsdb *pTsdb, STSmaDataWrapper *pData, int64_ tsdbDebug("vgId:%d skey %" PRIi64 " of window not in expired window for index %" PRIi64, REPO_ID(pTsdb), querySKey, indexUid); } - tsdbUnRefSmaStat(pTsdb, SMA_ENV_STAT(pTsdb->pTSmaEnv)); + + STSma *pTSma = pItem->pSma; + + #endif STSmaReadH tReadH = {0}; - tsdbInitTSmaReadH(&tReadH, pTsdb, interval, intervalUnit); + tsdbInitTSmaReadH(&tReadH, pTsdb, pTSma->interval, pTSma->intervalUnit); tsdbCloseDBF(&tReadH.dFile); + + tsdbUnRefSmaStat(pTsdb, SMA_ENV_STAT(pTsdb->pTSmaEnv)); tsdbInitTSmaFile(&tReadH, indexUid, querySKey); if (tsdbOpenDBF(SMA_ENV_ENV(pTsdb->pTSmaEnv), &tReadH.dFile) != 0) { @@ -1259,7 +1310,8 @@ static int32_t tsdbGetTSmaDataImpl(STsdb *pTsdb, STSmaDataWrapper *pData, int64_ char smaKey[SMA_KEY_LEN] = {0}; void *pSmaKey = &smaKey; - tsdbEncodeTSmaKey(tableUid, colId, querySKey, (void **)&pSmaKey); + int64_t queryGroupId = 1; + tsdbEncodeTSmaKey(queryGroupId, querySKey, (void **)&pSmaKey); tsdbDebug("vgId:%d get sma data from %s: smaKey %" PRIx64 "-%" PRIu16 "-%" PRIx64 ", keyLen %d", REPO_ID(pTsdb), tReadH.dFile.path, *(tb_uid_t *)smaKey, *(uint16_t *)POINTER_SHIFT(smaKey, 8), @@ -1347,11 +1399,10 @@ int32_t tsdbRemoveTSmaData(STsdb *pTsdb, void *smaIndex, STimeWindow *pWin) { } #endif - // TODO: Who is responsible for resource allocate and release? -int32_t tsdbInsertTSmaData(STsdb *pTsdb, char *msg) { +int32_t tsdbInsertTSmaData(STsdb *pTsdb, int64_t indexUid, const char *msg) { int32_t code = TSDB_CODE_SUCCESS; - if ((code = tsdbInsertTSmaDataImpl(pTsdb, msg)) < 0) { + if ((code = tsdbInsertTSmaDataImpl(pTsdb, indexUid, msg)) < 0) { tsdbWarn("vgId:%d insert tSma data failed since %s", REPO_ID(pTsdb), tstrerror(terrno)); } return code; @@ -1373,18 +1424,14 @@ int32_t tsdbInsertRSmaData(STsdb *pTsdb, char *msg) { return code; } - -int32_t tsdbGetTSmaData(STsdb *pTsdb, STSmaDataWrapper *pData, int64_t indexUid, int64_t interval, int8_t intervalUnit, - tb_uid_t tableUid, col_id_t colId, TSKEY querySKey, int32_t nMaxResult) { +int32_t tsdbGetTSmaData(STsdb *pTsdb, char*pData, int64_t indexUid, TSKEY querySKey, int32_t nMaxResult) { int32_t code = TSDB_CODE_SUCCESS; - if ((code = tsdbGetTSmaDataImpl(pTsdb, pData, indexUid, interval, intervalUnit, tableUid, colId, querySKey, - nMaxResult)) < 0) { + if ((code = tsdbGetTSmaDataImpl(pTsdb, pData, indexUid, querySKey, nMaxResult)) < 0) { tsdbWarn("vgId:%d get tSma data failed since %s", REPO_ID(pTsdb), tstrerror(terrno)); } return code; } - int32_t tsdbDropTSmaData(STsdb *pTsdb, int64_t indexUid) { int32_t code = TSDB_CODE_SUCCESS; if ((code = tsdbDropTSmaDataImpl(pTsdb, indexUid)) < 0) { diff --git a/source/dnode/vnode/src/vnd/vnodeWrite.c b/source/dnode/vnode/src/vnd/vnodeWrite.c index 8875090b43..d6f9f0da0b 100644 --- a/source/dnode/vnode/src/vnd/vnodeWrite.c +++ b/source/dnode/vnode/src/vnd/vnodeWrite.c @@ -17,7 +17,9 @@ void smaHandleRes(void *pVnode, int64_t smaId, const SArray *data) { // TODO + blockDebugShowData(data); + tsdbInsertTSmaData(((SVnode *)pVnode)->pTsdb, smaId, (const char *)data); } void vnodeProcessWMsgs(SVnode *pVnode, SArray *pMsgs) { @@ -202,7 +204,7 @@ int vnodeApplyWMsg(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) { vCreateSmaReq.tSma.indexUid); // record current timezone of server side - tstrncpy(vCreateSmaReq.tSma.timezone, tsTimezoneStr, TD_TIMEZONE_LEN); + vCreateSmaReq.tSma.timezoneInt = tsTimezone; if (metaCreateTSma(pVnode->pMeta, &vCreateSmaReq) < 0) { // TODO: handle error diff --git a/source/dnode/vnode/test/tsdbSmaTest.cpp b/source/dnode/vnode/test/tsdbSmaTest.cpp index d010ea4437..4c8ddd9ead 100644 --- a/source/dnode/vnode/test/tsdbSmaTest.cpp +++ b/source/dnode/vnode/test/tsdbSmaTest.cpp @@ -15,6 +15,7 @@ #include #include + #include #include #include @@ -280,7 +281,7 @@ TEST(testCase, tSma_metaDB_Put_Get_Del_Test) { } #endif -#if 0 +#if 1 TEST(testCase, tSma_Data_Insert_Query_Test) { // step 1: prepare meta const char *smaIndexName1 = "sma_index_test_1"; @@ -299,9 +300,9 @@ TEST(testCase, tSma_Data_Insert_Query_Test) { // encode STSma tSma = {0}; tSma.version = 0; - tSma.intervalUnit = TIME_UNIT_DAY; + tSma.intervalUnit = TIME_UNIT_MINUTE; tSma.interval = 1; - tSma.slidingUnit = TIME_UNIT_HOUR; + tSma.slidingUnit = TIME_UNIT_MINUTE; tSma.sliding = 1; // sliding = interval when it's convert window tSma.indexUid = indexUid1; tstrncpy(tSma.indexName, smaIndexName1, TSDB_INDEX_NAME_LEN); @@ -330,8 +331,8 @@ TEST(testCase, tSma_Data_Insert_Query_Test) { ASSERT_EQ(metaSaveSmaToDB(pMeta, pSmaCfg), 0); // step 2: insert data - STsdb *pTsdb = (STsdb *)taosMemoryCalloc(1, sizeof(STsdb)); - STsdbCfg *pCfg = &pTsdb->config; + STsdb *pTsdb = (STsdb *)taosMemoryCalloc(1, sizeof(STsdb)); + STsdbCfg *pCfg = &pTsdb->config; pTsdb->pMeta = pMeta; pTsdb->vgId = 2; @@ -405,15 +406,94 @@ TEST(testCase, tSma_Data_Insert_Query_Test) { ASSERT_EQ(tsdbUpdateSmaWindow(pTsdb, (const char *)pMsg), 0); // init - int32_t allocCnt = 0; - int32_t allocStep = 16384; - int32_t buffer = 1024; - void *buf = NULL; - ASSERT_EQ(tsdbMakeRoom(&buf, allocStep), 0); - int32_t bufSize = taosTSizeof(buf); - int32_t numOfTables = 10; - col_id_t numOfCols = 4096; - ASSERT_GT(numOfCols, 0); + const int32_t tSmaGroupSize = 4; + const int32_t tSmaNumOfTags = 2; + const int64_t tSmaGroupId = 12345670; + const col_id_t tSmaNumOfCols = 9; // binary/nchar/varbinary/varchar are only used for tags for group by conditions. + const int32_t tSmaNumOfRows = 2; + + SArray *pDataBlocks = taosArrayInit(tSmaGroupSize, sizeof(SSDataBlock *)); + ASSERT_NE(pDataBlocks, nullptr); + int32_t tSmaTypeArray[tSmaNumOfCols] = {TSDB_DATA_TYPE_TIMESTAMP, TSDB_DATA_TYPE_BOOL, TSDB_DATA_TYPE_INT, + TSDB_DATA_TYPE_UBIGINT, TSDB_DATA_TYPE_SMALLINT, TSDB_DATA_TYPE_FLOAT, + TSDB_DATA_TYPE_DOUBLE, TSDB_DATA_TYPE_VARCHAR, TSDB_DATA_TYPE_NCHAR}; + // last 2 columns for group by tags + // int32_t tSmaTypeArray[tSmaNumOfCols] = {TSDB_DATA_TYPE_TIMESTAMP, TSDB_DATA_TYPE_BOOL}; + const char *tSmaGroupbyTags[tSmaGroupSize * tSmaNumOfTags] = {"BeiJing", "HaiDian", "BeiJing", "ChaoYang", + "ShangHai", "PuDong", "ShangHai", "MinHang"}; + TSKEY tSmaSKeyMs = (int64_t)1648535332 * 1000; + int64_t tSmaIntervalMs = tSma.interval * 60 * 1000; + int64_t tSmaInitVal = 0; + + for (int32_t g = 0; g < tSmaGroupSize; ++g) { + SSDataBlock *pDataBlock = (SSDataBlock *)taosMemoryCalloc(1, sizeof(SSDataBlock)); + ASSERT_NE(pDataBlock, nullptr); + pDataBlock->pBlockAgg = NULL; + pDataBlock->info.numOfCols = tSmaNumOfCols; + pDataBlock->info.rows = tSmaNumOfRows; + pDataBlock->info.groupId = tSmaGroupId + g; + + pDataBlock->pDataBlock = taosArrayInit(tSmaNumOfCols, sizeof(SColumnInfoData *)); + ASSERT_NE(pDataBlock->pDataBlock, nullptr); + for (int32_t c = 0; c < tSmaNumOfCols; ++c) { + + SColumnInfoData *pColInfoData = (SColumnInfoData *)taosMemoryCalloc(1, sizeof(SColumnInfoData)); + ASSERT_NE(pColInfoData, nullptr); + + pColInfoData->info.type = tSmaTypeArray[c]; + if (IS_VAR_DATA_TYPE(pColInfoData->info.type)) { + pColInfoData->info.bytes = 100; // update accordingly + } else { + pColInfoData->info.bytes = TYPE_BYTES[pColInfoData->info.type]; + } + pColInfoData->pData = (char *)taosMemoryCalloc(1, tSmaNumOfRows * pColInfoData->info.bytes); + + for (int32_t r = 0; r < tSmaNumOfRows; ++r) { + void *pCellData = pColInfoData->pData + r * pColInfoData->info.bytes; + switch (pColInfoData->info.type) { + case TSDB_DATA_TYPE_TIMESTAMP: + *(TSKEY *)pCellData = tSmaSKeyMs + tSmaIntervalMs * r; + break; + case TSDB_DATA_TYPE_BOOL: + *(bool *)pCellData = (bool)tSmaInitVal++; + break; + case TSDB_DATA_TYPE_INT: + *(int *)pCellData = (int)tSmaInitVal++; + break; + case TSDB_DATA_TYPE_UBIGINT: + *(uint64_t *)pCellData = (uint64_t)tSmaInitVal++; + break; + case TSDB_DATA_TYPE_SMALLINT: + *(int16_t *)pCellData = (int16_t)tSmaInitVal++; + break; + case TSDB_DATA_TYPE_FLOAT: + *(float *)pCellData = (float)tSmaInitVal++; + break; + case TSDB_DATA_TYPE_DOUBLE: + *(double *)pCellData = (double)tSmaInitVal++; + break; + case TSDB_DATA_TYPE_VARCHAR: // city + varDataSetLen(pCellData, strlen(tSmaGroupbyTags[g * 2])); + memcpy(varDataVal(pCellData), tSmaGroupbyTags[g * 2], varDataLen(pCellData)); + break; + case TSDB_DATA_TYPE_NCHAR: // district + varDataSetLen(pCellData, strlen(tSmaGroupbyTags[g * 2 + 1])); + memcpy(varDataVal(pCellData), tSmaGroupbyTags[g * 2 + 1], varDataLen(pCellData)); + break; + default: + ASSERT_EQ(0, 1); // add definition + break; + } + } + // push SColumnInfoData + taosArrayPush(pDataBlock->pDataBlock, &pColInfoData); + } + // push SSDataBlock + taosArrayPush(pDataBlocks, &pDataBlock); + } + + // execute + ASSERT_EQ(tsdbInsertTSmaData(pTsdb, tSma.indexUid, (const char *)pDataBlocks), TSDB_CODE_SUCCESS); #if 0 STSmaDataWrapper *pSmaData = NULL; @@ -464,26 +544,30 @@ TEST(testCase, tSma_Data_Insert_Query_Test) { ASSERT_EQ(tsdbInsertTSmaData(pTsdb, (char *)pSmaData), TSDB_CODE_SUCCESS); #endif - SSDataBlock *pSmaData = (SSDataBlock *)taosMemoryCalloc(1, sizeof(SSDataBlock)); - - - // step 3: query uint32_t checkDataCnt = 0; - for (int32_t t = 0; t < numOfTables; ++t) { - for (col_id_t c = 0; c < numOfCols; ++c) { - ASSERT_EQ(tsdbGetTSmaData(pTsdb, NULL, indexUid1, interval1, intervalUnit1, tbUid + t, - c + PRIMARYKEY_TIMESTAMP_COL_ID, skey1, 1), - TSDB_CODE_SUCCESS); - ++checkDataCnt; - } - } + ASSERT_EQ(tsdbGetTSmaData(pTsdb, NULL, indexUid1, skey1, 1), TSDB_CODE_SUCCESS); + ++checkDataCnt; printf("%s:%d The sma data check count for insert and query is %" PRIu32 "\n", __FILE__, __LINE__, checkDataCnt); // release data taosMemoryFreeClear(pMsg); - taosTZfree(buf); + + for (int32_t i = 0; i < taosArrayGetSize(pDataBlocks); ++i) { + SSDataBlock *pDataBlock = (SSDataBlock *)taosArrayGet(pDataBlocks, i); + int32_t numOfOutput = taosArrayGetSize(pDataBlock->pDataBlock); + for (int32_t j = 0; j < numOfOutput; ++j) { + SColumnInfoData *pColInfoData = (SColumnInfoData *)taosArrayGet(pDataBlock->pDataBlock, j); + colDataDestroy(pColInfoData); + } + + taosArrayDestroy(pDataBlock->pDataBlock); + taosMemoryFreeClear(pDataBlock->pBlockAgg); + taosMemoryFreeClear(pDataBlock); + } + taosArrayDestroy(pDataBlocks); + // release meta tdDestroyTSma(&tSma); tfsClose(pTsdb->pTfs); From 39b2fac3dcefeae9c84bec24d5f7de6e7b06bdfe Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Wed, 30 Mar 2022 08:01:49 +0000 Subject: [PATCH 19/49] refact more TDB --- source/libs/tdb/src/db/tdbBtree.c | 230 +++++++++++++++++------------- 1 file changed, 128 insertions(+), 102 deletions(-) diff --git a/source/libs/tdb/src/db/tdbBtree.c b/source/libs/tdb/src/db/tdbBtree.c index 6372216dd0..e9de8ab67e 100644 --- a/source/libs/tdb/src/db/tdbBtree.c +++ b/source/libs/tdb/src/db/tdbBtree.c @@ -988,105 +988,6 @@ int tdbBtcOpen(SBTC *pBtc, SBTree *pBt) { return 0; } -static int tdbBtcMoveTo(SBTC *pBtc, const void *pKey, int kLen, int *pCRst) { - int ret; - SBTree *pBt; - SPager *pPager; - - pBt = pBtc->pBt; - pPager = pBt->pPager; - - if (pBtc->iPage < 0) { - ASSERT(pBtc->iPage == -1); - ASSERT(pBtc->idx == -1); - - // Move from the root - ret = tdbPagerFetchPage(pPager, pBt->root, &(pBtc->pPage), tdbBtreeInitPage, pBt); - if (ret < 0) { - ASSERT(0); - return -1; - } - - pBtc->iPage = 0; - - if (TDB_PAGE_TOTAL_CELLS(pBtc->pPage) == 0) { - // Current page is empty - // ASSERT(TDB_FLAG_IS(TDB_PAGE_FLAGS(pBtc->pPage), TDB_BTREE_ROOT | TDB_BTREE_LEAF)); - return 0; - } - - for (;;) { - int lidx, ridx, midx, c, nCells; - SCell *pCell; - SPage *pPage; - SCellDecoder cd = {0}; - - pPage = pBtc->pPage; - nCells = TDB_PAGE_TOTAL_CELLS(pPage); - lidx = 0; - ridx = nCells - 1; - - ASSERT(nCells > 0); - - for (;;) { - if (lidx > ridx) break; - - midx = (lidx + ridx) >> 1; - - pCell = tdbPageGetCell(pPage, midx); - ret = tdbBtreeDecodeCell(pPage, pCell, &cd); - if (ret < 0) { - // TODO: handle error - ASSERT(0); - return -1; - } - - // Compare the key values - c = pBt->kcmpr(pKey, kLen, cd.pKey, cd.kLen); - if (c < 0) { - /* input-key < cell-key */ - ridx = midx - 1; - } else if (c > 0) { - /* input-key > cell-key */ - lidx = midx + 1; - } else { - /* input-key == cell-key */ - break; - } - } - - // Move downward or break - u8 leaf = TDB_BTREE_PAGE_IS_LEAF(pPage); - if (leaf) { - pBtc->idx = midx; - *pCRst = c; - break; - } else { - if (c <= 0) { - pBtc->idx = midx; - tdbBtcMoveDownward(pBtc, cd.pgno); - } else { - pBtc->idx = midx + 1; - if (midx == nCells - 1) { - /* Move to right-most child */ - tdbBtcMoveDownward(pBtc, ((SIntHdr *)pBtc->pPage->pData)->pgno); - } else { - pCell = tdbPageGetCell(pPage, pBtc->idx); - tdbBtreeDecodeCell(pPage, pCell, &cd); - tdbBtcMoveDownward(pBtc, cd.pgno); - } - } - } - } - - } else { - // TODO: Move the cursor from a some position instead of a clear state - ASSERT(0); - } - - return 0; -} - int tdbBtcMoveToFirst(SBTC *pBtc) { int ret; SBTree *pBt; @@ -1105,11 +1006,36 @@ int tdbBtcMoveToFirst(SBTC *pBtc) { return -1; } + ASSERT(TDB_BTREE_PAGE_IS_ROOT(pBtc->pPage)); + pBtc->iPage = 0; - pBtc->idx = 0; + if (TDB_PAGE_TOTAL_CELLS(pBtc->pPage) > 0) { + pBtc->idx = 0; + } else { + // no any data, point is invalid + ASSERT(TDB_BTREE_PAGE_IS_LEAF(pBtc->pPage)); + pBtc->idx = -1; + return 0; + } } else { // move from a position - ASSERT(0); + int iPage = 0; + + for (; iPage < pBtc->iPage; iPage++) { + ASSERT(pBtc->idxStack[iPage] >= 0); + if (pBtc->idxStack[iPage]) break; + } + + // move upward + for (;;) { + if (pBtc->iPage == 0) { + pBtc->idx = 0; + break; + } + + if (pBtc->iPage < iPage) break; + tdbBtcMoveUpward(pBtc); + } } // move downward @@ -1284,6 +1210,7 @@ static int tdbBtcMoveDownward(SBTC *pBtc, SPgno pgno) { ret = tdbPagerFetchPage(pBtc->pBt->pPager, pgno, &pBtc->pPage, tdbBtreeInitPage, pBtc->pBt); if (ret < 0) { ASSERT(0); + return -1; } return 0; @@ -1292,7 +1219,7 @@ static int tdbBtcMoveDownward(SBTC *pBtc, SPgno pgno) { static int tdbBtcMoveUpward(SBTC *pBtc) { if (pBtc->iPage == 0) return -1; - // tdbPagerReturnPage(pBtc->pBt->pPager, pBtc->pPage); + tdbPagerReturnPage(pBtc->pBt->pPager, pBtc->pPage); pBtc->iPage--; pBtc->pPage = pBtc->pgStack[pBtc->iPage]; @@ -1301,6 +1228,105 @@ static int tdbBtcMoveUpward(SBTC *pBtc) { return 0; } +static int tdbBtcMoveTo(SBTC *pBtc, const void *pKey, int kLen, int *pCRst) { + int ret; + SBTree *pBt; + SPager *pPager; + + pBt = pBtc->pBt; + pPager = pBt->pPager; + + if (pBtc->iPage < 0) { + ASSERT(pBtc->iPage == -1); + ASSERT(pBtc->idx == -1); + + // Move from the root + ret = tdbPagerFetchPage(pPager, pBt->root, &(pBtc->pPage), tdbBtreeInitPage, pBt); + if (ret < 0) { + ASSERT(0); + return -1; + } + + pBtc->iPage = 0; + + if (TDB_PAGE_TOTAL_CELLS(pBtc->pPage) == 0) { + // Current page is empty + // ASSERT(TDB_FLAG_IS(TDB_PAGE_FLAGS(pBtc->pPage), TDB_BTREE_ROOT | TDB_BTREE_LEAF)); + return 0; + } + + for (;;) { + int lidx, ridx, midx, c, nCells; + SCell *pCell; + SPage *pPage; + SCellDecoder cd = {0}; + + pPage = pBtc->pPage; + nCells = TDB_PAGE_TOTAL_CELLS(pPage); + lidx = 0; + ridx = nCells - 1; + + ASSERT(nCells > 0); + + for (;;) { + if (lidx > ridx) break; + + midx = (lidx + ridx) >> 1; + + pCell = tdbPageGetCell(pPage, midx); + ret = tdbBtreeDecodeCell(pPage, pCell, &cd); + if (ret < 0) { + // TODO: handle error + ASSERT(0); + return -1; + } + + // Compare the key values + c = pBt->kcmpr(pKey, kLen, cd.pKey, cd.kLen); + if (c < 0) { + /* input-key < cell-key */ + ridx = midx - 1; + } else if (c > 0) { + /* input-key > cell-key */ + lidx = midx + 1; + } else { + /* input-key == cell-key */ + break; + } + } + + // Move downward or break + u8 leaf = TDB_BTREE_PAGE_IS_LEAF(pPage); + if (leaf) { + pBtc->idx = midx; + *pCRst = c; + break; + } else { + if (c <= 0) { + pBtc->idx = midx; + tdbBtcMoveDownward(pBtc, cd.pgno); + } else { + pBtc->idx = midx + 1; + if (midx == nCells - 1) { + /* Move to right-most child */ + tdbBtcMoveDownward(pBtc, ((SIntHdr *)pBtc->pPage->pData)->pgno); + } else { + pCell = tdbPageGetCell(pPage, pBtc->idx); + tdbBtreeDecodeCell(pPage, pCell, &cd); + tdbBtcMoveDownward(pBtc, cd.pgno); + } + } + } + } + + } else { + // TODO: Move the cursor from a some position instead of a clear state + ASSERT(0); + } + + return 0; +} + int tdbBtcClose(SBTC *pBtc) { if (pBtc->iPage < 0) return 0; From 0977a484d78424c289ffef7b66e4bb4ee0f71a56 Mon Sep 17 00:00:00 2001 From: afwerar <1296468573@qq.com> Date: Wed, 30 Mar 2022 16:06:04 +0800 Subject: [PATCH 20/49] [TD-13759]: add pthread func. --- include/os/osThread.h | 250 +++++++++++++++------- source/os/src/osSocket.c | 4 +- source/os/src/osThread.c | 368 +++++++++++++++++++++++++-------- source/util/src/tprocess.c | 6 +- source/util/test/queueTest.cpp | 8 +- 5 files changed, 472 insertions(+), 164 deletions(-) diff --git a/include/os/osThread.h b/include/os/osThread.h index 8a0ace3e77..cca25f4fa4 100644 --- a/include/os/osThread.h +++ b/include/os/osThread.h @@ -42,81 +42,189 @@ typedef pthread_barrierattr_t TdThreadBarrierAttr; // If the error is in a third-party library, place this header file under the third-party library header file. // When you want to use this feature, you should find or add the same function in the following section. #ifndef ALLOW_FORBID_FUNC - #define pthread_t PTHREAD_T_TYPE_TAOS_FORBID - #define pthread_spinlock_t PTHREAD_SPINLOCK_T_TYPE_TAOS_FORBID - #define pthread_mutex_t PTHREAD_MUTEX_T_TYPE_TAOS_FORBID - #define pthread_mutexattr_t PTHREAD_MUTEXATTR_T_TYPE_TAOS_FORBID - #define pthread_rwlock_t PTHREAD_RWLOCK_T_TYPE_TAOS_FORBID - #define pthread_attr_t PTHREAD_ATTR_T_TYPE_TAOS_FORBID - #define pthread_once_t PTHREAD_ONCE_T_TYPE_TAOS_FORBID - #define pthread_rwlockattr_t PTHREAD_RWLOCKATTR_T_TYPE_TAOS_FORBID - #define pthread_cond_t PTHREAD_COND_T_TYPE_TAOS_FORBID - #define pthread_condattr_t PTHREAD_CONDATTR_T_TYPE_TAOS_FORBID - #define pthread_spin_init PTHREAD_SPIN_INIT_FUNC_TAOS_FORBID - #define pthread_mutex_init PTHREAD_MUTEX_INIT_FUNC_TAOS_FORBID - #define pthread_spin_destroy PTHREAD_SPIN_DESTROY_FUNC_TAOS_FORBID - #define pthread_mutex_destroy PTHREAD_MUTEX_DESTROY_FUNC_TAOS_FORBID - #define pthread_spin_lock PTHREAD_SPIN_LOCK_FUNC_TAOS_FORBID - #define pthread_mutex_lock PTHREAD_MUTEX_LOCK_FUNC_TAOS_FORBID - #define pthread_spin_unlock PTHREAD_SPIN_UNLOCK_FUNC_TAOS_FORBID - #define pthread_mutex_unlock PTHREAD_MUTEX_UNLOCK_FUNC_TAOS_FORBID - #define pthread_rwlock_rdlock PTHREAD_RWLOCK_RDLOCK_FUNC_TAOS_FORBID - #define pthread_rwlock_wrlock PTHREAD_RWLOCK_WRLOCK_FUNC_TAOS_FORBID - #define pthread_rwlock_unlock PTHREAD_RWLOCK_UNLOCK_FUNC_TAOS_FORBID - #define pthread_testcancel PTHREAD_TESTCANCEL_FUNC_TAOS_FORBID - #define pthread_attr_init PTHREAD_ATTR_INIT_FUNC_TAOS_FORBID - #define pthread_create PTHREAD_CREATE_FUNC_TAOS_FORBID - #define pthread_once PTHREAD_ONCE_FUNC_TAOS_FORBID - #define pthread_attr_setdetachstate PTHREAD_ATTR_SETDETACHSTATE_FUNC_TAOS_FORBID - #define pthread_attr_destroy PTHREAD_ATTR_DESTROY_FUNC_TAOS_FORBID - #define pthread_join PTHREAD_JOIN_FUNC_TAOS_FORBID - #define pthread_rwlock_init PTHREAD_RWLOCK_INIT_FUNC_TAOS_FORBID - #define pthread_rwlock_destroy PTHREAD_RWLOCK_DESTROY_FUNC_TAOS_FORBID - #define pthread_cond_signal PTHREAD_COND_SIGNAL_FUNC_TAOS_FORBID - #define pthread_cond_init PTHREAD_COND_INIT_FUNC_TAOS_FORBID - #define pthread_cond_broadcast PTHREAD_COND_BROADCAST_FUNC_TAOS_FORBID - #define pthread_cond_destroy PTHREAD_COND_DESTROY_FUNC_TAOS_FORBID - #define pthread_cond_wait PTHREAD_COND_WAIT_FUNC_TAOS_FORBID - #define pthread_self PTHREAD_SELF_FUNC_TAOS_FORBID - #define pthread_equal PTHREAD_EQUAL_FUNC_TAOS_FORBID - #define pthread_sigmask PTHREAD_SIGMASK_FUNC_TAOS_FORBID - #define pthread_cancel PTHREAD_CANCEL_FUNC_TAOS_FORBID - #define pthread_kill PTHREAD_KILL_FUNC_TAOS_FORBID - #define pthread_setname_np PTHREAD_SETNAME_FUNC_TAOS_FORBID + // #define pthread_t PTHREAD_T_TYPE_TAOS_FORBID + // #define pthread_spinlock_t PTHREAD_SPINLOCK_T_TYPE_TAOS_FORBID + // #define pthread_mutex_t PTHREAD_MUTEX_T_TYPE_TAOS_FORBID + // #define pthread_mutexattr_t PTHREAD_MUTEXATTR_T_TYPE_TAOS_FORBID + // #define pthread_rwlock_t PTHREAD_RWLOCK_T_TYPE_TAOS_FORBID + // #define pthread_attr_t PTHREAD_ATTR_T_TYPE_TAOS_FORBID + // #define pthread_once_t PTHREAD_ONCE_T_TYPE_TAOS_FORBID + // #define pthread_rwlockattr_t PTHREAD_RWLOCKATTR_T_TYPE_TAOS_FORBID + // #define pthread_cond_t PTHREAD_COND_T_TYPE_TAOS_FORBID + // #define pthread_condattr_t PTHREAD_CONDATTR_T_TYPE_TAOS_FORBID + // #define pthread_key_t PTHREAD_KEY_T_TYPE_TAOS_FORBID + // #define pthread_barrier_t PTHREAD_BARRIER_T_TYPE_TAOS_FORBID + // #define pthread_barrierattr_t PTHREAD_BARRIERATTR_T_TYPE_TAOS_FORBID + // #define pthread_create PTHREAD_CREATE_FUNC_TAOS_FORBID + // #define pthread_attr_destroy PTHREAD_ATTR_DESTROY_FUNC_TAOS_FORBID + // #define pthread_attr_getdetachstate PTHREAD_ATTR_GETDETACHSTATE_FUNC_TAOS_FORBID + // #define pthread_attr_getinheritsched PTHREAD_ATTR_GETINHERITSCHED_FUNC_TAOS_FORBID + // #define pthread_attr_getschedparam PTHREAD_ATTR_GETSCHEDPARAM_FUNC_TAOS_FORBID + // #define pthread_attr_getschedpolicy PTHREAD_ATTR_GETSCHEDPOLICY_FUNC_TAOS_FORBID + // #define pthread_attr_getscope PTHREAD_ATTR_GETSCOPE_FUNC_TAOS_FORBID + // #define pthread_attr_getstacksize PTHREAD_ATTR_GETSTACKSIZE_FUNC_TAOS_FORBID + // #define pthread_attr_init PTHREAD_ATTR_INIT_FUNC_TAOS_FORBID + // #define pthread_attr_setdetachstate PTHREAD_ATTR_SETDETACHSTATE_FUNC_TAOS_FORBID + // #define pthread_attr_setinheritsched PTHREAD_ATTR_SETINHERITSCHED_FUNC_TAOS_FORBID + // #define pthread_attr_setschedparam PTHREAD_ATTR_SETSCHEDPARAM_FUNC_TAOS_FORBID + // #define pthread_attr_setschedpolicy PTHREAD_ATTR_SETSCHEDPOLICY_FUNC_TAOS_FORBID + // #define pthread_attr_setscope PTHREAD_ATTR_SETSCOPE_FUNC_TAOS_FORBID + // #define pthread_attr_setstacksize PTHREAD_ATTR_SETSTACKSIZE_FUNC_TAOS_FORBID + // #define pthread_barrier_destroy PTHREAD_BARRIER_DESTROY_FUNC_TAOS_FORBID + // #define pthread_barrier_init PTHREAD_BARRIER_INIT_FUNC_TAOS_FORBID + // #define pthread_barrier_wait PTHREAD_BARRIER_WAIT_FUNC_TAOS_FORBID + // #define pthread_barrierattr_destroy PTHREAD_BARRIERATTR_DESTROY_FUNC_TAOS_FORBID + // #define pthread_barrierattr_getpshared PTHREAD_BARRIERATTR_GETPSHARED_FUNC_TAOS_FORBID + // #define pthread_barrierattr_init PTHREAD_BARRIERATTR_INIT_FUNC_TAOS_FORBID + // #define pthread_barrierattr_setpshared PTHREAD_BARRIERATTR_SETPSHARED_FUNC_TAOS_FORBID + // #define pthread_cancel PTHREAD_CANCEL_FUNC_TAOS_FORBID + // #define pthread_cond_destroy PTHREAD_COND_DESTROY_FUNC_TAOS_FORBID + // #define pthread_cond_init PTHREAD_COND_INIT_FUNC_TAOS_FORBID + // #define pthread_cond_signal PTHREAD_COND_SIGNAL_FUNC_TAOS_FORBID + // #define pthread_cond_broadcast PTHREAD_COND_BROADCAST_FUNC_TAOS_FORBID + // #define pthread_cond_wait PTHREAD_COND_WAIT_FUNC_TAOS_FORBID + // #define pthread_cond_timedwait PTHREAD_COND_TIMEDWAIT_FUNC_TAOS_FORBID + // #define pthread_condattr_destroy PTHREAD_CONDATTR_DESTROY_FUNC_TAOS_FORBID + // #define pthread_condattr_getpshared PTHREAD_CONDATTR_GETPSHARED_FUNC_TAOS_FORBID + // #define pthread_condattr_init PTHREAD_CONDATTR_INIT_FUNC_TAOS_FORBID + // #define pthread_condattr_setpshared PTHREAD_CONDATTR_SETPSHARED_FUNC_TAOS_FORBID + // #define pthread_detach PTHREAD_DETACH_FUNC_TAOS_FORBID + // #define pthread_equal PTHREAD_EQUAL_FUNC_TAOS_FORBID + // #define pthread_exit PTHREAD_EXIT_FUNC_TAOS_FORBID + // #define pthread_getschedparam PTHREAD_GETSCHEDPARAM_FUNC_TAOS_FORBID + // #define pthread_getspecific PTHREAD_GETSPECIFIC_FUNC_TAOS_FORBID + // #define pthread_join PTHREAD_JOIN_FUNC_TAOS_FORBID + // #define pthread_key_create PTHREAD_KEY_CREATE_FUNC_TAOS_FORBID + // #define pthread_key_delete PTHREAD_KEY_DELETE_FUNC_TAOS_FORBID + // #define pthread_kill PTHREAD_KILL_FUNC_TAOS_FORBID + // #define pthread_mutex_consistent PTHREAD_MUTEX_CONSISTENT_FUNC_TAOS_FORBID + // #define pthread_mutex_destroy PTHREAD_MUTEX_DESTROY_FUNC_TAOS_FORBID + // #define pthread_mutex_init PTHREAD_MUTEX_INIT_FUNC_TAOS_FORBID + // #define pthread_mutex_lock PTHREAD_MUTEX_LOCK_FUNC_TAOS_FORBID + // #define pthread_mutex_timedlock PTHREAD_MUTEX_TIMEDLOCK_FUNC_TAOS_FORBID + // #define pthread_mutex_trylock PTHREAD_MUTEX_TRYLOCK_FUNC_TAOS_FORBID + // #define pthread_mutex_unlock PTHREAD_MUTEX_UNLOCK_FUNC_TAOS_FORBID + // #define pthread_mutexattr_destroy PTHREAD_MUTEXATTR_DESTROY_FUNC_TAOS_FORBID + // #define pthread_mutexattr_getpshared PTHREAD_MUTEXATTR_GETPSHARED_FUNC_TAOS_FORBID + // #define pthread_mutexattr_getrobust PTHREAD_MUTEXATTR_GETROBUST_FUNC_TAOS_FORBID + // #define pthread_mutexattr_gettype PTHREAD_MUTEXATTR_GETTYPE_FUNC_TAOS_FORBID + // #define pthread_mutexattr_init PTHREAD_MUTEXATTR_INIT_FUNC_TAOS_FORBID + // #define pthread_mutexattr_setpshared PTHREAD_MUTEXATTR_SETPSHARED_FUNC_TAOS_FORBID + // #define pthread_mutexattr_setrobust PTHREAD_MUTEXATTR_SETROBUST_FUNC_TAOS_FORBID + // #define pthread_mutexattr_settype PTHREAD_MUTEXATTR_SETTYPE_FUNC_TAOS_FORBID + // #define pthread_once PTHREAD_ONCE_FUNC_TAOS_FORBID + // #define pthread_rwlock_destroy PTHREAD_RWLOCK_DESTROY_FUNC_TAOS_FORBID + // #define pthread_rwlock_init PTHREAD_RWLOCK_INIT_FUNC_TAOS_FORBID + // #define pthread_rwlock_rdlock PTHREAD_RWLOCK_RDLOCK_FUNC_TAOS_FORBID + // #define pthread_rwlock_timedrdlock PTHREAD_RWLOCK_TIMEDRDLOCK_FUNC_TAOS_FORBID + // #define pthread_rwlock_timedwrlock PTHREAD_RWLOCK_TIMEDWRLOCK_FUNC_TAOS_FORBID + // #define pthread_rwlock_tryrdlock PTHREAD_RWLOCK_TRYRDLOCK_FUNC_TAOS_FORBID + // #define pthread_rwlock_trywrlock PTHREAD_RWLOCK_TRYWRLOCK_FUNC_TAOS_FORBID + // #define pthread_rwlock_unlock PTHREAD_RWLOCK_UNLOCK_FUNC_TAOS_FORBID + // #define pthread_rwlock_wrlock PTHREAD_RWLOCK_WRLOCK_FUNC_TAOS_FORBID + // #define pthread_rwlockattr_destroy PTHREAD_RWLOCKATTR_DESTROY_FUNC_TAOS_FORBID + // #define pthread_rwlockattr_getpshared PTHREAD_RWLOCKATTR_GETPSHARED_FUNC_TAOS_FORBID + // #define pthread_rwlockattr_init PTHREAD_RWLOCKATTR_INIT_FUNC_TAOS_FORBID + // #define pthread_rwlockattr_setpshared PTHREAD_RWLOCKATTR_SETPSHARED_FUNC_TAOS_FORBID + // #define pthread_self PTHREAD_SELF_FUNC_TAOS_FORBID + // #define pthread_setcancelstate PTHREAD_SETCANCELSTATE_FUNC_TAOS_FORBID + // #define pthread_setcanceltype PTHREAD_SETCANCELTYPE_FUNC_TAOS_FORBID + // #define pthread_setschedparam PTHREAD_SETSCHEDPARAM_FUNC_TAOS_FORBID + // #define pthread_setspecific PTHREAD_SETSPECIFIC_FUNC_TAOS_FORBID + // #define pthread_spin_destroy PTHREAD_SPIN_DESTROY_FUNC_TAOS_FORBID + // #define pthread_spin_init PTHREAD_SPIN_INIT_FUNC_TAOS_FORBID + // #define pthread_spin_lock PTHREAD_SPIN_LOCK_FUNC_TAOS_FORBID + // #define pthread_spin_trylock PTHREAD_SPIN_TRYLOCK_FUNC_TAOS_FORBID + // #define pthread_spin_unlock PTHREAD_SPIN_UNLOCK_FUNC_TAOS_FORBID + // #define pthread_testcancel PTHREAD_TESTCANCEL_FUNC_TAOS_FORBID + // #define pthread_sigmask PTHREAD_SIGMASK_FUNC_TAOS_FORBID + // #define sigwait SIGWAIT_FUNC_TAOS_FORBID #endif -int32_t taosThreadSpinInit(TdThreadSpinlock *lock, int pshared); -int32_t taosThreadMutexInit(TdThreadMutex *mutex, const TdThreadMutexAttr *attr); -int32_t taosThreadSpinDestroy(TdThreadSpinlock *lock); -int32_t taosThreadMutexDestroy(TdThreadMutex * mutex); -int32_t taosThreadSpinLock(TdThreadSpinlock *lock); -int32_t taosThreadSpinTryLock(TdThreadSpinlock *lock); -int32_t taosThreadMutexLock(TdThreadMutex *mutex); -int32_t taosThreadRwlockRdlock(TdThreadRwlock *rwlock); -int32_t taosThreadSpinUnlock(TdThreadSpinlock *lock); -int32_t taosThreadMutexUnlock(TdThreadMutex *mutex); -int32_t taosThreadRwlockWrlock(TdThreadRwlock *rwlock); -int32_t taosThreadRwlockUnlock(TdThreadRwlock *rwlock); -void taosThreadTestCancel(void); -int32_t taosThreadAttrInit(TdThreadAttr *attr); -int32_t taosThreadCreate(TdThread *tid, const TdThreadAttr *attr, void*(*start)(void*), void *arg); -int32_t taosThreadOnce(TdThreadOnce *onceControl, void(*initRoutine)(void)); -int32_t taosThreadAttrSetDetachState(TdThreadAttr *attr, int32_t detachState); -int32_t taosThreadAttrDestroy(TdThreadAttr *attr); -int32_t taosThreadJoin(TdThread thread, void **pValue); -int32_t taosThreadRwlockInit(TdThreadRwlock *rwlock, const TdThreadRwlockAttr *attr); -int32_t taosThreadRwlockDestroy(TdThreadRwlock *rwlock); -int32_t taosThreadCondSignal(TdThreadCond *cond); -int32_t taosThreadCondInit(TdThreadCond *cond, const TdThreadCondAttr *attr); -int32_t taosThreadCondBroadcast(TdThreadCond *cond); -int32_t taosThreadCondDestroy(TdThreadCond *cond); -int32_t taosThreadCondWait(TdThreadCond *cond, TdThreadMutex *mutex); -TdThread taosThreadSelf(void); -int32_t taosThreadEqual(TdThread t1, TdThread t2); -int32_t taosThreadSigmask(int how, sigset_t const *set, sigset_t *oset); +int32_t taosThreadCreate(TdThread * tid, const TdThreadAttr * attr, void *(*start)(void *), void *arg); +int32_t taosThreadAttrDestroy(TdThreadAttr * attr); +int32_t taosThreadAttrGetDetachState(const TdThreadAttr * attr, int32_t *detachstate); +int32_t taosThreadAttrGetInheritSched(const TdThreadAttr * attr, int32_t *inheritsched); +int32_t taosThreadAttrGetSchedParam(const TdThreadAttr * attr, struct sched_param *param); +int32_t taosThreadAttrGetSchedPolicy(const TdThreadAttr * attr, int32_t *policy); +int32_t taosThreadAttrGetScope(const TdThreadAttr * attr, int32_t *contentionscope); +int32_t taosThreadAttrGetStackSize(const TdThreadAttr * attr, size_t * stacksize); +int32_t taosThreadAttrInit(TdThreadAttr * attr); +int32_t taosThreadAttrSetDetachState(TdThreadAttr * attr, int32_t detachstate); +int32_t taosThreadAttrSetInheritSched(TdThreadAttr * attr, int32_t inheritsched); +int32_t taosThreadAttrSetSchedParam(TdThreadAttr * attr, const struct sched_param *param); +int32_t taosThreadAttrSetSchedPolicy(TdThreadAttr * attr, int32_t policy); +int32_t taosThreadAttrSetScope(TdThreadAttr * attr, int32_t contentionscope); +int32_t taosThreadAttrSetStackSize(TdThreadAttr * attr, size_t stacksize); +int32_t taosThreadBarrierDestroy(TdThreadBarrier * barrier); +int32_t taosThreadBarrierInit(TdThreadBarrier * barrier, const TdThreadBarrierAttr * attr, uint32_t count); +int32_t taosThreadBarrierWait(TdThreadBarrier * barrier); +int32_t taosThreadBarrierAttrDestroy(TdThreadBarrierAttr * attr); +int32_t taosThreadBarrierAttrGetPshared(const TdThreadBarrierAttr * attr, int32_t *pshared); +int32_t taosThreadBarrierAttrInit(TdThreadBarrierAttr * attr); +int32_t taosThreadBarrierAttrSetPshared(TdThreadBarrierAttr * attr, int32_t pshared); int32_t taosThreadCancel(TdThread thread); -int32_t taosThreadKill(TdThread thread, int sig); +int32_t taosThreadCondDestroy(TdThreadCond * cond); +int32_t taosThreadCondInit(TdThreadCond * cond, const TdThreadCondAttr * attr); +int32_t taosThreadCondSignal(TdThreadCond * cond); +int32_t taosThreadCondBroadcast(TdThreadCond * cond); +int32_t taosThreadCondWait(TdThreadCond * cond, TdThreadMutex * mutex); +int32_t taosThreadCondTimedWait(TdThreadCond * cond, TdThreadMutex * mutex, const struct timespec *abstime); +int32_t taosThreadCondAttrDestroy(TdThreadCondAttr * attr); +int32_t taosThreadCondAttrGetPshared(const TdThreadCondAttr * attr, int32_t *pshared); +int32_t taosThreadCondAttrInit(TdThreadCondAttr * attr); +int32_t taosThreadCondAttrSetPshared(TdThreadCondAttr * attr, int32_t pshared); int32_t taosThreadDetach(TdThread thread); +int32_t taosThreadEqual(TdThread t1, TdThread t2); +void taosThreadExit(void *valuePtr); +int32_t taosThreadGetSchedParam(TdThread thread, int32_t *policy, struct sched_param *param); +void *taosThreadGetSpecific(TdThreadKey key); +int32_t taosThreadJoin(TdThread thread, void **valuePtr); +int32_t taosThreadKeyCreate(TdThreadKey * key, void(*destructor)(void *)); +int32_t taosThreadKeyDelete(TdThreadKey key); +int32_t taosThreadKill(TdThread thread, int32_t sig); +int32_t taosThreadMutexConsistent(TdThreadMutex* mutex); +int32_t taosThreadMutexDestroy(TdThreadMutex * mutex); +int32_t taosThreadMutexInit(TdThreadMutex * mutex, const TdThreadMutexAttr * attr); +int32_t taosThreadMutexLock(TdThreadMutex * mutex); +int32_t taosThreadMutexTimedLock(TdThreadMutex * mutex, const struct timespec *abstime); +int32_t taosThreadMutexTryLock(TdThreadMutex * mutex); +int32_t taosThreadMutexUnlock(TdThreadMutex * mutex); +int32_t taosThreadMutexAttrDestroy(TdThreadMutexAttr * attr); +int32_t taosThreadMutexAttrGetPshared(const TdThreadMutexAttr * attr, int32_t *pshared); +int32_t taosThreadMutexAttrGetRobust(const TdThreadMutexAttr * attr, int32_t * robust); +int32_t taosThreadMutexAttrGetType(const TdThreadMutexAttr * attr, int32_t *kind); +int32_t taosThreadMutexAttrInit(TdThreadMutexAttr * attr); +int32_t taosThreadMutexAttrSetPshared(TdThreadMutexAttr * attr, int32_t pshared); +int32_t taosThreadMutexAttrSetRobust(TdThreadMutexAttr * attr, int32_t robust); +int32_t taosThreadMutexAttrSetType(TdThreadMutexAttr * attr, int32_t kind); +int32_t taosThreadOnce(TdThreadOnce * onceControl, void(*initRoutine)(void)); +int32_t taosThreadRwlockDestroy(TdThreadRwlock * rwlock); +int32_t taosThreadRwlockInit(TdThreadRwlock * rwlock, const TdThreadRwlockAttr * attr); +int32_t taosThreadRwlockRdlock(TdThreadRwlock * rwlock); +int32_t taosThreadRwlockTimedRdlock(TdThreadRwlock * rwlock, const struct timespec *abstime); +int32_t taosThreadRwlockTimedWrlock(TdThreadRwlock * rwlock, const struct timespec *abstime); +int32_t taosThreadRwlockTryRdlock(TdThreadRwlock * rwlock); +int32_t taosThreadRwlockTryWrlock(TdThreadRwlock * rwlock); +int32_t taosThreadRwlockUnlock(TdThreadRwlock * rwlock); +int32_t taosThreadRwlockWrlock(TdThreadRwlock * rwlock); +int32_t taosThreadRwlockAttrDestroy(TdThreadRwlockAttr * attr); +int32_t taosThreadRwlockAttrGetPshared(const TdThreadRwlockAttr * attr, int32_t *pshared); +int32_t taosThreadRwlockAttrInit(TdThreadRwlockAttr * attr); +int32_t taosThreadRwlockAttrSetPshared(TdThreadRwlockAttr * attr, int32_t pshared); +TdThread taosThreadSelf(void); +int32_t taosThreadSetCancelState(int32_t state, int32_t *oldstate); +int32_t taosThreadSetCancelType(int32_t type, int32_t *oldtype); +int32_t taosThreadSetSchedParam(TdThread thread, int32_t policy, const struct sched_param *param); +int32_t taosThreadSetSpecific(TdThreadKey key, const void *value); +int32_t taosThreadSpinDestroy(TdThreadSpinlock * lock); +int32_t taosThreadSpinInit(TdThreadSpinlock * lock, int32_t pshared); +int32_t taosThreadSpinLock(TdThreadSpinlock * lock); +int32_t taosThreadSpinTrylock(TdThreadSpinlock * lock); +int32_t taosThreadSpinUnlock(TdThreadSpinlock * lock); +void taosThreadTestCancel(void); +int32_t taosThreadSigMask(int32_t how, sigset_t const *set, sigset_t * oset); +int32_t taosThreadSigWait(const sigset_t * set, int32_t *sig); #ifdef __cplusplus } diff --git a/source/os/src/osSocket.c b/source/os/src/osSocket.c index b130689d4b..d79d7c3d58 100644 --- a/source/os/src/osSocket.c +++ b/source/os/src/osSocket.c @@ -758,7 +758,7 @@ void taosBlockSIGPIPE() { sigset_t signal_mask; sigemptyset(&signal_mask); sigaddset(&signal_mask, SIGPIPE); - int32_t rc = taosThreadSigmask(SIG_BLOCK, &signal_mask, NULL); + int32_t rc = taosThreadSigMask(SIG_BLOCK, &signal_mask, NULL); if (rc != 0) { // printf("failed to block SIGPIPE"); } @@ -876,7 +876,7 @@ void taosSetMaskSIGPIPE() { sigset_t signal_mask; sigemptyset(&signal_mask); sigaddset(&signal_mask, SIGPIPE); - int32_t rc = taosThreadSigmask(SIG_SETMASK, &signal_mask, NULL); + int32_t rc = taosThreadSigMask(SIG_SETMASK, &signal_mask, NULL); if (rc != 0) { // printf("failed to setmask SIGPIPE"); } diff --git a/source/os/src/osThread.c b/source/os/src/osThread.c index 386534500f..436614ad6a 100644 --- a/source/os/src/osThread.c +++ b/source/os/src/osThread.c @@ -17,138 +17,338 @@ #include #include "os.h" -// int32_t taosThreadSetnameNp(TdThread thread, const char *name) { -// return pthread_setname_np(thread,name); -// } - -int32_t taosThreadSpinInit(TdThreadSpinlock *lock, int pshared) { - return pthread_spin_init(lock, pshared); +int32_t taosThreadCreate(TdThread * tid, const TdThreadAttr * attr, void *(*start)(void *), void *arg) { + return pthread_create(tid, attr, start, arg); } -int32_t taosThreadMutexInit(TdThreadMutex *mutex, const TdThreadMutexAttr *attr) { - return pthread_mutex_init(mutex, attr); +int32_t taosThreadAttrDestroy(TdThreadAttr * attr) { + return pthread_attr_destroy(attr); } -int32_t taosThreadSpinDestroy(TdThreadSpinlock *lock) { - return pthread_spin_destroy(lock); +int32_t taosThreadAttrGetDetachState(const TdThreadAttr * attr, int32_t *detachstate) { + return pthread_attr_getdetachstate(attr, detachstate); } -int32_t taosThreadMutexDestroy(TdThreadMutex * mutex) { - return pthread_mutex_destroy(mutex); +int32_t taosThreadAttrGetInheritSched(const TdThreadAttr * attr, int32_t *inheritsched) { + return pthread_attr_getinheritsched(attr, inheritsched); } -int32_t taosThreadSpinLock(TdThreadSpinlock *lock) { - return pthread_spin_lock(lock); +int32_t taosThreadAttrGetSchedParam(const TdThreadAttr * attr, struct sched_param *param) { + return pthread_attr_getschedparam(attr, param); } -int32_t taosThreadSpinTryLock(TdThreadSpinlock *lock) { - return pthread_spin_trylock(lock); +int32_t taosThreadAttrGetSchedPolicy(const TdThreadAttr * attr, int32_t *policy) { + return pthread_attr_getschedpolicy(attr, policy); } -int32_t taosThreadMutexLock(TdThreadMutex *mutex) { - return pthread_mutex_lock(mutex); +int32_t taosThreadAttrGetScope(const TdThreadAttr * attr, int32_t *contentionscope) { + return pthread_attr_getscope(attr, contentionscope); } -int32_t taosThreadSpinUnlock(TdThreadSpinlock *lock) { - return pthread_spin_unlock(lock); +int32_t taosThreadAttrGetStackSize(const TdThreadAttr * attr, size_t * stacksize) { + return pthread_attr_getstacksize(attr, stacksize); } -int32_t taosThreadMutexUnlock(TdThreadMutex *mutex) { - return pthread_mutex_unlock(mutex); +int32_t taosThreadAttrInit(TdThreadAttr * attr) { + return pthread_attr_init(attr); } -int32_t taosThreadRwlockRdlock(TdThreadRwlock *rwlock) { - return pthread_rwlock_rdlock(rwlock); +int32_t taosThreadAttrSetDetachState(TdThreadAttr * attr, int32_t detachstate) { + return pthread_attr_setdetachstate(attr, detachstate); } -int32_t taosThreadRwlockWrlock(TdThreadRwlock *rwlock) { - return pthread_rwlock_wrlock(rwlock); +int32_t taosThreadAttrSetInheritSched(TdThreadAttr * attr, int32_t inheritsched) { + return pthread_attr_setinheritsched(attr, inheritsched); } -int32_t taosThreadRwlockUnlock(TdThreadRwlock *rwlock) { - return pthread_rwlock_unlock(rwlock); +int32_t taosThreadAttrSetSchedParam(TdThreadAttr * attr, const struct sched_param *param) { + return pthread_attr_setschedparam(attr, param); } -void taosThreadTestCancel(void) { - return pthread_testcancel(); +int32_t taosThreadAttrSetSchedPolicy(TdThreadAttr * attr, int32_t policy) { + return pthread_attr_setschedpolicy(attr, policy); } -int32_t taosThreadAttrInit(TdThreadAttr *attr) { - return pthread_attr_init(attr); +int32_t taosThreadAttrSetScope(TdThreadAttr * attr, int32_t contentionscope) { + return pthread_attr_setscope(attr, contentionscope); } -int32_t taosThreadCreate(TdThread *tid, const TdThreadAttr *attr, void*(*start)(void*), void *arg) { - return pthread_create(tid, attr, start, arg); +int32_t taosThreadAttrSetStackSize(TdThreadAttr * attr, size_t stacksize) { + return pthread_attr_setstacksize(attr, stacksize); } -int32_t taosThreadOnce(TdThreadOnce *onceControl, void(*initRoutine)(void)) { - return pthread_once(onceControl, initRoutine); +int32_t taosThreadBarrierDestroy(TdThreadBarrier * barrier) { + return pthread_barrier_destroy(barrier); } -int32_t taosThreadAttrSetDetachState(TdThreadAttr *attr, int32_t detachState) { - return pthread_attr_setdetachstate(attr, detachState); +int32_t taosThreadBarrierInit(TdThreadBarrier * barrier, const TdThreadBarrierAttr * attr, uint32_t count) { + return pthread_barrier_init(barrier, attr, count); } -int32_t taosThreadAttrDestroy(TdThreadAttr *attr) { - return pthread_attr_destroy(attr); +int32_t taosThreadBarrierWait(TdThreadBarrier * barrier) { + return pthread_barrier_wait(barrier); } -int32_t taosThreadJoin(TdThread thread, void **pValue) { - return pthread_join(thread, pValue); +int32_t taosThreadBarrierAttrDestroy(TdThreadBarrierAttr * attr) { + return pthread_barrierattr_destroy(attr); } -int32_t taosThreadRwlockInit(TdThreadRwlock *rwlock, const TdThreadRwlockAttr *attr) { - return pthread_rwlock_init(rwlock, attr); +int32_t taosThreadBarrierAttrGetPshared(const TdThreadBarrierAttr * attr, int32_t *pshared) { + return pthread_barrierattr_getpshared(attr, pshared); } -int32_t taosThreadRwlockDestroy(TdThreadRwlock *rwlock) { - return pthread_rwlock_destroy(rwlock); +int32_t taosThreadBarrierAttrInit(TdThreadBarrierAttr * attr) { + return pthread_barrierattr_init(attr); } -int32_t taosThreadCondSignal(TdThreadCond *cond) { - return pthread_cond_signal(cond); -} - -int32_t taosThreadCondInit(TdThreadCond *cond, const TdThreadCondAttr *attr) { - return pthread_cond_init(cond, attr); -} - -int32_t taosThreadCondBroadcast(TdThreadCond *cond) { - return pthread_cond_broadcast(cond); -} - -int32_t taosThreadCondDestroy(TdThreadCond *cond) { - return pthread_cond_destroy(cond); -} - -int32_t taosThreadCondWait(TdThreadCond *cond, TdThreadMutex *mutex) { - return pthread_cond_wait(cond, mutex); -} - -TdThread taosThreadSelf(void) { - return pthread_self(); -} - -// int32_t taosThreadGetW32ThreadIdNp(TdThread thread) { -// return pthread_getw32threadid_np(thread); -// } - -int32_t taosThreadEqual(TdThread t1, TdThread t2) { - return pthread_equal(t1, t2); -} - -int32_t taosThreadSigmask(int how, sigset_t const *set, sigset_t *oset) { - return pthread_sigmask(how, set, oset); +int32_t taosThreadBarrierAttrSetPshared(TdThreadBarrierAttr * attr, int32_t pshared) { + return pthread_barrierattr_setpshared(attr, pshared); } int32_t taosThreadCancel(TdThread thread) { - return pthread_cancel(thread); + return pthread_cancel(thread); } -int32_t taosThreadKill(TdThread thread, int sig) { - return pthread_kill(thread, sig); +int32_t taosThreadCondDestroy(TdThreadCond * cond) { + return pthread_cond_destroy(cond); +} + +int32_t taosThreadCondInit(TdThreadCond * cond, const TdThreadCondAttr * attr) { + return pthread_cond_init(cond, attr); +} + +int32_t taosThreadCondSignal(TdThreadCond * cond) { + return pthread_cond_signal(cond); +} + +int32_t taosThreadCondBroadcast(TdThreadCond * cond) { + return pthread_cond_broadcast(cond); +} + +int32_t taosThreadCondWait(TdThreadCond * cond, TdThreadMutex * mutex) { + return pthread_cond_wait(cond, mutex); +} + +int32_t taosThreadCondTimedWait(TdThreadCond * cond, TdThreadMutex * mutex, const struct timespec *abstime) { + return pthread_cond_timedwait(cond, mutex, abstime); +} + +int32_t taosThreadCondAttrDestroy(TdThreadCondAttr * attr) { + return pthread_condattr_destroy(attr); +} + +int32_t taosThreadCondAttrGetPshared(const TdThreadCondAttr * attr, int32_t *pshared) { + return pthread_condattr_getpshared(attr, pshared); +} + +int32_t taosThreadCondAttrInit(TdThreadCondAttr * attr) { + return pthread_condattr_init(attr); +} + +int32_t taosThreadCondAttrSetPshared(TdThreadCondAttr * attr, int32_t pshared) { + return pthread_condattr_setpshared(attr, pshared); } int32_t taosThreadDetach(TdThread thread) { - return pthread_detach(thread); + return pthread_detach(thread); +} + +int32_t taosThreadEqual(TdThread t1, TdThread t2) { + return pthread_equal(t1, t2); +} + +void taosThreadExit(void *valuePtr) { + return pthread_exit(valuePtr); +} + +int32_t taosThreadGetSchedParam(TdThread thread, int32_t *policy, struct sched_param *param) { + return pthread_getschedparam(thread, policy, param); +} + +void *taosThreadGetSpecific(TdThreadKey key) { + return pthread_getspecific(key); +} + +int32_t taosThreadJoin(TdThread thread, void **valuePtr) { + return pthread_join(thread, valuePtr); +} + +int32_t taosThreadKeyCreate(TdThreadKey * key, void(*destructor)(void *)) { + return pthread_key_create(key, destructor); +} + +int32_t taosThreadKeyDelete(TdThreadKey key) { + return pthread_key_delete(key); +} + +int32_t taosThreadKill(TdThread thread, int32_t sig) { + return pthread_kill(thread, sig); +} + +int32_t taosThreadMutexConsistent(TdThreadMutex* mutex) { + return pthread_mutex_consistent(mutex); +} + +int32_t taosThreadMutexDestroy(TdThreadMutex * mutex) { + return pthread_mutex_destroy(mutex); +} + +int32_t taosThreadMutexInit(TdThreadMutex * mutex, const TdThreadMutexAttr * attr) { + return pthread_mutex_init(mutex, attr); +} + +int32_t taosThreadMutexLock(TdThreadMutex * mutex) { + return pthread_mutex_lock(mutex); +} + +int32_t taosThreadMutexTimedLock(TdThreadMutex * mutex, const struct timespec *abstime) { + return pthread_mutex_timedlock(mutex, abstime); +} + +int32_t taosThreadMutexTryLock(TdThreadMutex * mutex) { + return pthread_mutex_trylock(mutex); +} + +int32_t taosThreadMutexUnlock(TdThreadMutex * mutex) { + return pthread_mutex_unlock(mutex); +} + +int32_t taosThreadMutexAttrDestroy(TdThreadMutexAttr * attr) { + return pthread_mutexattr_destroy(attr); +} + +int32_t taosThreadMutexAttrGetPshared(const TdThreadMutexAttr * attr, int32_t *pshared) { + return pthread_mutexattr_getpshared(attr, pshared); +} + +int32_t taosThreadMutexAttrGetRobust(const TdThreadMutexAttr * attr, int32_t * robust) { + return pthread_mutexattr_getrobust(attr, robust); +} + +int32_t taosThreadMutexAttrGetType(const TdThreadMutexAttr * attr, int32_t *kind) { + return pthread_mutexattr_gettype(attr, kind); +} + +int32_t taosThreadMutexAttrInit(TdThreadMutexAttr * attr) { + return pthread_mutexattr_init(attr); +} + +int32_t taosThreadMutexAttrSetPshared(TdThreadMutexAttr * attr, int32_t pshared) { + return pthread_mutexattr_setpshared(attr, pshared); +} + +int32_t taosThreadMutexAttrSetRobust(TdThreadMutexAttr * attr, int32_t robust) { + return pthread_mutexattr_setrobust(attr, robust); +} + +int32_t taosThreadMutexAttrSetType(TdThreadMutexAttr * attr, int32_t kind) { + return pthread_mutexattr_settype(attr, kind); +} + +int32_t taosThreadOnce(TdThreadOnce * onceControl, void(*initRoutine)(void)) { + return pthread_once(onceControl, initRoutine); +} + +int32_t taosThreadRwlockDestroy(TdThreadRwlock * rwlock) { + return pthread_rwlock_destroy(rwlock); +} + +int32_t taosThreadRwlockInit(TdThreadRwlock * rwlock, const TdThreadRwlockAttr * attr) { + return pthread_rwlock_init(rwlock, attr); +} + +int32_t taosThreadRwlockRdlock(TdThreadRwlock * rwlock) { + return pthread_rwlock_rdlock(rwlock); +} + +int32_t taosThreadRwlockTimedRdlock(TdThreadRwlock * rwlock, const struct timespec *abstime) { + return pthread_rwlock_timedrdlock(rwlock, abstime); +} + +int32_t taosThreadRwlockTimedWrlock(TdThreadRwlock * rwlock, const struct timespec *abstime) { + return pthread_rwlock_timedwrlock(rwlock, abstime); +} + +int32_t taosThreadRwlockTryRdlock(TdThreadRwlock * rwlock) { + return pthread_rwlock_tryrdlock(rwlock); +} + +int32_t taosThreadRwlockTryWrlock(TdThreadRwlock * rwlock) { + return pthread_rwlock_trywrlock(rwlock); +} + +int32_t taosThreadRwlockUnlock(TdThreadRwlock * rwlock) { + return pthread_rwlock_unlock(rwlock); +} + +int32_t taosThreadRwlockWrlock(TdThreadRwlock * rwlock) { + return pthread_rwlock_wrlock(rwlock); +} + +int32_t taosThreadRwlockAttrDestroy(TdThreadRwlockAttr * attr) { + return pthread_rwlockattr_destroy(attr); +} + +int32_t taosThreadRwlockAttrGetPshared(const TdThreadRwlockAttr * attr, int32_t *pshared) { + return pthread_rwlockattr_getpshared(attr, pshared); +} + +int32_t taosThreadRwlockAttrInit(TdThreadRwlockAttr * attr) { + return pthread_rwlockattr_init(attr); +} + +int32_t taosThreadRwlockAttrSetPshared(TdThreadRwlockAttr * attr, int32_t pshared) { + return pthread_rwlockattr_setpshared(attr, pshared); +} + +TdThread taosThreadSelf(void) { + return pthread_self(); +} + +int32_t taosThreadSetCancelState(int32_t state, int32_t *oldstate) { + return pthread_setcancelstate(state, oldstate); +} + +int32_t taosThreadSetCancelType(int32_t type, int32_t *oldtype) { + return pthread_setcanceltype(type, oldtype); +} + +int32_t taosThreadSetSchedParam(TdThread thread, int32_t policy, const struct sched_param *param) { + return pthread_setschedparam(thread, policy, param); +} + +int32_t taosThreadSetSpecific(TdThreadKey key, const void *value) { + return pthread_setspecific(key, value); +} + +int32_t taosThreadSpinDestroy(TdThreadSpinlock * lock) { + return pthread_spin_destroy(lock); +} + +int32_t taosThreadSpinInit(TdThreadSpinlock * lock, int32_t pshared) { + return pthread_spin_init(lock, pshared); +} + +int32_t taosThreadSpinLock(TdThreadSpinlock * lock) { + return pthread_spin_lock(lock); +} + +int32_t taosThreadSpinTrylock(TdThreadSpinlock * lock) { + return pthread_spin_trylock(lock); +} + +int32_t taosThreadSpinUnlock(TdThreadSpinlock * lock) { + return pthread_spin_unlock(lock); +} + +void taosThreadTestCancel(void) { + return pthread_testcancel(); +} + +int32_t taosThreadSigMask(int32_t how, sigset_t const *set, sigset_t * oset) { + return pthread_sigmask(how, set, oset); +} + +int32_t taosThreadSigWait(const sigset_t * set, int32_t *sig) { + return sigwait(set, sig); } \ No newline at end of file diff --git a/source/util/src/tprocess.c b/source/util/src/tprocess.c index 86cec2d271..bfb55b4593 100644 --- a/source/util/src/tprocess.c +++ b/source/util/src/tprocess.c @@ -64,13 +64,13 @@ static int32_t taosProcInitMutex(TdThreadMutex **ppMutex, int32_t *pShmid) { int32_t shmid = -1; int32_t code = -1; - if (pthread_mutexattr_init(&mattr) != 0) { + if (taosThreadMutexAttrInit(&mattr) != 0) { terrno = TAOS_SYSTEM_ERROR(errno); uError("failed to init mutex while init attr since %s", terrstr()); goto _OVER; } - if (pthread_mutexattr_setpshared(&mattr, PTHREAD_PROCESS_SHARED) != 0) { + if (taosThreadMutexAttrSetPshared(&mattr, PTHREAD_PROCESS_SHARED) != 0) { terrno = TAOS_SYSTEM_ERROR(errno); uError("failed to init mutex while set shared since %s", terrstr()); goto _OVER; @@ -112,7 +112,7 @@ _OVER: *pShmid = shmid; } - pthread_mutexattr_destroy(&mattr); + taosThreadMutexAttrDestroy(&mattr); return code; } diff --git a/source/util/test/queueTest.cpp b/source/util/test/queueTest.cpp index 09c544df9f..0bc53ab85a 100644 --- a/source/util/test/queueTest.cpp +++ b/source/util/test/queueTest.cpp @@ -36,12 +36,12 @@ TEST_F(UtilTestQueue, 01_fork) { int err; pthread_mutexattr_t mattr; - if ((err = pthread_mutexattr_init(&mattr)) < 0) { + if ((err = taosThreadMutexAttrInit(&mattr)) < 0) { printf("mutex addr init error:%s\n", strerror(err)); exit(1); } - if ((err = pthread_mutexattr_setpshared(&mattr, PTHREAD_PROCESS_SHARED)) < 0) { + if ((err = taosThreadMutexAttrSetPshared(&mattr, PTHREAD_PROCESS_SHARED)) < 0) { printf("mutex addr get shared error:%s\n", strerror(err)); exit(1); } @@ -50,7 +50,7 @@ TEST_F(UtilTestQueue, 01_fork) { int mid = shmget(IPC_PRIVATE, sizeof(pthread_mutex_t), 0600); m = (pthread_mutex_t*)shmat(mid, NULL, 0); - if ((err = pthread_mutex_init(m, &mattr)) < 0) { + if ((err = taosThreadMutexInit(m, &mattr)) < 0) { printf("mutex mutex init error:%s\n", strerror(err)); exit(1); } @@ -125,7 +125,7 @@ TEST_F(UtilTestQueue, 01_fork) { taosThreadAttrDestroy(&mattr); //销毁mutex - pthread_mutex_destroy(m); + taosThreadMutexDestroy(m); exit(0); } From 49390dc7136764cacb09fa3c4a8834fdc176b301 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Wed, 30 Mar 2022 08:15:03 +0000 Subject: [PATCH 21/49] refact more --- source/libs/tdb/src/db/tdbBtree.c | 45 +++++++++++++------------------ 1 file changed, 19 insertions(+), 26 deletions(-) diff --git a/source/libs/tdb/src/db/tdbBtree.c b/source/libs/tdb/src/db/tdbBtree.c index e9de8ab67e..7a53d885bd 100644 --- a/source/libs/tdb/src/db/tdbBtree.c +++ b/source/libs/tdb/src/db/tdbBtree.c @@ -76,7 +76,7 @@ static int tdbBtreeDecodeCell(SPage *pPage, const SCell *pCell, SCellDecoder *pD static int tdbBtreeBalance(SBTC *pBtc); static int tdbBtreeCellSize(const SPage *pPage, SCell *pCell); static int tdbBtcMoveToNext(SBTC *pBtc); -static int tdbBtcMoveDownward(SBTC *pBtc, SPgno pgno); +static int tdbBtcMoveDownward(SBTC *pBtc); static int tdbBtcMoveUpward(SBTC *pBtc); int tdbBtreeOpen(int keyLen, int valLen, SPager *pPager, FKeyComparator kcmpr, SBTree **ppBt) { @@ -1042,10 +1042,7 @@ int tdbBtcMoveToFirst(SBTC *pBtc) { for (;;) { if (TDB_BTREE_PAGE_IS_LEAF(pBtc->pPage)) break; - pCell = tdbPageGetCell(pBtc->pPage, 0); - pgno = *(SPgno *)pCell; - - ret = tdbBtcMoveDownward(pBtc, pgno); + ret = tdbBtcMoveDownward(pBtc); if (ret < 0) { ASSERT(0); return -1; @@ -1089,9 +1086,8 @@ int tdbBtcMoveToLast(SBTC *pBtc) { break; } else { pBtc->idx = TDB_PAGE_TOTAL_CELLS(pBtc->pPage); - pgno = ((SIntHdr *)pBtc->pPage->pData)->pgno; - ret = tdbBtcMoveDownward(pBtc, pgno); + ret = tdbBtcMoveDownward(pBtc); if (ret < 0) { ASSERT(0); return -1; @@ -1144,7 +1140,6 @@ int tdbBtreeNext(SBTC *pBtc, void **ppKey, int *kLen, void **ppVal, int *vLen) { static int tdbBtcMoveToNext(SBTC *pBtc) { int nCells; - SPgno pgno; SCell *pCell; ASSERT(TDB_BTREE_PAGE_IS_LEAF(pBtc->pPage)); @@ -1180,14 +1175,8 @@ static int tdbBtcMoveToNext(SBTC *pBtc) { // Move downward for (;;) { nCells = TDB_PAGE_TOTAL_CELLS(pBtc->pPage); - if (pBtc->idx < nCells) { - pCell = tdbPageGetCell(pBtc->pPage, pBtc->idx); - pgno = *(SPgno *)pCell; - } else { - pgno = ((SIntHdr *)pBtc->pPage->pData)->pgno; - } - tdbBtcMoveDownward(pBtc, pgno); + tdbBtcMoveDownward(pBtc); pBtc->idx = 0; if (TDB_BTREE_PAGE_IS_LEAF(pBtc->pPage)) { @@ -1198,8 +1187,20 @@ static int tdbBtcMoveToNext(SBTC *pBtc) { return 0; } -static int tdbBtcMoveDownward(SBTC *pBtc, SPgno pgno) { - int ret; +static int tdbBtcMoveDownward(SBTC *pBtc) { + int ret; + SPgno pgno; + SCell *pCell; + + ASSERT(pBtc->idx >= 0); + ASSERT(!TDB_BTREE_PAGE_IS_LEAF(pBtc->pPage)); + + if (pBtc->idx < TDB_PAGE_TOTAL_CELLS(pBtc->pPage)) { + pCell = tdbPageGetCell(pBtc->pPage, pBtc->idx); + pgno = ((SPgno *)pCell)[0]; + } else { + pgno = ((SIntHdr *)pBtc->pPage->pData)->pgno; + } pBtc->pgStack[pBtc->iPage] = pBtc->pPage; pBtc->idxStack[pBtc->iPage] = pBtc->idx; @@ -1304,18 +1305,10 @@ static int tdbBtcMoveTo(SBTC *pBtc, const void *pKey, int kLen, int *pCRst) { } else { if (c <= 0) { pBtc->idx = midx; - tdbBtcMoveDownward(pBtc, cd.pgno); } else { pBtc->idx = midx + 1; - if (midx == nCells - 1) { - /* Move to right-most child */ - tdbBtcMoveDownward(pBtc, ((SIntHdr *)pBtc->pPage->pData)->pgno); - } else { - pCell = tdbPageGetCell(pPage, pBtc->idx); - tdbBtreeDecodeCell(pPage, pCell, &cd); - tdbBtcMoveDownward(pBtc, cd.pgno); - } } + tdbBtcMoveDownward(pBtc); } } From 5e08c4ff9ffb68e1479c40ca454781ec9823d1f9 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Wed, 30 Mar 2022 08:25:01 +0000 Subject: [PATCH 22/49] more --- source/libs/tdb/src/db/tdbBtree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/tdb/src/db/tdbBtree.c b/source/libs/tdb/src/db/tdbBtree.c index 7a53d885bd..fc27e88cf1 100644 --- a/source/libs/tdb/src/db/tdbBtree.c +++ b/source/libs/tdb/src/db/tdbBtree.c @@ -1012,7 +1012,7 @@ int tdbBtcMoveToFirst(SBTC *pBtc) { if (TDB_PAGE_TOTAL_CELLS(pBtc->pPage) > 0) { pBtc->idx = 0; } else { - // no any data, point is invalid + // no any data, point to an invalid position ASSERT(TDB_BTREE_PAGE_IS_LEAF(pBtc->pPage)); pBtc->idx = -1; return 0; From 5d2de02b3401b9b7cc2fcb5991528420de50edde Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Wed, 30 Mar 2022 08:27:34 +0000 Subject: [PATCH 23/49] more --- source/libs/tdb/src/inc/tdbOs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/tdb/src/inc/tdbOs.h b/source/libs/tdb/src/inc/tdbOs.h index 794d4c502a..196bbdafc7 100644 --- a/source/libs/tdb/src/inc/tdbOs.h +++ b/source/libs/tdb/src/inc/tdbOs.h @@ -64,7 +64,7 @@ typedef TdThreadSpinlock tdb_spinlock_t; #define tdbSpinlockDestroy taosThreadSpinDestroy #define tdbSpinlockLock taosThreadSpinLock #define tdbSpinlockUnlock taosThreadSpinUnlock -#define tdbSpinlockTrylock pthread_spin_trylock +#define tdbSpinlockTrylock taosThreadSpinTrylock /* mutex lock */ typedef TdThreadMutex tdb_mutex_t; From 0c8271e0c26eede3c63ea6fd2a9e53a49c277368 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Wed, 30 Mar 2022 17:35:35 +0800 Subject: [PATCH 24/49] add fuzzy search --- source/libs/index/inc/indexFstDfa.h | 72 ++++++++++++++ source/libs/index/inc/indexFstRegex.h | 74 ++++++++++++++ .../inc/{indexSparse.h => indexFstSparse.h} | 4 +- source/libs/index/src/indexFstDfa.c | 96 +++++++++++++++++++ source/libs/index/src/indexFstRegex.c | 34 +++++++ source/libs/index/src/indexSparse.c | 2 +- 6 files changed, 279 insertions(+), 3 deletions(-) create mode 100644 source/libs/index/inc/indexFstDfa.h create mode 100644 source/libs/index/inc/indexFstRegex.h rename source/libs/index/inc/{indexSparse.h => indexFstSparse.h} (94%) create mode 100644 source/libs/index/src/indexFstDfa.c create mode 100644 source/libs/index/src/indexFstRegex.c diff --git a/source/libs/index/inc/indexFstDfa.h b/source/libs/index/inc/indexFstDfa.h new file mode 100644 index 0000000000..72a265c123 --- /dev/null +++ b/source/libs/index/inc/indexFstDfa.h @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#ifndef __INDEX_FST_DFA_H__ +#define __INDEX_FST_DFA_H__ + +#include "indexFstRegex.h" +#include "indexFstSparse.h" +#include "tarray.h" +#include "thash.h" + +#ifdef __cplusplus + +extern "C" { +#endif + +typedef struct FstDfa FstDfa; + +typedef struct { + SArray * insts; + uint32_t next[256]; + bool isMatch; +} State; + +/* + * dfa builder related func + **/ +typedef struct FstDfaBuilder { + FstDfa * dfa; + SHashObj *cache; +} FstDfaBuilder; + +FstDfaBuilder *dfaBuilderCreate(SArray *insts); + +FstDfa *dfaBuilderBuild(FstDfaBuilder *builder); + +bool dfaBuilderRunState(FstDfaBuilder *builder, FstSparseSet *cur, FstSparseSet *next, uint32_t state, uint8_t bytes, + uint32_t *result); + +bool dfaBuilderCachedState(FstDfaBuilder *builder, FstSparseSet *set, uint32_t *result); + +/* + * dfa related func + **/ +typedef struct FstDfa { + SArray *insts; + SArray *states; +} FstDfa; + +FstDfa *dfaCreate(SArray *insts, SArray *states); +bool dfaIsMatch(FstDfa *dfa, uint32_t si); +bool dfaAccept(FstDfa *dfa, uint32_t si, uint8_t byte, uint32_t *result); +void dfaAdd(FstDfa *dfa, FstSparseSet *set, uint32_t ip); +bool dfaRun(FstDfa *dfa, FstSparseSet *from, FstSparseSet *to, uint8_t byte); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/source/libs/index/inc/indexFstRegex.h b/source/libs/index/inc/indexFstRegex.h new file mode 100644 index 0000000000..50b9cae7ff --- /dev/null +++ b/source/libs/index/inc/indexFstRegex.h @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#ifndef _TD_INDEX_FST_REGEX_H_ +#define _TD_INDEX_FST_REGEX_H_ + +//#include "indexFstDfa.h" +#include "taos.h" +#include "tarray.h" +#include "tchecksum.h" +#include "thash.h" +#include "tlog.h" +#include "tutil.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { MATCH, JUMP, SPLIT, RANGE } InstType; + +typedef struct MatchValue { +} MatchValue; +typedef struct JumpValue { + uint32_t step; +} JumpValue; + +typedef struct SplitValue { + uint32_t len1; + uint32_t len2; +} SplitValue; + +typedef struct RangeValue { + uint8_t start; + uint8_t end; +} RangeValue; + +typedef struct { + InstType ty; + union { + MatchValue mv; + JumpValue jv; + SplitValue sv; + RangeValue rv; + }; +} Inst; + +typedef struct { + char *orig; + void *dfa; +} FstRegex; + +FstRegex *regexCreate(const char *str); + +void regexSetup(FstRegex *regex, uint32_t size, const char *str); + +// uint32_t regexStart() + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/source/libs/index/inc/indexSparse.h b/source/libs/index/inc/indexFstSparse.h similarity index 94% rename from source/libs/index/inc/indexSparse.h rename to source/libs/index/inc/indexFstSparse.h index 8035f6e08d..69b33c82d9 100644 --- a/source/libs/index/inc/indexSparse.h +++ b/source/libs/index/inc/indexFstSparse.h @@ -13,8 +13,8 @@ * along with this program. If not, see . */ -#ifndef _TD_INDEX_SPARSE_H_ -#define _TD_INDEX_SPARSE_H_ +#ifndef _TD_INDEX_FST_SPARSE_H_ +#define _TD_INDEX_FST_SPARSE_H_ #include "tarray.h" diff --git a/source/libs/index/src/indexFstDfa.c b/source/libs/index/src/indexFstDfa.c new file mode 100644 index 0000000000..765c5f08eb --- /dev/null +++ b/source/libs/index/src/indexFstDfa.c @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#include "indexFstDfa.h" +#include "thash.h" + +static int dfaInstsEqual(const void *a, const void *b, size_t size) { + SArray *ar = (SArray *)a; + SArray *br = (SArray *)b; + size_t al = ar != NULL ? taosArrayGetSize(ar) : 0; + size_t bl = br != NULL ? taosArrayGetSize(br) : 0; + if (al != bl) { + return -1; + } + for (int i = 0; i < al; i++) { + uint32_t v1 = *(uint32_t *)taosArrayGet(ar, i); + uint32_t v2 = *(uint32_t *)taosArrayGet(br, i); + if (v1 != v2) { + return -1; + } + } + return 0; +} +FstDfaBuilder *dfaBuilderCreate(SArray *insts) { + FstDfaBuilder *builder = taosMemoryCalloc(1, sizeof(FstDfaBuilder)); + if (builder == NULL) { + return NULL; + } + + SArray *states = taosArrayInit(4, sizeof(State)); + + builder->dfa = dfaCreate(insts, states); + builder->cache = taosHashInit( + 4, taosGetDefaultHashFunction(POINTER_BYTES == sizeof(int64_t) ? TSDB_DATA_TYPE_BIGINT : TSDB_DATA_TYPE_INT), + false, HASH_NO_LOCK); + taosHashSetEqualFp(builder->cache, dfaInstsEqual); + return builder; +} + +FstDfa *dfaBuilderBuild(FstDfaBuilder *builder) { + uint32_t sz = taosArrayGetSize(builder->dfa->insts); + FstSparseSet *cur = sparSetCreate(sz); + FstSparseSet *nxt = sparSetCreate(sz); + + dfaAdd(builder->dfa, cur, 0); +} + +bool dfaBuilderRunState(FstDfaBuilder *builder, FstSparseSet *cur, FstSparseSet *next, uint32_t state, uint8_t bytes, + uint32_t *result) { + // impl run state + return true; +} + +bool dfaBuilderCachedState(FstDfaBuilder *builder, FstSparseSet *set, uint32_t *result) { + // impl cache state + return true; +} + +FstDfa *dfaCreate(SArray *insts, SArray *states) { + FstDfa *dfa = taosMemoryCalloc(1, sizeof(FstDfa)); + if (dfa == NULL) { + return NULL; + } + + dfa->insts = insts; + dfa->states = states; + return dfa; +} +bool dfaIsMatch(FstDfa *dfa, uint32_t si) { + // impl match + return true; +} +bool dfaAccept(FstDfa *dfa, uint32_t si, uint8_t byte, uint32_t *result) { + // impl accept + return true; +} +void dfaAdd(FstDfa *dfa, FstSparseSet *set, uint32_t ip) { + // impl add + return; +} +bool dfaRun(FstDfa *dfa, FstSparseSet *from, FstSparseSet *to, uint8_t byte) { + // impl run + return true; +} diff --git a/source/libs/index/src/indexFstRegex.c b/source/libs/index/src/indexFstRegex.c new file mode 100644 index 0000000000..ec41a7f58e --- /dev/null +++ b/source/libs/index/src/indexFstRegex.c @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#include "indexFstRegex.h" +#include "indexFstSparse.h" + +FstRegex *regexCreate(const char *str) { + FstRegex *regex = taosMemoryCalloc(1, sizeof(FstRegex)); + if (regex == NULL) { + return NULL; + } + int32_t sz = (int32_t)strlen(str); + char * orig = taosMemoryCalloc(1, sz); + memcpy(orig, str, sz); + + regex->orig = orig; +} + +void regexSetup(FstRegex *regex, uint32_t size, const char *str) { + // return + // return; +} diff --git a/source/libs/index/src/indexSparse.c b/source/libs/index/src/indexSparse.c index 8bcf04602f..9d228e71ff 100644 --- a/source/libs/index/src/indexSparse.c +++ b/source/libs/index/src/indexSparse.c @@ -13,7 +13,7 @@ * along with this program. If not, see . */ -#include "indexSparse.h" +#include "indexFstSparse.h" FstSparseSet *sparSetCreate(int32_t sz) { FstSparseSet *ss = taosMemoryCalloc(1, sizeof(FstSparseSet)); From 69b1add85548cce963e9e64b40dfeb7c99318aa7 Mon Sep 17 00:00:00 2001 From: plum-lihui Date: Wed, 30 Mar 2022 17:38:59 +0800 Subject: [PATCH 25/49] [add case] --- tests/script/tsim/db/alter_option.sim | 443 ++++++++++++++++++++++++++ 1 file changed, 443 insertions(+) create mode 100644 tests/script/tsim/db/alter_option.sim diff --git a/tests/script/tsim/db/alter_option.sim b/tests/script/tsim/db/alter_option.sim new file mode 100644 index 0000000000..5c2848883b --- /dev/null +++ b/tests/script/tsim/db/alter_option.sim @@ -0,0 +1,443 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/deploy.sh -n dnode2 -i 2 +system sh/deploy.sh -n dnode3 -i 3 +system sh/exec.sh -n dnode1 -s start +system sh/exec.sh -n dnode2 -s start +system sh/exec.sh -n dnode3 -s start + +$loop_cnt = 0 +check_dnode_ready: + $loop_cnt = $loop_cnt + 1 + sleep 200 + if $loop_cnt == 10 then + print ====> dnode not ready! + return -1 + endi +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 +endi + +sql connect +sql create dnode $hostname port 7200 +sql create dnode $hostname port 7300 + +$loop_cnt = 0 +check_dnode_ready_1: + $loop_cnt = $loop_cnt + 1 + sleep 200 + if $loop_cnt == 10 then + print ====> dnode not ready! + return -1 + endi +sql show dnodes +print ===> rows: $rows +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +print ===> $data20 $data21 $data22 $data23 $data24 $data25 +if $data00 != 1 then + return -1 +endi +if $data01 != localhost:7100 then + return -1 +endi +if $data04 != ready then + goto check_dnode_ready_1 +endi +if $data14 != ready then + goto check_dnode_ready_1 +endi +if $data24 != ready then + goto check_dnode_ready_1 +endi + +print ============= create database +#database_option: { +# BLOCKS value [3~1000, default: 6] +# | CACHE value [default: 16M] +# | CACHELAST value [0, 1, 2, 3] +# | COMP [0 | 1 | 2] +# | DAYS value [unit is minutes] +# | FSYNC value [0 ~ 180000 ms] +# | MAXROWS value [default: 4096] +# | MINROWS value [default: 100] +# | KEEP value [days, 365000] +# | PRECISION ['ms' | 'us' | 'ns'] +# | QUORUM value [1 | 2] +# | REPLICA value [1 | 3] +# | TTL value [unit is day, min=1] +# | WAL value [1 | 2] +# | VGROUPS value [default: 2] +# | SINGLE_STABLE [0 | 1] +# | STREAM_MODE [0 | 1] + +sql create database db BLOCKS 7 CACHE 3 CACHELAST 3 COMP 0 DAYS 240 FSYNC 1000 MAXROWS 8000 MINROWS 10 KEEP 1000 PRECISION 'ns' QUORUM 1 REPLICA 3 TTL 7 WAL 2 VGROUPS 6 SINGLE_STABLE 1 STREAM_MODE 1 +sql show databases +print rows: $rows +print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 +print $data10 $data11 $data12 $data13 $data14 $data15 $data16 $data17 $data18 $data19 +print ====> dataX_db +print $data0_db $data1_db $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db + +if $rows != 2 then + return -1 +endi +if $data0_db != db then # name + return -1 +endi +if $data2_db != 6 then # vgroups + return -1 +endi +if $data3_db != 0 then # ntables + return -1 +endi +if $data4_db != 3 then # replica + return -1 +endi +if $data5_db != 1 then # quorum + return -1 +endi +if $data6_db != 240 then # days + return -1 +endi +if $data7_db != 1000,1000,1000 then # keep + return -1 +endi +if $data8_db != 3 then # cache + return -1 +endi +if $data9_db != 7 then # blocks + return -1 +endi +if $data10_db != 10 then # minrows + return -1 +endi +if $data11_db != 8000 then # maxrows + return -1 +endi +if $data12_db != 2 then # wal + return -1 +endi +if $data13_db != 1000 then # fsync + return -1 +endi +if $data14_db != 0 then # comp + return -1 +endi +if $data15_db != 3 then # cachelast + return -1 +endi +if $data16_db != ns then # precision + return -1 +endi + +print ============== not support modify options: name, create_time, vgroups, ntables +sql_error alter database db name dba +sql_error alter database db create_time "2022-03-03 15:08:13.329" +sql_error alter database db vgroups -1 +sql_error alter database db vgroups 0 +sql_error alter database db vgroups 2 +sql_error alter database db vgroups 20 +sql_error alter database db ntables -1 +sql_error alter database db ntables 0 +sql_error alter database db ntables 1 +sql_error alter database db ntables 10 + +#print ============== modify replica +sql_error alter database db replica 2 +sql_error alter database db replica 5 +sql_error alter database db replica -1 +sql_error alter database db replica 0 +#sql alter database db replica 1 +#sql show databases +#print replica: $data4_db +#if $data4_db != 1 then +# return -1 +#endi +#sql alter database db replica 3 +#sql show databases +#print replica: $data4_db +#if $data4_db != 3 then +# return -1 +#endi + +print ============== modify quorum +sql alter database db quorum 2 +sql show databases +print quorum $data5_db +if $data5_db != 2 then + return -1 +endi +sql alter database db quorum 1 +sql show databases +print quorum $data5_db +if $data5_db != 1 then + return -1 +endi + +sql_error alter database db quorum -1 +sql_error alter database db quorum 0 +sql_error alter database db quorum 3 +sql_error alter database db quorum 4 +sql_error alter database db quorum 5 + +#print ============== modify days +#sql alter database db days 480 +#sql show databases +#print days $data6_db +#if $data6_db != 480 then # days +# return -1 +#endi +#sql alter database db days 360 +#sql show databases +#print days $data6_db +#if $data6_db != 360 then # days +# return -1 +#endi + +sql_error alter database db days 0 +#sql_error alter database db days 14400 # set over than keep + + +print ============== modify keep +sql alter database db keep 2000 +sql show databases +print keep $data7_db +if $data7_db != 1000,1000,2000 then + return -1 +endi + +#sql alter database db keep 1000,2000 +#sql show databases +#print keep $data7_db +#if $data7_db != 500,500,500 then +# return -1 +#endi + +#sql alter database db keep 40,50 +#sql alter database db keep 30,31 +#sql alter database db keep 20 +#sql_error alter database db keep 10.0 +#sql_error alter database db keep 9 +#sql_error alter database db keep 1 +sql_error alter database db keep 0 +sql_error alter database db keep -1 +#sql_error alter database db keep 365001 + +print ============== modify cache +#sql alter database db cache 12 +#sql show databases +#print cache $data8_db +#if $data8_db != 12 then +# return -1 +#endi +#sql alter database db cache 1 +#sql show databases +#print cache $data8_db +#if $data8_db != 6 then +# return -1 +#endi +# +#sql_error alter database db cache 60 +#sql_error alter database db cache 50 +#sql_error alter database db cache 20 +#sql_error alter database db cache 3 +#sql_error alter database db cache 129 +#sql_error alter database db cache 300 +sql_error alter database db cache 0 +sql_error alter database db cache -1 + +print ============== modify blocks +sql alter database db blocks 3 +sql show databases +print blocks $data9_db +if $data9_db != 3 then + return -1 +endi +sql alter database db blocks 11 +sql show databases +print blocks $data9_db +if $data9_db != 11 then + return -1 +endi + +sql alter database db blocks 40 +sql alter database db blocks 30 +sql alter database db blocks 20 +sql alter database db blocks 10 +sql_error alter database db blocks 2 +sql_error alter database db blocks 1 +sql_error alter database db blocks 0 +sql_error alter database db blocks -1 +sql_error alter database db blocks 10001 + +#print ============== modify minrows +#sql alter database db minrows 8 +#sql show databases +#print minrows $data10_db +#if $data10_db != 8 then +# return -1 +#endi +#sql alter database db minrows 200 +#sql show databases +#print minrows $data10_db +#if $data10_db != 200 then +# return -1 +#endi +# +#sql alter database db minrows 11 +#sql show databases +#print minrows $data10_db +#if $data10_db != 11 then +# return -1 +#endi +#sql_error alter database db minrows 8000 +#sql_error alter database db minrows 8001 + +#print ============== modify maxrows +#sql alter database db maxrows 1000 +#sql show databases +#print maxrows $data11_db +#if $data11_db != 1000 then +# return -1 +#endi +#sql alter database db maxrows 2000 +#sql show databases +#print maxrows $data11_db +#if $data11_db != 2000 then +# return -1 +#endi +# +#sql_error alter database db maxrows 11 # equal minrows +#sql_error alter database db maxrows 10 # little than minrows + +print ============== step wal +sql alter database db wal 1 +sql show databases +print wal $data12_db +if $data12_db != 1 then + return -1 +endi +sql alter database db wal 2 +sql show databases +print wal $data12_db +if $data12_db != 2 then + return -1 +endi + +sql_error alter database db wal 0 +sql_error alter database db wal 3 +sql_error alter database db wal 100 +sql_error alter database db wal -1 + +print ============== modify fsync +sql alter database db fsync 2000 +sql show databases +print fsync $data13_db +if $data13_db != 2000 then + return -1 +endi +sql alter database db fsync 500 +sql show databases +print fsync $data13_db +if $data13_db != 500 then + return -1 +endi +sql_error alter database db fsync 0 +sql_error alter database db fsync -1 + +print ============== modify comp +sql alter database db comp 1 +sql show databases +print comp $data14_db +if $data14_db != 1 then + return -1 +endi +sql alter database db comp 2 +sql show databases +print comp $data14_db +if $data14_db != 2 then + return -1 +endi +sql alter database db comp 1 +sql show databases +print comp $data14_db +if $data14_db != 1 then + return -1 +endi +sql alter database db comp 0 +sql show databases +print comp $data14_db +if $data14_db != 0 then + return -1 +endi + +sql_error alter database db comp 3 +sql_error alter database db comp 4 +sql_error alter database db comp 5 +sql_error alter database db comp -1 + +print ============== modify cachelast [0, 1, 2, 3] +sql alter database db cachelast 2 +sql show databases +print cachelast $data15_db +if $data15_db != 2 then + return -1 +endi +sql alter database db cachelast 1 +sql show databases +print cachelast $data15_db +if $data15_db != 1 then + return -1 +endi +sql alter database db cachelast 0 +sql show databases +print cachelast $data15_db +if $data15_db != 0 then + return -1 +endi +sql alter database db cachelast 2 +sql show databases +print cachelast $data15_db +if $data15_db != 2 then + return -1 +endi +sql alter database db cachelast 3 +sql show databases +print cachelast $data15_db +if $data15_db != 3 then + return -1 +endi + +sql_error alter database db comp 4 +sql_error alter database db comp 10 +sql_error alter database db comp -1 + +print ============== modify precision +sql alter database db precision 'ms' +sql show databases +print precision $data16_db +if $data16_db != ms then + return -1 +endi +sql alter database db precision 'us' +sql show databases +print precision $data16_db +if $data16_db != us then + return -1 +endi +sql alter database db precision 'ns' +sql show databases +print precision $data16_db +if $data16_db != ns then + return -1 +endi + +sql_error alter database db prec 'xs' + +#system sh/exec.sh -n dnode1 -s stop -x SIGINT From 5aaafc0f8b9d7df62cc65097959957c2f7e073a9 Mon Sep 17 00:00:00 2001 From: afwerar <1296468573@qq.com> Date: Wed, 30 Mar 2022 17:44:56 +0800 Subject: [PATCH 26/49] [TD-13759]: forbid pthread func. --- include/os/osThread.h | 194 +++++++++++++++++++-------------------- source/os/src/osMemory.c | 10 +- 2 files changed, 104 insertions(+), 100 deletions(-) diff --git a/include/os/osThread.h b/include/os/osThread.h index cca25f4fa4..a145b0da07 100644 --- a/include/os/osThread.h +++ b/include/os/osThread.h @@ -42,103 +42,103 @@ typedef pthread_barrierattr_t TdThreadBarrierAttr; // If the error is in a third-party library, place this header file under the third-party library header file. // When you want to use this feature, you should find or add the same function in the following section. #ifndef ALLOW_FORBID_FUNC - // #define pthread_t PTHREAD_T_TYPE_TAOS_FORBID - // #define pthread_spinlock_t PTHREAD_SPINLOCK_T_TYPE_TAOS_FORBID - // #define pthread_mutex_t PTHREAD_MUTEX_T_TYPE_TAOS_FORBID - // #define pthread_mutexattr_t PTHREAD_MUTEXATTR_T_TYPE_TAOS_FORBID - // #define pthread_rwlock_t PTHREAD_RWLOCK_T_TYPE_TAOS_FORBID - // #define pthread_attr_t PTHREAD_ATTR_T_TYPE_TAOS_FORBID - // #define pthread_once_t PTHREAD_ONCE_T_TYPE_TAOS_FORBID - // #define pthread_rwlockattr_t PTHREAD_RWLOCKATTR_T_TYPE_TAOS_FORBID - // #define pthread_cond_t PTHREAD_COND_T_TYPE_TAOS_FORBID - // #define pthread_condattr_t PTHREAD_CONDATTR_T_TYPE_TAOS_FORBID - // #define pthread_key_t PTHREAD_KEY_T_TYPE_TAOS_FORBID - // #define pthread_barrier_t PTHREAD_BARRIER_T_TYPE_TAOS_FORBID - // #define pthread_barrierattr_t PTHREAD_BARRIERATTR_T_TYPE_TAOS_FORBID - // #define pthread_create PTHREAD_CREATE_FUNC_TAOS_FORBID - // #define pthread_attr_destroy PTHREAD_ATTR_DESTROY_FUNC_TAOS_FORBID - // #define pthread_attr_getdetachstate PTHREAD_ATTR_GETDETACHSTATE_FUNC_TAOS_FORBID - // #define pthread_attr_getinheritsched PTHREAD_ATTR_GETINHERITSCHED_FUNC_TAOS_FORBID - // #define pthread_attr_getschedparam PTHREAD_ATTR_GETSCHEDPARAM_FUNC_TAOS_FORBID - // #define pthread_attr_getschedpolicy PTHREAD_ATTR_GETSCHEDPOLICY_FUNC_TAOS_FORBID - // #define pthread_attr_getscope PTHREAD_ATTR_GETSCOPE_FUNC_TAOS_FORBID - // #define pthread_attr_getstacksize PTHREAD_ATTR_GETSTACKSIZE_FUNC_TAOS_FORBID - // #define pthread_attr_init PTHREAD_ATTR_INIT_FUNC_TAOS_FORBID - // #define pthread_attr_setdetachstate PTHREAD_ATTR_SETDETACHSTATE_FUNC_TAOS_FORBID - // #define pthread_attr_setinheritsched PTHREAD_ATTR_SETINHERITSCHED_FUNC_TAOS_FORBID - // #define pthread_attr_setschedparam PTHREAD_ATTR_SETSCHEDPARAM_FUNC_TAOS_FORBID - // #define pthread_attr_setschedpolicy PTHREAD_ATTR_SETSCHEDPOLICY_FUNC_TAOS_FORBID - // #define pthread_attr_setscope PTHREAD_ATTR_SETSCOPE_FUNC_TAOS_FORBID - // #define pthread_attr_setstacksize PTHREAD_ATTR_SETSTACKSIZE_FUNC_TAOS_FORBID - // #define pthread_barrier_destroy PTHREAD_BARRIER_DESTROY_FUNC_TAOS_FORBID - // #define pthread_barrier_init PTHREAD_BARRIER_INIT_FUNC_TAOS_FORBID - // #define pthread_barrier_wait PTHREAD_BARRIER_WAIT_FUNC_TAOS_FORBID - // #define pthread_barrierattr_destroy PTHREAD_BARRIERATTR_DESTROY_FUNC_TAOS_FORBID - // #define pthread_barrierattr_getpshared PTHREAD_BARRIERATTR_GETPSHARED_FUNC_TAOS_FORBID - // #define pthread_barrierattr_init PTHREAD_BARRIERATTR_INIT_FUNC_TAOS_FORBID - // #define pthread_barrierattr_setpshared PTHREAD_BARRIERATTR_SETPSHARED_FUNC_TAOS_FORBID - // #define pthread_cancel PTHREAD_CANCEL_FUNC_TAOS_FORBID - // #define pthread_cond_destroy PTHREAD_COND_DESTROY_FUNC_TAOS_FORBID - // #define pthread_cond_init PTHREAD_COND_INIT_FUNC_TAOS_FORBID - // #define pthread_cond_signal PTHREAD_COND_SIGNAL_FUNC_TAOS_FORBID - // #define pthread_cond_broadcast PTHREAD_COND_BROADCAST_FUNC_TAOS_FORBID - // #define pthread_cond_wait PTHREAD_COND_WAIT_FUNC_TAOS_FORBID - // #define pthread_cond_timedwait PTHREAD_COND_TIMEDWAIT_FUNC_TAOS_FORBID - // #define pthread_condattr_destroy PTHREAD_CONDATTR_DESTROY_FUNC_TAOS_FORBID - // #define pthread_condattr_getpshared PTHREAD_CONDATTR_GETPSHARED_FUNC_TAOS_FORBID - // #define pthread_condattr_init PTHREAD_CONDATTR_INIT_FUNC_TAOS_FORBID - // #define pthread_condattr_setpshared PTHREAD_CONDATTR_SETPSHARED_FUNC_TAOS_FORBID - // #define pthread_detach PTHREAD_DETACH_FUNC_TAOS_FORBID - // #define pthread_equal PTHREAD_EQUAL_FUNC_TAOS_FORBID - // #define pthread_exit PTHREAD_EXIT_FUNC_TAOS_FORBID - // #define pthread_getschedparam PTHREAD_GETSCHEDPARAM_FUNC_TAOS_FORBID - // #define pthread_getspecific PTHREAD_GETSPECIFIC_FUNC_TAOS_FORBID - // #define pthread_join PTHREAD_JOIN_FUNC_TAOS_FORBID - // #define pthread_key_create PTHREAD_KEY_CREATE_FUNC_TAOS_FORBID - // #define pthread_key_delete PTHREAD_KEY_DELETE_FUNC_TAOS_FORBID - // #define pthread_kill PTHREAD_KILL_FUNC_TAOS_FORBID - // #define pthread_mutex_consistent PTHREAD_MUTEX_CONSISTENT_FUNC_TAOS_FORBID - // #define pthread_mutex_destroy PTHREAD_MUTEX_DESTROY_FUNC_TAOS_FORBID - // #define pthread_mutex_init PTHREAD_MUTEX_INIT_FUNC_TAOS_FORBID - // #define pthread_mutex_lock PTHREAD_MUTEX_LOCK_FUNC_TAOS_FORBID - // #define pthread_mutex_timedlock PTHREAD_MUTEX_TIMEDLOCK_FUNC_TAOS_FORBID - // #define pthread_mutex_trylock PTHREAD_MUTEX_TRYLOCK_FUNC_TAOS_FORBID - // #define pthread_mutex_unlock PTHREAD_MUTEX_UNLOCK_FUNC_TAOS_FORBID - // #define pthread_mutexattr_destroy PTHREAD_MUTEXATTR_DESTROY_FUNC_TAOS_FORBID - // #define pthread_mutexattr_getpshared PTHREAD_MUTEXATTR_GETPSHARED_FUNC_TAOS_FORBID - // #define pthread_mutexattr_getrobust PTHREAD_MUTEXATTR_GETROBUST_FUNC_TAOS_FORBID - // #define pthread_mutexattr_gettype PTHREAD_MUTEXATTR_GETTYPE_FUNC_TAOS_FORBID - // #define pthread_mutexattr_init PTHREAD_MUTEXATTR_INIT_FUNC_TAOS_FORBID - // #define pthread_mutexattr_setpshared PTHREAD_MUTEXATTR_SETPSHARED_FUNC_TAOS_FORBID - // #define pthread_mutexattr_setrobust PTHREAD_MUTEXATTR_SETROBUST_FUNC_TAOS_FORBID - // #define pthread_mutexattr_settype PTHREAD_MUTEXATTR_SETTYPE_FUNC_TAOS_FORBID - // #define pthread_once PTHREAD_ONCE_FUNC_TAOS_FORBID - // #define pthread_rwlock_destroy PTHREAD_RWLOCK_DESTROY_FUNC_TAOS_FORBID - // #define pthread_rwlock_init PTHREAD_RWLOCK_INIT_FUNC_TAOS_FORBID - // #define pthread_rwlock_rdlock PTHREAD_RWLOCK_RDLOCK_FUNC_TAOS_FORBID - // #define pthread_rwlock_timedrdlock PTHREAD_RWLOCK_TIMEDRDLOCK_FUNC_TAOS_FORBID - // #define pthread_rwlock_timedwrlock PTHREAD_RWLOCK_TIMEDWRLOCK_FUNC_TAOS_FORBID - // #define pthread_rwlock_tryrdlock PTHREAD_RWLOCK_TRYRDLOCK_FUNC_TAOS_FORBID - // #define pthread_rwlock_trywrlock PTHREAD_RWLOCK_TRYWRLOCK_FUNC_TAOS_FORBID - // #define pthread_rwlock_unlock PTHREAD_RWLOCK_UNLOCK_FUNC_TAOS_FORBID - // #define pthread_rwlock_wrlock PTHREAD_RWLOCK_WRLOCK_FUNC_TAOS_FORBID - // #define pthread_rwlockattr_destroy PTHREAD_RWLOCKATTR_DESTROY_FUNC_TAOS_FORBID - // #define pthread_rwlockattr_getpshared PTHREAD_RWLOCKATTR_GETPSHARED_FUNC_TAOS_FORBID - // #define pthread_rwlockattr_init PTHREAD_RWLOCKATTR_INIT_FUNC_TAOS_FORBID - // #define pthread_rwlockattr_setpshared PTHREAD_RWLOCKATTR_SETPSHARED_FUNC_TAOS_FORBID - // #define pthread_self PTHREAD_SELF_FUNC_TAOS_FORBID - // #define pthread_setcancelstate PTHREAD_SETCANCELSTATE_FUNC_TAOS_FORBID - // #define pthread_setcanceltype PTHREAD_SETCANCELTYPE_FUNC_TAOS_FORBID - // #define pthread_setschedparam PTHREAD_SETSCHEDPARAM_FUNC_TAOS_FORBID - // #define pthread_setspecific PTHREAD_SETSPECIFIC_FUNC_TAOS_FORBID - // #define pthread_spin_destroy PTHREAD_SPIN_DESTROY_FUNC_TAOS_FORBID - // #define pthread_spin_init PTHREAD_SPIN_INIT_FUNC_TAOS_FORBID - // #define pthread_spin_lock PTHREAD_SPIN_LOCK_FUNC_TAOS_FORBID - // #define pthread_spin_trylock PTHREAD_SPIN_TRYLOCK_FUNC_TAOS_FORBID - // #define pthread_spin_unlock PTHREAD_SPIN_UNLOCK_FUNC_TAOS_FORBID - // #define pthread_testcancel PTHREAD_TESTCANCEL_FUNC_TAOS_FORBID - // #define pthread_sigmask PTHREAD_SIGMASK_FUNC_TAOS_FORBID - // #define sigwait SIGWAIT_FUNC_TAOS_FORBID + #define pthread_t PTHREAD_T_TYPE_TAOS_FORBID + #define pthread_spinlock_t PTHREAD_SPINLOCK_T_TYPE_TAOS_FORBID + #define pthread_mutex_t PTHREAD_MUTEX_T_TYPE_TAOS_FORBID + #define pthread_mutexattr_t PTHREAD_MUTEXATTR_T_TYPE_TAOS_FORBID + #define pthread_rwlock_t PTHREAD_RWLOCK_T_TYPE_TAOS_FORBID + #define pthread_attr_t PTHREAD_ATTR_T_TYPE_TAOS_FORBID + #define pthread_once_t PTHREAD_ONCE_T_TYPE_TAOS_FORBID + #define pthread_rwlockattr_t PTHREAD_RWLOCKATTR_T_TYPE_TAOS_FORBID + #define pthread_cond_t PTHREAD_COND_T_TYPE_TAOS_FORBID + #define pthread_condattr_t PTHREAD_CONDATTR_T_TYPE_TAOS_FORBID + #define pthread_key_t PTHREAD_KEY_T_TYPE_TAOS_FORBID + #define pthread_barrier_t PTHREAD_BARRIER_T_TYPE_TAOS_FORBID + #define pthread_barrierattr_t PTHREAD_BARRIERATTR_T_TYPE_TAOS_FORBID + #define pthread_create PTHREAD_CREATE_FUNC_TAOS_FORBID + #define pthread_attr_destroy PTHREAD_ATTR_DESTROY_FUNC_TAOS_FORBID + #define pthread_attr_getdetachstate PTHREAD_ATTR_GETDETACHSTATE_FUNC_TAOS_FORBID + #define pthread_attr_getinheritsched PTHREAD_ATTR_GETINHERITSCHED_FUNC_TAOS_FORBID + #define pthread_attr_getschedparam PTHREAD_ATTR_GETSCHEDPARAM_FUNC_TAOS_FORBID + #define pthread_attr_getschedpolicy PTHREAD_ATTR_GETSCHEDPOLICY_FUNC_TAOS_FORBID + #define pthread_attr_getscope PTHREAD_ATTR_GETSCOPE_FUNC_TAOS_FORBID + #define pthread_attr_getstacksize PTHREAD_ATTR_GETSTACKSIZE_FUNC_TAOS_FORBID + #define pthread_attr_init PTHREAD_ATTR_INIT_FUNC_TAOS_FORBID + #define pthread_attr_setdetachstate PTHREAD_ATTR_SETDETACHSTATE_FUNC_TAOS_FORBID + #define pthread_attr_setinheritsched PTHREAD_ATTR_SETINHERITSCHED_FUNC_TAOS_FORBID + #define pthread_attr_setschedparam PTHREAD_ATTR_SETSCHEDPARAM_FUNC_TAOS_FORBID + #define pthread_attr_setschedpolicy PTHREAD_ATTR_SETSCHEDPOLICY_FUNC_TAOS_FORBID + #define pthread_attr_setscope PTHREAD_ATTR_SETSCOPE_FUNC_TAOS_FORBID + #define pthread_attr_setstacksize PTHREAD_ATTR_SETSTACKSIZE_FUNC_TAOS_FORBID + #define pthread_barrier_destroy PTHREAD_BARRIER_DESTROY_FUNC_TAOS_FORBID + #define pthread_barrier_init PTHREAD_BARRIER_INIT_FUNC_TAOS_FORBID + #define pthread_barrier_wait PTHREAD_BARRIER_WAIT_FUNC_TAOS_FORBID + #define pthread_barrierattr_destroy PTHREAD_BARRIERATTR_DESTROY_FUNC_TAOS_FORBID + #define pthread_barrierattr_getpshared PTHREAD_BARRIERATTR_GETPSHARED_FUNC_TAOS_FORBID + #define pthread_barrierattr_init PTHREAD_BARRIERATTR_INIT_FUNC_TAOS_FORBID + #define pthread_barrierattr_setpshared PTHREAD_BARRIERATTR_SETPSHARED_FUNC_TAOS_FORBID + #define pthread_cancel PTHREAD_CANCEL_FUNC_TAOS_FORBID + #define pthread_cond_destroy PTHREAD_COND_DESTROY_FUNC_TAOS_FORBID + #define pthread_cond_init PTHREAD_COND_INIT_FUNC_TAOS_FORBID + #define pthread_cond_signal PTHREAD_COND_SIGNAL_FUNC_TAOS_FORBID + #define pthread_cond_broadcast PTHREAD_COND_BROADCAST_FUNC_TAOS_FORBID + #define pthread_cond_wait PTHREAD_COND_WAIT_FUNC_TAOS_FORBID + #define pthread_cond_timedwait PTHREAD_COND_TIMEDWAIT_FUNC_TAOS_FORBID + #define pthread_condattr_destroy PTHREAD_CONDATTR_DESTROY_FUNC_TAOS_FORBID + #define pthread_condattr_getpshared PTHREAD_CONDATTR_GETPSHARED_FUNC_TAOS_FORBID + #define pthread_condattr_init PTHREAD_CONDATTR_INIT_FUNC_TAOS_FORBID + #define pthread_condattr_setpshared PTHREAD_CONDATTR_SETPSHARED_FUNC_TAOS_FORBID + #define pthread_detach PTHREAD_DETACH_FUNC_TAOS_FORBID + #define pthread_equal PTHREAD_EQUAL_FUNC_TAOS_FORBID + #define pthread_exit PTHREAD_EXIT_FUNC_TAOS_FORBID + #define pthread_getschedparam PTHREAD_GETSCHEDPARAM_FUNC_TAOS_FORBID + #define pthread_getspecific PTHREAD_GETSPECIFIC_FUNC_TAOS_FORBID + #define pthread_join PTHREAD_JOIN_FUNC_TAOS_FORBID + #define pthread_key_create PTHREAD_KEY_CREATE_FUNC_TAOS_FORBID + #define pthread_key_delete PTHREAD_KEY_DELETE_FUNC_TAOS_FORBID + #define pthread_kill PTHREAD_KILL_FUNC_TAOS_FORBID + #define pthread_mutex_consistent PTHREAD_MUTEX_CONSISTENT_FUNC_TAOS_FORBID + #define pthread_mutex_destroy PTHREAD_MUTEX_DESTROY_FUNC_TAOS_FORBID + #define pthread_mutex_init PTHREAD_MUTEX_INIT_FUNC_TAOS_FORBID + #define pthread_mutex_lock PTHREAD_MUTEX_LOCK_FUNC_TAOS_FORBID + #define pthread_mutex_timedlock PTHREAD_MUTEX_TIMEDLOCK_FUNC_TAOS_FORBID + #define pthread_mutex_trylock PTHREAD_MUTEX_TRYLOCK_FUNC_TAOS_FORBID + #define pthread_mutex_unlock PTHREAD_MUTEX_UNLOCK_FUNC_TAOS_FORBID + #define pthread_mutexattr_destroy PTHREAD_MUTEXATTR_DESTROY_FUNC_TAOS_FORBID + #define pthread_mutexattr_getpshared PTHREAD_MUTEXATTR_GETPSHARED_FUNC_TAOS_FORBID + #define pthread_mutexattr_getrobust PTHREAD_MUTEXATTR_GETROBUST_FUNC_TAOS_FORBID + #define pthread_mutexattr_gettype PTHREAD_MUTEXATTR_GETTYPE_FUNC_TAOS_FORBID + #define pthread_mutexattr_init PTHREAD_MUTEXATTR_INIT_FUNC_TAOS_FORBID + #define pthread_mutexattr_setpshared PTHREAD_MUTEXATTR_SETPSHARED_FUNC_TAOS_FORBID + #define pthread_mutexattr_setrobust PTHREAD_MUTEXATTR_SETROBUST_FUNC_TAOS_FORBID + #define pthread_mutexattr_settype PTHREAD_MUTEXATTR_SETTYPE_FUNC_TAOS_FORBID + #define pthread_once PTHREAD_ONCE_FUNC_TAOS_FORBID + #define pthread_rwlock_destroy PTHREAD_RWLOCK_DESTROY_FUNC_TAOS_FORBID + #define pthread_rwlock_init PTHREAD_RWLOCK_INIT_FUNC_TAOS_FORBID + #define pthread_rwlock_rdlock PTHREAD_RWLOCK_RDLOCK_FUNC_TAOS_FORBID + #define pthread_rwlock_timedrdlock PTHREAD_RWLOCK_TIMEDRDLOCK_FUNC_TAOS_FORBID + #define pthread_rwlock_timedwrlock PTHREAD_RWLOCK_TIMEDWRLOCK_FUNC_TAOS_FORBID + #define pthread_rwlock_tryrdlock PTHREAD_RWLOCK_TRYRDLOCK_FUNC_TAOS_FORBID + #define pthread_rwlock_trywrlock PTHREAD_RWLOCK_TRYWRLOCK_FUNC_TAOS_FORBID + #define pthread_rwlock_unlock PTHREAD_RWLOCK_UNLOCK_FUNC_TAOS_FORBID + #define pthread_rwlock_wrlock PTHREAD_RWLOCK_WRLOCK_FUNC_TAOS_FORBID + #define pthread_rwlockattr_destroy PTHREAD_RWLOCKATTR_DESTROY_FUNC_TAOS_FORBID + #define pthread_rwlockattr_getpshared PTHREAD_RWLOCKATTR_GETPSHARED_FUNC_TAOS_FORBID + #define pthread_rwlockattr_init PTHREAD_RWLOCKATTR_INIT_FUNC_TAOS_FORBID + #define pthread_rwlockattr_setpshared PTHREAD_RWLOCKATTR_SETPSHARED_FUNC_TAOS_FORBID + #define pthread_self PTHREAD_SELF_FUNC_TAOS_FORBID + #define pthread_setcancelstate PTHREAD_SETCANCELSTATE_FUNC_TAOS_FORBID + #define pthread_setcanceltype PTHREAD_SETCANCELTYPE_FUNC_TAOS_FORBID + #define pthread_setschedparam PTHREAD_SETSCHEDPARAM_FUNC_TAOS_FORBID + #define pthread_setspecific PTHREAD_SETSPECIFIC_FUNC_TAOS_FORBID + #define pthread_spin_destroy PTHREAD_SPIN_DESTROY_FUNC_TAOS_FORBID + #define pthread_spin_init PTHREAD_SPIN_INIT_FUNC_TAOS_FORBID + #define pthread_spin_lock PTHREAD_SPIN_LOCK_FUNC_TAOS_FORBID + #define pthread_spin_trylock PTHREAD_SPIN_TRYLOCK_FUNC_TAOS_FORBID + #define pthread_spin_unlock PTHREAD_SPIN_UNLOCK_FUNC_TAOS_FORBID + #define pthread_testcancel PTHREAD_TESTCANCEL_FUNC_TAOS_FORBID + #define pthread_sigmask PTHREAD_SIGMASK_FUNC_TAOS_FORBID + #define sigwait SIGWAIT_FUNC_TAOS_FORBID #endif int32_t taosThreadCreate(TdThread * tid, const TdThreadAttr * attr, void *(*start)(void *), void *arg); diff --git a/source/os/src/osMemory.c b/source/os/src/osMemory.c index 81ee259ff1..f4d4c74d1d 100644 --- a/source/os/src/osMemory.c +++ b/source/os/src/osMemory.c @@ -17,6 +17,8 @@ #include #include "os.h" +#ifdef USE_TD_MEMORY + #define TD_MEMORY_SYMBOL ('T'<<24|'A'<<16|'O'<<8|'S') #define TD_MEMORY_STACK_TRACE_DEPTH 10 @@ -70,6 +72,8 @@ int32_t taosBackTrace(void **buffer, int32_t size) { // return backtrace_symbols(buffer, *size); // } +#endif + void *taosMemoryMalloc(int32_t size) { #ifdef USE_TD_MEMORY void *tmp = malloc(size + sizeof(TdMemoryInfo)); @@ -126,9 +130,9 @@ void *taosMemoryRealloc(void *ptr, int32_t size) { } void taosMemoryFree(const void *ptr) { -#ifdef USE_TD_MEMORY if (ptr == NULL) return; +#ifdef USE_TD_MEMORY TdMemoryInfoPtr pTdMemoryInfo = (TdMemoryInfoPtr)((char*)ptr - sizeof(TdMemoryInfo)); if(pTdMemoryInfo->symbol == TD_MEMORY_SYMBOL) { pTdMemoryInfo->memorySize = 0; @@ -143,9 +147,9 @@ void taosMemoryFree(const void *ptr) { } int32_t taosMemorySize(void *ptr) { -#ifdef USE_TD_MEMORY if (ptr == NULL) return 0; - + +#ifdef USE_TD_MEMORY TdMemoryInfoPtr pTdMemoryInfo = (TdMemoryInfoPtr)((char*)ptr - sizeof(TdMemoryInfo)); assert(pTdMemoryInfo->symbol == TD_MEMORY_SYMBOL); From 7a8642ff5388a4fe54e7d8e9869daa64b056a003 Mon Sep 17 00:00:00 2001 From: Cary Xu Date: Wed, 30 Mar 2022 17:54:29 +0800 Subject: [PATCH 27/49] memory clear --- source/dnode/vnode/src/inc/tsdbSma.h | 6 +- source/dnode/vnode/src/tsdb/tsdbSma.c | 26 ++--- source/dnode/vnode/test/tsdbSmaTest.cpp | 146 ++++++++++++------------ 3 files changed, 90 insertions(+), 88 deletions(-) diff --git a/source/dnode/vnode/src/inc/tsdbSma.h b/source/dnode/vnode/src/inc/tsdbSma.h index ffb9869914..da0a6856ab 100644 --- a/source/dnode/vnode/src/inc/tsdbSma.h +++ b/source/dnode/vnode/src/inc/tsdbSma.h @@ -51,7 +51,7 @@ static FORCE_INLINE int32_t tsdbEncodeTSmaKey(int64_t groupId, TSKEY tsKey, void return len; } -static FORCE_INLINE int tsdbRLockSma(SSmaEnv *pEnv) { +static FORCE_INLINE int32_t tsdbRLockSma(SSmaEnv *pEnv) { int code = taosThreadRwlockRdlock(&(pEnv->lock)); if (code != 0) { terrno = TAOS_SYSTEM_ERROR(code); @@ -60,7 +60,7 @@ static FORCE_INLINE int tsdbRLockSma(SSmaEnv *pEnv) { return 0; } -static FORCE_INLINE int tsdbWLockSma(SSmaEnv *pEnv) { +static FORCE_INLINE int32_t tsdbWLockSma(SSmaEnv *pEnv) { int code = taosThreadRwlockWrlock(&(pEnv->lock)); if (code != 0) { terrno = TAOS_SYSTEM_ERROR(code); @@ -69,7 +69,7 @@ static FORCE_INLINE int tsdbWLockSma(SSmaEnv *pEnv) { return 0; } -static FORCE_INLINE int tsdbUnLockSma(SSmaEnv *pEnv) { +static FORCE_INLINE int32_t tsdbUnLockSma(SSmaEnv *pEnv) { int code = taosThreadRwlockUnlock(&(pEnv->lock)); if (code != 0) { terrno = TAOS_SYSTEM_ERROR(code); diff --git a/source/dnode/vnode/src/tsdb/tsdbSma.c b/source/dnode/vnode/src/tsdb/tsdbSma.c index 91b4e83dd0..f04f4791b5 100644 --- a/source/dnode/vnode/src/tsdb/tsdbSma.c +++ b/source/dnode/vnode/src/tsdb/tsdbSma.c @@ -651,9 +651,8 @@ static int32_t tsdbGetSmaStorageLevel(int64_t interval, int8_t intervalUnit) { */ static int32_t tsdbInsertTSmaBlocks(STSmaWriteH *pSmaH, void *smaKey, uint32_t keyLen, void *pData, uint32_t dataLen) { SDBFile *pDBFile = &pSmaH->dFile; - tsdbDebug("vgId:%d insert sma data blocks into %s: smaKey %" PRIx64 "-%" PRIu16 "-%" PRIx64 ", dataLen %d", - REPO_ID(pSmaH->pTsdb), pDBFile->path, *(tb_uid_t *)smaKey, *(uint16_t *)POINTER_SHIFT(smaKey, 8), - *(int64_t *)POINTER_SHIFT(smaKey, 10), dataLen); + printf("\nvgId:%d insert sma data blocks into %s: smaKey %" PRIx64 "-%" PRIx64 ", dataLen %" PRIu32 "\n", + REPO_ID(pSmaH->pTsdb), pDBFile->path, *(int64_t *)smaKey, *(int64_t *)POINTER_SHIFT(smaKey, 8), dataLen); // TODO: insert sma data blocks into B+Tree(TDB) if (tsdbSaveSmaToDB(pDBFile, smaKey, keyLen, pData, dataLen) != 0) { @@ -874,7 +873,6 @@ static int32_t tsdbInsertTSmaDataImpl(STsdb *pTsdb, int64_t indexUid, const char // key: skey + groupId char smaKey[SMA_KEY_LEN] = {0}; - void *pSmaKey = &smaKey; char dataBuf[512] = {0}; void *pDataBuf = &dataBuf; int32_t sz = taosArrayGetSize(pDataBlocks); @@ -887,6 +885,7 @@ static int32_t tsdbInsertTSmaDataImpl(STsdb *pTsdb, int64_t indexUid, const char for (int32_t j = 0; j < rows; ++j) { printf("|"); TSKEY skey = TSKEY_INITIAL_VAL; // the start key of TS window by interval + void *pSmaKey = &smaKey; int32_t tlen = 0; for (int32_t k = 0; k < colNum; ++k) { SColumnInfoData *pColInfoData = *(SColumnInfoData **)taosArrayGet(pDataBlock->pDataBlock, k); @@ -894,7 +893,7 @@ static int32_t tsdbInsertTSmaDataImpl(STsdb *pTsdb, int64_t indexUid, const char switch (pColInfoData->info.type) { case TSDB_DATA_TYPE_TIMESTAMP: skey = *(TSKEY *)var; - printf(" skey = %" PRIi64 " groupId = %" PRId64 "|", skey, groupId); + printf("==> skey = %" PRIi64 " groupId = %" PRId64 "|", skey, groupId); tsdbEncodeTSmaKey(groupId, skey, &pSmaKey); break; case TSDB_DATA_TYPE_BOOL: @@ -976,7 +975,7 @@ static int32_t tsdbInsertTSmaDataImpl(STsdb *pTsdb, int64_t indexUid, const char } } - if (tsdbInsertTSmaBlocks(&tSmaH, pSmaKey, SMA_KEY_LEN, pDataBuf, tlen) != 0) { + if (tsdbInsertTSmaBlocks(&tSmaH, &smaKey, SMA_KEY_LEN, pDataBuf, tlen) != 0) { tsdbWarn("vgId:%d insert tSma data blocks failed for index %" PRIi64 ", skey %" PRIi64 ", groupId %" PRIi64 " since %s", REPO_ID(pTsdb), indexUid, skey, groupId, tstrerror(terrno)); @@ -1308,22 +1307,19 @@ static int32_t tsdbGetTSmaDataImpl(STsdb *pTsdb, char *pData, int64_t indexUid, return TSDB_CODE_FAILED; } - char smaKey[SMA_KEY_LEN] = {0}; - void *pSmaKey = &smaKey; + char smaKey[SMA_KEY_LEN] = {0}; + void *pSmaKey = &smaKey; int64_t queryGroupId = 1; tsdbEncodeTSmaKey(queryGroupId, querySKey, (void **)&pSmaKey); - tsdbDebug("vgId:%d get sma data from %s: smaKey %" PRIx64 "-%" PRIu16 "-%" PRIx64 ", keyLen %d", REPO_ID(pTsdb), - tReadH.dFile.path, *(tb_uid_t *)smaKey, *(uint16_t *)POINTER_SHIFT(smaKey, 8), - *(int64_t *)POINTER_SHIFT(smaKey, 10), SMA_KEY_LEN); + tsdbDebug("vgId:%d get sma data from %s: smaKey %" PRIx64 "-%" PRIx64 ", keyLen %d", REPO_ID(pTsdb), + tReadH.dFile.path, *(int64_t *)smaKey, *(int64_t *)POINTER_SHIFT(smaKey, 8), SMA_KEY_LEN); void *result = NULL; uint32_t valueSize = 0; if ((result = tsdbGetSmaDataByKey(&tReadH.dFile, smaKey, SMA_KEY_LEN, &valueSize)) == NULL) { - tsdbWarn("vgId:%d get sma data failed from smaIndex %" PRIi64 ", smaKey %" PRIx64 "-%" PRIu16 "-%" PRIx64 - " since %s", - REPO_ID(pTsdb), indexUid, *(tb_uid_t *)smaKey, *(uint16_t *)POINTER_SHIFT(smaKey, 8), - *(int64_t *)POINTER_SHIFT(smaKey, 10), tstrerror(terrno)); + tsdbWarn("vgId:%d get sma data failed from smaIndex %" PRIi64 ", smaKey %" PRIx64 "-%" PRIx64 " since %s", + REPO_ID(pTsdb), indexUid, *(int64_t *)smaKey, *(int64_t *)POINTER_SHIFT(smaKey, 8), tstrerror(terrno)); tsdbCloseDBF(&tReadH.dFile); return TSDB_CODE_FAILED; } diff --git a/source/dnode/vnode/test/tsdbSmaTest.cpp b/source/dnode/vnode/test/tsdbSmaTest.cpp index 4c8ddd9ead..db31b9f4a3 100644 --- a/source/dnode/vnode/test/tsdbSmaTest.cpp +++ b/source/dnode/vnode/test/tsdbSmaTest.cpp @@ -59,20 +59,21 @@ TEST(testCase, unionEncodeDecodeTest) { void *buf = taosMemoryMalloc(1024); void *pBuf = buf; + void *qBuf = buf; int32_t tlen = 0; - tlen += taosEncodeFixedU8(&buf, sut.info); - tlen += taosEncodeFixedI16(&buf, sut.nBSmaCols); + tlen += taosEncodeFixedU8(&pBuf, sut.info); + tlen += taosEncodeFixedI16(&pBuf, sut.nBSmaCols); for (col_id_t i = 0; i < sut.nBSmaCols; ++i) { - tlen += taosEncodeFixedI16(&buf, sut.pBSmaCols[i]); + tlen += taosEncodeFixedI16(&pBuf, sut.pBSmaCols[i]); } SUnionTest dut = {0}; - pBuf = taosDecodeFixedU8(pBuf, &dut.info); - pBuf = taosDecodeFixedI16(pBuf, &dut.nBSmaCols); + qBuf = taosDecodeFixedU8(qBuf, &dut.info); + qBuf = taosDecodeFixedI16(qBuf, &dut.nBSmaCols); if (dut.nBSmaCols > 0) { dut.pBSmaCols = (col_id_t *)taosMemoryMalloc(dut.nBSmaCols * sizeof(col_id_t)); for (col_id_t i = 0; i < dut.nBSmaCols; ++i) { - pBuf = taosDecodeFixedI16(pBuf, dut.pBSmaCols + i); + qBuf = taosDecodeFixedI16(qBuf, dut.pBSmaCols + i); } } else { dut.pBSmaCols = NULL; @@ -81,13 +82,17 @@ TEST(testCase, unionEncodeDecodeTest) { printf("sut.rollup=%" PRIu8 ", type=%" PRIu8 ", info=%" PRIu8 "\n", sut.rollup, sut.type, sut.info); printf("dut.rollup=%" PRIu8 ", type=%" PRIu8 ", info=%" PRIu8 "\n", dut.rollup, dut.type, dut.info); - ASSERT_EQ(sut.rollup, dut.rollup); - ASSERT_EQ(sut.type, dut.type); - ASSERT_EQ(sut.nBSmaCols, dut.nBSmaCols); + EXPECT_EQ(sut.rollup, dut.rollup); + EXPECT_EQ(sut.type, dut.type); + EXPECT_EQ(sut.nBSmaCols, dut.nBSmaCols); for (col_id_t i = 0; i < sut.nBSmaCols; ++i) { - ASSERT_EQ(*(col_id_t *)(sut.pBSmaCols + i), sut.pBSmaCols[i]); - ASSERT_EQ(*(col_id_t *)(sut.pBSmaCols + i), dut.pBSmaCols[i]); + EXPECT_EQ(*(col_id_t *)(sut.pBSmaCols + i), sut.pBSmaCols[i]); + EXPECT_EQ(*(col_id_t *)(sut.pBSmaCols + i), dut.pBSmaCols[i]); } + + taosMemoryFreeClear(buf); + taosMemoryFreeClear(dut.pBSmaCols); + taosMemoryFreeClear(sut.pBSmaCols); } #if 1 TEST(testCase, tSma_Meta_Encode_Decode_Test) { @@ -107,37 +112,37 @@ TEST(testCase, tSma_Meta_Encode_Decode_Test) { uint32_t bufLen = tEncodeTSmaWrapper(NULL, &tSmaWrapper); void *buf = taosMemoryCalloc(1, bufLen); - ASSERT_NE(buf, nullptr); + EXPECT_NE(buf, nullptr); STSmaWrapper *pSW = (STSmaWrapper *)buf; uint32_t len = tEncodeTSmaWrapper(&buf, &tSmaWrapper); - ASSERT_EQ(len, bufLen); + EXPECT_EQ(len, bufLen); // decode STSmaWrapper dstTSmaWrapper = {0}; void *result = tDecodeTSmaWrapper(pSW, &dstTSmaWrapper); - ASSERT_NE(result, nullptr); + EXPECT_NE(result, nullptr); - ASSERT_EQ(tSmaWrapper.number, dstTSmaWrapper.number); + EXPECT_EQ(tSmaWrapper.number, dstTSmaWrapper.number); for (int i = 0; i < tSmaWrapper.number; ++i) { STSma *pSma = tSmaWrapper.tSma + i; STSma *qSma = dstTSmaWrapper.tSma + i; - ASSERT_EQ(pSma->version, qSma->version); - ASSERT_EQ(pSma->intervalUnit, qSma->intervalUnit); - ASSERT_EQ(pSma->slidingUnit, qSma->slidingUnit); - ASSERT_STRCASEEQ(pSma->indexName, qSma->indexName); - ASSERT_EQ(pSma->timezoneInt, qSma->timezoneInt); - ASSERT_EQ(pSma->indexUid, qSma->indexUid); - ASSERT_EQ(pSma->tableUid, qSma->tableUid); - ASSERT_EQ(pSma->interval, qSma->interval); - ASSERT_EQ(pSma->sliding, qSma->sliding); - ASSERT_EQ(pSma->exprLen, qSma->exprLen); - ASSERT_STRCASEEQ(pSma->expr, qSma->expr); - ASSERT_EQ(pSma->tagsFilterLen, qSma->tagsFilterLen); - ASSERT_STRCASEEQ(pSma->tagsFilter, qSma->tagsFilter); + EXPECT_EQ(pSma->version, qSma->version); + EXPECT_EQ(pSma->intervalUnit, qSma->intervalUnit); + EXPECT_EQ(pSma->slidingUnit, qSma->slidingUnit); + EXPECT_STRCASEEQ(pSma->indexName, qSma->indexName); + EXPECT_EQ(pSma->timezoneInt, qSma->timezoneInt); + EXPECT_EQ(pSma->indexUid, qSma->indexUid); + EXPECT_EQ(pSma->tableUid, qSma->tableUid); + EXPECT_EQ(pSma->interval, qSma->interval); + EXPECT_EQ(pSma->sliding, qSma->sliding); + EXPECT_EQ(pSma->exprLen, qSma->exprLen); + EXPECT_STRCASEEQ(pSma->expr, qSma->expr); + EXPECT_EQ(pSma->tagsFilterLen, qSma->tagsFilterLen); + EXPECT_STRCASEEQ(pSma->tagsFilter, qSma->tagsFilter); } // resource release @@ -173,12 +178,12 @@ TEST(testCase, tSma_metaDB_Put_Get_Del_Test) { tSma.exprLen = strlen(expr); tSma.expr = (char *)taosMemoryCalloc(1, tSma.exprLen + 1); - ASSERT_NE(tSma.expr, nullptr); + EXPECT_NE(tSma.expr, nullptr); tstrncpy(tSma.expr, expr, tSma.exprLen + 1); tSma.tagsFilterLen = strlen(tagsFilter); tSma.tagsFilter = (char *)taosMemoryCalloc(tSma.tagsFilterLen + 1, 1); - ASSERT_NE(tSma.tagsFilter, nullptr); + EXPECT_NE(tSma.tagsFilter, nullptr); tstrncpy(tSma.tagsFilter, tagsFilter, tSma.tagsFilterLen + 1); SMeta *pMeta = NULL; @@ -190,7 +195,7 @@ TEST(testCase, tSma_metaDB_Put_Get_Del_Test) { pMeta = metaOpen(smaTestDir, pMetaCfg, NULL); assert(pMeta != NULL); // save index 1 - ASSERT_EQ(metaSaveSmaToDB(pMeta, pSmaCfg), 0); + EXPECT_EQ(metaSaveSmaToDB(pMeta, pSmaCfg), 0); pSmaCfg->indexUid = indexUid2; tstrncpy(pSmaCfg->indexName, smaIndexName2, TSDB_INDEX_NAME_LEN); @@ -201,7 +206,7 @@ TEST(testCase, tSma_metaDB_Put_Get_Del_Test) { pSmaCfg->sliding = 5; // save index 2 - ASSERT_EQ(metaSaveSmaToDB(pMeta, pSmaCfg), 0); + EXPECT_EQ(metaSaveSmaToDB(pMeta, pSmaCfg), 0); // get value by indexName STSma *qSmaCfg = NULL; @@ -211,8 +216,8 @@ TEST(testCase, tSma_metaDB_Put_Get_Del_Test) { printf("timezone1 = %" PRIi8 "\n", qSmaCfg->timezoneInt); printf("expr1 = %s\n", qSmaCfg->expr != NULL ? qSmaCfg->expr : ""); printf("tagsFilter1 = %s\n", qSmaCfg->tagsFilter != NULL ? qSmaCfg->tagsFilter : ""); - ASSERT_STRCASEEQ(qSmaCfg->indexName, smaIndexName1); - ASSERT_EQ(qSmaCfg->tableUid, tSma.tableUid); + EXPECT_STRCASEEQ(qSmaCfg->indexName, smaIndexName1); + EXPECT_EQ(qSmaCfg->tableUid, tSma.tableUid); tdDestroyTSma(qSmaCfg); taosMemoryFreeClear(qSmaCfg); @@ -222,8 +227,8 @@ TEST(testCase, tSma_metaDB_Put_Get_Del_Test) { printf("timezone2 = %" PRIi8 "\n", qSmaCfg->timezoneInt); printf("expr2 = %s\n", qSmaCfg->expr != NULL ? qSmaCfg->expr : ""); printf("tagsFilter2 = %s\n", qSmaCfg->tagsFilter != NULL ? qSmaCfg->tagsFilter : ""); - ASSERT_STRCASEEQ(qSmaCfg->indexName, smaIndexName2); - ASSERT_EQ(qSmaCfg->interval, tSma.interval); + EXPECT_STRCASEEQ(qSmaCfg->indexName, smaIndexName2); + EXPECT_EQ(qSmaCfg->interval, tSma.interval); tdDestroyTSma(qSmaCfg); taosMemoryFreeClear(qSmaCfg); @@ -239,25 +244,25 @@ TEST(testCase, tSma_metaDB_Put_Get_Del_Test) { printf("indexName = %s\n", indexName); ++indexCnt; } - ASSERT_EQ(indexCnt, nCntTSma); + EXPECT_EQ(indexCnt, nCntTSma); metaCloseSmaCurosr(pSmaCur); // get wrapper by table uid STSmaWrapper *pSW = metaGetSmaInfoByTable(pMeta, tbUid); assert(pSW != NULL); - ASSERT_EQ(pSW->number, nCntTSma); - ASSERT_STRCASEEQ(pSW->tSma->indexName, smaIndexName1); - ASSERT_EQ(pSW->tSma->timezoneInt, timezone); - ASSERT_STRCASEEQ(pSW->tSma->expr, expr); - ASSERT_STRCASEEQ(pSW->tSma->tagsFilter, tagsFilter); - ASSERT_EQ(pSW->tSma->indexUid, indexUid1); - ASSERT_EQ(pSW->tSma->tableUid, tbUid); - ASSERT_STRCASEEQ((pSW->tSma + 1)->indexName, smaIndexName2); - ASSERT_EQ((pSW->tSma + 1)->timezoneInt, timezone); - ASSERT_STRCASEEQ((pSW->tSma + 1)->expr, expr); - ASSERT_STRCASEEQ((pSW->tSma + 1)->tagsFilter, tagsFilter); - ASSERT_EQ((pSW->tSma + 1)->indexUid, indexUid2); - ASSERT_EQ((pSW->tSma + 1)->tableUid, tbUid); + EXPECT_EQ(pSW->number, nCntTSma); + EXPECT_STRCASEEQ(pSW->tSma->indexName, smaIndexName1); + EXPECT_EQ(pSW->tSma->timezoneInt, timezone); + EXPECT_STRCASEEQ(pSW->tSma->expr, expr); + EXPECT_STRCASEEQ(pSW->tSma->tagsFilter, tagsFilter); + EXPECT_EQ(pSW->tSma->indexUid, indexUid1); + EXPECT_EQ(pSW->tSma->tableUid, tbUid); + EXPECT_STRCASEEQ((pSW->tSma + 1)->indexName, smaIndexName2); + EXPECT_EQ((pSW->tSma + 1)->timezoneInt, timezone); + EXPECT_STRCASEEQ((pSW->tSma + 1)->expr, expr); + EXPECT_STRCASEEQ((pSW->tSma + 1)->tagsFilter, tagsFilter); + EXPECT_EQ((pSW->tSma + 1)->indexUid, indexUid2); + EXPECT_EQ((pSW->tSma + 1)->tableUid, tbUid); tdDestroyTSmaWrapper(pSW); taosMemoryFreeClear(pSW); @@ -269,7 +274,7 @@ TEST(testCase, tSma_metaDB_Put_Get_Del_Test) { printf("metaGetSmaTbUids: uid[%" PRIu32 "] = %" PRIi64 "\n", i, *(tb_uid_t *)taosArrayGet(pUids, i)); // printf("metaGetSmaTbUids: index[%" PRIu32 "] = %s", i, (char *)taosArrayGet(pUids, i)); } - ASSERT_EQ(taosArrayGetSize(pUids), 1); + EXPECT_EQ(taosArrayGetSize(pUids), 1); taosArrayDestroy(pUids); // resource release @@ -311,12 +316,12 @@ TEST(testCase, tSma_Data_Insert_Query_Test) { tSma.exprLen = strlen(expr); tSma.expr = (char *)taosMemoryCalloc(1, tSma.exprLen + 1); - ASSERT_NE(tSma.expr, nullptr); + EXPECT_NE(tSma.expr, nullptr); tstrncpy(tSma.expr, expr, tSma.exprLen + 1); tSma.tagsFilterLen = strlen(tagsFilter); tSma.tagsFilter = (char *)taosMemoryCalloc(1, tSma.tagsFilterLen + 1); - ASSERT_NE(tSma.tagsFilter, nullptr); + EXPECT_NE(tSma.tagsFilter, nullptr); tstrncpy(tSma.tagsFilter, tagsFilter, tSma.tagsFilterLen + 1); SMeta *pMeta = NULL; @@ -328,7 +333,7 @@ TEST(testCase, tSma_Data_Insert_Query_Test) { pMeta = metaOpen(smaTestDir, pMetaCfg, NULL); assert(pMeta != NULL); // save index 1 - ASSERT_EQ(metaSaveSmaToDB(pMeta, pSmaCfg), 0); + EXPECT_EQ(metaSaveSmaToDB(pMeta, pSmaCfg), 0); // step 2: insert data STsdb *pTsdb = (STsdb *)taosMemoryCalloc(1, sizeof(STsdb)); @@ -365,7 +370,7 @@ TEST(testCase, tSma_Data_Insert_Query_Test) { strncpy(pDisks.dir, "/var/lib/taos", TSDB_FILENAME_LEN); int32_t numOfDisks = 1; pTsdb->pTfs = tfsOpen(&pDisks, numOfDisks); - ASSERT_NE(pTsdb->pTfs, nullptr); + EXPECT_NE(pTsdb->pTfs, nullptr); // generate SSubmitReq msg and update expired window int16_t schemaVer = 0; @@ -375,7 +380,7 @@ TEST(testCase, tSma_Data_Insert_Query_Test) { uint32_t msgLen = sizeof(SSubmitReq) + mockBlkNum * sizeof(SSubmitBlk) + mockBlkNum * mockRowNum * mockRowLen; SSubmitReq *pMsg = (SSubmitReq *)taosMemoryCalloc(1, msgLen); - ASSERT_NE(pMsg, nullptr); + EXPECT_NE(pMsg, nullptr); pMsg->version = htobe64(schemaVer); pMsg->numOfBlocks = htonl(mockBlkNum); pMsg->length = htonl(msgLen); @@ -401,9 +406,9 @@ TEST(testCase, tSma_Data_Insert_Query_Test) { } } - ASSERT_EQ(tdScanAndConvertSubmitMsg(pMsg), TSDB_CODE_SUCCESS); + EXPECT_EQ(tdScanAndConvertSubmitMsg(pMsg), TSDB_CODE_SUCCESS); - ASSERT_EQ(tsdbUpdateSmaWindow(pTsdb, (const char *)pMsg), 0); + EXPECT_EQ(tsdbUpdateSmaWindow(pTsdb, (const char *)pMsg), 0); // init const int32_t tSmaGroupSize = 4; @@ -413,7 +418,7 @@ TEST(testCase, tSma_Data_Insert_Query_Test) { const int32_t tSmaNumOfRows = 2; SArray *pDataBlocks = taosArrayInit(tSmaGroupSize, sizeof(SSDataBlock *)); - ASSERT_NE(pDataBlocks, nullptr); + EXPECT_NE(pDataBlocks, nullptr); int32_t tSmaTypeArray[tSmaNumOfCols] = {TSDB_DATA_TYPE_TIMESTAMP, TSDB_DATA_TYPE_BOOL, TSDB_DATA_TYPE_INT, TSDB_DATA_TYPE_UBIGINT, TSDB_DATA_TYPE_SMALLINT, TSDB_DATA_TYPE_FLOAT, TSDB_DATA_TYPE_DOUBLE, TSDB_DATA_TYPE_VARCHAR, TSDB_DATA_TYPE_NCHAR}; @@ -427,18 +432,18 @@ TEST(testCase, tSma_Data_Insert_Query_Test) { for (int32_t g = 0; g < tSmaGroupSize; ++g) { SSDataBlock *pDataBlock = (SSDataBlock *)taosMemoryCalloc(1, sizeof(SSDataBlock)); - ASSERT_NE(pDataBlock, nullptr); + EXPECT_NE(pDataBlock, nullptr); pDataBlock->pBlockAgg = NULL; pDataBlock->info.numOfCols = tSmaNumOfCols; pDataBlock->info.rows = tSmaNumOfRows; pDataBlock->info.groupId = tSmaGroupId + g; pDataBlock->pDataBlock = taosArrayInit(tSmaNumOfCols, sizeof(SColumnInfoData *)); - ASSERT_NE(pDataBlock->pDataBlock, nullptr); + EXPECT_NE(pDataBlock->pDataBlock, nullptr); for (int32_t c = 0; c < tSmaNumOfCols; ++c) { SColumnInfoData *pColInfoData = (SColumnInfoData *)taosMemoryCalloc(1, sizeof(SColumnInfoData)); - ASSERT_NE(pColInfoData, nullptr); + EXPECT_NE(pColInfoData, nullptr); pColInfoData->info.type = tSmaTypeArray[c]; if (IS_VAR_DATA_TYPE(pColInfoData->info.type)) { @@ -481,7 +486,7 @@ TEST(testCase, tSma_Data_Insert_Query_Test) { memcpy(varDataVal(pCellData), tSmaGroupbyTags[g * 2 + 1], varDataLen(pCellData)); break; default: - ASSERT_EQ(0, 1); // add definition + EXPECT_EQ(0, 1); // add definition break; } } @@ -493,7 +498,7 @@ TEST(testCase, tSma_Data_Insert_Query_Test) { } // execute - ASSERT_EQ(tsdbInsertTSmaData(pTsdb, tSma.indexUid, (const char *)pDataBlocks), TSDB_CODE_SUCCESS); + EXPECT_EQ(tsdbInsertTSmaData(pTsdb, tSma.indexUid, (const char *)pDataBlocks), TSDB_CODE_SUCCESS); #if 0 STSmaDataWrapper *pSmaData = NULL; @@ -512,7 +517,7 @@ TEST(testCase, tSma_Data_Insert_Query_Test) { int32_t tableDataLen = sizeof(STSmaTbData); for (col_id_t c = 0; c < numOfCols; ++c) { if (bufSize - len - tableDataLen < buffer) { - ASSERT_EQ(tsdbMakeRoom(&buf, bufSize + allocStep), 0); + EXPECT_EQ(tsdbMakeRoom(&buf, bufSize + allocStep), 0); pSmaData = (STSmaDataWrapper *)buf; pTbData = (STSmaTbData *)POINTER_SHIFT(pSmaData, len); bufSize = taosTSizeof(buf); @@ -539,14 +544,14 @@ TEST(testCase, tSma_Data_Insert_Query_Test) { } pSmaData->dataLen = (len - sizeof(STSmaDataWrapper)); - ASSERT_GE(bufSize, pSmaData->dataLen); + EXPECT_GE(bufSize, pSmaData->dataLen); // execute - ASSERT_EQ(tsdbInsertTSmaData(pTsdb, (char *)pSmaData), TSDB_CODE_SUCCESS); + EXPECT_EQ(tsdbInsertTSmaData(pTsdb, (char *)pSmaData), TSDB_CODE_SUCCESS); #endif // step 3: query uint32_t checkDataCnt = 0; - ASSERT_EQ(tsdbGetTSmaData(pTsdb, NULL, indexUid1, skey1, 1), TSDB_CODE_SUCCESS); + EXPECT_EQ(tsdbGetTSmaData(pTsdb, NULL, indexUid1, skey1, 1), TSDB_CODE_SUCCESS); ++checkDataCnt; printf("%s:%d The sma data check count for insert and query is %" PRIu32 "\n", __FILE__, __LINE__, checkDataCnt); @@ -555,11 +560,12 @@ TEST(testCase, tSma_Data_Insert_Query_Test) { taosMemoryFreeClear(pMsg); for (int32_t i = 0; i < taosArrayGetSize(pDataBlocks); ++i) { - SSDataBlock *pDataBlock = (SSDataBlock *)taosArrayGet(pDataBlocks, i); + SSDataBlock *pDataBlock = *(SSDataBlock **)taosArrayGet(pDataBlocks, i); int32_t numOfOutput = taosArrayGetSize(pDataBlock->pDataBlock); for (int32_t j = 0; j < numOfOutput; ++j) { - SColumnInfoData *pColInfoData = (SColumnInfoData *)taosArrayGet(pDataBlock->pDataBlock, j); + SColumnInfoData *pColInfoData = *(SColumnInfoData **)taosArrayGet(pDataBlock->pDataBlock, j); colDataDestroy(pColInfoData); + taosMemoryFreeClear(pColInfoData); } taosArrayDestroy(pDataBlock->pDataBlock); From f83e1106fbae6ca2b494fe12af493bfceb19b063 Mon Sep 17 00:00:00 2001 From: plum-lihui Date: Wed, 30 Mar 2022 18:31:50 +0800 Subject: [PATCH 28/49] [add function for tmq] --- tests/script/tsim/tmq/basic1.sim | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/tests/script/tsim/tmq/basic1.sim b/tests/script/tsim/tmq/basic1.sim index fe6a7a0660..cfcb1ac992 100644 --- a/tests/script/tsim/tmq/basic1.sim +++ b/tests/script/tsim/tmq/basic1.sim @@ -66,15 +66,15 @@ print =============== will support: * from stb; function from stb/ctb sql create topic topic_stb_column as select ts, c1, c3 from stb #sql create topic topic_stb_all as select * from stb -#sql create topic topic_stb_function as select ts, abs(c1), sina(c2) from stb +sql create topic topic_stb_function as select ts, abs(c1), sin(c2) from stb sql create topic topic_ctb_column as select ts, c1, c3 from ct0 sql create topic topic_ctb_all as select * from ct0 -#sql create topic topic_ctb_function as select ts, abs(c1), sina(c2) from ct0 +sql create topic topic_ctb_function as select ts, abs(c1), sin(c2) from ct0 sql create topic topic_ntb_column as select ts, c1, c3 from ntb sql create topic topic_ntb_all as select * from ntb -#sql create topic topic_ntb_function as select ts, abs(c1), sina(c2) from ntb +sql create topic topic_ntb_function as select ts, abs(c1), sin(c2) from ntb sql show tables if $rows != 3 then @@ -147,6 +147,13 @@ endi # return -1 #endi +print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_stb_function" -k "group.id:tg2" +system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_stb_function" -k "group.id:tg2" +print cmd result----> $system_content +if $system_content != @{consume success: 20, 0}@ then + return -1 +endi + print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ctb_column" -k "group.id:tg2" system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ctb_column" -k "group.id:tg2" print cmd result----> $system_content @@ -161,6 +168,13 @@ if $system_content != @{consume success: 10, 0}@ then return -1 endi +print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ctb_function" -k "group.id:tg2" +system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ctb_function" -k "group.id:tg2" +print cmd result----> $system_content +if $system_content != @{consume success: 10, 0}@ then + return -1 +endi + print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ntb_column" -k "group.id:tg2" system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ntb_column" -k "group.id:tg2" print cmd result----> $system_content @@ -175,6 +189,13 @@ if $system_content != @{consume success: 20, 0}@ then return -1 endi +print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ntb_function" -k "group.id:tg2" +system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ntb_function" -k "group.id:tg2" +print cmd result----> $system_content +if $system_content != @{consume success: 20, 0}@ then + return -1 +endi + print =============== create database , vgroup 4 $dbNamme = d1 sql create database $dbNamme vgroups 4 From 9f2b1509f3d5ebf77be94b5d6d17a0ba1bf88f2a Mon Sep 17 00:00:00 2001 From: cpwu Date: Wed, 30 Mar 2022 19:06:36 +0800 Subject: [PATCH 29/49] fix basic loaction --- tests/script/jenkins/basic.txt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index 26cb553097..46b6a40166 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -40,12 +40,12 @@ ./test.sh -f tsim/tmq/basic1.sim # --- stable -./test.sh -f general/stable/disk.sim -./test.sh -f general/stable/dnode3.sim -./test.sh -f general/stable/metrics.sim -./test.sh -f general/stable/refcount.sim -# ./test.sh -f general/stable/show.sim -./test.sh -f general/stable/values.sim -./test.sh -f general/stable/vnode3.sim +./test.sh -f tsim/stable/disk.sim +./test.sh -f tsim/stable/dnode3.sim +./test.sh -f tsim/stable/metrics.sim +./test.sh -f tsim/stable/refcount.sim +# ./test.sh -f tsim/stable/show.sim +./test.sh -f tsim/stable/values.sim +./test.sh -f tsim/stable/vnode3.sim #======================b1-end=============== From fd4455aa23ccd40328eea8110a6e85db7f4337b5 Mon Sep 17 00:00:00 2001 From: Cary Xu Date: Wed, 30 Mar 2022 19:13:24 +0800 Subject: [PATCH 30/49] colIdx bugfix --- include/common/trow.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/common/trow.h b/include/common/trow.h index df28bc9962..abbe55c3a3 100644 --- a/include/common/trow.h +++ b/include/common/trow.h @@ -937,9 +937,8 @@ static FORCE_INLINE bool tdSTSRowIterNext(STSRowIter *pIter, col_id_t colId, col STColumn *pCol = NULL; STSchema *pSchema = pIter->pSchema; while (pIter->colIdx <= pSchema->numOfCols) { - pCol = &pSchema->columns[pIter->colIdx]; + pCol = &pSchema->columns[pIter->colIdx]; // 1st column of schema is primary TS key if (colId == pCol->colId) { - ++pIter->colIdx; break; } else if (colId < pCol->colId) { ++pIter->colIdx; @@ -948,7 +947,8 @@ static FORCE_INLINE bool tdSTSRowIterNext(STSRowIter *pIter, col_id_t colId, col return false; } } - return tdGetTpRowDataOfCol(pIter, pCol->type, pCol->offset - sizeof(TSKEY), pVal); + tdGetTpRowDataOfCol(pIter, pCol->type, pCol->offset - sizeof(TSKEY), pVal); + ++pIter->colIdx; } else if (TD_IS_KV_ROW(pIter->pRow)) { return tdGetKvRowValOfColEx(pIter, colId, colType, &pIter->kvIdx, pVal); } else { From a915647df897699fe3d266278eb140844fecf649 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Wed, 30 Mar 2022 19:27:41 +0800 Subject: [PATCH 31/49] add fuzzy search --- source/libs/index/inc/indexFstDfa.h | 2 + source/libs/index/src/indexFstDfa.c | 61 +++++++++++++++++++++++++++-- 2 files changed, 60 insertions(+), 3 deletions(-) diff --git a/source/libs/index/inc/indexFstDfa.h b/source/libs/index/inc/indexFstDfa.h index 72a265c123..f6c220bcb7 100644 --- a/source/libs/index/inc/indexFstDfa.h +++ b/source/libs/index/inc/indexFstDfa.h @@ -44,6 +44,8 @@ typedef struct FstDfaBuilder { FstDfaBuilder *dfaBuilderCreate(SArray *insts); +void dfaBuilderDestroy(FstDfaBuilder *builder); + FstDfa *dfaBuilderBuild(FstDfaBuilder *builder); bool dfaBuilderRunState(FstDfaBuilder *builder, FstSparseSet *cur, FstSparseSet *next, uint32_t state, uint8_t bytes, diff --git a/source/libs/index/src/indexFstDfa.c b/source/libs/index/src/indexFstDfa.c index 765c5f08eb..b390c31343 100644 --- a/source/libs/index/src/indexFstDfa.c +++ b/source/libs/index/src/indexFstDfa.c @@ -16,6 +16,8 @@ #include "indexFstDfa.h" #include "thash.h" +const static uint32_t STATE_LIMIT = 1000; + static int dfaInstsEqual(const void *a, const void *b, size_t size) { SArray *ar = (SArray *)a; SArray *br = (SArray *)b; @@ -48,6 +50,18 @@ FstDfaBuilder *dfaBuilderCreate(SArray *insts) { taosHashSetEqualFp(builder->cache, dfaInstsEqual); return builder; } +void dfaBuilderDestroy(FstDfaBuilder *builder) { + if (builder == NULL) { + return; + } + void *pIter = builder->cache != NULL ? taosHashIterate(builder->cache, NULL) : NULL; + while (pIter) { + SArray **key = pIter; + taosArrayDestroy(*key); + pIter = taosHashIterate(builder->cache, pIter); + } + taosHashCleanup(builder->cache); +} FstDfa *dfaBuilderBuild(FstDfaBuilder *builder) { uint32_t sz = taosArrayGetSize(builder->dfa->insts); @@ -55,12 +69,53 @@ FstDfa *dfaBuilderBuild(FstDfaBuilder *builder) { FstSparseSet *nxt = sparSetCreate(sz); dfaAdd(builder->dfa, cur, 0); + + SArray * states = taosArrayInit(0, sizeof(uint32_t)); + uint32_t result; + if (dfaBuilderCachedState(builder, cur, &result)) { + taosArrayPush(states, &result); + } + SHashObj *seen = taosHashInit(12, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), false, HASH_NO_LOCK); + while (taosArrayGetSize(states) != 0) { + result = *(uint32_t *)taosArrayPop(states); + for (int i = 0; i < 256; i++) { + uint32_t ns, dummpy = 0; + if (dfaBuilderRunState(builder, cur, nxt, result, i, &ns)) { + if (taosHashGet(seen, &ns, sizeof(ns)) == NULL) { + taosHashPut(seen, &ns, sizeof(ns), &dummpy, sizeof(dummpy)); + taosArrayPush(states, &ns); + } + } + if (taosArrayGetSize(builder->dfa->states) > STATE_LIMIT) { + // Too many state; + // + } + } + } + taosArrayDestroy(states); + taosHashCleanup(seen); + return builder->dfa; } -bool dfaBuilderRunState(FstDfaBuilder *builder, FstSparseSet *cur, FstSparseSet *next, uint32_t state, uint8_t bytes, +bool dfaBuilderRunState(FstDfaBuilder *builder, FstSparseSet *cur, FstSparseSet *next, uint32_t state, uint8_t byte, uint32_t *result) { - // impl run state - return true; + sparSetClear(cur); + State *t = taosArrayGet(builder->dfa->states, state); + for (int i = 0; i < taosArrayGetSize(t->insts); i++) { + uint32_t ip = *(int32_t *)taosArrayGet(t->insts, i); + sparSetAdd(cur, ip); + } + dfaRun(builder->dfa, cur, next, byte); + + t = taosArrayGet(builder->dfa->states, state); + + uint32_t nxtState; + if (dfaBuilderCachedState(builder, next, &nxtState)) { + t->next[byte] = nxtState; + *result = nxtState; + return true; + } + return false; } bool dfaBuilderCachedState(FstDfaBuilder *builder, FstSparseSet *set, uint32_t *result) { From 387cfe8d4560f3525d009baa91710271eacb5423 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Wed, 30 Mar 2022 19:38:30 +0800 Subject: [PATCH 32/49] [td-13039] fix bug in stream interval query. --- source/dnode/vnode/src/tq/tqRead.c | 2 +- source/dnode/vnode/src/vnd/vnodeQuery.c | 4 +- source/libs/executor/inc/executorimpl.h | 1 + source/libs/executor/src/executil.c | 2 +- source/libs/executor/src/executorimpl.c | 46 ++++++++++++++++------ source/libs/planner/src/planPhysiCreater.c | 3 ++ source/libs/stream/src/tstream.c | 1 + 7 files changed, 43 insertions(+), 16 deletions(-) diff --git a/source/dnode/vnode/src/tq/tqRead.c b/source/dnode/vnode/src/tq/tqRead.c index 9c0b0802ab..344b4fa655 100644 --- a/source/dnode/vnode/src/tq/tqRead.c +++ b/source/dnode/vnode/src/tq/tqRead.c @@ -167,7 +167,7 @@ SArray* tqRetrieveDataBlock(STqReadHandle* pHandle) { if (!tdSTSRowIterNext(&iter, pColData->info.colId, pColData->info.type, &sVal)) { break; } - if (colDataAppend(pColData, curRow, sVal.val, sVal.valType == TD_VTYPE_NULL) < 0) { + if (colDataAppend(pColData, curRow, sVal.val, false) < 0) { taosArrayDestroyEx(pArray, (void (*)(void*))tDeleteSSDataBlock); return NULL; } diff --git a/source/dnode/vnode/src/vnd/vnodeQuery.c b/source/dnode/vnode/src/vnd/vnodeQuery.c index 598647f797..d377ec2039 100644 --- a/source/dnode/vnode/src/vnd/vnodeQuery.c +++ b/source/dnode/vnode/src/vnd/vnodeQuery.c @@ -69,9 +69,9 @@ int vnodeProcessFetchMsg(SVnode *pVnode, SRpcMsg *pMsg, SQueueInfo *pInfo) { return tqProcessPollReq(pVnode->pTq, pMsg); case TDMT_VND_TASK_PIPE_EXEC: case TDMT_VND_TASK_MERGE_EXEC: - return tqProcessTaskExec(pVnode->pTq, msgstr, msgLen, pInfo->workerId); + return tqProcessTaskExec(pVnode->pTq, msgstr, msgLen, 0); case TDMT_VND_STREAM_TRIGGER: - return tqProcessStreamTrigger(pVnode->pTq, pMsg->pCont, pMsg->contLen, pInfo->workerId); + return tqProcessStreamTrigger(pVnode->pTq, pMsg->pCont, pMsg->contLen, 0); case TDMT_VND_QUERY_HEARTBEAT: return qWorkerProcessHbMsg(pVnode, pVnode->pQuery, pMsg); default: diff --git a/source/libs/executor/inc/executorimpl.h b/source/libs/executor/inc/executorimpl.h index 1d7023930d..ce0069fdfa 100644 --- a/source/libs/executor/inc/executorimpl.h +++ b/source/libs/executor/inc/executorimpl.h @@ -422,6 +422,7 @@ typedef struct SStreamBlockScanInfo { uint64_t numOfRows; // total scanned rows uint64_t numOfExec; // execution times void* readerHandle; // stream block reader handle + SArray* pColMatchInfo; // } SStreamBlockScanInfo; typedef struct SSysTableScanInfo { diff --git a/source/libs/executor/src/executil.c b/source/libs/executor/src/executil.c index 9fb009c917..93fbfe43ce 100644 --- a/source/libs/executor/src/executil.c +++ b/source/libs/executor/src/executil.c @@ -227,7 +227,7 @@ void initMultiResInfoFromArrayList(SGroupResInfo* pGroupResInfo, SArray* pArrayL taosArrayDestroy(pGroupResInfo->pRows); } - pGroupResInfo->pRows = pArrayList->pData; + pGroupResInfo->pRows = pArrayList; pGroupResInfo->index = 0; ASSERT(pGroupResInfo->index <= getNumOfTotalRes(pGroupResInfo)); } diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index f734c81858..6265fe6123 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -352,7 +352,7 @@ SSDataBlock* createOutputBuf_rv1(SDataBlockDescNode* pNode) { continue; } - idata.info.type = pDescNode->dataType.type; + idata.info.type = pDescNode->dataType.type; idata.info.bytes = pDescNode->dataType.bytes; idata.info.scale = pDescNode->dataType.scale; idata.info.slotId = pDescNode->slotId; @@ -1551,8 +1551,8 @@ static SArray* hashIntervalAgg(SOperatorInfo* pOperatorInfo, SResultRowInfo* pRe if (pSDataBlock->pDataBlock != NULL) { SColumnInfoData* pColDataInfo = taosArrayGet(pSDataBlock->pDataBlock, 0); tsCols = (int64_t*)pColDataInfo->pData; - assert(tsCols[0] == pSDataBlock->info.window.skey && - tsCols[pSDataBlock->info.rows - 1] == pSDataBlock->info.window.ekey); +// assert(tsCols[0] == pSDataBlock->info.window.skey && +// tsCols[pSDataBlock->info.rows - 1] == pSDataBlock->info.window.ekey); } int32_t startPos = ascScan? 0 : (pSDataBlock->info.rows - 1); @@ -3660,6 +3660,7 @@ void finalizeUpdatedResult(SqlFunctionCtx* pCtx, int32_t numOfOutput, SDiskbased if (pCtx[j].fpSet.process) { // TODO set the dummy function. pCtx[j].fpSet.finalize(&pCtx[j]); + pResInfo->initialized = true; } if (pRow->numOfRows < pResInfo->numOfRes) { @@ -3778,10 +3779,6 @@ void setResultRowOutputBufInitCtx_rv(SDiskbasedBuf* pBuf, SResultRow* pResult, S continue; } - // int32_t functionId = pCtx[i].functionId; - // if (functionId < 0) { - // continue; - // } // if (functionId == FUNCTION_TOP || functionId == FUNCTION_BOTTOM || functionId == FUNCTION_DIFF) { // if (i > 0) pCtx[i].ptsOutputBuf = pCtx[i - 1].pOutput; // } @@ -4971,7 +4968,20 @@ static SSDataBlock* doStreamBlockScan(SOperatorInfo* pOperator, bool* newgroup) return NULL; } - pInfo->pRes->pDataBlock = tqRetrieveDataBlock(pInfo->readerHandle); + SArray* pCols = tqRetrieveDataBlock(pInfo->readerHandle); + + int32_t numOfCols = pInfo->pRes->info.numOfCols; + for (int32_t i = 0; i < numOfCols; ++i) { + SColumnInfoData* p = taosArrayGet(pCols, i); + SColMatchInfo* pColMatchInfo = taosArrayGet(pInfo->pColMatchInfo, i); + if (!pColMatchInfo->output) { + continue; + } + + ASSERT(pColMatchInfo->colId == p->info.colId); + taosArraySet(pInfo->pRes->pDataBlock, pColMatchInfo->targetSlotId, p); + } + if (pInfo->pRes->pDataBlock == NULL) { // TODO add log pTaskInfo->code = terrno; @@ -5625,8 +5635,18 @@ SOperatorInfo* createStreamScanOperatorInfo(void* streamReadHandle, SSDataBlock* return NULL; } + int32_t numOfOutput = taosArrayGetSize(pColList); + + SArray* pColIds = taosArrayInit(4, sizeof(int16_t)); + for(int32_t i = 0; i < numOfOutput; ++i) { + int16_t* id = taosArrayGet(pColList, i); + taosArrayPush(pColIds, id); + } + + pInfo->pColMatchInfo = pColList; + // set the extract column id to streamHandle - tqReadHandleSetColIdList((STqReadHandle*)streamReadHandle, pColList); + tqReadHandleSetColIdList((STqReadHandle*)streamReadHandle, pColIds); int32_t code = tqReadHandleSetTbUidList(streamReadHandle, pTableIdList); if (code != 0) { taosMemoryFreeClear(pInfo); @@ -6972,7 +6992,7 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo *pOperator, bool* newgroup if (pInfo->binfo.pRes->info.rows == 0 || !hasRemainDataInCurrentGroup(&pInfo->groupResInfo)) { pOperator->status = OP_EXEC_DONE; } - return pInfo->binfo.pRes; + return pInfo->binfo.pRes->info.rows == 0 ? NULL : pInfo->binfo.pRes; } // STimeWindow win = {0}; @@ -8801,8 +8821,10 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo SArray* tableIdList = extractTableIdList(pTableGroupInfo); SSDataBlock* pResBlock = createOutputBuf_rv1(pScanPhyNode->node.pOutputDataBlockDesc); - SArray* colList = extractScanColumnId(pScanPhyNode->pScanCols); - SOperatorInfo* pOperator = createStreamScanOperatorInfo(pHandle->reader, pResBlock, colList, tableIdList, pTaskInfo); + + int32_t numOfCols = 0; + SArray* pColList = extractColMatchInfo(pScanPhyNode->pScanCols, pScanPhyNode->node.pOutputDataBlockDesc, &numOfCols); + SOperatorInfo* pOperator = createStreamScanOperatorInfo(pHandle->reader, pResBlock, pColList, tableIdList, pTaskInfo); taosArrayDestroy(tableIdList); return pOperator; } else if (QUERY_NODE_PHYSICAL_PLAN_SYSTABLE_SCAN == nodeType(pPhyNode)) { diff --git a/source/libs/planner/src/planPhysiCreater.c b/source/libs/planner/src/planPhysiCreater.c index 9ef1c01cd1..c46f98ef55 100644 --- a/source/libs/planner/src/planPhysiCreater.c +++ b/source/libs/planner/src/planPhysiCreater.c @@ -719,6 +719,9 @@ static int32_t createStreamScanPhysiNodeByExchange(SPhysiPlanContext* pCxt, SExc if (NULL == pScan->pScanCols) { code = TSDB_CODE_OUT_OF_MEMORY; } + if (TSDB_CODE_SUCCESS == code) { + code = sortScanCols(pScan->pScanCols); + } if (TSDB_CODE_SUCCESS == code) { code = addDataBlockSlots(pCxt, pScan->pScanCols, pScan->node.pOutputDataBlockDesc); } diff --git a/source/libs/stream/src/tstream.c b/source/libs/stream/src/tstream.c index fb6c0f6c12..5223aa1e3a 100644 --- a/source/libs/stream/src/tstream.c +++ b/source/libs/stream/src/tstream.c @@ -152,6 +152,7 @@ int32_t streamExecTask(SStreamTask* pTask, SMsgCb* pMsgCb, const void* input, in // sink if (pTask->sinkType == TASK_SINK__TABLE) { // + blockDebugShowData(pRes); } else if (pTask->sinkType == TASK_SINK__SMA) { pTask->smaSink.smaHandle(pTask->ahandle, pTask->smaSink.smaId, pRes); // From 70fb71b02a609f6a239af36780dc8238bad9cace Mon Sep 17 00:00:00 2001 From: plum-lihui Date: Wed, 30 Mar 2022 19:52:27 +0800 Subject: [PATCH 33/49] [1ms--->3000ms] --- tests/test/c/tmqSim.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test/c/tmqSim.c b/tests/test/c/tmqSim.c index 4d3108500e..38264331c1 100644 --- a/tests/test/c/tmqSim.c +++ b/tests/test/c/tmqSim.c @@ -226,7 +226,7 @@ void loop_consume(tmq_t* tmq) { int32_t totalRows = 0; int32_t skipLogNum = 0; while (running) { - tmq_message_t* tmqMsg = tmq_consumer_poll(tmq, 1); + tmq_message_t* tmqMsg = tmq_consumer_poll(tmq, 3000); if (tmqMsg) { totalMsgs++; From 7a0deb2dac4e9763d284532a4da29e71c9a1e29b Mon Sep 17 00:00:00 2001 From: Cary Xu Date: Wed, 30 Mar 2022 19:53:31 +0800 Subject: [PATCH 34/49] trigger CI From 79936567c5cc20dda71f43babf7b5c8975237b89 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 30 Mar 2022 19:54:41 +0800 Subject: [PATCH 35/49] shm --- include/os/osShm.h | 5 +- include/util/tprocess.h | 6 +- source/dnode/mgmt/main/exe/dndMain.c | 4 + source/dnode/mgmt/main/src/dndExec.c | 10 +- source/dnode/mgmt/main/src/dndFile.c | 30 +-- source/dnode/mgmt/main/src/dndObj.c | 1 + source/os/src/osShm.c | 25 +- source/util/src/tprocess.c | 372 ++++++++++++--------------- 8 files changed, 204 insertions(+), 249 deletions(-) diff --git a/include/os/osShm.h b/include/os/osShm.h index a5d6716d0d..d26a99e277 100644 --- a/include/os/osShm.h +++ b/include/os/osShm.h @@ -22,14 +22,13 @@ extern "C" { typedef struct { int32_t id; - int64_t size; + int32_t size; void* ptr; } SShm; -int32_t taosCreateShm(SShm *pShm, int64_t shmsize) ; +int32_t taosCreateShm(SShm *pShm, int32_t shmsize) ; void taosDropShm(SShm *pShm); int32_t taosAttachShm(SShm *pShm); -void taosDetachShm(SShm *pShm); #ifdef __cplusplus } diff --git a/include/util/tprocess.h b/include/util/tprocess.h index 090762b340..3a47450eec 100644 --- a/include/util/tprocess.h +++ b/include/util/tprocess.h @@ -38,21 +38,19 @@ typedef struct { ProcMallocFp childMallocBodyFp; ProcFreeFp childFreeBodyFp; ProcConsumeFp parentConsumeFp; - ProcMallocFp parentdMallocHeadFp; + ProcMallocFp parentMallocHeadFp; ProcFreeFp parentFreeHeadFp; ProcMallocFp parentMallocBodyFp; ProcFreeFp parentFreeBodyFp; SShm shm; void *pParent; const char *name; + bool isChild; } SProcCfg; SProcObj *taosProcInit(const SProcCfg *pCfg); void taosProcCleanup(SProcObj *pProc); int32_t taosProcRun(SProcObj *pProc); -void taosProcStop(SProcObj *pProc); -bool taosProcIsChild(SProcObj *pProc); -int32_t taosProcChildId(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, diff --git a/source/dnode/mgmt/main/exe/dndMain.c b/source/dnode/mgmt/main/exe/dndMain.c index 525b26d967..5acab06216 100644 --- a/source/dnode/mgmt/main/exe/dndMain.c +++ b/source/dnode/mgmt/main/exe/dndMain.c @@ -83,6 +83,10 @@ static int32_t dndParseArgs(int32_t argc, char const *argv[]) { global.generateGrant = true; } 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"); + return -1; + } } else if (strcmp(argv[i], "-C") == 0) { global.dumpConfig = true; } else if (strcmp(argv[i], "-V") == 0) { diff --git a/source/dnode/mgmt/main/src/dndExec.c b/source/dnode/mgmt/main/src/dndExec.c index d4dfae2d69..d2a203107a 100644 --- a/source/dnode/mgmt/main/src/dndExec.c +++ b/source/dnode/mgmt/main/src/dndExec.c @@ -166,14 +166,16 @@ static int32_t dndRunInParentProcess(SDnode *pDnode) { .childMallocBodyFp = (ProcMallocFp)rpcMallocCont, .childFreeBodyFp = (ProcFreeFp)rpcFreeCont, .parentConsumeFp = (ProcConsumeFp)dndConsumeParentQueue, - .parentdMallocHeadFp = (ProcMallocFp)taosMemoryMalloc, + .parentMallocHeadFp = (ProcMallocFp)taosMemoryMalloc, .parentFreeHeadFp = (ProcFreeFp)taosMemoryFree, .parentMallocBodyFp = (ProcMallocFp)rpcMallocCont, .parentFreeBodyFp = (ProcFreeFp)rpcFreeCont, .shm = pWrapper->shm, .pParent = pWrapper, + .isChild = false, .name = pWrapper->name}; + pWrapper->procType = PROC_PARENT; pWrapper->pProc = taosProcInit(&cfg); if (pWrapper->pProc == NULL) { dError("node:%s, failed to create proc since %s", pWrapper->name, terrstr()); @@ -193,7 +195,6 @@ static int32_t dndRunInParentProcess(SDnode *pDnode) { dInfo("node:%s, will not start in parent process", pWrapper->name); // exec new node - pWrapper->procType = PROC_PARENT; if (taosProcRun(pWrapper->pProc) != 0) { dError("node:%s, failed to run proc since %s", pWrapper->name, terrstr()); return -1; @@ -226,21 +227,22 @@ static int32_t dndRunInChildProcess(SDnode *pDnode) { .childMallocBodyFp = (ProcMallocFp)rpcMallocCont, .childFreeBodyFp = (ProcFreeFp)rpcFreeCont, .parentConsumeFp = (ProcConsumeFp)dndConsumeParentQueue, - .parentdMallocHeadFp = (ProcMallocFp)taosMemoryMalloc, + .parentMallocHeadFp = (ProcMallocFp)taosMemoryMalloc, .parentFreeHeadFp = (ProcFreeFp)taosMemoryFree, .parentMallocBodyFp = (ProcMallocFp)rpcMallocCont, .parentFreeBodyFp = (ProcFreeFp)rpcFreeCont, .shm = pWrapper->shm, .pParent = pWrapper, + .isChild = true, .name = pWrapper->name}; + pWrapper->procType = PROC_CHILD; pWrapper->pProc = taosProcInit(&cfg); if (pWrapper->pProc == NULL) { dError("node:%s, failed to create proc since %s", pWrapper->name, terrstr()); return -1; } - pWrapper->procType = PROC_CHILD; if (taosProcRun(pWrapper->pProc) != 0) { dError("node:%s, failed to run proc since %s", pWrapper->name, terrstr()); return -1; diff --git a/source/dnode/mgmt/main/src/dndFile.c b/source/dnode/mgmt/main/src/dndFile.c index bcfb90af13..bbd1cd3b92 100644 --- a/source/dnode/mgmt/main/src/dndFile.c +++ b/source/dnode/mgmt/main/src/dndFile.c @@ -167,23 +167,23 @@ int32_t dndReadShmFile(SDnode *pDnode) { for (ENodeType ntype = DNODE + 1; ntype < NODE_MAX; ++ntype) { snprintf(itemName, sizeof(itemName), "%s_shmid", dndNodeProcStr(ntype)); cJSON *shmid = cJSON_GetObjectItem(root, itemName); - if (shmid && shmid->type == cJSON_String) { - pDnode->wrappers[ntype].shm.id = atoi(shmid->valuestring); + if (shmid && shmid->type == cJSON_Number) { + pDnode->wrappers[ntype].shm.id = shmid->valueint; } snprintf(itemName, sizeof(itemName), "%s_shmsize", dndNodeProcStr(ntype)); cJSON *shmsize = cJSON_GetObjectItem(root, itemName); - if (shmsize && shmsize->type == cJSON_String) { - pDnode->wrappers[ntype].shm.size = atoll(shmsize->valuestring); + if (shmsize && shmsize->type == cJSON_Number) { + pDnode->wrappers[ntype].shm.size = shmsize->valueint; } } } - if (tsMultiProcess || pDnode->ntype == DNODE) { + if (!tsMultiProcess || pDnode->ntype == DNODE) { for (ENodeType ntype = DNODE; ntype < NODE_MAX; ++ntype) { - SMgmtWrapper *pWrapper = &pDnode->wrappers[pDnode->ntype]; - if (pWrapper->shm.id > 0) { - dDebug("shmid:%d, is closed, size:%" PRId64, pWrapper->shm.id, pWrapper->shm.size); + SMgmtWrapper *pWrapper = &pDnode->wrappers[ntype]; + if (pWrapper->shm.id >= 0) { + dDebug("shmid:%d, is closed, size:%d", pWrapper->shm.id, pWrapper->shm.size); taosDropShm(&pWrapper->shm); } } @@ -194,7 +194,7 @@ int32_t dndReadShmFile(SDnode *pDnode) { dError("shmid:%d, failed to attach since %s", pWrapper->shm.id, terrstr()); goto _OVER; } - dDebug("shmid:%d, is attached, size:%" PRId64, pWrapper->shm.id, pWrapper->shm.size); + dDebug("shmid:%d, is attached, size:%d", pWrapper->shm.id, pWrapper->shm.size); } dDebug("successed to open %s", file); @@ -227,14 +227,12 @@ int32_t dndWriteShmFile(SDnode *pDnode) { len += snprintf(content + len, MAXLEN - len, "{\n"); for (ENodeType ntype = DNODE + 1; ntype < NODE_MAX; ++ntype) { - SMgmtWrapper *pWrapper = &pDnode->wrappers[pDnode->ntype]; - len += snprintf(content + len, MAXLEN - len, " \"%s_shmid\": \"%d\",\n", dndNodeProcStr(ntype), pWrapper->shm.id); + SMgmtWrapper *pWrapper = &pDnode->wrappers[ntype]; + len += snprintf(content + len, MAXLEN - len, " \"%s_shmid\":%d,\n", dndNodeProcStr(ntype), pWrapper->shm.id); if (ntype == NODE_MAX - 1) { - len += snprintf(content + len, MAXLEN - len, " \"%s_shmsize\": \"%" PRId64 "\"\n", dndNodeProcStr(ntype), - pWrapper->shm.size); + len += snprintf(content + len, MAXLEN - len, " \"%s_shmsize\":%d\n", dndNodeProcStr(ntype), pWrapper->shm.size); } else { - len += snprintf(content + len, MAXLEN - len, " \"%s_shmsize\": \"%" PRId64 "\",\n", dndNodeProcStr(ntype), - pWrapper->shm.size); + len += snprintf(content + len, MAXLEN - len, " \"%s_shmsize\":%d,\n", dndNodeProcStr(ntype), pWrapper->shm.size); } } len += snprintf(content + len, MAXLEN - len, "}\n"); @@ -259,7 +257,7 @@ int32_t dndWriteShmFile(SDnode *pDnode) { return -1; } - dDebug("successed to write %s", realfile); + dInfo("successed to write %s", realfile); code = 0; _OVER: diff --git a/source/dnode/mgmt/main/src/dndObj.c b/source/dnode/mgmt/main/src/dndObj.c index 91f2cb233b..387efca846 100644 --- a/source/dnode/mgmt/main/src/dndObj.c +++ b/source/dnode/mgmt/main/src/dndObj.c @@ -91,6 +91,7 @@ SDnode *dndCreate(const SDnodeOpt *pOption) { SMgmtWrapper *pWrapper = &pDnode->wrappers[n]; snprintf(path, sizeof(path), "%s%s%s", pDnode->dataDir, TD_DIRSEP, pWrapper->name); pWrapper->path = strdup(path); + pWrapper->shm.id = -1; pWrapper->pDnode = pDnode; if (pWrapper->path == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; diff --git a/source/os/src/osShm.c b/source/os/src/osShm.c index cb80aeb5f3..74717878a0 100644 --- a/source/os/src/osShm.c +++ b/source/os/src/osShm.c @@ -17,8 +17,10 @@ #define _DEFAULT_SOURCE #include "os.h" -int32_t taosCreateShm(SShm* pShm, int64_t shmsize) { - int32_t shmid = shmget(IPC_PRIVATE, (size_t)shmsize, IPC_CREAT | 0600); +int32_t taosCreateShm(SShm* pShm, int32_t shmsize) { + pShm->id = -1; + + int32_t shmid = shmget(0X95279527, shmsize, IPC_CREAT | 0600); if (shmid < 0) { return -1; } @@ -35,19 +37,19 @@ int32_t taosCreateShm(SShm* pShm, int64_t shmsize) { } void taosDropShm(SShm* pShm) { - if (pShm->id > 0) { + if (pShm->id >= 0) { if (pShm->ptr != NULL) { shmdt(pShm->ptr); } shmctl(pShm->id, IPC_RMID, NULL); } - pShm->id = 0; + pShm->id = -1; pShm->size = 0; pShm->ptr = NULL; } int32_t taosAttachShm(SShm* pShm) { - if (pShm->id > 0 && pShm->size > 0) { + if (pShm->id >= 0) { pShm->ptr = shmat(pShm->id, NULL, 0); if (pShm->ptr != NULL) { return 0; @@ -56,16 +58,3 @@ int32_t taosAttachShm(SShm* pShm) { return -1; } - -void taosDetachShm(SShm* pShm) { - if (pShm->id > 0) { - if (pShm->ptr != NULL) { - shmdt(pShm->ptr); - pShm->ptr = NULL; - } - } - - pShm->id = 0; - pShm->size = 0; - pShm->ptr = NULL; -} diff --git a/source/util/src/tprocess.c b/source/util/src/tprocess.c index 7afbe56587..1d565083e1 100644 --- a/source/util/src/tprocess.c +++ b/source/util/src/tprocess.c @@ -23,34 +23,36 @@ typedef void *(*ProcThreadFp)(void *param); typedef struct SProcQueue { - int32_t head; - int32_t tail; - int32_t total; - int32_t avail; - int32_t items; - char *pBuffer; - ProcMallocFp mallocHeadFp; - ProcFreeFp freeHeadFp; - ProcMallocFp mallocBodyFp; - ProcFreeFp freeBodyFp; - ProcConsumeFp consumeFp; - void *pParent; - tsem_t sem; - TdThreadMutex *mutex; - int32_t mutexShmid; - int32_t bufferShmid; - const char *name; + int32_t head; + int32_t tail; + int32_t total; + int32_t avail; + int32_t items; + char name[8]; + TdThreadMutex mutex; + tsem_t sem; + char pBuffer[]; } SProcQueue; typedef struct SProcObj { - TdThread childThread; - SProcQueue *pChildQueue; - TdThread parentThread; - SProcQueue *pParentQueue; - const char *name; - int32_t pid; - bool isChild; - bool stopFlag; + TdThread thread; + SProcQueue *pChildQueue; + SProcQueue *pParentQueue; + ProcConsumeFp childConsumeFp; + ProcMallocFp childMallocHeadFp; + ProcFreeFp childFreeHeadFp; + ProcMallocFp childMallocBodyFp; + ProcFreeFp childFreeBodyFp; + ProcConsumeFp parentConsumeFp; + ProcMallocFp parentMallocHeadFp; + ProcFreeFp parentFreeHeadFp; + ProcMallocFp parentMallocBodyFp; + ProcFreeFp parentFreeBodyFp; + void *pParent; + const char *name; + int32_t pid; + bool isChild; + bool stopFlag; } SProcObj; static inline int32_t CEIL8(int32_t v) { @@ -58,150 +60,95 @@ static inline int32_t CEIL8(int32_t v) { return c < 8 ? 8 : c; } -static int32_t taosProcInitMutex(TdThreadMutex **ppMutex, int32_t *pShmid) { - TdThreadMutex *pMutex = NULL; +static int32_t taosProcInitMutex(SProcQueue *pQueue) { TdThreadMutexAttr mattr = {0}; - int32_t shmid = -1; - int32_t code = -1; if (pthread_mutexattr_init(&mattr) != 0) { terrno = TAOS_SYSTEM_ERROR(errno); uError("failed to init mutex while init attr since %s", terrstr()); - goto _OVER; + return -1; } if (pthread_mutexattr_setpshared(&mattr, PTHREAD_PROCESS_SHARED) != 0) { + pthread_mutexattr_destroy(&mattr); terrno = TAOS_SYSTEM_ERROR(errno); uError("failed to init mutex while set shared since %s", terrstr()); - goto _OVER; + return -1; } - shmid = shmget(IPC_PRIVATE, sizeof(TdThreadMutex), IPC_CREAT | 0600); - if (shmid <= 0) { - terrno = TAOS_SYSTEM_ERROR(errno); - uError("failed to init mutex while shmget since %s", terrstr()); - goto _OVER; - } - - pMutex = (TdThreadMutex *)shmat(shmid, NULL, 0); - if (pMutex == NULL) { - terrno = TAOS_SYSTEM_ERROR(errno); - uError("failed to init mutex while shmat since %s", terrstr()); - goto _OVER; - } - - if (taosThreadMutexInit(pMutex, &mattr) != 0) { + if (taosThreadMutexInit(&pQueue->mutex, &mattr) != 0) { + pthread_mutexattr_destroy(&mattr); terrno = TAOS_SYSTEM_ERROR(errno); uError("failed to init mutex since %s", terrstr()); - goto _OVER; - } - - code = 0; - -_OVER: - if (code != 0) { - if (pMutex != NULL) { - taosThreadMutexDestroy(pMutex); - shmdt(pMutex); - } - if (shmid >= 0) { - shmctl(shmid, IPC_RMID, NULL); - } - } else { - *ppMutex = pMutex; - *pShmid = shmid; + return -1; } pthread_mutexattr_destroy(&mattr); - return code; + return 0; } -static void taosProcDestroyMutex(TdThreadMutex *pMutex, int32_t shmid) { - if (pMutex != NULL) { - taosThreadMutexDestroy(pMutex); - } - if (shmid >= 0) { - shmctl(shmid, IPC_RMID, NULL); - } -} - -static int32_t taosProcInitBuffer(void **ppBuffer, int32_t size) { - int32_t shmid = shmget(IPC_PRIVATE, size, IPC_CREAT | 0600); - if (shmid <= 0) { - terrno = TAOS_SYSTEM_ERROR(errno); - uError("failed to init buffer while shmget since %s", terrstr()); - return -1; - } - - void *shmptr = shmat(shmid, NULL, 0); - if (shmptr == NULL) { - terrno = TAOS_SYSTEM_ERROR(errno); - uError("failed to init buffer while shmat since %s", terrstr()); - shmctl(shmid, IPC_RMID, NULL); - return -1; - } - - *ppBuffer = shmptr; - return shmid; -} - -static void taosProcDestroyBuffer(void *pBuffer, int32_t shmid) { - if (shmid > 0) { - shmdt(pBuffer); - shmctl(shmid, IPC_RMID, NULL); - } -} - -static SProcQueue *taosProcInitQueue(int32_t size) { - if (size <= 0) size = SHM_DEFAULT_SIZE; - - int32_t bufSize = CEIL8(size); - int32_t headSize = CEIL8(sizeof(SProcQueue)); - - SProcQueue *pQueue = NULL; - int32_t shmId = taosProcInitBuffer((void **)&pQueue, bufSize + headSize); - if (shmId < 0) { - terrno = TSDB_CODE_OUT_OF_MEMORY; - return NULL; - } - pQueue->bufferShmid = shmId; - - if (taosProcInitMutex(&pQueue->mutex, &pQueue->mutexShmid) != 0) { - taosProcDestroyBuffer(pQueue, pQueue->bufferShmid); - return NULL; - } - +static int32_t taosProcInitSem(SProcQueue *pQueue) { if (tsem_init(&pQueue->sem, 1, 0) != 0) { - taosProcDestroyMutex(pQueue->mutex, pQueue->mutexShmid); - taosProcDestroyBuffer(pQueue, pQueue->bufferShmid); + terrno = TAOS_SYSTEM_ERROR(errno); + uError("failed to init sem"); + return -1; + } + + return 0; +} + +static SProcQueue *taosProcInitQueue(const char *name, bool isChild, char *ptr, int32_t size) { + int32_t bufSize = size - CEIL8(sizeof(SProcQueue)); + if (bufSize <= 1024) { terrno = TSDB_CODE_OUT_OF_MEMORY; return NULL; } - if (taosProcInitMutex(&pQueue->mutex, &pQueue->mutexShmid) != 0) { - tsem_destroy(&pQueue->sem); - taosProcDestroyMutex(pQueue->mutex, pQueue->mutexShmid); - taosProcDestroyBuffer(pQueue, pQueue->bufferShmid); - return NULL; + SProcQueue *pQueue = (SProcQueue *)(ptr); + + if (!isChild) { + if (taosProcInitMutex(pQueue) != 0) { + return NULL; + } + + if (taosProcInitSem(pQueue) != 0) { + return NULL; + } + + tstrncpy(pQueue->name, name, sizeof(pQueue->name)); + pQueue->head = 0; + pQueue->tail = 0; + pQueue->total = bufSize; + pQueue->avail = bufSize; + pQueue->items = 0; } - pQueue->head = 0; - pQueue->tail = 0; - pQueue->total = bufSize; - pQueue->avail = bufSize; - pQueue->items = 0; - pQueue->pBuffer = (char *)pQueue + headSize; return pQueue; } +#if 0 +static void taosProcDestroyMutex(SProcQueue *pQueue) { + if (pQueue->mutex != NULL) { + taosThreadMutexDestroy(pQueue->mutex); + pQueue->mutex = NULL; + } +} + +static void taosProcDestroySem(SProcQueue *pQueue) { + if (pQueue->sem != NULL) { + tsem_destroy(pQueue->sem); + pQueue->sem = NULL; + } + +} + static void taosProcCleanupQueue(SProcQueue *pQueue) { if (pQueue != NULL) { - uDebug("proc:%s, queue:%p clean up", pQueue->name, pQueue); - tsem_destroy(&pQueue->sem); - taosProcDestroyMutex(pQueue->mutex, pQueue->mutexShmid); - taosProcDestroyBuffer(pQueue, pQueue->bufferShmid); + taosProcDestroyMutex(pQueue); + taosProcDestroySem(pQueue); } } +#endif static int32_t taosProcQueuePush(SProcQueue *pQueue, const char *pHead, int16_t rawHeadLen, const char *pBody, int32_t rawBodyLen, ProcFuncType ftype) { @@ -209,9 +156,9 @@ static int32_t taosProcQueuePush(SProcQueue *pQueue, const char *pHead, int16_t const int32_t bodyLen = CEIL8(rawBodyLen); const int32_t fullLen = headLen + bodyLen + 8; - taosThreadMutexLock(pQueue->mutex); + taosThreadMutexLock(&pQueue->mutex); if (fullLen > pQueue->avail) { - taosThreadMutexUnlock(pQueue->mutex); + taosThreadMutexUnlock(&pQueue->mutex); terrno = TSDB_CODE_OUT_OF_SHM_MEM; return -1; } @@ -260,7 +207,7 @@ static int32_t taosProcQueuePush(SProcQueue *pQueue, const char *pHead, int16_t pQueue->avail -= fullLen; pQueue->items++; - taosThreadMutexUnlock(pQueue->mutex); + taosThreadMutexUnlock(&pQueue->mutex); tsem_post(&pQueue->sem); uTrace("proc:%s, push msg at pos:%d ftype:%d remain:%d, head:%d %p body:%d %p", pQueue->name, pos, ftype, @@ -268,13 +215,14 @@ static int32_t taosProcQueuePush(SProcQueue *pQueue, const char *pHead, int16_t return 0; } -static int32_t taosProcQueuePop(SProcQueue *pQueue, void **ppHead, int16_t *pHeadLen, void **ppBody, - int32_t *pBodyLen, ProcFuncType *pFuncType) { +static int32_t taosProcQueuePop(SProcQueue *pQueue, void **ppHead, int16_t *pHeadLen, void **ppBody, int32_t *pBodyLen, + ProcFuncType *pFuncType, ProcMallocFp mallocHeadFp, ProcFreeFp freeHeadFp, + ProcMallocFp mallocBodyFp, ProcFreeFp freeBodyFp) { tsem_wait(&pQueue->sem); - taosThreadMutexLock(pQueue->mutex); + taosThreadMutexLock(&pQueue->mutex); if (pQueue->total - pQueue->avail <= 0) { - taosThreadMutexUnlock(pQueue->mutex); + taosThreadMutexUnlock(&pQueue->mutex); tsem_post(&pQueue->sem); terrno = TSDB_CODE_OUT_OF_SHM_MEM; return 0; @@ -293,13 +241,13 @@ static int32_t taosProcQueuePop(SProcQueue *pQueue, void **ppHead, int16_t *pHea bodyLen = *(int32_t *)(pQueue->pBuffer + 4); } - void *pHead = (*pQueue->mallocHeadFp)(headLen); - void *pBody = (*pQueue->mallocBodyFp)(bodyLen); + void *pHead = (*mallocHeadFp)(headLen); + void *pBody = (*mallocBodyFp)(bodyLen); if (pHead == NULL || pBody == NULL) { - taosThreadMutexUnlock(pQueue->mutex); + taosThreadMutexUnlock(&pQueue->mutex); tsem_post(&pQueue->sem); - (*pQueue->freeHeadFp)(pHead); - (*pQueue->freeBodyFp)(pBody); + (*freeHeadFp)(pHead); + (*freeBodyFp)(pBody); terrno = TSDB_CODE_OUT_OF_MEMORY; return -1; } @@ -338,7 +286,7 @@ static int32_t taosProcQueuePop(SProcQueue *pQueue, void **ppHead, int16_t *pHea pQueue->avail = pQueue->avail + headLen + bodyLen + 8; pQueue->items--; - taosThreadMutexUnlock(pQueue->mutex); + taosThreadMutexUnlock(&pQueue->mutex); *ppHead = pHead; *ppBody = pBody; @@ -358,65 +306,85 @@ SProcObj *taosProcInit(const SProcCfg *pCfg) { return NULL; } + int32_t cstart = 0; + int32_t csize = CEIL8(pCfg->shm.size / 2); + int32_t pstart = csize; + int32_t psize = CEIL8(pCfg->shm.size - pstart); + if (pstart + psize > pCfg->shm.size) { + psize -= 8; + } + pProc->name = pCfg->name; - pProc->pChildQueue = taosProcInitQueue(pCfg->shm.size / 2); - pProc->pParentQueue = taosProcInitQueue(pCfg->shm.size / 2); + pProc->pChildQueue = taosProcInitQueue(pCfg->name, pCfg->isChild, (char *)pCfg->shm.ptr + cstart, csize); + pProc->pParentQueue = taosProcInitQueue(pCfg->name, pCfg->isChild, (char *)pCfg->shm.ptr + pstart, psize); if (pProc->pChildQueue == NULL || pProc->pParentQueue == NULL) { taosProcCleanupQueue(pProc->pChildQueue); taosMemoryFree(pProc); return NULL; } - pProc->pChildQueue->name = pCfg->name; - pProc->pChildQueue->pParent = pCfg->pParent; - pProc->pChildQueue->mallocHeadFp = pCfg->childMallocHeadFp; - pProc->pChildQueue->freeHeadFp = pCfg->childFreeHeadFp; - pProc->pChildQueue->mallocBodyFp = pCfg->childMallocBodyFp; - pProc->pChildQueue->freeBodyFp = pCfg->childFreeBodyFp; - pProc->pChildQueue->consumeFp = pCfg->childConsumeFp; - pProc->pParentQueue->name = pCfg->name; - pProc->pParentQueue->pParent = pCfg->pParent; - pProc->pParentQueue->mallocHeadFp = pCfg->parentdMallocHeadFp; - pProc->pParentQueue->freeHeadFp = pCfg->parentFreeHeadFp; - pProc->pParentQueue->mallocBodyFp = pCfg->parentMallocBodyFp; - pProc->pParentQueue->freeBodyFp = pCfg->parentFreeBodyFp; - pProc->pParentQueue->consumeFp = pCfg->parentConsumeFp; + pProc->name = pCfg->name; + pProc->pParent = pCfg->pParent; + pProc->childMallocHeadFp = pCfg->childMallocHeadFp; + pProc->childFreeHeadFp = pCfg->childFreeHeadFp; + pProc->childMallocBodyFp = pCfg->childMallocBodyFp; + pProc->childFreeBodyFp = pCfg->childFreeBodyFp; + pProc->childConsumeFp = pCfg->childConsumeFp; + pProc->parentMallocHeadFp = pCfg->parentMallocHeadFp; + pProc->parentFreeHeadFp = pCfg->parentFreeHeadFp; + pProc->parentMallocBodyFp = pCfg->parentMallocBodyFp; + pProc->parentFreeBodyFp = pCfg->parentFreeBodyFp; + pProc->parentConsumeFp = pCfg->parentConsumeFp; + pProc->isChild = pCfg->isChild; - uDebug("proc:%s, is initialized, child queue:%p parent queue:%p", pProc->name, pProc->pChildQueue, pProc->pParentQueue); - - pProc->pid = fork(); - if (pProc->pid == 0) { - pProc->isChild = 1; - prctl(PR_SET_NAME, pProc->name, NULL, NULL, NULL); - } else { - pProc->isChild = 0; - uInfo("this is parent process, child pid:%d", pProc->pid); - } + uDebug("proc:%s, is initialized, child:%d child queue:%p parent queue:%p", pProc->name, pProc->isChild, + pProc->pChildQueue, pProc->pParentQueue); return pProc; } -static void taosProcThreadLoop(SProcQueue *pQueue) { - ProcConsumeFp consumeFp = pQueue->consumeFp; - void *pParent = pQueue->pParent; +static void taosProcThreadLoop(SProcObj *pProc) { void *pHead, *pBody; int16_t headLen; ProcFuncType ftype; int32_t bodyLen; + SProcQueue *pQueue; + ProcConsumeFp consumeFp; + ProcMallocFp mallocHeadFp; + ProcFreeFp freeHeadFp; + ProcMallocFp mallocBodyFp; + ProcFreeFp freeBodyFp; - uDebug("proc:%s, start to get msg from queue:%p", pQueue->name, pQueue); + if (pProc->isChild) { + pQueue = pProc->pChildQueue; + consumeFp = pProc->childConsumeFp; + mallocHeadFp = pProc->childMallocHeadFp; + freeHeadFp = pProc->childFreeHeadFp; + mallocBodyFp = pProc->childMallocBodyFp; + freeBodyFp = pProc->childFreeBodyFp; + } else { + pQueue = pProc->pParentQueue; + consumeFp = pProc->parentConsumeFp; + mallocHeadFp = pProc->parentMallocHeadFp; + freeHeadFp = pProc->parentFreeHeadFp; + mallocBodyFp = pProc->parentMallocBodyFp; + freeBodyFp = pProc->parentFreeBodyFp; + } + + uDebug("proc:%s, start to get msg from queue:%p", pProc->name, pQueue); while (1) { - int32_t numOfMsgs = taosProcQueuePop(pQueue, &pHead, &headLen, &pBody, &bodyLen, &ftype); + int32_t numOfMsgs = taosProcQueuePop(pQueue, &pHead, &headLen, &pBody, &bodyLen, &ftype, mallocHeadFp, freeHeadFp, + mallocBodyFp, freeBodyFp); if (numOfMsgs == 0) { - uDebug("proc:%s, get no msg from queue:%p and exit the proc thread", pQueue->name, pQueue); + uInfo("proc:%s, get no msg from queue:%p and exit the proc thread", pProc->name, pQueue); break; } else if (numOfMsgs < 0) { - uTrace("proc:%s, get no msg from queue:%p since %s", pQueue->name, pQueue, terrstr()); + uTrace("proc:%s, get no msg from queue:%p since %s", pProc->name, pQueue, terrstr()); taosMsleep(1); continue; } else { - (*consumeFp)(pParent, pHead, headLen, pBody, bodyLen, ftype); + (*consumeFp)(pProc->pParent, pHead, headLen, pBody, bodyLen, ftype); } } } @@ -426,34 +394,30 @@ int32_t taosProcRun(SProcObj *pProc) { taosThreadAttrInit(&thAttr); taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_JOINABLE); - if (pProc->isChild) { - if (taosThreadCreate(&pProc->childThread, &thAttr, (ProcThreadFp)taosProcThreadLoop, pProc->pChildQueue) != 0) { - terrno = TAOS_SYSTEM_ERROR(errno); - uError("failed to create thread since %s", terrstr()); - return -1; - } - uDebug("proc:%s, child start to consume queue:%p", pProc->name, pProc->pChildQueue); - } else { - if (taosThreadCreate(&pProc->parentThread, &thAttr, (ProcThreadFp)taosProcThreadLoop, pProc->pParentQueue) != 0) { - terrno = TAOS_SYSTEM_ERROR(errno); - uError("failed to create thread since %s", terrstr()); - return -1; - } - uDebug("proc:%s, parent start to consume queue:%p", pProc->name, pProc->pParentQueue); + if (taosThreadCreate(&pProc->thread, &thAttr, (ProcThreadFp)taosProcThreadLoop, pProc) != 0) { + terrno = TAOS_SYSTEM_ERROR(errno); + uError("failed to create thread since %s", terrstr()); + return -1; } + uDebug("proc:%s, start to consume queue:%p", pProc->name, pProc->pChildQueue); return 0; } -void taosProcStop(SProcObj *pProc) { - pProc->stopFlag = true; - // todo join +static void taosProcStop(SProcObj *pProc) { + if (!taosCheckPthreadValid(pProc->thread)) return; + + uDebug("proc:%s, start to join thread", pProc->name); + SProcQueue *pQueue; + if (pProc->isChild) { + pQueue = pProc->pParentQueue; + } else { + pQueue = pProc->pChildQueue; + } + tsem_post(&pQueue->sem); + taosThreadJoin(pProc->thread, NULL); } -bool taosProcIsChild(SProcObj *pProc) { return pProc->isChild; } - -int32_t taosProcChildId(SProcObj *pProc) { return pProc->pid; } - void taosProcCleanup(SProcObj *pProc) { if (pProc != NULL) { uDebug("proc:%s, clean up", pProc->name); From b168766ff2ff4a3c4a3f17ff40a26cc49ffbc16f Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 30 Mar 2022 20:32:01 +0800 Subject: [PATCH 36/49] shm --- include/util/taoserror.h | 1 + source/dnode/mgmt/main/src/dndFile.c | 2 +- source/dnode/mgmt/main/src/dndObj.c | 8 +++++--- source/os/src/osShm.c | 13 ++++++------- source/util/src/terror.c | 2 +- 5 files changed, 14 insertions(+), 12 deletions(-) diff --git a/include/util/taoserror.h b/include/util/taoserror.h index d49e83b012..27145afc3d 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -78,6 +78,7 @@ int32_t* taosGetErrno(); #define TSDB_CODE_CFG_NOT_FOUND TAOS_DEF_ERROR_CODE(0, 0x010C) #define TSDB_CODE_INVALID_CFG TAOS_DEF_ERROR_CODE(0, 0x010D) #define TSDB_CODE_OUT_OF_SHM_MEM TAOS_DEF_ERROR_CODE(0, 0x010E) +#define TSDB_CODE_INVALID_SHM_ID TAOS_DEF_ERROR_CODE(0, 0x010F) #define TSDB_CODE_REF_NO_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0110) #define TSDB_CODE_REF_FULL TAOS_DEF_ERROR_CODE(0, 0x0111) #define TSDB_CODE_REF_ID_REMOVED TAOS_DEF_ERROR_CODE(0, 0x0112) diff --git a/source/dnode/mgmt/main/src/dndFile.c b/source/dnode/mgmt/main/src/dndFile.c index bbd1cd3b92..edd5b75d97 100644 --- a/source/dnode/mgmt/main/src/dndFile.c +++ b/source/dnode/mgmt/main/src/dndFile.c @@ -191,7 +191,7 @@ int32_t dndReadShmFile(SDnode *pDnode) { SMgmtWrapper *pWrapper = &pDnode->wrappers[pDnode->ntype]; if (taosAttachShm(&pWrapper->shm) != 0) { terrno = TAOS_SYSTEM_ERROR(errno); - dError("shmid:%d, failed to attach since %s", pWrapper->shm.id, terrstr()); + dError("shmid:%d, failed to attach shm since %s", pWrapper->shm.id, terrstr()); goto _OVER; } dDebug("shmid:%d, is attached, size:%d", pWrapper->shm.id, pWrapper->shm.size); diff --git a/source/dnode/mgmt/main/src/dndObj.c b/source/dnode/mgmt/main/src/dndObj.c index 387efca846..cd0ef4879b 100644 --- a/source/dnode/mgmt/main/src/dndObj.c +++ b/source/dnode/mgmt/main/src/dndObj.c @@ -35,9 +35,11 @@ static int32_t dndInitVars(SDnode *pDnode, const SDnodeOpt *pOption) { return -1; } - pDnode->lockfile = dndCheckRunning(pDnode->dataDir); - if (pDnode->lockfile == NULL) { - return -1; + if (!tsMultiProcess || pDnode->ntype == DNODE) { + pDnode->lockfile = dndCheckRunning(pDnode->dataDir); + if (pDnode->lockfile == NULL) { + return -1; + } } return 0; diff --git a/source/os/src/osShm.c b/source/os/src/osShm.c index 74717878a0..ba184c1f5d 100644 --- a/source/os/src/osShm.c +++ b/source/os/src/osShm.c @@ -49,12 +49,11 @@ void taosDropShm(SShm* pShm) { } int32_t taosAttachShm(SShm* pShm) { - if (pShm->id >= 0) { - pShm->ptr = shmat(pShm->id, NULL, 0); - if (pShm->ptr != NULL) { - return 0; - } - } + errno = 0; - return -1; + void* ptr = shmat(pShm->id, NULL, 0); + if (errno == 0) { + pShm->ptr = ptr; + } + return errno; } diff --git a/source/util/src/terror.c b/source/util/src/terror.c index 005995c8e2..90fa624a8d 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -85,7 +85,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_REPEAT_INIT, "Repeat initialization TAOS_DEFINE_ERROR(TSDB_CODE_CFG_NOT_FOUND, "Config not found") TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_CFG, "Invalid config option") TAOS_DEFINE_ERROR(TSDB_CODE_OUT_OF_SHM_MEM, "Out of Share memory") - +TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_SHM_ID, "Invalid SHM ID") TAOS_DEFINE_ERROR(TSDB_CODE_REF_NO_MEMORY, "Ref out of memory") TAOS_DEFINE_ERROR(TSDB_CODE_REF_FULL, "too many Ref Objs") TAOS_DEFINE_ERROR(TSDB_CODE_REF_ID_REMOVED, "Ref ID is removed") From afad08d106d9c41c529bf8218da7b069743ff886 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 30 Mar 2022 20:45:30 +0800 Subject: [PATCH 37/49] shm --- source/dnode/mgmt/main/inc/dnd.h | 4 ++-- source/dnode/mgmt/main/src/dndExec.c | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/source/dnode/mgmt/main/inc/dnd.h b/source/dnode/mgmt/main/inc/dnd.h index 294413a54d..1ce2293799 100644 --- a/source/dnode/mgmt/main/inc/dnd.h +++ b/source/dnode/mgmt/main/inc/dnd.h @@ -99,9 +99,9 @@ typedef struct SMgmtWrapper { SShm shm; void *pMgmt; SDnode *pDnode; - NodeMsgFp msgFps[TDMT_MAX]; - int8_t msgVgIds[TDMT_MAX]; // Handle the case where the same message type is distributed to qnode or vnode SMgmtFp fp; + int8_t msgVgIds[TDMT_MAX]; // Handle the case where the same message type is distributed to qnode or vnode + NodeMsgFp msgFps[TDMT_MAX]; } SMgmtWrapper; typedef struct { diff --git a/source/dnode/mgmt/main/src/dndExec.c b/source/dnode/mgmt/main/src/dndExec.c index d2a203107a..10e1685153 100644 --- a/source/dnode/mgmt/main/src/dndExec.c +++ b/source/dnode/mgmt/main/src/dndExec.c @@ -214,8 +214,12 @@ static int32_t dndRunInParentProcess(SDnode *pDnode) { static int32_t dndRunInChildProcess(SDnode *pDnode) { dInfo("dnode start to run in child process"); - SMgmtWrapper *pWrapper = &pDnode->wrappers[pDnode->ntype]; + + SMsgCb msgCb = dndCreateMsgcb(pWrapper); + tmsgSetDefaultMsgCb(&msgCb); + pWrapper->procType = PROC_CHILD; + if (dndOpenNode(pWrapper) != 0) { dError("node:%s, failed to start since %s", pWrapper->name, terrstr()); return -1; @@ -236,13 +240,19 @@ static int32_t dndRunInChildProcess(SDnode *pDnode) { .isChild = true, .name = pWrapper->name}; - pWrapper->procType = PROC_CHILD; pWrapper->pProc = taosProcInit(&cfg); if (pWrapper->pProc == NULL) { dError("node:%s, failed to create proc since %s", pWrapper->name, terrstr()); return -1; } + if (pWrapper->fp.startFp != NULL) { + if ((*pWrapper->fp.startFp)(pWrapper) != 0) { + dError("node:%s, failed to start since %s", pWrapper->name, terrstr()); + return -1; + } + } + if (taosProcRun(pWrapper->pProc) != 0) { dError("node:%s, failed to run proc since %s", pWrapper->name, terrstr()); return -1; From 68da160004ed23eaad7c309618c2c017582751da Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 30 Mar 2022 20:51:34 +0800 Subject: [PATCH 38/49] shm --- source/dnode/mgmt/main/exe/dndMain.c | 2 -- source/dnode/mgmt/main/src/dndExec.c | 9 ++++++--- source/dnode/mgmt/main/src/dndFile.c | 2 +- source/dnode/mgmt/main/src/dndObj.c | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/source/dnode/mgmt/main/exe/dndMain.c b/source/dnode/mgmt/main/exe/dndMain.c index 5acab06216..ca89c7cc1a 100644 --- a/source/dnode/mgmt/main/exe/dndMain.c +++ b/source/dnode/mgmt/main/exe/dndMain.c @@ -52,11 +52,9 @@ static void dndSetSignalHandle() { if (!tsMultiProcess) { // Set the single process signal } else if (global.ntype == DNODE) { - // Set the parent process signal // When the child process exits, the parent process receives a signal taosSetSignal(SIGCHLD, dndHandleChild); } else { - // Set child process signal // When the parent process exits, the child process will receive the SIGKILL signal prctl(PR_SET_PDEATHSIG, SIGKILL); } diff --git a/source/dnode/mgmt/main/src/dndExec.c b/source/dnode/mgmt/main/src/dndExec.c index 10e1685153..c2a075cfc0 100644 --- a/source/dnode/mgmt/main/src/dndExec.c +++ b/source/dnode/mgmt/main/src/dndExec.c @@ -192,8 +192,11 @@ static int32_t dndRunInParentProcess(SDnode *pDnode) { SMgmtWrapper *pWrapper = &pDnode->wrappers[n]; if (!pWrapper->required) continue; - dInfo("node:%s, will not start in parent process", pWrapper->name); - // exec new node + if (pDnode->ntype == NODE_MAX) { + dInfo("node:%s, will be started manually", pWrapper->name); + } else { + dInfo("node:%s, will pull up the child process through exec", pWrapper->name); + } if (taosProcRun(pWrapper->pProc) != 0) { dError("node:%s, failed to run proc since %s", pWrapper->name, terrstr()); @@ -268,7 +271,7 @@ int32_t dndRun(SDnode * pDnode) { dError("failed to run dnode since %s", terrstr()); return -1; } - } else if (pDnode->ntype == DNODE) { + } else if (pDnode->ntype == DNODE || pDnode->ntype == NODE_MAX) { if (dndRunInParentProcess(pDnode) != 0) { dError("failed to run dnode in parent process since %s", terrstr()); return -1; diff --git a/source/dnode/mgmt/main/src/dndFile.c b/source/dnode/mgmt/main/src/dndFile.c index edd5b75d97..0214cf33d4 100644 --- a/source/dnode/mgmt/main/src/dndFile.c +++ b/source/dnode/mgmt/main/src/dndFile.c @@ -179,7 +179,7 @@ int32_t dndReadShmFile(SDnode *pDnode) { } } - if (!tsMultiProcess || pDnode->ntype == DNODE) { + if (!tsMultiProcess || pDnode->ntype == DNODE || pDnode->ntype == DNODE) { for (ENodeType ntype = DNODE; ntype < NODE_MAX; ++ntype) { SMgmtWrapper *pWrapper = &pDnode->wrappers[ntype]; if (pWrapper->shm.id >= 0) { diff --git a/source/dnode/mgmt/main/src/dndObj.c b/source/dnode/mgmt/main/src/dndObj.c index cd0ef4879b..44013deed8 100644 --- a/source/dnode/mgmt/main/src/dndObj.c +++ b/source/dnode/mgmt/main/src/dndObj.c @@ -35,7 +35,7 @@ static int32_t dndInitVars(SDnode *pDnode, const SDnodeOpt *pOption) { return -1; } - if (!tsMultiProcess || pDnode->ntype == DNODE) { + if (!tsMultiProcess || pDnode->ntype == DNODE || pDnode->ntype == NODE_MAX) { pDnode->lockfile = dndCheckRunning(pDnode->dataDir); if (pDnode->lockfile == NULL) { return -1; From 4d6c84443815a3dabb0172a7c87d9d75d40dc5ed Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 30 Mar 2022 21:09:23 +0800 Subject: [PATCH 39/49] shm --- include/os/os.h | 1 + include/os/osProc.h | 33 +++++++++ include/os/osSignal.h | 2 + source/dnode/mgmt/main/exe/dndMain.c | 5 +- source/dnode/mgmt/main/inc/dnd.h | 1 + source/dnode/mgmt/main/src/dndExec.c | 12 ++- source/os/src/osProc.c | 27 +++++++ source/os/src/osSignal.c | 2 + source/util/test/queueTest.cpp | 105 --------------------------- 9 files changed, 78 insertions(+), 110 deletions(-) create mode 100644 include/os/osProc.h create mode 100644 source/os/src/osProc.c diff --git a/include/os/os.h b/include/os/os.h index 0d0c308134..3ea94d0094 100644 --- a/include/os/os.h +++ b/include/os/os.h @@ -82,6 +82,7 @@ extern "C" { #include "osLz4.h" #include "osMath.h" #include "osMemory.h" +#include "osProc.h" #include "osRand.h" #include "osThread.h" #include "osSemaphore.h" diff --git a/include/os/osProc.h b/include/os/osProc.h new file mode 100644 index 0000000000..e76e22a54e --- /dev/null +++ b/include/os/osProc.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#ifndef _TD_OS_PROC_H_ +#define _TD_OS_PROC_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +// start a copy of itself +int32_t taosNewProc(const char *args); + +// the length of the new name must be less than the original name to take effect +void taosSetProcName(char **argv, const char *name); + +#ifdef __cplusplus +} +#endif + +#endif /*_TD_OS_PROC_H_*/ diff --git a/include/os/osSignal.h b/include/os/osSignal.h index ab4b6fa242..e9fb13e870 100644 --- a/include/os/osSignal.h +++ b/include/os/osSignal.h @@ -49,6 +49,8 @@ void taosSetSignal(int32_t signum, FSignalHandler sigfp); void taosIgnSignal(int32_t signum); void taosDflSignal(int32_t signum); +void taosKillChildOnSelfStopped(); + #ifdef __cplusplus } #endif diff --git a/source/dnode/mgmt/main/exe/dndMain.c b/source/dnode/mgmt/main/exe/dndMain.c index ca89c7cc1a..1dcb312724 100644 --- a/source/dnode/mgmt/main/exe/dndMain.c +++ b/source/dnode/mgmt/main/exe/dndMain.c @@ -56,7 +56,7 @@ static void dndSetSignalHandle() { taosSetSignal(SIGCHLD, dndHandleChild); } else { // When the parent process exits, the child process will receive the SIGKILL signal - prctl(PR_SET_PDEATHSIG, SIGKILL); + taosKillChildOnSelfStopped(); } } @@ -143,8 +143,7 @@ static int32_t dndInitLog() { static void dndSetProcName(char **argv) { if (global.ntype != DNODE) { const char *name = dndNodeProcStr(global.ntype); - prctl(PR_SET_NAME, name); - strcpy(argv[0], name); + taosSetProcName(argv, name); } } diff --git a/source/dnode/mgmt/main/inc/dnd.h b/source/dnode/mgmt/main/inc/dnd.h index 1ce2293799..7e87d26af4 100644 --- a/source/dnode/mgmt/main/inc/dnd.h +++ b/source/dnode/mgmt/main/inc/dnd.h @@ -95,6 +95,7 @@ typedef struct SMgmtWrapper { bool deployed; bool required; EProcType procType; + int32_t procId; SProcObj *pProc; SShm shm; void *pMgmt; diff --git a/source/dnode/mgmt/main/src/dndExec.c b/source/dnode/mgmt/main/src/dndExec.c index c2a075cfc0..d74adf45d1 100644 --- a/source/dnode/mgmt/main/src/dndExec.c +++ b/source/dnode/mgmt/main/src/dndExec.c @@ -193,9 +193,17 @@ static int32_t dndRunInParentProcess(SDnode *pDnode) { if (!pWrapper->required) continue; if (pDnode->ntype == NODE_MAX) { - dInfo("node:%s, will be started manually", pWrapper->name); + dInfo("node:%s, should be started manually", pWrapper->name); } else { - dInfo("node:%s, will pull up the child process through exec", pWrapper->name); + char args[PATH_MAX]; + int32_t pid = taosNewProc(args); + if (pid <= 0) { + terrno = TAOS_SYSTEM_ERROR(errno); + dError("node:%s, failed to exec in new process since %s", pWrapper->name, terrstr()); + return -1; + } + pWrapper->procId = pid; + dInfo("node:%s, run in new process, pid:%d", pWrapper->name, pid); } if (taosProcRun(pWrapper->pProc) != 0) { diff --git a/source/os/src/osProc.c b/source/os/src/osProc.c new file mode 100644 index 0000000000..6c58e71003 --- /dev/null +++ b/source/os/src/osProc.c @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#define ALLOW_FORBID_FUNC +#define _DEFAULT_SOURCE +#include "os.h" + +int32_t taosNewProc(const char *args) { + return 0; +} + +void taosSetProcName(char **argv, const char *name) { + prctl(PR_SET_NAME, name); + strcpy(argv[0], name); +} \ No newline at end of file diff --git a/source/os/src/osSignal.c b/source/os/src/osSignal.c index 12721a17f5..ce029cdfe5 100644 --- a/source/os/src/osSignal.c +++ b/source/os/src/osSignal.c @@ -71,4 +71,6 @@ void taosIgnSignal(int32_t signum) { signal(signum, SIG_IGN); } void taosDflSignal(int32_t signum) { signal(signum, SIG_DFL); } +void taosKillChildOnSelfStopped() { prctl(PR_SET_PDEATHSIG, SIGKILL); } + #endif diff --git a/source/util/test/queueTest.cpp b/source/util/test/queueTest.cpp index 0bc53ab85a..0c4bcf84ad 100644 --- a/source/util/test/queueTest.cpp +++ b/source/util/test/queueTest.cpp @@ -26,108 +26,3 @@ class UtilTestQueue : public ::testing::Test { static void SetUpTestSuite() {} static void TearDownTestSuite() {} }; - -#if 0 -TEST_F(UtilTestQueue, 01_fork) { - pid_t pid; - int shmid; - int* shmptr; - int* tmp; - - int err; - pthread_mutexattr_t mattr; - if ((err = taosThreadMutexAttrInit(&mattr)) < 0) { - printf("mutex addr init error:%s\n", strerror(err)); - exit(1); - } - - if ((err = taosThreadMutexAttrSetPshared(&mattr, PTHREAD_PROCESS_SHARED)) < 0) { - printf("mutex addr get shared error:%s\n", strerror(err)); - exit(1); - } - - pthread_mutex_t* m; - int mid = shmget(IPC_PRIVATE, sizeof(pthread_mutex_t), 0600); - m = (pthread_mutex_t*)shmat(mid, NULL, 0); - - if ((err = taosThreadMutexInit(m, &mattr)) < 0) { - printf("mutex mutex init error:%s\n", strerror(err)); - exit(1); - } - - if ((shmid = shmget(IPC_PRIVATE, 1000, IPC_CREAT | 0600)) < 0) { - perror("shmget error"); - exit(1); - } - - if ((shmptr = (int*)shmat(shmid, 0, 0)) == (void*)-1) { - perror("shmat error"); - exit(1); - } - - tmp = shmptr; - - int shmid2; - int** shmptr2; - if ((shmid2 = shmget(IPC_PRIVATE, 20, IPC_CREAT | 0600)) < 0) { - perror("shmget2 error"); - exit(1); - } - - if ((shmptr2 = (int**)shmat(shmid2, 0, 0)) == (void*)-1) { - perror("shmat2 error"); - exit(1); - } - - *shmptr2 = shmptr; - - if ((pid = fork()) < 0) { - perror("fork error"); - exit(1); - } else if (pid == 0) { - if ((err = taosThreadMutexLock(m)) < 0) { - printf("lock error:%s\n", strerror(err)); - exit(1); - } - for (int i = 0; i < 30; ++i) { - **shmptr2 = i; - (*shmptr2)++; - } - - if ((err = taosThreadMutexUnlock(m)) < 0) { - printf("unlock error:%s\n", strerror(err)); - exit(1); - } - exit(0); - - } else { - if ((err = taosThreadMutexLock(m)) < 0) { - printf("lock error:%s\n", strerror(err)); - exit(1); - } - for (int i = 10; i < 42; ++i) { - **shmptr2 = i; - (*shmptr2)++; - } - if ((err = taosThreadMutexUnlock(m)) < 0) { - printf("unlock error:%s\n", strerror(err)); - exit(1); - } - } - - wait(NULL); - - for (int i = 0; i < 70; ++i) { - printf("%d ", tmp[i]); - } - - printf("\n"); - - taosThreadAttrDestroy(&mattr); - //销毁mutex - taosThreadMutexDestroy(m); - - exit(0); -} - -#endif \ No newline at end of file From 27280fe2921e7bcfd982a215fd357f804d83c267 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Wed, 30 Mar 2022 21:36:39 +0800 Subject: [PATCH 40/49] add fuzzy search --- source/libs/index/src/indexFstDfa.c | 33 ++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/source/libs/index/src/indexFstDfa.c b/source/libs/index/src/indexFstDfa.c index b390c31343..e704144974 100644 --- a/source/libs/index/src/indexFstDfa.c +++ b/source/libs/index/src/indexFstDfa.c @@ -119,7 +119,38 @@ bool dfaBuilderRunState(FstDfaBuilder *builder, FstSparseSet *cur, FstSparseSet } bool dfaBuilderCachedState(FstDfaBuilder *builder, FstSparseSet *set, uint32_t *result) { - // impl cache state + SArray *tinsts = taosArrayInit(4, sizeof(uint32_t)); + bool isMatch = false; + + for (int i = 0; i < sparSetLen(set); i++) { + uint32_t ip = sparSetGet(set, i); + + Inst *inst = taosArrayGet(builder->dfa->insts, ip); + if (inst->ty == JUMP || inst->ty == SPLIT) { + continue; + } else if (inst->ty == RANGE) { + taosArrayPush(tinsts, &ip); + } else if (inst->ty == MATCH) { + isMatch = true; + taosArrayPush(tinsts, &ip); + } + } + if (taosArrayGetSize(tinsts) == 0) { + return false; + } + uint32_t *v = taosHashGet(builder->cache, &tinsts, sizeof(POINTER_BYTES)); + if (v != NULL) { + *result = *v; + taosArrayDestroy(tinsts); + } else { + State st; + st.insts = tinsts; + st.isMatch = isMatch; + taosArrayPush(builder->dfa->states, &st); + int32_t sz = taosArrayGetSize(builder->dfa->states) - 1; + taosHashPut(builder->cache, &tinsts, sizeof(POINTER_BYTES), &sz, sizeof(sz)); + *result = sz; + } return true; } From baf28eced5c000057c3048a2d97b4cb386ff907c Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Wed, 30 Mar 2022 22:04:10 +0800 Subject: [PATCH 41/49] add fuzzy search --- source/libs/index/src/indexFstDfa.c | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/source/libs/index/src/indexFstDfa.c b/source/libs/index/src/indexFstDfa.c index e704144974..b4ac9f3a99 100644 --- a/source/libs/index/src/indexFstDfa.c +++ b/source/libs/index/src/indexFstDfa.c @@ -165,15 +165,34 @@ FstDfa *dfaCreate(SArray *insts, SArray *states) { return dfa; } bool dfaIsMatch(FstDfa *dfa, uint32_t si) { - // impl match - return true; + if (dfa->states == NULL || si < taosArrayGetSize(dfa->states)) { + return false; + } + State *st = taosArrayGet(dfa->states, si); + return st != NULL ? st->isMatch : false; } bool dfaAccept(FstDfa *dfa, uint32_t si, uint8_t byte, uint32_t *result) { - // impl accept + if (dfa->states == NULL || si < taosArrayGetSize(dfa->states)) { + return false; + } + State *st = taosArrayGet(dfa->states, si); + *result = st->next[byte]; return true; } void dfaAdd(FstDfa *dfa, FstSparseSet *set, uint32_t ip) { - // impl add + if (sparSetContains(set, ip)) { + return; + } + sparSetAdd(set, ip); + Inst *inst = taosArrayGet(dfa->insts, ip); + if (inst->ty == MATCH || inst->ty == RANGE) { + // do nothing + } else if (inst->ty == JUMP) { + dfaAdd(dfa, set, inst->jv.step); + } else if (inst->ty == SPLIT) { + dfaAdd(dfa, set, inst->sv.len1); + dfaAdd(dfa, set, inst->sv.len2); + } return; } bool dfaRun(FstDfa *dfa, FstSparseSet *from, FstSparseSet *to, uint8_t byte) { From f2c9f40dffca587d89bc321d8ff53ce48fff71fe Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Thu, 31 Mar 2022 10:16:04 +0800 Subject: [PATCH 42/49] add fuzzy search --- source/libs/index/src/indexFstDfa.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/source/libs/index/src/indexFstDfa.c b/source/libs/index/src/indexFstDfa.c index b4ac9f3a99..ff6b154c54 100644 --- a/source/libs/index/src/indexFstDfa.c +++ b/source/libs/index/src/indexFstDfa.c @@ -193,9 +193,26 @@ void dfaAdd(FstDfa *dfa, FstSparseSet *set, uint32_t ip) { dfaAdd(dfa, set, inst->sv.len1); dfaAdd(dfa, set, inst->sv.len2); } + return; } bool dfaRun(FstDfa *dfa, FstSparseSet *from, FstSparseSet *to, uint8_t byte) { - // impl run - return true; + bool isMatch = false; + sparSetClear(to); + for (int i = 0; i < sparSetLen(from); i++) { + uint32_t ip = sparSetGet(from, i); + + Inst *inst = taosArrayGet(dfa->insts, ip); + if (inst->ty == JUMP || inst->ty == SPLIT) { + continue; + } else if (inst->ty == MATCH) { + isMatch = true; + } else if (inst->ty == RANGE) { + if (inst->rv.start <= byte && byte <= inst->rv.end) { + dfaAdd(dfa, to, ip + 1); + } + } + } + + return isMatch; } From 4cb1e013cf3dd637df363632ddebc783584468bc Mon Sep 17 00:00:00 2001 From: plum-lihui Date: Thu, 31 Mar 2022 11:08:32 +0800 Subject: [PATCH 43/49] [add cases] --- tests/script/tsim/query/scalarFunction.sim | 140 +++++++++++++++++++++ tests/test/c/tmqSim.c | 2 +- 2 files changed, 141 insertions(+), 1 deletion(-) create mode 100644 tests/script/tsim/query/scalarFunction.sim diff --git a/tests/script/tsim/query/scalarFunction.sim b/tests/script/tsim/query/scalarFunction.sim new file mode 100644 index 0000000000..912e3ffcd8 --- /dev/null +++ b/tests/script/tsim/query/scalarFunction.sim @@ -0,0 +1,140 @@ +#### abs, log, pow, sqrt, sin, cos, tan, asin, acos, atan, ceil, floor, round + +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/cfg.sh -n dnode1 +system sh/exec.sh -n dnode1 -s start + +$loop_cnt = 0 +check_dnode_ready: + $loop_cnt = $loop_cnt + 1 + sleep 200 + if $loop_cnt == 10 then + print ====> dnode not ready! + return -1 + endi +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 +endi + +sql connect + +$vgroups = 4 +$dbNamme = d0 + +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 +print $data10 $data11 $data12 $data13 $data14 $data15 $data16 $data17 $data18 $data19 +#print $data20 $data21 $data22 $data23 $data24 $data25 $data26 $data27 $data28 $data29 + +sql use $dbNamme + +print =============== create super table +sql create table if not exists stb (ts timestamp, c1 int, c2 float, c3 double) tags (t1 int) + +print =============== create child table +$tbPrefix = ct +$tbNum = 2 + +$i = 0 +while $i < $tbNum + $tb = $tbPrefix . $i + sql create table $tb using stb tags( $i ) + $i = $i + 1 +endw + +print =============== create normal table +sql create table ntb (ts timestamp, c1 int, c2 float, c3 double) + +sql show tables +if $rows != 3 then + return -1 +endi + +print =============== insert data +$rowNum = 20 +$tstart = 1640966400000 # 2022-01-01 00:00:00.000 + +$i = 0 +while $i < $tbNum + $tb = $tbPrefix . $i + + $x = 0 + $c1 = 0 + while $x < $rowNum + $c2 = 0 - $c1 + $c3 = $c1 + 100 + + sql insert into $tb values ($tstart , $c1 , $c2 , $c3 ) + sql insert into ntb values ($tstart , $c1 , $c2 , $c3 ) + $tstart = $tstart + 1 + $c1 = $c1 + 5 + $x = $x + 1 + endw + + $i = $i + 1 + $tstart = 1640966400000 +endw + +print ====> abs +sql select c1, abs(c1), c2, abs(c2), c3, abs(c3) from ct1 +print ====> select c1, abs(c1), c2, abs(c2), c3, abs(c3) from ct1 +print ====> rows: $rows +print ====> $data00 $data01 $data02 $data03 $data04 $data05 +print ====> $data10 $data11 $data12 $data13 $data14 $data15 +print ====> $data20 $data21 $data22 $data23 $data24 $data25 +print ====> $data30 $data31 $data32 $data33 $data34 $data35 +print ====> $data40 $data41 $data42 $data43 $data44 $data45 +print ====> $data50 $data51 $data52 $data53 $data54 $data55 +print ====> $data60 $data61 $data62 $data63 $data64 $data65 +print ====> $data70 $data71 $data72 $data73 $data74 $data75 +print ====> $data80 $data81 $data82 $data83 $data84 $data85 +print ====> $data90 $data91 $data92 $data93 $data94 $data95 +if $rows != 10 then + return -1 +endi + +print ====> sin +sql select c1, sin(c1), c2, sin(c2), c3, sin(c3) from ct1 +print ====> select c1, sin(c1), c2, sin(c2), c3, sin(c3) from ct1 +print ====> rows: $rows +print ====> $data00 $data01 $data02 $data03 $data04 $data05 +print ====> $data10 $data11 $data12 $data13 $data14 $data15 +print ====> $data20 $data21 $data22 $data23 $data24 $data25 +print ====> $data30 $data31 $data32 $data33 $data34 $data35 +print ====> $data40 $data41 $data42 $data43 $data44 $data45 +print ====> $data50 $data51 $data52 $data53 $data54 $data55 +print ====> $data60 $data61 $data62 $data63 $data64 $data65 +print ====> $data70 $data71 $data72 $data73 $data74 $data75 +print ====> $data80 $data81 $data82 $data83 $data84 $data85 +print ====> $data90 $data91 $data92 $data93 $data94 $data95 +if $rows != 10 then + return -1 +endi + +print ====> cos +sql select c1, cos(c1), c2, cos(c2), c3, cos(c3) from ct1 +print ====> select c1, cos(c1), c2, cos(c2), c3, cos(c3) from ct1 +print ====> rows: $rows +print ====> $data00 $data01 $data02 $data03 $data04 $data05 +print ====> $data10 $data11 $data12 $data13 $data14 $data15 +print ====> $data20 $data21 $data22 $data23 $data24 $data25 +print ====> $data30 $data31 $data32 $data33 $data34 $data35 +print ====> $data40 $data41 $data42 $data43 $data44 $data45 +print ====> $data50 $data51 $data52 $data53 $data54 $data55 +print ====> $data60 $data61 $data62 $data63 $data64 $data65 +print ====> $data70 $data71 $data72 $data73 $data74 $data75 +print ====> $data80 $data81 $data82 $data83 $data84 $data85 +print ====> $data90 $data91 $data92 $data93 $data94 $data95 +if $rows != 10 then + return -1 +endi + +#system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/test/c/tmqSim.c b/tests/test/c/tmqSim.c index 38264331c1..78f1c7e015 100644 --- a/tests/test/c/tmqSim.c +++ b/tests/test/c/tmqSim.c @@ -226,7 +226,7 @@ void loop_consume(tmq_t* tmq) { int32_t totalRows = 0; int32_t skipLogNum = 0; while (running) { - tmq_message_t* tmqMsg = tmq_consumer_poll(tmq, 3000); + tmq_message_t* tmqMsg = tmq_consumer_poll(tmq, 6000); if (tmqMsg) { totalMsgs++; From 2c1ec0dd103e61e1991885576f676df773f5397d Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Thu, 31 Mar 2022 11:32:23 +0800 Subject: [PATCH 44/49] [TD-13603]: python connector for 3.0 (#11152) * add a few stmt_ interface declartion * add taos_load_table_info * add taos_set_config(() interface * add more interfaces * warn 'reset query cache' only since lack engine support * update taos-tools --- tests/pytest/util/sql.py | 7 +++++-- tools/taos-tools | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/pytest/util/sql.py b/tests/pytest/util/sql.py index 2b654a3793..9fe4ffa0d4 100644 --- a/tests/pytest/util/sql.py +++ b/tests/pytest/util/sql.py @@ -50,7 +50,10 @@ class TDSql: def prepare(self): tdLog.info("prepare database:db") s = 'reset query cache' - self.cursor.execute(s) + try: + self.cursor.execute(s) + except: + tdLog.notice("'reset query cache' is not supported") s = 'drop database if exists db' self.cursor.execute(s) s = 'create database db' @@ -341,4 +344,4 @@ class TDSql: tdLog.info("dir: %s is created" %dir) pass -tdSql = TDSql() \ No newline at end of file +tdSql = TDSql() diff --git a/tools/taos-tools b/tools/taos-tools index f36b07f710..33cdfe4f90 160000 --- a/tools/taos-tools +++ b/tools/taos-tools @@ -1 +1 @@ -Subproject commit f36b07f710d661dca88fdd70e73b5e3e16a960e0 +Subproject commit 33cdfe4f90a209f105c1b6091439798a9cde1e93 From 4c2ce0b407ed816e39519a5f8a1fba80f4716e09 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Thu, 31 Mar 2022 11:15:20 +0800 Subject: [PATCH 45/49] shm --- include/os/osProc.h | 9 +- include/os/osSignal.h | 2 +- source/dnode/mgmt/main/exe/dndMain.c | 12 +- source/dnode/mgmt/main/src/dndExec.c | 213 +++++++++++++++------------ source/dnode/mgmt/main/src/dndObj.c | 4 +- source/os/src/osProc.c | 35 ++++- source/os/src/osSignal.c | 2 +- 7 files changed, 163 insertions(+), 114 deletions(-) diff --git a/include/os/osProc.h b/include/os/osProc.h index e76e22a54e..0b22105e5e 100644 --- a/include/os/osProc.h +++ b/include/os/osProc.h @@ -20,11 +20,10 @@ extern "C" { #endif -// start a copy of itself -int32_t taosNewProc(const char *args); - -// the length of the new name must be less than the original name to take effect -void taosSetProcName(char **argv, const char *name); +int32_t taosNewProc(char **args); +void taosSetProcName(int32_t argc, char **argv, const char *name); +void taosSetProcPath(int32_t argc, char **argv); +bool taosProcExists(int32_t pid); #ifdef __cplusplus } diff --git a/include/os/osSignal.h b/include/os/osSignal.h index e9fb13e870..e22c43684c 100644 --- a/include/os/osSignal.h +++ b/include/os/osSignal.h @@ -49,7 +49,7 @@ void taosSetSignal(int32_t signum, FSignalHandler sigfp); void taosIgnSignal(int32_t signum); void taosDflSignal(int32_t signum); -void taosKillChildOnSelfStopped(); +void taosKillChildOnParentStopped(); #ifdef __cplusplus } diff --git a/source/dnode/mgmt/main/exe/dndMain.c b/source/dnode/mgmt/main/exe/dndMain.c index 1dcb312724..1bfa23c022 100644 --- a/source/dnode/mgmt/main/exe/dndMain.c +++ b/source/dnode/mgmt/main/exe/dndMain.c @@ -50,13 +50,10 @@ static void dndSetSignalHandle() { taosSetSignal(SIGBREAK, dndStopDnode); if (!tsMultiProcess) { - // Set the single process signal } else if (global.ntype == DNODE) { - // When the child process exits, the parent process receives a signal taosSetSignal(SIGCHLD, dndHandleChild); } else { - // When the parent process exits, the child process will receive the SIGKILL signal - taosKillChildOnSelfStopped(); + taosKillChildOnParentStopped(); } } @@ -140,10 +137,11 @@ static int32_t dndInitLog() { return taosCreateLog(logName, 1, configDir, global.envFile, global.apolloUrl, global.pArgs, 0); } -static void dndSetProcName(char **argv) { +static void dndSetProcInfo(int32_t argc, char **argv) { + taosSetProcPath(argc, argv); if (global.ntype != DNODE) { const char *name = dndNodeProcStr(global.ntype); - taosSetProcName(argv, name); + taosSetProcName(argc, argv, name); } } @@ -186,6 +184,7 @@ int main(int argc, char const *argv[]) { return -1; } + dndSetProcInfo(argc, (char **)argv); if (global.generateGrant) { dndGenerateGrant(); return 0; @@ -213,6 +212,5 @@ int main(int argc, char const *argv[]) { return 0; } - dndSetProcName((char **)argv); return dndRunDnode(); } diff --git a/source/dnode/mgmt/main/src/dndExec.c b/source/dnode/mgmt/main/src/dndExec.c index d74adf45d1..7b8975da88 100644 --- a/source/dnode/mgmt/main/src/dndExec.c +++ b/source/dnode/mgmt/main/src/dndExec.c @@ -17,8 +17,8 @@ #include "dndInt.h" static bool dndRequireNode(SMgmtWrapper *pWrapper) { - bool required = false; - int32_t code =(*pWrapper->fp.requiredFp)(pWrapper, &required); + bool required = false; + int32_t code = (*pWrapper->fp.requiredFp)(pWrapper, &required); if (!required) { dDebug("node:%s, no need to start", pWrapper->name); } else { @@ -65,36 +65,6 @@ void dndCloseNode(SMgmtWrapper *pWrapper) { dDebug("node:%s, has been closed", pWrapper->name); } -static int32_t dndRunInSingleProcess(SDnode *pDnode) { - dInfo("dnode start to run in single process"); - - for (ENodeType n = DNODE; n < NODE_MAX; ++n) { - SMgmtWrapper *pWrapper = &pDnode->wrappers[n]; - pWrapper->required = dndRequireNode(pWrapper); - if (!pWrapper->required) continue; - - if (dndOpenNode(pWrapper) != 0) { - dError("node:%s, failed to start since %s", pWrapper->name, terrstr()); - return -1; - } - } - - dndSetStatus(pDnode, DND_STAT_RUNNING); - - for (ENodeType n = 0; n < NODE_MAX; ++n) { - SMgmtWrapper *pWrapper = &pDnode->wrappers[n]; - if (!pWrapper->required) continue; - if (pWrapper->fp.startFp == NULL) continue; - if ((*pWrapper->fp.startFp)(pWrapper) != 0) { - dError("node:%s, failed to start since %s", pWrapper->name, terrstr()); - return -1; - } - } - - dInfo("dnode running in single process"); - return 0; -} - static void dndConsumeChildQueue(SMgmtWrapper *pWrapper, SNodeMsg *pMsg, int16_t msgLen, void *pCont, int32_t contLen, ProcFuncType ftype) { SRpcMsg *pRpc = &pMsg->rpcMsg; @@ -140,6 +110,84 @@ static void dndConsumeParentQueue(SMgmtWrapper *pWrapper, SRpcMsg *pMsg, int16_t taosMemoryFree(pMsg); } +static int32_t dndNewProc(SMgmtWrapper *pWrapper, ENodeType n) { + char tstr[8] = {0}; + char *args[6] = {0}; + snprintf(tstr, sizeof(tstr), "%d", n); + args[1] = "-c"; + args[2] = configDir; + args[3] = "-n"; + args[4] = tstr; + args[5] = NULL; + + int32_t pid = taosNewProc(args); + if (pid <= 0) { + terrno = TAOS_SYSTEM_ERROR(errno); + dError("node:%s, failed to exec in new process since %s", pWrapper->name, terrstr()); + return -1; + } + + pWrapper->procId = pid; + dInfo("node:%s, run in new process, pid:%d", pWrapper->name, pid); + return 0; +} + +static SProcCfg dndGenProcCfg(SMgmtWrapper *pWrapper) { + SProcCfg cfg = {.childConsumeFp = (ProcConsumeFp)dndConsumeChildQueue, + .childMallocHeadFp = (ProcMallocFp)taosAllocateQitem, + .childFreeHeadFp = (ProcFreeFp)taosFreeQitem, + .childMallocBodyFp = (ProcMallocFp)rpcMallocCont, + .childFreeBodyFp = (ProcFreeFp)rpcFreeCont, + .parentConsumeFp = (ProcConsumeFp)dndConsumeParentQueue, + .parentMallocHeadFp = (ProcMallocFp)taosMemoryMalloc, + .parentFreeHeadFp = (ProcFreeFp)taosMemoryFree, + .parentMallocBodyFp = (ProcMallocFp)rpcMallocCont, + .parentFreeBodyFp = (ProcFreeFp)rpcFreeCont, + .shm = pWrapper->shm, + .pParent = pWrapper, + .name = pWrapper->name}; + return cfg; +} + +static int32_t dndRunInSingleProcess(SDnode *pDnode) { + dInfo("dnode start to run in single process"); + + for (ENodeType n = DNODE; n < NODE_MAX; ++n) { + SMgmtWrapper *pWrapper = &pDnode->wrappers[n]; + pWrapper->required = dndRequireNode(pWrapper); + if (!pWrapper->required) continue; + + if (dndOpenNode(pWrapper) != 0) { + dError("node:%s, failed to start since %s", pWrapper->name, terrstr()); + return -1; + } + } + + dndSetStatus(pDnode, DND_STAT_RUNNING); + + for (ENodeType n = 0; n < NODE_MAX; ++n) { + SMgmtWrapper *pWrapper = &pDnode->wrappers[n]; + if (!pWrapper->required) continue; + if (pWrapper->fp.startFp == NULL) continue; + if ((*pWrapper->fp.startFp)(pWrapper) != 0) { + dError("node:%s, failed to start since %s", pWrapper->name, terrstr()); + return -1; + } + } + + dInfo("TDengine initialized successfully"); + dndReportStartup(pDnode, "TDengine", "initialized successfully"); + while (1) { + if (pDnode->event == DND_EVENT_STOP) { + dInfo("dnode is about to stop"); + break; + } + taosMsleep(100); + } + + return 0; +} + static int32_t dndRunInParentProcess(SDnode *pDnode) { dInfo("dnode start to run in parent process"); SMgmtWrapper *pDWrapper = &pDnode->wrappers[DNODE]; @@ -160,21 +208,8 @@ static int32_t dndRunInParentProcess(SDnode *pDnode) { return -1; } - SProcCfg cfg = {.childConsumeFp = (ProcConsumeFp)dndConsumeChildQueue, - .childMallocHeadFp = (ProcMallocFp)taosAllocateQitem, - .childFreeHeadFp = (ProcFreeFp)taosFreeQitem, - .childMallocBodyFp = (ProcMallocFp)rpcMallocCont, - .childFreeBodyFp = (ProcFreeFp)rpcFreeCont, - .parentConsumeFp = (ProcConsumeFp)dndConsumeParentQueue, - .parentMallocHeadFp = (ProcMallocFp)taosMemoryMalloc, - .parentFreeHeadFp = (ProcFreeFp)taosMemoryFree, - .parentMallocBodyFp = (ProcMallocFp)rpcMallocCont, - .parentFreeBodyFp = (ProcFreeFp)rpcFreeCont, - .shm = pWrapper->shm, - .pParent = pWrapper, - .isChild = false, - .name = pWrapper->name}; - + SProcCfg cfg = dndGenProcCfg(pWrapper); + cfg.isChild = false; pWrapper->procType = PROC_PARENT; pWrapper->pProc = taosProcInit(&cfg); if (pWrapper->pProc == NULL) { @@ -195,15 +230,9 @@ static int32_t dndRunInParentProcess(SDnode *pDnode) { if (pDnode->ntype == NODE_MAX) { dInfo("node:%s, should be started manually", pWrapper->name); } else { - char args[PATH_MAX]; - int32_t pid = taosNewProc(args); - if (pid <= 0) { - terrno = TAOS_SYSTEM_ERROR(errno); - dError("node:%s, failed to exec in new process since %s", pWrapper->name, terrstr()); + if (dndNewProc(pWrapper, n) != 0) { return -1; } - pWrapper->procId = pid; - dInfo("node:%s, run in new process, pid:%d", pWrapper->name, pid); } if (taosProcRun(pWrapper->pProc) != 0) { @@ -219,7 +248,29 @@ static int32_t dndRunInParentProcess(SDnode *pDnode) { return -1; } - dInfo("dnode running in parent process"); + dInfo("TDengine initialized successfully"); + dndReportStartup(pDnode, "TDengine", "initialized successfully"); + + while (1) { + if (pDnode->event == DND_EVENT_STOP) { + dInfo("dnode is about to stop"); + break; + } + + 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 && !taosProcExists(pWrapper->procId)) { + dInfo("node:%s, process not exist, pid:%d", pWrapper->name, pWrapper->procId); + dndNewProc(pWrapper, n); + } + + taosMsleep(100); + } + } + return 0; } @@ -236,21 +287,8 @@ static int32_t dndRunInChildProcess(SDnode *pDnode) { return -1; } - SProcCfg cfg = {.childConsumeFp = (ProcConsumeFp)dndConsumeChildQueue, - .childMallocHeadFp = (ProcMallocFp)taosAllocateQitem, - .childFreeHeadFp = (ProcFreeFp)taosFreeQitem, - .childMallocBodyFp = (ProcMallocFp)rpcMallocCont, - .childFreeBodyFp = (ProcFreeFp)rpcFreeCont, - .parentConsumeFp = (ProcConsumeFp)dndConsumeParentQueue, - .parentMallocHeadFp = (ProcMallocFp)taosMemoryMalloc, - .parentFreeHeadFp = (ProcFreeFp)taosMemoryFree, - .parentMallocBodyFp = (ProcMallocFp)rpcMallocCont, - .parentFreeBodyFp = (ProcFreeFp)rpcFreeCont, - .shm = pWrapper->shm, - .pParent = pWrapper, - .isChild = true, - .name = pWrapper->name}; - + SProcCfg cfg = dndGenProcCfg(pWrapper); + cfg.isChild = true; pWrapper->pProc = taosProcInit(&cfg); if (pWrapper->pProc == NULL) { dError("node:%s, failed to create proc since %s", pWrapper->name, terrstr()); @@ -269,31 +307,8 @@ static int32_t dndRunInChildProcess(SDnode *pDnode) { return -1; } - dInfo("dnode running in child process"); - return 0; -} - -int32_t dndRun(SDnode * pDnode) { - if (!tsMultiProcess) { - if (dndRunInSingleProcess(pDnode) != 0) { - dError("failed to run dnode since %s", terrstr()); - return -1; - } - } else if (pDnode->ntype == DNODE || pDnode->ntype == NODE_MAX) { - if (dndRunInParentProcess(pDnode) != 0) { - dError("failed to run dnode in parent process since %s", terrstr()); - return -1; - } - } else { - if (dndRunInChildProcess(pDnode) != 0) { - dError("failed to run dnode in child process since %s", terrstr()); - return -1; - } - } - - dndReportStartup(pDnode, "TDengine", "initialized successfully"); dInfo("TDengine initialized successfully"); - + dndReportStartup(pDnode, "TDengine", "initialized successfully"); while (1) { if (pDnode->event == DND_EVENT_STOP) { dInfo("dnode is about to stop"); @@ -301,6 +316,16 @@ int32_t dndRun(SDnode * pDnode) { } taosMsleep(100); } +} + +int32_t dndRun(SDnode *pDnode) { + if (!tsMultiProcess) { + return dndRunInSingleProcess(pDnode); + } else if (pDnode->ntype == DNODE || pDnode->ntype == NODE_MAX) { + return dndRunInParentProcess(pDnode); + } else { + return dndRunInChildProcess(pDnode); + } return 0; } diff --git a/source/dnode/mgmt/main/src/dndObj.c b/source/dnode/mgmt/main/src/dndObj.c index 44013deed8..ed2b669587 100644 --- a/source/dnode/mgmt/main/src/dndObj.c +++ b/source/dnode/mgmt/main/src/dndObj.c @@ -152,7 +152,9 @@ void dndClose(SDnode *pDnode) { void dndHandleEvent(SDnode *pDnode, EDndEvent event) { dInfo("dnode object receive event %d, data:%p", event, pDnode); - pDnode->event = event; + if (event == DND_EVENT_STOP) { + pDnode->event = event; + } } SMgmtWrapper *dndAcquireWrapper(SDnode *pDnode, ENodeType ntype) { diff --git a/source/os/src/osProc.c b/source/os/src/osProc.c index 6c58e71003..7da25ae8c6 100644 --- a/source/os/src/osProc.c +++ b/source/os/src/osProc.c @@ -17,11 +17,36 @@ #define _DEFAULT_SOURCE #include "os.h" -int32_t taosNewProc(const char *args) { - return 0; +static char *tsProcPath = NULL; + +int32_t taosNewProc(char **args) { + int32_t pid = fork(); + if (pid == 0) { + args[0] = tsProcPath; + return execvp(tsProcPath, args); + } else { + return pid; + } } -void taosSetProcName(char **argv, const char *name) { +// the length of the new name must be less than the original name to take effect +void taosSetProcName(int32_t argc, char **argv, const char *name) { prctl(PR_SET_NAME, name); - strcpy(argv[0], name); -} \ No newline at end of file + + for (int32_t i = 0; i < argc; ++i) { + int32_t len = strlen(argv[i]); + for (int32_t j = 0; j < len; ++j) { + argv[i][j] = 0; + } + if (i == 0) { + tstrncpy(argv[0], name, len); + } + } +} + +void taosSetProcPath(int32_t argc, char **argv) { tsProcPath = argv[0]; } + +bool taosProcExists(int32_t pid) { + int32_t p = getpgid(pid); + return p == 0; +} diff --git a/source/os/src/osSignal.c b/source/os/src/osSignal.c index ce029cdfe5..d4e6cb3318 100644 --- a/source/os/src/osSignal.c +++ b/source/os/src/osSignal.c @@ -71,6 +71,6 @@ void taosIgnSignal(int32_t signum) { signal(signum, SIG_IGN); } void taosDflSignal(int32_t signum) { signal(signum, SIG_DFL); } -void taosKillChildOnSelfStopped() { prctl(PR_SET_PDEATHSIG, SIGKILL); } +void taosKillChildOnParentStopped() { prctl(PR_SET_PDEATHSIG, SIGKILL); } #endif From ba80c7478fa67d010c7271b99850aa0ae7e10119 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Thu, 31 Mar 2022 02:19:11 -0400 Subject: [PATCH 46/49] TD-14405 TD-14404 desc and reset query cache statement implement --- include/common/ttokendef.h | 109 +- include/libs/command/command.h | 19 + include/libs/nodes/cmdnodes.h | 13 + include/libs/nodes/nodes.h | 2 + include/libs/parser/parser.h | 1 + source/client/CMakeLists.txt | 2 +- source/client/src/clientImpl.c | 21 +- source/libs/CMakeLists.txt | 1 + source/libs/command/CMakeLists.txt | 16 + source/libs/command/src/command.c | 115 + source/libs/command/test/CMakeLists.txt | 18 + source/libs/command/test/commandTest.cpp | 21 + source/libs/nodes/src/nodesUtilFuncs.c | 4 + source/libs/parser/inc/parAst.h | 2 + source/libs/parser/inc/parInt.h | 1 + source/libs/parser/inc/sql.y | 9 +- source/libs/parser/src/parAstCreater.c | 15 + source/libs/parser/src/parTokenizer.c | 6 +- source/libs/parser/src/parTranslater.c | 127 +- source/libs/parser/src/parser.c | 4 + source/libs/parser/src/sql.c | 3522 ++++++++++---------- source/libs/planner/src/planPhysiCreater.c | 3 + 22 files changed, 2189 insertions(+), 1842 deletions(-) create mode 100644 include/libs/command/command.h create mode 100644 source/libs/command/CMakeLists.txt create mode 100644 source/libs/command/src/command.c create mode 100644 source/libs/command/test/CMakeLists.txt create mode 100644 source/libs/command/test/commandTest.cpp diff --git a/include/common/ttokendef.h b/include/common/ttokendef.h index 73c15d508c..47a97071aa 100644 --- a/include/common/ttokendef.h +++ b/include/common/ttokendef.h @@ -138,59 +138,62 @@ #define TK_INTERVAL 120 #define TK_TOPIC 121 #define TK_AS 122 -#define TK_EXPLAIN 123 -#define TK_ANALYZE 124 -#define TK_VERBOSE 125 -#define TK_NK_BOOL 126 -#define TK_RATIO 127 -#define TK_NULL 128 -#define TK_NK_VARIABLE 129 -#define TK_NK_UNDERLINE 130 -#define TK_ROWTS 131 -#define TK_TBNAME 132 -#define TK_QSTARTTS 133 -#define TK_QENDTS 134 -#define TK_WSTARTTS 135 -#define TK_WENDTS 136 -#define TK_WDURATION 137 -#define TK_BETWEEN 138 -#define TK_IS 139 -#define TK_NK_LT 140 -#define TK_NK_GT 141 -#define TK_NK_LE 142 -#define TK_NK_GE 143 -#define TK_NK_NE 144 -#define TK_MATCH 145 -#define TK_NMATCH 146 -#define TK_IN 147 -#define TK_JOIN 148 -#define TK_INNER 149 -#define TK_SELECT 150 -#define TK_DISTINCT 151 -#define TK_WHERE 152 -#define TK_PARTITION 153 -#define TK_BY 154 -#define TK_SESSION 155 -#define TK_STATE_WINDOW 156 -#define TK_SLIDING 157 -#define TK_FILL 158 -#define TK_VALUE 159 -#define TK_NONE 160 -#define TK_PREV 161 -#define TK_LINEAR 162 -#define TK_NEXT 163 -#define TK_GROUP 164 -#define TK_HAVING 165 -#define TK_ORDER 166 -#define TK_SLIMIT 167 -#define TK_SOFFSET 168 -#define TK_LIMIT 169 -#define TK_OFFSET 170 -#define TK_ASC 171 -#define TK_DESC 172 -#define TK_NULLS 173 -#define TK_FIRST 174 -#define TK_LAST 175 +#define TK_DESC 123 +#define TK_DESCRIBE 124 +#define TK_RESET 125 +#define TK_QUERY 126 +#define TK_EXPLAIN 127 +#define TK_ANALYZE 128 +#define TK_VERBOSE 129 +#define TK_NK_BOOL 130 +#define TK_RATIO 131 +#define TK_NULL 132 +#define TK_NK_VARIABLE 133 +#define TK_NK_UNDERLINE 134 +#define TK_ROWTS 135 +#define TK_TBNAME 136 +#define TK_QSTARTTS 137 +#define TK_QENDTS 138 +#define TK_WSTARTTS 139 +#define TK_WENDTS 140 +#define TK_WDURATION 141 +#define TK_BETWEEN 142 +#define TK_IS 143 +#define TK_NK_LT 144 +#define TK_NK_GT 145 +#define TK_NK_LE 146 +#define TK_NK_GE 147 +#define TK_NK_NE 148 +#define TK_MATCH 149 +#define TK_NMATCH 150 +#define TK_IN 151 +#define TK_JOIN 152 +#define TK_INNER 153 +#define TK_SELECT 154 +#define TK_DISTINCT 155 +#define TK_WHERE 156 +#define TK_PARTITION 157 +#define TK_BY 158 +#define TK_SESSION 159 +#define TK_STATE_WINDOW 160 +#define TK_SLIDING 161 +#define TK_FILL 162 +#define TK_VALUE 163 +#define TK_NONE 164 +#define TK_PREV 165 +#define TK_LINEAR 166 +#define TK_NEXT 167 +#define TK_GROUP 168 +#define TK_HAVING 169 +#define TK_ORDER 170 +#define TK_SLIMIT 171 +#define TK_SOFFSET 172 +#define TK_LIMIT 173 +#define TK_OFFSET 174 +#define TK_ASC 175 +#define TK_NULLS 176 +#define TK_FIRST 177 +#define TK_LAST 178 #define TK_NK_SPACE 300 #define TK_NK_COMMENT 301 diff --git a/include/libs/command/command.h b/include/libs/command/command.h new file mode 100644 index 0000000000..699c2f9792 --- /dev/null +++ b/include/libs/command/command.h @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#include "cmdnodes.h" +#include "tmsg.h" + +int32_t qExecCommand(SNode* pStmt, SRetrieveTableRsp** pRsp); diff --git a/include/libs/nodes/cmdnodes.h b/include/libs/nodes/cmdnodes.h index a03c496b4f..1c812d40ca 100644 --- a/include/libs/nodes/cmdnodes.h +++ b/include/libs/nodes/cmdnodes.h @@ -20,8 +20,14 @@ extern "C" { #endif +#include "query.h" #include "querynodes.h" +#define DESCRIBE_RESULT_COLS 4 +#define DESCRIBE_RESULT_FIELD_LEN (TSDB_COL_NAME_LEN - 1 + VARSTR_HEADER_SIZE) +#define DESCRIBE_RESULT_TYPE_LEN (20 + VARSTR_HEADER_SIZE) +#define DESCRIBE_RESULT_NOTE_LEN (8 + VARSTR_HEADER_SIZE) + typedef struct SDatabaseOptions { ENodeType type; int32_t numOfBlocks; @@ -247,6 +253,13 @@ typedef struct SAlterLocalStmt { char value[TSDB_DNODE_VALUE_LEN]; } SAlterLocalStmt; +typedef struct SDescribeStmt { + ENodeType type; + char dbName[TSDB_DB_NAME_LEN]; + char tableName[TSDB_TABLE_NAME_LEN]; + STableMeta* pMeta; +} SDescribeStmt; + #ifdef __cplusplus } #endif diff --git a/include/libs/nodes/nodes.h b/include/libs/nodes/nodes.h index 83c0bccaaf..5f86c75787 100644 --- a/include/libs/nodes/nodes.h +++ b/include/libs/nodes/nodes.h @@ -101,6 +101,8 @@ typedef enum ENodeType { QUERY_NODE_DROP_TOPIC_STMT, QUERY_NODE_ALTER_LOCAL_STMT, QUERY_NODE_EXPLAIN_STMT, + QUERY_NODE_DESCRIBE_STMT, + QUERY_NODE_RESET_QUERY_CACHE_STMT, QUERY_NODE_SHOW_DATABASES_STMT, QUERY_NODE_SHOW_TABLES_STMT, QUERY_NODE_SHOW_STABLES_STMT, diff --git a/include/libs/parser/parser.h b/include/libs/parser/parser.h index 0747534721..f10185c44f 100644 --- a/include/libs/parser/parser.h +++ b/include/libs/parser/parser.h @@ -55,6 +55,7 @@ typedef struct SQuery { SArray* pDbList; SArray* pTableList; bool showRewrite; + bool localCmd; } SQuery; int32_t qParseQuerySql(SParseContext* pCxt, SQuery** pQuery); diff --git a/source/client/CMakeLists.txt b/source/client/CMakeLists.txt index a632337d4a..8ee6c31ba1 100644 --- a/source/client/CMakeLists.txt +++ b/source/client/CMakeLists.txt @@ -8,7 +8,7 @@ target_include_directories( target_link_libraries( taos INTERFACE api - PRIVATE os util common transport nodes parser planner catalog scheduler function qcom + PRIVATE os util common transport nodes parser command planner catalog scheduler function qcom ) if(${BUILD_TEST}) diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index d8017a8727..f0d5941141 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -1,6 +1,7 @@ #include "clientInt.h" #include "clientLog.h" +#include "command.h" #include "scheduler.h" #include "tdatablock.h" #include "tdef.h" @@ -170,6 +171,15 @@ int32_t parseSql(SRequestObj* pRequest, bool topicQuery, SQuery** pQuery) { return code; } +int32_t execLocalCmd(SRequestObj* pRequest, SQuery* pQuery) { + SRetrieveTableRsp* pRsp = NULL; + int32_t code = qExecCommand(pQuery->pRoot, &pRsp); + if (TSDB_CODE_SUCCESS == code && NULL != pRsp) { + code = setQueryResultFromRsp(&pRequest->body.resInfo, pRsp); + } + return code; +} + int32_t execDdlQuery(SRequestObj* pRequest, SQuery* pQuery) { SCmdMsgInfo* pMsgInfo = pQuery->pCmdMsg; pRequest->type = pMsgInfo->msgType; @@ -259,7 +269,9 @@ SRequestObj* execQueryImpl(STscObj* pTscObj, const char* sql, int sqlLen) { CHECK_CODE_GOTO(buildRequest(pTscObj, sql, sqlLen, &pRequest), _return); CHECK_CODE_GOTO(parseSql(pRequest, false, &pQuery), _return); - if (pQuery->directRpc) { + if (pQuery->localCmd) { + CHECK_CODE_GOTO(execLocalCmd(pRequest, pQuery), _return); + } else if (pQuery->directRpc) { CHECK_CODE_GOTO(execDdlQuery(pRequest, pQuery), _return); } else { CHECK_CODE_GOTO(getPlan(pRequest, pQuery, &pRequest->body.pDag, pNodeList), _return); @@ -464,9 +476,11 @@ static void destroySendMsgInfo(SMsgSendInfo* pMsgBody) { taosMemoryFreeClear(pMsgBody->msgInfo.pData); taosMemoryFreeClear(pMsgBody); } + bool persistConnForSpecificMsg(void* parenct, tmsg_t msgType) { return msgType == TDMT_VND_QUERY_RSP || msgType == TDMT_VND_FETCH_RSP || msgType == TDMT_VND_RES_READY_RSP || msgType == TDMT_VND_QUERY_HEARTBEAT_RSP; } + void processMsgFromServer(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet) { SMsgSendInfo* pSendInfo = (SMsgSendInfo*)pMsg->ahandle; assert(pMsg->ahandle != NULL); @@ -647,6 +661,11 @@ void* doFetchRow(SRequestObj* pRequest, bool setupOneRowPtr) { } } + if (pResultInfo->completed) { + pResultInfo->numOfRows = 0; + return NULL; + } + SMsgSendInfo* body = buildMsgInfoImpl(pRequest); int64_t transporterId = 0; diff --git a/source/libs/CMakeLists.txt b/source/libs/CMakeLists.txt index a1b9337fa8..b1e8be6528 100644 --- a/source/libs/CMakeLists.txt +++ b/source/libs/CMakeLists.txt @@ -17,3 +17,4 @@ add_subdirectory(tfs) add_subdirectory(monitor) add_subdirectory(nodes) add_subdirectory(scalar) +add_subdirectory(command) diff --git a/source/libs/command/CMakeLists.txt b/source/libs/command/CMakeLists.txt new file mode 100644 index 0000000000..db3766d145 --- /dev/null +++ b/source/libs/command/CMakeLists.txt @@ -0,0 +1,16 @@ +aux_source_directory(src COMMAND_SRC) +add_library(command STATIC ${COMMAND_SRC}) +target_include_directories( + command + PUBLIC "${CMAKE_SOURCE_DIR}/include/libs/command" + PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc" +) + +target_link_libraries( + command + PRIVATE os util nodes catalog function transport qcom +) + +if(${BUILD_TEST}) + ADD_SUBDIRECTORY(test) +endif(${BUILD_TEST}) \ No newline at end of file diff --git a/source/libs/command/src/command.c b/source/libs/command/src/command.c new file mode 100644 index 0000000000..7ffbd4f80a --- /dev/null +++ b/source/libs/command/src/command.c @@ -0,0 +1,115 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#include "command.h" +#include "tdatablock.h" + +// #define SET_VARSTR(pData, val, pOffset) + +static void buildRspData(const STableMeta* pMeta, char* pData) { + int32_t* pColSizes = (int32_t*)pData; + pData += DESCRIBE_RESULT_COLS * sizeof(int32_t); + int32_t numOfRows = TABLE_TOTAL_COL_NUM(pMeta); + + // Field + int32_t* pOffset = (int32_t*)pData; + pData += numOfRows * sizeof(int32_t); + for (int32_t i = 0; i < numOfRows; ++i) { + STR_TO_VARSTR(pData, pMeta->schema[i].name); + int16_t len = varDataTLen(pData); + pData += len; + *pOffset = pColSizes[0]; + pOffset += 1; + pColSizes[0] += len; + } + + // Type + pOffset = (int32_t*)pData; + pData += numOfRows * sizeof(int32_t); + for (int32_t i = 0; i < numOfRows; ++i) { + STR_TO_VARSTR(pData, tDataTypes[pMeta->schema[i].type].name); + int16_t len = varDataTLen(pData); + pData += len; + *pOffset = pColSizes[1]; + pOffset += 1; + pColSizes[1] += len; + } + + // Length + pData += BitmapLen(numOfRows); + for (int32_t i = 0; i < numOfRows; ++i) { + *(int32_t*)pData = pMeta->schema[i].bytes; + pData += sizeof(int32_t); + } + pColSizes[2] = sizeof(int32_t) * numOfRows; + + // Note + pOffset = (int32_t*)pData; + pData += numOfRows * sizeof(int32_t); + for (int32_t i = 0; i < numOfRows; ++i) { + STR_TO_VARSTR(pData, i >= pMeta->tableInfo.numOfColumns ? "TAG" : ""); + int16_t len = varDataTLen(pData); + pData += len; + *pOffset = pColSizes[3]; + pOffset += 1; + pColSizes[3] += len; + } + + for (int32_t i = 0; i < DESCRIBE_RESULT_COLS; ++i) { + pColSizes[i] = htonl(pColSizes[i]); + } +} + +static int32_t calcRspSize(const STableMeta* pMeta) { + int32_t numOfRows = TABLE_TOTAL_COL_NUM(pMeta); + return sizeof(SRetrieveTableRsp) + + (numOfRows * sizeof(int32_t) + numOfRows * DESCRIBE_RESULT_FIELD_LEN) + + (numOfRows * sizeof(int32_t) + numOfRows * DESCRIBE_RESULT_TYPE_LEN) + + (BitmapLen(numOfRows) + numOfRows * sizeof(int32_t)) + + (numOfRows * sizeof(int32_t) + numOfRows * DESCRIBE_RESULT_NOTE_LEN); +} + +static int32_t execDescribe(SNode* pStmt, SRetrieveTableRsp** pRsp) { + SDescribeStmt* pDesc = (SDescribeStmt*)pStmt; + *pRsp = taosMemoryCalloc(1, calcRspSize(pDesc->pMeta)); + if (NULL == *pRsp) { + return TSDB_CODE_OUT_OF_MEMORY; + } + (*pRsp)->useconds = 0; + (*pRsp)->completed = 1; + (*pRsp)->precision = 0; + (*pRsp)->compressed = 0; + (*pRsp)->compLen = 0; + (*pRsp)->numOfRows = htonl(TABLE_TOTAL_COL_NUM(pDesc->pMeta)); + buildRspData(pDesc->pMeta, (*pRsp)->data); + return TSDB_CODE_SUCCESS; +} + +static int32_t execResetQueryCache() { + // todo + return TSDB_CODE_SUCCESS; +} + +int32_t qExecCommand(SNode* pStmt, SRetrieveTableRsp** pRsp) { + switch (nodeType(pStmt)) { + case QUERY_NODE_DESCRIBE_STMT: + return execDescribe(pStmt, pRsp); + case QUERY_NODE_RESET_QUERY_CACHE_STMT: + return execResetQueryCache(); + default: + break; + } + return TSDB_CODE_FAILED; +} diff --git a/source/libs/command/test/CMakeLists.txt b/source/libs/command/test/CMakeLists.txt new file mode 100644 index 0000000000..6d2335d2e3 --- /dev/null +++ b/source/libs/command/test/CMakeLists.txt @@ -0,0 +1,18 @@ +MESSAGE(STATUS "build command unit test") + +# GoogleTest requires at least C++11 +SET(CMAKE_CXX_STANDARD 11) +AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} SOURCE_LIST) + +ADD_EXECUTABLE(commandTest ${SOURCE_LIST}) + +TARGET_INCLUDE_DIRECTORIES( + commandTest + PUBLIC "${CMAKE_SOURCE_DIR}/include/libs/command/" + PRIVATE "${CMAKE_SOURCE_DIR}/source/libs/command/inc" +) + +TARGET_LINK_LIBRARIES( + commandTest + PUBLIC os util common nodes parser catalog transport gtest function qcom +) \ No newline at end of file diff --git a/source/libs/command/test/commandTest.cpp b/source/libs/command/test/commandTest.cpp new file mode 100644 index 0000000000..59118c501a --- /dev/null +++ b/source/libs/command/test/commandTest.cpp @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#include + +int main(int argc, char* argv[]) { + testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index 89b4476899..799d07e5d9 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -136,6 +136,10 @@ SNodeptr nodesMakeNode(ENodeType type) { return makeNode(type, sizeof(SDropTopicStmt)); case QUERY_NODE_EXPLAIN_STMT: return makeNode(type, sizeof(SExplainStmt)); + case QUERY_NODE_DESCRIBE_STMT: + return makeNode(type, sizeof(SDescribeStmt)); + case QUERY_NODE_RESET_QUERY_CACHE_STMT: + return makeNode(type, sizeof(SNode)); case QUERY_NODE_SHOW_DATABASES_STMT: case QUERY_NODE_SHOW_TABLES_STMT: case QUERY_NODE_SHOW_STABLES_STMT: diff --git a/source/libs/parser/inc/parAst.h b/source/libs/parser/inc/parAst.h index 029ae7e91f..9ad089f38e 100644 --- a/source/libs/parser/inc/parAst.h +++ b/source/libs/parser/inc/parAst.h @@ -163,6 +163,8 @@ SNode* createDefaultExplainOptions(SAstCreateContext* pCxt); SNode* setExplainVerbose(SAstCreateContext* pCxt, SNode* pOptions, const SToken* pVal); SNode* setExplainRatio(SAstCreateContext* pCxt, SNode* pOptions, const SToken* pVal); SNode* createExplainStmt(SAstCreateContext* pCxt, bool analyze, SNode* pOptions, SNode* pQuery); +SNode* createDescribeStmt(SAstCreateContext* pCxt, SNode* pRealTable); +SNode* createResetQueryCacheStmt(SAstCreateContext* pCxt); #ifdef __cplusplus } diff --git a/source/libs/parser/inc/parInt.h b/source/libs/parser/inc/parInt.h index af0d78717e..9bad3e9eb9 100644 --- a/source/libs/parser/inc/parInt.h +++ b/source/libs/parser/inc/parInt.h @@ -25,6 +25,7 @@ extern "C" { int32_t parseInsertSql(SParseContext* pContext, SQuery** pQuery); int32_t doParse(SParseContext* pParseCxt, SQuery** pQuery); int32_t doTranslate(SParseContext* pParseCxt, SQuery* pQuery); +int32_t extractResultSchema(const SNode* pRoot, int32_t* numOfCols, SSchema** pSchema); #ifdef __cplusplus } diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index 5e2f8e4241..60c3e29913 100644 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -339,7 +339,14 @@ cmd ::= CREATE TOPIC not_exists_opt(A) topic_name(B) AS query_expression(C). cmd ::= CREATE TOPIC not_exists_opt(A) topic_name(B) AS db_name(C). { pCxt->pRootNode = createCreateTopicStmt(pCxt, A, &B, NULL, &C); } cmd ::= DROP TOPIC exists_opt(A) topic_name(B). { pCxt->pRootNode = createDropTopicStmt(pCxt, A, &B); } -/************************************************ select **************************************************************/ +/************************************************ desc/describe *******************************************************/ +cmd ::= DESC full_table_name(A). { pCxt->pRootNode = createDescribeStmt(pCxt, A); } +cmd ::= DESCRIBE full_table_name(A). { pCxt->pRootNode = createDescribeStmt(pCxt, A); } + +/************************************************ reset query cache ***************************************************/ +cmd ::= RESET QUERY CACHE. { pCxt->pRootNode = createResetQueryCacheStmt(pCxt); } + +/************************************************ explain *************************************************************/ cmd ::= EXPLAIN analyze_opt(A) explain_options(B) query_expression(C). { pCxt->pRootNode = createExplainStmt(pCxt, A, B, C); } %type analyze_opt { bool } diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c index 8783872ad8..9206898383 100644 --- a/source/libs/parser/src/parAstCreater.c +++ b/source/libs/parser/src/parAstCreater.c @@ -1343,3 +1343,18 @@ SNode* createExplainStmt(SAstCreateContext* pCxt, bool analyze, SNode* pOptions, pStmt->pQuery = pQuery; return (SNode*)pStmt; } + +SNode* createDescribeStmt(SAstCreateContext* pCxt, SNode* pRealTable) { + SDescribeStmt* pStmt = nodesMakeNode(QUERY_NODE_DESCRIBE_STMT); + CHECK_OUT_OF_MEM(pStmt); + strcpy(pStmt->dbName, ((SRealTableNode*)pRealTable)->table.dbName); + strcpy(pStmt->tableName, ((SRealTableNode*)pRealTable)->table.tableName); + nodesDestroyNode(pRealTable); + return (SNode*)pStmt; +} + +SNode* createResetQueryCacheStmt(SAstCreateContext* pCxt) { + SNode* pStmt = nodesMakeNode(QUERY_NODE_RESET_QUERY_CACHE_STMT); + CHECK_OUT_OF_MEM(pStmt); + return pStmt; +} diff --git a/source/libs/parser/src/parTokenizer.c b/source/libs/parser/src/parTokenizer.c index 213b14ae5d..817db3592d 100644 --- a/source/libs/parser/src/parTokenizer.c +++ b/source/libs/parser/src/parTokenizer.c @@ -51,6 +51,7 @@ static SKeyword keywordTable[] = { {"DAYS", TK_DAYS}, {"DELAY", TK_DELAY}, {"DESC", TK_DESC}, + {"DESCRIBE", TK_DESCRIBE}, {"DISTINCT", TK_DISTINCT}, {"DNODE", TK_DNODE}, {"DNODES", TK_DNODES}, @@ -111,9 +112,11 @@ static SKeyword keywordTable[] = { {"QNODE", TK_QNODE}, {"QNODES", TK_QNODES}, {"QSTARTTS", TK_QSTARTTS}, + {"QUERY", TK_QUERY}, {"QUORUM", TK_QUORUM}, {"RATIO", TK_RATIO}, {"REPLICA", TK_REPLICA}, + {"RESET", TK_RESET}, {"RETENTIONS", TK_RETENTIONS}, {"ROLLUP", TK_ROLLUP}, {"ROWTS", TK_ROWTS}, @@ -186,7 +189,6 @@ static SKeyword keywordTable[] = { // {"SCORES", TK_SCORES}, // {"GRANTS", TK_GRANTS}, // {"DOT", TK_DOT}, - // {"DESCRIBE", TK_DESCRIBE}, // {"SYNCDB", TK_SYNCDB}, // {"LOCAL", TK_LOCAL}, // {"PPS", TK_PPS}, @@ -203,8 +205,6 @@ static SKeyword keywordTable[] = { // {"EVERY", TK_EVERY}, // {"VARIABLE", TK_VARIABLE}, // {"UPDATE", TK_UPDATE}, - // {"RESET", TK_RESET}, - // {"QUERY", TK_QUERY}, // {"ADD", TK_ADD}, // {"COLUMN", TK_COLUMN}, // {"TAG", TK_TAG}, diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index d453193d0f..65e248a2bc 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -1812,6 +1812,10 @@ static int32_t translateExplain(STranslateContext* pCxt, SExplainStmt* pStmt) { return translateQuery(pCxt, pStmt->pQuery); } +static int32_t translateDescribe(STranslateContext* pCxt, SDescribeStmt* pStmt) { + return getTableMeta(pCxt, pStmt->dbName, pStmt->tableName, &pStmt->pMeta); +} + static int32_t translateQuery(STranslateContext* pCxt, SNode* pNode) { int32_t code = TSDB_CODE_SUCCESS; switch (nodeType(pNode)) { @@ -1896,6 +1900,9 @@ static int32_t translateQuery(STranslateContext* pCxt, SNode* pNode) { case QUERY_NODE_EXPLAIN_STMT: code = translateExplain(pCxt, (SExplainStmt*)pNode); break; + case QUERY_NODE_DESCRIBE_STMT: + code = translateDescribe(pCxt, (SDescribeStmt*)pNode); + break; default: break; } @@ -1913,40 +1920,81 @@ static int32_t translateSubquery(STranslateContext* pCxt, SNode* pNode) { return code; } -int32_t qExtractResultSchema(const SNode* pRoot, int32_t* numOfCols, SSchema** pSchema) { +static int32_t extractSelectResultSchema(const SSelectStmt* pSelect, int32_t* numOfCols, SSchema** pSchema) { + *numOfCols = LIST_LENGTH(pSelect->pProjectionList); + *pSchema = taosMemoryCalloc((*numOfCols), sizeof(SSchema)); + if (NULL == (*pSchema)) { + return TSDB_CODE_OUT_OF_MEMORY; + } + + SNode* pNode; + int32_t index = 0; + FOREACH(pNode, pSelect->pProjectionList) { + SExprNode* pExpr = (SExprNode*)pNode; + (*pSchema)[index].type = pExpr->resType.type; + (*pSchema)[index].bytes = pExpr->resType.bytes; + (*pSchema)[index].colId = index + 1; + strcpy((*pSchema)[index].name, pExpr->aliasName); + index +=1; + } + + return TSDB_CODE_SUCCESS; +} + +static int32_t extractExplainResultSchema(int32_t* numOfCols, SSchema** pSchema) { + *numOfCols = 1; + *pSchema = taosMemoryCalloc((*numOfCols), sizeof(SSchema)); + if (NULL == (*pSchema)) { + return TSDB_CODE_OUT_OF_MEMORY; + } + (*pSchema)[0].type = TSDB_DATA_TYPE_BINARY; + (*pSchema)[0].bytes = TSDB_EXPLAIN_RESULT_ROW_SIZE; + return TSDB_CODE_SUCCESS; +} + +static int32_t extractDescribeResultSchema(int32_t* numOfCols, SSchema** pSchema) { + *numOfCols = DESCRIBE_RESULT_COLS; + *pSchema = taosMemoryCalloc((*numOfCols), sizeof(SSchema)); + if (NULL == (*pSchema)) { + return TSDB_CODE_OUT_OF_MEMORY; + } + + (*pSchema)[0].type = TSDB_DATA_TYPE_BINARY; + (*pSchema)[0].bytes = DESCRIBE_RESULT_FIELD_LEN; + strcpy((*pSchema)[0].name, "Field"); + + (*pSchema)[1].type = TSDB_DATA_TYPE_BINARY; + (*pSchema)[1].bytes = DESCRIBE_RESULT_TYPE_LEN; + strcpy((*pSchema)[1].name, "Type"); + + (*pSchema)[2].type = TSDB_DATA_TYPE_INT; + (*pSchema)[2].bytes = tDataTypes[TSDB_DATA_TYPE_INT].bytes; + strcpy((*pSchema)[2].name, "Length"); + + (*pSchema)[3].type = TSDB_DATA_TYPE_BINARY; + (*pSchema)[3].bytes = DESCRIBE_RESULT_NOTE_LEN; + strcpy((*pSchema)[3].name, "Note"); + + return TSDB_CODE_SUCCESS; +} + +int32_t extractResultSchema(const SNode* pRoot, int32_t* numOfCols, SSchema** pSchema) { if (NULL == pRoot) { return TSDB_CODE_SUCCESS; } - if (QUERY_NODE_SELECT_STMT == nodeType(pRoot)) { - SSelectStmt* pSelect = (SSelectStmt*) pRoot; - *numOfCols = LIST_LENGTH(pSelect->pProjectionList); - *pSchema = taosMemoryCalloc((*numOfCols), sizeof(SSchema)); - if (NULL == (*pSchema)) { - return TSDB_CODE_OUT_OF_MEMORY; - } - - SNode* pNode; - int32_t index = 0; - FOREACH(pNode, pSelect->pProjectionList) { - SExprNode* pExpr = (SExprNode*)pNode; - (*pSchema)[index].type = pExpr->resType.type; - (*pSchema)[index].bytes = pExpr->resType.bytes; - (*pSchema)[index].colId = index + 1; - strcpy((*pSchema)[index].name, pExpr->aliasName); - index +=1; - } - } else if (QUERY_NODE_EXPLAIN_STMT == nodeType(pRoot)) { - *numOfCols = 1; - *pSchema = taosMemoryCalloc((*numOfCols), sizeof(SSchema)); - if (NULL == (*pSchema)) { - return TSDB_CODE_OUT_OF_MEMORY; - } - (*pSchema)[0].type = TSDB_DATA_TYPE_BINARY; - (*pSchema)[0].bytes = TSDB_EXPLAIN_RESULT_ROW_SIZE; + switch (nodeType(pRoot)) { + case QUERY_NODE_SELECT_STMT: + return extractSelectResultSchema((SSelectStmt*)pRoot, numOfCols, pSchema); + case QUERY_NODE_EXPLAIN_STMT: + return extractExplainResultSchema(numOfCols, pSchema); + case QUERY_NODE_DESCRIBE_STMT: + return extractDescribeResultSchema(numOfCols, pSchema); + default: + break; } - return TSDB_CODE_SUCCESS; + return TSDB_CODE_FAILED; } static void destroyTranslateContext(STranslateContext* pCxt) { @@ -2530,25 +2578,30 @@ static int32_t setQuery(STranslateContext* pCxt, SQuery* pQuery) { case QUERY_NODE_SELECT_STMT: case QUERY_NODE_EXPLAIN_STMT: pQuery->haveResultSet = true; - pQuery->directRpc = false; pQuery->msgType = TDMT_VND_QUERY; - if (TSDB_CODE_SUCCESS != qExtractResultSchema(pQuery->pRoot, &pQuery->numOfResCols, &pQuery->pResSchema)) { - return TSDB_CODE_OUT_OF_MEMORY; - } break; case QUERY_NODE_VNODE_MODIF_STMT: - pQuery->haveResultSet = false; - pQuery->directRpc = false; pQuery->msgType = TDMT_VND_CREATE_TABLE; break; + case QUERY_NODE_DESCRIBE_STMT: + pQuery->localCmd = true; + pQuery->haveResultSet = true; + break; + case QUERY_NODE_RESET_QUERY_CACHE_STMT: + pQuery->localCmd = true; + break; default: - pQuery->haveResultSet = false; pQuery->directRpc = true; - pQuery->pCmdMsg = pCxt->pCmdMsg; - pCxt->pCmdMsg = NULL; + TSWAP(pQuery->pCmdMsg, pCxt->pCmdMsg, SCmdMsgInfo*); pQuery->msgType = pQuery->pCmdMsg->msgType; break; } + + if (pQuery->haveResultSet) { + if (TSDB_CODE_SUCCESS != extractResultSchema(pQuery->pRoot, &pQuery->numOfResCols, &pQuery->pResSchema)) { + return TSDB_CODE_OUT_OF_MEMORY; + } + } if (NULL != pCxt->pDbs) { pQuery->pDbList = taosArrayInit(taosHashGetSize(pCxt->pDbs), TSDB_DB_FNAME_LEN); diff --git a/source/libs/parser/src/parser.c b/source/libs/parser/src/parser.c index d9bff4b9ef..d410aa2e17 100644 --- a/source/libs/parser/src/parser.c +++ b/source/libs/parser/src/parser.c @@ -62,3 +62,7 @@ void qDestroyQuery(SQuery* pQueryNode) { taosArrayDestroy(pQueryNode->pTableList); taosMemoryFreeClear(pQueryNode); } + +int32_t qExtractResultSchema(const SNode* pRoot, int32_t* numOfCols, SSchema** pSchema) { + return extractResultSchema(pRoot, numOfCols, pSchema); +} \ No newline at end of file diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index 154b87ba4b..fc6a582da5 100644 --- a/source/libs/parser/src/sql.c +++ b/source/libs/parser/src/sql.c @@ -100,24 +100,24 @@ #endif /************* Begin control #defines *****************************************/ #define YYCODETYPE unsigned short int -#define YYNOCODE 274 +#define YYNOCODE 277 #define YYACTIONTYPE unsigned short int #define ParseTOKENTYPE SToken typedef union { int yyinit; ParseTOKENTYPE yy0; - SAlterOption yy29; - SNodeList* yy40; - ENullOrder yy177; - EOrder yy210; - EOperatorType yy328; - SNode* yy364; - EJoinType yy392; - SDataType yy420; - SToken yy437; - int32_t yy460; - EFillMode yy478; - bool yy493; + EFillMode yy6; + EJoinType yy10; + SNode* yy46; + SToken yy95; + SAlterOption yy145; + bool yy151; + SNodeList* yy194; + int32_t yy202; + ENullOrder yy273; + EOperatorType yy292; + SDataType yy400; + EOrder yy456; } YYMINORTYPE; #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 @@ -132,17 +132,17 @@ typedef union { #define ParseCTX_PARAM #define ParseCTX_FETCH #define ParseCTX_STORE -#define YYNSTATE 438 -#define YYNRULE 354 -#define YYNTOKEN 176 -#define YY_MAX_SHIFT 437 -#define YY_MIN_SHIFTREDUCE 684 -#define YY_MAX_SHIFTREDUCE 1037 -#define YY_ERROR_ACTION 1038 -#define YY_ACCEPT_ACTION 1039 -#define YY_NO_ACTION 1040 -#define YY_MIN_REDUCE 1041 -#define YY_MAX_REDUCE 1394 +#define YYNSTATE 445 +#define YYNRULE 357 +#define YYNTOKEN 179 +#define YY_MAX_SHIFT 444 +#define YY_MIN_SHIFTREDUCE 691 +#define YY_MAX_SHIFTREDUCE 1047 +#define YY_ERROR_ACTION 1048 +#define YY_ACCEPT_ACTION 1049 +#define YY_NO_ACTION 1050 +#define YY_MIN_REDUCE 1051 +#define YY_MAX_REDUCE 1407 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -209,408 +209,422 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (1305) +#define YY_ACTTAB_COUNT (1352) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 1251, 337, 24, 172, 356, 356, 256, 241, 1247, 1254, - /* 10 */ 1220, 1221, 31, 29, 27, 26, 25, 1264, 369, 369, - /* 20 */ 9, 8, 93, 67, 67, 31, 29, 27, 26, 25, - /* 30 */ 286, 292, 337, 1373, 106, 60, 1053, 1280, 369, 1144, - /* 40 */ 1144, 341, 1135, 276, 353, 94, 118, 215, 1084, 249, - /* 50 */ 1371, 91, 1136, 93, 355, 979, 1211, 1213, 1238, 1144, - /* 60 */ 215, 165, 1319, 336, 110, 335, 1087, 44, 1373, 913, - /* 70 */ 63, 1265, 1266, 1269, 1312, 1184, 90, 943, 231, 1308, - /* 80 */ 1385, 118, 91, 1238, 1139, 1371, 107, 1111, 956, 1346, - /* 90 */ 943, 339, 114, 1319, 1320, 257, 1324, 422, 421, 420, - /* 100 */ 419, 418, 417, 416, 415, 414, 413, 412, 411, 410, - /* 110 */ 409, 408, 407, 406, 405, 298, 944, 293, 105, 242, - /* 120 */ 297, 213, 898, 296, 368, 294, 1147, 105, 295, 944, - /* 130 */ 31, 29, 27, 26, 25, 1146, 368, 1122, 23, 236, - /* 140 */ 938, 939, 940, 941, 942, 946, 947, 948, 27, 26, - /* 150 */ 25, 23, 236, 938, 939, 940, 941, 942, 946, 947, - /* 160 */ 948, 793, 392, 391, 390, 797, 389, 799, 800, 388, - /* 170 */ 802, 385, 1264, 808, 382, 810, 811, 379, 376, 229, - /* 180 */ 30, 28, 337, 277, 12, 30, 28, 980, 238, 277, - /* 190 */ 878, 246, 1280, 238, 1264, 878, 1251, 310, 255, 353, - /* 200 */ 254, 1191, 978, 93, 1247, 1253, 876, 228, 1251, 355, - /* 210 */ 308, 876, 1189, 1238, 1280, 11, 1247, 1253, 341, 369, - /* 220 */ 11, 340, 248, 119, 1141, 62, 1265, 1266, 1269, 1312, - /* 230 */ 105, 355, 91, 214, 1308, 1238, 1, 265, 1146, 1120, - /* 240 */ 1144, 1, 115, 1319, 1320, 1373, 1324, 63, 1265, 1266, - /* 250 */ 1269, 1312, 119, 1191, 720, 231, 1308, 113, 118, 243, - /* 260 */ 434, 6, 1371, 902, 1189, 434, 119, 430, 429, 168, - /* 270 */ 284, 312, 877, 1280, 1280, 319, 1339, 877, 30, 28, - /* 280 */ 353, 353, 124, 123, 222, 404, 238, 1264, 878, 1033, - /* 290 */ 1034, 326, 1331, 975, 879, 53, 882, 883, 204, 879, - /* 300 */ 926, 882, 883, 204, 876, 926, 290, 1280, 327, 330, - /* 310 */ 289, 313, 1137, 11, 340, 721, 1373, 720, 119, 1264, - /* 320 */ 223, 1191, 221, 220, 355, 288, 332, 328, 1238, 1372, - /* 330 */ 1064, 291, 1212, 1371, 1, 722, 119, 368, 1373, 1280, - /* 340 */ 63, 1265, 1266, 1269, 1312, 404, 353, 369, 231, 1308, - /* 350 */ 113, 118, 366, 30, 28, 1371, 355, 369, 434, 900, - /* 360 */ 1238, 238, 367, 878, 395, 167, 1264, 975, 1144, 1340, - /* 370 */ 877, 1238, 63, 1265, 1266, 1269, 1312, 1191, 1144, 876, - /* 380 */ 231, 1308, 1385, 250, 1063, 12, 1280, 192, 1189, 331, - /* 390 */ 1174, 1369, 879, 353, 882, 883, 204, 337, 926, 139, - /* 400 */ 251, 1062, 137, 355, 30, 28, 354, 1238, 105, 7, - /* 410 */ 369, 303, 238, 348, 878, 186, 1146, 44, 93, 63, - /* 420 */ 1265, 1266, 1269, 1312, 1061, 1238, 311, 231, 1308, 1385, - /* 430 */ 876, 1144, 945, 434, 1140, 987, 30, 28, 1330, 345, - /* 440 */ 147, 900, 1238, 306, 238, 877, 878, 91, 300, 1060, - /* 450 */ 1326, 146, 1264, 1059, 21, 1191, 901, 116, 1319, 1320, - /* 460 */ 7, 1324, 876, 949, 899, 1238, 1190, 879, 1323, 882, - /* 470 */ 883, 204, 1280, 926, 41, 30, 28, 40, 1004, 353, - /* 480 */ 1121, 1326, 369, 238, 434, 878, 1058, 252, 1208, 355, - /* 490 */ 1238, 119, 7, 1238, 1238, 122, 877, 1039, 341, 1322, - /* 500 */ 344, 876, 349, 1144, 1057, 205, 1265, 1266, 1269, 323, - /* 510 */ 1002, 1003, 1005, 1006, 1326, 290, 434, 1056, 879, 289, - /* 520 */ 882, 883, 204, 1055, 926, 1373, 346, 1238, 877, 898, - /* 530 */ 1052, 1, 1321, 9, 8, 903, 258, 401, 118, 270, - /* 540 */ 291, 400, 1371, 1264, 141, 1238, 253, 140, 271, 1133, - /* 550 */ 879, 352, 882, 883, 204, 434, 926, 143, 1238, 886, - /* 560 */ 142, 1051, 402, 1280, 1238, 20, 1050, 877, 1049, 1112, - /* 570 */ 353, 1238, 1129, 1373, 1264, 31, 29, 27, 26, 25, - /* 580 */ 355, 399, 398, 397, 1238, 396, 118, 1036, 1037, 879, - /* 590 */ 1371, 882, 883, 204, 1280, 926, 64, 1265, 1266, 1269, - /* 600 */ 1312, 353, 1238, 145, 1311, 1308, 144, 1238, 1131, 1238, - /* 610 */ 1048, 355, 1047, 1264, 315, 1238, 269, 1046, 1264, 264, - /* 620 */ 263, 262, 261, 260, 1045, 889, 99, 64, 1265, 1266, - /* 630 */ 1269, 1312, 935, 1280, 1001, 351, 1308, 153, 1280, 298, - /* 640 */ 353, 293, 1080, 1127, 297, 353, 42, 296, 1075, 294, - /* 650 */ 355, 1238, 295, 1238, 1238, 355, 1264, 1119, 1238, 1238, - /* 660 */ 1042, 885, 1044, 343, 299, 1238, 108, 1265, 1266, 1269, - /* 670 */ 301, 64, 1265, 1266, 1269, 1312, 1280, 169, 394, 1054, - /* 680 */ 1309, 78, 158, 353, 77, 76, 75, 74, 73, 72, - /* 690 */ 71, 70, 69, 355, 156, 324, 1264, 1238, 1073, 878, - /* 700 */ 237, 1264, 1185, 1238, 342, 1386, 162, 950, 283, 209, - /* 710 */ 1265, 1266, 1269, 1258, 401, 876, 1280, 1342, 400, 32, - /* 720 */ 304, 1280, 910, 353, 865, 1256, 338, 888, 353, 1281, - /* 730 */ 171, 871, 177, 355, 32, 361, 32, 1238, 355, 402, - /* 740 */ 320, 183, 1238, 1264, 175, 2, 190, 96, 898, 209, - /* 750 */ 1265, 1266, 1269, 97, 208, 1265, 1266, 1269, 399, 398, - /* 760 */ 397, 1210, 396, 1280, 121, 22, 259, 267, 266, 434, - /* 770 */ 353, 786, 268, 1264, 272, 31, 29, 27, 26, 25, - /* 780 */ 355, 877, 781, 99, 1238, 906, 333, 126, 31, 29, - /* 790 */ 27, 26, 25, 1280, 42, 1264, 108, 1265, 1266, 1269, - /* 800 */ 353, 273, 274, 879, 814, 882, 883, 818, 905, 824, - /* 810 */ 355, 823, 100, 129, 1238, 1280, 374, 235, 275, 97, - /* 820 */ 437, 98, 353, 99, 97, 278, 209, 1265, 1266, 1269, - /* 830 */ 43, 132, 355, 904, 189, 1387, 1238, 89, 287, 239, - /* 840 */ 285, 314, 227, 426, 317, 188, 59, 88, 209, 1265, - /* 850 */ 1266, 1269, 1041, 1134, 78, 136, 55, 77, 76, 75, - /* 860 */ 74, 73, 72, 71, 70, 69, 1130, 138, 61, 101, - /* 870 */ 1264, 184, 102, 1132, 1128, 103, 87, 86, 85, 84, - /* 880 */ 83, 82, 81, 80, 79, 104, 316, 148, 151, 925, - /* 890 */ 1280, 927, 928, 929, 930, 931, 903, 353, 1353, 325, - /* 900 */ 197, 1264, 365, 359, 154, 199, 883, 355, 322, 1343, - /* 910 */ 157, 1238, 1352, 230, 329, 5, 161, 198, 334, 318, - /* 920 */ 321, 1280, 149, 207, 1265, 1266, 1269, 125, 353, 975, - /* 930 */ 1333, 1264, 31, 29, 27, 26, 25, 111, 355, 4, - /* 940 */ 163, 902, 1238, 92, 1327, 33, 232, 17, 164, 347, - /* 950 */ 350, 1280, 1388, 1264, 210, 1265, 1266, 1269, 353, 1294, - /* 960 */ 1370, 362, 170, 179, 191, 1219, 1218, 357, 355, 358, - /* 970 */ 364, 240, 1238, 1280, 363, 1264, 181, 52, 1145, 54, - /* 980 */ 353, 372, 193, 187, 202, 1265, 1266, 1269, 65, 913, - /* 990 */ 355, 433, 195, 39, 1238, 1280, 200, 1264, 201, 196, - /* 1000 */ 1232, 874, 353, 873, 1226, 120, 211, 1265, 1266, 1269, - /* 1010 */ 848, 1203, 355, 1202, 95, 1201, 1238, 1280, 1200, 1264, - /* 1020 */ 1199, 1198, 1197, 1196, 353, 850, 1195, 1194, 203, 1265, - /* 1030 */ 1266, 1269, 119, 1193, 355, 1192, 1086, 1225, 1238, 1280, - /* 1040 */ 1216, 1264, 128, 1123, 733, 1085, 353, 1083, 279, 281, - /* 1050 */ 212, 1265, 1266, 1269, 1072, 280, 355, 1071, 1068, 1125, - /* 1060 */ 1238, 1280, 68, 1264, 135, 1124, 831, 830, 353, 761, - /* 1070 */ 829, 1081, 1277, 1265, 1266, 1269, 760, 759, 355, 758, - /* 1080 */ 757, 1076, 1238, 1280, 756, 224, 225, 1264, 302, 1074, - /* 1090 */ 353, 226, 1067, 305, 1276, 1265, 1266, 1269, 307, 1066, - /* 1100 */ 355, 309, 66, 1224, 1238, 1223, 36, 1280, 152, 150, - /* 1110 */ 14, 1264, 1215, 3, 353, 32, 1275, 1265, 1266, 1269, - /* 1120 */ 245, 244, 155, 15, 355, 37, 34, 10, 1238, 46, - /* 1130 */ 891, 1280, 160, 1264, 49, 1022, 1000, 994, 353, 993, - /* 1140 */ 218, 1265, 1266, 1269, 972, 109, 884, 1021, 355, 233, - /* 1150 */ 8, 159, 1238, 1280, 47, 1264, 48, 1026, 1256, 971, - /* 1160 */ 353, 19, 1025, 1027, 217, 1265, 1266, 1269, 35, 234, - /* 1170 */ 355, 166, 13, 117, 1238, 1280, 16, 1264, 936, 911, - /* 1180 */ 173, 18, 353, 174, 998, 176, 219, 1265, 1266, 1269, - /* 1190 */ 178, 50, 355, 360, 1214, 180, 1238, 1280, 55, 893, - /* 1200 */ 370, 182, 51, 38, 353, 1255, 185, 371, 216, 1265, - /* 1210 */ 1266, 1269, 887, 815, 355, 375, 134, 373, 1238, 112, - /* 1220 */ 247, 807, 812, 377, 378, 282, 809, 133, 380, 381, - /* 1230 */ 206, 1265, 1266, 1269, 892, 803, 895, 883, 383, 384, - /* 1240 */ 386, 801, 387, 806, 805, 804, 792, 393, 56, 826, - /* 1250 */ 45, 822, 57, 131, 58, 821, 820, 731, 825, 403, - /* 1260 */ 753, 752, 745, 751, 750, 749, 748, 747, 746, 744, - /* 1270 */ 743, 742, 1082, 741, 740, 739, 1070, 738, 1069, 737, - /* 1280 */ 736, 423, 424, 427, 428, 1065, 431, 425, 432, 1040, - /* 1290 */ 880, 194, 435, 436, 1040, 1040, 1040, 1040, 1040, 1040, - /* 1300 */ 130, 1040, 1040, 1040, 127, + /* 0 */ 1264, 344, 24, 174, 363, 363, 258, 243, 1260, 1267, + /* 10 */ 1230, 1231, 31, 29, 27, 26, 25, 1277, 376, 376, + /* 20 */ 9, 8, 95, 69, 69, 31, 29, 27, 26, 25, + /* 30 */ 293, 299, 344, 1386, 108, 62, 1063, 1293, 376, 1154, + /* 40 */ 1154, 348, 1145, 262, 360, 96, 120, 217, 1094, 251, + /* 50 */ 1384, 93, 1146, 95, 362, 375, 1221, 1223, 1251, 1154, + /* 60 */ 217, 167, 1332, 343, 112, 342, 1097, 46, 1386, 923, + /* 70 */ 65, 1278, 1279, 1282, 1325, 1194, 92, 953, 233, 1321, + /* 80 */ 1398, 120, 93, 1251, 1149, 1384, 109, 1121, 966, 1359, + /* 90 */ 953, 346, 116, 1332, 1333, 272, 1337, 429, 428, 427, + /* 100 */ 426, 425, 424, 423, 422, 421, 420, 419, 418, 417, + /* 110 */ 416, 415, 414, 413, 412, 305, 954, 300, 375, 1293, + /* 120 */ 304, 1132, 908, 303, 1049, 301, 360, 80, 302, 954, + /* 130 */ 79, 78, 77, 76, 75, 74, 73, 72, 71, 317, + /* 140 */ 126, 125, 23, 238, 948, 949, 950, 951, 952, 956, + /* 150 */ 957, 958, 315, 375, 334, 23, 238, 948, 949, 950, + /* 160 */ 951, 952, 956, 957, 958, 1277, 12, 284, 31, 29, + /* 170 */ 27, 26, 25, 255, 800, 399, 398, 397, 804, 396, + /* 180 */ 806, 807, 395, 809, 392, 1293, 815, 389, 817, 818, + /* 190 */ 386, 383, 360, 31, 29, 27, 26, 25, 231, 1201, + /* 200 */ 1386, 12, 362, 1074, 30, 28, 1251, 257, 1277, 256, + /* 210 */ 1222, 348, 240, 120, 888, 1264, 1386, 1384, 64, 1278, + /* 220 */ 1279, 1282, 1325, 1260, 1266, 923, 216, 1321, 1293, 1385, + /* 230 */ 886, 46, 121, 1384, 912, 347, 333, 376, 1386, 11, + /* 240 */ 247, 246, 263, 297, 1251, 362, 1218, 296, 1150, 1251, + /* 250 */ 901, 120, 121, 124, 1277, 1384, 121, 1073, 1154, 284, + /* 260 */ 1, 65, 1278, 1279, 1282, 1325, 894, 376, 298, 233, + /* 270 */ 1321, 115, 283, 264, 1293, 339, 335, 30, 28, 990, + /* 280 */ 248, 360, 910, 170, 441, 240, 6, 888, 1154, 326, + /* 290 */ 1352, 362, 30, 28, 1293, 1251, 887, 1264, 1251, 215, + /* 300 */ 240, 360, 888, 886, 1044, 1260, 1266, 66, 1278, 1279, + /* 310 */ 1282, 1325, 11, 1052, 1072, 1324, 1321, 1339, 886, 1014, + /* 320 */ 377, 913, 889, 319, 892, 893, 206, 11, 936, 337, + /* 330 */ 437, 436, 897, 1, 80, 1336, 169, 79, 78, 77, + /* 340 */ 76, 75, 74, 73, 72, 71, 121, 1130, 1, 1051, + /* 350 */ 330, 1012, 1013, 1015, 1016, 1251, 1043, 441, 902, 1071, + /* 360 */ 905, 893, 376, 320, 1070, 1277, 376, 1151, 989, 887, + /* 370 */ 1271, 373, 441, 89, 88, 87, 86, 85, 84, 83, + /* 380 */ 82, 81, 1269, 1154, 887, 1293, 107, 1154, 1277, 338, + /* 390 */ 1386, 1069, 347, 411, 1157, 889, 985, 892, 893, 206, + /* 400 */ 1251, 936, 362, 120, 351, 1251, 1251, 1384, 1293, 121, + /* 410 */ 889, 1277, 892, 893, 206, 360, 936, 727, 65, 1278, + /* 420 */ 1279, 1282, 1325, 155, 1201, 362, 233, 1321, 115, 1251, + /* 430 */ 230, 1293, 1251, 291, 344, 1199, 1339, 728, 360, 727, + /* 440 */ 1068, 65, 1278, 1279, 1282, 1325, 55, 1353, 362, 233, + /* 450 */ 1321, 1398, 1251, 355, 1335, 95, 955, 729, 1067, 1339, + /* 460 */ 1382, 30, 28, 1147, 65, 1278, 1279, 1282, 1325, 240, + /* 470 */ 1277, 888, 233, 1321, 1398, 1131, 911, 1334, 30, 28, + /* 480 */ 361, 1251, 21, 1343, 93, 411, 240, 886, 888, 909, + /* 490 */ 1293, 959, 30, 28, 117, 1332, 1333, 360, 1337, 1251, + /* 500 */ 240, 1066, 888, 194, 886, 244, 1184, 362, 1065, 376, + /* 510 */ 1062, 1251, 141, 107, 374, 139, 348, 7, 886, 988, + /* 520 */ 1061, 1156, 402, 207, 1278, 1279, 1282, 322, 224, 1201, + /* 530 */ 1154, 1064, 408, 1060, 7, 245, 407, 30, 28, 101, + /* 540 */ 1199, 441, 1251, 1386, 1201, 240, 356, 888, 7, 1251, + /* 550 */ 297, 1251, 61, 887, 296, 1200, 120, 409, 441, 997, + /* 560 */ 1384, 1251, 57, 886, 225, 910, 223, 222, 1277, 295, + /* 570 */ 887, 350, 441, 1143, 1251, 298, 406, 405, 404, 889, + /* 580 */ 403, 892, 893, 206, 887, 936, 1139, 376, 1293, 1344, + /* 590 */ 985, 1277, 188, 1, 359, 360, 889, 1141, 892, 893, + /* 600 */ 206, 143, 936, 121, 142, 362, 9, 8, 1154, 1251, + /* 610 */ 889, 1293, 892, 893, 206, 376, 936, 441, 360, 250, + /* 620 */ 254, 66, 1278, 1279, 1282, 1325, 1137, 107, 362, 887, + /* 630 */ 1322, 1201, 1251, 199, 1059, 1156, 1154, 252, 201, 27, + /* 640 */ 26, 25, 1199, 1277, 66, 1278, 1279, 1282, 1325, 1277, + /* 650 */ 200, 344, 358, 1321, 1277, 889, 896, 892, 893, 206, + /* 660 */ 127, 936, 935, 1293, 937, 938, 939, 940, 941, 1293, + /* 670 */ 360, 1011, 95, 1058, 1293, 1251, 360, 1057, 1056, 945, + /* 680 */ 362, 360, 1055, 42, 1251, 145, 362, 1054, 144, 147, + /* 690 */ 1251, 362, 146, 239, 1122, 1251, 110, 1278, 1279, 1282, + /* 700 */ 1277, 93, 211, 1278, 1279, 1282, 1277, 110, 1278, 1279, + /* 710 */ 1282, 118, 1332, 1333, 1251, 1337, 253, 352, 1251, 1251, + /* 720 */ 1293, 67, 899, 1251, 107, 171, 1293, 360, 1251, 1090, + /* 730 */ 1277, 401, 1156, 360, 349, 1399, 888, 362, 44, 43, + /* 740 */ 261, 1251, 122, 362, 327, 331, 1400, 1251, 1046, 1047, + /* 750 */ 1293, 306, 886, 211, 1278, 1279, 1282, 360, 1085, 210, + /* 760 */ 1278, 1279, 1282, 908, 1195, 160, 960, 362, 1277, 121, + /* 770 */ 265, 1251, 1083, 277, 237, 895, 164, 158, 32, 444, + /* 780 */ 308, 290, 278, 211, 1278, 1279, 1282, 20, 1293, 1355, + /* 790 */ 345, 340, 1294, 191, 311, 360, 91, 31, 29, 27, + /* 800 */ 26, 25, 433, 22, 190, 362, 441, 920, 353, 1251, + /* 810 */ 173, 1277, 241, 31, 29, 27, 26, 25, 887, 32, + /* 820 */ 872, 211, 1278, 1279, 1282, 179, 2, 63, 368, 881, + /* 830 */ 186, 1293, 32, 185, 908, 192, 1220, 177, 360, 793, + /* 840 */ 98, 898, 1277, 123, 889, 99, 892, 893, 362, 266, + /* 850 */ 276, 101, 1251, 271, 270, 269, 268, 267, 788, 273, + /* 860 */ 274, 372, 1293, 821, 209, 1278, 1279, 1282, 825, 360, + /* 870 */ 42, 275, 831, 1277, 279, 381, 916, 280, 325, 362, + /* 880 */ 99, 151, 1277, 1251, 100, 128, 31, 29, 27, 26, + /* 890 */ 25, 830, 281, 1293, 102, 212, 1278, 1279, 1282, 915, + /* 900 */ 360, 282, 1293, 101, 1277, 131, 99, 45, 285, 360, + /* 910 */ 362, 134, 914, 1277, 1251, 294, 292, 229, 1144, 362, + /* 920 */ 138, 1140, 90, 1251, 1293, 140, 204, 1278, 1279, 1282, + /* 930 */ 321, 360, 103, 1293, 1129, 213, 1278, 1279, 1282, 150, + /* 940 */ 360, 362, 104, 1277, 1142, 1251, 324, 1138, 105, 106, + /* 950 */ 362, 1277, 153, 913, 1251, 332, 366, 205, 1278, 1279, + /* 960 */ 1282, 1356, 323, 1293, 1366, 156, 214, 1278, 1279, 1282, + /* 970 */ 360, 1293, 329, 893, 1277, 1365, 5, 305, 360, 300, + /* 980 */ 362, 159, 304, 341, 1251, 303, 232, 301, 362, 336, + /* 990 */ 302, 408, 1251, 328, 1293, 407, 1290, 1278, 1279, 1282, + /* 1000 */ 163, 360, 4, 985, 1289, 1278, 1279, 1282, 912, 113, + /* 1010 */ 1346, 362, 165, 1277, 94, 1251, 409, 1340, 33, 166, + /* 1020 */ 234, 1277, 357, 354, 17, 1307, 1229, 1288, 1278, 1279, + /* 1030 */ 1282, 1401, 172, 1293, 364, 406, 405, 404, 1383, 403, + /* 1040 */ 360, 1293, 365, 242, 1277, 1228, 369, 370, 360, 371, + /* 1050 */ 362, 181, 1277, 183, 1251, 310, 193, 1155, 362, 54, + /* 1060 */ 56, 195, 1251, 189, 1293, 379, 220, 1278, 1279, 1282, + /* 1070 */ 318, 360, 1293, 440, 219, 1278, 1279, 1282, 202, 360, + /* 1080 */ 203, 362, 197, 1277, 149, 1251, 198, 313, 1245, 362, + /* 1090 */ 884, 39, 307, 1251, 883, 148, 1239, 221, 1278, 1279, + /* 1100 */ 1282, 1238, 259, 1293, 260, 218, 1278, 1279, 1282, 1237, + /* 1110 */ 360, 1236, 855, 1213, 1212, 97, 1211, 1210, 41, 136, + /* 1120 */ 362, 40, 114, 1209, 1251, 1208, 1207, 1206, 289, 857, + /* 1130 */ 135, 1205, 1204, 1203, 1202, 1096, 208, 1278, 1279, 1282, + /* 1140 */ 1235, 1226, 130, 1133, 1095, 740, 1093, 288, 286, 1082, + /* 1150 */ 1081, 287, 1078, 47, 1135, 70, 133, 137, 838, 837, + /* 1160 */ 836, 1134, 768, 1091, 226, 1086, 767, 766, 765, 227, + /* 1170 */ 1084, 1077, 1076, 228, 764, 763, 68, 314, 309, 316, + /* 1180 */ 1234, 1233, 36, 312, 1225, 154, 48, 3, 14, 32, + /* 1190 */ 111, 152, 15, 37, 34, 10, 51, 8, 946, 367, + /* 1200 */ 162, 184, 832, 132, 1224, 1050, 1050, 129, 1050, 1050, + /* 1210 */ 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1032, 1050, 1050, + /* 1220 */ 1031, 235, 157, 1036, 1035, 236, 1050, 1010, 161, 1050, + /* 1230 */ 903, 1004, 49, 182, 1050, 1003, 50, 1050, 982, 1269, + /* 1240 */ 1050, 829, 981, 1050, 1050, 1037, 1050, 1050, 19, 1050, + /* 1250 */ 1050, 1050, 1050, 1050, 168, 1050, 35, 119, 921, 16, + /* 1260 */ 176, 13, 18, 380, 249, 1008, 178, 180, 175, 52, + /* 1270 */ 53, 384, 387, 1050, 1050, 57, 1092, 390, 1050, 1050, + /* 1280 */ 1268, 393, 799, 1050, 1050, 187, 38, 1050, 827, 760, + /* 1290 */ 738, 822, 382, 752, 438, 1050, 1050, 819, 816, 385, + /* 1300 */ 378, 810, 833, 828, 388, 391, 759, 758, 757, 808, + /* 1310 */ 410, 756, 1080, 1079, 394, 430, 755, 814, 1075, 754, + /* 1320 */ 753, 751, 439, 442, 750, 749, 435, 58, 748, 59, + /* 1330 */ 60, 747, 746, 890, 432, 443, 745, 744, 743, 431, + /* 1340 */ 400, 196, 434, 813, 1050, 1050, 1050, 1050, 1050, 812, + /* 1350 */ 1050, 811, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 220, 185, 237, 238, 216, 216, 225, 219, 228, 229, - /* 10 */ 222, 222, 12, 13, 14, 15, 16, 179, 185, 185, - /* 20 */ 1, 2, 206, 190, 190, 12, 13, 14, 15, 16, - /* 30 */ 197, 197, 185, 252, 178, 184, 180, 199, 185, 206, - /* 40 */ 206, 225, 179, 190, 206, 194, 265, 47, 0, 208, - /* 50 */ 269, 235, 201, 206, 216, 4, 215, 216, 220, 206, - /* 60 */ 47, 245, 246, 247, 198, 249, 0, 187, 252, 69, - /* 70 */ 232, 233, 234, 235, 236, 209, 196, 77, 240, 241, - /* 80 */ 242, 265, 235, 220, 204, 269, 188, 189, 69, 251, - /* 90 */ 77, 244, 245, 246, 247, 185, 249, 49, 50, 51, + /* 0 */ 223, 188, 240, 241, 219, 219, 228, 222, 231, 232, + /* 10 */ 225, 225, 12, 13, 14, 15, 16, 182, 188, 188, + /* 20 */ 1, 2, 209, 193, 193, 12, 13, 14, 15, 16, + /* 30 */ 200, 200, 188, 255, 181, 187, 183, 202, 188, 209, + /* 40 */ 209, 228, 182, 193, 209, 197, 268, 47, 0, 211, + /* 50 */ 272, 238, 204, 209, 219, 20, 218, 219, 223, 209, + /* 60 */ 47, 248, 249, 250, 201, 252, 0, 190, 255, 69, + /* 70 */ 235, 236, 237, 238, 239, 212, 199, 77, 243, 244, + /* 80 */ 245, 268, 238, 223, 207, 272, 191, 192, 69, 254, + /* 90 */ 77, 247, 248, 249, 250, 63, 252, 49, 50, 51, /* 100 */ 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, - /* 110 */ 62, 63, 64, 65, 66, 49, 116, 51, 199, 191, - /* 120 */ 54, 211, 20, 57, 20, 59, 207, 199, 62, 116, - /* 130 */ 12, 13, 14, 15, 16, 207, 20, 0, 138, 139, - /* 140 */ 140, 141, 142, 143, 144, 145, 146, 147, 14, 15, - /* 150 */ 16, 138, 139, 140, 141, 142, 143, 144, 145, 146, - /* 160 */ 147, 83, 84, 85, 86, 87, 88, 89, 90, 91, - /* 170 */ 92, 93, 179, 95, 96, 97, 98, 99, 100, 203, - /* 180 */ 12, 13, 185, 46, 68, 12, 13, 14, 20, 46, - /* 190 */ 22, 203, 199, 20, 179, 22, 220, 21, 125, 206, - /* 200 */ 127, 199, 151, 206, 228, 229, 38, 205, 220, 216, - /* 210 */ 34, 38, 210, 220, 199, 47, 228, 229, 225, 185, - /* 220 */ 47, 206, 191, 150, 190, 232, 233, 234, 235, 236, - /* 230 */ 199, 216, 235, 240, 241, 220, 68, 63, 207, 0, - /* 240 */ 206, 68, 245, 246, 247, 252, 249, 232, 233, 234, - /* 250 */ 235, 236, 150, 199, 22, 240, 241, 242, 265, 205, - /* 260 */ 92, 43, 269, 20, 210, 92, 150, 182, 183, 254, - /* 270 */ 38, 185, 104, 199, 199, 260, 261, 104, 12, 13, - /* 280 */ 206, 206, 108, 109, 35, 46, 20, 179, 22, 171, - /* 290 */ 172, 120, 148, 149, 126, 184, 128, 129, 130, 126, - /* 300 */ 132, 128, 129, 130, 38, 132, 57, 199, 234, 234, - /* 310 */ 61, 225, 201, 47, 206, 20, 252, 22, 150, 179, - /* 320 */ 71, 199, 73, 74, 216, 76, 155, 156, 220, 265, - /* 330 */ 179, 82, 210, 269, 68, 40, 150, 20, 252, 199, - /* 340 */ 232, 233, 234, 235, 236, 46, 206, 185, 240, 241, - /* 350 */ 242, 265, 190, 12, 13, 269, 216, 185, 92, 20, - /* 360 */ 220, 20, 190, 22, 79, 122, 179, 149, 206, 261, - /* 370 */ 104, 220, 232, 233, 234, 235, 236, 199, 206, 38, - /* 380 */ 240, 241, 242, 205, 179, 68, 199, 192, 210, 20, - /* 390 */ 195, 251, 126, 206, 128, 129, 130, 185, 132, 72, - /* 400 */ 191, 179, 75, 216, 12, 13, 14, 220, 199, 68, - /* 410 */ 185, 4, 20, 81, 22, 190, 207, 187, 206, 232, - /* 420 */ 233, 234, 235, 236, 179, 220, 19, 240, 241, 242, - /* 430 */ 38, 206, 116, 92, 204, 14, 12, 13, 251, 81, - /* 440 */ 33, 20, 220, 36, 20, 104, 22, 235, 41, 179, - /* 450 */ 230, 44, 179, 179, 138, 199, 20, 245, 246, 247, - /* 460 */ 68, 249, 38, 147, 20, 220, 210, 126, 248, 128, - /* 470 */ 129, 130, 199, 132, 67, 12, 13, 70, 128, 206, - /* 480 */ 0, 230, 185, 20, 92, 22, 179, 190, 206, 216, - /* 490 */ 220, 150, 68, 220, 220, 213, 104, 176, 225, 248, - /* 500 */ 3, 38, 170, 206, 179, 232, 233, 234, 235, 159, - /* 510 */ 160, 161, 162, 163, 230, 57, 92, 179, 126, 61, - /* 520 */ 128, 129, 130, 179, 132, 252, 168, 220, 104, 20, - /* 530 */ 179, 68, 248, 1, 2, 20, 27, 57, 265, 30, - /* 540 */ 82, 61, 269, 179, 72, 220, 225, 75, 39, 200, - /* 550 */ 126, 47, 128, 129, 130, 92, 132, 72, 220, 38, - /* 560 */ 75, 179, 82, 199, 220, 2, 179, 104, 179, 189, - /* 570 */ 206, 220, 200, 252, 179, 12, 13, 14, 15, 16, - /* 580 */ 216, 101, 102, 103, 220, 105, 265, 174, 175, 126, - /* 590 */ 269, 128, 129, 130, 199, 132, 232, 233, 234, 235, - /* 600 */ 236, 206, 220, 72, 240, 241, 75, 220, 200, 220, - /* 610 */ 179, 216, 179, 179, 69, 220, 107, 179, 179, 110, - /* 620 */ 111, 112, 113, 114, 179, 104, 81, 232, 233, 234, - /* 630 */ 235, 236, 128, 199, 69, 240, 241, 122, 199, 49, - /* 640 */ 206, 51, 0, 200, 54, 206, 81, 57, 0, 59, - /* 650 */ 216, 220, 62, 220, 220, 216, 179, 0, 220, 220, - /* 660 */ 0, 38, 179, 166, 22, 220, 232, 233, 234, 235, - /* 670 */ 22, 232, 233, 234, 235, 236, 199, 272, 200, 180, - /* 680 */ 241, 21, 69, 206, 24, 25, 26, 27, 28, 29, - /* 690 */ 30, 31, 32, 216, 81, 263, 179, 220, 0, 22, - /* 700 */ 223, 179, 209, 220, 270, 271, 257, 69, 182, 232, - /* 710 */ 233, 234, 235, 68, 57, 38, 199, 231, 61, 81, - /* 720 */ 22, 199, 69, 206, 69, 80, 250, 104, 206, 199, - /* 730 */ 266, 124, 69, 216, 81, 69, 81, 220, 216, 82, - /* 740 */ 223, 69, 220, 179, 81, 253, 226, 81, 20, 232, - /* 750 */ 233, 234, 235, 81, 232, 233, 234, 235, 101, 102, - /* 760 */ 103, 185, 105, 199, 115, 2, 214, 116, 212, 92, - /* 770 */ 206, 69, 212, 179, 185, 12, 13, 14, 15, 16, - /* 780 */ 216, 104, 69, 81, 220, 20, 264, 187, 12, 13, - /* 790 */ 14, 15, 16, 199, 81, 179, 232, 233, 234, 235, - /* 800 */ 206, 224, 206, 126, 69, 128, 129, 69, 20, 69, - /* 810 */ 216, 69, 69, 187, 220, 199, 81, 223, 217, 81, - /* 820 */ 19, 81, 206, 81, 81, 185, 232, 233, 234, 235, - /* 830 */ 187, 187, 216, 20, 33, 271, 220, 36, 199, 223, - /* 840 */ 181, 224, 181, 42, 217, 44, 68, 185, 232, 233, - /* 850 */ 234, 235, 0, 199, 21, 199, 78, 24, 25, 26, - /* 860 */ 27, 28, 29, 30, 31, 32, 199, 199, 67, 199, - /* 870 */ 179, 70, 199, 199, 199, 199, 24, 25, 26, 27, - /* 880 */ 28, 29, 30, 31, 32, 199, 206, 184, 184, 131, - /* 890 */ 199, 133, 134, 135, 136, 137, 20, 206, 262, 158, - /* 900 */ 18, 179, 101, 157, 221, 23, 129, 216, 220, 231, - /* 910 */ 221, 220, 262, 220, 220, 165, 258, 35, 164, 118, - /* 920 */ 153, 199, 121, 232, 233, 234, 235, 45, 206, 149, - /* 930 */ 259, 179, 12, 13, 14, 15, 16, 256, 216, 152, - /* 940 */ 255, 20, 220, 206, 230, 115, 173, 68, 243, 167, - /* 950 */ 169, 199, 273, 179, 232, 233, 234, 235, 206, 239, - /* 960 */ 268, 119, 267, 206, 195, 221, 221, 220, 216, 220, - /* 970 */ 217, 220, 220, 199, 218, 179, 184, 184, 206, 68, - /* 980 */ 206, 202, 185, 184, 232, 233, 234, 235, 106, 69, - /* 990 */ 216, 181, 186, 227, 220, 199, 193, 179, 193, 177, - /* 1000 */ 0, 104, 206, 126, 0, 123, 232, 233, 234, 235, - /* 1010 */ 80, 0, 216, 0, 115, 0, 220, 199, 0, 179, - /* 1020 */ 0, 0, 0, 0, 206, 22, 0, 0, 232, 233, - /* 1030 */ 234, 235, 150, 0, 216, 0, 0, 0, 220, 199, - /* 1040 */ 0, 179, 43, 0, 48, 0, 206, 0, 38, 43, - /* 1050 */ 232, 233, 234, 235, 0, 36, 216, 0, 0, 0, - /* 1060 */ 220, 199, 77, 179, 75, 0, 38, 38, 206, 38, - /* 1070 */ 22, 0, 232, 233, 234, 235, 38, 38, 216, 38, - /* 1080 */ 38, 0, 220, 199, 38, 22, 22, 179, 39, 0, - /* 1090 */ 206, 22, 0, 38, 232, 233, 234, 235, 22, 0, - /* 1100 */ 216, 22, 20, 0, 220, 0, 122, 199, 117, 43, - /* 1110 */ 154, 179, 0, 81, 206, 81, 232, 233, 234, 235, - /* 1120 */ 12, 13, 69, 154, 216, 81, 148, 154, 220, 68, - /* 1130 */ 22, 199, 81, 179, 4, 38, 69, 69, 206, 69, - /* 1140 */ 232, 233, 234, 235, 69, 68, 38, 38, 216, 38, - /* 1150 */ 2, 68, 220, 199, 68, 179, 68, 38, 80, 69, - /* 1160 */ 206, 81, 38, 69, 232, 233, 234, 235, 81, 38, - /* 1170 */ 216, 80, 68, 80, 220, 199, 81, 179, 128, 69, - /* 1180 */ 80, 68, 206, 69, 69, 68, 232, 233, 234, 235, - /* 1190 */ 68, 68, 216, 120, 0, 43, 220, 199, 78, 22, - /* 1200 */ 92, 117, 68, 68, 206, 80, 80, 79, 232, 233, - /* 1210 */ 234, 235, 104, 69, 216, 68, 33, 38, 220, 36, - /* 1220 */ 38, 94, 69, 38, 68, 42, 69, 44, 38, 68, - /* 1230 */ 232, 233, 234, 235, 126, 69, 128, 129, 38, 68, - /* 1240 */ 38, 69, 68, 94, 94, 94, 22, 82, 68, 38, - /* 1250 */ 67, 38, 68, 70, 68, 38, 22, 48, 104, 47, - /* 1260 */ 22, 38, 22, 38, 38, 38, 38, 38, 38, 38, - /* 1270 */ 38, 38, 0, 38, 38, 38, 0, 38, 0, 38, - /* 1280 */ 38, 38, 36, 38, 37, 0, 22, 43, 21, 274, - /* 1290 */ 22, 22, 21, 20, 274, 274, 274, 274, 274, 274, - /* 1300 */ 117, 274, 274, 274, 121, 274, 274, 274, 274, 274, - /* 1310 */ 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, - /* 1320 */ 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, - /* 1330 */ 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, - /* 1340 */ 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, - /* 1350 */ 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, - /* 1360 */ 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, - /* 1370 */ 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, - /* 1380 */ 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, - /* 1390 */ 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, - /* 1400 */ 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, - /* 1410 */ 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, - /* 1420 */ 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, - /* 1430 */ 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, - /* 1440 */ 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, - /* 1450 */ 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, - /* 1460 */ 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + /* 110 */ 62, 63, 64, 65, 66, 49, 116, 51, 20, 202, + /* 120 */ 54, 0, 20, 57, 179, 59, 209, 21, 62, 116, + /* 130 */ 24, 25, 26, 27, 28, 29, 30, 31, 32, 21, + /* 140 */ 108, 109, 142, 143, 144, 145, 146, 147, 148, 149, + /* 150 */ 150, 151, 34, 20, 237, 142, 143, 144, 145, 146, + /* 160 */ 147, 148, 149, 150, 151, 182, 68, 46, 12, 13, + /* 170 */ 14, 15, 16, 228, 83, 84, 85, 86, 87, 88, + /* 180 */ 89, 90, 91, 92, 93, 202, 95, 96, 97, 98, + /* 190 */ 99, 100, 209, 12, 13, 14, 15, 16, 206, 202, + /* 200 */ 255, 68, 219, 182, 12, 13, 223, 129, 182, 131, + /* 210 */ 213, 228, 20, 268, 22, 223, 255, 272, 235, 236, + /* 220 */ 237, 238, 239, 231, 232, 69, 243, 244, 202, 268, + /* 230 */ 38, 190, 154, 272, 20, 209, 120, 188, 255, 47, + /* 240 */ 12, 13, 193, 57, 223, 219, 209, 61, 207, 223, + /* 250 */ 22, 268, 154, 216, 182, 272, 154, 182, 209, 46, + /* 260 */ 68, 235, 236, 237, 238, 239, 38, 188, 82, 243, + /* 270 */ 244, 245, 193, 188, 202, 159, 160, 12, 13, 14, + /* 280 */ 206, 209, 20, 257, 92, 20, 43, 22, 209, 263, + /* 290 */ 264, 219, 12, 13, 202, 223, 104, 223, 223, 214, + /* 300 */ 20, 209, 22, 38, 123, 231, 232, 235, 236, 237, + /* 310 */ 238, 239, 47, 0, 182, 243, 244, 233, 38, 132, + /* 320 */ 92, 20, 130, 188, 132, 133, 134, 47, 136, 237, + /* 330 */ 185, 186, 104, 68, 21, 251, 122, 24, 25, 26, + /* 340 */ 27, 28, 29, 30, 31, 32, 154, 0, 68, 0, + /* 350 */ 163, 164, 165, 166, 167, 223, 175, 92, 130, 182, + /* 360 */ 132, 133, 188, 228, 182, 182, 188, 193, 4, 104, + /* 370 */ 68, 193, 92, 24, 25, 26, 27, 28, 29, 30, + /* 380 */ 31, 32, 80, 209, 104, 202, 202, 209, 182, 20, + /* 390 */ 255, 182, 209, 46, 210, 130, 153, 132, 133, 134, + /* 400 */ 223, 136, 219, 268, 3, 223, 223, 272, 202, 154, + /* 410 */ 130, 182, 132, 133, 134, 209, 136, 22, 235, 236, + /* 420 */ 237, 238, 239, 122, 202, 219, 243, 244, 245, 223, + /* 430 */ 208, 202, 223, 38, 188, 213, 233, 20, 209, 22, + /* 440 */ 182, 235, 236, 237, 238, 239, 187, 264, 219, 243, + /* 450 */ 244, 245, 223, 81, 251, 209, 116, 40, 182, 233, + /* 460 */ 254, 12, 13, 204, 235, 236, 237, 238, 239, 20, + /* 470 */ 182, 22, 243, 244, 245, 0, 20, 251, 12, 13, + /* 480 */ 14, 223, 142, 254, 238, 46, 20, 38, 22, 20, + /* 490 */ 202, 151, 12, 13, 248, 249, 250, 209, 252, 223, + /* 500 */ 20, 182, 22, 195, 38, 194, 198, 219, 182, 188, + /* 510 */ 182, 223, 72, 202, 193, 75, 228, 68, 38, 155, + /* 520 */ 182, 210, 79, 235, 236, 237, 238, 69, 35, 202, + /* 530 */ 209, 183, 57, 182, 68, 208, 61, 12, 13, 81, + /* 540 */ 213, 92, 223, 255, 202, 20, 174, 22, 68, 223, + /* 550 */ 57, 223, 68, 104, 61, 213, 268, 82, 92, 14, + /* 560 */ 272, 223, 78, 38, 71, 20, 73, 74, 182, 76, + /* 570 */ 104, 170, 92, 203, 223, 82, 101, 102, 103, 130, + /* 580 */ 105, 132, 133, 134, 104, 136, 203, 188, 202, 152, + /* 590 */ 153, 182, 193, 68, 47, 209, 130, 203, 132, 133, + /* 600 */ 134, 72, 136, 154, 75, 219, 1, 2, 209, 223, + /* 610 */ 130, 202, 132, 133, 134, 188, 136, 92, 209, 194, + /* 620 */ 193, 235, 236, 237, 238, 239, 203, 202, 219, 104, + /* 630 */ 244, 202, 223, 18, 182, 210, 209, 208, 23, 14, + /* 640 */ 15, 16, 213, 182, 235, 236, 237, 238, 239, 182, + /* 650 */ 35, 188, 243, 244, 182, 130, 38, 132, 133, 134, + /* 660 */ 45, 136, 135, 202, 137, 138, 139, 140, 141, 202, + /* 670 */ 209, 69, 209, 182, 202, 223, 209, 182, 182, 132, + /* 680 */ 219, 209, 182, 81, 223, 72, 219, 182, 75, 72, + /* 690 */ 223, 219, 75, 226, 192, 223, 235, 236, 237, 238, + /* 700 */ 182, 238, 235, 236, 237, 238, 182, 235, 236, 237, + /* 710 */ 238, 248, 249, 250, 223, 252, 194, 81, 223, 223, + /* 720 */ 202, 106, 104, 223, 202, 275, 202, 209, 223, 0, + /* 730 */ 182, 203, 210, 209, 273, 274, 22, 219, 123, 124, + /* 740 */ 125, 223, 127, 219, 226, 266, 274, 223, 177, 178, + /* 750 */ 202, 22, 38, 235, 236, 237, 238, 209, 0, 235, + /* 760 */ 236, 237, 238, 20, 212, 69, 69, 219, 182, 154, + /* 770 */ 27, 223, 0, 30, 226, 38, 260, 81, 81, 19, + /* 780 */ 22, 185, 39, 235, 236, 237, 238, 2, 202, 234, + /* 790 */ 253, 267, 202, 33, 22, 209, 36, 12, 13, 14, + /* 800 */ 15, 16, 42, 2, 44, 219, 92, 69, 172, 223, + /* 810 */ 269, 182, 226, 12, 13, 14, 15, 16, 104, 81, + /* 820 */ 69, 235, 236, 237, 238, 69, 256, 67, 69, 128, + /* 830 */ 70, 202, 81, 69, 20, 229, 188, 81, 209, 69, + /* 840 */ 81, 104, 182, 115, 130, 81, 132, 133, 219, 217, + /* 850 */ 107, 81, 223, 110, 111, 112, 113, 114, 69, 215, + /* 860 */ 116, 101, 202, 69, 235, 236, 237, 238, 69, 209, + /* 870 */ 81, 215, 69, 182, 188, 81, 20, 227, 118, 219, + /* 880 */ 81, 121, 182, 223, 81, 190, 12, 13, 14, 15, + /* 890 */ 16, 69, 209, 202, 69, 235, 236, 237, 238, 20, + /* 900 */ 209, 220, 202, 81, 182, 190, 81, 190, 188, 209, + /* 910 */ 219, 190, 20, 182, 223, 202, 184, 184, 202, 219, + /* 920 */ 202, 202, 188, 223, 202, 202, 235, 236, 237, 238, + /* 930 */ 227, 209, 202, 202, 0, 235, 236, 237, 238, 187, + /* 940 */ 209, 219, 202, 182, 202, 223, 220, 202, 202, 202, + /* 950 */ 219, 182, 187, 20, 223, 162, 161, 235, 236, 237, + /* 960 */ 238, 234, 209, 202, 265, 224, 235, 236, 237, 238, + /* 970 */ 209, 202, 223, 133, 182, 265, 169, 49, 209, 51, + /* 980 */ 219, 224, 54, 168, 223, 57, 223, 59, 219, 223, + /* 990 */ 62, 57, 223, 157, 202, 61, 235, 236, 237, 238, + /* 1000 */ 261, 209, 156, 153, 235, 236, 237, 238, 20, 259, + /* 1010 */ 262, 219, 258, 182, 209, 223, 82, 233, 115, 246, + /* 1020 */ 176, 182, 173, 171, 68, 242, 224, 235, 236, 237, + /* 1030 */ 238, 276, 270, 202, 223, 101, 102, 103, 271, 105, + /* 1040 */ 209, 202, 223, 223, 182, 224, 119, 221, 209, 220, + /* 1050 */ 219, 209, 182, 187, 223, 4, 198, 209, 219, 187, + /* 1060 */ 68, 188, 223, 187, 202, 205, 235, 236, 237, 238, + /* 1070 */ 19, 209, 202, 184, 235, 236, 237, 238, 196, 209, + /* 1080 */ 196, 219, 189, 182, 33, 223, 180, 36, 0, 219, + /* 1090 */ 104, 230, 41, 223, 130, 44, 0, 235, 236, 237, + /* 1100 */ 238, 0, 50, 202, 126, 235, 236, 237, 238, 0, + /* 1110 */ 209, 0, 80, 0, 0, 115, 0, 0, 67, 33, + /* 1120 */ 219, 70, 36, 0, 223, 0, 0, 0, 42, 22, + /* 1130 */ 44, 0, 0, 0, 0, 0, 235, 236, 237, 238, + /* 1140 */ 0, 0, 43, 0, 0, 48, 0, 43, 38, 0, + /* 1150 */ 0, 36, 0, 67, 0, 77, 70, 75, 38, 38, + /* 1160 */ 22, 0, 38, 0, 22, 0, 38, 38, 38, 22, + /* 1170 */ 0, 0, 0, 22, 38, 38, 20, 22, 39, 22, + /* 1180 */ 0, 0, 122, 38, 0, 117, 68, 81, 158, 81, + /* 1190 */ 68, 43, 158, 81, 152, 158, 4, 2, 132, 120, + /* 1200 */ 81, 117, 104, 117, 0, 277, 277, 121, 277, 277, + /* 1210 */ 277, 277, 277, 277, 277, 277, 277, 38, 277, 277, + /* 1220 */ 38, 38, 69, 38, 38, 38, 277, 69, 68, 277, + /* 1230 */ 22, 69, 68, 43, 277, 69, 68, 277, 69, 80, + /* 1240 */ 277, 38, 69, 277, 277, 69, 277, 277, 81, 277, + /* 1250 */ 277, 277, 277, 277, 80, 277, 81, 80, 69, 81, + /* 1260 */ 69, 68, 68, 38, 38, 69, 68, 68, 80, 68, + /* 1270 */ 68, 38, 38, 277, 277, 78, 0, 38, 277, 277, + /* 1280 */ 80, 38, 22, 277, 277, 80, 68, 277, 22, 22, + /* 1290 */ 48, 69, 68, 22, 22, 277, 277, 69, 69, 68, + /* 1300 */ 79, 69, 38, 38, 68, 68, 38, 38, 38, 69, + /* 1310 */ 47, 38, 0, 0, 68, 38, 38, 94, 0, 38, + /* 1320 */ 38, 38, 21, 21, 38, 38, 37, 68, 38, 68, + /* 1330 */ 68, 38, 38, 22, 43, 20, 38, 38, 38, 36, + /* 1340 */ 82, 22, 38, 94, 277, 277, 277, 277, 277, 94, + /* 1350 */ 277, 94, 277, 277, 277, 277, 277, 277, 277, 277, + /* 1360 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, + /* 1370 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, + /* 1380 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, + /* 1390 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, + /* 1400 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, + /* 1410 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, + /* 1420 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, + /* 1430 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, + /* 1440 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, + /* 1450 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, + /* 1460 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, + /* 1470 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, + /* 1480 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, + /* 1490 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, + /* 1500 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, + /* 1510 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, + /* 1520 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, + /* 1530 */ 277, }; -#define YY_SHIFT_COUNT (437) +#define YY_SHIFT_COUNT (444) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (1285) +#define YY_SHIFT_MAX (1319) static const unsigned short int yy_shift_ofst[] = { - /* 0 */ 882, 168, 173, 266, 266, 266, 266, 341, 266, 266, - /* 10 */ 424, 463, 116, 392, 424, 424, 424, 424, 424, 424, - /* 20 */ 424, 424, 424, 424, 424, 424, 424, 424, 424, 424, - /* 30 */ 424, 424, 424, 317, 317, 317, 102, 1108, 1108, 73, - /* 40 */ 104, 104, 1108, 104, 104, 143, 339, 369, 369, 186, - /* 50 */ 436, 339, 104, 104, 339, 104, 339, 436, 339, 339, - /* 60 */ 104, 299, 0, 13, 13, 509, 833, 249, 677, 677, - /* 70 */ 677, 677, 677, 677, 677, 677, 677, 677, 677, 677, - /* 80 */ 677, 677, 677, 677, 677, 677, 677, 677, 590, 295, - /* 90 */ 137, 243, 243, 243, 239, 444, 436, 339, 339, 339, - /* 100 */ 285, 78, 78, 78, 78, 78, 660, 66, 118, 350, - /* 110 */ 458, 171, 232, 515, 144, 218, 144, 421, 497, 51, - /* 120 */ 607, 728, 649, 651, 651, 728, 765, 143, 444, 788, - /* 130 */ 143, 143, 728, 143, 813, 339, 339, 339, 339, 339, - /* 140 */ 339, 339, 339, 339, 339, 339, 728, 813, 765, 299, - /* 150 */ 444, 788, 299, 876, 741, 746, 777, 741, 746, 777, - /* 160 */ 777, 750, 754, 767, 787, 780, 444, 921, 830, 773, - /* 170 */ 781, 782, 879, 339, 746, 777, 777, 746, 777, 842, - /* 180 */ 444, 788, 299, 285, 299, 444, 911, 728, 299, 813, - /* 190 */ 1305, 1305, 1305, 1305, 1305, 48, 852, 801, 1183, 407, - /* 200 */ 480, 657, 563, 763, 758, 920, 776, 776, 776, 776, - /* 210 */ 776, 776, 776, 174, 19, 316, 134, 134, 134, 134, - /* 220 */ 327, 472, 485, 531, 642, 648, 698, 176, 545, 565, - /* 230 */ 613, 532, 413, 358, 332, 638, 504, 653, 645, 655, - /* 240 */ 663, 666, 672, 702, 521, 623, 713, 735, 738, 740, - /* 250 */ 742, 743, 778, 1000, 897, 877, 1004, 930, 1011, 1013, - /* 260 */ 899, 1015, 1018, 1020, 1021, 1022, 1023, 1003, 1026, 1027, - /* 270 */ 1033, 1035, 1036, 1037, 1040, 999, 1043, 996, 1045, 1047, - /* 280 */ 1010, 1019, 1006, 1054, 1057, 1058, 1059, 985, 989, 1028, - /* 290 */ 1029, 1048, 1065, 1031, 1038, 1039, 1041, 1042, 1046, 1071, - /* 300 */ 1063, 1081, 1064, 1049, 1089, 1069, 1055, 1092, 1076, 1099, - /* 310 */ 1079, 1082, 1103, 1105, 984, 1112, 1061, 1066, 991, 1032, - /* 320 */ 1034, 956, 1053, 1044, 1067, 1077, 1083, 1068, 1086, 1070, - /* 330 */ 1051, 1078, 1088, 1080, 969, 1075, 1090, 1091, 978, 1087, - /* 340 */ 1093, 1094, 1095, 973, 1130, 1097, 1109, 1111, 1119, 1124, - /* 350 */ 1131, 1148, 1050, 1100, 1110, 1104, 1113, 1114, 1115, 1117, - /* 360 */ 1122, 1073, 1123, 1194, 1152, 1084, 1134, 1120, 1125, 1126, - /* 370 */ 1177, 1135, 1128, 1144, 1179, 1182, 1147, 1153, 1185, 1156, - /* 380 */ 1157, 1190, 1161, 1166, 1200, 1171, 1172, 1202, 1174, 1127, - /* 390 */ 1149, 1150, 1151, 1224, 1165, 1180, 1211, 1154, 1184, 1186, - /* 400 */ 1213, 1217, 1234, 1209, 1212, 1238, 1223, 1225, 1226, 1227, - /* 410 */ 1228, 1229, 1230, 1240, 1231, 1232, 1233, 1235, 1236, 1237, - /* 420 */ 1239, 1241, 1242, 1272, 1243, 1246, 1244, 1276, 1245, 1247, - /* 430 */ 1278, 1285, 1264, 1267, 1268, 1269, 1271, 1273, + /* 0 */ 615, 192, 265, 280, 280, 280, 280, 449, 280, 280, + /* 10 */ 480, 525, 98, 466, 480, 480, 480, 480, 480, 480, + /* 20 */ 480, 480, 480, 480, 480, 480, 480, 480, 480, 480, + /* 30 */ 480, 480, 480, 133, 133, 133, 102, 228, 228, 78, + /* 40 */ 35, 35, 228, 35, 35, 35, 35, 213, 262, 369, + /* 50 */ 369, 255, 456, 262, 35, 35, 262, 35, 262, 456, + /* 60 */ 262, 262, 35, 439, 0, 13, 13, 743, 106, 493, + /* 70 */ 714, 714, 714, 714, 714, 714, 714, 714, 714, 714, + /* 80 */ 714, 714, 714, 714, 714, 714, 714, 714, 714, 714, + /* 90 */ 928, 417, 121, 214, 214, 214, 347, 469, 456, 262, + /* 100 */ 262, 262, 443, 91, 91, 91, 91, 91, 313, 66, + /* 110 */ 181, 187, 186, 116, 395, 301, 437, 243, 437, 545, + /* 120 */ 401, 364, 701, 814, 728, 744, 744, 814, 856, 213, + /* 130 */ 469, 879, 213, 213, 814, 213, 892, 262, 262, 262, + /* 140 */ 262, 262, 262, 262, 262, 262, 262, 262, 814, 892, + /* 150 */ 856, 439, 469, 879, 439, 933, 793, 795, 840, 793, + /* 160 */ 795, 840, 840, 807, 815, 836, 846, 850, 469, 988, + /* 170 */ 903, 844, 849, 852, 956, 262, 795, 840, 840, 795, + /* 180 */ 840, 927, 469, 879, 439, 443, 439, 469, 992, 814, + /* 190 */ 439, 892, 1352, 1352, 1352, 1352, 1352, 48, 349, 760, + /* 200 */ 1086, 1051, 475, 934, 785, 801, 527, 156, 874, 874, + /* 210 */ 874, 874, 874, 874, 874, 32, 19, 340, 625, 625, + /* 220 */ 625, 625, 440, 529, 613, 617, 729, 758, 772, 118, + /* 230 */ 458, 602, 696, 605, 571, 636, 372, 697, 547, 738, + /* 240 */ 302, 751, 756, 759, 764, 770, 618, 737, 789, 794, + /* 250 */ 799, 803, 822, 825, 484, 1088, 986, 964, 1096, 1101, + /* 260 */ 1052, 978, 1109, 1111, 1032, 1113, 1114, 1000, 1116, 1117, + /* 270 */ 1123, 1125, 1126, 1127, 1107, 1131, 1132, 1133, 1134, 1135, + /* 280 */ 1140, 1141, 1099, 1143, 1097, 1144, 1146, 1110, 1115, 1104, + /* 290 */ 1149, 1150, 1152, 1154, 1078, 1082, 1120, 1121, 1138, 1161, + /* 300 */ 1124, 1128, 1129, 1130, 1136, 1137, 1163, 1142, 1165, 1147, + /* 310 */ 1139, 1170, 1151, 1145, 1171, 1155, 1172, 1157, 1156, 1180, + /* 320 */ 1181, 1060, 1184, 1118, 1148, 1068, 1106, 1108, 1030, 1153, + /* 330 */ 1112, 1158, 1122, 1160, 1162, 1164, 1166, 1119, 1159, 1168, + /* 340 */ 1167, 1034, 1169, 1173, 1174, 1042, 1175, 1177, 1176, 1178, + /* 350 */ 1037, 1192, 1179, 1182, 1183, 1185, 1186, 1187, 1195, 1066, + /* 360 */ 1188, 1189, 1193, 1194, 1191, 1196, 1198, 1199, 1079, 1201, + /* 370 */ 1204, 1190, 1084, 1202, 1197, 1200, 1205, 1208, 1218, 1221, + /* 380 */ 1222, 1225, 1226, 1224, 1228, 1233, 1231, 1229, 1234, 1236, + /* 390 */ 1232, 1239, 1237, 1240, 1243, 1246, 1223, 1249, 1255, 1257, + /* 400 */ 1260, 1258, 1259, 1264, 1098, 1261, 1262, 1203, 1265, 1266, + /* 410 */ 1242, 1263, 1267, 1268, 1269, 1270, 1273, 1278, 1281, 1282, + /* 420 */ 1271, 1283, 1286, 1287, 1290, 1293, 1294, 1298, 1299, 1300, + /* 430 */ 1276, 1277, 1303, 1291, 1312, 1304, 1289, 1313, 1318, 1272, + /* 440 */ 1301, 1311, 1319, 1302, 1315, }; -#define YY_REDUCE_COUNT (194) -#define YY_REDUCE_MIN (-235) -#define YY_REDUCE_MAX (998) +#define YY_REDUCE_COUNT (196) +#define YY_REDUCE_MIN (-238) +#define YY_REDUCE_MAX (906) static const short yy_reduce_ofst[] = { - /* 0 */ 321, -7, 15, 108, -162, 140, 187, 273, 364, 395, - /* 10 */ 434, 439, -184, 477, 517, 522, 564, 594, 616, 691, - /* 20 */ 722, 752, 774, 796, 818, 840, 862, 884, 908, 932, - /* 30 */ 954, 976, 998, -153, -3, 212, 86, -24, -12, -219, - /* 40 */ -167, -166, -220, -147, 34, -120, 2, 74, 75, 64, - /* 50 */ -212, -72, 162, 172, 54, 225, 31, -159, 178, 209, - /* 60 */ 297, -149, -235, -235, -235, -90, -144, -134, -137, 151, - /* 70 */ 205, 222, 245, 270, 274, 307, 325, 338, 344, 351, - /* 80 */ 382, 387, 389, 431, 433, 438, 445, 483, -102, 85, - /* 90 */ 230, 220, 251, 284, 111, 282, -211, -81, 122, 256, - /* 100 */ 195, 349, 372, 408, 443, 478, 499, 380, 405, 432, - /* 110 */ 493, 449, 526, 486, 476, 476, 476, 530, 464, 492, - /* 120 */ 520, 576, 552, 556, 560, 589, 577, 600, 596, 601, - /* 130 */ 626, 643, 640, 644, 659, 639, 654, 656, 667, 668, - /* 140 */ 670, 673, 674, 675, 676, 686, 662, 661, 617, 703, - /* 150 */ 680, 627, 704, 678, 636, 683, 688, 650, 689, 693, - /* 160 */ 694, 671, 658, 681, 685, 476, 737, 714, 705, 679, - /* 170 */ 692, 695, 720, 530, 744, 747, 749, 745, 751, 756, - /* 180 */ 757, 753, 792, 769, 793, 772, 779, 797, 799, 810, - /* 190 */ 766, 803, 805, 806, 822, + /* 0 */ -55, -17, 26, 183, -165, 206, 229, 288, 72, 409, + /* 10 */ 461, 386, -187, 467, 518, 524, 472, 548, 586, 629, + /* 20 */ 660, 691, 700, 722, 731, 761, 769, 792, 831, 839, + /* 30 */ 862, 870, 901, -156, 246, 463, 135, -8, 74, -222, + /* 40 */ -170, -169, -223, -150, 49, 79, 174, -123, 222, -83, + /* 50 */ 92, -39, -215, 311, 178, 321, 327, 399, 425, -162, + /* 60 */ 429, 522, 427, -152, -238, -238, -238, 85, -147, -137, + /* 70 */ -140, 21, 75, 132, 177, 182, 209, 258, 276, 319, + /* 80 */ 326, 328, 338, 351, 452, 491, 495, 496, 500, 505, + /* 90 */ -105, 145, 41, 84, 203, 226, 259, 37, -214, 184, + /* 100 */ -3, 342, 308, 370, 383, 394, 423, 528, 348, 502, + /* 110 */ 450, 479, 552, 516, 596, 555, 537, 537, 537, 590, + /* 120 */ 541, 570, 606, 648, 632, 644, 656, 686, 650, 695, + /* 130 */ 683, 681, 715, 717, 720, 721, 732, 713, 716, 718, + /* 140 */ 719, 723, 730, 740, 742, 745, 746, 747, 734, 733, + /* 150 */ 703, 752, 753, 726, 765, 727, 699, 741, 749, 710, + /* 160 */ 757, 763, 766, 748, 739, 750, 754, 537, 805, 784, + /* 170 */ 773, 755, 767, 762, 783, 590, 802, 811, 819, 821, + /* 180 */ 820, 826, 842, 829, 866, 858, 872, 848, 860, 873, + /* 190 */ 876, 889, 861, 882, 884, 893, 906, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, - /* 10 */ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, - /* 20 */ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, - /* 30 */ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, - /* 40 */ 1038, 1038, 1038, 1038, 1038, 1091, 1038, 1038, 1038, 1038, - /* 50 */ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, - /* 60 */ 1038, 1089, 1038, 1314, 1038, 1204, 1038, 1038, 1038, 1038, - /* 70 */ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, - /* 80 */ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, - /* 90 */ 1091, 1325, 1325, 1325, 1089, 1038, 1038, 1038, 1038, 1038, - /* 100 */ 1173, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1389, 1038, - /* 110 */ 1126, 1349, 1038, 1341, 1317, 1331, 1318, 1038, 1374, 1334, - /* 120 */ 1227, 1038, 1209, 1206, 1206, 1038, 1038, 1091, 1038, 1038, - /* 130 */ 1091, 1091, 1038, 1091, 1038, 1038, 1038, 1038, 1038, 1038, - /* 140 */ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1089, - /* 150 */ 1038, 1038, 1089, 1038, 1356, 1354, 1038, 1356, 1354, 1038, - /* 160 */ 1038, 1368, 1364, 1347, 1345, 1331, 1038, 1038, 1038, 1392, - /* 170 */ 1380, 1376, 1038, 1038, 1354, 1038, 1038, 1354, 1038, 1217, - /* 180 */ 1038, 1038, 1089, 1038, 1089, 1038, 1142, 1038, 1089, 1038, - /* 190 */ 1229, 1176, 1176, 1092, 1043, 1038, 1038, 1038, 1038, 1038, - /* 200 */ 1038, 1038, 1038, 1038, 1038, 1038, 1279, 1367, 1366, 1278, - /* 210 */ 1291, 1290, 1289, 1038, 1038, 1038, 1273, 1274, 1272, 1271, - /* 220 */ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, - /* 230 */ 1038, 1315, 1038, 1377, 1381, 1038, 1038, 1038, 1257, 1038, - /* 240 */ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, - /* 250 */ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, - /* 260 */ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, - /* 270 */ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, - /* 280 */ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, - /* 290 */ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, - /* 300 */ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, - /* 310 */ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1338, - /* 320 */ 1348, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, - /* 330 */ 1038, 1257, 1038, 1365, 1038, 1324, 1320, 1038, 1038, 1316, - /* 340 */ 1038, 1038, 1375, 1038, 1038, 1038, 1038, 1038, 1038, 1038, - /* 350 */ 1038, 1310, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, - /* 360 */ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1256, 1038, - /* 370 */ 1038, 1038, 1038, 1038, 1038, 1038, 1170, 1038, 1038, 1038, - /* 380 */ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1155, - /* 390 */ 1153, 1152, 1151, 1038, 1148, 1038, 1038, 1038, 1038, 1038, - /* 400 */ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, - /* 410 */ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, - /* 420 */ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, - /* 430 */ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, + /* 0 */ 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, + /* 10 */ 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, + /* 20 */ 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, + /* 30 */ 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, + /* 40 */ 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1101, 1048, 1048, + /* 50 */ 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, + /* 60 */ 1048, 1048, 1048, 1099, 1048, 1327, 1048, 1214, 1048, 1048, + /* 70 */ 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, + /* 80 */ 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, + /* 90 */ 1048, 1048, 1101, 1338, 1338, 1338, 1099, 1048, 1048, 1048, + /* 100 */ 1048, 1048, 1183, 1048, 1048, 1048, 1048, 1048, 1048, 1048, + /* 110 */ 1402, 1048, 1136, 1362, 1048, 1354, 1330, 1344, 1331, 1048, + /* 120 */ 1387, 1347, 1240, 1048, 1219, 1216, 1216, 1048, 1048, 1101, + /* 130 */ 1048, 1048, 1101, 1101, 1048, 1101, 1048, 1048, 1048, 1048, + /* 140 */ 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, + /* 150 */ 1048, 1099, 1048, 1048, 1099, 1048, 1369, 1367, 1048, 1369, + /* 160 */ 1367, 1048, 1048, 1381, 1377, 1360, 1358, 1344, 1048, 1048, + /* 170 */ 1048, 1405, 1393, 1389, 1048, 1048, 1367, 1048, 1048, 1367, + /* 180 */ 1048, 1227, 1048, 1048, 1099, 1048, 1099, 1048, 1152, 1048, + /* 190 */ 1099, 1048, 1242, 1186, 1186, 1102, 1053, 1048, 1048, 1048, + /* 200 */ 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1292, 1380, + /* 210 */ 1379, 1291, 1304, 1303, 1302, 1048, 1048, 1048, 1286, 1287, + /* 220 */ 1285, 1284, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, + /* 230 */ 1048, 1048, 1048, 1328, 1048, 1390, 1394, 1048, 1048, 1048, + /* 240 */ 1270, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, + /* 250 */ 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, + /* 260 */ 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, + /* 270 */ 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, + /* 280 */ 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, + /* 290 */ 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, + /* 300 */ 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, + /* 310 */ 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, + /* 320 */ 1048, 1048, 1048, 1048, 1048, 1048, 1351, 1361, 1048, 1048, + /* 330 */ 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1270, 1048, + /* 340 */ 1378, 1048, 1337, 1333, 1048, 1048, 1329, 1048, 1048, 1388, + /* 350 */ 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1323, 1048, + /* 360 */ 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, + /* 370 */ 1048, 1048, 1048, 1048, 1048, 1269, 1048, 1048, 1048, 1048, + /* 380 */ 1048, 1048, 1048, 1180, 1048, 1048, 1048, 1048, 1048, 1048, + /* 390 */ 1048, 1048, 1048, 1048, 1048, 1048, 1165, 1163, 1162, 1161, + /* 400 */ 1048, 1158, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, + /* 410 */ 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, + /* 420 */ 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, + /* 430 */ 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, + /* 440 */ 1048, 1048, 1048, 1048, 1048, }; /********** End of lemon-generated parsing tables *****************************/ @@ -840,157 +854,160 @@ static const char *const yyTokenName[] = { /* 120 */ "INTERVAL", /* 121 */ "TOPIC", /* 122 */ "AS", - /* 123 */ "EXPLAIN", - /* 124 */ "ANALYZE", - /* 125 */ "VERBOSE", - /* 126 */ "NK_BOOL", - /* 127 */ "RATIO", - /* 128 */ "NULL", - /* 129 */ "NK_VARIABLE", - /* 130 */ "NK_UNDERLINE", - /* 131 */ "ROWTS", - /* 132 */ "TBNAME", - /* 133 */ "QSTARTTS", - /* 134 */ "QENDTS", - /* 135 */ "WSTARTTS", - /* 136 */ "WENDTS", - /* 137 */ "WDURATION", - /* 138 */ "BETWEEN", - /* 139 */ "IS", - /* 140 */ "NK_LT", - /* 141 */ "NK_GT", - /* 142 */ "NK_LE", - /* 143 */ "NK_GE", - /* 144 */ "NK_NE", - /* 145 */ "MATCH", - /* 146 */ "NMATCH", - /* 147 */ "IN", - /* 148 */ "JOIN", - /* 149 */ "INNER", - /* 150 */ "SELECT", - /* 151 */ "DISTINCT", - /* 152 */ "WHERE", - /* 153 */ "PARTITION", - /* 154 */ "BY", - /* 155 */ "SESSION", - /* 156 */ "STATE_WINDOW", - /* 157 */ "SLIDING", - /* 158 */ "FILL", - /* 159 */ "VALUE", - /* 160 */ "NONE", - /* 161 */ "PREV", - /* 162 */ "LINEAR", - /* 163 */ "NEXT", - /* 164 */ "GROUP", - /* 165 */ "HAVING", - /* 166 */ "ORDER", - /* 167 */ "SLIMIT", - /* 168 */ "SOFFSET", - /* 169 */ "LIMIT", - /* 170 */ "OFFSET", - /* 171 */ "ASC", - /* 172 */ "DESC", - /* 173 */ "NULLS", - /* 174 */ "FIRST", - /* 175 */ "LAST", - /* 176 */ "cmd", - /* 177 */ "account_options", - /* 178 */ "alter_account_options", - /* 179 */ "literal", - /* 180 */ "alter_account_option", - /* 181 */ "user_name", - /* 182 */ "dnode_endpoint", - /* 183 */ "dnode_host_name", - /* 184 */ "not_exists_opt", - /* 185 */ "db_name", - /* 186 */ "db_options", - /* 187 */ "exists_opt", - /* 188 */ "alter_db_options", - /* 189 */ "alter_db_option", - /* 190 */ "full_table_name", - /* 191 */ "column_def_list", - /* 192 */ "tags_def_opt", - /* 193 */ "table_options", - /* 194 */ "multi_create_clause", - /* 195 */ "tags_def", - /* 196 */ "multi_drop_clause", - /* 197 */ "alter_table_clause", - /* 198 */ "alter_table_options", - /* 199 */ "column_name", - /* 200 */ "type_name", - /* 201 */ "create_subtable_clause", - /* 202 */ "specific_tags_opt", - /* 203 */ "literal_list", - /* 204 */ "drop_table_clause", - /* 205 */ "col_name_list", - /* 206 */ "table_name", - /* 207 */ "column_def", - /* 208 */ "func_name_list", - /* 209 */ "alter_table_option", - /* 210 */ "col_name", - /* 211 */ "db_name_cond_opt", - /* 212 */ "like_pattern_opt", - /* 213 */ "table_name_cond", - /* 214 */ "from_db_opt", - /* 215 */ "func_name", - /* 216 */ "function_name", - /* 217 */ "index_name", - /* 218 */ "index_options", - /* 219 */ "func_list", - /* 220 */ "duration_literal", - /* 221 */ "sliding_opt", - /* 222 */ "func", - /* 223 */ "expression_list", - /* 224 */ "topic_name", - /* 225 */ "query_expression", - /* 226 */ "analyze_opt", - /* 227 */ "explain_options", - /* 228 */ "signed", - /* 229 */ "signed_literal", - /* 230 */ "table_alias", - /* 231 */ "column_alias", - /* 232 */ "expression", - /* 233 */ "pseudo_column", - /* 234 */ "column_reference", - /* 235 */ "subquery", - /* 236 */ "predicate", - /* 237 */ "compare_op", - /* 238 */ "in_op", - /* 239 */ "in_predicate_value", - /* 240 */ "boolean_value_expression", - /* 241 */ "boolean_primary", - /* 242 */ "common_expression", - /* 243 */ "from_clause", - /* 244 */ "table_reference_list", - /* 245 */ "table_reference", - /* 246 */ "table_primary", - /* 247 */ "joined_table", - /* 248 */ "alias_opt", - /* 249 */ "parenthesized_joined_table", - /* 250 */ "join_type", - /* 251 */ "search_condition", - /* 252 */ "query_specification", - /* 253 */ "set_quantifier_opt", - /* 254 */ "select_list", - /* 255 */ "where_clause_opt", - /* 256 */ "partition_by_clause_opt", - /* 257 */ "twindow_clause_opt", - /* 258 */ "group_by_clause_opt", - /* 259 */ "having_clause_opt", - /* 260 */ "select_sublist", - /* 261 */ "select_item", - /* 262 */ "fill_opt", - /* 263 */ "fill_mode", - /* 264 */ "group_by_list", - /* 265 */ "query_expression_body", - /* 266 */ "order_by_clause_opt", - /* 267 */ "slimit_clause_opt", - /* 268 */ "limit_clause_opt", - /* 269 */ "query_primary", - /* 270 */ "sort_specification_list", - /* 271 */ "sort_specification", - /* 272 */ "ordering_specification_opt", - /* 273 */ "null_ordering_opt", + /* 123 */ "DESC", + /* 124 */ "DESCRIBE", + /* 125 */ "RESET", + /* 126 */ "QUERY", + /* 127 */ "EXPLAIN", + /* 128 */ "ANALYZE", + /* 129 */ "VERBOSE", + /* 130 */ "NK_BOOL", + /* 131 */ "RATIO", + /* 132 */ "NULL", + /* 133 */ "NK_VARIABLE", + /* 134 */ "NK_UNDERLINE", + /* 135 */ "ROWTS", + /* 136 */ "TBNAME", + /* 137 */ "QSTARTTS", + /* 138 */ "QENDTS", + /* 139 */ "WSTARTTS", + /* 140 */ "WENDTS", + /* 141 */ "WDURATION", + /* 142 */ "BETWEEN", + /* 143 */ "IS", + /* 144 */ "NK_LT", + /* 145 */ "NK_GT", + /* 146 */ "NK_LE", + /* 147 */ "NK_GE", + /* 148 */ "NK_NE", + /* 149 */ "MATCH", + /* 150 */ "NMATCH", + /* 151 */ "IN", + /* 152 */ "JOIN", + /* 153 */ "INNER", + /* 154 */ "SELECT", + /* 155 */ "DISTINCT", + /* 156 */ "WHERE", + /* 157 */ "PARTITION", + /* 158 */ "BY", + /* 159 */ "SESSION", + /* 160 */ "STATE_WINDOW", + /* 161 */ "SLIDING", + /* 162 */ "FILL", + /* 163 */ "VALUE", + /* 164 */ "NONE", + /* 165 */ "PREV", + /* 166 */ "LINEAR", + /* 167 */ "NEXT", + /* 168 */ "GROUP", + /* 169 */ "HAVING", + /* 170 */ "ORDER", + /* 171 */ "SLIMIT", + /* 172 */ "SOFFSET", + /* 173 */ "LIMIT", + /* 174 */ "OFFSET", + /* 175 */ "ASC", + /* 176 */ "NULLS", + /* 177 */ "FIRST", + /* 178 */ "LAST", + /* 179 */ "cmd", + /* 180 */ "account_options", + /* 181 */ "alter_account_options", + /* 182 */ "literal", + /* 183 */ "alter_account_option", + /* 184 */ "user_name", + /* 185 */ "dnode_endpoint", + /* 186 */ "dnode_host_name", + /* 187 */ "not_exists_opt", + /* 188 */ "db_name", + /* 189 */ "db_options", + /* 190 */ "exists_opt", + /* 191 */ "alter_db_options", + /* 192 */ "alter_db_option", + /* 193 */ "full_table_name", + /* 194 */ "column_def_list", + /* 195 */ "tags_def_opt", + /* 196 */ "table_options", + /* 197 */ "multi_create_clause", + /* 198 */ "tags_def", + /* 199 */ "multi_drop_clause", + /* 200 */ "alter_table_clause", + /* 201 */ "alter_table_options", + /* 202 */ "column_name", + /* 203 */ "type_name", + /* 204 */ "create_subtable_clause", + /* 205 */ "specific_tags_opt", + /* 206 */ "literal_list", + /* 207 */ "drop_table_clause", + /* 208 */ "col_name_list", + /* 209 */ "table_name", + /* 210 */ "column_def", + /* 211 */ "func_name_list", + /* 212 */ "alter_table_option", + /* 213 */ "col_name", + /* 214 */ "db_name_cond_opt", + /* 215 */ "like_pattern_opt", + /* 216 */ "table_name_cond", + /* 217 */ "from_db_opt", + /* 218 */ "func_name", + /* 219 */ "function_name", + /* 220 */ "index_name", + /* 221 */ "index_options", + /* 222 */ "func_list", + /* 223 */ "duration_literal", + /* 224 */ "sliding_opt", + /* 225 */ "func", + /* 226 */ "expression_list", + /* 227 */ "topic_name", + /* 228 */ "query_expression", + /* 229 */ "analyze_opt", + /* 230 */ "explain_options", + /* 231 */ "signed", + /* 232 */ "signed_literal", + /* 233 */ "table_alias", + /* 234 */ "column_alias", + /* 235 */ "expression", + /* 236 */ "pseudo_column", + /* 237 */ "column_reference", + /* 238 */ "subquery", + /* 239 */ "predicate", + /* 240 */ "compare_op", + /* 241 */ "in_op", + /* 242 */ "in_predicate_value", + /* 243 */ "boolean_value_expression", + /* 244 */ "boolean_primary", + /* 245 */ "common_expression", + /* 246 */ "from_clause", + /* 247 */ "table_reference_list", + /* 248 */ "table_reference", + /* 249 */ "table_primary", + /* 250 */ "joined_table", + /* 251 */ "alias_opt", + /* 252 */ "parenthesized_joined_table", + /* 253 */ "join_type", + /* 254 */ "search_condition", + /* 255 */ "query_specification", + /* 256 */ "set_quantifier_opt", + /* 257 */ "select_list", + /* 258 */ "where_clause_opt", + /* 259 */ "partition_by_clause_opt", + /* 260 */ "twindow_clause_opt", + /* 261 */ "group_by_clause_opt", + /* 262 */ "having_clause_opt", + /* 263 */ "select_sublist", + /* 264 */ "select_item", + /* 265 */ "fill_opt", + /* 266 */ "fill_mode", + /* 267 */ "group_by_list", + /* 268 */ "query_expression_body", + /* 269 */ "order_by_clause_opt", + /* 270 */ "slimit_clause_opt", + /* 271 */ "limit_clause_opt", + /* 272 */ "query_primary", + /* 273 */ "sort_specification_list", + /* 274 */ "sort_specification", + /* 275 */ "ordering_specification_opt", + /* 276 */ "null_ordering_opt", }; #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ @@ -1183,175 +1200,178 @@ static const char *const yyRuleName[] = { /* 182 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression", /* 183 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS db_name", /* 184 */ "cmd ::= DROP TOPIC exists_opt topic_name", - /* 185 */ "cmd ::= EXPLAIN analyze_opt explain_options query_expression", - /* 186 */ "analyze_opt ::=", - /* 187 */ "analyze_opt ::= ANALYZE", - /* 188 */ "explain_options ::=", - /* 189 */ "explain_options ::= explain_options VERBOSE NK_BOOL", - /* 190 */ "explain_options ::= explain_options RATIO NK_FLOAT", - /* 191 */ "cmd ::= query_expression", - /* 192 */ "literal ::= NK_INTEGER", - /* 193 */ "literal ::= NK_FLOAT", - /* 194 */ "literal ::= NK_STRING", - /* 195 */ "literal ::= NK_BOOL", - /* 196 */ "literal ::= TIMESTAMP NK_STRING", - /* 197 */ "literal ::= duration_literal", - /* 198 */ "literal ::= NULL", - /* 199 */ "duration_literal ::= NK_VARIABLE", - /* 200 */ "signed ::= NK_INTEGER", - /* 201 */ "signed ::= NK_PLUS NK_INTEGER", - /* 202 */ "signed ::= NK_MINUS NK_INTEGER", - /* 203 */ "signed ::= NK_FLOAT", - /* 204 */ "signed ::= NK_PLUS NK_FLOAT", - /* 205 */ "signed ::= NK_MINUS NK_FLOAT", - /* 206 */ "signed_literal ::= signed", - /* 207 */ "signed_literal ::= NK_STRING", - /* 208 */ "signed_literal ::= NK_BOOL", - /* 209 */ "signed_literal ::= TIMESTAMP NK_STRING", - /* 210 */ "signed_literal ::= duration_literal", - /* 211 */ "signed_literal ::= NULL", - /* 212 */ "literal_list ::= signed_literal", - /* 213 */ "literal_list ::= literal_list NK_COMMA signed_literal", - /* 214 */ "db_name ::= NK_ID", - /* 215 */ "table_name ::= NK_ID", - /* 216 */ "column_name ::= NK_ID", - /* 217 */ "function_name ::= NK_ID", - /* 218 */ "table_alias ::= NK_ID", - /* 219 */ "column_alias ::= NK_ID", - /* 220 */ "user_name ::= NK_ID", - /* 221 */ "index_name ::= NK_ID", - /* 222 */ "topic_name ::= NK_ID", - /* 223 */ "expression ::= literal", - /* 224 */ "expression ::= pseudo_column", - /* 225 */ "expression ::= column_reference", - /* 226 */ "expression ::= function_name NK_LP expression_list NK_RP", - /* 227 */ "expression ::= function_name NK_LP NK_STAR NK_RP", - /* 228 */ "expression ::= subquery", - /* 229 */ "expression ::= NK_LP expression NK_RP", - /* 230 */ "expression ::= NK_PLUS expression", - /* 231 */ "expression ::= NK_MINUS expression", - /* 232 */ "expression ::= expression NK_PLUS expression", - /* 233 */ "expression ::= expression NK_MINUS expression", - /* 234 */ "expression ::= expression NK_STAR expression", - /* 235 */ "expression ::= expression NK_SLASH expression", - /* 236 */ "expression ::= expression NK_REM expression", - /* 237 */ "expression_list ::= expression", - /* 238 */ "expression_list ::= expression_list NK_COMMA expression", - /* 239 */ "column_reference ::= column_name", - /* 240 */ "column_reference ::= table_name NK_DOT column_name", - /* 241 */ "pseudo_column ::= NK_UNDERLINE ROWTS", - /* 242 */ "pseudo_column ::= TBNAME", - /* 243 */ "pseudo_column ::= NK_UNDERLINE QSTARTTS", - /* 244 */ "pseudo_column ::= NK_UNDERLINE QENDTS", - /* 245 */ "pseudo_column ::= NK_UNDERLINE WSTARTTS", - /* 246 */ "pseudo_column ::= NK_UNDERLINE WENDTS", - /* 247 */ "pseudo_column ::= NK_UNDERLINE WDURATION", - /* 248 */ "predicate ::= expression compare_op expression", - /* 249 */ "predicate ::= expression BETWEEN expression AND expression", - /* 250 */ "predicate ::= expression NOT BETWEEN expression AND expression", - /* 251 */ "predicate ::= expression IS NULL", - /* 252 */ "predicate ::= expression IS NOT NULL", - /* 253 */ "predicate ::= expression in_op in_predicate_value", - /* 254 */ "compare_op ::= NK_LT", - /* 255 */ "compare_op ::= NK_GT", - /* 256 */ "compare_op ::= NK_LE", - /* 257 */ "compare_op ::= NK_GE", - /* 258 */ "compare_op ::= NK_NE", - /* 259 */ "compare_op ::= NK_EQ", - /* 260 */ "compare_op ::= LIKE", - /* 261 */ "compare_op ::= NOT LIKE", - /* 262 */ "compare_op ::= MATCH", - /* 263 */ "compare_op ::= NMATCH", - /* 264 */ "in_op ::= IN", - /* 265 */ "in_op ::= NOT IN", - /* 266 */ "in_predicate_value ::= NK_LP expression_list NK_RP", - /* 267 */ "boolean_value_expression ::= boolean_primary", - /* 268 */ "boolean_value_expression ::= NOT boolean_primary", - /* 269 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", - /* 270 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", - /* 271 */ "boolean_primary ::= predicate", - /* 272 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", - /* 273 */ "common_expression ::= expression", - /* 274 */ "common_expression ::= boolean_value_expression", - /* 275 */ "from_clause ::= FROM table_reference_list", - /* 276 */ "table_reference_list ::= table_reference", - /* 277 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", - /* 278 */ "table_reference ::= table_primary", - /* 279 */ "table_reference ::= joined_table", - /* 280 */ "table_primary ::= table_name alias_opt", - /* 281 */ "table_primary ::= db_name NK_DOT table_name alias_opt", - /* 282 */ "table_primary ::= subquery alias_opt", - /* 283 */ "table_primary ::= parenthesized_joined_table", - /* 284 */ "alias_opt ::=", - /* 285 */ "alias_opt ::= table_alias", - /* 286 */ "alias_opt ::= AS table_alias", - /* 287 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", - /* 288 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", - /* 289 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", - /* 290 */ "join_type ::=", - /* 291 */ "join_type ::= INNER", - /* 292 */ "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", - /* 293 */ "set_quantifier_opt ::=", - /* 294 */ "set_quantifier_opt ::= DISTINCT", - /* 295 */ "set_quantifier_opt ::= ALL", - /* 296 */ "select_list ::= NK_STAR", - /* 297 */ "select_list ::= select_sublist", - /* 298 */ "select_sublist ::= select_item", - /* 299 */ "select_sublist ::= select_sublist NK_COMMA select_item", - /* 300 */ "select_item ::= common_expression", - /* 301 */ "select_item ::= common_expression column_alias", - /* 302 */ "select_item ::= common_expression AS column_alias", - /* 303 */ "select_item ::= table_name NK_DOT NK_STAR", - /* 304 */ "where_clause_opt ::=", - /* 305 */ "where_clause_opt ::= WHERE search_condition", - /* 306 */ "partition_by_clause_opt ::=", - /* 307 */ "partition_by_clause_opt ::= PARTITION BY expression_list", - /* 308 */ "twindow_clause_opt ::=", - /* 309 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", - /* 310 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP", - /* 311 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", - /* 312 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", - /* 313 */ "sliding_opt ::=", - /* 314 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", - /* 315 */ "fill_opt ::=", - /* 316 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", - /* 317 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", - /* 318 */ "fill_mode ::= NONE", - /* 319 */ "fill_mode ::= PREV", - /* 320 */ "fill_mode ::= NULL", - /* 321 */ "fill_mode ::= LINEAR", - /* 322 */ "fill_mode ::= NEXT", - /* 323 */ "group_by_clause_opt ::=", - /* 324 */ "group_by_clause_opt ::= GROUP BY group_by_list", - /* 325 */ "group_by_list ::= expression", - /* 326 */ "group_by_list ::= group_by_list NK_COMMA expression", - /* 327 */ "having_clause_opt ::=", - /* 328 */ "having_clause_opt ::= HAVING search_condition", - /* 329 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt", - /* 330 */ "query_expression_body ::= query_primary", - /* 331 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body", - /* 332 */ "query_primary ::= query_specification", - /* 333 */ "order_by_clause_opt ::=", - /* 334 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", - /* 335 */ "slimit_clause_opt ::=", - /* 336 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", - /* 337 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", - /* 338 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 339 */ "limit_clause_opt ::=", - /* 340 */ "limit_clause_opt ::= LIMIT NK_INTEGER", - /* 341 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", - /* 342 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 343 */ "subquery ::= NK_LP query_expression NK_RP", - /* 344 */ "search_condition ::= common_expression", - /* 345 */ "sort_specification_list ::= sort_specification", - /* 346 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", - /* 347 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt", - /* 348 */ "ordering_specification_opt ::=", - /* 349 */ "ordering_specification_opt ::= ASC", - /* 350 */ "ordering_specification_opt ::= DESC", - /* 351 */ "null_ordering_opt ::=", - /* 352 */ "null_ordering_opt ::= NULLS FIRST", - /* 353 */ "null_ordering_opt ::= NULLS LAST", + /* 185 */ "cmd ::= DESC full_table_name", + /* 186 */ "cmd ::= DESCRIBE full_table_name", + /* 187 */ "cmd ::= RESET QUERY CACHE", + /* 188 */ "cmd ::= EXPLAIN analyze_opt explain_options query_expression", + /* 189 */ "analyze_opt ::=", + /* 190 */ "analyze_opt ::= ANALYZE", + /* 191 */ "explain_options ::=", + /* 192 */ "explain_options ::= explain_options VERBOSE NK_BOOL", + /* 193 */ "explain_options ::= explain_options RATIO NK_FLOAT", + /* 194 */ "cmd ::= query_expression", + /* 195 */ "literal ::= NK_INTEGER", + /* 196 */ "literal ::= NK_FLOAT", + /* 197 */ "literal ::= NK_STRING", + /* 198 */ "literal ::= NK_BOOL", + /* 199 */ "literal ::= TIMESTAMP NK_STRING", + /* 200 */ "literal ::= duration_literal", + /* 201 */ "literal ::= NULL", + /* 202 */ "duration_literal ::= NK_VARIABLE", + /* 203 */ "signed ::= NK_INTEGER", + /* 204 */ "signed ::= NK_PLUS NK_INTEGER", + /* 205 */ "signed ::= NK_MINUS NK_INTEGER", + /* 206 */ "signed ::= NK_FLOAT", + /* 207 */ "signed ::= NK_PLUS NK_FLOAT", + /* 208 */ "signed ::= NK_MINUS NK_FLOAT", + /* 209 */ "signed_literal ::= signed", + /* 210 */ "signed_literal ::= NK_STRING", + /* 211 */ "signed_literal ::= NK_BOOL", + /* 212 */ "signed_literal ::= TIMESTAMP NK_STRING", + /* 213 */ "signed_literal ::= duration_literal", + /* 214 */ "signed_literal ::= NULL", + /* 215 */ "literal_list ::= signed_literal", + /* 216 */ "literal_list ::= literal_list NK_COMMA signed_literal", + /* 217 */ "db_name ::= NK_ID", + /* 218 */ "table_name ::= NK_ID", + /* 219 */ "column_name ::= NK_ID", + /* 220 */ "function_name ::= NK_ID", + /* 221 */ "table_alias ::= NK_ID", + /* 222 */ "column_alias ::= NK_ID", + /* 223 */ "user_name ::= NK_ID", + /* 224 */ "index_name ::= NK_ID", + /* 225 */ "topic_name ::= NK_ID", + /* 226 */ "expression ::= literal", + /* 227 */ "expression ::= pseudo_column", + /* 228 */ "expression ::= column_reference", + /* 229 */ "expression ::= function_name NK_LP expression_list NK_RP", + /* 230 */ "expression ::= function_name NK_LP NK_STAR NK_RP", + /* 231 */ "expression ::= subquery", + /* 232 */ "expression ::= NK_LP expression NK_RP", + /* 233 */ "expression ::= NK_PLUS expression", + /* 234 */ "expression ::= NK_MINUS expression", + /* 235 */ "expression ::= expression NK_PLUS expression", + /* 236 */ "expression ::= expression NK_MINUS expression", + /* 237 */ "expression ::= expression NK_STAR expression", + /* 238 */ "expression ::= expression NK_SLASH expression", + /* 239 */ "expression ::= expression NK_REM expression", + /* 240 */ "expression_list ::= expression", + /* 241 */ "expression_list ::= expression_list NK_COMMA expression", + /* 242 */ "column_reference ::= column_name", + /* 243 */ "column_reference ::= table_name NK_DOT column_name", + /* 244 */ "pseudo_column ::= NK_UNDERLINE ROWTS", + /* 245 */ "pseudo_column ::= TBNAME", + /* 246 */ "pseudo_column ::= NK_UNDERLINE QSTARTTS", + /* 247 */ "pseudo_column ::= NK_UNDERLINE QENDTS", + /* 248 */ "pseudo_column ::= NK_UNDERLINE WSTARTTS", + /* 249 */ "pseudo_column ::= NK_UNDERLINE WENDTS", + /* 250 */ "pseudo_column ::= NK_UNDERLINE WDURATION", + /* 251 */ "predicate ::= expression compare_op expression", + /* 252 */ "predicate ::= expression BETWEEN expression AND expression", + /* 253 */ "predicate ::= expression NOT BETWEEN expression AND expression", + /* 254 */ "predicate ::= expression IS NULL", + /* 255 */ "predicate ::= expression IS NOT NULL", + /* 256 */ "predicate ::= expression in_op in_predicate_value", + /* 257 */ "compare_op ::= NK_LT", + /* 258 */ "compare_op ::= NK_GT", + /* 259 */ "compare_op ::= NK_LE", + /* 260 */ "compare_op ::= NK_GE", + /* 261 */ "compare_op ::= NK_NE", + /* 262 */ "compare_op ::= NK_EQ", + /* 263 */ "compare_op ::= LIKE", + /* 264 */ "compare_op ::= NOT LIKE", + /* 265 */ "compare_op ::= MATCH", + /* 266 */ "compare_op ::= NMATCH", + /* 267 */ "in_op ::= IN", + /* 268 */ "in_op ::= NOT IN", + /* 269 */ "in_predicate_value ::= NK_LP expression_list NK_RP", + /* 270 */ "boolean_value_expression ::= boolean_primary", + /* 271 */ "boolean_value_expression ::= NOT boolean_primary", + /* 272 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", + /* 273 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", + /* 274 */ "boolean_primary ::= predicate", + /* 275 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", + /* 276 */ "common_expression ::= expression", + /* 277 */ "common_expression ::= boolean_value_expression", + /* 278 */ "from_clause ::= FROM table_reference_list", + /* 279 */ "table_reference_list ::= table_reference", + /* 280 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", + /* 281 */ "table_reference ::= table_primary", + /* 282 */ "table_reference ::= joined_table", + /* 283 */ "table_primary ::= table_name alias_opt", + /* 284 */ "table_primary ::= db_name NK_DOT table_name alias_opt", + /* 285 */ "table_primary ::= subquery alias_opt", + /* 286 */ "table_primary ::= parenthesized_joined_table", + /* 287 */ "alias_opt ::=", + /* 288 */ "alias_opt ::= table_alias", + /* 289 */ "alias_opt ::= AS table_alias", + /* 290 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", + /* 291 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", + /* 292 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", + /* 293 */ "join_type ::=", + /* 294 */ "join_type ::= INNER", + /* 295 */ "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", + /* 296 */ "set_quantifier_opt ::=", + /* 297 */ "set_quantifier_opt ::= DISTINCT", + /* 298 */ "set_quantifier_opt ::= ALL", + /* 299 */ "select_list ::= NK_STAR", + /* 300 */ "select_list ::= select_sublist", + /* 301 */ "select_sublist ::= select_item", + /* 302 */ "select_sublist ::= select_sublist NK_COMMA select_item", + /* 303 */ "select_item ::= common_expression", + /* 304 */ "select_item ::= common_expression column_alias", + /* 305 */ "select_item ::= common_expression AS column_alias", + /* 306 */ "select_item ::= table_name NK_DOT NK_STAR", + /* 307 */ "where_clause_opt ::=", + /* 308 */ "where_clause_opt ::= WHERE search_condition", + /* 309 */ "partition_by_clause_opt ::=", + /* 310 */ "partition_by_clause_opt ::= PARTITION BY expression_list", + /* 311 */ "twindow_clause_opt ::=", + /* 312 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", + /* 313 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP", + /* 314 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", + /* 315 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", + /* 316 */ "sliding_opt ::=", + /* 317 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", + /* 318 */ "fill_opt ::=", + /* 319 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", + /* 320 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", + /* 321 */ "fill_mode ::= NONE", + /* 322 */ "fill_mode ::= PREV", + /* 323 */ "fill_mode ::= NULL", + /* 324 */ "fill_mode ::= LINEAR", + /* 325 */ "fill_mode ::= NEXT", + /* 326 */ "group_by_clause_opt ::=", + /* 327 */ "group_by_clause_opt ::= GROUP BY group_by_list", + /* 328 */ "group_by_list ::= expression", + /* 329 */ "group_by_list ::= group_by_list NK_COMMA expression", + /* 330 */ "having_clause_opt ::=", + /* 331 */ "having_clause_opt ::= HAVING search_condition", + /* 332 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt", + /* 333 */ "query_expression_body ::= query_primary", + /* 334 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body", + /* 335 */ "query_primary ::= query_specification", + /* 336 */ "order_by_clause_opt ::=", + /* 337 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", + /* 338 */ "slimit_clause_opt ::=", + /* 339 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", + /* 340 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", + /* 341 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 342 */ "limit_clause_opt ::=", + /* 343 */ "limit_clause_opt ::= LIMIT NK_INTEGER", + /* 344 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", + /* 345 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 346 */ "subquery ::= NK_LP query_expression NK_RP", + /* 347 */ "search_condition ::= common_expression", + /* 348 */ "sort_specification_list ::= sort_specification", + /* 349 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", + /* 350 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt", + /* 351 */ "ordering_specification_opt ::=", + /* 352 */ "ordering_specification_opt ::= ASC", + /* 353 */ "ordering_specification_opt ::= DESC", + /* 354 */ "null_ordering_opt ::=", + /* 355 */ "null_ordering_opt ::= NULLS FIRST", + /* 356 */ "null_ordering_opt ::= NULLS LAST", }; #endif /* NDEBUG */ @@ -1478,148 +1498,148 @@ static void yy_destructor( */ /********* Begin destructor definitions ***************************************/ /* Default NON-TERMINAL Destructor */ - case 176: /* cmd */ - case 179: /* literal */ - case 186: /* db_options */ - case 188: /* alter_db_options */ - case 190: /* full_table_name */ - case 193: /* table_options */ - case 197: /* alter_table_clause */ - case 198: /* alter_table_options */ - case 201: /* create_subtable_clause */ - case 204: /* drop_table_clause */ - case 207: /* column_def */ - case 210: /* col_name */ - case 211: /* db_name_cond_opt */ - case 212: /* like_pattern_opt */ - case 213: /* table_name_cond */ - case 214: /* from_db_opt */ - case 215: /* func_name */ - case 218: /* index_options */ - case 220: /* duration_literal */ - case 221: /* sliding_opt */ - case 222: /* func */ - case 225: /* query_expression */ - case 227: /* explain_options */ - case 228: /* signed */ - case 229: /* signed_literal */ - case 232: /* expression */ - case 233: /* pseudo_column */ - case 234: /* column_reference */ - case 235: /* subquery */ - case 236: /* predicate */ - case 239: /* in_predicate_value */ - case 240: /* boolean_value_expression */ - case 241: /* boolean_primary */ - case 242: /* common_expression */ - case 243: /* from_clause */ - case 244: /* table_reference_list */ - case 245: /* table_reference */ - case 246: /* table_primary */ - case 247: /* joined_table */ - case 249: /* parenthesized_joined_table */ - case 251: /* search_condition */ - case 252: /* query_specification */ - case 255: /* where_clause_opt */ - case 257: /* twindow_clause_opt */ - case 259: /* having_clause_opt */ - case 261: /* select_item */ - case 262: /* fill_opt */ - case 265: /* query_expression_body */ - case 267: /* slimit_clause_opt */ - case 268: /* limit_clause_opt */ - case 269: /* query_primary */ - case 271: /* sort_specification */ + case 179: /* cmd */ + case 182: /* literal */ + case 189: /* db_options */ + case 191: /* alter_db_options */ + case 193: /* full_table_name */ + case 196: /* table_options */ + case 200: /* alter_table_clause */ + case 201: /* alter_table_options */ + case 204: /* create_subtable_clause */ + case 207: /* drop_table_clause */ + case 210: /* column_def */ + case 213: /* col_name */ + case 214: /* db_name_cond_opt */ + case 215: /* like_pattern_opt */ + case 216: /* table_name_cond */ + case 217: /* from_db_opt */ + case 218: /* func_name */ + case 221: /* index_options */ + case 223: /* duration_literal */ + case 224: /* sliding_opt */ + case 225: /* func */ + case 228: /* query_expression */ + case 230: /* explain_options */ + case 231: /* signed */ + case 232: /* signed_literal */ + case 235: /* expression */ + case 236: /* pseudo_column */ + case 237: /* column_reference */ + case 238: /* subquery */ + case 239: /* predicate */ + case 242: /* in_predicate_value */ + case 243: /* boolean_value_expression */ + case 244: /* boolean_primary */ + case 245: /* common_expression */ + case 246: /* from_clause */ + case 247: /* table_reference_list */ + case 248: /* table_reference */ + case 249: /* table_primary */ + case 250: /* joined_table */ + case 252: /* parenthesized_joined_table */ + case 254: /* search_condition */ + case 255: /* query_specification */ + case 258: /* where_clause_opt */ + case 260: /* twindow_clause_opt */ + case 262: /* having_clause_opt */ + case 264: /* select_item */ + case 265: /* fill_opt */ + case 268: /* query_expression_body */ + case 270: /* slimit_clause_opt */ + case 271: /* limit_clause_opt */ + case 272: /* query_primary */ + case 274: /* sort_specification */ { - nodesDestroyNode((yypminor->yy364)); + nodesDestroyNode((yypminor->yy46)); } break; - case 177: /* account_options */ - case 178: /* alter_account_options */ - case 180: /* alter_account_option */ + case 180: /* account_options */ + case 181: /* alter_account_options */ + case 183: /* alter_account_option */ { } break; - case 181: /* user_name */ - case 182: /* dnode_endpoint */ - case 183: /* dnode_host_name */ - case 185: /* db_name */ - case 199: /* column_name */ - case 206: /* table_name */ - case 216: /* function_name */ - case 217: /* index_name */ - case 224: /* topic_name */ - case 230: /* table_alias */ - case 231: /* column_alias */ - case 248: /* alias_opt */ + case 184: /* user_name */ + case 185: /* dnode_endpoint */ + case 186: /* dnode_host_name */ + case 188: /* db_name */ + case 202: /* column_name */ + case 209: /* table_name */ + case 219: /* function_name */ + case 220: /* index_name */ + case 227: /* topic_name */ + case 233: /* table_alias */ + case 234: /* column_alias */ + case 251: /* alias_opt */ { } break; - case 184: /* not_exists_opt */ - case 187: /* exists_opt */ - case 226: /* analyze_opt */ - case 253: /* set_quantifier_opt */ + case 187: /* not_exists_opt */ + case 190: /* exists_opt */ + case 229: /* analyze_opt */ + case 256: /* set_quantifier_opt */ { } break; - case 189: /* alter_db_option */ - case 209: /* alter_table_option */ + case 192: /* alter_db_option */ + case 212: /* alter_table_option */ { } break; - case 191: /* column_def_list */ - case 192: /* tags_def_opt */ - case 194: /* multi_create_clause */ - case 195: /* tags_def */ - case 196: /* multi_drop_clause */ - case 202: /* specific_tags_opt */ - case 203: /* literal_list */ - case 205: /* col_name_list */ - case 208: /* func_name_list */ - case 219: /* func_list */ - case 223: /* expression_list */ - case 254: /* select_list */ - case 256: /* partition_by_clause_opt */ - case 258: /* group_by_clause_opt */ - case 260: /* select_sublist */ - case 264: /* group_by_list */ - case 266: /* order_by_clause_opt */ - case 270: /* sort_specification_list */ + case 194: /* column_def_list */ + case 195: /* tags_def_opt */ + case 197: /* multi_create_clause */ + case 198: /* tags_def */ + case 199: /* multi_drop_clause */ + case 205: /* specific_tags_opt */ + case 206: /* literal_list */ + case 208: /* col_name_list */ + case 211: /* func_name_list */ + case 222: /* func_list */ + case 226: /* expression_list */ + case 257: /* select_list */ + case 259: /* partition_by_clause_opt */ + case 261: /* group_by_clause_opt */ + case 263: /* select_sublist */ + case 267: /* group_by_list */ + case 269: /* order_by_clause_opt */ + case 273: /* sort_specification_list */ { - nodesDestroyList((yypminor->yy40)); + nodesDestroyList((yypminor->yy194)); } break; - case 200: /* type_name */ + case 203: /* type_name */ { } break; - case 237: /* compare_op */ - case 238: /* in_op */ + case 240: /* compare_op */ + case 241: /* in_op */ { } break; - case 250: /* join_type */ + case 253: /* join_type */ { } break; - case 263: /* fill_mode */ + case 266: /* fill_mode */ { } break; - case 272: /* ordering_specification_opt */ + case 275: /* ordering_specification_opt */ { } break; - case 273: /* null_ordering_opt */ + case 276: /* null_ordering_opt */ { } @@ -1918,360 +1938,363 @@ static const struct { YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ signed char nrhs; /* Negative of the number of RHS symbols in the rule */ } yyRuleInfo[] = { - { 176, -6 }, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ - { 176, -4 }, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ - { 177, 0 }, /* (2) account_options ::= */ - { 177, -3 }, /* (3) account_options ::= account_options PPS literal */ - { 177, -3 }, /* (4) account_options ::= account_options TSERIES literal */ - { 177, -3 }, /* (5) account_options ::= account_options STORAGE literal */ - { 177, -3 }, /* (6) account_options ::= account_options STREAMS literal */ - { 177, -3 }, /* (7) account_options ::= account_options QTIME literal */ - { 177, -3 }, /* (8) account_options ::= account_options DBS literal */ - { 177, -3 }, /* (9) account_options ::= account_options USERS literal */ - { 177, -3 }, /* (10) account_options ::= account_options CONNS literal */ - { 177, -3 }, /* (11) account_options ::= account_options STATE literal */ - { 178, -1 }, /* (12) alter_account_options ::= alter_account_option */ - { 178, -2 }, /* (13) alter_account_options ::= alter_account_options alter_account_option */ - { 180, -2 }, /* (14) alter_account_option ::= PASS literal */ - { 180, -2 }, /* (15) alter_account_option ::= PPS literal */ - { 180, -2 }, /* (16) alter_account_option ::= TSERIES literal */ - { 180, -2 }, /* (17) alter_account_option ::= STORAGE literal */ - { 180, -2 }, /* (18) alter_account_option ::= STREAMS literal */ - { 180, -2 }, /* (19) alter_account_option ::= QTIME literal */ - { 180, -2 }, /* (20) alter_account_option ::= DBS literal */ - { 180, -2 }, /* (21) alter_account_option ::= USERS literal */ - { 180, -2 }, /* (22) alter_account_option ::= CONNS literal */ - { 180, -2 }, /* (23) alter_account_option ::= STATE literal */ - { 176, -5 }, /* (24) cmd ::= CREATE USER user_name PASS NK_STRING */ - { 176, -5 }, /* (25) cmd ::= ALTER USER user_name PASS NK_STRING */ - { 176, -5 }, /* (26) cmd ::= ALTER USER user_name PRIVILEGE NK_STRING */ - { 176, -3 }, /* (27) cmd ::= DROP USER user_name */ - { 176, -3 }, /* (28) cmd ::= CREATE DNODE dnode_endpoint */ - { 176, -5 }, /* (29) cmd ::= CREATE DNODE dnode_host_name PORT NK_INTEGER */ - { 176, -3 }, /* (30) cmd ::= DROP DNODE NK_INTEGER */ - { 176, -3 }, /* (31) cmd ::= DROP DNODE dnode_endpoint */ - { 176, -4 }, /* (32) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ - { 176, -5 }, /* (33) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ - { 176, -4 }, /* (34) cmd ::= ALTER ALL DNODES NK_STRING */ - { 176, -5 }, /* (35) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ - { 182, -1 }, /* (36) dnode_endpoint ::= NK_STRING */ - { 183, -1 }, /* (37) dnode_host_name ::= NK_ID */ - { 183, -1 }, /* (38) dnode_host_name ::= NK_IPTOKEN */ - { 176, -3 }, /* (39) cmd ::= ALTER LOCAL NK_STRING */ - { 176, -4 }, /* (40) cmd ::= ALTER LOCAL NK_STRING NK_STRING */ - { 176, -5 }, /* (41) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ - { 176, -5 }, /* (42) cmd ::= DROP QNODE ON DNODE NK_INTEGER */ - { 176, -5 }, /* (43) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ - { 176, -4 }, /* (44) cmd ::= DROP DATABASE exists_opt db_name */ - { 176, -2 }, /* (45) cmd ::= USE db_name */ - { 176, -4 }, /* (46) cmd ::= ALTER DATABASE db_name alter_db_options */ - { 184, -3 }, /* (47) not_exists_opt ::= IF NOT EXISTS */ - { 184, 0 }, /* (48) not_exists_opt ::= */ - { 187, -2 }, /* (49) exists_opt ::= IF EXISTS */ - { 187, 0 }, /* (50) exists_opt ::= */ - { 186, 0 }, /* (51) db_options ::= */ - { 186, -3 }, /* (52) db_options ::= db_options BLOCKS NK_INTEGER */ - { 186, -3 }, /* (53) db_options ::= db_options CACHE NK_INTEGER */ - { 186, -3 }, /* (54) db_options ::= db_options CACHELAST NK_INTEGER */ - { 186, -3 }, /* (55) db_options ::= db_options COMP NK_INTEGER */ - { 186, -3 }, /* (56) db_options ::= db_options DAYS NK_INTEGER */ - { 186, -3 }, /* (57) db_options ::= db_options FSYNC NK_INTEGER */ - { 186, -3 }, /* (58) db_options ::= db_options MAXROWS NK_INTEGER */ - { 186, -3 }, /* (59) db_options ::= db_options MINROWS NK_INTEGER */ - { 186, -3 }, /* (60) db_options ::= db_options KEEP NK_INTEGER */ - { 186, -3 }, /* (61) db_options ::= db_options PRECISION NK_STRING */ - { 186, -3 }, /* (62) db_options ::= db_options QUORUM NK_INTEGER */ - { 186, -3 }, /* (63) db_options ::= db_options REPLICA NK_INTEGER */ - { 186, -3 }, /* (64) db_options ::= db_options TTL NK_INTEGER */ - { 186, -3 }, /* (65) db_options ::= db_options WAL NK_INTEGER */ - { 186, -3 }, /* (66) db_options ::= db_options VGROUPS NK_INTEGER */ - { 186, -3 }, /* (67) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ - { 186, -3 }, /* (68) db_options ::= db_options STREAM_MODE NK_INTEGER */ - { 186, -3 }, /* (69) db_options ::= db_options RETENTIONS NK_STRING */ - { 188, -1 }, /* (70) alter_db_options ::= alter_db_option */ - { 188, -2 }, /* (71) alter_db_options ::= alter_db_options alter_db_option */ - { 189, -2 }, /* (72) alter_db_option ::= BLOCKS NK_INTEGER */ - { 189, -2 }, /* (73) alter_db_option ::= FSYNC NK_INTEGER */ - { 189, -2 }, /* (74) alter_db_option ::= KEEP NK_INTEGER */ - { 189, -2 }, /* (75) alter_db_option ::= WAL NK_INTEGER */ - { 189, -2 }, /* (76) alter_db_option ::= QUORUM NK_INTEGER */ - { 189, -2 }, /* (77) alter_db_option ::= CACHELAST NK_INTEGER */ - { 176, -9 }, /* (78) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ - { 176, -3 }, /* (79) cmd ::= CREATE TABLE multi_create_clause */ - { 176, -9 }, /* (80) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ - { 176, -3 }, /* (81) cmd ::= DROP TABLE multi_drop_clause */ - { 176, -4 }, /* (82) cmd ::= DROP STABLE exists_opt full_table_name */ - { 176, -3 }, /* (83) cmd ::= ALTER TABLE alter_table_clause */ - { 176, -3 }, /* (84) cmd ::= ALTER STABLE alter_table_clause */ - { 197, -2 }, /* (85) alter_table_clause ::= full_table_name alter_table_options */ - { 197, -5 }, /* (86) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ - { 197, -4 }, /* (87) alter_table_clause ::= full_table_name DROP COLUMN column_name */ - { 197, -5 }, /* (88) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ - { 197, -5 }, /* (89) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ - { 197, -5 }, /* (90) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ - { 197, -4 }, /* (91) alter_table_clause ::= full_table_name DROP TAG column_name */ - { 197, -5 }, /* (92) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ - { 197, -5 }, /* (93) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ - { 197, -6 }, /* (94) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ literal */ - { 194, -1 }, /* (95) multi_create_clause ::= create_subtable_clause */ - { 194, -2 }, /* (96) multi_create_clause ::= multi_create_clause create_subtable_clause */ - { 201, -9 }, /* (97) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP */ - { 196, -1 }, /* (98) multi_drop_clause ::= drop_table_clause */ - { 196, -2 }, /* (99) multi_drop_clause ::= multi_drop_clause drop_table_clause */ - { 204, -2 }, /* (100) drop_table_clause ::= exists_opt full_table_name */ - { 202, 0 }, /* (101) specific_tags_opt ::= */ - { 202, -3 }, /* (102) specific_tags_opt ::= NK_LP col_name_list NK_RP */ - { 190, -1 }, /* (103) full_table_name ::= table_name */ - { 190, -3 }, /* (104) full_table_name ::= db_name NK_DOT table_name */ - { 191, -1 }, /* (105) column_def_list ::= column_def */ - { 191, -3 }, /* (106) column_def_list ::= column_def_list NK_COMMA column_def */ - { 207, -2 }, /* (107) column_def ::= column_name type_name */ - { 207, -4 }, /* (108) column_def ::= column_name type_name COMMENT NK_STRING */ - { 200, -1 }, /* (109) type_name ::= BOOL */ - { 200, -1 }, /* (110) type_name ::= TINYINT */ - { 200, -1 }, /* (111) type_name ::= SMALLINT */ - { 200, -1 }, /* (112) type_name ::= INT */ - { 200, -1 }, /* (113) type_name ::= INTEGER */ - { 200, -1 }, /* (114) type_name ::= BIGINT */ - { 200, -1 }, /* (115) type_name ::= FLOAT */ - { 200, -1 }, /* (116) type_name ::= DOUBLE */ - { 200, -4 }, /* (117) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ - { 200, -1 }, /* (118) type_name ::= TIMESTAMP */ - { 200, -4 }, /* (119) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ - { 200, -2 }, /* (120) type_name ::= TINYINT UNSIGNED */ - { 200, -2 }, /* (121) type_name ::= SMALLINT UNSIGNED */ - { 200, -2 }, /* (122) type_name ::= INT UNSIGNED */ - { 200, -2 }, /* (123) type_name ::= BIGINT UNSIGNED */ - { 200, -1 }, /* (124) type_name ::= JSON */ - { 200, -4 }, /* (125) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ - { 200, -1 }, /* (126) type_name ::= MEDIUMBLOB */ - { 200, -1 }, /* (127) type_name ::= BLOB */ - { 200, -4 }, /* (128) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ - { 200, -1 }, /* (129) type_name ::= DECIMAL */ - { 200, -4 }, /* (130) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ - { 200, -6 }, /* (131) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - { 192, 0 }, /* (132) tags_def_opt ::= */ - { 192, -1 }, /* (133) tags_def_opt ::= tags_def */ - { 195, -4 }, /* (134) tags_def ::= TAGS NK_LP column_def_list NK_RP */ - { 193, 0 }, /* (135) table_options ::= */ - { 193, -3 }, /* (136) table_options ::= table_options COMMENT NK_STRING */ - { 193, -3 }, /* (137) table_options ::= table_options KEEP NK_INTEGER */ - { 193, -3 }, /* (138) table_options ::= table_options TTL NK_INTEGER */ - { 193, -5 }, /* (139) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ - { 193, -5 }, /* (140) table_options ::= table_options ROLLUP NK_LP func_name_list NK_RP */ - { 193, -3 }, /* (141) table_options ::= table_options FILE_FACTOR NK_FLOAT */ - { 193, -3 }, /* (142) table_options ::= table_options DELAY NK_INTEGER */ - { 198, -1 }, /* (143) alter_table_options ::= alter_table_option */ - { 198, -2 }, /* (144) alter_table_options ::= alter_table_options alter_table_option */ - { 209, -2 }, /* (145) alter_table_option ::= COMMENT NK_STRING */ - { 209, -2 }, /* (146) alter_table_option ::= KEEP NK_INTEGER */ - { 209, -2 }, /* (147) alter_table_option ::= TTL NK_INTEGER */ - { 205, -1 }, /* (148) col_name_list ::= col_name */ - { 205, -3 }, /* (149) col_name_list ::= col_name_list NK_COMMA col_name */ - { 210, -1 }, /* (150) col_name ::= column_name */ - { 176, -2 }, /* (151) cmd ::= SHOW DNODES */ - { 176, -2 }, /* (152) cmd ::= SHOW USERS */ - { 176, -2 }, /* (153) cmd ::= SHOW DATABASES */ - { 176, -4 }, /* (154) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ - { 176, -4 }, /* (155) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ - { 176, -3 }, /* (156) cmd ::= SHOW db_name_cond_opt VGROUPS */ - { 176, -2 }, /* (157) cmd ::= SHOW MNODES */ - { 176, -2 }, /* (158) cmd ::= SHOW MODULES */ - { 176, -2 }, /* (159) cmd ::= SHOW QNODES */ - { 176, -2 }, /* (160) cmd ::= SHOW FUNCTIONS */ - { 176, -5 }, /* (161) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ - { 176, -2 }, /* (162) cmd ::= SHOW STREAMS */ - { 211, 0 }, /* (163) db_name_cond_opt ::= */ - { 211, -2 }, /* (164) db_name_cond_opt ::= db_name NK_DOT */ - { 212, 0 }, /* (165) like_pattern_opt ::= */ - { 212, -2 }, /* (166) like_pattern_opt ::= LIKE NK_STRING */ - { 213, -1 }, /* (167) table_name_cond ::= table_name */ - { 214, 0 }, /* (168) from_db_opt ::= */ - { 214, -2 }, /* (169) from_db_opt ::= FROM db_name */ - { 208, -1 }, /* (170) func_name_list ::= func_name */ - { 208, -3 }, /* (171) func_name_list ::= func_name_list NK_COMMA col_name */ - { 215, -1 }, /* (172) func_name ::= function_name */ - { 176, -8 }, /* (173) cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ - { 176, -10 }, /* (174) cmd ::= CREATE FULLTEXT INDEX not_exists_opt index_name ON table_name NK_LP col_name_list NK_RP */ - { 176, -6 }, /* (175) cmd ::= DROP INDEX exists_opt index_name ON table_name */ - { 218, 0 }, /* (176) index_options ::= */ - { 218, -9 }, /* (177) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt */ - { 218, -11 }, /* (178) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt */ - { 219, -1 }, /* (179) func_list ::= func */ - { 219, -3 }, /* (180) func_list ::= func_list NK_COMMA func */ - { 222, -4 }, /* (181) func ::= function_name NK_LP expression_list NK_RP */ - { 176, -6 }, /* (182) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ - { 176, -6 }, /* (183) cmd ::= CREATE TOPIC not_exists_opt topic_name AS db_name */ - { 176, -4 }, /* (184) cmd ::= DROP TOPIC exists_opt topic_name */ - { 176, -4 }, /* (185) cmd ::= EXPLAIN analyze_opt explain_options query_expression */ - { 226, 0 }, /* (186) analyze_opt ::= */ - { 226, -1 }, /* (187) analyze_opt ::= ANALYZE */ - { 227, 0 }, /* (188) explain_options ::= */ - { 227, -3 }, /* (189) explain_options ::= explain_options VERBOSE NK_BOOL */ - { 227, -3 }, /* (190) explain_options ::= explain_options RATIO NK_FLOAT */ - { 176, -1 }, /* (191) cmd ::= query_expression */ - { 179, -1 }, /* (192) literal ::= NK_INTEGER */ - { 179, -1 }, /* (193) literal ::= NK_FLOAT */ - { 179, -1 }, /* (194) literal ::= NK_STRING */ - { 179, -1 }, /* (195) literal ::= NK_BOOL */ - { 179, -2 }, /* (196) literal ::= TIMESTAMP NK_STRING */ - { 179, -1 }, /* (197) literal ::= duration_literal */ - { 179, -1 }, /* (198) literal ::= NULL */ - { 220, -1 }, /* (199) duration_literal ::= NK_VARIABLE */ - { 228, -1 }, /* (200) signed ::= NK_INTEGER */ - { 228, -2 }, /* (201) signed ::= NK_PLUS NK_INTEGER */ - { 228, -2 }, /* (202) signed ::= NK_MINUS NK_INTEGER */ - { 228, -1 }, /* (203) signed ::= NK_FLOAT */ - { 228, -2 }, /* (204) signed ::= NK_PLUS NK_FLOAT */ - { 228, -2 }, /* (205) signed ::= NK_MINUS NK_FLOAT */ - { 229, -1 }, /* (206) signed_literal ::= signed */ - { 229, -1 }, /* (207) signed_literal ::= NK_STRING */ - { 229, -1 }, /* (208) signed_literal ::= NK_BOOL */ - { 229, -2 }, /* (209) signed_literal ::= TIMESTAMP NK_STRING */ - { 229, -1 }, /* (210) signed_literal ::= duration_literal */ - { 229, -1 }, /* (211) signed_literal ::= NULL */ - { 203, -1 }, /* (212) literal_list ::= signed_literal */ - { 203, -3 }, /* (213) literal_list ::= literal_list NK_COMMA signed_literal */ - { 185, -1 }, /* (214) db_name ::= NK_ID */ - { 206, -1 }, /* (215) table_name ::= NK_ID */ - { 199, -1 }, /* (216) column_name ::= NK_ID */ - { 216, -1 }, /* (217) function_name ::= NK_ID */ - { 230, -1 }, /* (218) table_alias ::= NK_ID */ - { 231, -1 }, /* (219) column_alias ::= NK_ID */ - { 181, -1 }, /* (220) user_name ::= NK_ID */ - { 217, -1 }, /* (221) index_name ::= NK_ID */ - { 224, -1 }, /* (222) topic_name ::= NK_ID */ - { 232, -1 }, /* (223) expression ::= literal */ - { 232, -1 }, /* (224) expression ::= pseudo_column */ - { 232, -1 }, /* (225) expression ::= column_reference */ - { 232, -4 }, /* (226) expression ::= function_name NK_LP expression_list NK_RP */ - { 232, -4 }, /* (227) expression ::= function_name NK_LP NK_STAR NK_RP */ - { 232, -1 }, /* (228) expression ::= subquery */ - { 232, -3 }, /* (229) expression ::= NK_LP expression NK_RP */ - { 232, -2 }, /* (230) expression ::= NK_PLUS expression */ - { 232, -2 }, /* (231) expression ::= NK_MINUS expression */ - { 232, -3 }, /* (232) expression ::= expression NK_PLUS expression */ - { 232, -3 }, /* (233) expression ::= expression NK_MINUS expression */ - { 232, -3 }, /* (234) expression ::= expression NK_STAR expression */ - { 232, -3 }, /* (235) expression ::= expression NK_SLASH expression */ - { 232, -3 }, /* (236) expression ::= expression NK_REM expression */ - { 223, -1 }, /* (237) expression_list ::= expression */ - { 223, -3 }, /* (238) expression_list ::= expression_list NK_COMMA expression */ - { 234, -1 }, /* (239) column_reference ::= column_name */ - { 234, -3 }, /* (240) column_reference ::= table_name NK_DOT column_name */ - { 233, -2 }, /* (241) pseudo_column ::= NK_UNDERLINE ROWTS */ - { 233, -1 }, /* (242) pseudo_column ::= TBNAME */ - { 233, -2 }, /* (243) pseudo_column ::= NK_UNDERLINE QSTARTTS */ - { 233, -2 }, /* (244) pseudo_column ::= NK_UNDERLINE QENDTS */ - { 233, -2 }, /* (245) pseudo_column ::= NK_UNDERLINE WSTARTTS */ - { 233, -2 }, /* (246) pseudo_column ::= NK_UNDERLINE WENDTS */ - { 233, -2 }, /* (247) pseudo_column ::= NK_UNDERLINE WDURATION */ - { 236, -3 }, /* (248) predicate ::= expression compare_op expression */ - { 236, -5 }, /* (249) predicate ::= expression BETWEEN expression AND expression */ - { 236, -6 }, /* (250) predicate ::= expression NOT BETWEEN expression AND expression */ - { 236, -3 }, /* (251) predicate ::= expression IS NULL */ - { 236, -4 }, /* (252) predicate ::= expression IS NOT NULL */ - { 236, -3 }, /* (253) predicate ::= expression in_op in_predicate_value */ - { 237, -1 }, /* (254) compare_op ::= NK_LT */ - { 237, -1 }, /* (255) compare_op ::= NK_GT */ - { 237, -1 }, /* (256) compare_op ::= NK_LE */ - { 237, -1 }, /* (257) compare_op ::= NK_GE */ - { 237, -1 }, /* (258) compare_op ::= NK_NE */ - { 237, -1 }, /* (259) compare_op ::= NK_EQ */ - { 237, -1 }, /* (260) compare_op ::= LIKE */ - { 237, -2 }, /* (261) compare_op ::= NOT LIKE */ - { 237, -1 }, /* (262) compare_op ::= MATCH */ - { 237, -1 }, /* (263) compare_op ::= NMATCH */ - { 238, -1 }, /* (264) in_op ::= IN */ - { 238, -2 }, /* (265) in_op ::= NOT IN */ - { 239, -3 }, /* (266) in_predicate_value ::= NK_LP expression_list NK_RP */ - { 240, -1 }, /* (267) boolean_value_expression ::= boolean_primary */ - { 240, -2 }, /* (268) boolean_value_expression ::= NOT boolean_primary */ - { 240, -3 }, /* (269) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - { 240, -3 }, /* (270) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - { 241, -1 }, /* (271) boolean_primary ::= predicate */ - { 241, -3 }, /* (272) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - { 242, -1 }, /* (273) common_expression ::= expression */ - { 242, -1 }, /* (274) common_expression ::= boolean_value_expression */ - { 243, -2 }, /* (275) from_clause ::= FROM table_reference_list */ - { 244, -1 }, /* (276) table_reference_list ::= table_reference */ - { 244, -3 }, /* (277) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - { 245, -1 }, /* (278) table_reference ::= table_primary */ - { 245, -1 }, /* (279) table_reference ::= joined_table */ - { 246, -2 }, /* (280) table_primary ::= table_name alias_opt */ - { 246, -4 }, /* (281) table_primary ::= db_name NK_DOT table_name alias_opt */ - { 246, -2 }, /* (282) table_primary ::= subquery alias_opt */ - { 246, -1 }, /* (283) table_primary ::= parenthesized_joined_table */ - { 248, 0 }, /* (284) alias_opt ::= */ - { 248, -1 }, /* (285) alias_opt ::= table_alias */ - { 248, -2 }, /* (286) alias_opt ::= AS table_alias */ - { 249, -3 }, /* (287) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - { 249, -3 }, /* (288) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - { 247, -6 }, /* (289) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ - { 250, 0 }, /* (290) join_type ::= */ - { 250, -1 }, /* (291) join_type ::= INNER */ - { 252, -9 }, /* (292) 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 */ - { 253, 0 }, /* (293) set_quantifier_opt ::= */ - { 253, -1 }, /* (294) set_quantifier_opt ::= DISTINCT */ - { 253, -1 }, /* (295) set_quantifier_opt ::= ALL */ - { 254, -1 }, /* (296) select_list ::= NK_STAR */ - { 254, -1 }, /* (297) select_list ::= select_sublist */ - { 260, -1 }, /* (298) select_sublist ::= select_item */ - { 260, -3 }, /* (299) select_sublist ::= select_sublist NK_COMMA select_item */ - { 261, -1 }, /* (300) select_item ::= common_expression */ - { 261, -2 }, /* (301) select_item ::= common_expression column_alias */ - { 261, -3 }, /* (302) select_item ::= common_expression AS column_alias */ - { 261, -3 }, /* (303) select_item ::= table_name NK_DOT NK_STAR */ - { 255, 0 }, /* (304) where_clause_opt ::= */ - { 255, -2 }, /* (305) where_clause_opt ::= WHERE search_condition */ - { 256, 0 }, /* (306) partition_by_clause_opt ::= */ - { 256, -3 }, /* (307) partition_by_clause_opt ::= PARTITION BY expression_list */ - { 257, 0 }, /* (308) twindow_clause_opt ::= */ - { 257, -6 }, /* (309) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ - { 257, -4 }, /* (310) twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP */ - { 257, -6 }, /* (311) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ - { 257, -8 }, /* (312) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ - { 221, 0 }, /* (313) sliding_opt ::= */ - { 221, -4 }, /* (314) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ - { 262, 0 }, /* (315) fill_opt ::= */ - { 262, -4 }, /* (316) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - { 262, -6 }, /* (317) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ - { 263, -1 }, /* (318) fill_mode ::= NONE */ - { 263, -1 }, /* (319) fill_mode ::= PREV */ - { 263, -1 }, /* (320) fill_mode ::= NULL */ - { 263, -1 }, /* (321) fill_mode ::= LINEAR */ - { 263, -1 }, /* (322) fill_mode ::= NEXT */ - { 258, 0 }, /* (323) group_by_clause_opt ::= */ - { 258, -3 }, /* (324) group_by_clause_opt ::= GROUP BY group_by_list */ - { 264, -1 }, /* (325) group_by_list ::= expression */ - { 264, -3 }, /* (326) group_by_list ::= group_by_list NK_COMMA expression */ - { 259, 0 }, /* (327) having_clause_opt ::= */ - { 259, -2 }, /* (328) having_clause_opt ::= HAVING search_condition */ - { 225, -4 }, /* (329) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ - { 265, -1 }, /* (330) query_expression_body ::= query_primary */ - { 265, -4 }, /* (331) query_expression_body ::= query_expression_body UNION ALL query_expression_body */ - { 269, -1 }, /* (332) query_primary ::= query_specification */ - { 266, 0 }, /* (333) order_by_clause_opt ::= */ - { 266, -3 }, /* (334) order_by_clause_opt ::= ORDER BY sort_specification_list */ - { 267, 0 }, /* (335) slimit_clause_opt ::= */ - { 267, -2 }, /* (336) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - { 267, -4 }, /* (337) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - { 267, -4 }, /* (338) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - { 268, 0 }, /* (339) limit_clause_opt ::= */ - { 268, -2 }, /* (340) limit_clause_opt ::= LIMIT NK_INTEGER */ - { 268, -4 }, /* (341) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - { 268, -4 }, /* (342) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - { 235, -3 }, /* (343) subquery ::= NK_LP query_expression NK_RP */ - { 251, -1 }, /* (344) search_condition ::= common_expression */ - { 270, -1 }, /* (345) sort_specification_list ::= sort_specification */ - { 270, -3 }, /* (346) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - { 271, -3 }, /* (347) sort_specification ::= expression ordering_specification_opt null_ordering_opt */ - { 272, 0 }, /* (348) ordering_specification_opt ::= */ - { 272, -1 }, /* (349) ordering_specification_opt ::= ASC */ - { 272, -1 }, /* (350) ordering_specification_opt ::= DESC */ - { 273, 0 }, /* (351) null_ordering_opt ::= */ - { 273, -2 }, /* (352) null_ordering_opt ::= NULLS FIRST */ - { 273, -2 }, /* (353) null_ordering_opt ::= NULLS LAST */ + { 179, -6 }, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ + { 179, -4 }, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ + { 180, 0 }, /* (2) account_options ::= */ + { 180, -3 }, /* (3) account_options ::= account_options PPS literal */ + { 180, -3 }, /* (4) account_options ::= account_options TSERIES literal */ + { 180, -3 }, /* (5) account_options ::= account_options STORAGE literal */ + { 180, -3 }, /* (6) account_options ::= account_options STREAMS literal */ + { 180, -3 }, /* (7) account_options ::= account_options QTIME literal */ + { 180, -3 }, /* (8) account_options ::= account_options DBS literal */ + { 180, -3 }, /* (9) account_options ::= account_options USERS literal */ + { 180, -3 }, /* (10) account_options ::= account_options CONNS literal */ + { 180, -3 }, /* (11) account_options ::= account_options STATE literal */ + { 181, -1 }, /* (12) alter_account_options ::= alter_account_option */ + { 181, -2 }, /* (13) alter_account_options ::= alter_account_options alter_account_option */ + { 183, -2 }, /* (14) alter_account_option ::= PASS literal */ + { 183, -2 }, /* (15) alter_account_option ::= PPS literal */ + { 183, -2 }, /* (16) alter_account_option ::= TSERIES literal */ + { 183, -2 }, /* (17) alter_account_option ::= STORAGE literal */ + { 183, -2 }, /* (18) alter_account_option ::= STREAMS literal */ + { 183, -2 }, /* (19) alter_account_option ::= QTIME literal */ + { 183, -2 }, /* (20) alter_account_option ::= DBS literal */ + { 183, -2 }, /* (21) alter_account_option ::= USERS literal */ + { 183, -2 }, /* (22) alter_account_option ::= CONNS literal */ + { 183, -2 }, /* (23) alter_account_option ::= STATE literal */ + { 179, -5 }, /* (24) cmd ::= CREATE USER user_name PASS NK_STRING */ + { 179, -5 }, /* (25) cmd ::= ALTER USER user_name PASS NK_STRING */ + { 179, -5 }, /* (26) cmd ::= ALTER USER user_name PRIVILEGE NK_STRING */ + { 179, -3 }, /* (27) cmd ::= DROP USER user_name */ + { 179, -3 }, /* (28) cmd ::= CREATE DNODE dnode_endpoint */ + { 179, -5 }, /* (29) cmd ::= CREATE DNODE dnode_host_name PORT NK_INTEGER */ + { 179, -3 }, /* (30) cmd ::= DROP DNODE NK_INTEGER */ + { 179, -3 }, /* (31) cmd ::= DROP DNODE dnode_endpoint */ + { 179, -4 }, /* (32) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ + { 179, -5 }, /* (33) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ + { 179, -4 }, /* (34) cmd ::= ALTER ALL DNODES NK_STRING */ + { 179, -5 }, /* (35) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ + { 185, -1 }, /* (36) dnode_endpoint ::= NK_STRING */ + { 186, -1 }, /* (37) dnode_host_name ::= NK_ID */ + { 186, -1 }, /* (38) dnode_host_name ::= NK_IPTOKEN */ + { 179, -3 }, /* (39) cmd ::= ALTER LOCAL NK_STRING */ + { 179, -4 }, /* (40) cmd ::= ALTER LOCAL NK_STRING NK_STRING */ + { 179, -5 }, /* (41) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ + { 179, -5 }, /* (42) cmd ::= DROP QNODE ON DNODE NK_INTEGER */ + { 179, -5 }, /* (43) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ + { 179, -4 }, /* (44) cmd ::= DROP DATABASE exists_opt db_name */ + { 179, -2 }, /* (45) cmd ::= USE db_name */ + { 179, -4 }, /* (46) cmd ::= ALTER DATABASE db_name alter_db_options */ + { 187, -3 }, /* (47) not_exists_opt ::= IF NOT EXISTS */ + { 187, 0 }, /* (48) not_exists_opt ::= */ + { 190, -2 }, /* (49) exists_opt ::= IF EXISTS */ + { 190, 0 }, /* (50) exists_opt ::= */ + { 189, 0 }, /* (51) db_options ::= */ + { 189, -3 }, /* (52) db_options ::= db_options BLOCKS NK_INTEGER */ + { 189, -3 }, /* (53) db_options ::= db_options CACHE NK_INTEGER */ + { 189, -3 }, /* (54) db_options ::= db_options CACHELAST NK_INTEGER */ + { 189, -3 }, /* (55) db_options ::= db_options COMP NK_INTEGER */ + { 189, -3 }, /* (56) db_options ::= db_options DAYS NK_INTEGER */ + { 189, -3 }, /* (57) db_options ::= db_options FSYNC NK_INTEGER */ + { 189, -3 }, /* (58) db_options ::= db_options MAXROWS NK_INTEGER */ + { 189, -3 }, /* (59) db_options ::= db_options MINROWS NK_INTEGER */ + { 189, -3 }, /* (60) db_options ::= db_options KEEP NK_INTEGER */ + { 189, -3 }, /* (61) db_options ::= db_options PRECISION NK_STRING */ + { 189, -3 }, /* (62) db_options ::= db_options QUORUM NK_INTEGER */ + { 189, -3 }, /* (63) db_options ::= db_options REPLICA NK_INTEGER */ + { 189, -3 }, /* (64) db_options ::= db_options TTL NK_INTEGER */ + { 189, -3 }, /* (65) db_options ::= db_options WAL NK_INTEGER */ + { 189, -3 }, /* (66) db_options ::= db_options VGROUPS NK_INTEGER */ + { 189, -3 }, /* (67) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ + { 189, -3 }, /* (68) db_options ::= db_options STREAM_MODE NK_INTEGER */ + { 189, -3 }, /* (69) db_options ::= db_options RETENTIONS NK_STRING */ + { 191, -1 }, /* (70) alter_db_options ::= alter_db_option */ + { 191, -2 }, /* (71) alter_db_options ::= alter_db_options alter_db_option */ + { 192, -2 }, /* (72) alter_db_option ::= BLOCKS NK_INTEGER */ + { 192, -2 }, /* (73) alter_db_option ::= FSYNC NK_INTEGER */ + { 192, -2 }, /* (74) alter_db_option ::= KEEP NK_INTEGER */ + { 192, -2 }, /* (75) alter_db_option ::= WAL NK_INTEGER */ + { 192, -2 }, /* (76) alter_db_option ::= QUORUM NK_INTEGER */ + { 192, -2 }, /* (77) alter_db_option ::= CACHELAST NK_INTEGER */ + { 179, -9 }, /* (78) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ + { 179, -3 }, /* (79) cmd ::= CREATE TABLE multi_create_clause */ + { 179, -9 }, /* (80) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ + { 179, -3 }, /* (81) cmd ::= DROP TABLE multi_drop_clause */ + { 179, -4 }, /* (82) cmd ::= DROP STABLE exists_opt full_table_name */ + { 179, -3 }, /* (83) cmd ::= ALTER TABLE alter_table_clause */ + { 179, -3 }, /* (84) cmd ::= ALTER STABLE alter_table_clause */ + { 200, -2 }, /* (85) alter_table_clause ::= full_table_name alter_table_options */ + { 200, -5 }, /* (86) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ + { 200, -4 }, /* (87) alter_table_clause ::= full_table_name DROP COLUMN column_name */ + { 200, -5 }, /* (88) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ + { 200, -5 }, /* (89) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ + { 200, -5 }, /* (90) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ + { 200, -4 }, /* (91) alter_table_clause ::= full_table_name DROP TAG column_name */ + { 200, -5 }, /* (92) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ + { 200, -5 }, /* (93) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ + { 200, -6 }, /* (94) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ literal */ + { 197, -1 }, /* (95) multi_create_clause ::= create_subtable_clause */ + { 197, -2 }, /* (96) multi_create_clause ::= multi_create_clause create_subtable_clause */ + { 204, -9 }, /* (97) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP */ + { 199, -1 }, /* (98) multi_drop_clause ::= drop_table_clause */ + { 199, -2 }, /* (99) multi_drop_clause ::= multi_drop_clause drop_table_clause */ + { 207, -2 }, /* (100) drop_table_clause ::= exists_opt full_table_name */ + { 205, 0 }, /* (101) specific_tags_opt ::= */ + { 205, -3 }, /* (102) specific_tags_opt ::= NK_LP col_name_list NK_RP */ + { 193, -1 }, /* (103) full_table_name ::= table_name */ + { 193, -3 }, /* (104) full_table_name ::= db_name NK_DOT table_name */ + { 194, -1 }, /* (105) column_def_list ::= column_def */ + { 194, -3 }, /* (106) column_def_list ::= column_def_list NK_COMMA column_def */ + { 210, -2 }, /* (107) column_def ::= column_name type_name */ + { 210, -4 }, /* (108) column_def ::= column_name type_name COMMENT NK_STRING */ + { 203, -1 }, /* (109) type_name ::= BOOL */ + { 203, -1 }, /* (110) type_name ::= TINYINT */ + { 203, -1 }, /* (111) type_name ::= SMALLINT */ + { 203, -1 }, /* (112) type_name ::= INT */ + { 203, -1 }, /* (113) type_name ::= INTEGER */ + { 203, -1 }, /* (114) type_name ::= BIGINT */ + { 203, -1 }, /* (115) type_name ::= FLOAT */ + { 203, -1 }, /* (116) type_name ::= DOUBLE */ + { 203, -4 }, /* (117) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ + { 203, -1 }, /* (118) type_name ::= TIMESTAMP */ + { 203, -4 }, /* (119) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ + { 203, -2 }, /* (120) type_name ::= TINYINT UNSIGNED */ + { 203, -2 }, /* (121) type_name ::= SMALLINT UNSIGNED */ + { 203, -2 }, /* (122) type_name ::= INT UNSIGNED */ + { 203, -2 }, /* (123) type_name ::= BIGINT UNSIGNED */ + { 203, -1 }, /* (124) type_name ::= JSON */ + { 203, -4 }, /* (125) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ + { 203, -1 }, /* (126) type_name ::= MEDIUMBLOB */ + { 203, -1 }, /* (127) type_name ::= BLOB */ + { 203, -4 }, /* (128) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ + { 203, -1 }, /* (129) type_name ::= DECIMAL */ + { 203, -4 }, /* (130) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ + { 203, -6 }, /* (131) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + { 195, 0 }, /* (132) tags_def_opt ::= */ + { 195, -1 }, /* (133) tags_def_opt ::= tags_def */ + { 198, -4 }, /* (134) tags_def ::= TAGS NK_LP column_def_list NK_RP */ + { 196, 0 }, /* (135) table_options ::= */ + { 196, -3 }, /* (136) table_options ::= table_options COMMENT NK_STRING */ + { 196, -3 }, /* (137) table_options ::= table_options KEEP NK_INTEGER */ + { 196, -3 }, /* (138) table_options ::= table_options TTL NK_INTEGER */ + { 196, -5 }, /* (139) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ + { 196, -5 }, /* (140) table_options ::= table_options ROLLUP NK_LP func_name_list NK_RP */ + { 196, -3 }, /* (141) table_options ::= table_options FILE_FACTOR NK_FLOAT */ + { 196, -3 }, /* (142) table_options ::= table_options DELAY NK_INTEGER */ + { 201, -1 }, /* (143) alter_table_options ::= alter_table_option */ + { 201, -2 }, /* (144) alter_table_options ::= alter_table_options alter_table_option */ + { 212, -2 }, /* (145) alter_table_option ::= COMMENT NK_STRING */ + { 212, -2 }, /* (146) alter_table_option ::= KEEP NK_INTEGER */ + { 212, -2 }, /* (147) alter_table_option ::= TTL NK_INTEGER */ + { 208, -1 }, /* (148) col_name_list ::= col_name */ + { 208, -3 }, /* (149) col_name_list ::= col_name_list NK_COMMA col_name */ + { 213, -1 }, /* (150) col_name ::= column_name */ + { 179, -2 }, /* (151) cmd ::= SHOW DNODES */ + { 179, -2 }, /* (152) cmd ::= SHOW USERS */ + { 179, -2 }, /* (153) cmd ::= SHOW DATABASES */ + { 179, -4 }, /* (154) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ + { 179, -4 }, /* (155) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ + { 179, -3 }, /* (156) cmd ::= SHOW db_name_cond_opt VGROUPS */ + { 179, -2 }, /* (157) cmd ::= SHOW MNODES */ + { 179, -2 }, /* (158) cmd ::= SHOW MODULES */ + { 179, -2 }, /* (159) cmd ::= SHOW QNODES */ + { 179, -2 }, /* (160) cmd ::= SHOW FUNCTIONS */ + { 179, -5 }, /* (161) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ + { 179, -2 }, /* (162) cmd ::= SHOW STREAMS */ + { 214, 0 }, /* (163) db_name_cond_opt ::= */ + { 214, -2 }, /* (164) db_name_cond_opt ::= db_name NK_DOT */ + { 215, 0 }, /* (165) like_pattern_opt ::= */ + { 215, -2 }, /* (166) like_pattern_opt ::= LIKE NK_STRING */ + { 216, -1 }, /* (167) table_name_cond ::= table_name */ + { 217, 0 }, /* (168) from_db_opt ::= */ + { 217, -2 }, /* (169) from_db_opt ::= FROM db_name */ + { 211, -1 }, /* (170) func_name_list ::= func_name */ + { 211, -3 }, /* (171) func_name_list ::= func_name_list NK_COMMA col_name */ + { 218, -1 }, /* (172) func_name ::= function_name */ + { 179, -8 }, /* (173) cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ + { 179, -10 }, /* (174) cmd ::= CREATE FULLTEXT INDEX not_exists_opt index_name ON table_name NK_LP col_name_list NK_RP */ + { 179, -6 }, /* (175) cmd ::= DROP INDEX exists_opt index_name ON table_name */ + { 221, 0 }, /* (176) index_options ::= */ + { 221, -9 }, /* (177) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt */ + { 221, -11 }, /* (178) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt */ + { 222, -1 }, /* (179) func_list ::= func */ + { 222, -3 }, /* (180) func_list ::= func_list NK_COMMA func */ + { 225, -4 }, /* (181) func ::= function_name NK_LP expression_list NK_RP */ + { 179, -6 }, /* (182) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ + { 179, -6 }, /* (183) cmd ::= CREATE TOPIC not_exists_opt topic_name AS db_name */ + { 179, -4 }, /* (184) cmd ::= DROP TOPIC exists_opt topic_name */ + { 179, -2 }, /* (185) cmd ::= DESC full_table_name */ + { 179, -2 }, /* (186) cmd ::= DESCRIBE full_table_name */ + { 179, -3 }, /* (187) cmd ::= RESET QUERY CACHE */ + { 179, -4 }, /* (188) cmd ::= EXPLAIN analyze_opt explain_options query_expression */ + { 229, 0 }, /* (189) analyze_opt ::= */ + { 229, -1 }, /* (190) analyze_opt ::= ANALYZE */ + { 230, 0 }, /* (191) explain_options ::= */ + { 230, -3 }, /* (192) explain_options ::= explain_options VERBOSE NK_BOOL */ + { 230, -3 }, /* (193) explain_options ::= explain_options RATIO NK_FLOAT */ + { 179, -1 }, /* (194) cmd ::= query_expression */ + { 182, -1 }, /* (195) literal ::= NK_INTEGER */ + { 182, -1 }, /* (196) literal ::= NK_FLOAT */ + { 182, -1 }, /* (197) literal ::= NK_STRING */ + { 182, -1 }, /* (198) literal ::= NK_BOOL */ + { 182, -2 }, /* (199) literal ::= TIMESTAMP NK_STRING */ + { 182, -1 }, /* (200) literal ::= duration_literal */ + { 182, -1 }, /* (201) literal ::= NULL */ + { 223, -1 }, /* (202) duration_literal ::= NK_VARIABLE */ + { 231, -1 }, /* (203) signed ::= NK_INTEGER */ + { 231, -2 }, /* (204) signed ::= NK_PLUS NK_INTEGER */ + { 231, -2 }, /* (205) signed ::= NK_MINUS NK_INTEGER */ + { 231, -1 }, /* (206) signed ::= NK_FLOAT */ + { 231, -2 }, /* (207) signed ::= NK_PLUS NK_FLOAT */ + { 231, -2 }, /* (208) signed ::= NK_MINUS NK_FLOAT */ + { 232, -1 }, /* (209) signed_literal ::= signed */ + { 232, -1 }, /* (210) signed_literal ::= NK_STRING */ + { 232, -1 }, /* (211) signed_literal ::= NK_BOOL */ + { 232, -2 }, /* (212) signed_literal ::= TIMESTAMP NK_STRING */ + { 232, -1 }, /* (213) signed_literal ::= duration_literal */ + { 232, -1 }, /* (214) signed_literal ::= NULL */ + { 206, -1 }, /* (215) literal_list ::= signed_literal */ + { 206, -3 }, /* (216) literal_list ::= literal_list NK_COMMA signed_literal */ + { 188, -1 }, /* (217) db_name ::= NK_ID */ + { 209, -1 }, /* (218) table_name ::= NK_ID */ + { 202, -1 }, /* (219) column_name ::= NK_ID */ + { 219, -1 }, /* (220) function_name ::= NK_ID */ + { 233, -1 }, /* (221) table_alias ::= NK_ID */ + { 234, -1 }, /* (222) column_alias ::= NK_ID */ + { 184, -1 }, /* (223) user_name ::= NK_ID */ + { 220, -1 }, /* (224) index_name ::= NK_ID */ + { 227, -1 }, /* (225) topic_name ::= NK_ID */ + { 235, -1 }, /* (226) expression ::= literal */ + { 235, -1 }, /* (227) expression ::= pseudo_column */ + { 235, -1 }, /* (228) expression ::= column_reference */ + { 235, -4 }, /* (229) expression ::= function_name NK_LP expression_list NK_RP */ + { 235, -4 }, /* (230) expression ::= function_name NK_LP NK_STAR NK_RP */ + { 235, -1 }, /* (231) expression ::= subquery */ + { 235, -3 }, /* (232) expression ::= NK_LP expression NK_RP */ + { 235, -2 }, /* (233) expression ::= NK_PLUS expression */ + { 235, -2 }, /* (234) expression ::= NK_MINUS expression */ + { 235, -3 }, /* (235) expression ::= expression NK_PLUS expression */ + { 235, -3 }, /* (236) expression ::= expression NK_MINUS expression */ + { 235, -3 }, /* (237) expression ::= expression NK_STAR expression */ + { 235, -3 }, /* (238) expression ::= expression NK_SLASH expression */ + { 235, -3 }, /* (239) expression ::= expression NK_REM expression */ + { 226, -1 }, /* (240) expression_list ::= expression */ + { 226, -3 }, /* (241) expression_list ::= expression_list NK_COMMA expression */ + { 237, -1 }, /* (242) column_reference ::= column_name */ + { 237, -3 }, /* (243) column_reference ::= table_name NK_DOT column_name */ + { 236, -2 }, /* (244) pseudo_column ::= NK_UNDERLINE ROWTS */ + { 236, -1 }, /* (245) pseudo_column ::= TBNAME */ + { 236, -2 }, /* (246) pseudo_column ::= NK_UNDERLINE QSTARTTS */ + { 236, -2 }, /* (247) pseudo_column ::= NK_UNDERLINE QENDTS */ + { 236, -2 }, /* (248) pseudo_column ::= NK_UNDERLINE WSTARTTS */ + { 236, -2 }, /* (249) pseudo_column ::= NK_UNDERLINE WENDTS */ + { 236, -2 }, /* (250) pseudo_column ::= NK_UNDERLINE WDURATION */ + { 239, -3 }, /* (251) predicate ::= expression compare_op expression */ + { 239, -5 }, /* (252) predicate ::= expression BETWEEN expression AND expression */ + { 239, -6 }, /* (253) predicate ::= expression NOT BETWEEN expression AND expression */ + { 239, -3 }, /* (254) predicate ::= expression IS NULL */ + { 239, -4 }, /* (255) predicate ::= expression IS NOT NULL */ + { 239, -3 }, /* (256) predicate ::= expression in_op in_predicate_value */ + { 240, -1 }, /* (257) compare_op ::= NK_LT */ + { 240, -1 }, /* (258) compare_op ::= NK_GT */ + { 240, -1 }, /* (259) compare_op ::= NK_LE */ + { 240, -1 }, /* (260) compare_op ::= NK_GE */ + { 240, -1 }, /* (261) compare_op ::= NK_NE */ + { 240, -1 }, /* (262) compare_op ::= NK_EQ */ + { 240, -1 }, /* (263) compare_op ::= LIKE */ + { 240, -2 }, /* (264) compare_op ::= NOT LIKE */ + { 240, -1 }, /* (265) compare_op ::= MATCH */ + { 240, -1 }, /* (266) compare_op ::= NMATCH */ + { 241, -1 }, /* (267) in_op ::= IN */ + { 241, -2 }, /* (268) in_op ::= NOT IN */ + { 242, -3 }, /* (269) in_predicate_value ::= NK_LP expression_list NK_RP */ + { 243, -1 }, /* (270) boolean_value_expression ::= boolean_primary */ + { 243, -2 }, /* (271) boolean_value_expression ::= NOT boolean_primary */ + { 243, -3 }, /* (272) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + { 243, -3 }, /* (273) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + { 244, -1 }, /* (274) boolean_primary ::= predicate */ + { 244, -3 }, /* (275) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + { 245, -1 }, /* (276) common_expression ::= expression */ + { 245, -1 }, /* (277) common_expression ::= boolean_value_expression */ + { 246, -2 }, /* (278) from_clause ::= FROM table_reference_list */ + { 247, -1 }, /* (279) table_reference_list ::= table_reference */ + { 247, -3 }, /* (280) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + { 248, -1 }, /* (281) table_reference ::= table_primary */ + { 248, -1 }, /* (282) table_reference ::= joined_table */ + { 249, -2 }, /* (283) table_primary ::= table_name alias_opt */ + { 249, -4 }, /* (284) table_primary ::= db_name NK_DOT table_name alias_opt */ + { 249, -2 }, /* (285) table_primary ::= subquery alias_opt */ + { 249, -1 }, /* (286) table_primary ::= parenthesized_joined_table */ + { 251, 0 }, /* (287) alias_opt ::= */ + { 251, -1 }, /* (288) alias_opt ::= table_alias */ + { 251, -2 }, /* (289) alias_opt ::= AS table_alias */ + { 252, -3 }, /* (290) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + { 252, -3 }, /* (291) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + { 250, -6 }, /* (292) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ + { 253, 0 }, /* (293) join_type ::= */ + { 253, -1 }, /* (294) join_type ::= INNER */ + { 255, -9 }, /* (295) 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 */ + { 256, 0 }, /* (296) set_quantifier_opt ::= */ + { 256, -1 }, /* (297) set_quantifier_opt ::= DISTINCT */ + { 256, -1 }, /* (298) set_quantifier_opt ::= ALL */ + { 257, -1 }, /* (299) select_list ::= NK_STAR */ + { 257, -1 }, /* (300) select_list ::= select_sublist */ + { 263, -1 }, /* (301) select_sublist ::= select_item */ + { 263, -3 }, /* (302) select_sublist ::= select_sublist NK_COMMA select_item */ + { 264, -1 }, /* (303) select_item ::= common_expression */ + { 264, -2 }, /* (304) select_item ::= common_expression column_alias */ + { 264, -3 }, /* (305) select_item ::= common_expression AS column_alias */ + { 264, -3 }, /* (306) select_item ::= table_name NK_DOT NK_STAR */ + { 258, 0 }, /* (307) where_clause_opt ::= */ + { 258, -2 }, /* (308) where_clause_opt ::= WHERE search_condition */ + { 259, 0 }, /* (309) partition_by_clause_opt ::= */ + { 259, -3 }, /* (310) partition_by_clause_opt ::= PARTITION BY expression_list */ + { 260, 0 }, /* (311) twindow_clause_opt ::= */ + { 260, -6 }, /* (312) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ + { 260, -4 }, /* (313) twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP */ + { 260, -6 }, /* (314) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ + { 260, -8 }, /* (315) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ + { 224, 0 }, /* (316) sliding_opt ::= */ + { 224, -4 }, /* (317) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ + { 265, 0 }, /* (318) fill_opt ::= */ + { 265, -4 }, /* (319) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + { 265, -6 }, /* (320) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ + { 266, -1 }, /* (321) fill_mode ::= NONE */ + { 266, -1 }, /* (322) fill_mode ::= PREV */ + { 266, -1 }, /* (323) fill_mode ::= NULL */ + { 266, -1 }, /* (324) fill_mode ::= LINEAR */ + { 266, -1 }, /* (325) fill_mode ::= NEXT */ + { 261, 0 }, /* (326) group_by_clause_opt ::= */ + { 261, -3 }, /* (327) group_by_clause_opt ::= GROUP BY group_by_list */ + { 267, -1 }, /* (328) group_by_list ::= expression */ + { 267, -3 }, /* (329) group_by_list ::= group_by_list NK_COMMA expression */ + { 262, 0 }, /* (330) having_clause_opt ::= */ + { 262, -2 }, /* (331) having_clause_opt ::= HAVING search_condition */ + { 228, -4 }, /* (332) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ + { 268, -1 }, /* (333) query_expression_body ::= query_primary */ + { 268, -4 }, /* (334) query_expression_body ::= query_expression_body UNION ALL query_expression_body */ + { 272, -1 }, /* (335) query_primary ::= query_specification */ + { 269, 0 }, /* (336) order_by_clause_opt ::= */ + { 269, -3 }, /* (337) order_by_clause_opt ::= ORDER BY sort_specification_list */ + { 270, 0 }, /* (338) slimit_clause_opt ::= */ + { 270, -2 }, /* (339) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + { 270, -4 }, /* (340) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + { 270, -4 }, /* (341) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 271, 0 }, /* (342) limit_clause_opt ::= */ + { 271, -2 }, /* (343) limit_clause_opt ::= LIMIT NK_INTEGER */ + { 271, -4 }, /* (344) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + { 271, -4 }, /* (345) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 238, -3 }, /* (346) subquery ::= NK_LP query_expression NK_RP */ + { 254, -1 }, /* (347) search_condition ::= common_expression */ + { 273, -1 }, /* (348) sort_specification_list ::= sort_specification */ + { 273, -3 }, /* (349) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + { 274, -3 }, /* (350) sort_specification ::= expression ordering_specification_opt null_ordering_opt */ + { 275, 0 }, /* (351) ordering_specification_opt ::= */ + { 275, -1 }, /* (352) ordering_specification_opt ::= ASC */ + { 275, -1 }, /* (353) ordering_specification_opt ::= DESC */ + { 276, 0 }, /* (354) null_ordering_opt ::= */ + { 276, -2 }, /* (355) null_ordering_opt ::= NULLS FIRST */ + { 276, -2 }, /* (356) null_ordering_opt ::= NULLS LAST */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -2360,11 +2383,11 @@ static YYACTIONTYPE yy_reduce( YYMINORTYPE yylhsminor; case 0: /* cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ { pCxt->valid = false; generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } - yy_destructor(yypParser,177,&yymsp[0].minor); + yy_destructor(yypParser,180,&yymsp[0].minor); break; case 1: /* cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ { pCxt->valid = false; generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } - yy_destructor(yypParser,178,&yymsp[0].minor); + yy_destructor(yypParser,181,&yymsp[0].minor); break; case 2: /* account_options ::= */ { } @@ -2378,20 +2401,20 @@ static YYACTIONTYPE yy_reduce( case 9: /* account_options ::= account_options USERS literal */ yytestcase(yyruleno==9); case 10: /* account_options ::= account_options CONNS literal */ yytestcase(yyruleno==10); case 11: /* account_options ::= account_options STATE literal */ yytestcase(yyruleno==11); -{ yy_destructor(yypParser,177,&yymsp[-2].minor); +{ yy_destructor(yypParser,180,&yymsp[-2].minor); { } - yy_destructor(yypParser,179,&yymsp[0].minor); + yy_destructor(yypParser,182,&yymsp[0].minor); } break; case 12: /* alter_account_options ::= alter_account_option */ -{ yy_destructor(yypParser,180,&yymsp[0].minor); +{ yy_destructor(yypParser,183,&yymsp[0].minor); { } } break; case 13: /* alter_account_options ::= alter_account_options alter_account_option */ -{ yy_destructor(yypParser,178,&yymsp[-1].minor); +{ yy_destructor(yypParser,181,&yymsp[-1].minor); { } - yy_destructor(yypParser,180,&yymsp[0].minor); + yy_destructor(yypParser,183,&yymsp[0].minor); } break; case 14: /* alter_account_option ::= PASS literal */ @@ -2405,31 +2428,31 @@ static YYACTIONTYPE yy_reduce( case 22: /* alter_account_option ::= CONNS literal */ yytestcase(yyruleno==22); case 23: /* alter_account_option ::= STATE literal */ yytestcase(yyruleno==23); { } - yy_destructor(yypParser,179,&yymsp[0].minor); + yy_destructor(yypParser,182,&yymsp[0].minor); break; case 24: /* cmd ::= CREATE USER user_name PASS NK_STRING */ -{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-2].minor.yy437, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-2].minor.yy95, &yymsp[0].minor.yy0); } break; case 25: /* cmd ::= ALTER USER user_name PASS NK_STRING */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy437, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy95, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } break; case 26: /* cmd ::= ALTER USER user_name PRIVILEGE NK_STRING */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy437, TSDB_ALTER_USER_PRIVILEGES, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy95, TSDB_ALTER_USER_PRIVILEGES, &yymsp[0].minor.yy0); } break; case 27: /* cmd ::= DROP USER user_name */ -{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy437); } +{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy95); } break; case 28: /* cmd ::= CREATE DNODE dnode_endpoint */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy437, NULL); } +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy95, NULL); } break; case 29: /* cmd ::= CREATE DNODE dnode_host_name PORT NK_INTEGER */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy437, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy95, &yymsp[0].minor.yy0); } break; case 30: /* cmd ::= DROP DNODE NK_INTEGER */ { pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy0); } break; case 31: /* cmd ::= DROP DNODE dnode_endpoint */ -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy437); } +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy95); } break; case 32: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); } @@ -2446,17 +2469,17 @@ static YYACTIONTYPE yy_reduce( case 36: /* dnode_endpoint ::= NK_STRING */ case 37: /* dnode_host_name ::= NK_ID */ yytestcase(yyruleno==37); case 38: /* dnode_host_name ::= NK_IPTOKEN */ yytestcase(yyruleno==38); - case 214: /* db_name ::= NK_ID */ yytestcase(yyruleno==214); - case 215: /* table_name ::= NK_ID */ yytestcase(yyruleno==215); - case 216: /* column_name ::= NK_ID */ yytestcase(yyruleno==216); - case 217: /* function_name ::= NK_ID */ yytestcase(yyruleno==217); - case 218: /* table_alias ::= NK_ID */ yytestcase(yyruleno==218); - case 219: /* column_alias ::= NK_ID */ yytestcase(yyruleno==219); - case 220: /* user_name ::= NK_ID */ yytestcase(yyruleno==220); - case 221: /* index_name ::= NK_ID */ yytestcase(yyruleno==221); - case 222: /* topic_name ::= NK_ID */ yytestcase(yyruleno==222); -{ yylhsminor.yy437 = yymsp[0].minor.yy0; } - yymsp[0].minor.yy437 = yylhsminor.yy437; + case 217: /* db_name ::= NK_ID */ yytestcase(yyruleno==217); + case 218: /* table_name ::= NK_ID */ yytestcase(yyruleno==218); + case 219: /* column_name ::= NK_ID */ yytestcase(yyruleno==219); + case 220: /* function_name ::= NK_ID */ yytestcase(yyruleno==220); + case 221: /* table_alias ::= NK_ID */ yytestcase(yyruleno==221); + case 222: /* column_alias ::= NK_ID */ yytestcase(yyruleno==222); + case 223: /* user_name ::= NK_ID */ yytestcase(yyruleno==223); + case 224: /* index_name ::= NK_ID */ yytestcase(yyruleno==224); + case 225: /* topic_name ::= NK_ID */ yytestcase(yyruleno==225); +{ yylhsminor.yy95 = yymsp[0].minor.yy0; } + yymsp[0].minor.yy95 = yylhsminor.yy95; break; case 39: /* cmd ::= ALTER LOCAL NK_STRING */ { pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[0].minor.yy0, NULL); } @@ -2471,187 +2494,187 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createDropQnodeStmt(pCxt, &yymsp[0].minor.yy0); } break; case 43: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ -{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy493, &yymsp[-1].minor.yy437, yymsp[0].minor.yy364); } +{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy151, &yymsp[-1].minor.yy95, yymsp[0].minor.yy46); } break; case 44: /* cmd ::= DROP DATABASE exists_opt db_name */ -{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy493, &yymsp[0].minor.yy437); } +{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy151, &yymsp[0].minor.yy95); } break; case 45: /* cmd ::= USE db_name */ -{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy437); } +{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy95); } break; case 46: /* cmd ::= ALTER DATABASE db_name alter_db_options */ -{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy437, yymsp[0].minor.yy364); } +{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy95, yymsp[0].minor.yy46); } break; case 47: /* not_exists_opt ::= IF NOT EXISTS */ -{ yymsp[-2].minor.yy493 = true; } +{ yymsp[-2].minor.yy151 = true; } break; case 48: /* not_exists_opt ::= */ case 50: /* exists_opt ::= */ yytestcase(yyruleno==50); - case 186: /* analyze_opt ::= */ yytestcase(yyruleno==186); - case 293: /* set_quantifier_opt ::= */ yytestcase(yyruleno==293); -{ yymsp[1].minor.yy493 = false; } + case 189: /* analyze_opt ::= */ yytestcase(yyruleno==189); + case 296: /* set_quantifier_opt ::= */ yytestcase(yyruleno==296); +{ yymsp[1].minor.yy151 = false; } break; case 49: /* exists_opt ::= IF EXISTS */ -{ yymsp[-1].minor.yy493 = true; } +{ yymsp[-1].minor.yy151 = true; } break; case 51: /* db_options ::= */ -{ yymsp[1].minor.yy364 = createDefaultDatabaseOptions(pCxt); } +{ yymsp[1].minor.yy46 = createDefaultDatabaseOptions(pCxt); } break; case 52: /* db_options ::= db_options BLOCKS NK_INTEGER */ -{ yylhsminor.yy364 = setDatabaseOption(pCxt, yymsp[-2].minor.yy364, DB_OPTION_BLOCKS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy364 = yylhsminor.yy364; +{ yylhsminor.yy46 = setDatabaseOption(pCxt, yymsp[-2].minor.yy46, DB_OPTION_BLOCKS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy46 = yylhsminor.yy46; break; case 53: /* db_options ::= db_options CACHE NK_INTEGER */ -{ yylhsminor.yy364 = setDatabaseOption(pCxt, yymsp[-2].minor.yy364, DB_OPTION_CACHE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy364 = yylhsminor.yy364; +{ yylhsminor.yy46 = setDatabaseOption(pCxt, yymsp[-2].minor.yy46, DB_OPTION_CACHE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy46 = yylhsminor.yy46; break; case 54: /* db_options ::= db_options CACHELAST NK_INTEGER */ -{ yylhsminor.yy364 = setDatabaseOption(pCxt, yymsp[-2].minor.yy364, DB_OPTION_CACHELAST, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy364 = yylhsminor.yy364; +{ yylhsminor.yy46 = setDatabaseOption(pCxt, yymsp[-2].minor.yy46, DB_OPTION_CACHELAST, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy46 = yylhsminor.yy46; break; case 55: /* db_options ::= db_options COMP NK_INTEGER */ -{ yylhsminor.yy364 = setDatabaseOption(pCxt, yymsp[-2].minor.yy364, DB_OPTION_COMP, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy364 = yylhsminor.yy364; +{ yylhsminor.yy46 = setDatabaseOption(pCxt, yymsp[-2].minor.yy46, DB_OPTION_COMP, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy46 = yylhsminor.yy46; break; case 56: /* db_options ::= db_options DAYS NK_INTEGER */ -{ yylhsminor.yy364 = setDatabaseOption(pCxt, yymsp[-2].minor.yy364, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy364 = yylhsminor.yy364; +{ yylhsminor.yy46 = setDatabaseOption(pCxt, yymsp[-2].minor.yy46, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy46 = yylhsminor.yy46; break; case 57: /* db_options ::= db_options FSYNC NK_INTEGER */ -{ yylhsminor.yy364 = setDatabaseOption(pCxt, yymsp[-2].minor.yy364, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy364 = yylhsminor.yy364; +{ yylhsminor.yy46 = setDatabaseOption(pCxt, yymsp[-2].minor.yy46, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy46 = yylhsminor.yy46; break; case 58: /* db_options ::= db_options MAXROWS NK_INTEGER */ -{ yylhsminor.yy364 = setDatabaseOption(pCxt, yymsp[-2].minor.yy364, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy364 = yylhsminor.yy364; +{ yylhsminor.yy46 = setDatabaseOption(pCxt, yymsp[-2].minor.yy46, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy46 = yylhsminor.yy46; break; case 59: /* db_options ::= db_options MINROWS NK_INTEGER */ -{ yylhsminor.yy364 = setDatabaseOption(pCxt, yymsp[-2].minor.yy364, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy364 = yylhsminor.yy364; +{ yylhsminor.yy46 = setDatabaseOption(pCxt, yymsp[-2].minor.yy46, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy46 = yylhsminor.yy46; break; case 60: /* db_options ::= db_options KEEP NK_INTEGER */ -{ yylhsminor.yy364 = setDatabaseOption(pCxt, yymsp[-2].minor.yy364, DB_OPTION_KEEP, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy364 = yylhsminor.yy364; +{ yylhsminor.yy46 = setDatabaseOption(pCxt, yymsp[-2].minor.yy46, DB_OPTION_KEEP, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy46 = yylhsminor.yy46; break; case 61: /* db_options ::= db_options PRECISION NK_STRING */ -{ yylhsminor.yy364 = setDatabaseOption(pCxt, yymsp[-2].minor.yy364, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy364 = yylhsminor.yy364; +{ yylhsminor.yy46 = setDatabaseOption(pCxt, yymsp[-2].minor.yy46, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy46 = yylhsminor.yy46; break; case 62: /* db_options ::= db_options QUORUM NK_INTEGER */ -{ yylhsminor.yy364 = setDatabaseOption(pCxt, yymsp[-2].minor.yy364, DB_OPTION_QUORUM, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy364 = yylhsminor.yy364; +{ yylhsminor.yy46 = setDatabaseOption(pCxt, yymsp[-2].minor.yy46, DB_OPTION_QUORUM, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy46 = yylhsminor.yy46; break; case 63: /* db_options ::= db_options REPLICA NK_INTEGER */ -{ yylhsminor.yy364 = setDatabaseOption(pCxt, yymsp[-2].minor.yy364, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy364 = yylhsminor.yy364; +{ yylhsminor.yy46 = setDatabaseOption(pCxt, yymsp[-2].minor.yy46, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy46 = yylhsminor.yy46; break; case 64: /* db_options ::= db_options TTL NK_INTEGER */ -{ yylhsminor.yy364 = setDatabaseOption(pCxt, yymsp[-2].minor.yy364, DB_OPTION_TTL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy364 = yylhsminor.yy364; +{ yylhsminor.yy46 = setDatabaseOption(pCxt, yymsp[-2].minor.yy46, DB_OPTION_TTL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy46 = yylhsminor.yy46; break; case 65: /* db_options ::= db_options WAL NK_INTEGER */ -{ yylhsminor.yy364 = setDatabaseOption(pCxt, yymsp[-2].minor.yy364, DB_OPTION_WAL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy364 = yylhsminor.yy364; +{ yylhsminor.yy46 = setDatabaseOption(pCxt, yymsp[-2].minor.yy46, DB_OPTION_WAL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy46 = yylhsminor.yy46; break; case 66: /* db_options ::= db_options VGROUPS NK_INTEGER */ -{ yylhsminor.yy364 = setDatabaseOption(pCxt, yymsp[-2].minor.yy364, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy364 = yylhsminor.yy364; +{ yylhsminor.yy46 = setDatabaseOption(pCxt, yymsp[-2].minor.yy46, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy46 = yylhsminor.yy46; break; case 67: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */ -{ yylhsminor.yy364 = setDatabaseOption(pCxt, yymsp[-2].minor.yy364, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy364 = yylhsminor.yy364; +{ yylhsminor.yy46 = setDatabaseOption(pCxt, yymsp[-2].minor.yy46, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy46 = yylhsminor.yy46; break; case 68: /* db_options ::= db_options STREAM_MODE NK_INTEGER */ -{ yylhsminor.yy364 = setDatabaseOption(pCxt, yymsp[-2].minor.yy364, DB_OPTION_STREAM_MODE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy364 = yylhsminor.yy364; +{ yylhsminor.yy46 = setDatabaseOption(pCxt, yymsp[-2].minor.yy46, DB_OPTION_STREAM_MODE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy46 = yylhsminor.yy46; break; case 69: /* db_options ::= db_options RETENTIONS NK_STRING */ -{ yylhsminor.yy364 = setDatabaseOption(pCxt, yymsp[-2].minor.yy364, DB_OPTION_RETENTIONS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy364 = yylhsminor.yy364; +{ yylhsminor.yy46 = setDatabaseOption(pCxt, yymsp[-2].minor.yy46, DB_OPTION_RETENTIONS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy46 = yylhsminor.yy46; break; case 70: /* alter_db_options ::= alter_db_option */ -{ yylhsminor.yy364 = createDefaultAlterDatabaseOptions(pCxt); yylhsminor.yy364 = setDatabaseOption(pCxt, yylhsminor.yy364, yymsp[0].minor.yy29.type, &yymsp[0].minor.yy29.val); } - yymsp[0].minor.yy364 = yylhsminor.yy364; +{ yylhsminor.yy46 = createDefaultAlterDatabaseOptions(pCxt); yylhsminor.yy46 = setDatabaseOption(pCxt, yylhsminor.yy46, yymsp[0].minor.yy145.type, &yymsp[0].minor.yy145.val); } + yymsp[0].minor.yy46 = yylhsminor.yy46; break; case 71: /* alter_db_options ::= alter_db_options alter_db_option */ -{ yylhsminor.yy364 = setDatabaseOption(pCxt, yymsp[-1].minor.yy364, yymsp[0].minor.yy29.type, &yymsp[0].minor.yy29.val); } - yymsp[-1].minor.yy364 = yylhsminor.yy364; +{ yylhsminor.yy46 = setDatabaseOption(pCxt, yymsp[-1].minor.yy46, yymsp[0].minor.yy145.type, &yymsp[0].minor.yy145.val); } + yymsp[-1].minor.yy46 = yylhsminor.yy46; break; case 72: /* alter_db_option ::= BLOCKS NK_INTEGER */ -{ yymsp[-1].minor.yy29.type = DB_OPTION_BLOCKS; yymsp[-1].minor.yy29.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy145.type = DB_OPTION_BLOCKS; yymsp[-1].minor.yy145.val = yymsp[0].minor.yy0; } break; case 73: /* alter_db_option ::= FSYNC NK_INTEGER */ -{ yymsp[-1].minor.yy29.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy29.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy145.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy145.val = yymsp[0].minor.yy0; } break; case 74: /* alter_db_option ::= KEEP NK_INTEGER */ -{ yymsp[-1].minor.yy29.type = DB_OPTION_KEEP; yymsp[-1].minor.yy29.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy145.type = DB_OPTION_KEEP; yymsp[-1].minor.yy145.val = yymsp[0].minor.yy0; } break; case 75: /* alter_db_option ::= WAL NK_INTEGER */ -{ yymsp[-1].minor.yy29.type = DB_OPTION_WAL; yymsp[-1].minor.yy29.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy145.type = DB_OPTION_WAL; yymsp[-1].minor.yy145.val = yymsp[0].minor.yy0; } break; case 76: /* alter_db_option ::= QUORUM NK_INTEGER */ -{ yymsp[-1].minor.yy29.type = DB_OPTION_QUORUM; yymsp[-1].minor.yy29.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy145.type = DB_OPTION_QUORUM; yymsp[-1].minor.yy145.val = yymsp[0].minor.yy0; } break; case 77: /* alter_db_option ::= CACHELAST NK_INTEGER */ -{ yymsp[-1].minor.yy29.type = DB_OPTION_CACHELAST; yymsp[-1].minor.yy29.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy145.type = DB_OPTION_CACHELAST; yymsp[-1].minor.yy145.val = yymsp[0].minor.yy0; } break; case 78: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ case 80: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==80); -{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy493, yymsp[-5].minor.yy364, yymsp[-3].minor.yy40, yymsp[-1].minor.yy40, yymsp[0].minor.yy364); } +{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy151, yymsp[-5].minor.yy46, yymsp[-3].minor.yy194, yymsp[-1].minor.yy194, yymsp[0].minor.yy46); } break; case 79: /* cmd ::= CREATE TABLE multi_create_clause */ -{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy40); } +{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy194); } break; case 81: /* cmd ::= DROP TABLE multi_drop_clause */ -{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy40); } +{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy194); } break; case 82: /* cmd ::= DROP STABLE exists_opt full_table_name */ -{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy493, yymsp[0].minor.yy364); } +{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy151, yymsp[0].minor.yy46); } break; case 83: /* cmd ::= ALTER TABLE alter_table_clause */ case 84: /* cmd ::= ALTER STABLE alter_table_clause */ yytestcase(yyruleno==84); - case 191: /* cmd ::= query_expression */ yytestcase(yyruleno==191); -{ pCxt->pRootNode = yymsp[0].minor.yy364; } + case 194: /* cmd ::= query_expression */ yytestcase(yyruleno==194); +{ pCxt->pRootNode = yymsp[0].minor.yy46; } break; case 85: /* alter_table_clause ::= full_table_name alter_table_options */ -{ yylhsminor.yy364 = createAlterTableOption(pCxt, yymsp[-1].minor.yy364, yymsp[0].minor.yy364); } - yymsp[-1].minor.yy364 = yylhsminor.yy364; +{ yylhsminor.yy46 = createAlterTableOption(pCxt, yymsp[-1].minor.yy46, yymsp[0].minor.yy46); } + yymsp[-1].minor.yy46 = yylhsminor.yy46; break; case 86: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ -{ yylhsminor.yy364 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy364, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy437, yymsp[0].minor.yy420); } - yymsp[-4].minor.yy364 = yylhsminor.yy364; +{ yylhsminor.yy46 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy46, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy95, yymsp[0].minor.yy400); } + yymsp[-4].minor.yy46 = yylhsminor.yy46; break; case 87: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ -{ yylhsminor.yy364 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy364, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy437); } - yymsp[-3].minor.yy364 = yylhsminor.yy364; +{ yylhsminor.yy46 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy46, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy95); } + yymsp[-3].minor.yy46 = yylhsminor.yy46; break; case 88: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ -{ yylhsminor.yy364 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy364, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy437, yymsp[0].minor.yy420); } - yymsp[-4].minor.yy364 = yylhsminor.yy364; +{ yylhsminor.yy46 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy46, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy95, yymsp[0].minor.yy400); } + yymsp[-4].minor.yy46 = yylhsminor.yy46; break; case 89: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ -{ yylhsminor.yy364 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy364, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy437, &yymsp[0].minor.yy437); } - yymsp[-4].minor.yy364 = yylhsminor.yy364; +{ yylhsminor.yy46 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy46, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy95, &yymsp[0].minor.yy95); } + yymsp[-4].minor.yy46 = yylhsminor.yy46; break; case 90: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ -{ yylhsminor.yy364 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy364, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy437, yymsp[0].minor.yy420); } - yymsp[-4].minor.yy364 = yylhsminor.yy364; +{ yylhsminor.yy46 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy46, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy95, yymsp[0].minor.yy400); } + yymsp[-4].minor.yy46 = yylhsminor.yy46; break; case 91: /* alter_table_clause ::= full_table_name DROP TAG column_name */ -{ yylhsminor.yy364 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy364, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy437); } - yymsp[-3].minor.yy364 = yylhsminor.yy364; +{ yylhsminor.yy46 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy46, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy95); } + yymsp[-3].minor.yy46 = yylhsminor.yy46; break; case 92: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ -{ yylhsminor.yy364 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy364, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy437, yymsp[0].minor.yy420); } - yymsp[-4].minor.yy364 = yylhsminor.yy364; +{ yylhsminor.yy46 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy46, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy95, yymsp[0].minor.yy400); } + yymsp[-4].minor.yy46 = yylhsminor.yy46; break; case 93: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ -{ yylhsminor.yy364 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy364, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy437, &yymsp[0].minor.yy437); } - yymsp[-4].minor.yy364 = yylhsminor.yy364; +{ yylhsminor.yy46 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy46, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy95, &yymsp[0].minor.yy95); } + yymsp[-4].minor.yy46 = yylhsminor.yy46; break; case 94: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ literal */ -{ yylhsminor.yy364 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy364, &yymsp[-2].minor.yy437, yymsp[0].minor.yy364); } - yymsp[-5].minor.yy364 = yylhsminor.yy364; +{ yylhsminor.yy46 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy46, &yymsp[-2].minor.yy95, yymsp[0].minor.yy46); } + yymsp[-5].minor.yy46 = yylhsminor.yy46; break; case 95: /* multi_create_clause ::= create_subtable_clause */ case 98: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==98); @@ -2659,187 +2682,187 @@ static YYACTIONTYPE yy_reduce( case 148: /* col_name_list ::= col_name */ yytestcase(yyruleno==148); case 170: /* func_name_list ::= func_name */ yytestcase(yyruleno==170); case 179: /* func_list ::= func */ yytestcase(yyruleno==179); - case 212: /* literal_list ::= signed_literal */ yytestcase(yyruleno==212); - case 298: /* select_sublist ::= select_item */ yytestcase(yyruleno==298); - case 345: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==345); -{ yylhsminor.yy40 = createNodeList(pCxt, yymsp[0].minor.yy364); } - yymsp[0].minor.yy40 = yylhsminor.yy40; + case 215: /* literal_list ::= signed_literal */ yytestcase(yyruleno==215); + case 301: /* select_sublist ::= select_item */ yytestcase(yyruleno==301); + case 348: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==348); +{ yylhsminor.yy194 = createNodeList(pCxt, yymsp[0].minor.yy46); } + yymsp[0].minor.yy194 = yylhsminor.yy194; break; case 96: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ case 99: /* multi_drop_clause ::= multi_drop_clause drop_table_clause */ yytestcase(yyruleno==99); -{ yylhsminor.yy40 = addNodeToList(pCxt, yymsp[-1].minor.yy40, yymsp[0].minor.yy364); } - yymsp[-1].minor.yy40 = yylhsminor.yy40; +{ yylhsminor.yy194 = addNodeToList(pCxt, yymsp[-1].minor.yy194, yymsp[0].minor.yy46); } + yymsp[-1].minor.yy194 = yylhsminor.yy194; break; case 97: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP */ -{ yylhsminor.yy364 = createCreateSubTableClause(pCxt, yymsp[-8].minor.yy493, yymsp[-7].minor.yy364, yymsp[-5].minor.yy364, yymsp[-4].minor.yy40, yymsp[-1].minor.yy40); } - yymsp[-8].minor.yy364 = yylhsminor.yy364; +{ yylhsminor.yy46 = createCreateSubTableClause(pCxt, yymsp[-8].minor.yy151, yymsp[-7].minor.yy46, yymsp[-5].minor.yy46, yymsp[-4].minor.yy194, yymsp[-1].minor.yy194); } + yymsp[-8].minor.yy46 = yylhsminor.yy46; break; case 100: /* drop_table_clause ::= exists_opt full_table_name */ -{ yylhsminor.yy364 = createDropTableClause(pCxt, yymsp[-1].minor.yy493, yymsp[0].minor.yy364); } - yymsp[-1].minor.yy364 = yylhsminor.yy364; +{ yylhsminor.yy46 = createDropTableClause(pCxt, yymsp[-1].minor.yy151, yymsp[0].minor.yy46); } + yymsp[-1].minor.yy46 = yylhsminor.yy46; break; case 101: /* specific_tags_opt ::= */ case 132: /* tags_def_opt ::= */ yytestcase(yyruleno==132); - case 306: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==306); - case 323: /* group_by_clause_opt ::= */ yytestcase(yyruleno==323); - case 333: /* order_by_clause_opt ::= */ yytestcase(yyruleno==333); -{ yymsp[1].minor.yy40 = NULL; } + case 309: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==309); + case 326: /* group_by_clause_opt ::= */ yytestcase(yyruleno==326); + case 336: /* order_by_clause_opt ::= */ yytestcase(yyruleno==336); +{ yymsp[1].minor.yy194 = NULL; } break; case 102: /* specific_tags_opt ::= NK_LP col_name_list NK_RP */ -{ yymsp[-2].minor.yy40 = yymsp[-1].minor.yy40; } +{ yymsp[-2].minor.yy194 = yymsp[-1].minor.yy194; } break; case 103: /* full_table_name ::= table_name */ -{ yylhsminor.yy364 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy437, NULL); } - yymsp[0].minor.yy364 = yylhsminor.yy364; +{ yylhsminor.yy46 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy95, NULL); } + yymsp[0].minor.yy46 = yylhsminor.yy46; break; case 104: /* full_table_name ::= db_name NK_DOT table_name */ -{ yylhsminor.yy364 = createRealTableNode(pCxt, &yymsp[-2].minor.yy437, &yymsp[0].minor.yy437, NULL); } - yymsp[-2].minor.yy364 = yylhsminor.yy364; +{ yylhsminor.yy46 = createRealTableNode(pCxt, &yymsp[-2].minor.yy95, &yymsp[0].minor.yy95, NULL); } + yymsp[-2].minor.yy46 = yylhsminor.yy46; break; case 106: /* column_def_list ::= column_def_list NK_COMMA column_def */ case 149: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==149); case 171: /* func_name_list ::= func_name_list NK_COMMA col_name */ yytestcase(yyruleno==171); case 180: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==180); - case 213: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==213); - case 299: /* select_sublist ::= select_sublist NK_COMMA select_item */ yytestcase(yyruleno==299); - case 346: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==346); -{ yylhsminor.yy40 = addNodeToList(pCxt, yymsp[-2].minor.yy40, yymsp[0].minor.yy364); } - yymsp[-2].minor.yy40 = yylhsminor.yy40; + case 216: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==216); + case 302: /* select_sublist ::= select_sublist NK_COMMA select_item */ yytestcase(yyruleno==302); + case 349: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==349); +{ yylhsminor.yy194 = addNodeToList(pCxt, yymsp[-2].minor.yy194, yymsp[0].minor.yy46); } + yymsp[-2].minor.yy194 = yylhsminor.yy194; break; case 107: /* column_def ::= column_name type_name */ -{ yylhsminor.yy364 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy437, yymsp[0].minor.yy420, NULL); } - yymsp[-1].minor.yy364 = yylhsminor.yy364; +{ yylhsminor.yy46 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy95, yymsp[0].minor.yy400, NULL); } + yymsp[-1].minor.yy46 = yylhsminor.yy46; break; case 108: /* column_def ::= column_name type_name COMMENT NK_STRING */ -{ yylhsminor.yy364 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy437, yymsp[-2].minor.yy420, &yymsp[0].minor.yy0); } - yymsp[-3].minor.yy364 = yylhsminor.yy364; +{ yylhsminor.yy46 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy95, yymsp[-2].minor.yy400, &yymsp[0].minor.yy0); } + yymsp[-3].minor.yy46 = yylhsminor.yy46; break; case 109: /* type_name ::= BOOL */ -{ yymsp[0].minor.yy420 = createDataType(TSDB_DATA_TYPE_BOOL); } +{ yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_BOOL); } break; case 110: /* type_name ::= TINYINT */ -{ yymsp[0].minor.yy420 = createDataType(TSDB_DATA_TYPE_TINYINT); } +{ yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_TINYINT); } break; case 111: /* type_name ::= SMALLINT */ -{ yymsp[0].minor.yy420 = createDataType(TSDB_DATA_TYPE_SMALLINT); } +{ yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_SMALLINT); } break; case 112: /* type_name ::= INT */ case 113: /* type_name ::= INTEGER */ yytestcase(yyruleno==113); -{ yymsp[0].minor.yy420 = createDataType(TSDB_DATA_TYPE_INT); } +{ yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_INT); } break; case 114: /* type_name ::= BIGINT */ -{ yymsp[0].minor.yy420 = createDataType(TSDB_DATA_TYPE_BIGINT); } +{ yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_BIGINT); } break; case 115: /* type_name ::= FLOAT */ -{ yymsp[0].minor.yy420 = createDataType(TSDB_DATA_TYPE_FLOAT); } +{ yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_FLOAT); } break; case 116: /* type_name ::= DOUBLE */ -{ yymsp[0].minor.yy420 = createDataType(TSDB_DATA_TYPE_DOUBLE); } +{ yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_DOUBLE); } break; case 117: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy420 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy400 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } break; case 118: /* type_name ::= TIMESTAMP */ -{ yymsp[0].minor.yy420 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } +{ yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } break; case 119: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy420 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy400 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } break; case 120: /* type_name ::= TINYINT UNSIGNED */ -{ yymsp[-1].minor.yy420 = createDataType(TSDB_DATA_TYPE_UTINYINT); } +{ yymsp[-1].minor.yy400 = createDataType(TSDB_DATA_TYPE_UTINYINT); } break; case 121: /* type_name ::= SMALLINT UNSIGNED */ -{ yymsp[-1].minor.yy420 = createDataType(TSDB_DATA_TYPE_USMALLINT); } +{ yymsp[-1].minor.yy400 = createDataType(TSDB_DATA_TYPE_USMALLINT); } break; case 122: /* type_name ::= INT UNSIGNED */ -{ yymsp[-1].minor.yy420 = createDataType(TSDB_DATA_TYPE_UINT); } +{ yymsp[-1].minor.yy400 = createDataType(TSDB_DATA_TYPE_UINT); } break; case 123: /* type_name ::= BIGINT UNSIGNED */ -{ yymsp[-1].minor.yy420 = createDataType(TSDB_DATA_TYPE_UBIGINT); } +{ yymsp[-1].minor.yy400 = createDataType(TSDB_DATA_TYPE_UBIGINT); } break; case 124: /* type_name ::= JSON */ -{ yymsp[0].minor.yy420 = createDataType(TSDB_DATA_TYPE_JSON); } +{ yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_JSON); } break; case 125: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy420 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy400 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } break; case 126: /* type_name ::= MEDIUMBLOB */ -{ yymsp[0].minor.yy420 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } +{ yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } break; case 127: /* type_name ::= BLOB */ -{ yymsp[0].minor.yy420 = createDataType(TSDB_DATA_TYPE_BLOB); } +{ yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_BLOB); } break; case 128: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy420 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy400 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } break; case 129: /* type_name ::= DECIMAL */ -{ yymsp[0].minor.yy420 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +{ yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 130: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy420 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +{ yymsp[-3].minor.yy400 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 131: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ -{ yymsp[-5].minor.yy420 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +{ yymsp[-5].minor.yy400 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 133: /* tags_def_opt ::= tags_def */ - case 297: /* select_list ::= select_sublist */ yytestcase(yyruleno==297); -{ yylhsminor.yy40 = yymsp[0].minor.yy40; } - yymsp[0].minor.yy40 = yylhsminor.yy40; + case 300: /* select_list ::= select_sublist */ yytestcase(yyruleno==300); +{ yylhsminor.yy194 = yymsp[0].minor.yy194; } + yymsp[0].minor.yy194 = yylhsminor.yy194; break; case 134: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */ -{ yymsp[-3].minor.yy40 = yymsp[-1].minor.yy40; } +{ yymsp[-3].minor.yy194 = yymsp[-1].minor.yy194; } break; case 135: /* table_options ::= */ -{ yymsp[1].minor.yy364 = createDefaultTableOptions(pCxt); } +{ yymsp[1].minor.yy46 = createDefaultTableOptions(pCxt); } break; case 136: /* table_options ::= table_options COMMENT NK_STRING */ -{ yylhsminor.yy364 = setTableOption(pCxt, yymsp[-2].minor.yy364, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy364 = yylhsminor.yy364; +{ yylhsminor.yy46 = setTableOption(pCxt, yymsp[-2].minor.yy46, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy46 = yylhsminor.yy46; break; case 137: /* table_options ::= table_options KEEP NK_INTEGER */ -{ yylhsminor.yy364 = setTableOption(pCxt, yymsp[-2].minor.yy364, TABLE_OPTION_KEEP, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy364 = yylhsminor.yy364; +{ yylhsminor.yy46 = setTableOption(pCxt, yymsp[-2].minor.yy46, TABLE_OPTION_KEEP, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy46 = yylhsminor.yy46; break; case 138: /* table_options ::= table_options TTL NK_INTEGER */ -{ yylhsminor.yy364 = setTableOption(pCxt, yymsp[-2].minor.yy364, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy364 = yylhsminor.yy364; +{ yylhsminor.yy46 = setTableOption(pCxt, yymsp[-2].minor.yy46, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy46 = yylhsminor.yy46; break; case 139: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ -{ yylhsminor.yy364 = setTableSmaOption(pCxt, yymsp[-4].minor.yy364, yymsp[-1].minor.yy40); } - yymsp[-4].minor.yy364 = yylhsminor.yy364; +{ yylhsminor.yy46 = setTableSmaOption(pCxt, yymsp[-4].minor.yy46, yymsp[-1].minor.yy194); } + yymsp[-4].minor.yy46 = yylhsminor.yy46; break; case 140: /* table_options ::= table_options ROLLUP NK_LP func_name_list NK_RP */ -{ yylhsminor.yy364 = setTableRollupOption(pCxt, yymsp[-4].minor.yy364, yymsp[-1].minor.yy40); } - yymsp[-4].minor.yy364 = yylhsminor.yy364; +{ yylhsminor.yy46 = setTableRollupOption(pCxt, yymsp[-4].minor.yy46, yymsp[-1].minor.yy194); } + yymsp[-4].minor.yy46 = yylhsminor.yy46; break; case 141: /* table_options ::= table_options FILE_FACTOR NK_FLOAT */ -{ yylhsminor.yy364 = setTableOption(pCxt, yymsp[-2].minor.yy364, TABLE_OPTION_FILE_FACTOR, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy364 = yylhsminor.yy364; +{ yylhsminor.yy46 = setTableOption(pCxt, yymsp[-2].minor.yy46, TABLE_OPTION_FILE_FACTOR, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy46 = yylhsminor.yy46; break; case 142: /* table_options ::= table_options DELAY NK_INTEGER */ -{ yylhsminor.yy364 = setTableOption(pCxt, yymsp[-2].minor.yy364, TABLE_OPTION_DELAY, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy364 = yylhsminor.yy364; +{ yylhsminor.yy46 = setTableOption(pCxt, yymsp[-2].minor.yy46, TABLE_OPTION_DELAY, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy46 = yylhsminor.yy46; break; case 143: /* alter_table_options ::= alter_table_option */ -{ yylhsminor.yy364 = createDefaultAlterTableOptions(pCxt); yylhsminor.yy364 = setTableOption(pCxt, yylhsminor.yy364, yymsp[0].minor.yy29.type, &yymsp[0].minor.yy29.val); } - yymsp[0].minor.yy364 = yylhsminor.yy364; +{ yylhsminor.yy46 = createDefaultAlterTableOptions(pCxt); yylhsminor.yy46 = setTableOption(pCxt, yylhsminor.yy46, yymsp[0].minor.yy145.type, &yymsp[0].minor.yy145.val); } + yymsp[0].minor.yy46 = yylhsminor.yy46; break; case 144: /* alter_table_options ::= alter_table_options alter_table_option */ -{ yylhsminor.yy364 = setTableOption(pCxt, yymsp[-1].minor.yy364, yymsp[0].minor.yy29.type, &yymsp[0].minor.yy29.val); } - yymsp[-1].minor.yy364 = yylhsminor.yy364; +{ yylhsminor.yy46 = setTableOption(pCxt, yymsp[-1].minor.yy46, yymsp[0].minor.yy145.type, &yymsp[0].minor.yy145.val); } + yymsp[-1].minor.yy46 = yylhsminor.yy46; break; case 145: /* alter_table_option ::= COMMENT NK_STRING */ -{ yymsp[-1].minor.yy29.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy29.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy145.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy145.val = yymsp[0].minor.yy0; } break; case 146: /* alter_table_option ::= KEEP NK_INTEGER */ -{ yymsp[-1].minor.yy29.type = TABLE_OPTION_KEEP; yymsp[-1].minor.yy29.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy145.type = TABLE_OPTION_KEEP; yymsp[-1].minor.yy145.val = yymsp[0].minor.yy0; } break; case 147: /* alter_table_option ::= TTL NK_INTEGER */ -{ yymsp[-1].minor.yy29.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy29.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy145.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy145.val = yymsp[0].minor.yy0; } break; case 150: /* col_name ::= column_name */ -{ yylhsminor.yy364 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy437); } - yymsp[0].minor.yy364 = yylhsminor.yy364; +{ yylhsminor.yy46 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy95); } + yymsp[0].minor.yy46 = yylhsminor.yy46; break; case 151: /* cmd ::= SHOW DNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT, NULL, NULL); } @@ -2851,13 +2874,13 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT, NULL, NULL); } break; case 154: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy364, yymsp[0].minor.yy364); } +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy46, yymsp[0].minor.yy46); } break; case 155: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy364, yymsp[0].minor.yy364); } +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy46, yymsp[0].minor.yy46); } break; case 156: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy364, NULL); } +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy46, NULL); } break; case 157: /* cmd ::= SHOW MNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT, NULL, NULL); } @@ -2872,566 +2895,573 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT, NULL, NULL); } break; case 161: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[-1].minor.yy364, yymsp[0].minor.yy364); } +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[-1].minor.yy46, yymsp[0].minor.yy46); } break; case 162: /* cmd ::= SHOW STREAMS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT, NULL, NULL); } break; case 163: /* db_name_cond_opt ::= */ case 168: /* from_db_opt ::= */ yytestcase(yyruleno==168); -{ yymsp[1].minor.yy364 = createDefaultDatabaseCondValue(pCxt); } +{ yymsp[1].minor.yy46 = createDefaultDatabaseCondValue(pCxt); } break; case 164: /* db_name_cond_opt ::= db_name NK_DOT */ -{ yylhsminor.yy364 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy437); } - yymsp[-1].minor.yy364 = yylhsminor.yy364; +{ yylhsminor.yy46 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy95); } + yymsp[-1].minor.yy46 = yylhsminor.yy46; break; case 165: /* like_pattern_opt ::= */ case 176: /* index_options ::= */ yytestcase(yyruleno==176); - case 304: /* where_clause_opt ::= */ yytestcase(yyruleno==304); - case 308: /* twindow_clause_opt ::= */ yytestcase(yyruleno==308); - case 313: /* sliding_opt ::= */ yytestcase(yyruleno==313); - case 315: /* fill_opt ::= */ yytestcase(yyruleno==315); - case 327: /* having_clause_opt ::= */ yytestcase(yyruleno==327); - case 335: /* slimit_clause_opt ::= */ yytestcase(yyruleno==335); - case 339: /* limit_clause_opt ::= */ yytestcase(yyruleno==339); -{ yymsp[1].minor.yy364 = NULL; } + case 307: /* where_clause_opt ::= */ yytestcase(yyruleno==307); + case 311: /* twindow_clause_opt ::= */ yytestcase(yyruleno==311); + case 316: /* sliding_opt ::= */ yytestcase(yyruleno==316); + case 318: /* fill_opt ::= */ yytestcase(yyruleno==318); + case 330: /* having_clause_opt ::= */ yytestcase(yyruleno==330); + case 338: /* slimit_clause_opt ::= */ yytestcase(yyruleno==338); + case 342: /* limit_clause_opt ::= */ yytestcase(yyruleno==342); +{ yymsp[1].minor.yy46 = NULL; } break; case 166: /* like_pattern_opt ::= LIKE NK_STRING */ -{ yymsp[-1].minor.yy364 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } +{ yymsp[-1].minor.yy46 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } break; case 167: /* table_name_cond ::= table_name */ -{ yylhsminor.yy364 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy437); } - yymsp[0].minor.yy364 = yylhsminor.yy364; +{ yylhsminor.yy46 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy95); } + yymsp[0].minor.yy46 = yylhsminor.yy46; break; case 169: /* from_db_opt ::= FROM db_name */ -{ yymsp[-1].minor.yy364 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy437); } +{ yymsp[-1].minor.yy46 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy95); } break; case 172: /* func_name ::= function_name */ -{ yylhsminor.yy364 = createFunctionNode(pCxt, &yymsp[0].minor.yy437, NULL); } - yymsp[0].minor.yy364 = yylhsminor.yy364; +{ yylhsminor.yy46 = createFunctionNode(pCxt, &yymsp[0].minor.yy95, NULL); } + yymsp[0].minor.yy46 = yylhsminor.yy46; break; case 173: /* cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ -{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy493, &yymsp[-3].minor.yy437, &yymsp[-1].minor.yy437, NULL, yymsp[0].minor.yy364); } +{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy151, &yymsp[-3].minor.yy95, &yymsp[-1].minor.yy95, NULL, yymsp[0].minor.yy46); } break; case 174: /* cmd ::= CREATE FULLTEXT INDEX not_exists_opt index_name ON table_name NK_LP col_name_list NK_RP */ -{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_FULLTEXT, yymsp[-6].minor.yy493, &yymsp[-5].minor.yy437, &yymsp[-3].minor.yy437, yymsp[-1].minor.yy40, NULL); } +{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_FULLTEXT, yymsp[-6].minor.yy151, &yymsp[-5].minor.yy95, &yymsp[-3].minor.yy95, yymsp[-1].minor.yy194, NULL); } break; case 175: /* cmd ::= DROP INDEX exists_opt index_name ON table_name */ -{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-3].minor.yy493, &yymsp[-2].minor.yy437, &yymsp[0].minor.yy437); } +{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-3].minor.yy151, &yymsp[-2].minor.yy95, &yymsp[0].minor.yy95); } break; case 177: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt */ -{ yymsp[-8].minor.yy364 = createIndexOption(pCxt, yymsp[-6].minor.yy40, releaseRawExprNode(pCxt, yymsp[-2].minor.yy364), NULL, yymsp[0].minor.yy364); } +{ yymsp[-8].minor.yy46 = createIndexOption(pCxt, yymsp[-6].minor.yy194, releaseRawExprNode(pCxt, yymsp[-2].minor.yy46), NULL, yymsp[0].minor.yy46); } break; case 178: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt */ -{ yymsp[-10].minor.yy364 = createIndexOption(pCxt, yymsp[-8].minor.yy40, releaseRawExprNode(pCxt, yymsp[-4].minor.yy364), releaseRawExprNode(pCxt, yymsp[-2].minor.yy364), yymsp[0].minor.yy364); } +{ yymsp[-10].minor.yy46 = createIndexOption(pCxt, yymsp[-8].minor.yy194, releaseRawExprNode(pCxt, yymsp[-4].minor.yy46), releaseRawExprNode(pCxt, yymsp[-2].minor.yy46), yymsp[0].minor.yy46); } break; case 181: /* func ::= function_name NK_LP expression_list NK_RP */ -{ yylhsminor.yy364 = createFunctionNode(pCxt, &yymsp[-3].minor.yy437, yymsp[-1].minor.yy40); } - yymsp[-3].minor.yy364 = yylhsminor.yy364; +{ yylhsminor.yy46 = createFunctionNode(pCxt, &yymsp[-3].minor.yy95, yymsp[-1].minor.yy194); } + yymsp[-3].minor.yy46 = yylhsminor.yy46; break; case 182: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ -{ pCxt->pRootNode = createCreateTopicStmt(pCxt, yymsp[-3].minor.yy493, &yymsp[-2].minor.yy437, yymsp[0].minor.yy364, NULL); } +{ pCxt->pRootNode = createCreateTopicStmt(pCxt, yymsp[-3].minor.yy151, &yymsp[-2].minor.yy95, yymsp[0].minor.yy46, NULL); } break; case 183: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS db_name */ -{ pCxt->pRootNode = createCreateTopicStmt(pCxt, yymsp[-3].minor.yy493, &yymsp[-2].minor.yy437, NULL, &yymsp[0].minor.yy437); } +{ pCxt->pRootNode = createCreateTopicStmt(pCxt, yymsp[-3].minor.yy151, &yymsp[-2].minor.yy95, NULL, &yymsp[0].minor.yy95); } break; case 184: /* cmd ::= DROP TOPIC exists_opt topic_name */ -{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy493, &yymsp[0].minor.yy437); } +{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy151, &yymsp[0].minor.yy95); } break; - case 185: /* cmd ::= EXPLAIN analyze_opt explain_options query_expression */ -{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy493, yymsp[-1].minor.yy364, yymsp[0].minor.yy364); } + case 185: /* cmd ::= DESC full_table_name */ + case 186: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==186); +{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy46); } break; - case 187: /* analyze_opt ::= ANALYZE */ - case 294: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==294); -{ yymsp[0].minor.yy493 = true; } + case 187: /* cmd ::= RESET QUERY CACHE */ +{ pCxt->pRootNode = createResetQueryCacheStmt(pCxt); } break; - case 188: /* explain_options ::= */ -{ yymsp[1].minor.yy364 = createDefaultExplainOptions(pCxt); } + case 188: /* cmd ::= EXPLAIN analyze_opt explain_options query_expression */ +{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy151, yymsp[-1].minor.yy46, yymsp[0].minor.yy46); } break; - case 189: /* explain_options ::= explain_options VERBOSE NK_BOOL */ -{ yylhsminor.yy364 = setExplainVerbose(pCxt, yymsp[-2].minor.yy364, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy364 = yylhsminor.yy364; + case 190: /* analyze_opt ::= ANALYZE */ + case 297: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==297); +{ yymsp[0].minor.yy151 = true; } break; - case 190: /* explain_options ::= explain_options RATIO NK_FLOAT */ -{ yylhsminor.yy364 = setExplainRatio(pCxt, yymsp[-2].minor.yy364, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy364 = yylhsminor.yy364; + case 191: /* explain_options ::= */ +{ yymsp[1].minor.yy46 = createDefaultExplainOptions(pCxt); } break; - case 192: /* literal ::= NK_INTEGER */ -{ yylhsminor.yy364 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy364 = yylhsminor.yy364; + case 192: /* explain_options ::= explain_options VERBOSE NK_BOOL */ +{ yylhsminor.yy46 = setExplainVerbose(pCxt, yymsp[-2].minor.yy46, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy46 = yylhsminor.yy46; break; - case 193: /* literal ::= NK_FLOAT */ -{ yylhsminor.yy364 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy364 = yylhsminor.yy364; + case 193: /* explain_options ::= explain_options RATIO NK_FLOAT */ +{ yylhsminor.yy46 = setExplainRatio(pCxt, yymsp[-2].minor.yy46, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy46 = yylhsminor.yy46; break; - case 194: /* literal ::= NK_STRING */ -{ yylhsminor.yy364 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy364 = yylhsminor.yy364; + case 195: /* literal ::= NK_INTEGER */ +{ yylhsminor.yy46 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy46 = yylhsminor.yy46; break; - case 195: /* literal ::= NK_BOOL */ -{ yylhsminor.yy364 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy364 = yylhsminor.yy364; + case 196: /* literal ::= NK_FLOAT */ +{ yylhsminor.yy46 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy46 = yylhsminor.yy46; break; - case 196: /* literal ::= TIMESTAMP NK_STRING */ -{ yylhsminor.yy364 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } - yymsp[-1].minor.yy364 = yylhsminor.yy364; + case 197: /* literal ::= NK_STRING */ +{ yylhsminor.yy46 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy46 = yylhsminor.yy46; break; - case 197: /* literal ::= duration_literal */ - case 206: /* signed_literal ::= signed */ yytestcase(yyruleno==206); - case 223: /* expression ::= literal */ yytestcase(yyruleno==223); - case 224: /* expression ::= pseudo_column */ yytestcase(yyruleno==224); - case 225: /* expression ::= column_reference */ yytestcase(yyruleno==225); - case 228: /* expression ::= subquery */ yytestcase(yyruleno==228); - case 267: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==267); - case 271: /* boolean_primary ::= predicate */ yytestcase(yyruleno==271); - case 273: /* common_expression ::= expression */ yytestcase(yyruleno==273); - case 274: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==274); - case 276: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==276); - case 278: /* table_reference ::= table_primary */ yytestcase(yyruleno==278); - case 279: /* table_reference ::= joined_table */ yytestcase(yyruleno==279); - case 283: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==283); - case 330: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==330); - case 332: /* query_primary ::= query_specification */ yytestcase(yyruleno==332); -{ yylhsminor.yy364 = yymsp[0].minor.yy364; } - yymsp[0].minor.yy364 = yylhsminor.yy364; + case 198: /* literal ::= NK_BOOL */ +{ yylhsminor.yy46 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy46 = yylhsminor.yy46; break; - case 198: /* literal ::= NULL */ -{ yylhsminor.yy364 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, NULL)); } - yymsp[0].minor.yy364 = yylhsminor.yy364; + case 199: /* literal ::= TIMESTAMP NK_STRING */ +{ yylhsminor.yy46 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } + yymsp[-1].minor.yy46 = yylhsminor.yy46; break; - case 199: /* duration_literal ::= NK_VARIABLE */ -{ yylhsminor.yy364 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy364 = yylhsminor.yy364; + case 200: /* literal ::= duration_literal */ + case 209: /* signed_literal ::= signed */ yytestcase(yyruleno==209); + case 226: /* expression ::= literal */ yytestcase(yyruleno==226); + case 227: /* expression ::= pseudo_column */ yytestcase(yyruleno==227); + case 228: /* expression ::= column_reference */ yytestcase(yyruleno==228); + case 231: /* expression ::= subquery */ yytestcase(yyruleno==231); + case 270: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==270); + case 274: /* boolean_primary ::= predicate */ yytestcase(yyruleno==274); + case 276: /* common_expression ::= expression */ yytestcase(yyruleno==276); + case 277: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==277); + case 279: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==279); + case 281: /* table_reference ::= table_primary */ yytestcase(yyruleno==281); + case 282: /* table_reference ::= joined_table */ yytestcase(yyruleno==282); + case 286: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==286); + case 333: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==333); + case 335: /* query_primary ::= query_specification */ yytestcase(yyruleno==335); +{ yylhsminor.yy46 = yymsp[0].minor.yy46; } + yymsp[0].minor.yy46 = yylhsminor.yy46; break; - case 200: /* signed ::= NK_INTEGER */ -{ yylhsminor.yy364 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy364 = yylhsminor.yy364; + case 201: /* literal ::= NULL */ +{ yylhsminor.yy46 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, NULL)); } + yymsp[0].minor.yy46 = yylhsminor.yy46; break; - case 201: /* signed ::= NK_PLUS NK_INTEGER */ -{ yymsp[-1].minor.yy364 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } + case 202: /* duration_literal ::= NK_VARIABLE */ +{ yylhsminor.yy46 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy46 = yylhsminor.yy46; break; - case 202: /* signed ::= NK_MINUS NK_INTEGER */ + case 203: /* signed ::= NK_INTEGER */ +{ yylhsminor.yy46 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy46 = yylhsminor.yy46; + break; + case 204: /* signed ::= NK_PLUS NK_INTEGER */ +{ yymsp[-1].minor.yy46 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } + break; + case 205: /* signed ::= NK_MINUS NK_INTEGER */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy364 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); + yylhsminor.yy46 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); } - yymsp[-1].minor.yy364 = yylhsminor.yy364; + yymsp[-1].minor.yy46 = yylhsminor.yy46; break; - case 203: /* signed ::= NK_FLOAT */ -{ yylhsminor.yy364 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy364 = yylhsminor.yy364; + case 206: /* signed ::= NK_FLOAT */ +{ yylhsminor.yy46 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy46 = yylhsminor.yy46; break; - case 204: /* signed ::= NK_PLUS NK_FLOAT */ -{ yymsp[-1].minor.yy364 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + case 207: /* signed ::= NK_PLUS NK_FLOAT */ +{ yymsp[-1].minor.yy46 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } break; - case 205: /* signed ::= NK_MINUS NK_FLOAT */ + case 208: /* signed ::= NK_MINUS NK_FLOAT */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy364 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); + yylhsminor.yy46 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); } - yymsp[-1].minor.yy364 = yylhsminor.yy364; + yymsp[-1].minor.yy46 = yylhsminor.yy46; break; - case 207: /* signed_literal ::= NK_STRING */ -{ yylhsminor.yy364 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy364 = yylhsminor.yy364; + case 210: /* signed_literal ::= NK_STRING */ +{ yylhsminor.yy46 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy46 = yylhsminor.yy46; break; - case 208: /* signed_literal ::= NK_BOOL */ -{ yylhsminor.yy364 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy364 = yylhsminor.yy364; + case 211: /* signed_literal ::= NK_BOOL */ +{ yylhsminor.yy46 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy46 = yylhsminor.yy46; break; - case 209: /* signed_literal ::= TIMESTAMP NK_STRING */ -{ yymsp[-1].minor.yy364 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } + case 212: /* signed_literal ::= TIMESTAMP NK_STRING */ +{ yymsp[-1].minor.yy46 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } break; - case 210: /* signed_literal ::= duration_literal */ - case 344: /* search_condition ::= common_expression */ yytestcase(yyruleno==344); -{ yylhsminor.yy364 = releaseRawExprNode(pCxt, yymsp[0].minor.yy364); } - yymsp[0].minor.yy364 = yylhsminor.yy364; + case 213: /* signed_literal ::= duration_literal */ + case 347: /* search_condition ::= common_expression */ yytestcase(yyruleno==347); +{ yylhsminor.yy46 = releaseRawExprNode(pCxt, yymsp[0].minor.yy46); } + yymsp[0].minor.yy46 = yylhsminor.yy46; break; - case 211: /* signed_literal ::= NULL */ -{ yymsp[0].minor.yy364 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, NULL); } + case 214: /* signed_literal ::= NULL */ +{ yymsp[0].minor.yy46 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, NULL); } break; - case 226: /* expression ::= function_name NK_LP expression_list NK_RP */ -{ yylhsminor.yy364 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy437, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy437, yymsp[-1].minor.yy40)); } - yymsp[-3].minor.yy364 = yylhsminor.yy364; + case 229: /* expression ::= function_name NK_LP expression_list NK_RP */ +{ yylhsminor.yy46 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy95, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy95, yymsp[-1].minor.yy194)); } + yymsp[-3].minor.yy46 = yylhsminor.yy46; break; - case 227: /* expression ::= function_name NK_LP NK_STAR NK_RP */ -{ yylhsminor.yy364 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy437, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy437, createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy0)))); } - yymsp[-3].minor.yy364 = yylhsminor.yy364; + case 230: /* expression ::= function_name NK_LP NK_STAR NK_RP */ +{ yylhsminor.yy46 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy95, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy95, createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy0)))); } + yymsp[-3].minor.yy46 = yylhsminor.yy46; break; - case 229: /* expression ::= NK_LP expression NK_RP */ - case 272: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==272); -{ yylhsminor.yy364 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy364)); } - yymsp[-2].minor.yy364 = yylhsminor.yy364; + case 232: /* expression ::= NK_LP expression NK_RP */ + case 275: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==275); +{ yylhsminor.yy46 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy46)); } + yymsp[-2].minor.yy46 = yylhsminor.yy46; break; - case 230: /* expression ::= NK_PLUS expression */ + case 233: /* expression ::= NK_PLUS expression */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy364); - yylhsminor.yy364 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy364)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy46); + yylhsminor.yy46 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy46)); } - yymsp[-1].minor.yy364 = yylhsminor.yy364; + yymsp[-1].minor.yy46 = yylhsminor.yy46; break; - case 231: /* expression ::= NK_MINUS expression */ + case 234: /* expression ::= NK_MINUS expression */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy364); - yylhsminor.yy364 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[0].minor.yy364), NULL)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy46); + yylhsminor.yy46 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[0].minor.yy46), NULL)); } - yymsp[-1].minor.yy364 = yylhsminor.yy364; + yymsp[-1].minor.yy46 = yylhsminor.yy46; break; - case 232: /* expression ::= expression NK_PLUS expression */ + case 235: /* expression ::= expression NK_PLUS expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy364); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy364); - yylhsminor.yy364 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy364), releaseRawExprNode(pCxt, yymsp[0].minor.yy364))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy46); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy46); + yylhsminor.yy46 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy46), releaseRawExprNode(pCxt, yymsp[0].minor.yy46))); } - yymsp[-2].minor.yy364 = yylhsminor.yy364; + yymsp[-2].minor.yy46 = yylhsminor.yy46; break; - case 233: /* expression ::= expression NK_MINUS expression */ + case 236: /* expression ::= expression NK_MINUS expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy364); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy364); - yylhsminor.yy364 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy364), releaseRawExprNode(pCxt, yymsp[0].minor.yy364))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy46); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy46); + yylhsminor.yy46 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy46), releaseRawExprNode(pCxt, yymsp[0].minor.yy46))); } - yymsp[-2].minor.yy364 = yylhsminor.yy364; + yymsp[-2].minor.yy46 = yylhsminor.yy46; break; - case 234: /* expression ::= expression NK_STAR expression */ + case 237: /* expression ::= expression NK_STAR expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy364); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy364); - yylhsminor.yy364 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy364), releaseRawExprNode(pCxt, yymsp[0].minor.yy364))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy46); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy46); + yylhsminor.yy46 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy46), releaseRawExprNode(pCxt, yymsp[0].minor.yy46))); } - yymsp[-2].minor.yy364 = yylhsminor.yy364; + yymsp[-2].minor.yy46 = yylhsminor.yy46; break; - case 235: /* expression ::= expression NK_SLASH expression */ + case 238: /* expression ::= expression NK_SLASH expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy364); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy364); - yylhsminor.yy364 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy364), releaseRawExprNode(pCxt, yymsp[0].minor.yy364))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy46); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy46); + yylhsminor.yy46 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy46), releaseRawExprNode(pCxt, yymsp[0].minor.yy46))); } - yymsp[-2].minor.yy364 = yylhsminor.yy364; + yymsp[-2].minor.yy46 = yylhsminor.yy46; break; - case 236: /* expression ::= expression NK_REM expression */ + case 239: /* expression ::= expression NK_REM expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy364); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy364); - yylhsminor.yy364 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MOD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy364), releaseRawExprNode(pCxt, yymsp[0].minor.yy364))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy46); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy46); + yylhsminor.yy46 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MOD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy46), releaseRawExprNode(pCxt, yymsp[0].minor.yy46))); } - yymsp[-2].minor.yy364 = yylhsminor.yy364; + yymsp[-2].minor.yy46 = yylhsminor.yy46; break; - case 237: /* expression_list ::= expression */ -{ yylhsminor.yy40 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy364)); } - yymsp[0].minor.yy40 = yylhsminor.yy40; + case 240: /* expression_list ::= expression */ +{ yylhsminor.yy194 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy46)); } + yymsp[0].minor.yy194 = yylhsminor.yy194; break; - case 238: /* expression_list ::= expression_list NK_COMMA expression */ -{ yylhsminor.yy40 = addNodeToList(pCxt, yymsp[-2].minor.yy40, releaseRawExprNode(pCxt, yymsp[0].minor.yy364)); } - yymsp[-2].minor.yy40 = yylhsminor.yy40; + case 241: /* expression_list ::= expression_list NK_COMMA expression */ +{ yylhsminor.yy194 = addNodeToList(pCxt, yymsp[-2].minor.yy194, releaseRawExprNode(pCxt, yymsp[0].minor.yy46)); } + yymsp[-2].minor.yy194 = yylhsminor.yy194; break; - case 239: /* column_reference ::= column_name */ -{ yylhsminor.yy364 = createRawExprNode(pCxt, &yymsp[0].minor.yy437, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy437)); } - yymsp[0].minor.yy364 = yylhsminor.yy364; + case 242: /* column_reference ::= column_name */ +{ yylhsminor.yy46 = createRawExprNode(pCxt, &yymsp[0].minor.yy95, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy95)); } + yymsp[0].minor.yy46 = yylhsminor.yy46; break; - case 240: /* column_reference ::= table_name NK_DOT column_name */ -{ yylhsminor.yy364 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy437, &yymsp[0].minor.yy437, createColumnNode(pCxt, &yymsp[-2].minor.yy437, &yymsp[0].minor.yy437)); } - yymsp[-2].minor.yy364 = yylhsminor.yy364; + case 243: /* column_reference ::= table_name NK_DOT column_name */ +{ yylhsminor.yy46 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy95, &yymsp[0].minor.yy95, createColumnNode(pCxt, &yymsp[-2].minor.yy95, &yymsp[0].minor.yy95)); } + yymsp[-2].minor.yy46 = yylhsminor.yy46; break; - case 241: /* pseudo_column ::= NK_UNDERLINE ROWTS */ - case 243: /* pseudo_column ::= NK_UNDERLINE QSTARTTS */ yytestcase(yyruleno==243); - case 244: /* pseudo_column ::= NK_UNDERLINE QENDTS */ yytestcase(yyruleno==244); - case 245: /* pseudo_column ::= NK_UNDERLINE WSTARTTS */ yytestcase(yyruleno==245); - case 246: /* pseudo_column ::= NK_UNDERLINE WENDTS */ yytestcase(yyruleno==246); - case 247: /* pseudo_column ::= NK_UNDERLINE WDURATION */ yytestcase(yyruleno==247); + case 244: /* pseudo_column ::= NK_UNDERLINE ROWTS */ + case 246: /* pseudo_column ::= NK_UNDERLINE QSTARTTS */ yytestcase(yyruleno==246); + case 247: /* pseudo_column ::= NK_UNDERLINE QENDTS */ yytestcase(yyruleno==247); + case 248: /* pseudo_column ::= NK_UNDERLINE WSTARTTS */ yytestcase(yyruleno==248); + case 249: /* pseudo_column ::= NK_UNDERLINE WENDTS */ yytestcase(yyruleno==249); + case 250: /* pseudo_column ::= NK_UNDERLINE WDURATION */ yytestcase(yyruleno==250); { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy364 = createRawExprNode(pCxt, &t, createFunctionNode(pCxt, &t, NULL)); + yylhsminor.yy46 = createRawExprNode(pCxt, &t, createFunctionNode(pCxt, &t, NULL)); } - yymsp[-1].minor.yy364 = yylhsminor.yy364; + yymsp[-1].minor.yy46 = yylhsminor.yy46; break; - case 242: /* pseudo_column ::= TBNAME */ -{ yylhsminor.yy364 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } - yymsp[0].minor.yy364 = yylhsminor.yy364; + case 245: /* pseudo_column ::= TBNAME */ +{ yylhsminor.yy46 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } + yymsp[0].minor.yy46 = yylhsminor.yy46; break; - case 248: /* predicate ::= expression compare_op expression */ - case 253: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==253); + case 251: /* predicate ::= expression compare_op expression */ + case 256: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==256); { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy364); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy364); - yylhsminor.yy364 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy328, releaseRawExprNode(pCxt, yymsp[-2].minor.yy364), releaseRawExprNode(pCxt, yymsp[0].minor.yy364))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy46); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy46); + yylhsminor.yy46 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy292, releaseRawExprNode(pCxt, yymsp[-2].minor.yy46), releaseRawExprNode(pCxt, yymsp[0].minor.yy46))); } - yymsp[-2].minor.yy364 = yylhsminor.yy364; + yymsp[-2].minor.yy46 = yylhsminor.yy46; break; - case 249: /* predicate ::= expression BETWEEN expression AND expression */ + case 252: /* predicate ::= expression BETWEEN expression AND expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy364); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy364); - yylhsminor.yy364 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy364), releaseRawExprNode(pCxt, yymsp[-2].minor.yy364), releaseRawExprNode(pCxt, yymsp[0].minor.yy364))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy46); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy46); + yylhsminor.yy46 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy46), releaseRawExprNode(pCxt, yymsp[-2].minor.yy46), releaseRawExprNode(pCxt, yymsp[0].minor.yy46))); } - yymsp[-4].minor.yy364 = yylhsminor.yy364; + yymsp[-4].minor.yy46 = yylhsminor.yy46; break; - case 250: /* predicate ::= expression NOT BETWEEN expression AND expression */ + case 253: /* predicate ::= expression NOT BETWEEN expression AND expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy364); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy364); - yylhsminor.yy364 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy364), releaseRawExprNode(pCxt, yymsp[-5].minor.yy364), releaseRawExprNode(pCxt, yymsp[0].minor.yy364))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy46); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy46); + yylhsminor.yy46 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy46), releaseRawExprNode(pCxt, yymsp[-5].minor.yy46), releaseRawExprNode(pCxt, yymsp[0].minor.yy46))); } - yymsp[-5].minor.yy364 = yylhsminor.yy364; + yymsp[-5].minor.yy46 = yylhsminor.yy46; break; - case 251: /* predicate ::= expression IS NULL */ + case 254: /* predicate ::= expression IS NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy364); - yylhsminor.yy364 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy364), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy46); + yylhsminor.yy46 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy46), NULL)); } - yymsp[-2].minor.yy364 = yylhsminor.yy364; + yymsp[-2].minor.yy46 = yylhsminor.yy46; break; - case 252: /* predicate ::= expression IS NOT NULL */ + case 255: /* predicate ::= expression IS NOT NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy364); - yylhsminor.yy364 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy364), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy46); + yylhsminor.yy46 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy46), NULL)); } - yymsp[-3].minor.yy364 = yylhsminor.yy364; + yymsp[-3].minor.yy46 = yylhsminor.yy46; break; - case 254: /* compare_op ::= NK_LT */ -{ yymsp[0].minor.yy328 = OP_TYPE_LOWER_THAN; } + case 257: /* compare_op ::= NK_LT */ +{ yymsp[0].minor.yy292 = OP_TYPE_LOWER_THAN; } break; - case 255: /* compare_op ::= NK_GT */ -{ yymsp[0].minor.yy328 = OP_TYPE_GREATER_THAN; } + case 258: /* compare_op ::= NK_GT */ +{ yymsp[0].minor.yy292 = OP_TYPE_GREATER_THAN; } break; - case 256: /* compare_op ::= NK_LE */ -{ yymsp[0].minor.yy328 = OP_TYPE_LOWER_EQUAL; } + case 259: /* compare_op ::= NK_LE */ +{ yymsp[0].minor.yy292 = OP_TYPE_LOWER_EQUAL; } break; - case 257: /* compare_op ::= NK_GE */ -{ yymsp[0].minor.yy328 = OP_TYPE_GREATER_EQUAL; } + case 260: /* compare_op ::= NK_GE */ +{ yymsp[0].minor.yy292 = OP_TYPE_GREATER_EQUAL; } break; - case 258: /* compare_op ::= NK_NE */ -{ yymsp[0].minor.yy328 = OP_TYPE_NOT_EQUAL; } + case 261: /* compare_op ::= NK_NE */ +{ yymsp[0].minor.yy292 = OP_TYPE_NOT_EQUAL; } break; - case 259: /* compare_op ::= NK_EQ */ -{ yymsp[0].minor.yy328 = OP_TYPE_EQUAL; } + case 262: /* compare_op ::= NK_EQ */ +{ yymsp[0].minor.yy292 = OP_TYPE_EQUAL; } break; - case 260: /* compare_op ::= LIKE */ -{ yymsp[0].minor.yy328 = OP_TYPE_LIKE; } + case 263: /* compare_op ::= LIKE */ +{ yymsp[0].minor.yy292 = OP_TYPE_LIKE; } break; - case 261: /* compare_op ::= NOT LIKE */ -{ yymsp[-1].minor.yy328 = OP_TYPE_NOT_LIKE; } + case 264: /* compare_op ::= NOT LIKE */ +{ yymsp[-1].minor.yy292 = OP_TYPE_NOT_LIKE; } break; - case 262: /* compare_op ::= MATCH */ -{ yymsp[0].minor.yy328 = OP_TYPE_MATCH; } + case 265: /* compare_op ::= MATCH */ +{ yymsp[0].minor.yy292 = OP_TYPE_MATCH; } break; - case 263: /* compare_op ::= NMATCH */ -{ yymsp[0].minor.yy328 = OP_TYPE_NMATCH; } + case 266: /* compare_op ::= NMATCH */ +{ yymsp[0].minor.yy292 = OP_TYPE_NMATCH; } break; - case 264: /* in_op ::= IN */ -{ yymsp[0].minor.yy328 = OP_TYPE_IN; } + case 267: /* in_op ::= IN */ +{ yymsp[0].minor.yy292 = OP_TYPE_IN; } break; - case 265: /* in_op ::= NOT IN */ -{ yymsp[-1].minor.yy328 = OP_TYPE_NOT_IN; } + case 268: /* in_op ::= NOT IN */ +{ yymsp[-1].minor.yy292 = OP_TYPE_NOT_IN; } break; - case 266: /* in_predicate_value ::= NK_LP expression_list NK_RP */ -{ yylhsminor.yy364 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy40)); } - yymsp[-2].minor.yy364 = yylhsminor.yy364; + case 269: /* in_predicate_value ::= NK_LP expression_list NK_RP */ +{ yylhsminor.yy46 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy194)); } + yymsp[-2].minor.yy46 = yylhsminor.yy46; break; - case 268: /* boolean_value_expression ::= NOT boolean_primary */ + case 271: /* boolean_value_expression ::= NOT boolean_primary */ { - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy364); - yylhsminor.yy364 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy364), NULL)); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy46); + yylhsminor.yy46 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy46), NULL)); } - yymsp[-1].minor.yy364 = yylhsminor.yy364; + yymsp[-1].minor.yy46 = yylhsminor.yy46; break; - case 269: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + case 272: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy364); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy364); - yylhsminor.yy364 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy364), releaseRawExprNode(pCxt, yymsp[0].minor.yy364))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy46); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy46); + yylhsminor.yy46 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy46), releaseRawExprNode(pCxt, yymsp[0].minor.yy46))); } - yymsp[-2].minor.yy364 = yylhsminor.yy364; + yymsp[-2].minor.yy46 = yylhsminor.yy46; break; - case 270: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + case 273: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy364); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy364); - yylhsminor.yy364 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy364), releaseRawExprNode(pCxt, yymsp[0].minor.yy364))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy46); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy46); + yylhsminor.yy46 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy46), releaseRawExprNode(pCxt, yymsp[0].minor.yy46))); } - yymsp[-2].minor.yy364 = yylhsminor.yy364; + yymsp[-2].minor.yy46 = yylhsminor.yy46; break; - case 275: /* from_clause ::= FROM table_reference_list */ - case 305: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==305); - case 328: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==328); -{ yymsp[-1].minor.yy364 = yymsp[0].minor.yy364; } + case 278: /* from_clause ::= FROM table_reference_list */ + case 308: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==308); + case 331: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==331); +{ yymsp[-1].minor.yy46 = yymsp[0].minor.yy46; } break; - case 277: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ -{ yylhsminor.yy364 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy364, yymsp[0].minor.yy364, NULL); } - yymsp[-2].minor.yy364 = yylhsminor.yy364; + case 280: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ +{ yylhsminor.yy46 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy46, yymsp[0].minor.yy46, NULL); } + yymsp[-2].minor.yy46 = yylhsminor.yy46; break; - case 280: /* table_primary ::= table_name alias_opt */ -{ yylhsminor.yy364 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy437, &yymsp[0].minor.yy437); } - yymsp[-1].minor.yy364 = yylhsminor.yy364; + case 283: /* table_primary ::= table_name alias_opt */ +{ yylhsminor.yy46 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy95, &yymsp[0].minor.yy95); } + yymsp[-1].minor.yy46 = yylhsminor.yy46; break; - case 281: /* table_primary ::= db_name NK_DOT table_name alias_opt */ -{ yylhsminor.yy364 = createRealTableNode(pCxt, &yymsp[-3].minor.yy437, &yymsp[-1].minor.yy437, &yymsp[0].minor.yy437); } - yymsp[-3].minor.yy364 = yylhsminor.yy364; + case 284: /* table_primary ::= db_name NK_DOT table_name alias_opt */ +{ yylhsminor.yy46 = createRealTableNode(pCxt, &yymsp[-3].minor.yy95, &yymsp[-1].minor.yy95, &yymsp[0].minor.yy95); } + yymsp[-3].minor.yy46 = yylhsminor.yy46; break; - case 282: /* table_primary ::= subquery alias_opt */ -{ yylhsminor.yy364 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy364), &yymsp[0].minor.yy437); } - yymsp[-1].minor.yy364 = yylhsminor.yy364; + case 285: /* table_primary ::= subquery alias_opt */ +{ yylhsminor.yy46 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy46), &yymsp[0].minor.yy95); } + yymsp[-1].minor.yy46 = yylhsminor.yy46; break; - case 284: /* alias_opt ::= */ -{ yymsp[1].minor.yy437 = nil_token; } + case 287: /* alias_opt ::= */ +{ yymsp[1].minor.yy95 = nil_token; } break; - case 285: /* alias_opt ::= table_alias */ -{ yylhsminor.yy437 = yymsp[0].minor.yy437; } - yymsp[0].minor.yy437 = yylhsminor.yy437; + case 288: /* alias_opt ::= table_alias */ +{ yylhsminor.yy95 = yymsp[0].minor.yy95; } + yymsp[0].minor.yy95 = yylhsminor.yy95; break; - case 286: /* alias_opt ::= AS table_alias */ -{ yymsp[-1].minor.yy437 = yymsp[0].minor.yy437; } + case 289: /* alias_opt ::= AS table_alias */ +{ yymsp[-1].minor.yy95 = yymsp[0].minor.yy95; } break; - case 287: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - case 288: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==288); -{ yymsp[-2].minor.yy364 = yymsp[-1].minor.yy364; } + case 290: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + case 291: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==291); +{ yymsp[-2].minor.yy46 = yymsp[-1].minor.yy46; } break; - case 289: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ -{ yylhsminor.yy364 = createJoinTableNode(pCxt, yymsp[-4].minor.yy392, yymsp[-5].minor.yy364, yymsp[-2].minor.yy364, yymsp[0].minor.yy364); } - yymsp[-5].minor.yy364 = yylhsminor.yy364; + case 292: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ +{ yylhsminor.yy46 = createJoinTableNode(pCxt, yymsp[-4].minor.yy10, yymsp[-5].minor.yy46, yymsp[-2].minor.yy46, yymsp[0].minor.yy46); } + yymsp[-5].minor.yy46 = yylhsminor.yy46; break; - case 290: /* join_type ::= */ -{ yymsp[1].minor.yy392 = JOIN_TYPE_INNER; } + case 293: /* join_type ::= */ +{ yymsp[1].minor.yy10 = JOIN_TYPE_INNER; } break; - case 291: /* join_type ::= INNER */ -{ yymsp[0].minor.yy392 = JOIN_TYPE_INNER; } + case 294: /* join_type ::= INNER */ +{ yymsp[0].minor.yy10 = JOIN_TYPE_INNER; } break; - case 292: /* 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 295: /* 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.yy364 = createSelectStmt(pCxt, yymsp[-7].minor.yy493, yymsp[-6].minor.yy40, yymsp[-5].minor.yy364); - yymsp[-8].minor.yy364 = addWhereClause(pCxt, yymsp[-8].minor.yy364, yymsp[-4].minor.yy364); - yymsp[-8].minor.yy364 = addPartitionByClause(pCxt, yymsp[-8].minor.yy364, yymsp[-3].minor.yy40); - yymsp[-8].minor.yy364 = addWindowClauseClause(pCxt, yymsp[-8].minor.yy364, yymsp[-2].minor.yy364); - yymsp[-8].minor.yy364 = addGroupByClause(pCxt, yymsp[-8].minor.yy364, yymsp[-1].minor.yy40); - yymsp[-8].minor.yy364 = addHavingClause(pCxt, yymsp[-8].minor.yy364, yymsp[0].minor.yy364); + yymsp[-8].minor.yy46 = createSelectStmt(pCxt, yymsp[-7].minor.yy151, yymsp[-6].minor.yy194, yymsp[-5].minor.yy46); + yymsp[-8].minor.yy46 = addWhereClause(pCxt, yymsp[-8].minor.yy46, yymsp[-4].minor.yy46); + yymsp[-8].minor.yy46 = addPartitionByClause(pCxt, yymsp[-8].minor.yy46, yymsp[-3].minor.yy194); + yymsp[-8].minor.yy46 = addWindowClauseClause(pCxt, yymsp[-8].minor.yy46, yymsp[-2].minor.yy46); + yymsp[-8].minor.yy46 = addGroupByClause(pCxt, yymsp[-8].minor.yy46, yymsp[-1].minor.yy194); + yymsp[-8].minor.yy46 = addHavingClause(pCxt, yymsp[-8].minor.yy46, yymsp[0].minor.yy46); } break; - case 295: /* set_quantifier_opt ::= ALL */ -{ yymsp[0].minor.yy493 = false; } + case 298: /* set_quantifier_opt ::= ALL */ +{ yymsp[0].minor.yy151 = false; } break; - case 296: /* select_list ::= NK_STAR */ -{ yymsp[0].minor.yy40 = NULL; } + case 299: /* select_list ::= NK_STAR */ +{ yymsp[0].minor.yy194 = NULL; } break; - case 300: /* select_item ::= common_expression */ + case 303: /* select_item ::= common_expression */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy364); - yylhsminor.yy364 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy364), &t); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy46); + yylhsminor.yy46 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy46), &t); } - yymsp[0].minor.yy364 = yylhsminor.yy364; + yymsp[0].minor.yy46 = yylhsminor.yy46; break; - case 301: /* select_item ::= common_expression column_alias */ -{ yylhsminor.yy364 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy364), &yymsp[0].minor.yy437); } - yymsp[-1].minor.yy364 = yylhsminor.yy364; + case 304: /* select_item ::= common_expression column_alias */ +{ yylhsminor.yy46 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy46), &yymsp[0].minor.yy95); } + yymsp[-1].minor.yy46 = yylhsminor.yy46; break; - case 302: /* select_item ::= common_expression AS column_alias */ -{ yylhsminor.yy364 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy364), &yymsp[0].minor.yy437); } - yymsp[-2].minor.yy364 = yylhsminor.yy364; + case 305: /* select_item ::= common_expression AS column_alias */ +{ yylhsminor.yy46 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy46), &yymsp[0].minor.yy95); } + yymsp[-2].minor.yy46 = yylhsminor.yy46; break; - case 303: /* select_item ::= table_name NK_DOT NK_STAR */ -{ yylhsminor.yy364 = createColumnNode(pCxt, &yymsp[-2].minor.yy437, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy364 = yylhsminor.yy364; + case 306: /* select_item ::= table_name NK_DOT NK_STAR */ +{ yylhsminor.yy46 = createColumnNode(pCxt, &yymsp[-2].minor.yy95, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy46 = yylhsminor.yy46; break; - case 307: /* partition_by_clause_opt ::= PARTITION BY expression_list */ - case 324: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==324); - case 334: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==334); -{ yymsp[-2].minor.yy40 = yymsp[0].minor.yy40; } + case 310: /* partition_by_clause_opt ::= PARTITION BY expression_list */ + case 327: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==327); + case 337: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==337); +{ yymsp[-2].minor.yy194 = yymsp[0].minor.yy194; } break; - case 309: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ -{ yymsp[-5].minor.yy364 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy364), releaseRawExprNode(pCxt, yymsp[-1].minor.yy364)); } + case 312: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ +{ yymsp[-5].minor.yy46 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy46), releaseRawExprNode(pCxt, yymsp[-1].minor.yy46)); } break; - case 310: /* twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP */ -{ yymsp[-3].minor.yy364 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy364)); } + case 313: /* twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP */ +{ yymsp[-3].minor.yy46 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy46)); } break; - case 311: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-5].minor.yy364 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy364), NULL, yymsp[-1].minor.yy364, yymsp[0].minor.yy364); } + case 314: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-5].minor.yy46 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy46), NULL, yymsp[-1].minor.yy46, yymsp[0].minor.yy46); } break; - case 312: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-7].minor.yy364 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy364), releaseRawExprNode(pCxt, yymsp[-3].minor.yy364), yymsp[-1].minor.yy364, yymsp[0].minor.yy364); } + case 315: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-7].minor.yy46 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy46), releaseRawExprNode(pCxt, yymsp[-3].minor.yy46), yymsp[-1].minor.yy46, yymsp[0].minor.yy46); } break; - case 314: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ -{ yymsp[-3].minor.yy364 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy364); } + case 317: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ +{ yymsp[-3].minor.yy46 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy46); } break; - case 316: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ -{ yymsp[-3].minor.yy364 = createFillNode(pCxt, yymsp[-1].minor.yy478, NULL); } + case 319: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ +{ yymsp[-3].minor.yy46 = createFillNode(pCxt, yymsp[-1].minor.yy6, NULL); } break; - case 317: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ -{ yymsp[-5].minor.yy364 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy40)); } + case 320: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ +{ yymsp[-5].minor.yy46 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy194)); } break; - case 318: /* fill_mode ::= NONE */ -{ yymsp[0].minor.yy478 = FILL_MODE_NONE; } + case 321: /* fill_mode ::= NONE */ +{ yymsp[0].minor.yy6 = FILL_MODE_NONE; } break; - case 319: /* fill_mode ::= PREV */ -{ yymsp[0].minor.yy478 = FILL_MODE_PREV; } + case 322: /* fill_mode ::= PREV */ +{ yymsp[0].minor.yy6 = FILL_MODE_PREV; } break; - case 320: /* fill_mode ::= NULL */ -{ yymsp[0].minor.yy478 = FILL_MODE_NULL; } + case 323: /* fill_mode ::= NULL */ +{ yymsp[0].minor.yy6 = FILL_MODE_NULL; } break; - case 321: /* fill_mode ::= LINEAR */ -{ yymsp[0].minor.yy478 = FILL_MODE_LINEAR; } + case 324: /* fill_mode ::= LINEAR */ +{ yymsp[0].minor.yy6 = FILL_MODE_LINEAR; } break; - case 322: /* fill_mode ::= NEXT */ -{ yymsp[0].minor.yy478 = FILL_MODE_NEXT; } + case 325: /* fill_mode ::= NEXT */ +{ yymsp[0].minor.yy6 = FILL_MODE_NEXT; } break; - case 325: /* group_by_list ::= expression */ -{ yylhsminor.yy40 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy364))); } - yymsp[0].minor.yy40 = yylhsminor.yy40; + case 328: /* group_by_list ::= expression */ +{ yylhsminor.yy194 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy46))); } + yymsp[0].minor.yy194 = yylhsminor.yy194; break; - case 326: /* group_by_list ::= group_by_list NK_COMMA expression */ -{ yylhsminor.yy40 = addNodeToList(pCxt, yymsp[-2].minor.yy40, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy364))); } - yymsp[-2].minor.yy40 = yylhsminor.yy40; + case 329: /* group_by_list ::= group_by_list NK_COMMA expression */ +{ yylhsminor.yy194 = addNodeToList(pCxt, yymsp[-2].minor.yy194, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy46))); } + yymsp[-2].minor.yy194 = yylhsminor.yy194; break; - case 329: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ + case 332: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ { - yylhsminor.yy364 = addOrderByClause(pCxt, yymsp[-3].minor.yy364, yymsp[-2].minor.yy40); - yylhsminor.yy364 = addSlimitClause(pCxt, yylhsminor.yy364, yymsp[-1].minor.yy364); - yylhsminor.yy364 = addLimitClause(pCxt, yylhsminor.yy364, yymsp[0].minor.yy364); + yylhsminor.yy46 = addOrderByClause(pCxt, yymsp[-3].minor.yy46, yymsp[-2].minor.yy194); + yylhsminor.yy46 = addSlimitClause(pCxt, yylhsminor.yy46, yymsp[-1].minor.yy46); + yylhsminor.yy46 = addLimitClause(pCxt, yylhsminor.yy46, yymsp[0].minor.yy46); } - yymsp[-3].minor.yy364 = yylhsminor.yy364; + yymsp[-3].minor.yy46 = yylhsminor.yy46; break; - case 331: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */ -{ yylhsminor.yy364 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy364, yymsp[0].minor.yy364); } - yymsp[-3].minor.yy364 = yylhsminor.yy364; + case 334: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */ +{ yylhsminor.yy46 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy46, yymsp[0].minor.yy46); } + yymsp[-3].minor.yy46 = yylhsminor.yy46; break; - case 336: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ - case 340: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==340); -{ yymsp[-1].minor.yy364 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } + case 339: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ + case 343: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==343); +{ yymsp[-1].minor.yy46 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } break; - case 337: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - case 341: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==341); -{ yymsp[-3].minor.yy364 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } + case 340: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + case 344: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==344); +{ yymsp[-3].minor.yy46 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } break; - case 338: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - case 342: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==342); -{ yymsp[-3].minor.yy364 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } + case 341: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + case 345: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==345); +{ yymsp[-3].minor.yy46 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } break; - case 343: /* subquery ::= NK_LP query_expression NK_RP */ -{ yylhsminor.yy364 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy364); } - yymsp[-2].minor.yy364 = yylhsminor.yy364; + case 346: /* subquery ::= NK_LP query_expression NK_RP */ +{ yylhsminor.yy46 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy46); } + yymsp[-2].minor.yy46 = yylhsminor.yy46; break; - case 347: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */ -{ yylhsminor.yy364 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy364), yymsp[-1].minor.yy210, yymsp[0].minor.yy177); } - yymsp[-2].minor.yy364 = yylhsminor.yy364; + case 350: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */ +{ yylhsminor.yy46 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy46), yymsp[-1].minor.yy456, yymsp[0].minor.yy273); } + yymsp[-2].minor.yy46 = yylhsminor.yy46; break; - case 348: /* ordering_specification_opt ::= */ -{ yymsp[1].minor.yy210 = ORDER_ASC; } + case 351: /* ordering_specification_opt ::= */ +{ yymsp[1].minor.yy456 = ORDER_ASC; } break; - case 349: /* ordering_specification_opt ::= ASC */ -{ yymsp[0].minor.yy210 = ORDER_ASC; } + case 352: /* ordering_specification_opt ::= ASC */ +{ yymsp[0].minor.yy456 = ORDER_ASC; } break; - case 350: /* ordering_specification_opt ::= DESC */ -{ yymsp[0].minor.yy210 = ORDER_DESC; } + case 353: /* ordering_specification_opt ::= DESC */ +{ yymsp[0].minor.yy456 = ORDER_DESC; } break; - case 351: /* null_ordering_opt ::= */ -{ yymsp[1].minor.yy177 = NULL_ORDER_DEFAULT; } + case 354: /* null_ordering_opt ::= */ +{ yymsp[1].minor.yy273 = NULL_ORDER_DEFAULT; } break; - case 352: /* null_ordering_opt ::= NULLS FIRST */ -{ yymsp[-1].minor.yy177 = NULL_ORDER_FIRST; } + case 355: /* null_ordering_opt ::= NULLS FIRST */ +{ yymsp[-1].minor.yy273 = NULL_ORDER_FIRST; } break; - case 353: /* null_ordering_opt ::= NULLS LAST */ -{ yymsp[-1].minor.yy177 = NULL_ORDER_LAST; } + case 356: /* null_ordering_opt ::= NULLS LAST */ +{ yymsp[-1].minor.yy273 = NULL_ORDER_LAST; } break; default: break; diff --git a/source/libs/planner/src/planPhysiCreater.c b/source/libs/planner/src/planPhysiCreater.c index 9ef1c01cd1..c46f98ef55 100644 --- a/source/libs/planner/src/planPhysiCreater.c +++ b/source/libs/planner/src/planPhysiCreater.c @@ -719,6 +719,9 @@ static int32_t createStreamScanPhysiNodeByExchange(SPhysiPlanContext* pCxt, SExc if (NULL == pScan->pScanCols) { code = TSDB_CODE_OUT_OF_MEMORY; } + if (TSDB_CODE_SUCCESS == code) { + code = sortScanCols(pScan->pScanCols); + } if (TSDB_CODE_SUCCESS == code) { code = addDataBlockSlots(pCxt, pScan->pScanCols, pScan->node.pOutputDataBlockDesc); } From c448e7d667ed457c8efedebe0e9c72abde7179ed Mon Sep 17 00:00:00 2001 From: plum-lihui Date: Thu, 31 Mar 2022 14:31:28 +0800 Subject: [PATCH 47/49] [add cases] --- tests/script/jenkins/basic.txt | 1 + tests/script/tsim/query/scalarFunction.sim | 356 ++++++++++++++++++++- tests/script/tsim/testCaseSuite.sim | 1 + 3 files changed, 352 insertions(+), 6 deletions(-) diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index 46b6a40166..37233c288f 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -28,6 +28,7 @@ # ---- query ./test.sh -f tsim/query/interval.sim ./test.sh -f tsim/query/interval-offset.sim +./test.sh -f tsim/query/scalarFunction.sim # ---- show ./test.sh -f tsim/show/basic.sim diff --git a/tests/script/tsim/query/scalarFunction.sim b/tests/script/tsim/query/scalarFunction.sim index 912e3ffcd8..6a2a602703 100644 --- a/tests/script/tsim/query/scalarFunction.sim +++ b/tests/script/tsim/query/scalarFunction.sim @@ -37,11 +37,11 @@ print $data10 $data11 $data12 $data13 $data14 $data15 $data16 $data17 $data18 $d sql use $dbNamme print =============== create super table -sql create table if not exists stb (ts timestamp, c1 int, c2 float, c3 double) tags (t1 int) +sql create table stb (ts timestamp, c1 int, c2 float, c3 double) tags (t1 int) print =============== create child table $tbPrefix = ct -$tbNum = 2 +$tbNum = 100 $i = 0 while $i < $tbNum @@ -54,7 +54,7 @@ print =============== create normal table sql create table ntb (ts timestamp, c1 int, c2 float, c3 double) sql show tables -if $rows != 3 then +if $rows != 101 then return -1 endi @@ -83,6 +83,12 @@ while $i < $tbNum $tstart = 1640966400000 endw +$totalRows = $rowNum * $tbNum +print ====> totalRows of stb: $totalRows + +$loop_test = 0 +loop_test_pos: + print ====> abs sql select c1, abs(c1), c2, abs(c2), c3, abs(c3) from ct1 print ====> select c1, abs(c1), c2, abs(c2), c3, abs(c3) from ct1 @@ -97,11 +103,106 @@ print ====> $data60 $data61 $data62 $data63 $data64 $data65 print ====> $data70 $data71 $data72 $data73 $data74 $data75 print ====> $data80 $data81 $data82 $data83 $data84 $data85 print ====> $data90 $data91 $data92 $data93 $data94 $data95 -if $rows != 10 then +if $rows != $rowNum then + return -1 +endi +print ====> select c1, abs(c1), c2, abs(c2), c3, abs(c3) from stb +sql select c1, abs(c1), c2, abs(c2), c3, abs(c3) from stb +if $rows != $totalRows then + return -1 +endi +print ====> select c1, abs(c1), c2, abs(c2), c3, abs(c3) from ntb +sql select c1, abs(c1), c2, abs(c2), c3, abs(c3) from ntb +if $rows != $rowNum then + return -1 +endi + +print ====> log +sql select c1, log(c1, 10), c2, log(c2, 10), c3, log(c3, 10) from ct1 +print ====> select c1, log(c1, 10), c2, log(c2, 10), c3, log(c3, 10) from ct1 +print ====> rows: $rows +print ====> $data00 $data01 $data02 $data03 $data04 $data05 +print ====> $data10 $data11 $data12 $data13 $data14 $data15 +print ====> $data20 $data21 $data22 $data23 $data24 $data25 +print ====> $data30 $data31 $data32 $data33 $data34 $data35 +print ====> $data40 $data41 $data42 $data43 $data44 $data45 +print ====> $data50 $data51 $data52 $data53 $data54 $data55 +print ====> $data60 $data61 $data62 $data63 $data64 $data65 +print ====> $data70 $data71 $data72 $data73 $data74 $data75 +print ====> $data80 $data81 $data82 $data83 $data84 $data85 +print ====> $data90 $data91 $data92 $data93 $data94 $data95 +if $rows != $rowNum then + return -1 +endi +print ====> select c1, log(c1, 10), c2, log(c2, 10), c3, log(c3, 10) from stb +sql select c1, log(c1, 10), c2, log(c2, 10), c3, log(c3, 10) from stb +if $rows != $totalRows then + return -1 +endi +print ====> select c1, log(c1, 10), c2, log(c2, 10), c3, log(c3, 10) from ntb +sql select c1, log(c1, 10), c2, log(c2, 10), c3, log(c3, 10) from ntb +if $rows != $rowNum then + return -1 +endi + +print ====> pow +sql select c1, pow(c1, 2), c2, pow(c2, 2), c3, pow(c3, 2) from ct1 +print ====> select c1, pow(c1, 2), c2, pow(c2, 2), c3, pow(c3, 2) from ct1 +print ====> rows: $rows +print ====> $data00 $data01 $data02 $data03 $data04 $data05 +print ====> $data10 $data11 $data12 $data13 $data14 $data15 +print ====> $data20 $data21 $data22 $data23 $data24 $data25 +print ====> $data30 $data31 $data32 $data33 $data34 $data35 +print ====> $data40 $data41 $data42 $data43 $data44 $data45 +print ====> $data50 $data51 $data52 $data53 $data54 $data55 +print ====> $data60 $data61 $data62 $data63 $data64 $data65 +print ====> $data70 $data71 $data72 $data73 $data74 $data75 +print ====> $data80 $data81 $data82 $data83 $data84 $data85 +print ====> $data90 $data91 $data92 $data93 $data94 $data95 +if $rows != $rowNum then + return -1 +endi +print ====> select c1, pow(c1, 2), c2, pow(c2, 2), c3, pow(c3, 2) from stb +sql select c1, pow(c1, 2), c2, pow(c2, 2), c3, pow(c3, 2) from stb +if $rows != $totalRows then + return -1 +endi +print ====> select c1, pow(c1, 2), c2, pow(c2, 2), c3, pow(c3, 2) from ntb +sql select c1, pow(c1, 2), c2, pow(c2, 2), c3, pow(c3, 2) from ntb +if $rows != $rowNum then + return -1 +endi + +print ====> sqrt +sql select c1, sqrt(c1), c2, sqrt(c2), c3, sqrt(c3) from ct1 +print ====> select c1, sqrt(c1), c2, sqrt(c2), c3, sqrt(c3) from ct1 +print ====> rows: $rows +print ====> $data00 $data01 $data02 $data03 $data04 $data05 +print ====> $data10 $data11 $data12 $data13 $data14 $data15 +print ====> $data20 $data21 $data22 $data23 $data24 $data25 +print ====> $data30 $data31 $data32 $data33 $data34 $data35 +print ====> $data40 $data41 $data42 $data43 $data44 $data45 +print ====> $data50 $data51 $data52 $data53 $data54 $data55 +print ====> $data60 $data61 $data62 $data63 $data64 $data65 +print ====> $data70 $data71 $data72 $data73 $data74 $data75 +print ====> $data80 $data81 $data82 $data83 $data84 $data85 +print ====> $data90 $data91 $data92 $data93 $data94 $data95 +if $rows != $rowNum then + return -1 +endi +print ====> select c1, sqrt(c1), c2, sqrt(c2), c3, sqrt(c3) from stb +sql select c1, sqrt(c1), c2, sqrt(c2), c3, sqrt(c3) from stb +if $rows != $totalRows then + return -1 +endi +print ====> select c1, sqrt(c1), c2, sqrt(c2), c3, sqrt(c3) from ntb +sql select c1, sqrt(c1), c2, sqrt(c2), c3, sqrt(c3) from ntb +if $rows != $rowNum then return -1 endi print ====> sin +#sql select c1, sin(c1), sin(c1) * 3.14159265 / 180 from ct1 # TD-14426 sql select c1, sin(c1), c2, sin(c2), c3, sin(c3) from ct1 print ====> select c1, sin(c1), c2, sin(c2), c3, sin(c3) from ct1 print ====> rows: $rows @@ -115,7 +216,17 @@ print ====> $data60 $data61 $data62 $data63 $data64 $data65 print ====> $data70 $data71 $data72 $data73 $data74 $data75 print ====> $data80 $data81 $data82 $data83 $data84 $data85 print ====> $data90 $data91 $data92 $data93 $data94 $data95 -if $rows != 10 then +if $rows != $rowNum then + return -1 +endi +print ====> select c1, sin(c1), c2, sin(c2), c3, sin(c3) from stb +sql select c1, sin(c1), c2, sin(c2), c3, sin(c3) from stb +if $rows != $totalRows then + return -1 +endi +print ====> select c1, sin(c1), c2, sin(c2), c3, sin(c3) from ntb +sql select c1, sin(c1), c2, sin(c2), c3, sin(c3) from ntb +if $rows != $rowNum then return -1 endi @@ -133,8 +244,241 @@ print ====> $data60 $data61 $data62 $data63 $data64 $data65 print ====> $data70 $data71 $data72 $data73 $data74 $data75 print ====> $data80 $data81 $data82 $data83 $data84 $data85 print ====> $data90 $data91 $data92 $data93 $data94 $data95 -if $rows != 10 then +if $rows != $rowNum then + return -1 +endi +print ====> select c1, cos(c1), c2, cos(c2), c3, cos(c3) from stb +sql select c1, cos(c1), c2, cos(c2), c3, cos(c3) from stb +if $rows != $totalRows then + return -1 +endi +print ====> select c1, cos(c1), c2, cos(c2), c3, cos(c3) from ntb +sql select c1, cos(c1), c2, cos(c2), c3, cos(c3) from ntb +if $rows != $rowNum then return -1 endi +print ====> tan +sql select c1, tan(c1), c2, tan(c2), c3, tan(c3) from ct1 +print ====> select c1, tan(c1), c2, tan(c2), c3, tan(c3) from ct1 +print ====> rows: $rows +print ====> $data00 $data01 $data02 $data03 $data04 $data05 +print ====> $data10 $data11 $data12 $data13 $data14 $data15 +print ====> $data20 $data21 $data22 $data23 $data24 $data25 +print ====> $data30 $data31 $data32 $data33 $data34 $data35 +print ====> $data40 $data41 $data42 $data43 $data44 $data45 +print ====> $data50 $data51 $data52 $data53 $data54 $data55 +print ====> $data60 $data61 $data62 $data63 $data64 $data65 +print ====> $data70 $data71 $data72 $data73 $data74 $data75 +print ====> $data80 $data81 $data82 $data83 $data84 $data85 +print ====> $data90 $data91 $data92 $data93 $data94 $data95 +if $rows != $rowNum then + return -1 +endi +print ====> select c1, tan(c1), c2, tan(c2), c3, tan(c3) from stb +sql select c1, tan(c1), c2, tan(c2), c3, tan(c3) from stb +if $rows != $totalRows then + return -1 +endi +print ====> select c1, tan(c1), c2, tan(c2), c3, tan(c3) from ntb +sql select c1, tan(c1), c2, tan(c2), c3, tan(c3) from ntb +if $rows != $rowNum then + return -1 +endi + +print ====> asin +sql select c1, asin(c1), c2, asin(c2), c3, asin(c3) from ct1 +print ====> select c1, asin(c1), c2, asin(c2), c3, asin(c3) from ct1 +print ====> rows: $rows +print ====> $data00 $data01 $data02 $data03 $data04 $data05 +print ====> $data10 $data11 $data12 $data13 $data14 $data15 +print ====> $data20 $data21 $data22 $data23 $data24 $data25 +print ====> $data30 $data31 $data32 $data33 $data34 $data35 +print ====> $data40 $data41 $data42 $data43 $data44 $data45 +print ====> $data50 $data51 $data52 $data53 $data54 $data55 +print ====> $data60 $data61 $data62 $data63 $data64 $data65 +print ====> $data70 $data71 $data72 $data73 $data74 $data75 +print ====> $data80 $data81 $data82 $data83 $data84 $data85 +print ====> $data90 $data91 $data92 $data93 $data94 $data95 +if $rows != $rowNum then + return -1 +endi +print ====> select c1, asin(c1), c2, asin(c2), c3, asin(c3) from stb +sql select c1, asin(c1), c2, asin(c2), c3, asin(c3) from stb +if $rows != $totalRows then + return -1 +endi +print ====> select c1, asin(c1), c2, asin(c2), c3, asin(c3) from ntb +sql select c1, asin(c1), c2, asin(c2), c3, asin(c3) from ntb +if $rows != $rowNum then + return -1 +endi + +print ====> acos +sql select c1, acos(c1), c2, acos(c2), c3, acos(c3) from ct1 +print ====> select c1, acos(c1), c2, acos(c2), c3, acos(c3) from ct1 +print ====> rows: $rows +print ====> $data00 $data01 $data02 $data03 $data04 $data05 +print ====> $data10 $data11 $data12 $data13 $data14 $data15 +print ====> $data20 $data21 $data22 $data23 $data24 $data25 +print ====> $data30 $data31 $data32 $data33 $data34 $data35 +print ====> $data40 $data41 $data42 $data43 $data44 $data45 +print ====> $data50 $data51 $data52 $data53 $data54 $data55 +print ====> $data60 $data61 $data62 $data63 $data64 $data65 +print ====> $data70 $data71 $data72 $data73 $data74 $data75 +print ====> $data80 $data81 $data82 $data83 $data84 $data85 +print ====> $data90 $data91 $data92 $data93 $data94 $data95 +if $rows != $rowNum then + return -1 +endi +print ====> select c1, acos(c1), c2, acos(c2), c3, acos(c3) from stb +sql select c1, acos(c1), c2, acos(c2), c3, acos(c3) from stb +if $rows != $totalRows then + return -1 +endi +print ====> select c1, acos(c1), c2, acos(c2), c3, acos(c3) from ntb +sql select c1, acos(c1), c2, acos(c2), c3, acos(c3) from ntb +if $rows != $rowNum then + return -1 +endi + +print ====> atan +sql select c1, atan(c1), c2, atan(c2), c3, atan(c3) from ct1 +print ====> select c1, atan(c1), c2, atan(c2), c3, atan(c3) from ct1 +print ====> rows: $rows +print ====> $data00 $data01 $data02 $data03 $data04 $data05 +print ====> $data10 $data11 $data12 $data13 $data14 $data15 +print ====> $data20 $data21 $data22 $data23 $data24 $data25 +print ====> $data30 $data31 $data32 $data33 $data34 $data35 +print ====> $data40 $data41 $data42 $data43 $data44 $data45 +print ====> $data50 $data51 $data52 $data53 $data54 $data55 +print ====> $data60 $data61 $data62 $data63 $data64 $data65 +print ====> $data70 $data71 $data72 $data73 $data74 $data75 +print ====> $data80 $data81 $data82 $data83 $data84 $data85 +print ====> $data90 $data91 $data92 $data93 $data94 $data95 +if $rows != $rowNum then + return -1 +endi +print ====> select c1, atan(c1), c2, atan(c2), c3, atan(c3) from stb +sql select c1, atan(c1), c2, atan(c2), c3, atan(c3) from stb +if $rows != $totalRows then + return -1 +endi +print ====> select c1, atan(c1), c2, atan(c2), c3, atan(c3) from ntb +sql select c1, atan(c1), c2, atan(c2), c3, atan(c3) from ntb +if $rows != $rowNum then + return -1 +endi + +print ====> ceil +sql select c1, ceil(c1), c2, ceil(c2), c3, ceil(c3) from ct1 +print ====> select c1, ceil(c1), c2, ceil(c2), c3, ceil(c3) from ct1 +print ====> rows: $rows +print ====> $data00 $data01 $data02 $data03 $data04 $data05 +print ====> $data10 $data11 $data12 $data13 $data14 $data15 +print ====> $data20 $data21 $data22 $data23 $data24 $data25 +print ====> $data30 $data31 $data32 $data33 $data34 $data35 +print ====> $data40 $data41 $data42 $data43 $data44 $data45 +print ====> $data50 $data51 $data52 $data53 $data54 $data55 +print ====> $data60 $data61 $data62 $data63 $data64 $data65 +print ====> $data70 $data71 $data72 $data73 $data74 $data75 +print ====> $data80 $data81 $data82 $data83 $data84 $data85 +print ====> $data90 $data91 $data92 $data93 $data94 $data95 +if $rows != $rowNum then + return -1 +endi +print ====> select c1, ceil(c1), c2, ceil(c2), c3, ceil(c3) from stb +sql select c1, ceil(c1), c2, ceil(c2), c3, ceil(c3) from stb +if $rows != $totalRows then + return -1 +endi +print ====> select c1, ceil(c1), c2, ceil(c2), c3, ceil(c3) from ntb +sql select c1, ceil(c1), c2, ceil(c2), c3, ceil(c3) from ntb +if $rows != $rowNum then + return -1 +endi + +print ====> floor +sql select c1, floor(c1), c2, floor(c2), c3, floor(c3) from ct1 +print ====> select c1, floor(c1), c2, floor(c2), c3, floor(c3) from ct1 +print ====> rows: $rows +print ====> $data00 $data01 $data02 $data03 $data04 $data05 +print ====> $data10 $data11 $data12 $data13 $data14 $data15 +print ====> $data20 $data21 $data22 $data23 $data24 $data25 +print ====> $data30 $data31 $data32 $data33 $data34 $data35 +print ====> $data40 $data41 $data42 $data43 $data44 $data45 +print ====> $data50 $data51 $data52 $data53 $data54 $data55 +print ====> $data60 $data61 $data62 $data63 $data64 $data65 +print ====> $data70 $data71 $data72 $data73 $data74 $data75 +print ====> $data80 $data81 $data82 $data83 $data84 $data85 +print ====> $data90 $data91 $data92 $data93 $data94 $data95 +if $rows != $rowNum then + return -1 +endi +print ====> select c1, floor(c1), c2, floor(c2), c3, floor(c3) from stb +sql select c1, floor(c1), c2, floor(c2), c3, floor(c3) from stb +if $rows != $totalRows then + return -1 +endi +print ====> select c1, floor(c1), c2, floor(c2), c3, floor(c3) from ntb +sql select c1, floor(c1), c2, floor(c2), c3, floor(c3) from ntb +if $rows != $rowNum then + return -1 +endi + + +print ====> round +sql select c1, round(c1), c2, round(c2), c3, round(c3) from ct1 +print ====> select c1, round(c1), c2, round(c2), c3, round(c3) from ct1 +print ====> rows: $rows +print ====> $data00 $data01 $data02 $data03 $data04 $data05 +print ====> $data10 $data11 $data12 $data13 $data14 $data15 +print ====> $data20 $data21 $data22 $data23 $data24 $data25 +print ====> $data30 $data31 $data32 $data33 $data34 $data35 +print ====> $data40 $data41 $data42 $data43 $data44 $data45 +print ====> $data50 $data51 $data52 $data53 $data54 $data55 +print ====> $data60 $data61 $data62 $data63 $data64 $data65 +print ====> $data70 $data71 $data72 $data73 $data74 $data75 +print ====> $data80 $data81 $data82 $data83 $data84 $data85 +print ====> $data90 $data91 $data92 $data93 $data94 $data95 +if $rows != $rowNum then + return -1 +endi +print ====> select c1, round(c1), c2, round(c2), c3, round(c3) from stb +sql select c1, round(c1), c2, round(c2), c3, round(c3) from stb +if $rows != $totalRows then + return -1 +endi +print ====> select c1, round(c1), c2, round(c2), c3, round(c3) from ntb +sql select c1, round(c1), c2, round(c2), c3, round(c3) from ntb +if $rows != $rowNum then + return -1 +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/script/tsim/testCaseSuite.sim b/tests/script/tsim/testCaseSuite.sim index bf184f8794..0e17ed9141 100644 --- a/tests/script/tsim/testCaseSuite.sim +++ b/tests/script/tsim/testCaseSuite.sim @@ -20,6 +20,7 @@ run tsim/insert/null.sim run tsim/query/interval.sim run tsim/query/interval-offset.sim +run tsim/query/scalarFunction.sim run tsim/show/basic.sim From e555db03fc736138e01ae50599c9d0929aaf54de Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Thu, 31 Mar 2022 02:36:35 -0400 Subject: [PATCH 48/49] bugfix --- source/libs/parser/src/parAstCreater.c | 30 ++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c index 9206898383..7f3ba6d508 100644 --- a/source/libs/parser/src/parAstCreater.c +++ b/source/libs/parser/src/parAstCreater.c @@ -473,6 +473,9 @@ static bool checkPort(SAstCreateContext* pCxt, const SToken* pPortToken, int32_t static bool checkDbName(SAstCreateContext* pCxt, SToken* pDbName, bool query) { if (NULL == pDbName) { pCxt->valid = (query ? NULL != pCxt->pQueryCxt->db : true); + if (!pCxt->valid) { + snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, "db not specified"); + } } else { pCxt->valid = pDbName->n < TSDB_DB_NAME_LEN ? true : false; } @@ -1017,6 +1020,9 @@ SDataType createVarLenDataType(uint8_t type, const SToken* pLen) { SNode* createCreateTableStmt(SAstCreateContext* pCxt, bool ignoreExists, SNode* pRealTable, SNodeList* pCols, SNodeList* pTags, SNode* pOptions) { + if (NULL == pRealTable) { + return NULL; + } SCreateTableStmt* pStmt = (SCreateTableStmt*)nodesMakeNode(QUERY_NODE_CREATE_TABLE_STMT); CHECK_OUT_OF_MEM(pStmt); strcpy(pStmt->dbName, ((SRealTableNode*)pRealTable)->table.dbName); @@ -1031,6 +1037,9 @@ SNode* createCreateTableStmt(SAstCreateContext* pCxt, SNode* createCreateSubTableClause(SAstCreateContext* pCxt, bool ignoreExists, SNode* pRealTable, SNode* pUseRealTable, SNodeList* pSpecificTags, SNodeList* pValsOfTags) { + if (NULL == pRealTable) { + return NULL; + } SCreateSubTableClause* pStmt = nodesMakeNode(QUERY_NODE_CREATE_SUBTABLE_CLAUSE); CHECK_OUT_OF_MEM(pStmt); strcpy(pStmt->dbName, ((SRealTableNode*)pRealTable)->table.dbName); @@ -1053,6 +1062,9 @@ SNode* createCreateMultiTableStmt(SAstCreateContext* pCxt, SNodeList* pSubTables } SNode* createDropTableClause(SAstCreateContext* pCxt, bool ignoreNotExists, SNode* pRealTable) { + if (NULL == pRealTable) { + return NULL; + } SDropTableClause* pStmt = nodesMakeNode(QUERY_NODE_DROP_TABLE_CLAUSE); CHECK_OUT_OF_MEM(pStmt); strcpy(pStmt->dbName, ((SRealTableNode*)pRealTable)->table.dbName); @@ -1080,6 +1092,9 @@ SNode* createDropSuperTableStmt(SAstCreateContext* pCxt, bool ignoreNotExists, S } SNode* createAlterTableOption(SAstCreateContext* pCxt, SNode* pRealTable, SNode* pOptions) { + if (NULL == pRealTable) { + return NULL; + } SAlterTableStmt* pStmt = nodesMakeNode(QUERY_NODE_ALTER_TABLE_STMT); CHECK_OUT_OF_MEM(pStmt); pStmt->alterType = TSDB_ALTER_TABLE_UPDATE_OPTIONS; @@ -1088,6 +1103,9 @@ SNode* createAlterTableOption(SAstCreateContext* pCxt, SNode* pRealTable, SNode* } SNode* createAlterTableAddModifyCol(SAstCreateContext* pCxt, SNode* pRealTable, int8_t alterType, const SToken* pColName, SDataType dataType) { + if (NULL == pRealTable) { + return NULL; + } SAlterTableStmt* pStmt = nodesMakeNode(QUERY_NODE_ALTER_TABLE_STMT); CHECK_OUT_OF_MEM(pStmt); pStmt->alterType = alterType; @@ -1097,6 +1115,9 @@ SNode* createAlterTableAddModifyCol(SAstCreateContext* pCxt, SNode* pRealTable, } SNode* createAlterTableDropCol(SAstCreateContext* pCxt, SNode* pRealTable, int8_t alterType, const SToken* pColName) { + if (NULL == pRealTable) { + return NULL; + } SAlterTableStmt* pStmt = nodesMakeNode(QUERY_NODE_ALTER_TABLE_STMT); CHECK_OUT_OF_MEM(pStmt); pStmt->alterType = alterType; @@ -1105,6 +1126,9 @@ SNode* createAlterTableDropCol(SAstCreateContext* pCxt, SNode* pRealTable, int8_ } SNode* createAlterTableRenameCol(SAstCreateContext* pCxt, SNode* pRealTable, int8_t alterType, const SToken* pOldColName, const SToken* pNewColName) { + if (NULL == pRealTable) { + return NULL; + } SAlterTableStmt* pStmt = nodesMakeNode(QUERY_NODE_ALTER_TABLE_STMT); CHECK_OUT_OF_MEM(pStmt); pStmt->alterType = alterType; @@ -1114,6 +1138,9 @@ SNode* createAlterTableRenameCol(SAstCreateContext* pCxt, SNode* pRealTable, int } SNode* createAlterTableSetTag(SAstCreateContext* pCxt, SNode* pRealTable, const SToken* pTagName, SNode* pVal) { + if (NULL == pRealTable) { + return NULL; + } SAlterTableStmt* pStmt = nodesMakeNode(QUERY_NODE_ALTER_TABLE_STMT); CHECK_OUT_OF_MEM(pStmt); pStmt->alterType = TSDB_ALTER_TABLE_UPDATE_TAG_VAL; @@ -1345,6 +1372,9 @@ SNode* createExplainStmt(SAstCreateContext* pCxt, bool analyze, SNode* pOptions, } SNode* createDescribeStmt(SAstCreateContext* pCxt, SNode* pRealTable) { + if (NULL == pRealTable) { + return NULL; + } SDescribeStmt* pStmt = nodesMakeNode(QUERY_NODE_DESCRIBE_STMT); CHECK_OUT_OF_MEM(pStmt); strcpy(pStmt->dbName, ((SRealTableNode*)pRealTable)->table.dbName); From ee1b47b2e203e542bea02c58517219e0d0fcc7f9 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Thu, 31 Mar 2022 03:11:52 -0400 Subject: [PATCH 49/49] TD-14431 bugfix --- source/libs/parser/src/parInsert.c | 52 ++++++++++++++------------ source/libs/parser/src/parTranslater.c | 2 +- 2 files changed, 29 insertions(+), 25 deletions(-) diff --git a/source/libs/parser/src/parInsert.c b/source/libs/parser/src/parInsert.c index ed67de17e0..e94dfd9e0a 100644 --- a/source/libs/parser/src/parInsert.c +++ b/source/libs/parser/src/parInsert.c @@ -65,7 +65,7 @@ typedef struct SInsertParseContext { SVnodeModifOpStmt* pOutput; } SInsertParseContext; -typedef int32_t (*_row_append_fn_t)(const void *value, int32_t len, void *param); +typedef int32_t (*_row_append_fn_t)(SMsgBuf* pMsgBuf, const void *value, int32_t len, void *param); static uint8_t TRUE_VALUE = (uint8_t)TSDB_TRUE; static uint8_t FALSE_VALUE = (uint8_t)TSDB_FALSE; @@ -444,26 +444,26 @@ static int32_t parseValueToken(char** end, SToken* pToken, SSchema* pSchema, int if (isNullStr(pToken)) { if (TSDB_DATA_TYPE_TIMESTAMP == pSchema->type && PRIMARYKEY_TIMESTAMP_COL_ID == pSchema->colId) { int64_t tmpVal = 0; - return func(&tmpVal, pSchema->bytes, param); + return func(pMsgBuf, &tmpVal, pSchema->bytes, param); } - return func(NULL, 0, param); + return func(pMsgBuf, NULL, 0, param); } switch (pSchema->type) { case TSDB_DATA_TYPE_BOOL: { if ((pToken->type == TK_NK_BOOL || pToken->type == TK_NK_STRING) && (pToken->n != 0)) { if (strncmp(pToken->z, "true", pToken->n) == 0) { - return func(&TRUE_VALUE, pSchema->bytes, param); + return func(pMsgBuf, &TRUE_VALUE, pSchema->bytes, param); } else if (strncmp(pToken->z, "false", pToken->n) == 0) { - return func(&FALSE_VALUE, pSchema->bytes, param); + return func(pMsgBuf, &FALSE_VALUE, pSchema->bytes, param); } else { return buildSyntaxErrMsg(pMsgBuf, "invalid bool data", pToken->z); } } else if (pToken->type == TK_NK_INTEGER) { - return func(((strtoll(pToken->z, NULL, 10) == 0) ? &FALSE_VALUE : &TRUE_VALUE), pSchema->bytes, param); + return func(pMsgBuf, ((strtoll(pToken->z, NULL, 10) == 0) ? &FALSE_VALUE : &TRUE_VALUE), pSchema->bytes, param); } else if (pToken->type == TK_NK_FLOAT) { - return func(((strtod(pToken->z, NULL) == 0) ? &FALSE_VALUE : &TRUE_VALUE), pSchema->bytes, param); + return func(pMsgBuf, ((strtod(pToken->z, NULL) == 0) ? &FALSE_VALUE : &TRUE_VALUE), pSchema->bytes, param); } else { return buildSyntaxErrMsg(pMsgBuf, "invalid bool data", pToken->z); } @@ -477,7 +477,7 @@ static int32_t parseValueToken(char** end, SToken* pToken, SSchema* pSchema, int } uint8_t tmpVal = (uint8_t)iv; - return func(&tmpVal, pSchema->bytes, param); + return func(pMsgBuf, &tmpVal, pSchema->bytes, param); } case TSDB_DATA_TYPE_UTINYINT:{ @@ -487,7 +487,7 @@ static int32_t parseValueToken(char** end, SToken* pToken, SSchema* pSchema, int return buildSyntaxErrMsg(pMsgBuf, "unsigned tinyint data overflow", pToken->z); } uint8_t tmpVal = (uint8_t)iv; - return func(&tmpVal, pSchema->bytes, param); + return func(pMsgBuf, &tmpVal, pSchema->bytes, param); } case TSDB_DATA_TYPE_SMALLINT: { @@ -497,7 +497,7 @@ static int32_t parseValueToken(char** end, SToken* pToken, SSchema* pSchema, int return buildSyntaxErrMsg(pMsgBuf, "smallint data overflow", pToken->z); } int16_t tmpVal = (int16_t)iv; - return func(&tmpVal, pSchema->bytes, param); + return func(pMsgBuf, &tmpVal, pSchema->bytes, param); } case TSDB_DATA_TYPE_USMALLINT: { @@ -507,7 +507,7 @@ static int32_t parseValueToken(char** end, SToken* pToken, SSchema* pSchema, int return buildSyntaxErrMsg(pMsgBuf, "unsigned smallint data overflow", pToken->z); } uint16_t tmpVal = (uint16_t)iv; - return func(&tmpVal, pSchema->bytes, param); + return func(pMsgBuf, &tmpVal, pSchema->bytes, param); } case TSDB_DATA_TYPE_INT: { @@ -517,7 +517,7 @@ static int32_t parseValueToken(char** end, SToken* pToken, SSchema* pSchema, int return buildSyntaxErrMsg(pMsgBuf, "int data overflow", pToken->z); } int32_t tmpVal = (int32_t)iv; - return func(&tmpVal, pSchema->bytes, param); + return func(pMsgBuf, &tmpVal, pSchema->bytes, param); } case TSDB_DATA_TYPE_UINT: { @@ -527,7 +527,7 @@ static int32_t parseValueToken(char** end, SToken* pToken, SSchema* pSchema, int return buildSyntaxErrMsg(pMsgBuf, "unsigned int data overflow", pToken->z); } uint32_t tmpVal = (uint32_t)iv; - return func(&tmpVal, pSchema->bytes, param); + return func(pMsgBuf, &tmpVal, pSchema->bytes, param); } case TSDB_DATA_TYPE_BIGINT: { @@ -536,7 +536,7 @@ static int32_t parseValueToken(char** end, SToken* pToken, SSchema* pSchema, int } else if (!IS_VALID_BIGINT(iv)) { return buildSyntaxErrMsg(pMsgBuf, "bigint data overflow", pToken->z); } - return func(&iv, pSchema->bytes, param); + return func(pMsgBuf, &iv, pSchema->bytes, param); } case TSDB_DATA_TYPE_UBIGINT: { @@ -546,7 +546,7 @@ static int32_t parseValueToken(char** end, SToken* pToken, SSchema* pSchema, int return buildSyntaxErrMsg(pMsgBuf, "unsigned bigint data overflow", pToken->z); } uint64_t tmpVal = (uint64_t)iv; - return func(&tmpVal, pSchema->bytes, param); + return func(pMsgBuf, &tmpVal, pSchema->bytes, param); } case TSDB_DATA_TYPE_FLOAT: { @@ -558,7 +558,7 @@ static int32_t parseValueToken(char** end, SToken* pToken, SSchema* pSchema, int return buildSyntaxErrMsg(pMsgBuf, "illegal float data", pToken->z); } float tmpVal = (float)dv; - return func(&tmpVal, pSchema->bytes, param); + return func(pMsgBuf, &tmpVal, pSchema->bytes, param); } case TSDB_DATA_TYPE_DOUBLE: { @@ -569,7 +569,7 @@ static int32_t parseValueToken(char** end, SToken* pToken, SSchema* pSchema, int if (((dv == HUGE_VAL || dv == -HUGE_VAL) && errno == ERANGE) || isinf(dv) || isnan(dv)) { return buildSyntaxErrMsg(pMsgBuf, "illegal double data", pToken->z); } - return func(&dv, pSchema->bytes, param); + return func(pMsgBuf, &dv, pSchema->bytes, param); } case TSDB_DATA_TYPE_BINARY: { @@ -578,11 +578,11 @@ static int32_t parseValueToken(char** end, SToken* pToken, SSchema* pSchema, int return buildSyntaxErrMsg(pMsgBuf, "string data overflow", pToken->z); } - return func(pToken->z, pToken->n, param); + return func(pMsgBuf, pToken->z, pToken->n, param); } case TSDB_DATA_TYPE_NCHAR: { - return func(pToken->z, pToken->n, param); + return func(pMsgBuf, pToken->z, pToken->n, param); } case TSDB_DATA_TYPE_TIMESTAMP: { @@ -591,7 +591,7 @@ static int32_t parseValueToken(char** end, SToken* pToken, SSchema* pSchema, int return buildSyntaxErrMsg(pMsgBuf, "invalid timestamp", pToken->z); } - return func(&tmpVal, pSchema->bytes, param); + return func(pMsgBuf, &tmpVal, pSchema->bytes, param); } } @@ -605,7 +605,7 @@ typedef struct SMemParam { col_id_t colIdx; } SMemParam; -static FORCE_INLINE int32_t MemRowAppend(const void* value, int32_t len, void* param) { +static FORCE_INLINE int32_t MemRowAppend(SMsgBuf* pMsgBuf, const void* value, int32_t len, void* param) { SMemParam* pa = (SMemParam*)param; SRowBuilder* rb = pa->rb; if (TSDB_DATA_TYPE_BINARY == pa->schema->type) { @@ -617,7 +617,9 @@ static FORCE_INLINE int32_t MemRowAppend(const void* value, int32_t len, void* p int32_t output = 0; const char* rowEnd = tdRowEnd(rb->pBuf); if (!taosMbsToUcs4(value, len, (TdUcs4*)varDataVal(rowEnd), pa->schema->bytes - VARSTR_HEADER_SIZE, &output)) { - return TSDB_CODE_TSC_SQL_SYNTAX_ERROR; + char buf[512] = {0}; + snprintf(buf, tListLen(buf), "%s", strerror(errno)); + return buildSyntaxErrMsg(pMsgBuf, buf, value); } varDataSetLen(rowEnd, output); tdAppendColValToRow(rb, pa->schema->colId, pa->schema->type, TD_VTYPE_NORM, rowEnd, false, pa->toffset, pa->colIdx); @@ -714,7 +716,7 @@ typedef struct SKvParam { char buf[TSDB_MAX_TAGS_LEN]; } SKvParam; -static int32_t KvRowAppend(const void *value, int32_t len, void *param) { +static int32_t KvRowAppend(SMsgBuf* pMsgBuf, const void *value, int32_t len, void *param) { SKvParam* pa = (SKvParam*) param; int8_t type = pa->schema->type; @@ -727,7 +729,9 @@ static int32_t KvRowAppend(const void *value, int32_t len, void *param) { // if the converted output len is over than pColumnModel->bytes, return error: 'Argument list too long' int32_t output = 0; if (!taosMbsToUcs4(value, len, (TdUcs4*)varDataVal(pa->buf), pa->schema->bytes - VARSTR_HEADER_SIZE, &output)) { - return TSDB_CODE_TSC_SQL_SYNTAX_ERROR; + char buf[512] = {0}; + snprintf(buf, tListLen(buf), "%s", strerror(errno)); + return buildSyntaxErrMsg(pMsgBuf, buf, value);; } varDataSetLen(pa->buf, output); diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 65e248a2bc..9468b9f16a 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -2167,7 +2167,7 @@ typedef struct SVgroupTablesBatch { static void toSchema(const SColumnDefNode* pCol, col_id_t colId, SSchema* pSchema) { pSchema->colId = colId; pSchema->type = pCol->dataType.type; - pSchema->bytes = pCol->dataType.bytes; + pSchema->bytes = calcTypeBytes(pCol->dataType); strcpy(pSchema->name, pCol->colName); }