From 3904018757989718cd27223d61e08d2c4864b470 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Wed, 30 Mar 2022 08:49:40 +0000 Subject: [PATCH 01/68] refact more --- source/libs/tdb/src/db/tdbBtree.c | 34 ++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/source/libs/tdb/src/db/tdbBtree.c b/source/libs/tdb/src/db/tdbBtree.c index fc27e88cf1..adfbbc37ad 100644 --- a/source/libs/tdb/src/db/tdbBtree.c +++ b/source/libs/tdb/src/db/tdbBtree.c @@ -1056,6 +1056,7 @@ int tdbBtcMoveToFirst(SBTC *pBtc) { int tdbBtcMoveToLast(SBTC *pBtc) { int ret; + int nCells; SBTree *pBt; SPager *pPager; SPgno pgno; @@ -1071,7 +1072,16 @@ int tdbBtcMoveToLast(SBTC *pBtc) { return -1; } + nCells = TDB_PAGE_TOTAL_CELLS(pBtc->pPage); pBtc->iPage = 0; + if (nCells > 0) { + pBtc->idx = TDB_BTREE_PAGE_IS_LEAF(pBtc->pPage) ? nCells - 1 : nCells; + } else { + // no data at all, point to an invalid position + ASSERT(TDB_BTREE_PAGE_IS_LEAF(pBtc->pPage)); + pBtc->idx = -1; + return 0; + } } else { // move from a position ASSERT(0); @@ -1079,19 +1089,19 @@ int tdbBtcMoveToLast(SBTC *pBtc) { // move downward for (;;) { - 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; - break; - } else { - pBtc->idx = TDB_PAGE_TOTAL_CELLS(pBtc->pPage); + if (TDB_BTREE_PAGE_IS_LEAF(pBtc->pPage)) break; - ret = tdbBtcMoveDownward(pBtc); - if (ret < 0) { - ASSERT(0); - return -1; - } + ret = tdbBtcMoveDownward(pBtc); + if (ret < 0) { + ASSERT(0); + return -1; + } + + nCells = TDB_PAGE_TOTAL_CELLS(pBtc->pPage); + if (TDB_BTREE_PAGE_IS_LEAF(pBtc->pPage)) { + pBtc->idx = nCells - 1; + } else { + pBtc->idx = nCells; } } From d7cf7e791c16ab44ba23cf3a1b8ebdcda05d8767 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Wed, 30 Mar 2022 09:25:30 +0000 Subject: [PATCH 02/68] refact more code --- source/libs/tdb/src/db/tdbBtree.c | 70 ++++++++++++++++++++----------- 1 file changed, 46 insertions(+), 24 deletions(-) diff --git a/source/libs/tdb/src/db/tdbBtree.c b/source/libs/tdb/src/db/tdbBtree.c index adfbbc37ad..d3534ae5a2 100644 --- a/source/libs/tdb/src/db/tdbBtree.c +++ b/source/libs/tdb/src/db/tdbBtree.c @@ -1083,8 +1083,28 @@ int tdbBtcMoveToLast(SBTC *pBtc) { return 0; } } else { - // move from a position - ASSERT(0); + int iPage = 0; + + // downward search + for (; iPage < pBtc->iPage; iPage++) { + ASSERT(!TDB_BTREE_PAGE_IS_LEAF(pBtc->pgStack[iPage])); + nCells = TDB_PAGE_TOTAL_CELLS(pBtc->pgStack[iPage]); + if (pBtc->idxStack[iPage] != nCells) break; + } + + // move upward + for (;;) { + if (pBtc->iPage == 0) { + if (TDB_BTREE_PAGE_IS_LEAF(pBtc->pPage)) { + pBtc->idx = TDB_PAGE_TOTAL_CELLS(pBtc->pPage) - 1; + } else { + pBtc->idx = TDB_PAGE_TOTAL_CELLS(pBtc->pPage); + } + } + + if (pBtc->iPage < iPage) break; + tdbBtcMoveUpward(pBtc); + } } // move downward @@ -1114,6 +1134,7 @@ int tdbBtreeNext(SBTC *pBtc, void **ppKey, int *kLen, void **ppVal, int *vLen) { void *pKey, *pVal; int ret; + // current cursor points to an invalid position if (pBtc->idx < 0) { return -1; } @@ -1144,12 +1165,17 @@ int tdbBtreeNext(SBTC *pBtc, void **ppKey, int *kLen, void **ppVal, int *vLen) { memcpy(pVal, cd.pVal, cd.vLen); ret = tdbBtcMoveToNext(pBtc); + if (ret < 0) { + ASSERT(0); + return -1; + } return 0; } static int tdbBtcMoveToNext(SBTC *pBtc) { int nCells; + int ret; SCell *pCell; ASSERT(TDB_BTREE_PAGE_IS_LEAF(pBtc->pPage)); @@ -1161,39 +1187,35 @@ static int tdbBtcMoveToNext(SBTC *pBtc) { return 0; } - if (pBtc->iPage == 0) { - pBtc->idx = -1; - return 0; - } - - // Move upward + // move upward for (;;) { - tdbBtcMoveUpward(pBtc); - pBtc->idx++; - - nCells = TDB_PAGE_TOTAL_CELLS(pBtc->pPage); - if (pBtc->idx <= nCells) { - break; - } - if (pBtc->iPage == 0) { pBtc->idx = -1; return 0; } - } - // Move downward - for (;;) { - nCells = TDB_PAGE_TOTAL_CELLS(pBtc->pPage); + tdbBtcMoveUpward(pBtc); + pBtc->idx++; - tdbBtcMoveDownward(pBtc); - pBtc->idx = 0; - - if (TDB_BTREE_PAGE_IS_LEAF(pBtc->pPage)) { + ASSERT(!TDB_BTREE_PAGE_IS_LEAF(pBtc->pPage)); + if (pBtc->idx <= TDB_PAGE_TOTAL_CELLS(pBtc->pPage)) { break; } } + // move downward + for (;;) { + if (TDB_BTREE_PAGE_IS_LEAF(pBtc->pPage)) break; + + ret = tdbBtcMoveDownward(pBtc); + if (ret < 0) { + ASSERT(0); + return -1; + } + + pBtc->idx = 0; + } + return 0; } From b5e9f2aca0096ba00dfd6adcfc37d75e17a3aa79 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Wed, 30 Mar 2022 09:58:33 +0000 Subject: [PATCH 03/68] refact more --- source/libs/tdb/src/db/tdbBtree.c | 82 +++++++++++++++++------------- source/libs/tdb/src/db/tdbDb.c | 17 +------ source/libs/tdb/src/inc/tdbBtree.h | 2 +- 3 files changed, 50 insertions(+), 51 deletions(-) diff --git a/source/libs/tdb/src/db/tdbBtree.c b/source/libs/tdb/src/db/tdbBtree.c index d3534ae5a2..b1728b53e7 100644 --- a/source/libs/tdb/src/db/tdbBtree.c +++ b/source/libs/tdb/src/db/tdbBtree.c @@ -29,7 +29,7 @@ struct SBTree { int minLocal; int maxLeaf; int minLeaf; - u8 *pTmp; + void *pBuf; }; #define TDB_BTREE_PAGE_COMMON_HDR u8 flags; @@ -127,66 +127,80 @@ int tdbBtreeClose(SBTree *pBt) { return 0; } -int tdbBtCursorInsert(SBTC *pBtc, const void *pKey, int kLen, const void *pVal, int vLen) { - int ret; - int idx; - SPager *pPager; - SCell *pCell; - int szCell; - int cret; - SBTree *pBt; +int tdbBtreeInsert(SBTree *pBt, const void *pKey, int kLen, const void *pVal, int vLen) { + SBTC btc; + SCell *pCell; + void *pBuf; + int szCell; + int szBuf; + int ret; + int idx; + int c; - ret = tdbBtcMoveTo(pBtc, pKey, kLen, &cret); + tdbBtcOpen(&btc, pBt); + + // move to the position to insert + ret = tdbBtcMoveTo(&btc, pKey, kLen, &c); if (ret < 0) { - // TODO: handle error + tdbBtcClose(&btc); + ASSERT(0); return -1; } - if (pBtc->idx == -1) { - ASSERT(TDB_PAGE_TOTAL_CELLS(pBtc->pPage) == 0); + if (btc.idx == -1) { idx = 0; } else { - if (cret > 0) { - idx = pBtc->idx + 1; - } else if (cret < 0) { - idx = pBtc->idx; + if (c > 0) { + idx = btc.idx + 1; + } else if (c < 0) { + idx = btc.idx; } else { - /* TODO */ + // TDB does NOT allow same key + tdbBtcClose(&btc); ASSERT(0); - } - } - - // TODO: refact code here - pBt = pBtc->pBt; - if (!pBt->pTmp) { - pBt->pTmp = (u8 *)tdbOsMalloc(pBt->pageSize); - if (pBt->pTmp == NULL) { return -1; } } - pCell = pBt->pTmp; + // make sure enough space to hold the space + szBuf = kLen + vLen + 14; + pBuf = TDB_REALLOC(pBt->pBuf, pBt->pageSize > szBuf ? szBuf : pBt->pageSize); + if (pBuf == NULL) { + tdbBtcClose(&btc); + ASSERT(0); + return -1; + } + pBt->pBuf = pBuf; + pCell = (SCell *)pBt->pBuf; - // Encode the cell - ret = tdbBtreeEncodeCell(pBtc->pPage, pKey, kLen, pVal, vLen, pCell, &szCell); + // encode cell + ret = tdbBtreeEncodeCell(btc.pPage, pKey, kLen, pVal, vLen, pCell, &szCell); if (ret < 0) { + tdbBtcClose(&btc); + ASSERT(0); return -1; } - // Insert the cell to the index - ret = tdbPageInsertCell(pBtc->pPage, idx, pCell, szCell, 0); + // insert the cell + ret = tdbPageInsertCell(btc.pPage, idx, pCell, szCell, 0); if (ret < 0) { + tdbBtcClose(&btc); + ASSERT(0); return -1; } - // If page is overflow, balance the tree - if (pBtc->pPage->nOverflow > 0) { - ret = tdbBtreeBalance(pBtc); + // check if need balance + if (btc.pPage->nOverflow > 0) { + ret = tdbBtreeBalance(&btc); if (ret < 0) { + tdbBtcClose(&btc); + ASSERT(0); return -1; } } + tdbBtcClose(&btc); + return 0; } diff --git a/source/libs/tdb/src/db/tdbDb.c b/source/libs/tdb/src/db/tdbDb.c index e41e41f72a..0de2a6433f 100644 --- a/source/libs/tdb/src/db/tdbDb.c +++ b/source/libs/tdb/src/db/tdbDb.c @@ -74,22 +74,7 @@ int tdbDbDrop(TDB *pDb) { } int tdbDbInsert(TDB *pDb, const void *pKey, int keyLen, const void *pVal, int valLen) { - SBTC btc; - SBTC *pCur; - int ret; - - pCur = &btc; - ret = tdbBtcOpen(pCur, pDb->pBt); - if (ret < 0) { - return -1; - } - - ret = tdbBtCursorInsert(pCur, pKey, keyLen, pVal, valLen); - if (ret < 0) { - return -1; - } - - return 0; + return tdbBtreeInsert(pDb->pBt, pKey, keyLen, pVal, valLen); } int tdbDbGet(TDB *pDb, const void *pKey, int kLen, void **ppVal, int *vLen) { diff --git a/source/libs/tdb/src/inc/tdbBtree.h b/source/libs/tdb/src/inc/tdbBtree.h index 2797b5ea5e..2eba5f4f1a 100644 --- a/source/libs/tdb/src/inc/tdbBtree.h +++ b/source/libs/tdb/src/inc/tdbBtree.h @@ -40,7 +40,7 @@ struct SBTC { // SBTree int tdbBtreeOpen(int keyLen, int valLen, SPager *pFile, FKeyComparator kcmpr, SBTree **ppBt); int tdbBtreeClose(SBTree *pBt); -int tdbBtCursorInsert(SBTC *pCur, const void *pKey, int kLen, const void *pVal, int vLen); +int tdbBtreeInsert(SBTree *pBt, const void *pKey, int kLen, const void *pVal, int vLen); int tdbBtreeGet(SBTree *pBt, const void *pKey, int kLen, void **ppVal, int *vLen); int tdbBtreePGet(SBTree *pBt, const void *pKey, int kLen, void **ppKey, int *pkLen, void **ppVal, int *vLen); From cee75c2ba338056e17f2fd47b8732a9365b92d1b Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Wed, 30 Mar 2022 10:01:12 +0000 Subject: [PATCH 04/68] more --- source/libs/tdb/src/db/tdbBtree.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/source/libs/tdb/src/db/tdbBtree.c b/source/libs/tdb/src/db/tdbBtree.c index b1728b53e7..848500875d 100644 --- a/source/libs/tdb/src/db/tdbBtree.c +++ b/source/libs/tdb/src/db/tdbBtree.c @@ -162,7 +162,7 @@ int tdbBtreeInsert(SBTree *pBt, const void *pKey, int kLen, const void *pVal, in } } - // make sure enough space to hold the space + // make sure enough space to hold the cell szBuf = kLen + vLen + 14; pBuf = TDB_REALLOC(pBt->pBuf, pBt->pageSize > szBuf ? szBuf : pBt->pageSize); if (pBuf == NULL) { @@ -181,6 +181,14 @@ int tdbBtreeInsert(SBTree *pBt, const void *pKey, int kLen, const void *pVal, in return -1; } + // mark the page dirty + ret = tdbPagerWrite(pBt->pPager, btc.pPage); + if (ret < 0) { + tdbBtcClose(&btc); + ASSERT(0); + return -1; + } + // insert the cell ret = tdbPageInsertCell(btc.pPage, idx, pCell, szCell, 0); if (ret < 0) { From 0a62868d5ee8e1b0d637209fd9b617adb3f9da8e Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Wed, 30 Mar 2022 10:07:38 +0000 Subject: [PATCH 05/68] refact more --- source/libs/tdb/src/db/tdbBtree.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/source/libs/tdb/src/db/tdbBtree.c b/source/libs/tdb/src/db/tdbBtree.c index 848500875d..a4ca75ff36 100644 --- a/source/libs/tdb/src/db/tdbBtree.c +++ b/source/libs/tdb/src/db/tdbBtree.c @@ -216,15 +216,22 @@ int tdbBtreeGet(SBTree *pBt, const void *pKey, int kLen, void **ppVal, int *vLen SBTC btc; SCell *pCell; int cret; + int ret; void *pVal; SCellDecoder cd; tdbBtcOpen(&btc, pBt); - tdbBtcMoveTo(&btc, pKey, kLen, &cret); + ret = tdbBtcMoveTo(&btc, pKey, kLen, &cret); + if (ret < 0) { + tdbBtcClose(&btc); + ASSERT(0); + return -1; + } if (cret) { - return cret; + tdbBtcClose(&btc); + return -1; } pCell = tdbPageGetCell(btc.pPage, btc.idx); @@ -233,11 +240,15 @@ int tdbBtreeGet(SBTree *pBt, const void *pKey, int kLen, void **ppVal, int *vLen *vLen = cd.vLen; pVal = TDB_REALLOC(*ppVal, *vLen); if (pVal == NULL) { + tdbBtcClose(&btc); return -1; } *ppVal = pVal; memcpy(*ppVal, cd.pVal, cd.vLen); + + tdbBtcClose(&btc); + return 0; } From f75f60c84c8c9571fa4caf8537363403b7ad20fc Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Wed, 30 Mar 2022 10:18:04 +0000 Subject: [PATCH 06/68] refact more --- source/libs/tdb/src/db/tdbBtree.c | 69 +++++++++++-------------------- 1 file changed, 24 insertions(+), 45 deletions(-) diff --git a/source/libs/tdb/src/db/tdbBtree.c b/source/libs/tdb/src/db/tdbBtree.c index a4ca75ff36..ef9b03df6c 100644 --- a/source/libs/tdb/src/db/tdbBtree.c +++ b/source/libs/tdb/src/db/tdbBtree.c @@ -213,11 +213,16 @@ int tdbBtreeInsert(SBTree *pBt, const void *pKey, int kLen, const void *pVal, in } int tdbBtreeGet(SBTree *pBt, const void *pKey, int kLen, void **ppVal, int *vLen) { + return tdbBtreePGet(pBt, pKey, kLen, NULL, NULL, ppVal, vLen); +} + +int tdbBtreePGet(SBTree *pBt, const void *pKey, int kLen, void **ppKey, int *pkLen, void **ppVal, int *vLen) { SBTC btc; SCell *pCell; int cret; int ret; - void *pVal; + void *pTKey = NULL; + void *pTVal = NULL; SCellDecoder cd; tdbBtcOpen(&btc, pBt); @@ -226,7 +231,6 @@ int tdbBtreeGet(SBTree *pBt, const void *pKey, int kLen, void **ppVal, int *vLen if (ret < 0) { tdbBtcClose(&btc); ASSERT(0); - return -1; } if (cret) { @@ -237,14 +241,26 @@ int tdbBtreeGet(SBTree *pBt, const void *pKey, int kLen, void **ppVal, int *vLen pCell = tdbPageGetCell(btc.pPage, btc.idx); tdbBtreeDecodeCell(btc.pPage, pCell, &cd); - *vLen = cd.vLen; - pVal = TDB_REALLOC(*ppVal, *vLen); - if (pVal == NULL) { - tdbBtcClose(&btc); - return -1; + if (ppKey) { + pTKey = TDB_REALLOC(*ppKey, cd.kLen); + if (pTKey == NULL) { + tdbBtcClose(&btc); + ASSERT(0); + return -1; + } + *ppKey = pTKey; + *pkLen = cd.kLen; + memcpy(*ppKey, cd.pKey, cd.kLen); } - *ppVal = pVal; + pTVal = TDB_REALLOC(*ppVal, cd.vLen); + if (pTVal == NULL) { + tdbBtcClose(&btc); + ASSERT(0); + return -1; + } + *ppVal = pTVal; + *vLen = cd.vLen; memcpy(*ppVal, cd.pVal, cd.vLen); tdbBtcClose(&btc); @@ -252,43 +268,6 @@ int tdbBtreeGet(SBTree *pBt, const void *pKey, int kLen, void **ppVal, int *vLen return 0; } -int tdbBtreePGet(SBTree *pBt, const void *pKey, int kLen, void **ppKey, int *pkLen, void **ppVal, int *vLen) { - SBTC btc; - SCell *pCell; - int cret; - void *pTKey; - void *pTVal; - SCellDecoder cd; - - tdbBtcOpen(&btc, pBt); - - tdbBtcMoveTo(&btc, pKey, kLen, &cret); - if (cret) { - return cret; - } - - pCell = tdbPageGetCell(btc.pPage, btc.idx); - tdbBtreeDecodeCell(btc.pPage, pCell, &cd); - - pTKey = TDB_REALLOC(*ppKey, cd.kLen); - pTVal = TDB_REALLOC(*ppVal, cd.vLen); - - if (pTKey == NULL || pTVal == NULL) { - TDB_FREE(pTKey); - TDB_FREE(pTVal); - } - - *ppKey = pTKey; - *ppVal = pTVal; - *pkLen = cd.kLen; - *vLen = cd.vLen; - - memcpy(*ppKey, cd.pKey, cd.kLen); - memcpy(*ppVal, cd.pVal, cd.vLen); - - return 0; -} - static int tdbDefaultKeyCmprFn(const void *pKey1, int keyLen1, const void *pKey2, int keyLen2) { int mlen; int cret; From a6f0d2b55396d01f045f3cdc39df9b867fe5bcbb Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Wed, 30 Mar 2022 10:31:28 +0000 Subject: [PATCH 07/68] refact more --- source/libs/tdb/src/db/tdbPager.c | 1 - source/libs/tdb/src/inc/tdbOs.h | 6 +++++- source/libs/tdb/test/tdbTest.cpp | 18 ++---------------- 3 files changed, 7 insertions(+), 18 deletions(-) diff --git a/source/libs/tdb/src/db/tdbPager.c b/source/libs/tdb/src/db/tdbPager.c index 748633da34..b00bba2f66 100644 --- a/source/libs/tdb/src/db/tdbPager.c +++ b/source/libs/tdb/src/db/tdbPager.c @@ -210,7 +210,6 @@ int tdbPagerCommit(SPager *pPager) { tdbOsClose(pPager->jfd); tdbOsRemove(pPager->jFileName); - // pPager->jfd = -1; return 0; } diff --git a/source/libs/tdb/src/inc/tdbOs.h b/source/libs/tdb/src/inc/tdbOs.h index 196bbdafc7..5259cfb4d3 100644 --- a/source/libs/tdb/src/inc/tdbOs.h +++ b/source/libs/tdb/src/inc/tdbOs.h @@ -95,7 +95,11 @@ typedef int tdb_fd_t; #define tdbOsOpen(PATH, OPTION, MODE) open((PATH), (OPTION), (MODE)) -#define tdbOsClose close +#define tdbOsClose(FD) \ + do { \ + close(FD); \ + (FD) = -1; \ + } while (0) i64 tdbOsRead(tdb_fd_t fd, void *pData, i64 nBytes); i64 tdbOsPRead(tdb_fd_t fd, void *pData, i64 nBytes, i64 offset); diff --git a/source/libs/tdb/test/tdbTest.cpp b/source/libs/tdb/test/tdbTest.cpp index f41e2bcbee..2cb318a4d0 100644 --- a/source/libs/tdb/test/tdbTest.cpp +++ b/source/libs/tdb/test/tdbTest.cpp @@ -134,13 +134,7 @@ TEST(tdb_test, simple_test) { char val[64]; { // Insert some data - int i = 1; - SPoolMem *pPool; - int memPoolCapacity = 16 * 1024; - - pPool = openPool(); - - tdbTxnBegin(pEnv); + int i = 1; for (;;) { if (i > nData) break; @@ -150,18 +144,10 @@ TEST(tdb_test, simple_test) { ret = tdbDbInsert(pDb, key, strlen(key), val, strlen(val)); GTEST_ASSERT_EQ(ret, 0); - if (pPool->size >= memPoolCapacity) { - tdbTxnCommit(pEnv); - - clearPool(pPool); - - tdbTxnBegin(pEnv); - } - i++; } - closePool(pPool); + // tdbPagerCommit() } { // Query the data From cb4bd33c80fc1966a0066f697e6468e72d1dabd3 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Wed, 30 Mar 2022 10:46:08 +0000 Subject: [PATCH 08/68] more --- source/libs/tdb/src/db/tdbTxn.c | 12 ++++++++++++ source/libs/tdb/test/tdbTest.cpp | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/source/libs/tdb/src/db/tdbTxn.c b/source/libs/tdb/src/db/tdbTxn.c index fd4d5de60e..bb0bc6c845 100644 --- a/source/libs/tdb/src/db/tdbTxn.c +++ b/source/libs/tdb/src/db/tdbTxn.c @@ -21,6 +21,18 @@ int tdbTxnBegin(TENV *pEnv) { } int tdbTxnCommit(TENV *pEnv) { + SPager *pPager = NULL; + int ret; + + for (;;) { + break; + ret = tdbPagerCommit(pPager); + if (ret < 0) { + ASSERT(0); + return -1; + } + } + // TODO return 0; } diff --git a/source/libs/tdb/test/tdbTest.cpp b/source/libs/tdb/test/tdbTest.cpp index 2cb318a4d0..a976a9e581 100644 --- a/source/libs/tdb/test/tdbTest.cpp +++ b/source/libs/tdb/test/tdbTest.cpp @@ -147,7 +147,7 @@ TEST(tdb_test, simple_test) { i++; } - // tdbPagerCommit() + tdbTxnCommit(pEnv); } { // Query the data From 110703f9dfaba749bed52185cd1acfd9889b4742 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Wed, 30 Mar 2022 10:51:07 +0000 Subject: [PATCH 09/68] refact more --- source/libs/tdb/src/db/tdbEnv.c | 15 +++++++++++ source/libs/tdb/src/db/tdbTxn.c | 44 ++++++++++++++++---------------- source/libs/tdb/src/inc/tdbEnv.h | 5 ++++ source/libs/tdb/src/inc/tdbInt.h | 17 ------------ source/libs/tdb/src/inc/tdbTxn.h | 4 --- source/libs/tdb/test/tdbTest.cpp | 2 +- 6 files changed, 43 insertions(+), 44 deletions(-) diff --git a/source/libs/tdb/src/db/tdbEnv.c b/source/libs/tdb/src/db/tdbEnv.c index 4439147e09..5a5c281ed1 100644 --- a/source/libs/tdb/src/db/tdbEnv.c +++ b/source/libs/tdb/src/db/tdbEnv.c @@ -64,6 +64,21 @@ int tdbEnvClose(TENV *pEnv) { return 0; } +int tdbBegin(TENV *pEnv) { + // TODO + return 0; +} + +int tdbCommit(TENV *pEnv) { + // TODO + return 0; +} + +int tdbRollback(TENV *pEnv) { + // TODO + return 0; +} + SPager *tdbEnvGetPager(TENV *pEnv, const char *fname) { // TODO return NULL; diff --git a/source/libs/tdb/src/db/tdbTxn.c b/source/libs/tdb/src/db/tdbTxn.c index bb0bc6c845..03bcbb44a7 100644 --- a/source/libs/tdb/src/db/tdbTxn.c +++ b/source/libs/tdb/src/db/tdbTxn.c @@ -15,29 +15,29 @@ #include "tdbInt.h" -int tdbTxnBegin(TENV *pEnv) { - // TODO - return 0; -} +// int tdbTxnBegin(TENV *pEnv) { +// // TODO +// return 0; +// } -int tdbTxnCommit(TENV *pEnv) { - SPager *pPager = NULL; - int ret; +// int tdbTxnCommit(TENV *pEnv) { +// SPager *pPager = NULL; +// int ret; - for (;;) { - break; - ret = tdbPagerCommit(pPager); - if (ret < 0) { - ASSERT(0); - return -1; - } - } +// for (;;) { +// break; +// ret = tdbPagerCommit(pPager); +// if (ret < 0) { +// ASSERT(0); +// return -1; +// } +// } - // TODO - return 0; -} +// // TODO +// return 0; +// } -int tdbTxnRollback(TENV *pEnv) { - // TODO - return 0; -} \ No newline at end of file +// int tdbTxnRollback(TENV *pEnv) { +// // TODO +// return 0; +// } \ No newline at end of file diff --git a/source/libs/tdb/src/inc/tdbEnv.h b/source/libs/tdb/src/inc/tdbEnv.h index a651c3a12e..693be86cd8 100644 --- a/source/libs/tdb/src/inc/tdbEnv.h +++ b/source/libs/tdb/src/inc/tdbEnv.h @@ -25,10 +25,15 @@ typedef struct STEnv { char *jfname; int jfd; SPCache *pCache; + int nHash; + SPager **pagerHash; } TENV; int tdbEnvOpen(const char *rootDir, int pageSize, int cacheSize, TENV **ppEnv); int tdbEnvClose(TENV *pEnv); +int tdbBegin(TENV *pEnv); +int tdbCommit(TENV *pEnv); +int tdbRollback(TENV *pEnv); SPager *tdbEnvGetPager(TENV *pEnv, const char *fname); diff --git a/source/libs/tdb/src/inc/tdbInt.h b/source/libs/tdb/src/inc/tdbInt.h index 361a460cef..26f9247952 100644 --- a/source/libs/tdb/src/inc/tdbInt.h +++ b/source/libs/tdb/src/inc/tdbInt.h @@ -91,23 +91,6 @@ static FORCE_INLINE int tdbCmprPgId(const void *p1, const void *p2) { // dbname #define TDB_MAX_DBNAME_LEN 24 -// tdb_log -#define tdbError(var) - -#define TERR_A(val, op, flag) \ - do { \ - if (((val) = (op)) != 0) { \ - goto flag; \ - } \ - } while (0) - -#define TERR_B(val, op, flag) \ - do { \ - if (((val) = (op)) == NULL) { \ - goto flag; \ - } \ - } while (0) - #define TDB_VARIANT_LEN ((int)-1) typedef int (*FKeyComparator)(const void *pKey1, int kLen1, const void *pKey2, int kLen2); diff --git a/source/libs/tdb/src/inc/tdbTxn.h b/source/libs/tdb/src/inc/tdbTxn.h index cc11369785..0be2dad3c2 100644 --- a/source/libs/tdb/src/inc/tdbTxn.h +++ b/source/libs/tdb/src/inc/tdbTxn.h @@ -28,10 +28,6 @@ struct STxn { void *xArg; }; -int tdbTxnBegin(TENV *pEnv); -int tdbTxnCommit(TENV *pEnv); -int tdbTxnRollback(TENV *pEnv); - #ifdef __cplusplus } #endif diff --git a/source/libs/tdb/test/tdbTest.cpp b/source/libs/tdb/test/tdbTest.cpp index a976a9e581..2d19596ca6 100644 --- a/source/libs/tdb/test/tdbTest.cpp +++ b/source/libs/tdb/test/tdbTest.cpp @@ -147,7 +147,7 @@ TEST(tdb_test, simple_test) { i++; } - tdbTxnCommit(pEnv); + tdbCommit(pEnv); } { // Query the data From 4ecbe41d134bef9e69d93458b83fb4d04a9efe7a Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Wed, 30 Mar 2022 11:07:58 +0000 Subject: [PATCH 10/68] adjust some code --- source/libs/tdb/src/db/tdbBtree.c | 2 +- source/libs/tdb/src/db/tdbEnv.c | 25 ++++++++++++++++++++++--- source/libs/tdb/src/db/tdbPager.c | 16 ---------------- source/libs/tdb/src/inc/tdbEnv.h | 5 +++++ source/libs/tdb/src/inc/tdbPager.h | 15 ++++++++++++++- 5 files changed, 42 insertions(+), 21 deletions(-) diff --git a/source/libs/tdb/src/db/tdbBtree.c b/source/libs/tdb/src/db/tdbBtree.c index ef9b03df6c..f7e0d7181a 100644 --- a/source/libs/tdb/src/db/tdbBtree.c +++ b/source/libs/tdb/src/db/tdbBtree.c @@ -101,7 +101,7 @@ int tdbBtreeOpen(int keyLen, int valLen, SPager *pPager, FKeyComparator kcmpr, S // pBt->kcmpr pBt->kcmpr = kcmpr ? kcmpr : tdbDefaultKeyCmprFn; // pBt->pageSize - pBt->pageSize = tdbPagerGetPageSize(pPager); + pBt->pageSize = pPager->pageSize; // pBt->maxLocal pBt->maxLocal = tdbPageCapacity(pBt->pageSize, sizeof(SIntHdr)) / 4; // pBt->minLocal: Should not be allowed smaller than 15, which is [nPayload][nKey][nData] diff --git a/source/libs/tdb/src/db/tdbEnv.c b/source/libs/tdb/src/db/tdbEnv.c index 5a5c281ed1..a981e8c99e 100644 --- a/source/libs/tdb/src/db/tdbEnv.c +++ b/source/libs/tdb/src/db/tdbEnv.c @@ -19,6 +19,7 @@ int tdbEnvOpen(const char *rootDir, int pageSize, int cacheSize, TENV **ppEnv) { TENV *pEnv; int dsize; int zsize; + int tsize; u8 *pPtr; int ret; @@ -53,6 +54,14 @@ int tdbEnvOpen(const char *rootDir, int pageSize, int cacheSize, TENV **ppEnv) { return -1; } + pEnv->nHash = 8; + tsize = sizeof(SPager *) * pEnv->nHash; + pEnv->pagerHash = TDB_REALLOC(pEnv->pagerHash, tsize); + if (pEnv->pagerHash == NULL) { + return -1; + } + memset(pEnv->pagerHash, 0, tsize); + mkdir(rootDir, 0755); *ppEnv = pEnv; @@ -65,21 +74,31 @@ int tdbEnvClose(TENV *pEnv) { } int tdbBegin(TENV *pEnv) { - // TODO + ASSERT(0); return 0; } int tdbCommit(TENV *pEnv) { - // TODO + SPager *pPager; + + pPager = pEnv->pagerList; + while (pPager) { + tdbPagerCommit(pPager); + } + return 0; } int tdbRollback(TENV *pEnv) { - // TODO + ASSERT(0); return 0; } SPager *tdbEnvGetPager(TENV *pEnv, const char *fname) { // TODO return NULL; +} + +static void tdbEnvAddPager(TENV *pEnv, SPager *pPager) { + } \ No newline at end of file diff --git a/source/libs/tdb/src/db/tdbPager.c b/source/libs/tdb/src/db/tdbPager.c index b00bba2f66..818b8a371a 100644 --- a/source/libs/tdb/src/db/tdbPager.c +++ b/source/libs/tdb/src/db/tdbPager.c @@ -15,20 +15,6 @@ #include "tdbInt.h" -struct SPager { - char *dbFileName; - char *jFileName; - int pageSize; - uint8_t fid[TDB_FILE_ID_LEN]; - tdb_fd_t fd; - tdb_fd_t jfd; - SPCache *pCache; - SPgno dbFileSize; - SPgno dbOrigSize; - SPage *pDirty; - u8 inTran; -}; - typedef struct __attribute__((__packed__)) { u8 hdrString[16]; u16 pageSize; @@ -229,8 +215,6 @@ static int tdbPagerReadPage(SPager *pPager, SPage *pPage) { return 0; } -int tdbPagerGetPageSize(SPager *pPager) { return pPager->pageSize; } - int tdbPagerFetchPage(SPager *pPager, SPgno pgno, SPage **ppPage, int (*initPage)(SPage *, void *), void *arg) { SPage *pPage; SPgid pgid; diff --git a/source/libs/tdb/src/inc/tdbEnv.h b/source/libs/tdb/src/inc/tdbEnv.h index 693be86cd8..3eb3ebb328 100644 --- a/source/libs/tdb/src/inc/tdbEnv.h +++ b/source/libs/tdb/src/inc/tdbEnv.h @@ -20,11 +20,16 @@ extern "C" { #endif +#define TDB_PAGER_ENV_FIELDS \ + SPager *pNext; \ + SPager *pHashNext; + typedef struct STEnv { char *rootDir; char *jfname; int jfd; SPCache *pCache; + SPager *pagerList; int nHash; SPager **pagerHash; } TENV; diff --git a/source/libs/tdb/src/inc/tdbPager.h b/source/libs/tdb/src/inc/tdbPager.h index f4cc822f27..7ae86eb3ac 100644 --- a/source/libs/tdb/src/inc/tdbPager.h +++ b/source/libs/tdb/src/inc/tdbPager.h @@ -20,13 +20,26 @@ extern "C" { #endif +struct SPager { + char *dbFileName; + char *jFileName; + int pageSize; + uint8_t fid[TDB_FILE_ID_LEN]; + tdb_fd_t fd; + tdb_fd_t jfd; + SPCache *pCache; + SPgno dbFileSize; + SPgno dbOrigSize; + SPage *pDirty; + u8 inTran; +}; + int tdbPagerOpen(SPCache *pCache, const char *fileName, SPager **ppPager); int tdbPagerClose(SPager *pPager); int tdbPagerOpenDB(SPager *pPager, SPgno *ppgno, bool toCreate); int tdbPagerWrite(SPager *pPager, SPage *pPage); int tdbPagerBegin(SPager *pPager); int tdbPagerCommit(SPager *pPager); -int tdbPagerGetPageSize(SPager *pPager); int tdbPagerFetchPage(SPager *pPager, SPgno pgno, SPage **ppPage, int (*initPage)(SPage *, void *), void *arg); int tdbPagerNewPage(SPager *pPager, SPgno *ppgno, SPage **ppPage, int (*initPage)(SPage *, void *), void *arg); void tdbPagerReturnPage(SPager *pPager, SPage *pPage); From a466372179f897abb4e3bbe3546a4c06e2795582 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Thu, 31 Mar 2022 02:10:26 +0000 Subject: [PATCH 11/68] more TDB --- source/libs/tdb/src/db/tdbEnv.c | 71 ++++++++++++++++++++++++++---- source/libs/tdb/src/inc/tdbEnv.h | 13 +++--- source/libs/tdb/src/inc/tdbPager.h | 2 + source/libs/tdb/src/inc/tdbUtil.h | 5 +++ 4 files changed, 75 insertions(+), 16 deletions(-) diff --git a/source/libs/tdb/src/db/tdbEnv.c b/source/libs/tdb/src/db/tdbEnv.c index a981e8c99e..6e74aefc62 100644 --- a/source/libs/tdb/src/db/tdbEnv.c +++ b/source/libs/tdb/src/db/tdbEnv.c @@ -54,13 +54,13 @@ int tdbEnvOpen(const char *rootDir, int pageSize, int cacheSize, TENV **ppEnv) { return -1; } - pEnv->nHash = 8; - tsize = sizeof(SPager *) * pEnv->nHash; - pEnv->pagerHash = TDB_REALLOC(pEnv->pagerHash, tsize); - if (pEnv->pagerHash == NULL) { + pEnv->nPgrHash = 8; + tsize = sizeof(SPager *) * pEnv->nPgrHash; + pEnv->pgrHash = TDB_REALLOC(pEnv->pgrHash, tsize); + if (pEnv->pgrHash == NULL) { return -1; } - memset(pEnv->pagerHash, 0, tsize); + memset(pEnv->pgrHash, 0, tsize); mkdir(rootDir, 0755); @@ -81,7 +81,7 @@ int tdbBegin(TENV *pEnv) { int tdbCommit(TENV *pEnv) { SPager *pPager; - pPager = pEnv->pagerList; + pPager = pEnv->pgrList; while (pPager) { tdbPagerCommit(pPager); } @@ -95,10 +95,63 @@ int tdbRollback(TENV *pEnv) { } SPager *tdbEnvGetPager(TENV *pEnv, const char *fname) { - // TODO - return NULL; + int hash; + SPager **ppPager; + + hash = tdbCstringHash(fname); + ppPager = &pEnv->pgrHash[hash % pEnv->nPgrHash]; + for (; *ppPager && (strcmp(fname, (*ppPager)->dbFileName) != 0); ppPager = &((*ppPager)->pHashNext)) { + } + + return *ppPager; } -static void tdbEnvAddPager(TENV *pEnv, SPager *pPager) { +void tdbEnvAddPager(TENV *pEnv, SPager *pPager) { + int hash; + SPager **ppPager; + // rehash if neccessary + if (pEnv->nPager + 1 > pEnv->nPgrHash) { + // TODO + } + + // add to list + pPager->pNext = pEnv->pgrList; + pEnv->pgrList = pPager; + + // add to hash + hash = tdbCstringHash(pPager->dbFileName); + ppPager = &pEnv->pgrHash[hash % pEnv->nPgrHash]; + pPager->pHashNext = *ppPager; + *ppPager = pPager; + + // increase the counter + pEnv->nPager++; +} + +void tdbEnvRemovePager(TENV *pEnv, SPager *pPager) { + int hash; + SPager **ppPager; + + // remove from the list + for (ppPager = &pEnv->pgrList; *ppPager && (*ppPager != pPager); ppPager = &((*ppPager)->pNext)) { + } + ASSERT(*ppPager == pPager); + *ppPager = pPager->pNext; + + // remove from hash + hash = tdbCstringHash(pPager->dbFileName); + ppPager = &pEnv->pgrHash[hash % pEnv->nPgrHash]; + for (; *ppPager && *ppPager != pPager; ppPager = &((*ppPager)->pHashNext)) { + } + ASSERT(*ppPager == pPager); + *ppPager = pPager->pNext; + + // decrease the counter + pEnv->nPager--; + + // rehash if necessary + if (pEnv->nPgrHash > 8 && pEnv->nPager < pEnv->nPgrHash / 2) { + // TODO + } } \ No newline at end of file diff --git a/source/libs/tdb/src/inc/tdbEnv.h b/source/libs/tdb/src/inc/tdbEnv.h index 3eb3ebb328..e10c5d54e0 100644 --- a/source/libs/tdb/src/inc/tdbEnv.h +++ b/source/libs/tdb/src/inc/tdbEnv.h @@ -20,18 +20,15 @@ extern "C" { #endif -#define TDB_PAGER_ENV_FIELDS \ - SPager *pNext; \ - SPager *pHashNext; - typedef struct STEnv { char *rootDir; char *jfname; int jfd; SPCache *pCache; - SPager *pagerList; - int nHash; - SPager **pagerHash; + SPager *pgrList; + int nPager; + int nPgrHash; + SPager **pgrHash; } TENV; int tdbEnvOpen(const char *rootDir, int pageSize, int cacheSize, TENV **ppEnv); @@ -40,6 +37,8 @@ int tdbBegin(TENV *pEnv); int tdbCommit(TENV *pEnv); int tdbRollback(TENV *pEnv); +void tdbEnvAddPager(TENV *pEnv, SPager *pPager); +void tdbEnvRemovePager(TENV *pEnv, SPager *pPager); SPager *tdbEnvGetPager(TENV *pEnv, const char *fname); #ifdef __cplusplus diff --git a/source/libs/tdb/src/inc/tdbPager.h b/source/libs/tdb/src/inc/tdbPager.h index 7ae86eb3ac..81b6074431 100644 --- a/source/libs/tdb/src/inc/tdbPager.h +++ b/source/libs/tdb/src/inc/tdbPager.h @@ -32,6 +32,8 @@ struct SPager { SPgno dbOrigSize; SPage *pDirty; u8 inTran; + SPager *pNext; // used by TENV + SPager *pHashNext; // used by TENV }; int tdbPagerOpen(SPCache *pCache, const char *fileName, SPager **ppPager); diff --git a/source/libs/tdb/src/inc/tdbUtil.h b/source/libs/tdb/src/inc/tdbUtil.h index c06d9d18c9..a4cb09ea94 100644 --- a/source/libs/tdb/src/inc/tdbUtil.h +++ b/source/libs/tdb/src/inc/tdbUtil.h @@ -101,6 +101,11 @@ static inline int tdbGetVarInt(const u8 *p, int *v) { return n; } +static inline int tdbCstringHash(const char *s) { + // TODO + return 0; +} + #ifdef __cplusplus } #endif From 14bd838a9f285464b1025634a77f0a1d6c56e522 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Thu, 31 Mar 2022 02:23:58 +0000 Subject: [PATCH 12/68] more TDB --- .clang-format | 1 + source/libs/tdb/src/db/tdbEnv.c | 6 +++--- source/libs/tdb/src/inc/tdbInt.h | 2 -- source/libs/tdb/src/inc/tdbOs.h | 2 ++ source/libs/tdb/src/inc/tdbUtil.h | 5 +---- 5 files changed, 7 insertions(+), 9 deletions(-) diff --git a/.clang-format b/.clang-format index 3ddd8b43f6..e58d518b3b 100644 --- a/.clang-format +++ b/.clang-format @@ -5,6 +5,7 @@ AccessModifierOffset: -1 AlignAfterOpenBracket: Align AlignConsecutiveAssignments: false AlignConsecutiveDeclarations: true +AlignConsecutiveMacros: true AlignEscapedNewlinesLeft: true AlignOperands: true AlignTrailingComments: true diff --git a/source/libs/tdb/src/db/tdbEnv.c b/source/libs/tdb/src/db/tdbEnv.c index 6e74aefc62..a9e29d3f73 100644 --- a/source/libs/tdb/src/db/tdbEnv.c +++ b/source/libs/tdb/src/db/tdbEnv.c @@ -95,7 +95,7 @@ int tdbRollback(TENV *pEnv) { } SPager *tdbEnvGetPager(TENV *pEnv, const char *fname) { - int hash; + u32 hash; SPager **ppPager; hash = tdbCstringHash(fname); @@ -107,7 +107,7 @@ SPager *tdbEnvGetPager(TENV *pEnv, const char *fname) { } void tdbEnvAddPager(TENV *pEnv, SPager *pPager) { - int hash; + u32 hash; SPager **ppPager; // rehash if neccessary @@ -130,7 +130,7 @@ void tdbEnvAddPager(TENV *pEnv, SPager *pPager) { } void tdbEnvRemovePager(TENV *pEnv, SPager *pPager) { - int hash; + u32 hash; SPager **ppPager; // remove from the list diff --git a/source/libs/tdb/src/inc/tdbInt.h b/source/libs/tdb/src/inc/tdbInt.h index 26f9247952..57e01f904c 100644 --- a/source/libs/tdb/src/inc/tdbInt.h +++ b/source/libs/tdb/src/inc/tdbInt.h @@ -16,8 +16,6 @@ #ifndef _TD_TDB_INTERNAL_H_ #define _TD_TDB_INTERNAL_H_ -#include "os.h" - #include "tdb.h" #ifdef __cplusplus diff --git a/source/libs/tdb/src/inc/tdbOs.h b/source/libs/tdb/src/inc/tdbOs.h index 5259cfb4d3..ae389708f4 100644 --- a/source/libs/tdb/src/inc/tdbOs.h +++ b/source/libs/tdb/src/inc/tdbOs.h @@ -24,6 +24,8 @@ extern "C" { #define TDB_FOR_TDENGINE #ifdef TDB_FOR_TDENGINE +#include "os.h" +#include "thash.h" // For memory ----------------- #define tdbOsMalloc taosMemoryMalloc diff --git a/source/libs/tdb/src/inc/tdbUtil.h b/source/libs/tdb/src/inc/tdbUtil.h index a4cb09ea94..6abddb5b22 100644 --- a/source/libs/tdb/src/inc/tdbUtil.h +++ b/source/libs/tdb/src/inc/tdbUtil.h @@ -101,10 +101,7 @@ static inline int tdbGetVarInt(const u8 *p, int *v) { return n; } -static inline int tdbCstringHash(const char *s) { - // TODO - return 0; -} +static inline u32 tdbCstringHash(const char *s) { return MurmurHash3_32(s, strlen(s)); } #ifdef __cplusplus } From 34d9d1b9df91e215a52c9cdbdd62df2a4cec8064 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Thu, 31 Mar 2022 02:25:29 +0000 Subject: [PATCH 13/68] more --- source/libs/tdb/src/db/tdbEnv.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/libs/tdb/src/db/tdbEnv.c b/source/libs/tdb/src/db/tdbEnv.c index a9e29d3f73..c78dd67146 100644 --- a/source/libs/tdb/src/db/tdbEnv.c +++ b/source/libs/tdb/src/db/tdbEnv.c @@ -81,10 +81,10 @@ int tdbBegin(TENV *pEnv) { int tdbCommit(TENV *pEnv) { SPager *pPager; - pPager = pEnv->pgrList; - while (pPager) { - tdbPagerCommit(pPager); - } + // pPager = pEnv->pgrList; + // while (pPager) { + // tdbPagerCommit(pPager); + // } return 0; } From 7f08a2b7c30201075736867dce14f221bb914207 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Thu, 31 Mar 2022 02:55:07 +0000 Subject: [PATCH 14/68] more TDB --- source/libs/tdb/src/db/tdbDb.c | 2 ++ source/libs/tdb/src/db/tdbEnv.c | 24 +++++++++++++++++++----- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/source/libs/tdb/src/db/tdbDb.c b/source/libs/tdb/src/db/tdbDb.c index 0de2a6433f..fe7b8c6d48 100644 --- a/source/libs/tdb/src/db/tdbDb.c +++ b/source/libs/tdb/src/db/tdbDb.c @@ -49,6 +49,8 @@ int tdbDbOpen(const char *fname, int keyLen, int valLen, FKeyComparator keyCmprF if (ret < 0) { return -1; } + + tdbEnvAddPager(pEnv, pPager); } ASSERT(pPager != NULL); diff --git a/source/libs/tdb/src/db/tdbEnv.c b/source/libs/tdb/src/db/tdbEnv.c index c78dd67146..06d37df653 100644 --- a/source/libs/tdb/src/db/tdbEnv.c +++ b/source/libs/tdb/src/db/tdbEnv.c @@ -74,17 +74,31 @@ int tdbEnvClose(TENV *pEnv) { } int tdbBegin(TENV *pEnv) { - ASSERT(0); + SPager *pPager; + int ret; + + for (pPager = pEnv->pgrList; pPager; pPager = pPager->pNext) { + ret = tdbPagerBegin(pPager); + if (ret < 0) { + ASSERT(0); + return -1; + } + } + return 0; } int tdbCommit(TENV *pEnv) { SPager *pPager; + int ret; - // pPager = pEnv->pgrList; - // while (pPager) { - // tdbPagerCommit(pPager); - // } + for (pPager = pEnv->pgrList; pPager; pPager = pPager->pNext) { + ret = tdbPagerCommit(pPager); + if (ret < 0) { + ASSERT(0); + return -1; + } + } return 0; } From 839912e4f57cd1927f8658c5608cda467263da16 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Thu, 31 Mar 2022 03:55:46 +0000 Subject: [PATCH 15/68] more TDB --- source/libs/tdb/src/db/tdbBtree.c | 132 +++++++++++++++--------------- 1 file changed, 64 insertions(+), 68 deletions(-) diff --git a/source/libs/tdb/src/db/tdbBtree.c b/source/libs/tdb/src/db/tdbBtree.c index f7e0d7181a..dae9f1d88d 100644 --- a/source/libs/tdb/src/db/tdbBtree.c +++ b/source/libs/tdb/src/db/tdbBtree.c @@ -34,10 +34,10 @@ 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)) -#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_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)) @@ -1274,91 +1274,87 @@ static int tdbBtcMoveUpward(SBTC *pBtc) { } static int tdbBtcMoveTo(SBTC *pBtc, const void *pKey, int kLen, int *pCRst) { - int ret; - SBTree *pBt; - SPager *pPager; + int ret; + SBTree *pBt; + SCell *pCell; + SPager *pPager; + SCellDecoder cd = {0}; pBt = pBtc->pBt; pPager = pBt->pPager; if (pBtc->iPage < 0) { - ASSERT(pBtc->iPage == -1); - ASSERT(pBtc->idx == -1); - - // Move from the root + // move from a clear cursor ret = tdbPagerFetchPage(pPager, pBt->root, &(pBtc->pPage), tdbBtreeInitPage, pBt); if (ret < 0) { + // TODO 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; } + pBtc->iPage = 0; + pBtc->idx = -1; + // for empty tree, just return with an invalid position + if (TDB_PAGE_TOTAL_CELLS(pBtc->pPage) == 0) return 0; + } else { + // move upward to a page that the search key is in the range + ASSERT(0); + } + + // search downward to the leaf + for (;;) { + int lidx, ridx, midx, c, nCells; + SPage *pPage; + + pPage = pBtc->pPage; + nCells = TDB_PAGE_TOTAL_CELLS(pPage); + lidx = 0; + ridx = nCells - 1; + + ASSERT(nCells > 0); + ASSERT(pBtc->idx == -1); + + // binary search for (;;) { - int lidx, ridx, midx, c, nCells; - SCell *pCell; - SPage *pPage; - SCellDecoder cd = {0}; + if (lidx > ridx) break; - pPage = pBtc->pPage; - nCells = TDB_PAGE_TOTAL_CELLS(pPage); - lidx = 0; - ridx = nCells - 1; + midx = (lidx + ridx) >> 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; - } + pCell = tdbPageGetCell(pPage, midx); + ret = tdbBtreeDecodeCell(pPage, pCell, &cd); + if (ret < 0) { + // TODO: handle error + ASSERT(0); + return -1; } - // Move downward or break - u8 leaf = TDB_BTREE_PAGE_IS_LEAF(pPage); - if (leaf) { - pBtc->idx = midx; - *pCRst = c; - break; + // Compare the key values + c = pBt->kcmpr(pKey, kLen, cd.pKey, cd.kLen); + if (c < 0) { + // pKey < cd.pKey + ridx = midx - 1; + } else if (c > 0) { + // pKey > cd.pKey + lidx = midx + 1; } else { - if (c <= 0) { - pBtc->idx = midx; - } else { - pBtc->idx = midx + 1; - } - tdbBtcMoveDownward(pBtc); + // pKey == cd.pKey + break; } } - } else { - // TODO: Move the cursor from a some position instead of a clear state - ASSERT(0); + // keep search downward or break + if (TDB_BTREE_PAGE_IS_LEAF(pPage)) { + pBtc->idx = midx; + *pCRst = c; + break; + } else { + if (c <= 0) { + pBtc->idx = midx; + } else { + pBtc->idx = midx + 1; + } + tdbBtcMoveDownward(pBtc); + } } return 0; From 59061a6fb562b1922559f78606337518fefe97e7 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Thu, 31 Mar 2022 06:22:29 +0000 Subject: [PATCH 16/68] refact more --- source/libs/tdb/src/db/tdbBtree.c | 47 ++++++++++++++++++++++++++----- 1 file changed, 40 insertions(+), 7 deletions(-) diff --git a/source/libs/tdb/src/db/tdbBtree.c b/source/libs/tdb/src/db/tdbBtree.c index dae9f1d88d..32a04c6272 100644 --- a/source/libs/tdb/src/db/tdbBtree.c +++ b/source/libs/tdb/src/db/tdbBtree.c @@ -1040,12 +1040,11 @@ int tdbBtcMoveToFirst(SBTC *pBtc) { // move upward for (;;) { - if (pBtc->iPage == 0) { + if (pBtc->iPage == iPage) { pBtc->idx = 0; break; } - if (pBtc->iPage < iPage) break; tdbBtcMoveUpward(pBtc); } } @@ -1106,15 +1105,15 @@ int tdbBtcMoveToLast(SBTC *pBtc) { // move upward for (;;) { - if (pBtc->iPage == 0) { + if (pBtc->iPage == iPage) { if (TDB_BTREE_PAGE_IS_LEAF(pBtc->pPage)) { pBtc->idx = TDB_PAGE_TOTAL_CELLS(pBtc->pPage) - 1; } else { pBtc->idx = TDB_PAGE_TOTAL_CELLS(pBtc->pPage); } + break; } - if (pBtc->iPage < iPage) break; tdbBtcMoveUpward(pBtc); } } @@ -1275,6 +1274,8 @@ static int tdbBtcMoveUpward(SBTC *pBtc) { static int tdbBtcMoveTo(SBTC *pBtc, const void *pKey, int kLen, int *pCRst) { int ret; + int nCells; + int c; SBTree *pBt; SCell *pCell; SPager *pPager; @@ -1297,13 +1298,45 @@ static int tdbBtcMoveTo(SBTC *pBtc, const void *pKey, int kLen, int *pCRst) { // for empty tree, just return with an invalid position if (TDB_PAGE_TOTAL_CELLS(pBtc->pPage) == 0) return 0; } else { - // move upward to a page that the search key is in the range - ASSERT(0); + SPage *pPage; + int idx; + int iPage = 0; + + // downward search + for (; iPage < pBtc->iPage; iPage++) { + pPage = pBtc->pgStack[iPage]; + idx = pBtc->idxStack[iPage]; + nCells = TDB_PAGE_TOTAL_CELLS(pPage); + + ASSERT(!TDB_BTREE_PAGE_IS_LEAF(pPage)); + + // check if key <= current position + if (idx < nCells) { + pCell = tdbPageGetCell(pPage, idx); + tdbBtreeDecodeCell(pPage, pCell, &cd); + c = pBt->kcmpr(pKey, kLen, cd.pKey, cd.kLen); + if (c > 0) break; + } + + // check if key > current - 1 position + if (idx > 0) { + pCell = tdbPageGetCell(pPage, idx - 1); + tdbBtreeDecodeCell(pPage, pCell, &cd); + c = pBt->kcmpr(pKey, kLen, cd.pKey, cd.kLen); + if (c <= 0) break; + } + } + + // move upward + for (;;) { + if (pBtc->iPage == iPage) break; + tdbBtcMoveUpward(pBtc); + } } // search downward to the leaf for (;;) { - int lidx, ridx, midx, c, nCells; + int lidx, ridx, midx; SPage *pPage; pPage = pBtc->pPage; From ba4b33e7c7ed98eeba709fb84bf8b2f15cc0cfd9 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Thu, 31 Mar 2022 07:26:51 +0000 Subject: [PATCH 17/68] more progress --- source/libs/tdb/src/db/tdbBtree.c | 49 ++++++++++++++++++++++--------- source/libs/tdb/src/db/tdbPager.c | 42 ++++++++++++++------------ source/libs/tdb/src/inc/tdbPage.h | 1 + source/libs/tdb/test/tdbTest.cpp | 3 +- 4 files changed, 62 insertions(+), 33 deletions(-) diff --git a/source/libs/tdb/src/db/tdbBtree.c b/source/libs/tdb/src/db/tdbBtree.c index 32a04c6272..81aa591808 100644 --- a/source/libs/tdb/src/db/tdbBtree.c +++ b/source/libs/tdb/src/db/tdbBtree.c @@ -383,17 +383,7 @@ static int tdbBtreeZeroPage(SPage *pPage, void *arg) { return 0; } -#ifndef TDB_BTREE_BALANCE -typedef struct { - SBTree *pBt; - SPage *pParent; - int idx; - i8 nOld; - SPage *pOldPages[3]; - i8 nNewPages; - SPage *pNewPages[5]; -} SBtreeBalanceHelper; - +// TDB_BTREE_BALANCE ===================== static int tdbBtreeBalanceDeeper(SBTree *pBt, SPage *pRoot, SPage **ppChild) { SPager *pPager; SPage *pChild; @@ -420,6 +410,13 @@ static int tdbBtreeBalanceDeeper(SBTree *pBt, SPage *pRoot, SPage **ppChild) { ((SIntHdr *)pChild->pData)->pgno = ((SIntHdr *)(pRoot->pData))->pgno; } + ret = tdbPagerWrite(pPager, pChild); + if (ret < 0) { + // TODO + ASSERT(0); + return 0; + } + // Copy the root page content to the child page tdbPageCopy(pRoot, pChild); @@ -497,6 +494,13 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx) { } if (i < nOlds - 1) { + ret = tdbPagerWrite(pBt->pPager, pOlds[i]); + if (ret < 0) { + // TODO + ASSERT(0); + return -1; + } + ((SPgno *)pDivCell[i])[0] = ((SIntHdr *)pOlds[i]->pData)->pgno; ((SIntHdr *)pOlds[i]->pData)->pgno = 0; tdbPageInsertCell(pOlds[i], TDB_PAGE_TOTAL_CELLS(pOlds[i]), pDivCell[i], szDivCell[i], 1); @@ -504,6 +508,14 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx) { } rPgno = ((SIntHdr *)pOlds[nOlds - 1]->pData)->pgno; } + + ret = tdbPagerWrite(pBt->pPager, pParent); + if (ret < 0) { + // TODO + ASSERT(0); + return -1; + } + // drop the cells on parent page for (int i = 0; i < nOlds; i++) { nCells = TDB_PAGE_TOTAL_CELLS(pParent); @@ -631,6 +643,13 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx) { if (ret < 0) { ASSERT(0); } + + ret = tdbPagerWrite(pBt->pPager, pNews[iNew]); + if (ret < 0) { + // TODO + ASSERT(0); + return -1; + } } } @@ -749,9 +768,10 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx) { static int tdbBtreeBalance(SBTC *pBtc) { int iPage; + int ret; + int nFree; SPage *pParent; SPage *pPage; - int ret; u8 flags; u8 leaf; u8 root; @@ -762,10 +782,11 @@ static int tdbBtreeBalance(SBTC *pBtc) { pPage = pBtc->pPage; leaf = TDB_BTREE_PAGE_IS_LEAF(pPage); root = TDB_BTREE_PAGE_IS_ROOT(pPage); + nFree = TDB_PAGE_FREE_SIZE(pPage); // when the page is not overflow and not too empty, the balance work // is finished. Just break out the balance loop. - if (pPage->nOverflow == 0 /* TODO: && pPage->nFree <= */) { + if (pPage->nOverflow == 0 && nFree < TDB_PAGE_USABLE_SIZE(pPage) * 2 / 3) { break; } @@ -800,7 +821,7 @@ static int tdbBtreeBalance(SBTC *pBtc) { return 0; } -#endif +// TDB_BTREE_BALANCE // TDB_BTREE_CELL ===================== static int tdbBtreeEncodePayload(SPage *pPage, SCell *pCell, int nHeader, const void *pKey, int kLen, const void *pVal, diff --git a/source/libs/tdb/src/db/tdbPager.c b/source/libs/tdb/src/db/tdbPager.c index 818b8a371a..a37309f032 100644 --- a/source/libs/tdb/src/db/tdbPager.c +++ b/source/libs/tdb/src/db/tdbPager.c @@ -117,14 +117,18 @@ int tdbPagerOpenDB(SPager *pPager, SPgno *ppgno, bool toCreate) { } int tdbPagerWrite(SPager *pPager, SPage *pPage) { - int ret; + int ret; + SPage **ppPage; + ASSERT(pPager->inTran); +#if 0 if (pPager->inTran == 0) { ret = tdbPagerBegin(pPager); if (ret < 0) { return -1; } } +#endif if (pPage->isDirty) return 0; @@ -132,11 +136,14 @@ int tdbPagerWrite(SPager *pPager, SPage *pPage) { pPage->isDirty = 1; // Add page to dirty list - // TODO: sort the list according to the page number - pPage->pDirtyNext = pPager->pDirty; - pPager->pDirty = pPage; + for (ppPage = &pPager->pDirty; (*ppPage) && TDB_PAGE_PGNO(*ppPage) < TDB_PAGE_PGNO(pPage); + ppPage = &((*ppPage)->pDirtyNext)) { + } + ASSERT(*ppPage == NULL || TDB_PAGE_PGNO(*ppPage) > TDB_PAGE_PGNO(pPage)); + pPage->pDirtyNext = *ppPage; + *ppPage = pPage; - // Write page to journal + // Write page to journal if neccessary if (TDB_PAGE_PGNO(pPage) <= pPager->dbOrigSize) { ret = tdbPagerWritePageToJournal(pPager, pPage); if (ret < 0) { @@ -170,30 +177,29 @@ int tdbPagerCommit(SPager *pPager) { SPage *pPage; int ret; - // Begin commit - { - // TODO: Sync the journal file (Here or when write ?) + // sync the journal file + ret = tdbOsFSync(pPager->jfd); + if (ret < 0) { + // TODO + ASSERT(0); + return 0; } - for (;;) { - pPage = pPager->pDirty; - - if (pPage == NULL) break; - + // loop to write the dirty pages to file + for (pPage = pPager->pDirty; pPage; pPage = pPage->pDirtyNext) { ret = tdbPagerWritePageToDB(pPager, pPage); if (ret < 0) { ASSERT(0); return -1; } - - pPager->pDirty = pPage->pDirtyNext; - pPage->pDirtyNext = NULL; - - // TODO: release the page } + // TODO: loop to release the dirty pages + + // sync the db file tdbOsFSync(pPager->fd); + // remote the journal file tdbOsClose(pPager->jfd); tdbOsRemove(pPager->jFileName); diff --git a/source/libs/tdb/src/inc/tdbPage.h b/source/libs/tdb/src/inc/tdbPage.h index 563fb53e98..77a1ee5f6e 100644 --- a/source/libs/tdb/src/inc/tdbPage.h +++ b/source/libs/tdb/src/inc/tdbPage.h @@ -100,6 +100,7 @@ struct SPage { // APIs #define TDB_PAGE_TOTAL_CELLS(pPage) ((pPage)->nOverflow + (pPage)->pPageMethods->getCellNum(pPage)) #define TDB_PAGE_USABLE_SIZE(pPage) ((u8 *)(pPage)->pPageFtr - (pPage)->pCellIdx) +#define TDB_PAGE_FREE_SIZE(pPage) (*(pPage)->pPageMethods->getFreeBytes)(pPage) #define TDB_PAGE_PGNO(pPage) ((pPage)->pgid.pgno) #define TDB_BYTES_CELL_TAKEN(pPage, pCell) ((*(pPage)->xCellSize)(pPage, pCell) + (pPage)->pPageMethods->szOffset) #define TDB_PAGE_OFFSET_SIZE(pPage) ((pPage)->pPageMethods->szOffset) diff --git a/source/libs/tdb/test/tdbTest.cpp b/source/libs/tdb/test/tdbTest.cpp index 2d19596ca6..33a82094dc 100644 --- a/source/libs/tdb/test/tdbTest.cpp +++ b/source/libs/tdb/test/tdbTest.cpp @@ -134,8 +134,9 @@ TEST(tdb_test, simple_test) { char val[64]; { // Insert some data - int i = 1; + tdbBegin(pEnv); + int i = 1; for (;;) { if (i > nData) break; From 71c8b91059211c053324707c04c3d5d9bbb66f0c Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Thu, 31 Mar 2022 07:52:35 +0000 Subject: [PATCH 18/68] more --- source/libs/tdb/src/db/tdbBtree.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/source/libs/tdb/src/db/tdbBtree.c b/source/libs/tdb/src/db/tdbBtree.c index 81aa591808..51cd5fbffc 100644 --- a/source/libs/tdb/src/db/tdbBtree.c +++ b/source/libs/tdb/src/db/tdbBtree.c @@ -312,7 +312,8 @@ static int tdbBtreeOpenImpl(SBTree *pBt) { return -1; } - // TODO: Unref the page + // TODO: here still has problem + tdbPagerReturnPage(pBt->pPager, pPage); ASSERT(pgno != 0); pBt->root = pgno; @@ -763,6 +764,15 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx) { } } + // TODO: here is not corrent for drop case + for (int i = 0; i < nNews; i++) { + if (i < nOlds) { + tdbPagerReturnPage(pBt->pPager, pOlds[i]); + } else { + tdbPagerReturnPage(pBt->pPager, pNews[i]); + } + } + return 0; } @@ -814,6 +824,8 @@ static int tdbBtreeBalance(SBTC *pBtc) { return -1; } + tdbPagerReturnPage(pBtc->pBt->pPager, pBtc->pPage); + pBtc->iPage--; pBtc->pPage = pBtc->pgStack[pBtc->iPage]; } From 0492362f3821e960ab90b1d57617942ce1427fe9 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Thu, 31 Mar 2022 08:04:38 +0000 Subject: [PATCH 19/68] more TDB --- source/libs/tdb/src/db/tdbPCache.c | 21 +++------------------ source/libs/tdb/src/db/tdbPager.c | 15 ++++++++++++++- source/libs/tdb/src/inc/tdbPCache.h | 12 ++++++++++++ 3 files changed, 29 insertions(+), 19 deletions(-) diff --git a/source/libs/tdb/src/db/tdbPCache.c b/source/libs/tdb/src/db/tdbPCache.c index 07c267a15c..d886cfd889 100644 --- a/source/libs/tdb/src/db/tdbPCache.c +++ b/source/libs/tdb/src/db/tdbPCache.c @@ -34,18 +34,6 @@ struct SPCache { }) #define PAGE_IS_PINNED(pPage) ((pPage)->pLruNext == NULL) -// For page ref -#define TDB_INIT_PAGE_REF(pPage) ((pPage)->nRef = 0) -#if 0 -#define TDB_REF_PAGE(pPage) (++(pPage)->nRef) -#define TDB_UNREF_PAGE(pPage) (--(pPage)->nRef) -#define TDB_GET_PAGE_REF(pPage) ((pPage)->nRef) -#else -#define TDB_REF_PAGE(pPage) atomic_add_fetch_32(&((pPage)->nRef), 1) -#define TDB_UNREF_PAGE(pPage) atomic_sub_fetch_32(&((pPage)->nRef), 1) -#define TDB_GET_PAGE_REF(pPage) atomic_load_32(&((pPage)->nRef)) -#endif - static int tdbPCacheOpenImpl(SPCache *pCache); static void tdbPCacheInitLock(SPCache *pCache); static void tdbPCacheClearLock(SPCache *pCache); @@ -107,12 +95,7 @@ void tdbPCacheRelease(SPCache *pCache, SPage *pPage) { ASSERT(nRef >= 0); if (nRef == 0) { - if (1 /*TODO: page still clean*/) { - tdbPCacheUnpinPage(pCache, pPage); - } else { - // TODO - ASSERT(0); - } + tdbPCacheUnpinPage(pCache, pPage); } } @@ -192,6 +175,8 @@ static void tdbPCacheUnpinPage(SPCache *pCache, SPage *pPage) { tdbPCacheLock(pCache); + ASSERT(!pPage->isDirty); + nRef = TDB_GET_PAGE_REF(pPage); ASSERT(nRef >= 0); if (nRef == 0) { diff --git a/source/libs/tdb/src/db/tdbPager.c b/source/libs/tdb/src/db/tdbPager.c index a37309f032..90496e1263 100644 --- a/source/libs/tdb/src/db/tdbPager.c +++ b/source/libs/tdb/src/db/tdbPager.c @@ -132,6 +132,9 @@ int tdbPagerWrite(SPager *pPager, SPage *pPage) { if (pPage->isDirty) return 0; + // ref page one more time so the page will not be release + TDB_REF_PAGE(pPage); + // Set page as dirty pPage->isDirty = 1; @@ -187,6 +190,7 @@ int tdbPagerCommit(SPager *pPager) { // loop to write the dirty pages to file for (pPage = pPager->pDirty; pPage; pPage = pPage->pDirtyNext) { + // TODO: update the page footer ret = tdbPagerWritePageToDB(pPager, pPage); if (ret < 0) { ASSERT(0); @@ -194,7 +198,15 @@ int tdbPagerCommit(SPager *pPager) { } } - // TODO: loop to release the dirty pages + // release the page + for (pPage = pPager->pDirty; pPage; pPage = pPage->pDirtyNext) { + pPager->pDirty = pPage->pDirtyNext; + pPage->pDirtyNext = NULL; + + pPage->isDirty = 0; + + tdbPCacheRelease(pPager->pCache, pPage); + } // sync the db file tdbOsFSync(pPager->fd); @@ -202,6 +214,7 @@ int tdbPagerCommit(SPager *pPager) { // remote the journal file tdbOsClose(pPager->jfd); tdbOsRemove(pPager->jFileName); + pPager->dbOrigSize = pPager->dbFileSize; return 0; } diff --git a/source/libs/tdb/src/inc/tdbPCache.h b/source/libs/tdb/src/inc/tdbPCache.h index c7fa155615..f71d34ab53 100644 --- a/source/libs/tdb/src/inc/tdbPCache.h +++ b/source/libs/tdb/src/inc/tdbPCache.h @@ -33,6 +33,18 @@ extern "C" { SPager *pPager; \ SPgid pgid; +// For page ref +#define TDB_INIT_PAGE_REF(pPage) ((pPage)->nRef = 0) +#if 0 +#define TDB_REF_PAGE(pPage) (++(pPage)->nRef) +#define TDB_UNREF_PAGE(pPage) (--(pPage)->nRef) +#define TDB_GET_PAGE_REF(pPage) ((pPage)->nRef) +#else +#define TDB_REF_PAGE(pPage) atomic_add_fetch_32(&((pPage)->nRef), 1) +#define TDB_UNREF_PAGE(pPage) atomic_sub_fetch_32(&((pPage)->nRef), 1) +#define TDB_GET_PAGE_REF(pPage) atomic_load_32(&((pPage)->nRef)) +#endif + int tdbPCacheOpen(int pageSize, int cacheSize, SPCache **ppCache); int tdbPCacheClose(SPCache *pCache); SPage *tdbPCacheFetch(SPCache *pCache, const SPgid *pPgid, bool alcNewPage); From 4e6ea0d2d269b3f8428c340316470cad90bd33d4 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Thu, 31 Mar 2022 08:23:17 +0000 Subject: [PATCH 20/68] new test --- source/libs/tdb/test/tdbTest.cpp | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/source/libs/tdb/test/tdbTest.cpp b/source/libs/tdb/test/tdbTest.cpp index 33a82094dc..4eb1cfde63 100644 --- a/source/libs/tdb/test/tdbTest.cpp +++ b/source/libs/tdb/test/tdbTest.cpp @@ -121,7 +121,7 @@ TEST(tdb_test, simple_test) { int nData = 1000000; // Open Env - ret = tdbEnvOpen("tdb", 4096, 256000, &pEnv); + ret = tdbEnvOpen("tdb", 4096, 100, &pEnv); GTEST_ASSERT_EQ(ret, 0); // Create a database @@ -134,21 +134,19 @@ TEST(tdb_test, simple_test) { char val[64]; { // Insert some data - tdbBegin(pEnv); + for (int i = 1; i <= nData;) { + tdbBegin(pEnv); - int i = 1; - for (;;) { - if (i > nData) break; + for (int k = 0; k < 10; k++) { + sprintf(key, "key%d", i); + sprintf(val, "value%d", i); + ret = tdbDbInsert(pDb, key, strlen(key), val, strlen(val)); + GTEST_ASSERT_EQ(ret, 0); + i++; + } - sprintf(key, "key%d", i); - sprintf(val, "value%d", i); - ret = tdbDbInsert(pDb, key, strlen(key), val, strlen(val)); - GTEST_ASSERT_EQ(ret, 0); - - i++; + tdbCommit(pEnv); } - - tdbCommit(pEnv); } { // Query the data From 59398ee2df2ad680df215936b431d278884acdb5 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Thu, 31 Mar 2022 09:41:46 +0000 Subject: [PATCH 21/68] commit loop work now --- source/libs/tdb/src/db/tdbPager.c | 22 ++++++++++++++++++---- source/libs/tdb/test/tdbTest.cpp | 4 ++-- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/source/libs/tdb/src/db/tdbPager.c b/source/libs/tdb/src/db/tdbPager.c index 90496e1263..a60b6c2afe 100644 --- a/source/libs/tdb/src/db/tdbPager.c +++ b/source/libs/tdb/src/db/tdbPager.c @@ -29,7 +29,7 @@ TDB_STATIC_ASSERT(sizeof(SFileHdr) == 128, "Size of file header is not correct") static int tdbPagerReadPage(SPager *pPager, SPage *pPage); static int tdbPagerAllocPage(SPager *pPager, SPgno *ppgno); -static int tdbPagerInitPage(SPager *pPager, SPage *pPage, int (*initPage)(SPage *, void *), void *arg); +static int tdbPagerInitPage(SPager *pPager, SPage *pPage, int (*initPage)(SPage *, void *), void *arg, u8 loadPage); static int tdbPagerWritePageToJournal(SPager *pPager, SPage *pPage); static int tdbPagerWritePageToDB(SPager *pPager, SPage *pPage); @@ -249,7 +249,7 @@ int tdbPagerFetchPage(SPager *pPager, SPgno pgno, SPage **ppPage, int (*initPage // Initialize the page if need if (!TDB_PAGE_INITIALIZED(pPage)) { - ret = tdbPagerInitPage(pPager, pPage, initPage, arg); + ret = tdbPagerInitPage(pPager, pPage, initPage, arg, 1); if (ret < 0) { return -1; } @@ -286,7 +286,7 @@ int tdbPagerNewPage(SPager *pPager, SPgno *ppgno, SPage **ppPage, int (*initPage ASSERT(!TDB_PAGE_INITIALIZED(pPage)); // Initialize the page if need - ret = tdbPagerInitPage(pPager, pPage, initPage, arg); + ret = tdbPagerInitPage(pPager, pPage, initPage, arg, 0); if (ret < 0) { return -1; } @@ -334,10 +334,11 @@ static int tdbPagerAllocPage(SPager *pPager, SPgno *ppgno) { return 0; } -static int tdbPagerInitPage(SPager *pPager, SPage *pPage, int (*initPage)(SPage *, void *), void *arg) { +static int tdbPagerInitPage(SPager *pPager, SPage *pPage, int (*initPage)(SPage *, void *), void *arg, u8 loadPage) { int ret; int lcode; int nLoops; + i64 nRead; lcode = TDB_TRY_LOCK_PAGE(pPage); if (lcode == P_LOCK_SUCC) { @@ -346,6 +347,19 @@ static int tdbPagerInitPage(SPager *pPager, SPage *pPage, int (*initPage)(SPage return 0; } + if (loadPage) { + nRead = tdbOsPRead(pPager->fd, pPage->pData, pPage->pageSize, ((i64)pPage->pageSize) * TDB_PAGE_PGNO(pPage)); + if (nRead < 0) { + // TODO + ASSERT(0); + return -1; + } else if (nRead < pPage->pageSize) { + // TODO + ASSERT(0); + return -1; + } + } + ret = (*initPage)(pPage, arg); if (ret < 0) { TDB_UNLOCK_PAGE(pPage); diff --git a/source/libs/tdb/test/tdbTest.cpp b/source/libs/tdb/test/tdbTest.cpp index 4eb1cfde63..f98eff7e5b 100644 --- a/source/libs/tdb/test/tdbTest.cpp +++ b/source/libs/tdb/test/tdbTest.cpp @@ -121,7 +121,7 @@ TEST(tdb_test, simple_test) { int nData = 1000000; // Open Env - ret = tdbEnvOpen("tdb", 4096, 100, &pEnv); + ret = tdbEnvOpen("tdb", 4096, 8192, &pEnv); GTEST_ASSERT_EQ(ret, 0); // Create a database @@ -137,7 +137,7 @@ TEST(tdb_test, simple_test) { for (int i = 1; i <= nData;) { tdbBegin(pEnv); - for (int k = 0; k < 10; k++) { + for (int k = 0; k < 2000; k++) { sprintf(key, "key%d", i); sprintf(val, "value%d", i); ret = tdbDbInsert(pDb, key, strlen(key), val, strlen(val)); From 1a71bbfbd3310685559d3d69e6247eb288c9dcb7 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Thu, 31 Mar 2022 09:42:23 +0000 Subject: [PATCH 22/68] refact --- source/libs/tdb/src/db/tdbPager.c | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/source/libs/tdb/src/db/tdbPager.c b/source/libs/tdb/src/db/tdbPager.c index a60b6c2afe..3b2e17798e 100644 --- a/source/libs/tdb/src/db/tdbPager.c +++ b/source/libs/tdb/src/db/tdbPager.c @@ -27,7 +27,6 @@ TDB_STATIC_ASSERT(sizeof(SFileHdr) == 128, "Size of file header is not correct") #define TDB_PAGE_INITIALIZED(pPage) ((pPage)->pPager != NULL) -static int tdbPagerReadPage(SPager *pPager, SPage *pPage); static int tdbPagerAllocPage(SPager *pPager, SPgno *ppgno); static int tdbPagerInitPage(SPager *pPager, SPage *pPage, int (*initPage)(SPage *, void *), void *arg, u8 loadPage); static int tdbPagerWritePageToJournal(SPager *pPager, SPage *pPage); @@ -219,21 +218,6 @@ int tdbPagerCommit(SPager *pPager) { return 0; } -static int tdbPagerReadPage(SPager *pPager, SPage *pPage) { - i64 offset; - int ret; - - ASSERT(memcmp(pPager->fid, pPage->pgid.fileid, TDB_FILE_ID_LEN) == 0); - - offset = (pPage->pgid.pgno - 1) * (i64)(pPager->pageSize); - ret = tdbOsPRead(pPager->fd, pPage->pData, pPager->pageSize, offset); - if (ret < 0) { - // TODO: handle error - return -1; - } - return 0; -} - int tdbPagerFetchPage(SPager *pPager, SPgno pgno, SPage **ppPage, int (*initPage)(SPage *, void *), void *arg) { SPage *pPage; SPgid pgid; From 5d750f26aad31d561e27713cb52e7fd140db95ad Mon Sep 17 00:00:00 2001 From: afwerar <1296468573@qq.com> Date: Thu, 31 Mar 2022 19:16:56 +0800 Subject: [PATCH 23/68] [TD-13756]: file close memory error. --- include/os/osMemory.h | 1 + source/os/src/osFile.c | 2 +- source/os/src/osMemory.c | 31 +++++++++++++++++++++++++++++-- 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/include/os/osMemory.h b/include/os/osMemory.h index 62ac82782c..34e2422167 100644 --- a/include/os/osMemory.h +++ b/include/os/osMemory.h @@ -32,6 +32,7 @@ extern "C" { void *taosMemoryMalloc(int32_t size); void *taosMemoryCalloc(int32_t num, int32_t size); void *taosMemoryRealloc(void *ptr, int32_t size); +void *taosMemoryStrDup(void *ptr); void taosMemoryFree(const void *ptr); int32_t taosMemorySize(void *ptr); diff --git a/source/os/src/osFile.c b/source/os/src/osFile.c index ed93708c07..1b73f96896 100644 --- a/source/os/src/osFile.c +++ b/source/os/src/osFile.c @@ -294,7 +294,7 @@ int64_t taosCloseFile(TdFilePtr *ppFile) { #if FILE_WITH_LOCK taosThreadRwlockWrlock(&((*ppFile)->rwlock)); #endif - if (ppFile == NULL || *ppFile == NULL || (*ppFile)->fd == -1) { + if (ppFile == NULL || *ppFile == NULL) { return 0; } if ((*ppFile)->fp != NULL) { diff --git a/source/os/src/osMemory.c b/source/os/src/osMemory.c index f4d4c74d1d..3545aabdca 100644 --- a/source/os/src/osMemory.c +++ b/source/os/src/osMemory.c @@ -23,15 +23,22 @@ #define TD_MEMORY_STACK_TRACE_DEPTH 10 +typedef struct TdMemoryInfo *TdMemoryInfoPtr; + typedef struct TdMemoryInfo { int32_t symbol; int32_t memorySize; void *stackTrace[TD_MEMORY_STACK_TRACE_DEPTH]; // gdb: disassemble /m 0xXXX -} *TdMemoryInfoPtr , TdMemoryInfo; + // TdMemoryInfoPtr pNext; + // TdMemoryInfoPtr pPrev; +} TdMemoryInfo; + +// static TdMemoryInfoPtr GlobalMemoryPtr = NULL; #if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32) - + #define tstrdup(str) _strdup(str) #else + #define tstrdup(str) strdup(str) #include @@ -129,6 +136,26 @@ void *taosMemoryRealloc(void *ptr, int32_t size) { #endif } +void *taosMemoryStrDup(void *ptr) { +#ifdef USE_TD_MEMORY + if (ptr == NULL) return NULL; + + TdMemoryInfoPtr pTdMemoryInfo = (TdMemoryInfoPtr)((char*)ptr - sizeof(TdMemoryInfo)); + assert(pTdMemoryInfo->symbol == TD_MEMORY_SYMBOL); + + void *tmp = tstrdup((const char *)pTdMemoryInfo); + if (tmp == NULL) return NULL; + + memcpy(tmp, pTdMemoryInfo, sizeof(TdMemoryInfo)); + taosBackTrace(((TdMemoryInfoPtr)tmp)->stackTrace,TD_MEMORY_STACK_TRACE_DEPTH); + + return (char*)tmp + sizeof(TdMemoryInfo); +#else + return tstrdup((const char *)ptr); +#endif +} + + void taosMemoryFree(const void *ptr) { if (ptr == NULL) return; From 3ac1708a25730f260203e962c458b967f260693b Mon Sep 17 00:00:00 2001 From: afwerar <1296468573@qq.com> Date: Thu, 31 Mar 2022 19:32:43 +0800 Subject: [PATCH 24/68] [TD-13756]: file close memory error. --- source/util/src/tlog.c | 71 +++++++++++++++++++----------------------- 1 file changed, 32 insertions(+), 39 deletions(-) diff --git a/source/util/src/tlog.c b/source/util/src/tlog.c index ef15f44f8f..c0530d6d7f 100644 --- a/source/util/src/tlog.c +++ b/source/util/src/tlog.c @@ -38,7 +38,7 @@ #define LOG_BUF_MUTEX(x) ((x)->buffMutex) typedef struct { - char *buffer; + char buffer[LOG_DEFAULT_BUF_SIZE]; int32_t buffStart; int32_t buffEnd; int32_t buffSize; @@ -58,7 +58,7 @@ typedef struct { int32_t openInProgress; pid_t pid; char logName[LOG_FILE_NAME_LEN]; - SLogBuff *logHandle; + SLogBuff logHandle; TdThreadMutex logMutex; } SLogObj; @@ -101,15 +101,16 @@ int64_t dbgWSize = 0; static void *taosAsyncOutputLog(void *param); static int32_t taosPushLogBuffer(SLogBuff *tLogBuff, const char *msg, int32_t msgLen); -static SLogBuff *taosLogBuffNew(int32_t bufSize); +static SLogBuff *taosLogBuffNew(SLogBuff *tLogBuff); static void taosCloseLogByFd(TdFilePtr pFile); static int32_t taosOpenLogFile(char *fn, int32_t maxLines, int32_t maxFileNum); +static void taosCloseLogFile(void); static int32_t taosCompressFile(char *srcFileName, char *destFileName); static int32_t taosStartLog() { TdThreadAttr threadAttr; taosThreadAttrInit(&threadAttr); - if (taosThreadCreate(&(tsLogObj.logHandle->asyncThread), &threadAttr, taosAsyncOutputLog, tsLogObj.logHandle) != 0) { + if (taosThreadCreate(&(tsLogObj.logHandle.asyncThread), &threadAttr, taosAsyncOutputLog, &tsLogObj.logHandle) != 0) { return -1; } taosThreadAttrDestroy(&threadAttr); @@ -123,23 +124,21 @@ int32_t taosInitLog(const char *logName, int32_t maxFiles) { char fullName[PATH_MAX] = {0}; snprintf(fullName, PATH_MAX, "%s" TD_DIRSEP "%s", tsLogDir, logName); - tsLogObj.logHandle = taosLogBuffNew(LOG_DEFAULT_BUF_SIZE); - if (tsLogObj.logHandle == NULL) return -1; + taosLogBuffNew(&tsLogObj.logHandle); if (taosOpenLogFile(fullName, tsNumOfLogLines, maxFiles) < 0) return -1; + atexit(taosCloseLogFile); if (taosStartLog() < 0) return -1; return 0; } static void taosStopLog() { - if (tsLogObj.logHandle) { - tsLogObj.logHandle->stop = 1; - } + tsLogObj.logHandle.stop = 1; } void taosCloseLog() { taosStopLog(); - if (taosCheckPthreadValid(tsLogObj.logHandle->asyncThread)) { - taosThreadJoin(tsLogObj.logHandle->asyncThread, NULL); + if (taosCheckPthreadValid(tsLogObj.logHandle.asyncThread)) { + taosThreadJoin(tsLogObj.logHandle.asyncThread, NULL); } tsLogInited = 0; // In case that other threads still use log resources causing invalid write in valgrind @@ -210,8 +209,8 @@ static void *taosThreadToOpenNewFile(void *param) { taosLockLogFile(pFile); (void)taosLSeekFile(pFile, 0, SEEK_SET); - TdFilePtr pOldFile = tsLogObj.logHandle->pFile; - tsLogObj.logHandle->pFile = pFile; + TdFilePtr pOldFile = tsLogObj.logHandle.pFile; + tsLogObj.logHandle.pFile = pFile; tsLogObj.lines = 0; tsLogObj.openInProgress = 0; taosCloseLogByFd(pOldFile); @@ -347,35 +346,39 @@ static int32_t taosOpenLogFile(char *fn, int32_t maxLines, int32_t maxFileNum) { taosThreadMutexInit(&tsLogObj.logMutex, NULL); taosUmaskFile(0); - tsLogObj.logHandle->pFile = taosOpenFile(fileName, TD_FILE_CTEATE | TD_FILE_WRITE); + tsLogObj.logHandle.pFile = taosOpenFile(fileName, TD_FILE_CTEATE | TD_FILE_WRITE); - if (tsLogObj.logHandle->pFile == NULL) { + if (tsLogObj.logHandle.pFile == NULL) { printf("\nfailed to open log file:%s, reason:%s\n", fileName, strerror(errno)); return -1; } - taosLockLogFile(tsLogObj.logHandle->pFile); + taosLockLogFile(tsLogObj.logHandle.pFile); // only an estimate for number of lines int64_t filesize = 0; - if (taosFStatFile(tsLogObj.logHandle->pFile, &filesize, NULL) < 0) { + if (taosFStatFile(tsLogObj.logHandle.pFile, &filesize, NULL) < 0) { printf("\nfailed to fstat log file:%s, reason:%s\n", fileName, strerror(errno)); return -1; } size = (int32_t)filesize; tsLogObj.lines = size / 60; - taosLSeekFile(tsLogObj.logHandle->pFile, 0, SEEK_END); + taosLSeekFile(tsLogObj.logHandle.pFile, 0, SEEK_END); sprintf(name, "==================================================\n"); - taosWriteFile(tsLogObj.logHandle->pFile, name, (uint32_t)strlen(name)); + taosWriteFile(tsLogObj.logHandle.pFile, name, (uint32_t)strlen(name)); sprintf(name, " new log file \n"); - taosWriteFile(tsLogObj.logHandle->pFile, name, (uint32_t)strlen(name)); + taosWriteFile(tsLogObj.logHandle.pFile, name, (uint32_t)strlen(name)); sprintf(name, "==================================================\n"); - taosWriteFile(tsLogObj.logHandle->pFile, name, (uint32_t)strlen(name)); + taosWriteFile(tsLogObj.logHandle.pFile, name, (uint32_t)strlen(name)); return 0; } +static void taosCloseLogFile(void) { + taosCloseFile(&tsLogObj.logHandle.pFile); +} + static void taosUpdateLogNums(ELogLevel level) { switch (level) { case DEBUG_ERROR: @@ -409,12 +412,12 @@ static inline int32_t taosBuildLogHead(char *buffer, const char *flags) { } static inline void taosPrintLogImp(ELogLevel level, int32_t dflag, const char *buffer, int32_t len) { - if ((dflag & DEBUG_FILE) && tsLogObj.logHandle && tsLogObj.logHandle->pFile != NULL) { + if ((dflag & DEBUG_FILE) && tsLogObj.logHandle.pFile != NULL) { taosUpdateLogNums(level); if (tsAsyncLog) { - taosPushLogBuffer(tsLogObj.logHandle, buffer, len); + taosPushLogBuffer(&tsLogObj.logHandle, buffer, len); } else { - taosWriteFile(tsLogObj.logHandle->pFile, buffer, len); + taosWriteFile(tsLogObj.logHandle.pFile, buffer, len); } if (tsLogObj.maxLines > 0) { @@ -486,7 +489,7 @@ void taosDumpData(unsigned char *msg, int32_t len) { pos += 3; if (c >= 16) { temp[pos++] = '\n'; - taosWriteFile(tsLogObj.logHandle->pFile, temp, (uint32_t)pos); + taosWriteFile(tsLogObj.logHandle.pFile, temp, (uint32_t)pos); c = 0; pos = 0; } @@ -494,7 +497,7 @@ void taosDumpData(unsigned char *msg, int32_t len) { temp[pos++] = '\n'; - taosWriteFile(tsLogObj.logHandle->pFile, temp, (uint32_t)pos); + taosWriteFile(tsLogObj.logHandle.pFile, temp, (uint32_t)pos); } static void taosCloseLogByFd(TdFilePtr pFile) { @@ -504,18 +507,10 @@ static void taosCloseLogByFd(TdFilePtr pFile) { } } -static SLogBuff *taosLogBuffNew(int32_t bufSize) { - SLogBuff *tLogBuff = NULL; - - tLogBuff = taosMemoryCalloc(1, sizeof(SLogBuff)); - if (tLogBuff == NULL) return NULL; - - LOG_BUF_BUFFER(tLogBuff) = taosMemoryMalloc(bufSize); - if (LOG_BUF_BUFFER(tLogBuff) == NULL) goto _err; - +static SLogBuff *taosLogBuffNew(SLogBuff *tLogBuff) { LOG_BUF_START(tLogBuff) = LOG_BUF_END(tLogBuff) = 0; - LOG_BUF_SIZE(tLogBuff) = bufSize; - tLogBuff->minBuffSize = bufSize / 10; + LOG_BUF_SIZE(tLogBuff) = LOG_DEFAULT_BUF_SIZE; + tLogBuff->minBuffSize = LOG_DEFAULT_BUF_SIZE / 10; tLogBuff->stop = 0; if (taosThreadMutexInit(&LOG_BUF_MUTEX(tLogBuff), NULL) < 0) goto _err; @@ -524,8 +519,6 @@ static SLogBuff *taosLogBuffNew(int32_t bufSize) { return tLogBuff; _err: - taosMemoryFreeClear(LOG_BUF_BUFFER(tLogBuff)); - taosMemoryFreeClear(tLogBuff); return NULL; } From e916f83fd7dfcd689f53c035def7fc57d1fee4d7 Mon Sep 17 00:00:00 2001 From: Liu Jicong Date: Fri, 1 Apr 2022 09:57:55 +0800 Subject: [PATCH 25/68] temp --- source/client/src/tmq.c | 21 ++++++++++++++------- source/dnode/mnode/impl/inc/mndDef.h | 4 ++-- source/dnode/mnode/impl/src/mndSubscribe.c | 22 +++++++++++++--------- source/dnode/vnode/src/tq/tq.c | 15 +++++++-------- tests/script/tsim/tmq/basic1.sim | 2 +- 5 files changed, 37 insertions(+), 27 deletions(-) diff --git a/source/client/src/tmq.c b/source/client/src/tmq.c index 5d1e95be7c..3e4b25c9e7 100644 --- a/source/client/src/tmq.c +++ b/source/client/src/tmq.c @@ -882,11 +882,13 @@ int32_t tmqPollCb(void* param, const SDataBuf* pMsg, int32_t code) { // TODO: alloc mem /*pRsp->*/ /*printf("rsp commit off:%ld rsp off:%ld has data:%d\n", pRsp->committedOffset, pRsp->rspOffset, pRsp->numOfTopics);*/ +#if 0 if (pRsp->msg.numOfTopics == 0) { /*printf("no data\n");*/ taosFreeQitem(pRsp); goto WRITE_QUEUE_FAIL; } +#endif tscError("tmq recv poll: vg %d, req offset %ld, rsp offset %ld", pParam->pVg->vgId, pRsp->msg.reqOffset, pRsp->msg.rspOffset); @@ -938,7 +940,7 @@ bool tmqUpdateEp(tmq_t* tmq, int32_t epoch, SMqCMGetSubEpRsp* pRsp) { for (int32_t k = 0; k < vgNumCur; k++) { SMqClientVg* pVgCur = taosArrayGet(pTopicCur->vgs, k); sprintf(vgKey, "%s:%d", topic.topicName, pVgCur->vgId); - /*printf("epoch %d vg %d build %s\n", epoch, pVgCur->vgId, vgKey);*/ + printf("epoch %d vg %d build %s\n", epoch, pVgCur->vgId, vgKey); taosHashPut(pHash, vgKey, strlen(vgKey), &pVgCur->currentOffset, sizeof(int64_t)); } break; @@ -952,12 +954,12 @@ bool tmqUpdateEp(tmq_t* tmq, int32_t epoch, SMqCMGetSubEpRsp* pRsp) { sprintf(vgKey, "%s:%d", topic.topicName, pVgEp->vgId); int64_t* pOffset = taosHashGet(pHash, vgKey, strlen(vgKey)); int64_t offset = pVgEp->offset; - /*printf("epoch %d vg %d offset og to %ld\n", epoch, pVgEp->vgId, offset);*/ + printf("epoch %d vg %d offset og to %ld\n", epoch, pVgEp->vgId, offset); if (pOffset != NULL) { offset = *pOffset; - /*printf("epoch %d vg %d found %s\n", epoch, pVgEp->vgId, vgKey);*/ + printf("epoch %d vg %d found %s\n", epoch, pVgEp->vgId, vgKey); } - /*printf("epoch %d vg %d offset set to %ld\n", epoch, pVgEp->vgId, offset);*/ + printf("epoch %d vg %d offset set to %ld\n", epoch, pVgEp->vgId, offset); SMqClientVg clientVg = { .pollCnt = 0, .currentOffset = offset, @@ -1260,13 +1262,13 @@ int32_t tmqPollImpl(tmq_t* tmq, int64_t blockingTime) { } // return -int32_t tmqHandleRes(tmq_t* tmq, SMqRspHead* rspHead, bool* pReset) { +int32_t tmqHandleNoPollRsp(tmq_t* tmq, SMqRspHead* rspHead, bool* pReset) { if (rspHead->mqMsgType == TMQ_MSG_TYPE__EP_RSP) { /*printf("ep %d %d\n", rspMsg->head.epoch, tmq->epoch);*/ if (rspHead->epoch > atomic_load_32(&tmq->epoch)) { SMqCMGetSubEpRsp* rspMsg = (SMqCMGetSubEpRsp*)rspHead; tmqUpdateEp(tmq, rspHead->epoch, rspMsg); - tmqClearUnhandleMsg(tmq); + /*tmqClearUnhandleMsg(tmq);*/ *pReset = true; } else { *pReset = false; @@ -1297,6 +1299,11 @@ tmq_message_t* tmqHandleAllRsp(tmq_t* tmq, int64_t blockingTime, bool pollIfRese /*printf("vg %d offset %ld up to %ld\n", pVg->vgId, pVg->currentOffset, rspMsg->msg.rspOffset);*/ pVg->currentOffset = rspMsg->msg.rspOffset; atomic_store_32(&pVg->vgStatus, TMQ_VG_STATUS__IDLE); + if (rspMsg->msg.numOfTopics == 0) { + taosFreeQitem(rspMsg); + rspHead = NULL; + continue; + } return rspMsg; } else { /*printf("epoch mismatch\n");*/ @@ -1305,7 +1312,7 @@ tmq_message_t* tmqHandleAllRsp(tmq_t* tmq, int64_t blockingTime, bool pollIfRese } else { /*printf("handle ep rsp %d\n", rspMsg->head.mqMsgType);*/ bool reset = false; - tmqHandleRes(tmq, rspHead, &reset); + tmqHandleNoPollRsp(tmq, rspHead, &reset); taosFreeQitem(rspHead); if (pollIfReset && reset) { printf("reset and repoll\n"); diff --git a/source/dnode/mnode/impl/inc/mndDef.h b/source/dnode/mnode/impl/inc/mndDef.h index 7891c690e3..f418ec2290 100644 --- a/source/dnode/mnode/impl/inc/mndDef.h +++ b/source/dnode/mnode/impl/inc/mndDef.h @@ -620,13 +620,13 @@ static FORCE_INLINE void* tDecodeSubscribeObj(void* buf, SMqSubscribeObj* pSub) static FORCE_INLINE void tDeleteSMqSubscribeObj(SMqSubscribeObj* pSub) { if (pSub->consumers) { - taosArrayDestroyEx(pSub->consumers, (void (*)(void*))tDeleteSMqSubConsumer); + //taosArrayDestroyEx(pSub->consumers, (void (*)(void*))tDeleteSMqSubConsumer); // taosArrayDestroy(pSub->consumers); pSub->consumers = NULL; } if (pSub->unassignedVg) { - taosArrayDestroyEx(pSub->unassignedVg, (void (*)(void*))tDeleteSMqConsumerEp); + //taosArrayDestroyEx(pSub->unassignedVg, (void (*)(void*))tDeleteSMqConsumerEp); // taosArrayDestroy(pSub->unassignedVg); pSub->unassignedVg = NULL; } diff --git a/source/dnode/mnode/impl/src/mndSubscribe.c b/source/dnode/mnode/impl/src/mndSubscribe.c index 806415ccd9..195afa3848 100644 --- a/source/dnode/mnode/impl/src/mndSubscribe.c +++ b/source/dnode/mnode/impl/src/mndSubscribe.c @@ -237,7 +237,8 @@ static int32_t mndProcessGetSubEpReq(SNodeMsg *pMsg) { for (int32_t j = 0; j < csz; j++) { SMqSubConsumer *pSubConsumer = taosArrayGet(pSub->consumers, j); if (consumerId == pSubConsumer->consumerId) { - int32_t vgsz = taosArrayGetSize(pSubConsumer->vgInfo); + int32_t vgsz = taosArrayGetSize(pSubConsumer->vgInfo); + mInfo("topic %s has %d vg", topicName, pConsumer->epoch); SMqSubTopicEp topicEp; strcpy(topicEp.topic, topicName); topicEp.vgs = taosArrayInit(vgsz, sizeof(SMqSubVgEp)); @@ -419,7 +420,6 @@ static int32_t mndProcessDoRebalanceMsg(SNodeMsg *pMsg) { int32_t vgNum = pSub->vgNum; int32_t vgEachConsumer = vgNum / consumerNum; int32_t imbalanceVg = vgNum % consumerNum; - int32_t imbalanceSolved = 0; // iterate all consumers, set unassignedVgStash for (int32_t i = 0; i < consumerNum; i++) { @@ -446,19 +446,24 @@ static int32_t mndProcessDoRebalanceMsg(SNodeMsg *pMsg) { if (vgThisConsumerAfterRb != vgThisConsumerBeforeRb || (vgThisConsumerAfterRb != 0 && status != MQ_CONSUMER_STATUS__ACTIVE) || (vgThisConsumerAfterRb == 0 && status != MQ_CONSUMER_STATUS__LOST)) { + SMqConsumerObj* pNewRebConsumer = taosMemoryMalloc(sizeof(SMqConsumerObj)); + ASSERT(pNewRebConsumer); + memcpy(pNewRebConsumer, pRebConsumer, sizeof(SMqConsumerObj)); + pNewRebConsumer->currentTopics = taosArrayDup(pRebConsumer->currentTopics); + pNewRebConsumer->recentRemovedTopics = taosArrayDup(pRebConsumer->recentRemovedTopics); if (vgThisConsumerAfterRb != vgThisConsumerBeforeRb) { - pRebConsumer->epoch++; + pNewRebConsumer->epoch++; } if (vgThisConsumerAfterRb != 0) { - atomic_store_32(&pRebConsumer->status, MQ_CONSUMER_STATUS__ACTIVE); + atomic_store_32(&pNewRebConsumer->status, MQ_CONSUMER_STATUS__ACTIVE); } else { - atomic_store_32(&pRebConsumer->status, MQ_CONSUMER_STATUS__IDLE); + atomic_store_32(&pNewRebConsumer->status, MQ_CONSUMER_STATUS__IDLE); } - mInfo("mq consumer:%" PRId64 ", status change from %d to %d", pRebConsumer->consumerId, status, - pRebConsumer->status); + mInfo("mq consumer:%" PRId64 ", status change from %d to %d", pNewRebConsumer->consumerId, status, + pNewRebConsumer->status); - SSdbRaw *pConsumerRaw = mndConsumerActionEncode(pRebConsumer); + SSdbRaw *pConsumerRaw = mndConsumerActionEncode(pNewRebConsumer); sdbSetRawStatus(pConsumerRaw, SDB_STATUS_READY); mndTransAppendRedolog(pTrans, pConsumerRaw); } @@ -469,7 +474,6 @@ static int32_t mndProcessDoRebalanceMsg(SNodeMsg *pMsg) { if (taosArrayGetSize(pSub->unassignedVg) != 0) { for (int32_t i = 0; i < consumerNum; i++) { SMqSubConsumer *pSubConsumer = taosArrayGet(pSub->consumers, i); - int32_t vgThisConsumerBeforeRb = taosArrayGetSize(pSubConsumer->vgInfo); int32_t vgThisConsumerAfterRb; if (i < imbalanceVg) vgThisConsumerAfterRb = vgEachConsumer + 1; diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c index 82300f82cb..438a584842 100644 --- a/source/dnode/vnode/src/tq/tq.c +++ b/source/dnode/vnode/src/tq/tq.c @@ -264,7 +264,7 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) { fetchOffset = pReq->currentOffset + 1; } - /*printf("tmq poll vg %d req %ld %ld\n", pTq->pVnode->vgId, pReq->currentOffset, fetchOffset);*/ + printf("tmq poll vg %d req %ld %ld\n", pTq->pVnode->vgId, pReq->currentOffset, fetchOffset); SMqPollRsp rsp = { /*.consumerId = consumerId,*/ @@ -299,8 +299,8 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) { // response to user break; } - /*printf("vg %d offset %ld msgType %d from epoch %d\n", pTq->pVnode->vgId, fetchOffset, pHead->msgType, - * pReq->epoch);*/ + printf("vg %d offset %ld msgType %d from epoch %d\n", pTq->pVnode->vgId, fetchOffset, pHead->msgType, + pReq->epoch); /*int8_t pos = fetchOffset % TQ_BUFFER_SIZE;*/ /*pHead = pTopic->pReadhandle->pHead;*/ if (pHead->msgType == TDMT_VND_SUBMIT) { @@ -353,9 +353,7 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) { pMsg->pCont = buf; pMsg->contLen = tlen; pMsg->code = 0; - /*printf("vg %d offset %ld msgType %d from epoch %d actual rsp\n", pTq->pVnode->vgId, fetchOffset, - * pHead->msgType,*/ - /*pReq->epoch);*/ + printf("vg %d offset %ld msgType %d from epoch %d actual rsp\n", pTq->pVnode->vgId, fetchOffset, pHead->msgType, pReq->epoch); tmsgSendRsp(pMsg); taosMemoryFree(pHead); return 0; @@ -377,6 +375,7 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) { } ((SMqRspHead*)buf)->mqMsgType = TMQ_MSG_TYPE__POLL_RSP; ((SMqRspHead*)buf)->epoch = pReq->epoch; + rsp.rspOffset = fetchOffset - 1; void* abuf = POINTER_SHIFT(buf, sizeof(SMqRspHead)); tEncodeSMqPollRsp(&abuf, &rsp); @@ -385,7 +384,7 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) { pMsg->contLen = tlen; pMsg->code = 0; tmsgSendRsp(pMsg); - /*printf("vg %d offset %ld from epoch %d not rsp\n", pTq->pVnode->vgId, fetchOffset, pReq->epoch);*/ + printf("vg %d offset %ld from epoch %d not rsp\n", pTq->pVnode->vgId, fetchOffset, pReq->epoch); /*}*/ return 0; @@ -452,7 +451,7 @@ int32_t tqProcessSetConnReq(STQ* pTq, char* msg) { pTopic->buffer.output[i].task = qCreateStreamExecTaskInfo(req.qmsg, &handle); ASSERT(pTopic->buffer.output[i].task); } - printf("set topic %s to consumer %ld\n", pTopic->topicName, req.consumerId); + printf("set topic %s to consumer %ld on vg %d\n", pTopic->topicName, req.consumerId, pTq->pVnode->vgId); taosArrayPush(pConsumer->topics, pTopic); tqHandleMovePut(pTq->tqMeta, req.consumerId, pConsumer); tqHandleCommit(pTq->tqMeta, req.consumerId); diff --git a/tests/script/tsim/tmq/basic1.sim b/tests/script/tsim/tmq/basic1.sim index cfcb1ac992..afd3f0f9b0 100644 --- a/tests/script/tsim/tmq/basic1.sim +++ b/tests/script/tsim/tmq/basic1.sim @@ -35,7 +35,7 @@ sql connect $dbNamme = d0 print =============== create database , vgroup 1 -sql create database $dbNamme vgroups 1 +sql create database $dbNamme vgroups 10 sql show databases print $data00 $data01 $data02 if $rows != 2 then From 6b0b988f46907fe1e4aabfac9981172c44d5cd50 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Fri, 1 Apr 2022 02:38:50 +0000 Subject: [PATCH 26/68] fix a bug --- source/libs/tdb/src/db/tdbPager.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/libs/tdb/src/db/tdbPager.c b/source/libs/tdb/src/db/tdbPager.c index 3b2e17798e..c570e47c0e 100644 --- a/source/libs/tdb/src/db/tdbPager.c +++ b/source/libs/tdb/src/db/tdbPager.c @@ -137,7 +137,7 @@ int tdbPagerWrite(SPager *pPager, SPage *pPage) { // Set page as dirty pPage->isDirty = 1; - // Add page to dirty list + // Add page to dirty list(TODO: NOT use O(n^2) algorithm) for (ppPage = &pPager->pDirty; (*ppPage) && TDB_PAGE_PGNO(*ppPage) < TDB_PAGE_PGNO(pPage); ppPage = &((*ppPage)->pDirtyNext)) { } @@ -198,7 +198,7 @@ int tdbPagerCommit(SPager *pPager) { } // release the page - for (pPage = pPager->pDirty; pPage; pPage = pPage->pDirtyNext) { + for (pPage = pPager->pDirty; pPage; pPage = pPager->pDirty) { pPager->pDirty = pPage->pDirtyNext; pPage->pDirtyNext = NULL; From 0e7a420e83958ff158a66a7cc8262ede2d013755 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Fri, 1 Apr 2022 03:35:43 +0000 Subject: [PATCH 27/68] fix another bug --- source/libs/tdb/src/db/tdbBtree.c | 14 +++++++------- source/libs/tdb/src/db/tdbPager.c | 1 + 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/source/libs/tdb/src/db/tdbBtree.c b/source/libs/tdb/src/db/tdbBtree.c index 51cd5fbffc..740e665cd2 100644 --- a/source/libs/tdb/src/db/tdbBtree.c +++ b/source/libs/tdb/src/db/tdbBtree.c @@ -482,6 +482,13 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx) { ASSERT(0); return -1; } + + ret = tdbPagerWrite(pBt->pPager, pOlds[i]); + if (ret < 0) { + // TODO + ASSERT(0); + return -1; + } } // copy the parent key out if child pages are not leaf page childNotLeaf = !TDB_BTREE_PAGE_IS_LEAF(pOlds[0]); @@ -495,13 +502,6 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx) { } if (i < nOlds - 1) { - ret = tdbPagerWrite(pBt->pPager, pOlds[i]); - if (ret < 0) { - // TODO - ASSERT(0); - return -1; - } - ((SPgno *)pDivCell[i])[0] = ((SIntHdr *)pOlds[i]->pData)->pgno; ((SIntHdr *)pOlds[i]->pData)->pgno = 0; tdbPageInsertCell(pOlds[i], TDB_PAGE_TOTAL_CELLS(pOlds[i]), pDivCell[i], szDivCell[i], 1); diff --git a/source/libs/tdb/src/db/tdbPager.c b/source/libs/tdb/src/db/tdbPager.c index c570e47c0e..2bc40a6aad 100644 --- a/source/libs/tdb/src/db/tdbPager.c +++ b/source/libs/tdb/src/db/tdbPager.c @@ -214,6 +214,7 @@ int tdbPagerCommit(SPager *pPager) { tdbOsClose(pPager->jfd); tdbOsRemove(pPager->jFileName); pPager->dbOrigSize = pPager->dbFileSize; + pPager->inTran = 0; return 0; } From 6d4c848d88a0bfe7d1167a530089a563b3eac572 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Fri, 1 Apr 2022 01:04:14 -0400 Subject: [PATCH 28/68] sma is enabled for all columns by default --- source/libs/parser/inc/parInsertData.h | 2 -- source/libs/parser/src/parInsert.c | 7 ------- source/libs/parser/src/parTranslater.c | 2 +- 3 files changed, 1 insertion(+), 10 deletions(-) diff --git a/source/libs/parser/inc/parInsertData.h b/source/libs/parser/inc/parInsertData.h index a38d64c58c..dbf7d379ec 100644 --- a/source/libs/parser/inc/parInsertData.h +++ b/source/libs/parser/inc/parInsertData.h @@ -78,8 +78,6 @@ typedef struct STableDataBlocks { char *pData; bool cloned; STagData tagData; - char tableName[TSDB_TABLE_NAME_LEN]; - char dbFName[TSDB_DB_FNAME_LEN]; SParsedDataColInfo boundColumnInfo; SRowBuilder rowBuilder; diff --git a/source/libs/parser/src/parInsert.c b/source/libs/parser/src/parInsert.c index e94dfd9e0a..11b552fb94 100644 --- a/source/libs/parser/src/parInsert.c +++ b/source/libs/parser/src/parInsert.c @@ -52,8 +52,6 @@ typedef struct SInsertParseContext { SParseContext* pComCxt; // input char *pSql; // input SMsgBuf msg; // input - char dbFName[TSDB_DB_FNAME_LEN]; - char tableName[TSDB_TABLE_NAME_LEN]; STableMeta* pTableMeta; // each table SParsedDataColInfo tags; // each table SKVRowBuilder tagsBuilder; // each table @@ -231,9 +229,6 @@ static int32_t getTableMeta(SInsertParseContext* pCxt, SToken* pTname) { SVgroupInfo vg; CHECK_CODE(catalogGetTableHashVgroup(pBasicCtx->pCatalog, pBasicCtx->pTransporter, &pBasicCtx->mgmtEpSet, &name, &vg)); CHECK_CODE(taosHashPut(pCxt->pVgroupsHashObj, (const char*)&vg.vgId, sizeof(vg.vgId), (char*)&vg, sizeof(vg))); - pCxt->pTableMeta->vgId = vg.vgId; // todo remove - strcpy(pCxt->tableName, name.tname); - tNameGetFullDbName(&name, pCxt->dbFName); return TSDB_CODE_SUCCESS; } @@ -977,8 +972,6 @@ static int32_t parseInsertBody(SInsertParseContext* pCxt) { STableDataBlocks *dataBuf = NULL; CHECK_CODE(getDataBlockFromList(pCxt->pTableBlockHashObj, pCxt->pTableMeta->uid, TSDB_DEFAULT_PAYLOAD_SIZE, sizeof(SSubmitBlk), getTableInfo(pCxt->pTableMeta).rowSize, pCxt->pTableMeta, &dataBuf, NULL)); - strcpy(dataBuf->tableName, pCxt->tableName); - strcpy(dataBuf->dbFName, pCxt->dbFName); if (TK_NK_LP == sToken.type) { // pSql -> field1_name, ...) diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index a3ba53c496..3881615690 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -1164,7 +1164,7 @@ static int32_t translateCreateSuperTable(STranslateContext* pCxt, SCreateTableSt columnNodeToField(pStmt->pOptions->pSma, &createReq.pSmas); createReq.numOfColumns = LIST_LENGTH(pStmt->pCols); createReq.numOfTags = LIST_LENGTH(pStmt->pTags); - createReq.numOfSmas = LIST_LENGTH(pStmt->pOptions->pSma); + createReq.numOfSmas = (NULL == pStmt->pOptions->pSma ? createReq.numOfColumns : LIST_LENGTH(pStmt->pOptions->pSma)); SName tableName = { .type = TSDB_TABLE_NAME_T, .acctId = pCxt->pParseCxt->acctId }; strcpy(tableName.dbname, pStmt->dbName); From 70170d95d44b0dbf6653feb882be2eb389a20d63 Mon Sep 17 00:00:00 2001 From: afwerar <1296468573@qq.com> Date: Fri, 1 Apr 2022 15:36:30 +0800 Subject: [PATCH 29/68] [TD-13756]: file close memory error. --- source/util/src/tlog.c | 81 +++++++++++++++++++++++++----------------- 1 file changed, 49 insertions(+), 32 deletions(-) diff --git a/source/util/src/tlog.c b/source/util/src/tlog.c index c0530d6d7f..d74bb11d73 100644 --- a/source/util/src/tlog.c +++ b/source/util/src/tlog.c @@ -38,7 +38,7 @@ #define LOG_BUF_MUTEX(x) ((x)->buffMutex) typedef struct { - char buffer[LOG_DEFAULT_BUF_SIZE]; + char *buffer; int32_t buffStart; int32_t buffEnd; int32_t buffSize; @@ -58,7 +58,7 @@ typedef struct { int32_t openInProgress; pid_t pid; char logName[LOG_FILE_NAME_LEN]; - SLogBuff logHandle; + SLogBuff *logHandle; TdThreadMutex logMutex; } SLogObj; @@ -101,16 +101,16 @@ int64_t dbgWSize = 0; static void *taosAsyncOutputLog(void *param); static int32_t taosPushLogBuffer(SLogBuff *tLogBuff, const char *msg, int32_t msgLen); -static SLogBuff *taosLogBuffNew(SLogBuff *tLogBuff); +static SLogBuff *taosLogBuffNew(int32_t bufSize); static void taosCloseLogByFd(TdFilePtr pFile); +static void taosDestroyLog(); static int32_t taosOpenLogFile(char *fn, int32_t maxLines, int32_t maxFileNum); -static void taosCloseLogFile(void); static int32_t taosCompressFile(char *srcFileName, char *destFileName); static int32_t taosStartLog() { TdThreadAttr threadAttr; taosThreadAttrInit(&threadAttr); - if (taosThreadCreate(&(tsLogObj.logHandle.asyncThread), &threadAttr, taosAsyncOutputLog, &tsLogObj.logHandle) != 0) { + if (taosThreadCreate(&(tsLogObj.logHandle->asyncThread), &threadAttr, taosAsyncOutputLog, tsLogObj.logHandle) != 0) { return -1; } taosThreadAttrDestroy(&threadAttr); @@ -124,21 +124,24 @@ int32_t taosInitLog(const char *logName, int32_t maxFiles) { char fullName[PATH_MAX] = {0}; snprintf(fullName, PATH_MAX, "%s" TD_DIRSEP "%s", tsLogDir, logName); - taosLogBuffNew(&tsLogObj.logHandle); + tsLogObj.logHandle = taosLogBuffNew(LOG_DEFAULT_BUF_SIZE); + if (tsLogObj.logHandle == NULL) return -1; if (taosOpenLogFile(fullName, tsNumOfLogLines, maxFiles) < 0) return -1; - atexit(taosCloseLogFile); + // atexit(taosDestroyLog); if (taosStartLog() < 0) return -1; return 0; } static void taosStopLog() { - tsLogObj.logHandle.stop = 1; + if (tsLogObj.logHandle) { + tsLogObj.logHandle->stop = 1; + } } void taosCloseLog() { taosStopLog(); - if (taosCheckPthreadValid(tsLogObj.logHandle.asyncThread)) { - taosThreadJoin(tsLogObj.logHandle.asyncThread, NULL); + if (taosCheckPthreadValid(tsLogObj.logHandle->asyncThread)) { + taosThreadJoin(tsLogObj.logHandle->asyncThread, NULL); } tsLogInited = 0; // In case that other threads still use log resources causing invalid write in valgrind @@ -147,6 +150,14 @@ void taosCloseLog() { // taosCloseLog(); } +static void taosDestroyLog() { + if(tsLogObj.logHandle != NULL) { + taosCloseFile(&tsLogObj.logHandle->pFile); + taosMemoryFreeClear(LOG_BUF_BUFFER(tsLogObj.logHandle)); + taosMemoryFreeClear(tsLogObj.logHandle); + } +} + static bool taosLockLogFile(TdFilePtr pFile) { if (pFile == NULL) return false; @@ -209,8 +220,8 @@ static void *taosThreadToOpenNewFile(void *param) { taosLockLogFile(pFile); (void)taosLSeekFile(pFile, 0, SEEK_SET); - TdFilePtr pOldFile = tsLogObj.logHandle.pFile; - tsLogObj.logHandle.pFile = pFile; + TdFilePtr pOldFile = tsLogObj.logHandle->pFile; + tsLogObj.logHandle->pFile = pFile; tsLogObj.lines = 0; tsLogObj.openInProgress = 0; taosCloseLogByFd(pOldFile); @@ -346,39 +357,35 @@ static int32_t taosOpenLogFile(char *fn, int32_t maxLines, int32_t maxFileNum) { taosThreadMutexInit(&tsLogObj.logMutex, NULL); taosUmaskFile(0); - tsLogObj.logHandle.pFile = taosOpenFile(fileName, TD_FILE_CTEATE | TD_FILE_WRITE); + tsLogObj.logHandle->pFile = taosOpenFile(fileName, TD_FILE_CTEATE | TD_FILE_WRITE); - if (tsLogObj.logHandle.pFile == NULL) { + if (tsLogObj.logHandle->pFile == NULL) { printf("\nfailed to open log file:%s, reason:%s\n", fileName, strerror(errno)); return -1; } - taosLockLogFile(tsLogObj.logHandle.pFile); + taosLockLogFile(tsLogObj.logHandle->pFile); // only an estimate for number of lines int64_t filesize = 0; - if (taosFStatFile(tsLogObj.logHandle.pFile, &filesize, NULL) < 0) { + if (taosFStatFile(tsLogObj.logHandle->pFile, &filesize, NULL) < 0) { printf("\nfailed to fstat log file:%s, reason:%s\n", fileName, strerror(errno)); return -1; } size = (int32_t)filesize; tsLogObj.lines = size / 60; - taosLSeekFile(tsLogObj.logHandle.pFile, 0, SEEK_END); + taosLSeekFile(tsLogObj.logHandle->pFile, 0, SEEK_END); sprintf(name, "==================================================\n"); - taosWriteFile(tsLogObj.logHandle.pFile, name, (uint32_t)strlen(name)); + taosWriteFile(tsLogObj.logHandle->pFile, name, (uint32_t)strlen(name)); sprintf(name, " new log file \n"); - taosWriteFile(tsLogObj.logHandle.pFile, name, (uint32_t)strlen(name)); + taosWriteFile(tsLogObj.logHandle->pFile, name, (uint32_t)strlen(name)); sprintf(name, "==================================================\n"); - taosWriteFile(tsLogObj.logHandle.pFile, name, (uint32_t)strlen(name)); + taosWriteFile(tsLogObj.logHandle->pFile, name, (uint32_t)strlen(name)); return 0; } -static void taosCloseLogFile(void) { - taosCloseFile(&tsLogObj.logHandle.pFile); -} - static void taosUpdateLogNums(ELogLevel level) { switch (level) { case DEBUG_ERROR: @@ -412,12 +419,12 @@ static inline int32_t taosBuildLogHead(char *buffer, const char *flags) { } static inline void taosPrintLogImp(ELogLevel level, int32_t dflag, const char *buffer, int32_t len) { - if ((dflag & DEBUG_FILE) && tsLogObj.logHandle.pFile != NULL) { + if ((dflag & DEBUG_FILE) && tsLogObj.logHandle && tsLogObj.logHandle->pFile != NULL) { taosUpdateLogNums(level); if (tsAsyncLog) { - taosPushLogBuffer(&tsLogObj.logHandle, buffer, len); + taosPushLogBuffer(tsLogObj.logHandle, buffer, len); } else { - taosWriteFile(tsLogObj.logHandle.pFile, buffer, len); + taosWriteFile(tsLogObj.logHandle->pFile, buffer, len); } if (tsLogObj.maxLines > 0) { @@ -489,7 +496,7 @@ void taosDumpData(unsigned char *msg, int32_t len) { pos += 3; if (c >= 16) { temp[pos++] = '\n'; - taosWriteFile(tsLogObj.logHandle.pFile, temp, (uint32_t)pos); + taosWriteFile(tsLogObj.logHandle->pFile, temp, (uint32_t)pos); c = 0; pos = 0; } @@ -497,7 +504,7 @@ void taosDumpData(unsigned char *msg, int32_t len) { temp[pos++] = '\n'; - taosWriteFile(tsLogObj.logHandle.pFile, temp, (uint32_t)pos); + taosWriteFile(tsLogObj.logHandle->pFile, temp, (uint32_t)pos); } static void taosCloseLogByFd(TdFilePtr pFile) { @@ -507,10 +514,18 @@ static void taosCloseLogByFd(TdFilePtr pFile) { } } -static SLogBuff *taosLogBuffNew(SLogBuff *tLogBuff) { +static SLogBuff *taosLogBuffNew(int32_t bufSize) { + SLogBuff *tLogBuff = NULL; + + tLogBuff = taosMemoryCalloc(1, sizeof(SLogBuff)); + if (tLogBuff == NULL) return NULL; + + LOG_BUF_BUFFER(tLogBuff) = taosMemoryMalloc(bufSize); + if (LOG_BUF_BUFFER(tLogBuff) == NULL) goto _err; + LOG_BUF_START(tLogBuff) = LOG_BUF_END(tLogBuff) = 0; - LOG_BUF_SIZE(tLogBuff) = LOG_DEFAULT_BUF_SIZE; - tLogBuff->minBuffSize = LOG_DEFAULT_BUF_SIZE / 10; + LOG_BUF_SIZE(tLogBuff) = bufSize; + tLogBuff->minBuffSize = bufSize / 10; tLogBuff->stop = 0; if (taosThreadMutexInit(&LOG_BUF_MUTEX(tLogBuff), NULL) < 0) goto _err; @@ -519,6 +534,8 @@ static SLogBuff *taosLogBuffNew(SLogBuff *tLogBuff) { return tLogBuff; _err: + taosMemoryFreeClear(LOG_BUF_BUFFER(tLogBuff)); + taosMemoryFreeClear(tLogBuff); return NULL; } From 13e6efe3fc17b8aa61d0bf8424507ab1df906b15 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 1 Apr 2022 15:29:13 +0800 Subject: [PATCH 30/68] shm --- include/os/osShm.h | 2 +- source/dnode/mgmt/main/src/dndExec.c | 17 ++++------------- source/os/src/osProc.c | 2 +- source/os/src/osShm.c | 4 ++-- 4 files changed, 8 insertions(+), 17 deletions(-) diff --git a/include/os/osShm.h b/include/os/osShm.h index d26a99e277..61ffc0f6cc 100644 --- a/include/os/osShm.h +++ b/include/os/osShm.h @@ -26,7 +26,7 @@ typedef struct { void* ptr; } SShm; -int32_t taosCreateShm(SShm *pShm, int32_t shmsize) ; +int32_t taosCreateShm(SShm *pShm, int32_t key, int32_t shmsize) ; void taosDropShm(SShm *pShm); int32_t taosAttachShm(SShm *pShm); diff --git a/source/dnode/mgmt/main/src/dndExec.c b/source/dnode/mgmt/main/src/dndExec.c index b37893aa6f..0cc429c0d9 100644 --- a/source/dnode/mgmt/main/src/dndExec.c +++ b/source/dnode/mgmt/main/src/dndExec.c @@ -202,7 +202,7 @@ static int32_t dndRunInParentProcess(SDnode *pDnode) { if (!pWrapper->required) continue; int32_t shmsize = 1024 * 1024 * 2; // size will be a configuration item - if (taosCreateShm(&pWrapper->shm, shmsize) != 0) { + if (taosCreateShm(&pWrapper->shm, n, shmsize) != 0) { terrno = TAOS_SYSTEM_ERROR(terrno); dError("node:%s, failed to create shm size:%d since %s", pWrapper->name, shmsize, terrstr()); return -1; @@ -261,17 +261,8 @@ static int32_t dndRunInParentProcess(SDnode *pDnode) { if (pDnode->ntype == NODE_MAX) continue; if (pWrapper->procId > 0 && taosProcExist(pWrapper->procId)) { - dInfo("node:%s, send kill signal to the child process:%d", pWrapper->name, pWrapper->procId); - taosKillProc(pWrapper->procId); - } - } - - for (ENodeType n = DNODE + 1; n < NODE_MAX; ++n) { - SMgmtWrapper *pWrapper = &pDnode->wrappers[n]; - if (!pWrapper->required) continue; - if (pDnode->ntype == NODE_MAX) continue; - - if (pWrapper->procId > 0 && taosProcExist(pWrapper->procId)) { + // dInfo("node:%s, send kill signal to the child process:%d", pWrapper->name, pWrapper->procId); + // taosKillProc(pWrapper->procId); dInfo("node:%s, wait for child process:%d to stop", pWrapper->name, pWrapper->procId); taosWaitProc(pWrapper->procId); dInfo("node:%s, child process:%d is stopped", pWrapper->name, pWrapper->procId); @@ -340,7 +331,7 @@ static int32_t dndRunInChildProcess(SDnode *pDnode) { dndReportStartup(pDnode, "TDengine", "initialized successfully"); while (1) { if (pDnode->event == DND_EVENT_STOP) { - dInfo("dnode is about to stop"); + dInfo("%s is about to stop", pWrapper->name); break; } taosMsleep(100); diff --git a/source/os/src/osProc.c b/source/os/src/osProc.c index 6b52fa30be..262160c033 100644 --- a/source/os/src/osProc.c +++ b/source/os/src/osProc.c @@ -33,7 +33,7 @@ int32_t taosNewProc(char **args) { } void taosWaitProc(int32_t pid) { - int32_t status = 0; + int32_t status = -1; waitpid(pid, &status, 0); } diff --git a/source/os/src/osShm.c b/source/os/src/osShm.c index ba184c1f5d..bf784f14ac 100644 --- a/source/os/src/osShm.c +++ b/source/os/src/osShm.c @@ -17,10 +17,10 @@ #define _DEFAULT_SOURCE #include "os.h" -int32_t taosCreateShm(SShm* pShm, int32_t shmsize) { +int32_t taosCreateShm(SShm* pShm, int32_t key, int32_t shmsize) { pShm->id = -1; - int32_t shmid = shmget(0X95279527, shmsize, IPC_CREAT | 0600); + int32_t shmid = shmget(0X95270000 + key, shmsize, IPC_CREAT | 0600); if (shmid < 0) { return -1; } From 4aed871a59c447aea0a23131e375adc4068612ad Mon Sep 17 00:00:00 2001 From: plum-lihui Date: Fri, 1 Apr 2022 15:51:44 +0800 Subject: [PATCH 31/68] [add tools] --- tests/script/runAllSimCases.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 tests/script/runAllSimCases.sh diff --git a/tests/script/runAllSimCases.sh b/tests/script/runAllSimCases.sh new file mode 100755 index 0000000000..e1eea1cc38 --- /dev/null +++ b/tests/script/runAllSimCases.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +################################################## +# +# Do simulation test +# +################################################## + +set -e +#set -x + +while read line +do + firstChar=`echo ${line:0:1}` + if [[ -n "$line" ]] && [[ $firstChar != "#" ]]; then + echo "======== $line ========" + $line + fi +done < ./jenkins/basic.txt + + From e25b407c5a6379cf1dd0062f0b795220231f76a5 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Fri, 1 Apr 2022 08:00:46 +0000 Subject: [PATCH 32/68] optimize search process --- source/libs/tdb/src/db/tdbBtree.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/source/libs/tdb/src/db/tdbBtree.c b/source/libs/tdb/src/db/tdbBtree.c index 740e665cd2..f4e1621742 100644 --- a/source/libs/tdb/src/db/tdbBtree.c +++ b/source/libs/tdb/src/db/tdbBtree.c @@ -1380,6 +1380,30 @@ static int tdbBtcMoveTo(SBTC *pBtc, const void *pKey, int kLen, int *pCRst) { ASSERT(nCells > 0); ASSERT(pBtc->idx == -1); + // compare first cell + midx = lidx; + pCell = tdbPageGetCell(pPage, midx); + tdbBtreeDecodeCell(pPage, pCell, &cd); + c = pBt->kcmpr(pKey, kLen, cd.pKey, cd.kLen); + if (c <= 0) { + ridx = lidx - 1; + } else { + lidx = lidx + 1; + } + + // compare last cell + if (lidx <= ridx) { + midx = ridx; + pCell = tdbPageGetCell(pPage, midx); + tdbBtreeDecodeCell(pPage, pCell, &cd); + c = pBt->kcmpr(pKey, kLen, cd.pKey, cd.kLen); + if (c >= 0) { + lidx = ridx + 1; + } else { + ridx = ridx - 1; + } + } + // binary search for (;;) { if (lidx > ridx) break; From 79ffb5e5af9f71476c63d77a60e61061c7a74f03 Mon Sep 17 00:00:00 2001 From: afwerar <1296468573@qq.com> Date: Fri, 1 Apr 2022 16:11:51 +0800 Subject: [PATCH 33/68] [TD-13756]: file close memory error. --- source/util/src/tlog.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/source/util/src/tlog.c b/source/util/src/tlog.c index d74bb11d73..ef15f44f8f 100644 --- a/source/util/src/tlog.c +++ b/source/util/src/tlog.c @@ -103,7 +103,6 @@ static void *taosAsyncOutputLog(void *param); static int32_t taosPushLogBuffer(SLogBuff *tLogBuff, const char *msg, int32_t msgLen); static SLogBuff *taosLogBuffNew(int32_t bufSize); static void taosCloseLogByFd(TdFilePtr pFile); -static void taosDestroyLog(); static int32_t taosOpenLogFile(char *fn, int32_t maxLines, int32_t maxFileNum); static int32_t taosCompressFile(char *srcFileName, char *destFileName); @@ -127,7 +126,6 @@ int32_t taosInitLog(const char *logName, int32_t maxFiles) { tsLogObj.logHandle = taosLogBuffNew(LOG_DEFAULT_BUF_SIZE); if (tsLogObj.logHandle == NULL) return -1; if (taosOpenLogFile(fullName, tsNumOfLogLines, maxFiles) < 0) return -1; - // atexit(taosDestroyLog); if (taosStartLog() < 0) return -1; return 0; } @@ -150,14 +148,6 @@ void taosCloseLog() { // taosCloseLog(); } -static void taosDestroyLog() { - if(tsLogObj.logHandle != NULL) { - taosCloseFile(&tsLogObj.logHandle->pFile); - taosMemoryFreeClear(LOG_BUF_BUFFER(tsLogObj.logHandle)); - taosMemoryFreeClear(tsLogObj.logHandle); - } -} - static bool taosLockLogFile(TdFilePtr pFile) { if (pFile == NULL) return false; From 4ff2ad2c391310de321591b13e40f8fc5873e0b3 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Fri, 1 Apr 2022 04:31:24 -0400 Subject: [PATCH 34/68] all ddl statement syntax define, and ORDER BY clause bugfix --- include/common/ttokendef.h | 151 +- include/libs/nodes/cmdnodes.h | 6 + include/libs/nodes/nodes.h | 21 + source/libs/parser/inc/parAst.h | 12 + source/libs/parser/inc/sql.y | 54 + source/libs/parser/src/parAstCreater.c | 72 + source/libs/parser/src/parTokenizer.c | 60 +- source/libs/parser/src/parTranslater.c | 91 +- source/libs/parser/src/sql.c | 3850 +++++++++++++----------- 9 files changed, 2345 insertions(+), 1972 deletions(-) diff --git a/include/common/ttokendef.h b/include/common/ttokendef.h index 07ca829bf0..8d996be21e 100644 --- a/include/common/ttokendef.h +++ b/include/common/ttokendef.h @@ -131,69 +131,91 @@ #define TK_FUNCTIONS 113 #define TK_INDEXES 114 #define TK_FROM 115 -#define TK_LIKE 116 -#define TK_INDEX 117 -#define TK_FULLTEXT 118 -#define TK_FUNCTION 119 -#define TK_INTERVAL 120 -#define TK_TOPIC 121 -#define TK_AS 122 -#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_ACCOUNTS 116 +#define TK_APPS 117 +#define TK_CONNECTIONS 118 +#define TK_LICENCE 119 +#define TK_QUERIES 120 +#define TK_SCORES 121 +#define TK_TOPICS 122 +#define TK_VARIABLES 123 +#define TK_LIKE 124 +#define TK_INDEX 125 +#define TK_FULLTEXT 126 +#define TK_FUNCTION 127 +#define TK_INTERVAL 128 +#define TK_TOPIC 129 +#define TK_AS 130 +#define TK_DESC 131 +#define TK_DESCRIBE 132 +#define TK_RESET 133 +#define TK_QUERY 134 +#define TK_EXPLAIN 135 +#define TK_ANALYZE 136 +#define TK_VERBOSE 137 +#define TK_NK_BOOL 138 +#define TK_RATIO 139 +#define TK_COMPACT 140 +#define TK_VNODES 141 +#define TK_IN 142 +#define TK_OUTPUTTYPE 143 +#define TK_AGGREGATE 144 +#define TK_BUFSIZE 145 +#define TK_STREAM 146 +#define TK_INTO 147 +#define TK_KILL 148 +#define TK_CONNECTION 149 +#define TK_MERGE 150 +#define TK_VGROUP 151 +#define TK_REDISTRIBUTE 152 +#define TK_SPLIT 153 +#define TK_SYNCDB 154 +#define TK_NULL 155 +#define TK_NK_VARIABLE 156 +#define TK_NK_UNDERLINE 157 +#define TK_ROWTS 158 +#define TK_TBNAME 159 +#define TK_QSTARTTS 160 +#define TK_QENDTS 161 +#define TK_WSTARTTS 162 +#define TK_WENDTS 163 +#define TK_WDURATION 164 +#define TK_BETWEEN 165 +#define TK_IS 166 +#define TK_NK_LT 167 +#define TK_NK_GT 168 +#define TK_NK_LE 169 +#define TK_NK_GE 170 +#define TK_NK_NE 171 +#define TK_MATCH 172 +#define TK_NMATCH 173 +#define TK_JOIN 174 +#define TK_INNER 175 +#define TK_SELECT 176 +#define TK_DISTINCT 177 +#define TK_WHERE 178 +#define TK_PARTITION 179 +#define TK_BY 180 +#define TK_SESSION 181 +#define TK_STATE_WINDOW 182 +#define TK_SLIDING 183 +#define TK_FILL 184 +#define TK_VALUE 185 +#define TK_NONE 186 +#define TK_PREV 187 +#define TK_LINEAR 188 +#define TK_NEXT 189 +#define TK_GROUP 190 +#define TK_HAVING 191 +#define TK_ORDER 192 +#define TK_SLIMIT 193 +#define TK_SOFFSET 194 +#define TK_LIMIT 195 +#define TK_OFFSET 196 +#define TK_ASC 197 +#define TK_NULLS 198 +#define TK_FIRST 199 +#define TK_LAST 200 #define TK_NK_SPACE 300 #define TK_NK_COMMENT 301 @@ -207,10 +229,9 @@ #define TK_NK_COLON 500 #define TK_NK_BITNOT 501 #define TK_INSERT 502 -#define TK_INTO 503 #define TK_NOW 504 #define TK_VALUES 507 -#define TK_IMPORT 507 +#define TK_IMPORT 509 #define TK_NK_SEMI 508 #define TK_NK_NIL 65535 diff --git a/include/libs/nodes/cmdnodes.h b/include/libs/nodes/cmdnodes.h index b7131716f3..069aec14b5 100644 --- a/include/libs/nodes/cmdnodes.h +++ b/include/libs/nodes/cmdnodes.h @@ -197,6 +197,12 @@ typedef struct SShowStmt { SNode* pTbNamePattern; // SValueNode } SShowStmt; +typedef struct SShowCreatStmt { + ENodeType type; + char dbName[TSDB_DB_NAME_LEN]; + char tableName[TSDB_TABLE_NAME_LEN]; +} SShowCreatStmt; + typedef enum EIndexType { INDEX_TYPE_SMA = 1, INDEX_TYPE_FULLTEXT diff --git a/include/libs/nodes/nodes.h b/include/libs/nodes/nodes.h index 9849dfca39..9668082696 100644 --- a/include/libs/nodes/nodes.h +++ b/include/libs/nodes/nodes.h @@ -103,6 +103,15 @@ typedef enum ENodeType { QUERY_NODE_EXPLAIN_STMT, QUERY_NODE_DESCRIBE_STMT, QUERY_NODE_RESET_QUERY_CACHE_STMT, + QUERY_NODE_COMPACT_STMT, + QUERY_NODE_CREATE_FUNCTION_STMT, + QUERY_NODE_DROP_FUNCTION_STMT, + QUERY_NODE_CREATE_STREAM_STMT, + QUERY_NODE_DROP_STREAM_STMT, + QUERY_NODE_MERGE_VGROUP_STMT, + QUERY_NODE_REDISTRIBUTE_VGROUP_STMT, + QUERY_NODE_SPLIT_VGROUP_STMT, + QUERY_NODE_SYNCDB_STMT, QUERY_NODE_SHOW_DATABASES_STMT, QUERY_NODE_SHOW_TABLES_STMT, QUERY_NODE_SHOW_STABLES_STMT, @@ -115,6 +124,18 @@ typedef enum ENodeType { QUERY_NODE_SHOW_FUNCTIONS_STMT, QUERY_NODE_SHOW_INDEXES_STMT, QUERY_NODE_SHOW_STREAMS_STMT, + QUERY_NODE_SHOW_APPS_STMT, + QUERY_NODE_SHOW_CONNECTIONS_STMT, + QUERY_NODE_SHOW_LICENCE_STMT, + QUERY_NODE_SHOW_CREATE_DATABASE_STMT, + QUERY_NODE_SHOW_CREATE_TABLE_STMT, + QUERY_NODE_SHOW_CREATE_STABLE_STMT, + QUERY_NODE_SHOW_QUERIES_STMT, + QUERY_NODE_SHOW_SCORES_STMT, + QUERY_NODE_SHOW_TOPICS_STMT, + QUERY_NODE_SHOW_VARIABLE_STMT, + QUERY_NODE_KILL_CONNECTION_STMT, + QUERY_NODE_KILL_QUERY_STMT, // logic plan node QUERY_NODE_LOGIC_PLAN_SCAN, diff --git a/source/libs/parser/inc/parAst.h b/source/libs/parser/inc/parAst.h index f8880eac72..1fce11acdf 100644 --- a/source/libs/parser/inc/parAst.h +++ b/source/libs/parser/inc/parAst.h @@ -150,6 +150,8 @@ SNode* createAlterTableRenameCol(SAstCreateContext* pCxt, SNode* pRealTable, int SNode* createAlterTableSetTag(SAstCreateContext* pCxt, SNode* pRealTable, const SToken* pTagName, SNode* pVal); SNode* createUseDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName); SNode* createShowStmt(SAstCreateContext* pCxt, ENodeType type, SNode* pDbName, SNode* pTbNamePattern); +SNode* createShowCreateDatabaseStmt(SAstCreateContext* pCxt, const SToken* pDbName); +SNode* createShowCreateTableStmt(SAstCreateContext* pCxt, ENodeType type, SNode* pRealTable); SNode* createCreateUserStmt(SAstCreateContext* pCxt, SToken* pUserName, const SToken* pPassword); SNode* createAlterUserStmt(SAstCreateContext* pCxt, SToken* pUserName, int8_t alterType, const SToken* pVal); SNode* createDropUserStmt(SAstCreateContext* pCxt, SToken* pUserName); @@ -170,6 +172,16 @@ SNode* setExplainRatio(SAstCreateContext* pCxt, SNode* pOptions, const SToken* p SNode* createExplainStmt(SAstCreateContext* pCxt, bool analyze, SNode* pOptions, SNode* pQuery); SNode* createDescribeStmt(SAstCreateContext* pCxt, SNode* pRealTable); SNode* createResetQueryCacheStmt(SAstCreateContext* pCxt); +SNode* createCompactStmt(SAstCreateContext* pCxt, SNodeList* pVgroups); +SNode* createCreateFunctionStmt(SAstCreateContext* pCxt, bool aggFunc, const SToken* pFuncName, const SToken* pLibPath, SDataType dataType, int32_t bufSize); +SNode* createDropFunctionStmt(SAstCreateContext* pCxt, const SToken* pFuncName); +SNode* createCreateStreamStmt(SAstCreateContext* pCxt, const SToken* pStreamName, const SToken* pTableName, SNode* pQuery); +SNode* createDropStreamStmt(SAstCreateContext* pCxt, const SToken* pStreamName); +SNode* createKillStmt(SAstCreateContext* pCxt, ENodeType type, const SToken* pId); +SNode* createMergeVgroupStmt(SAstCreateContext* pCxt, const SToken* pVgId1, const SToken* pVgId2); +SNode* createRedistributeVgroupStmt(SAstCreateContext* pCxt, const SToken* pVgId, SNodeList* pDnodes); +SNode* createSplitVgroupStmt(SAstCreateContext* pCxt, const SToken* pVgId); +SNode* createSyncdbStmt(SAstCreateContext* pCxt, const SToken* pDbName); #ifdef __cplusplus } diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index e2b96b4a50..29b1d8857a 100644 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -301,6 +301,17 @@ cmd ::= SHOW QNODES. cmd ::= SHOW FUNCTIONS. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT, NULL, NULL); } cmd ::= SHOW INDEXES FROM table_name_cond(A) from_db_opt(B). { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, A, B); } cmd ::= SHOW STREAMS. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT, NULL, NULL); } +cmd ::= SHOW ACCOUNTS. { pCxt->valid = false; generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } +cmd ::= SHOW APPS. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_APPS_STMT, NULL, NULL); } +cmd ::= SHOW CONNECTIONS. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONNECTIONS_STMT, NULL, NULL); } +cmd ::= SHOW LICENCE. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCE_STMT, NULL, NULL); } +cmd ::= SHOW CREATE DATABASE db_name(A). { pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &A); } +cmd ::= SHOW CREATE TABLE full_table_name(A). { pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, A); } +cmd ::= SHOW CREATE STABLE full_table_name(A). { pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, A); } +cmd ::= SHOW QUERIES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT, NULL, NULL); } +cmd ::= SHOW SCORES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SCORES_STMT, NULL, NULL); } +cmd ::= SHOW TOPICS. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TOPICS_STMT, NULL, NULL); } +cmd ::= SHOW VARIABLES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VARIABLE_STMT, NULL, NULL); } db_name_cond_opt(A) ::= . { A = createDefaultDatabaseCondValue(pCxt); } db_name_cond_opt(A) ::= db_name(B) NK_DOT. { A = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &B); } @@ -364,6 +375,45 @@ explain_options(A) ::= . 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); } +/************************************************ compact *************************************************************/ +cmd ::= COMPACT VNODES IN NK_LP integer_list(A) NK_RP. { pCxt->pRootNode = createCompactStmt(pCxt, A); } + +/************************************************ create/drop function ************************************************/ +cmd ::= CREATE agg_func_opt(A) FUNCTION function_name(B) + AS NK_STRING(C) OUTPUTTYPE type_name(D) bufsize_opt(E). { pCxt->pRootNode = createCreateFunctionStmt(pCxt, A, &B, &C, D, E); } +cmd ::= DROP FUNCTION function_name(A). { pCxt->pRootNode = createDropFunctionStmt(pCxt, &A); } + +%type agg_func_opt { bool } +%destructor agg_func_opt { } +agg_func_opt(A) ::= . { A = false; } +agg_func_opt(A) ::= AGGREGATE. { A = true; } + +%type bufsize_opt { int32_t } +%destructor bufsize_opt { } +bufsize_opt(A) ::= . { A = 0; } +bufsize_opt(A) ::= BUFSIZE NK_INTEGER(B). { A = strtol(B.z, NULL, 10); } + +/************************************************ create/drop stream **************************************************/ +cmd ::= CREATE STREAM stream_name(A) INTO table_name(B) AS query_expression(C). { pCxt->pRootNode = createCreateStreamStmt(pCxt, &A, &B, C); } +cmd ::= DROP STREAM stream_name(A). { pCxt->pRootNode = createDropStreamStmt(pCxt, &A); } + +/************************************************ kill connection/query ***********************************************/ +cmd ::= KILL CONNECTION NK_INTEGER(A). { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &A); } +cmd ::= KILL QUERY NK_INTEGER(A). { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_QUERY_STMT, &A); } + +/************************************************ merge/redistribute/ vgroup ******************************************/ +cmd ::= MERGE VGROUP NK_INTEGER(A) NK_INTEGER(B). { pCxt->pRootNode = createMergeVgroupStmt(pCxt, &A, &B); } +cmd ::= REDISTRIBUTE VGROUP NK_INTEGER(A) dnode_list(B). { pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &A, B); } +cmd ::= SPLIT VGROUP NK_INTEGER(A). { pCxt->pRootNode = createSplitVgroupStmt(pCxt, &A); } + +%type dnode_list { SNodeList* } +%destructor dnode_list { nodesDestroyList($$); } +dnode_list(A) ::= DNODE NK_INTEGER(B). { A = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &B)); } +dnode_list(A) ::= dnode_list(B) DNODE NK_INTEGER(C). { A = addNodeToList(pCxt, B, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &C)); } + +/************************************************ syncdb **************************************************************/ +cmd ::= SYNCDB db_name(A) REPLICA. { pCxt->pRootNode = createSyncdbStmt(pCxt, &A); } + /************************************************ select **************************************************************/ cmd ::= query_expression(A). { pCxt->pRootNode = A; } @@ -442,6 +492,10 @@ index_name(A) ::= NK_ID(B). %destructor topic_name { } topic_name(A) ::= NK_ID(B). { A = B; } +%type stream_name { SToken } +%destructor stream_name { } +stream_name(A) ::= NK_ID(B). { A = B; } + /************************************************ expression **********************************************************/ expression(A) ::= literal(B). { A = B; } //expression(A) ::= NK_QUESTION(B). { A = B; } diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c index 028238ab60..18a0ae8cfa 100644 --- a/source/libs/parser/src/parAstCreater.c +++ b/source/libs/parser/src/parAstCreater.c @@ -1221,6 +1221,18 @@ SNode* createShowStmt(SAstCreateContext* pCxt, ENodeType type, SNode* pDbName, S return (SNode*)pStmt; } +SNode* createShowCreateDatabaseStmt(SAstCreateContext* pCxt, const SToken* pDbName) { + SNode* pStmt = nodesMakeNode(QUERY_NODE_SHOW_CREATE_DATABASE_STMT); + CHECK_OUT_OF_MEM(pStmt); + return pStmt; +} + +SNode* createShowCreateTableStmt(SAstCreateContext* pCxt, ENodeType type, SNode* pRealTable) { + SNode* pStmt = nodesMakeNode(type); + CHECK_OUT_OF_MEM(pStmt); + return pStmt; +} + SNode* createCreateUserStmt(SAstCreateContext* pCxt, SToken* pUserName, const SToken* pPassword) { char password[TSDB_USET_PASSWORD_LEN] = {0}; if (!checkUserName(pCxt, pUserName) || !checkPassword(pCxt, pPassword, password)) { @@ -1433,3 +1445,63 @@ SNode* createResetQueryCacheStmt(SAstCreateContext* pCxt) { CHECK_OUT_OF_MEM(pStmt); return pStmt; } + +SNode* createCompactStmt(SAstCreateContext* pCxt, SNodeList* pVgroups) { + SNode* pStmt = nodesMakeNode(QUERY_NODE_COMPACT_STMT); + CHECK_OUT_OF_MEM(pStmt); + return pStmt; +} + +SNode* createCreateFunctionStmt(SAstCreateContext* pCxt, bool aggFunc, const SToken* pFuncName, const SToken* pLibPath, SDataType dataType, int32_t bufSize) { + SNode* pStmt = nodesMakeNode(QUERY_NODE_CREATE_FUNCTION_STMT); + CHECK_OUT_OF_MEM(pStmt); + return pStmt; +} + +SNode* createDropFunctionStmt(SAstCreateContext* pCxt, const SToken* pFuncName) { + SNode* pStmt = nodesMakeNode(QUERY_NODE_DROP_FUNCTION_STMT); + CHECK_OUT_OF_MEM(pStmt); + return pStmt; +} + +SNode* createCreateStreamStmt(SAstCreateContext* pCxt, const SToken* pStreamName, const SToken* pTableName, SNode* pQuery) { + SNode* pStmt = nodesMakeNode(QUERY_NODE_CREATE_STREAM_STMT); + CHECK_OUT_OF_MEM(pStmt); + return pStmt; +} + +SNode* createDropStreamStmt(SAstCreateContext* pCxt, const SToken* pStreamName) { + SNode* pStmt = nodesMakeNode(QUERY_NODE_DROP_STREAM_STMT); + CHECK_OUT_OF_MEM(pStmt); + return pStmt; +} + +SNode* createKillStmt(SAstCreateContext* pCxt, ENodeType type, const SToken* pId) { + SNode* pStmt = nodesMakeNode(type); + CHECK_OUT_OF_MEM(pStmt); + return pStmt; +} + +SNode* createMergeVgroupStmt(SAstCreateContext* pCxt, const SToken* pVgId1, const SToken* pVgId2) { + SNode* pStmt = nodesMakeNode(QUERY_NODE_MERGE_VGROUP_STMT); + CHECK_OUT_OF_MEM(pStmt); + return pStmt; +} + +SNode* createRedistributeVgroupStmt(SAstCreateContext* pCxt, const SToken* pVgId, SNodeList* pDnodes) { + SNode* pStmt = nodesMakeNode(QUERY_NODE_REDISTRIBUTE_VGROUP_STMT); + CHECK_OUT_OF_MEM(pStmt); + return pStmt; +} + +SNode* createSplitVgroupStmt(SAstCreateContext* pCxt, const SToken* pVgId) { + SNode* pStmt = nodesMakeNode(QUERY_NODE_SPLIT_VGROUP_STMT); + CHECK_OUT_OF_MEM(pStmt); + return pStmt; +} + +SNode* createSyncdbStmt(SAstCreateContext* pCxt, const SToken* pDbName) { + SNode* pStmt = nodesMakeNode(QUERY_NODE_SYNCDB_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 817db3592d..be2bd0d0b6 100644 --- a/source/libs/parser/src/parTokenizer.c +++ b/source/libs/parser/src/parTokenizer.c @@ -29,10 +29,14 @@ typedef struct SKeyword { // keywords in sql string static SKeyword keywordTable[] = { {"ACCOUNT", TK_ACCOUNT}, + {"ACCOUNTS", TK_ACCOUNTS}, + {"ADD", TK_ADD}, + {"AGGREGATE", TK_AGGREGATE}, {"ALL", TK_ALL}, {"ALTER", TK_ALTER}, {"ANALYZE", TK_ANALYZE}, {"AND", TK_AND}, + {"APPS", TK_APPS}, {"AS", TK_AS}, {"ASC", TK_ASC}, {"BETWEEN", TK_BETWEEN}, @@ -40,15 +44,22 @@ static SKeyword keywordTable[] = { {"BIGINT", TK_BIGINT}, {"BLOCKS", TK_BLOCKS}, {"BOOL", TK_BOOL}, + {"BUFSIZE", TK_BUFSIZE}, {"BY", TK_BY}, {"CACHE", TK_CACHE}, {"CACHELAST", TK_CACHELAST}, + {"COLUMN", TK_COLUMN}, {"COMMENT", TK_COMMENT}, {"COMP", TK_COMP}, + {"COMPACT", TK_COMPACT}, + {"CONNS", TK_CONNS}, + {"CONNECTION", TK_CONNECTION}, + {"CONNECTIONS", TK_CONNECTIONS}, {"CREATE", TK_CREATE}, {"DATABASE", TK_DATABASE}, {"DATABASES", TK_DATABASES}, {"DAYS", TK_DAYS}, + {"DBS", TK_DBS}, {"DELAY", TK_DELAY}, {"DESC", TK_DESC}, {"DESCRIBE", TK_DESCRIBE}, @@ -83,14 +94,18 @@ static SKeyword keywordTable[] = { {"JOIN", TK_JOIN}, {"JSON", TK_JSON}, {"KEEP", TK_KEEP}, + {"KILL", TK_KILL}, + {"LICENCE", TK_LICENCE}, {"LIKE", TK_LIKE}, {"LIMIT", TK_LIMIT}, {"LINEAR", TK_LINEAR}, + {"LOCAL", TK_LOCAL}, {"MATCH", TK_MATCH}, {"MAXROWS", TK_MAXROWS}, {"MINROWS", TK_MINROWS}, {"MINUS", TK_MINUS}, {"MNODES", TK_MNODES}, + {"MODIFY", TK_MODIFY}, {"MODULES", TK_MODULES}, {"NCHAR", TK_NCHAR}, {"NMATCH", TK_NMATCH}, @@ -102,9 +117,11 @@ static SKeyword keywordTable[] = { {"ON", TK_ON}, {"OR", TK_OR}, {"ORDER", TK_ORDER}, + {"OUTPUTTYPE", TK_OUTPUTTYPE}, {"PARTITION", TK_PARTITION}, {"PASS", TK_PASS}, {"PORT", TK_PORT}, + {"PPS", TK_PPS}, {"PRECISION", TK_PRECISION}, {"PRIVILEGE", TK_PRIVILEGE}, {"PREV", TK_PREV}, @@ -112,6 +129,8 @@ static SKeyword keywordTable[] = { {"QNODE", TK_QNODE}, {"QNODES", TK_QNODES}, {"QSTARTTS", TK_QSTARTTS}, + {"QTIME", TK_QTIME}, + {"QUERIES", TK_QUERIES}, {"QUERY", TK_QUERY}, {"QUORUM", TK_QUORUM}, {"RATIO", TK_RATIO}, @@ -120,8 +139,10 @@ static SKeyword keywordTable[] = { {"RETENTIONS", TK_RETENTIONS}, {"ROLLUP", TK_ROLLUP}, {"ROWTS", TK_ROWTS}, + {"SCORES", TK_SCORES}, {"SELECT", TK_SELECT}, {"SESSION", TK_SESSION}, + {"SET", TK_SET}, {"SHOW", TK_SHOW}, {"SINGLE_STABLE", TK_SINGLE_STABLE}, {"SLIDING", TK_SLIDING}, @@ -131,16 +152,23 @@ static SKeyword keywordTable[] = { {"SOFFSET", TK_SOFFSET}, {"STABLE", TK_STABLE}, {"STABLES", TK_STABLES}, + {"STATE", TK_STATE}, {"STATE_WINDOW", TK_STATE_WINDOW}, + {"STORAGE", TK_STORAGE}, + {"STREAM", TK_STREAM}, {"STREAMS", TK_STREAMS}, {"STREAM_MODE", TK_STREAM_MODE}, + {"SYNCDB", TK_SYNCDB}, {"TABLE", TK_TABLE}, {"TABLES", TK_TABLES}, + {"TAG", TK_TAG}, {"TAGS", TK_TAGS}, {"TBNAME", TK_TBNAME}, {"TIMESTAMP", TK_TIMESTAMP}, {"TINYINT", TK_TINYINT}, {"TOPIC", TK_TOPIC}, + {"TOPICS", TK_TOPICS}, + {"TSERIES", TK_TSERIES}, {"TTL", TK_TTL}, {"UNION", TK_UNION}, {"UNSIGNED", TK_UNSIGNED}, @@ -150,8 +178,10 @@ static SKeyword keywordTable[] = { {"USING", TK_USING}, {"VALUES", TK_VALUES}, {"VARCHAR", TK_VARCHAR}, + {"VARIABLES", TK_VARIABLES}, {"VERBOSE", TK_VERBOSE}, {"VGROUPS", TK_VGROUPS}, + {"VNODES", TK_VNODES}, {"WAL", TK_WAL}, {"WDURATION", TK_WDURATION}, {"WENDTS", TK_WENDTS}, @@ -182,22 +212,8 @@ static SKeyword keywordTable[] = { // {"UMINUS", TK_UMINUS}, // {"UPLUS", TK_UPLUS}, // {"BITNOT", TK_BITNOT}, - // {"ACCOUNTS", TK_ACCOUNTS}, - // {"QUERIES", TK_QUERIES}, - // {"CONNECTIONS", TK_CONNECTIONS}, - // {"VARIABLES", TK_VARIABLES}, - // {"SCORES", TK_SCORES}, // {"GRANTS", TK_GRANTS}, // {"DOT", TK_DOT}, - // {"SYNCDB", TK_SYNCDB}, - // {"LOCAL", TK_LOCAL}, - // {"PPS", TK_PPS}, - // {"TSERIES", TK_TSERIES}, - // {"DBS", TK_DBS}, - // {"STORAGE", TK_STORAGE}, - // {"QTIME", TK_QTIME}, - // {"CONNS", TK_CONNS}, - // {"STATE", TK_STATE}, // {"CTIME", TK_CTIME}, // {"LP", TK_LP}, // {"RP", TK_RP}, @@ -205,15 +221,8 @@ static SKeyword keywordTable[] = { // {"EVERY", TK_EVERY}, // {"VARIABLE", TK_VARIABLE}, // {"UPDATE", TK_UPDATE}, - // {"ADD", TK_ADD}, - // {"COLUMN", TK_COLUMN}, - // {"TAG", TK_TAG}, // {"CHANGE", TK_CHANGE}, - // {"SET", TK_SET}, - // {"KILL", TK_KILL}, - // {"CONNECTION", TK_CONNECTION}, // {"COLON", TK_COLON}, - // {"STREAM", TK_STREAM}, // {"ABORT", TK_ABORT}, // {"AFTER", TK_AFTER}, // {"ATTACH", TK_ATTACH}, @@ -244,14 +253,7 @@ static SKeyword keywordTable[] = { // {"TRIGGER", TK_TRIGGER}, // {"VIEW", TK_VIEW}, // {"SEMI", TK_SEMI}, - // {"VNODES", TK_VNODES}, -// {"PARTITIONS", TK_PARTITIONS}, - // {"TOPICS", TK_TOPICS}, - // {"COMPACT", TK_COMPACT}, - // {"MODIFY", TK_MODIFY}, - // {"OUTPUTTYPE", TK_OUTPUTTYPE}, - // {"AGGREGATE", TK_AGGREGATE}, - // {"BUFSIZE", TK_BUFSIZE}, + // {"PARTITIONS", TK_PARTITIONS}, // {"MODE", TK_MODE}, }; diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index c14d540bc8..2947d25e1f 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -240,7 +240,11 @@ static void setColumnInfoByExpr(const STableNode* pTable, SExprNode* pExpr, SCol if (NULL != pTable) { strcpy(pCol->tableAlias, pTable->tableAlias); } else if (QUERY_NODE_COLUMN == nodeType(pExpr)) { - strcpy(pCol->tableAlias, ((SColumnNode*)pExpr)->tableAlias); + SColumnNode* pProjCol = (SColumnNode*)pExpr; + strcpy(pCol->tableAlias, pProjCol->tableAlias); + pCol->tableId = pProjCol->tableId; + pCol->colId = pProjCol->colId; + pCol->colType = pProjCol->colType; } strcpy(pCol->colName, pExpr->aliasName); pCol->node.resType = pExpr->resType; @@ -1095,10 +1099,6 @@ static int32_t columnDefNodeToField(SNodeList* pList, SArray** pArray) { } static int32_t columnNodeToField(SNodeList* pList, SArray** pArray) { - if (NULL == pList) { - return TSDB_CODE_SUCCESS; - } - *pArray = taosArrayInit(LIST_LENGTH(pList), sizeof(SField)); SNode* pNode; FOREACH(pNode, pList) { @@ -1161,10 +1161,15 @@ static int32_t translateCreateSuperTable(STranslateContext* pCxt, SCreateTableSt createReq.delay = pStmt->pOptions->delay; columnDefNodeToField(pStmt->pCols, &createReq.pColumns); columnDefNodeToField(pStmt->pTags, &createReq.pTags); - columnNodeToField(pStmt->pOptions->pSma, &createReq.pSmas); createReq.numOfColumns = LIST_LENGTH(pStmt->pCols); createReq.numOfTags = LIST_LENGTH(pStmt->pTags); - createReq.numOfSmas = (NULL == pStmt->pOptions->pSma ? createReq.numOfColumns : LIST_LENGTH(pStmt->pOptions->pSma)); + if (NULL == pStmt->pOptions->pSma) { + columnDefNodeToField(pStmt->pCols, &createReq.pSmas); + createReq.numOfSmas = createReq.numOfColumns; + } else { + columnNodeToField(pStmt->pOptions->pSma, &createReq.pSmas); + createReq.numOfSmas = LIST_LENGTH(pStmt->pOptions->pSma); + } SName tableName = { .type = TSDB_TABLE_NAME_T, .acctId = pCxt->pParseCxt->acctId }; strcpy(tableName.dbname, pStmt->dbName); @@ -1470,20 +1475,20 @@ static int32_t translateAlterDnode(STranslateContext* pCxt, SAlterDnodeStmt* pSt static int32_t nodeTypeToShowType(ENodeType nt) { switch (nt) { - case QUERY_NODE_SHOW_DATABASES_STMT: - return TSDB_MGMT_TABLE_DB; - case QUERY_NODE_SHOW_STABLES_STMT: - return TSDB_MGMT_TABLE_STB; - case QUERY_NODE_SHOW_USERS_STMT: - return TSDB_MGMT_TABLE_USER; - case QUERY_NODE_SHOW_DNODES_STMT: - return TSDB_MGMT_TABLE_DNODE; - case QUERY_NODE_SHOW_VGROUPS_STMT: - return TSDB_MGMT_TABLE_VGROUP; - case QUERY_NODE_SHOW_MNODES_STMT: - return TSDB_MGMT_TABLE_MNODE; - case QUERY_NODE_SHOW_QNODES_STMT: - return TSDB_MGMT_TABLE_QNODE; + case QUERY_NODE_SHOW_APPS_STMT: + return 0; // todo + case QUERY_NODE_SHOW_CONNECTIONS_STMT: + return TSDB_MGMT_TABLE_CONNS; + case QUERY_NODE_SHOW_LICENCE_STMT: + return 0; // todo + case QUERY_NODE_SHOW_QUERIES_STMT: + return TSDB_MGMT_TABLE_QUERIES; + case QUERY_NODE_SHOW_SCORES_STMT: + return 0; // todo + case QUERY_NODE_SHOW_TOPICS_STMT: + return 0; // todo + case QUERY_NODE_SHOW_VARIABLE_STMT: + return TSDB_MGMT_TABLE_VARIABLES; default: break; } @@ -1509,30 +1514,6 @@ static int32_t translateShow(STranslateContext* pCxt, SShowStmt* pStmt) { return TSDB_CODE_SUCCESS; } -static int32_t translateShowTables(STranslateContext* pCxt) { - SVShowTablesReq* pShowReq = taosMemoryCalloc(1, sizeof(SVShowTablesReq)); - - SArray* array = NULL; - int32_t code = getDBVgInfo(pCxt, pCxt->pParseCxt->db, &array); - if (TSDB_CODE_SUCCESS != code) { - return code; - } - SVgroupInfo* info = taosArrayGet(array, 0); - pShowReq->head.vgId = htonl(info->vgId); - - pCxt->pCmdMsg = taosMemoryMalloc(sizeof(SCmdMsgInfo)); - if (NULL == pCxt->pCmdMsg) { - return TSDB_CODE_OUT_OF_MEMORY; - } - pCxt->pCmdMsg->epSet = info->epSet; - pCxt->pCmdMsg->msgType = TDMT_VND_SHOW_TABLES; - pCxt->pCmdMsg->msgLen = sizeof(SVShowTablesReq); - pCxt->pCmdMsg->pMsg = pShowReq; - pCxt->pCmdMsg->pExtension = array; - - return TSDB_CODE_SUCCESS; -} - static int32_t getSmaIndexDstVgId(STranslateContext* pCxt, char* pTableName, int32_t* pVgId) { SVgroupInfo vg = {0}; int32_t code = getTableHashVgroup(pCxt, pCxt->pParseCxt->db, pTableName, &vg); @@ -1868,17 +1849,19 @@ static int32_t translateQuery(STranslateContext* pCxt, SNode* pNode) { case QUERY_NODE_ALTER_DNODE_STMT: code = translateAlterDnode(pCxt, (SAlterDnodeStmt*)pNode); break; - case QUERY_NODE_SHOW_DATABASES_STMT: - case QUERY_NODE_SHOW_STABLES_STMT: - case QUERY_NODE_SHOW_USERS_STMT: - case QUERY_NODE_SHOW_DNODES_STMT: - case QUERY_NODE_SHOW_VGROUPS_STMT: - case QUERY_NODE_SHOW_MNODES_STMT: - case QUERY_NODE_SHOW_QNODES_STMT: + case QUERY_NODE_SHOW_APPS_STMT: + case QUERY_NODE_SHOW_CONNECTIONS_STMT: + case QUERY_NODE_SHOW_LICENCE_STMT: + case QUERY_NODE_SHOW_QUERIES_STMT: + case QUERY_NODE_SHOW_SCORES_STMT: + case QUERY_NODE_SHOW_TOPICS_STMT: + case QUERY_NODE_SHOW_VARIABLE_STMT: code = translateShow(pCxt, (SShowStmt*)pNode); break; - case QUERY_NODE_SHOW_TABLES_STMT: - code = translateShowTables(pCxt); + case QUERY_NODE_SHOW_CREATE_DATABASE_STMT: + case QUERY_NODE_SHOW_CREATE_TABLE_STMT: + case QUERY_NODE_SHOW_CREATE_STABLE_STMT: + // todo break; case QUERY_NODE_CREATE_INDEX_STMT: code = translateCreateIndex(pCxt, (SCreateIndexStmt*)pNode); diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index 1252943f6e..618e80cbfe 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 278 +#define YYNOCODE 304 #define YYACTIONTYPE unsigned short int #define ParseTOKENTYPE SToken typedef union { int yyinit; ParseTOKENTYPE yy0; - SNode* yy24; - EOperatorType yy36; - ENullOrder yy45; - int32_t yy104; - SDataType yy212; - bool yy265; - EJoinType yy320; - SToken yy337; - EOrder yy346; - SNodeList* yy504; + EOperatorType yy60; + SNode* yy104; + SToken yy129; + bool yy185; + int32_t yy196; + SAlterOption yy253; + SNodeList* yy312; + SDataType yy336; + EOrder yy354; + ENullOrder yy489; + EJoinType yy532; EFillMode yy550; - SAlterOption yy553; } YYMINORTYPE; #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 @@ -132,17 +132,17 @@ typedef union { #define ParseCTX_PARAM #define ParseCTX_FETCH #define ParseCTX_STORE -#define YYNSTATE 451 -#define YYNRULE 360 -#define YYNTOKEN 179 -#define YY_MAX_SHIFT 450 -#define YY_MIN_SHIFTREDUCE 696 -#define YY_MAX_SHIFTREDUCE 1055 -#define YY_ERROR_ACTION 1056 -#define YY_ACCEPT_ACTION 1057 -#define YY_NO_ACTION 1058 -#define YY_MIN_REDUCE 1059 -#define YY_MAX_REDUCE 1418 +#define YYNSTATE 512 +#define YYNRULE 389 +#define YYNTOKEN 201 +#define YY_MAX_SHIFT 511 +#define YY_MIN_SHIFTREDUCE 762 +#define YY_MAX_SHIFTREDUCE 1150 +#define YY_ERROR_ACTION 1151 +#define YY_ACCEPT_ACTION 1152 +#define YY_NO_ACTION 1153 +#define YY_MIN_REDUCE 1154 +#define YY_MAX_REDUCE 1542 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -209,417 +209,452 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (1316) +#define YY_ACTTAB_COUNT (1412) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 1275, 368, 1288, 1154, 247, 1397, 46, 1241, 1271, 1278, - /* 10 */ 1304, 1288, 31, 29, 27, 26, 25, 365, 1396, 108, - /* 20 */ 349, 1071, 1395, 1304, 1161, 31, 29, 27, 26, 25, - /* 30 */ 365, 380, 1304, 31, 29, 27, 26, 25, 235, 352, - /* 40 */ 367, 1150, 95, 380, 1262, 339, 732, 221, 1102, 367, - /* 50 */ 27, 26, 25, 1262, 1304, 1275, 214, 1289, 1290, 1293, - /* 60 */ 221, 365, 295, 1271, 1277, 65, 1289, 1290, 1293, 1336, - /* 70 */ 931, 93, 920, 237, 1332, 115, 24, 176, 961, 1105, - /* 80 */ 351, 116, 1343, 1344, 1212, 1348, 61, 172, 345, 342, - /* 90 */ 234, 961, 12, 331, 1363, 1210, 57, 435, 434, 433, - /* 100 */ 432, 431, 430, 429, 428, 192, 425, 424, 423, 422, - /* 110 */ 421, 420, 419, 418, 417, 81, 962, 46, 80, 79, - /* 120 */ 78, 77, 76, 75, 74, 73, 72, 92, 310, 962, - /* 130 */ 305, 381, 733, 309, 732, 1160, 149, 266, 306, 304, - /* 140 */ 268, 307, 23, 242, 956, 957, 958, 959, 960, 964, - /* 150 */ 965, 966, 734, 1165, 1156, 23, 242, 956, 957, 958, - /* 160 */ 959, 960, 964, 965, 966, 1288, 916, 219, 1057, 31, - /* 170 */ 29, 27, 26, 25, 171, 808, 404, 403, 402, 812, - /* 180 */ 401, 814, 815, 400, 817, 397, 1304, 823, 394, 825, - /* 190 */ 826, 391, 388, 365, 112, 1143, 1262, 380, 30, 28, - /* 200 */ 261, 1082, 260, 367, 381, 1205, 244, 1262, 896, 1288, - /* 210 */ 267, 943, 353, 945, 946, 947, 948, 949, 259, 64, - /* 220 */ 1289, 1290, 1293, 1336, 894, 121, 1165, 220, 1332, 109, - /* 230 */ 1304, 1129, 248, 11, 30, 28, 998, 352, 918, 1397, - /* 240 */ 107, 288, 244, 1262, 896, 1397, 12, 367, 1167, 30, - /* 250 */ 28, 1262, 120, 107, 1022, 1, 1395, 244, 120, 896, - /* 260 */ 894, 1168, 1395, 65, 1289, 1290, 1293, 1336, 1212, 11, - /* 270 */ 1212, 237, 1332, 115, 249, 894, 256, 1350, 447, 1210, - /* 280 */ 1052, 1210, 252, 349, 11, 335, 1020, 1021, 1023, 1024, - /* 290 */ 895, 1, 1364, 1081, 916, 1347, 315, 1355, 993, 1275, - /* 300 */ 121, 269, 255, 262, 281, 95, 1, 1271, 1277, 1232, - /* 310 */ 1234, 323, 6, 282, 447, 381, 897, 381, 900, 901, - /* 320 */ 210, 287, 944, 1162, 353, 151, 895, 963, 318, 447, - /* 330 */ 1397, 121, 1051, 312, 93, 1262, 150, 1165, 1288, 1165, - /* 340 */ 121, 895, 288, 120, 169, 1343, 348, 1395, 347, 254, - /* 350 */ 921, 1397, 897, 21, 900, 901, 210, 107, 944, 1304, - /* 360 */ 41, 1288, 967, 40, 120, 1167, 365, 897, 1395, 900, - /* 370 */ 901, 210, 324, 944, 343, 257, 367, 9, 8, 62, - /* 380 */ 1262, 280, 1304, 107, 275, 274, 273, 272, 271, 365, - /* 390 */ 96, 1167, 65, 1289, 1290, 1293, 1336, 1157, 381, 367, - /* 400 */ 237, 1332, 1409, 1262, 378, 1288, 148, 357, 381, 1080, - /* 410 */ 300, 1370, 1141, 325, 69, 65, 1289, 1290, 1293, 1336, - /* 420 */ 1165, 297, 993, 237, 1332, 1409, 1304, 1350, 30, 28, - /* 430 */ 1165, 302, 338, 365, 1393, 368, 244, 1079, 896, 121, - /* 440 */ 1397, 1242, 1078, 367, 381, 1346, 974, 1262, 1077, 1288, - /* 450 */ 379, 1262, 157, 120, 894, 1076, 276, 1395, 416, 65, - /* 460 */ 1289, 1290, 1293, 1336, 349, 1075, 1165, 237, 1332, 1409, - /* 470 */ 1304, 344, 340, 30, 28, 366, 381, 365, 1354, 1262, - /* 480 */ 356, 244, 69, 896, 1262, 7, 95, 367, 1229, 303, - /* 490 */ 1262, 1262, 443, 442, 381, 124, 353, 1262, 1165, 894, - /* 500 */ 190, 126, 125, 211, 1289, 1290, 1293, 1262, 447, 30, - /* 510 */ 28, 997, 358, 1074, 1073, 93, 1165, 244, 1070, 896, - /* 520 */ 895, 1069, 349, 1397, 1350, 117, 1343, 1344, 416, 1348, - /* 530 */ 7, 919, 1068, 30, 28, 894, 120, 1067, 1066, 55, - /* 540 */ 1395, 244, 1345, 896, 95, 381, 897, 1212, 900, 901, - /* 550 */ 210, 258, 944, 447, 1288, 1262, 1262, 1158, 1233, 894, - /* 560 */ 1262, 1065, 1064, 1262, 1063, 895, 7, 1165, 917, 198, - /* 570 */ 121, 203, 1195, 93, 1262, 1304, 205, 1062, 141, 1262, - /* 580 */ 1262, 139, 365, 118, 1343, 1344, 1288, 1348, 204, 447, - /* 590 */ 1, 897, 367, 900, 901, 210, 1262, 944, 127, 1005, - /* 600 */ 1098, 895, 407, 1262, 1262, 918, 1262, 1304, 66, 1289, - /* 610 */ 1290, 1293, 1336, 447, 365, 143, 1335, 1332, 142, 1262, - /* 620 */ 145, 1212, 311, 144, 367, 895, 360, 897, 1262, 900, - /* 630 */ 901, 210, 1211, 944, 1093, 147, 1152, 1288, 146, 1091, - /* 640 */ 66, 1289, 1290, 1293, 1336, 1288, 1148, 355, 363, 1332, - /* 650 */ 322, 897, 364, 900, 901, 210, 313, 944, 1304, 67, - /* 660 */ 406, 316, 996, 320, 101, 365, 1304, 327, 896, 42, - /* 670 */ 904, 160, 1019, 365, 162, 367, 44, 43, 265, 1262, - /* 680 */ 122, 9, 8, 367, 894, 1054, 1055, 1262, 1060, 903, - /* 690 */ 173, 110, 1289, 1290, 1293, 32, 1072, 1130, 968, 66, - /* 700 */ 1289, 1290, 1293, 1336, 336, 1206, 1288, 121, 1333, 81, - /* 710 */ 166, 20, 80, 79, 78, 77, 76, 75, 74, 73, - /* 720 */ 72, 31, 29, 27, 26, 25, 1288, 1304, 294, 354, - /* 730 */ 1410, 1288, 32, 361, 365, 928, 907, 953, 447, 31, - /* 740 */ 29, 27, 26, 25, 367, 1282, 32, 1304, 1262, 880, - /* 750 */ 895, 243, 1304, 179, 365, 906, 181, 1280, 1366, 365, - /* 760 */ 215, 1289, 1290, 1293, 367, 251, 250, 98, 1262, 367, - /* 770 */ 373, 332, 1288, 1262, 350, 909, 897, 1288, 900, 901, - /* 780 */ 215, 1289, 1290, 1293, 1305, 110, 1289, 1290, 1293, 99, - /* 790 */ 2, 902, 187, 1304, 889, 175, 196, 931, 1304, 101, - /* 800 */ 365, 42, 801, 386, 796, 365, 829, 916, 1231, 99, - /* 810 */ 367, 1059, 833, 100, 1262, 367, 839, 241, 101, 1262, - /* 820 */ 123, 838, 245, 278, 1411, 270, 215, 1289, 1290, 1293, - /* 830 */ 277, 215, 1289, 1290, 1293, 90, 89, 88, 87, 86, - /* 840 */ 85, 84, 83, 82, 450, 382, 279, 99, 283, 1288, - /* 850 */ 102, 924, 22, 284, 128, 285, 923, 905, 195, 286, - /* 860 */ 1288, 91, 31, 29, 27, 26, 25, 439, 922, 194, - /* 870 */ 1304, 131, 45, 289, 134, 296, 298, 365, 1155, 775, - /* 880 */ 138, 1304, 301, 910, 326, 913, 901, 367, 365, 71, - /* 890 */ 1151, 1262, 140, 63, 308, 103, 188, 1288, 367, 104, - /* 900 */ 1153, 1149, 1262, 213, 1289, 1290, 1293, 105, 233, 106, - /* 910 */ 152, 921, 155, 328, 216, 1289, 1290, 1293, 1304, 228, - /* 920 */ 329, 337, 371, 1377, 901, 365, 377, 1288, 1367, 1376, - /* 930 */ 165, 5, 1357, 158, 334, 367, 161, 236, 341, 1262, - /* 940 */ 346, 148, 333, 330, 920, 300, 153, 1288, 1304, 4, - /* 950 */ 993, 208, 1289, 1290, 1293, 365, 229, 94, 227, 226, - /* 960 */ 1351, 299, 1142, 168, 33, 367, 302, 362, 1304, 1262, - /* 970 */ 1288, 238, 113, 359, 17, 365, 167, 1240, 1318, 369, - /* 980 */ 370, 217, 1289, 1290, 1293, 367, 374, 183, 1239, 1262, - /* 990 */ 174, 1304, 1394, 246, 1288, 1412, 375, 376, 365, 197, - /* 1000 */ 1288, 209, 1289, 1290, 1293, 56, 185, 54, 367, 1166, - /* 1010 */ 384, 199, 1262, 413, 427, 1304, 193, 446, 202, 191, - /* 1020 */ 39, 1304, 365, 412, 218, 1289, 1290, 1293, 365, 206, - /* 1030 */ 1256, 207, 367, 201, 892, 1250, 1262, 1249, 367, 891, - /* 1040 */ 263, 1288, 1262, 264, 414, 1248, 1247, 863, 1301, 1289, - /* 1050 */ 1290, 1293, 1288, 1224, 1300, 1289, 1290, 1293, 1140, 1223, - /* 1060 */ 97, 1222, 1304, 411, 410, 409, 1221, 408, 1220, 365, - /* 1070 */ 1219, 1218, 1217, 1304, 865, 1216, 1215, 1214, 1213, 367, - /* 1080 */ 365, 1104, 1246, 1262, 1237, 130, 1144, 745, 1103, 1288, - /* 1090 */ 367, 1101, 290, 291, 1262, 1299, 1289, 1290, 1293, 292, - /* 1100 */ 1288, 1090, 1089, 1086, 1146, 70, 224, 1289, 1290, 1293, - /* 1110 */ 1304, 846, 137, 1145, 426, 191, 844, 365, 774, 412, - /* 1120 */ 1099, 1304, 230, 773, 1094, 772, 1092, 367, 365, 231, - /* 1130 */ 1288, 1262, 314, 771, 769, 768, 232, 317, 367, 1085, - /* 1140 */ 414, 319, 1262, 223, 1289, 1290, 1293, 1084, 68, 321, - /* 1150 */ 1245, 1304, 1288, 1244, 225, 1289, 1290, 1293, 365, 411, - /* 1160 */ 410, 409, 36, 408, 1236, 154, 156, 48, 367, 14, - /* 1170 */ 1280, 15, 1262, 1304, 111, 3, 32, 37, 34, 10, - /* 1180 */ 365, 159, 1018, 164, 222, 1289, 1290, 1293, 136, 51, - /* 1190 */ 367, 114, 163, 8, 1262, 1012, 170, 293, 49, 135, - /* 1200 */ 1011, 50, 19, 990, 989, 35, 212, 1289, 1290, 1293, - /* 1210 */ 1045, 310, 119, 305, 1040, 16, 309, 1039, 239, 149, - /* 1220 */ 1044, 306, 304, 47, 307, 1043, 133, 240, 929, 13, - /* 1230 */ 177, 178, 18, 1235, 186, 1016, 180, 182, 954, 52, - /* 1240 */ 184, 372, 53, 911, 38, 57, 385, 830, 253, 389, - /* 1250 */ 1279, 827, 189, 387, 383, 390, 392, 395, 824, 393, - /* 1260 */ 398, 807, 818, 396, 841, 816, 822, 399, 837, 58, - /* 1270 */ 59, 60, 132, 835, 765, 743, 129, 821, 415, 764, - /* 1280 */ 763, 405, 840, 762, 761, 760, 759, 820, 758, 757, - /* 1290 */ 819, 776, 755, 754, 753, 752, 751, 750, 749, 748, - /* 1300 */ 1100, 436, 437, 1088, 1087, 438, 440, 441, 1083, 444, - /* 1310 */ 445, 1058, 898, 200, 448, 449, + /* 0 */ 1398, 24, 191, 442, 442, 504, 503, 253, 1307, 72, + /* 10 */ 72, 270, 1394, 1401, 252, 307, 349, 355, 233, 1305, + /* 20 */ 1010, 1197, 1155, 442, 1398, 1260, 1260, 319, 1398, 305, + /* 30 */ 331, 31, 29, 27, 26, 25, 1394, 1400, 429, 332, + /* 40 */ 1394, 1400, 234, 84, 1348, 1260, 83, 82, 81, 80, + /* 50 */ 79, 78, 77, 76, 75, 273, 31, 29, 27, 26, + /* 60 */ 25, 429, 1338, 1340, 265, 213, 236, 1347, 1290, 441, + /* 70 */ 496, 495, 494, 493, 492, 491, 490, 489, 207, 486, + /* 80 */ 485, 484, 483, 482, 481, 480, 479, 478, 998, 1026, + /* 90 */ 31, 29, 27, 26, 25, 84, 441, 1056, 83, 82, + /* 100 */ 81, 80, 79, 78, 77, 76, 75, 330, 1154, 442, + /* 110 */ 325, 324, 323, 322, 321, 306, 318, 317, 316, 315, + /* 120 */ 311, 310, 309, 308, 442, 236, 27, 26, 25, 340, + /* 130 */ 312, 1260, 93, 92, 91, 90, 89, 88, 87, 86, + /* 140 */ 85, 1428, 362, 1057, 357, 12, 1260, 361, 426, 1012, + /* 150 */ 160, 442, 358, 356, 1001, 359, 1056, 313, 404, 399, + /* 160 */ 410, 1061, 874, 465, 464, 463, 878, 462, 880, 881, + /* 170 */ 461, 883, 458, 1260, 889, 455, 891, 892, 452, 449, + /* 180 */ 400, 126, 98, 1010, 23, 260, 1051, 1052, 1053, 1054, + /* 190 */ 1055, 1059, 1060, 20, 112, 1412, 300, 1013, 299, 219, + /* 200 */ 385, 266, 1057, 31, 29, 27, 26, 25, 442, 111, + /* 210 */ 111, 217, 405, 401, 339, 96, 1428, 1262, 1263, 292, + /* 220 */ 1061, 136, 1251, 426, 412, 121, 1467, 1468, 1177, 1472, + /* 230 */ 1260, 477, 301, 428, 294, 126, 113, 1385, 1166, 1412, + /* 240 */ 1011, 386, 414, 23, 260, 1051, 1052, 1053, 1054, 1055, + /* 250 */ 1059, 1060, 126, 68, 1413, 1414, 1417, 1460, 30, 28, + /* 260 */ 1428, 235, 1456, 1521, 1385, 442, 262, 426, 990, 468, + /* 270 */ 1385, 1257, 1521, 1521, 1249, 1412, 125, 428, 990, 159, + /* 280 */ 1519, 1385, 67, 352, 988, 125, 125, 1260, 1117, 1519, + /* 290 */ 1519, 1374, 49, 11, 988, 6, 1428, 70, 1413, 1414, + /* 300 */ 1417, 1460, 95, 413, 354, 1459, 1456, 45, 44, 304, + /* 310 */ 1255, 130, 1245, 428, 1200, 1, 298, 1385, 396, 1115, + /* 320 */ 1116, 1118, 1119, 410, 242, 442, 290, 284, 286, 282, + /* 330 */ 127, 439, 441, 69, 1413, 1414, 1417, 1460, 508, 126, + /* 340 */ 326, 255, 1456, 120, 1428, 98, 1247, 1260, 508, 49, + /* 350 */ 989, 426, 126, 442, 1014, 187, 30, 28, 1093, 440, + /* 360 */ 989, 392, 1487, 362, 262, 357, 990, 1256, 361, 30, + /* 370 */ 28, 160, 1412, 358, 356, 1260, 359, 262, 96, 990, + /* 380 */ 1243, 12, 988, 403, 991, 135, 134, 1176, 122, 1467, + /* 390 */ 1468, 11, 1472, 1428, 991, 988, 9, 8, 117, 1238, + /* 400 */ 413, 994, 995, 224, 11, 1039, 114, 272, 1224, 1300, + /* 410 */ 428, 994, 995, 1, 1385, 111, 1412, 31, 29, 27, + /* 420 */ 26, 25, 126, 1262, 65, 1412, 1, 1088, 1152, 1385, + /* 430 */ 69, 1413, 1414, 1417, 1460, 99, 508, 1428, 255, 1456, + /* 440 */ 120, 1307, 1252, 1521, 426, 340, 1428, 267, 989, 508, + /* 450 */ 165, 1307, 1305, 426, 428, 1058, 1520, 274, 1385, 1488, + /* 460 */ 1519, 989, 1305, 428, 186, 1069, 1038, 1385, 1040, 1041, + /* 470 */ 1042, 1043, 1044, 1062, 227, 1413, 1414, 1417, 277, 467, + /* 480 */ 30, 28, 991, 69, 1413, 1414, 1417, 1460, 262, 1412, + /* 490 */ 990, 255, 1456, 1533, 131, 991, 21, 1175, 1236, 994, + /* 500 */ 995, 224, 1494, 1039, 1412, 384, 988, 275, 417, 1521, + /* 510 */ 1428, 1174, 994, 995, 224, 111, 1039, 426, 47, 410, + /* 520 */ 1015, 46, 125, 1262, 1307, 1428, 1519, 428, 1173, 798, + /* 530 */ 1092, 1385, 426, 1412, 1474, 1339, 1147, 7, 799, 1385, + /* 540 */ 798, 98, 428, 1167, 477, 347, 1385, 69, 1413, 1414, + /* 550 */ 1417, 1460, 1471, 1385, 1428, 255, 1456, 1533, 800, 188, + /* 560 */ 508, 426, 230, 1413, 1414, 1417, 1517, 1100, 1225, 1172, + /* 570 */ 1385, 428, 989, 1012, 96, 1385, 442, 1171, 1474, 30, + /* 580 */ 28, 427, 205, 1335, 123, 1467, 1468, 262, 1472, 990, + /* 590 */ 133, 69, 1413, 1414, 1417, 1460, 1470, 1170, 1260, 255, + /* 600 */ 1456, 1533, 1146, 1474, 22, 988, 991, 1412, 1169, 376, + /* 610 */ 1478, 1385, 30, 28, 31, 29, 27, 26, 25, 1385, + /* 620 */ 262, 1469, 990, 994, 995, 224, 442, 1039, 1428, 58, + /* 630 */ 172, 1168, 276, 1165, 1164, 426, 7, 1163, 988, 1385, + /* 640 */ 1521, 1162, 1161, 487, 126, 428, 295, 1253, 1260, 1385, + /* 650 */ 1385, 269, 268, 125, 414, 1479, 1088, 1519, 1160, 508, + /* 660 */ 418, 1003, 30, 28, 511, 225, 1413, 1414, 1417, 7, + /* 670 */ 262, 989, 990, 1385, 421, 1385, 1385, 996, 210, 1385, + /* 680 */ 397, 94, 1307, 1385, 1385, 1521, 1159, 500, 988, 209, + /* 690 */ 1158, 1157, 508, 1306, 9, 8, 152, 416, 125, 150, + /* 700 */ 1385, 1301, 1519, 1091, 989, 991, 1412, 154, 156, 158, + /* 710 */ 153, 155, 157, 66, 1193, 1188, 203, 1186, 104, 1, + /* 720 */ 425, 388, 994, 995, 224, 64, 1039, 1428, 1385, 1149, + /* 730 */ 1150, 443, 1385, 1385, 426, 60, 363, 365, 991, 368, + /* 740 */ 181, 1405, 508, 999, 428, 374, 438, 43, 1385, 175, + /* 750 */ 1114, 997, 177, 1403, 989, 994, 995, 224, 372, 1039, + /* 760 */ 410, 346, 1412, 411, 70, 1413, 1414, 1417, 1460, 1490, + /* 770 */ 1429, 391, 424, 1456, 168, 32, 32, 1004, 1063, 1023, + /* 780 */ 190, 1010, 98, 1428, 2, 279, 283, 419, 991, 974, + /* 790 */ 426, 164, 241, 841, 1007, 995, 32, 243, 966, 957, + /* 800 */ 428, 414, 314, 422, 1385, 994, 995, 224, 211, 1039, + /* 810 */ 1412, 194, 132, 101, 196, 96, 434, 1000, 1337, 320, + /* 820 */ 115, 1413, 1414, 1417, 328, 184, 1467, 409, 1048, 408, + /* 830 */ 333, 1428, 1521, 31, 29, 27, 26, 25, 426, 102, + /* 840 */ 1019, 246, 202, 104, 147, 125, 867, 119, 428, 1519, + /* 850 */ 327, 43, 1385, 345, 862, 146, 329, 447, 415, 1534, + /* 860 */ 895, 334, 102, 159, 1412, 899, 335, 352, 70, 1413, + /* 870 */ 1414, 1417, 1460, 1412, 1018, 336, 139, 1457, 247, 50, + /* 880 */ 245, 244, 144, 351, 103, 1428, 337, 905, 354, 1017, + /* 890 */ 104, 1026, 426, 904, 1428, 102, 338, 142, 105, 48, + /* 900 */ 341, 426, 428, 145, 1016, 348, 1385, 1412, 350, 261, + /* 910 */ 377, 428, 353, 1250, 149, 1385, 74, 1246, 393, 151, + /* 920 */ 106, 107, 229, 1413, 1414, 1417, 1248, 1244, 1428, 108, + /* 930 */ 109, 229, 1413, 1414, 1417, 426, 143, 360, 138, 251, + /* 940 */ 140, 379, 378, 1412, 167, 428, 170, 1015, 389, 1385, + /* 950 */ 398, 1412, 383, 1501, 367, 390, 995, 137, 432, 1500, + /* 960 */ 5, 387, 380, 1481, 1428, 228, 1413, 1414, 1417, 375, + /* 970 */ 407, 426, 1428, 173, 395, 4, 254, 1412, 176, 426, + /* 980 */ 1491, 428, 402, 162, 394, 1385, 370, 1088, 97, 428, + /* 990 */ 1014, 364, 1237, 1385, 161, 33, 259, 406, 1428, 1235, + /* 1000 */ 1475, 115, 1413, 1414, 1417, 426, 1412, 118, 180, 229, + /* 1010 */ 1413, 1414, 1417, 256, 183, 428, 1518, 182, 41, 1385, + /* 1020 */ 423, 40, 263, 420, 189, 1536, 17, 1428, 1442, 1346, + /* 1030 */ 1412, 430, 431, 264, 426, 229, 1413, 1414, 1417, 1345, + /* 1040 */ 1535, 435, 436, 200, 428, 198, 437, 57, 1385, 206, + /* 1050 */ 212, 1428, 59, 473, 1412, 474, 206, 488, 426, 1261, + /* 1060 */ 473, 445, 214, 507, 222, 1413, 1414, 1417, 428, 208, + /* 1070 */ 220, 39, 1385, 216, 475, 1428, 1379, 221, 1412, 218, + /* 1080 */ 1378, 475, 426, 278, 1375, 280, 281, 984, 231, 1413, + /* 1090 */ 1414, 1417, 428, 472, 471, 470, 1385, 469, 985, 1428, + /* 1100 */ 472, 471, 470, 128, 469, 285, 426, 1412, 1373, 287, + /* 1110 */ 288, 289, 223, 1413, 1414, 1417, 428, 1372, 1371, 291, + /* 1120 */ 1385, 293, 1362, 129, 296, 297, 969, 968, 1428, 1356, + /* 1130 */ 1355, 303, 302, 1412, 1354, 426, 232, 1413, 1414, 1417, + /* 1140 */ 1353, 1412, 940, 1330, 1329, 428, 1328, 1327, 1326, 1385, + /* 1150 */ 1325, 1324, 1323, 1322, 1428, 1321, 1320, 1319, 1318, 100, + /* 1160 */ 1317, 426, 1428, 1316, 1315, 1425, 1413, 1414, 1417, 426, + /* 1170 */ 1314, 428, 1313, 1312, 1311, 1385, 1412, 1310, 1309, 428, + /* 1180 */ 1308, 942, 1412, 1385, 1199, 1370, 1364, 1352, 1343, 1239, + /* 1190 */ 811, 1424, 1413, 1414, 1417, 1198, 1196, 1428, 1185, 1423, + /* 1200 */ 1413, 1414, 1417, 1428, 426, 141, 342, 343, 344, 1184, + /* 1210 */ 426, 1412, 1181, 1241, 428, 73, 487, 1412, 1385, 912, + /* 1220 */ 428, 148, 910, 1240, 1385, 1194, 248, 1189, 840, 839, + /* 1230 */ 838, 837, 1428, 249, 239, 1413, 1414, 1417, 1428, 426, + /* 1240 */ 238, 1413, 1414, 1417, 835, 426, 834, 1187, 250, 428, + /* 1250 */ 1180, 371, 369, 1385, 366, 428, 1179, 373, 71, 1385, + /* 1260 */ 1369, 42, 163, 1412, 1363, 381, 976, 110, 382, 240, + /* 1270 */ 1413, 1414, 1417, 1351, 1350, 237, 1413, 1414, 1417, 1342, + /* 1280 */ 169, 166, 14, 1403, 1428, 51, 171, 3, 32, 174, + /* 1290 */ 15, 426, 1113, 116, 34, 54, 36, 37, 185, 124, + /* 1300 */ 178, 428, 1107, 52, 1135, 1385, 1106, 179, 53, 19, + /* 1310 */ 1134, 1085, 35, 10, 1084, 16, 1140, 8, 257, 1139, + /* 1320 */ 1138, 226, 1413, 1414, 1417, 258, 1341, 1024, 13, 433, + /* 1330 */ 1049, 18, 192, 193, 60, 1111, 195, 197, 55, 199, + /* 1340 */ 56, 1005, 1402, 446, 38, 271, 450, 896, 893, 453, + /* 1350 */ 456, 204, 448, 451, 459, 890, 444, 454, 201, 884, + /* 1360 */ 882, 457, 460, 873, 901, 907, 903, 61, 809, 476, + /* 1370 */ 62, 63, 831, 830, 829, 828, 827, 826, 825, 823, + /* 1380 */ 888, 466, 824, 842, 821, 820, 819, 818, 887, 886, + /* 1390 */ 817, 885, 816, 815, 814, 1195, 497, 498, 1183, 1182, + /* 1400 */ 501, 502, 499, 1178, 906, 505, 506, 1153, 992, 215, + /* 1410 */ 509, 510, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 224, 220, 182, 204, 223, 256, 190, 226, 232, 233, - /* 10 */ 203, 182, 12, 13, 14, 15, 16, 210, 269, 181, - /* 20 */ 188, 183, 273, 203, 208, 12, 13, 14, 15, 16, - /* 30 */ 210, 20, 203, 12, 13, 14, 15, 16, 207, 210, - /* 40 */ 220, 204, 210, 20, 224, 238, 22, 47, 0, 220, - /* 50 */ 14, 15, 16, 224, 203, 224, 236, 237, 238, 239, - /* 60 */ 47, 210, 38, 232, 233, 236, 237, 238, 239, 240, - /* 70 */ 70, 239, 20, 244, 245, 246, 241, 242, 78, 0, - /* 80 */ 248, 249, 250, 251, 203, 253, 69, 258, 268, 238, - /* 90 */ 209, 78, 69, 264, 265, 214, 79, 49, 50, 51, - /* 100 */ 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, - /* 110 */ 62, 63, 64, 65, 66, 21, 116, 190, 24, 25, - /* 120 */ 26, 27, 28, 29, 30, 31, 32, 200, 49, 116, - /* 130 */ 51, 188, 20, 54, 22, 208, 57, 194, 59, 60, - /* 140 */ 188, 62, 142, 143, 144, 145, 146, 147, 148, 149, - /* 150 */ 150, 151, 40, 210, 182, 142, 143, 144, 145, 146, - /* 160 */ 147, 148, 149, 150, 151, 182, 20, 215, 179, 12, - /* 170 */ 13, 14, 15, 16, 122, 83, 84, 85, 86, 87, - /* 180 */ 88, 89, 90, 91, 92, 93, 203, 95, 96, 97, - /* 190 */ 98, 99, 100, 210, 202, 0, 224, 20, 12, 13, - /* 200 */ 129, 182, 131, 220, 188, 213, 20, 224, 22, 182, - /* 210 */ 194, 135, 229, 137, 138, 139, 140, 141, 229, 236, - /* 220 */ 237, 238, 239, 240, 38, 154, 210, 244, 245, 191, - /* 230 */ 203, 193, 195, 47, 12, 13, 14, 210, 20, 256, - /* 240 */ 203, 46, 20, 224, 22, 256, 69, 220, 211, 12, - /* 250 */ 13, 224, 269, 203, 132, 69, 273, 20, 269, 22, - /* 260 */ 38, 211, 273, 236, 237, 238, 239, 240, 203, 47, - /* 270 */ 203, 244, 245, 246, 209, 38, 209, 234, 92, 214, - /* 280 */ 123, 214, 207, 188, 47, 163, 164, 165, 166, 167, - /* 290 */ 104, 69, 265, 182, 20, 252, 4, 152, 153, 224, - /* 300 */ 154, 27, 212, 229, 30, 210, 69, 232, 233, 219, - /* 310 */ 220, 19, 43, 39, 92, 188, 130, 188, 132, 133, - /* 320 */ 134, 194, 136, 194, 229, 33, 104, 116, 36, 92, - /* 330 */ 256, 154, 175, 41, 239, 224, 44, 210, 182, 210, - /* 340 */ 154, 104, 46, 269, 249, 250, 251, 273, 253, 195, - /* 350 */ 20, 256, 130, 142, 132, 133, 134, 203, 136, 203, - /* 360 */ 68, 182, 151, 71, 269, 211, 210, 130, 273, 132, - /* 370 */ 133, 134, 188, 136, 20, 195, 220, 1, 2, 187, - /* 380 */ 224, 107, 203, 203, 110, 111, 112, 113, 114, 210, - /* 390 */ 198, 211, 236, 237, 238, 239, 240, 205, 188, 220, - /* 400 */ 244, 245, 246, 224, 194, 182, 57, 67, 188, 182, - /* 410 */ 61, 255, 0, 229, 194, 236, 237, 238, 239, 240, - /* 420 */ 210, 201, 153, 244, 245, 246, 203, 234, 12, 13, - /* 430 */ 210, 82, 120, 210, 255, 220, 20, 182, 22, 154, - /* 440 */ 256, 226, 182, 220, 188, 252, 70, 224, 182, 182, - /* 450 */ 194, 224, 122, 269, 38, 182, 63, 273, 46, 236, - /* 460 */ 237, 238, 239, 240, 188, 182, 210, 244, 245, 246, - /* 470 */ 203, 159, 160, 12, 13, 14, 188, 210, 255, 224, - /* 480 */ 3, 20, 194, 22, 224, 69, 210, 220, 210, 201, - /* 490 */ 224, 224, 185, 186, 188, 217, 229, 224, 210, 38, - /* 500 */ 194, 108, 109, 236, 237, 238, 239, 224, 92, 12, - /* 510 */ 13, 4, 172, 182, 182, 239, 210, 20, 182, 22, - /* 520 */ 104, 182, 188, 256, 234, 249, 250, 251, 46, 253, - /* 530 */ 69, 20, 182, 12, 13, 38, 269, 182, 182, 187, - /* 540 */ 273, 20, 252, 22, 210, 188, 130, 203, 132, 133, - /* 550 */ 134, 194, 136, 92, 182, 224, 224, 205, 214, 38, - /* 560 */ 224, 182, 182, 224, 182, 104, 69, 210, 20, 196, - /* 570 */ 154, 18, 199, 239, 224, 203, 23, 182, 73, 224, - /* 580 */ 224, 76, 210, 249, 250, 251, 182, 253, 35, 92, - /* 590 */ 69, 130, 220, 132, 133, 134, 224, 136, 45, 14, - /* 600 */ 0, 104, 80, 224, 224, 20, 224, 203, 236, 237, - /* 610 */ 238, 239, 240, 92, 210, 73, 244, 245, 76, 224, - /* 620 */ 73, 203, 22, 76, 220, 104, 67, 130, 224, 132, - /* 630 */ 133, 134, 214, 136, 0, 73, 204, 182, 76, 0, - /* 640 */ 236, 237, 238, 239, 240, 182, 204, 170, 244, 245, - /* 650 */ 21, 130, 47, 132, 133, 134, 22, 136, 203, 106, - /* 660 */ 204, 22, 155, 34, 67, 210, 203, 70, 22, 67, - /* 670 */ 38, 67, 70, 210, 70, 220, 123, 124, 125, 224, - /* 680 */ 127, 1, 2, 220, 38, 177, 178, 224, 0, 38, - /* 690 */ 276, 236, 237, 238, 239, 67, 183, 193, 70, 236, - /* 700 */ 237, 238, 239, 240, 267, 213, 182, 154, 245, 21, - /* 710 */ 261, 2, 24, 25, 26, 27, 28, 29, 30, 31, - /* 720 */ 32, 12, 13, 14, 15, 16, 182, 203, 185, 274, - /* 730 */ 275, 182, 67, 174, 210, 70, 104, 132, 92, 12, - /* 740 */ 13, 14, 15, 16, 220, 69, 67, 203, 224, 70, - /* 750 */ 104, 227, 203, 67, 210, 104, 70, 81, 235, 210, - /* 760 */ 236, 237, 238, 239, 220, 12, 13, 67, 224, 220, - /* 770 */ 70, 227, 182, 224, 254, 22, 130, 182, 132, 133, - /* 780 */ 236, 237, 238, 239, 203, 236, 237, 238, 239, 67, - /* 790 */ 257, 38, 70, 203, 128, 270, 230, 70, 203, 67, - /* 800 */ 210, 67, 70, 67, 70, 210, 70, 20, 188, 67, - /* 810 */ 220, 0, 70, 67, 224, 220, 70, 227, 67, 224, - /* 820 */ 115, 70, 227, 116, 275, 218, 236, 237, 238, 239, - /* 830 */ 216, 236, 237, 238, 239, 24, 25, 26, 27, 28, - /* 840 */ 29, 30, 31, 32, 19, 92, 216, 67, 188, 182, - /* 850 */ 70, 20, 2, 228, 190, 210, 20, 104, 33, 221, - /* 860 */ 182, 36, 12, 13, 14, 15, 16, 42, 20, 44, - /* 870 */ 203, 190, 190, 188, 190, 184, 203, 210, 203, 38, - /* 880 */ 203, 203, 192, 130, 228, 132, 133, 220, 210, 188, - /* 890 */ 203, 224, 203, 68, 192, 203, 71, 182, 220, 203, - /* 900 */ 203, 203, 224, 236, 237, 238, 239, 203, 184, 203, - /* 910 */ 187, 20, 187, 210, 236, 237, 238, 239, 203, 35, - /* 920 */ 221, 162, 161, 266, 133, 210, 101, 182, 235, 266, - /* 930 */ 262, 169, 263, 225, 224, 220, 225, 224, 224, 224, - /* 940 */ 168, 57, 157, 118, 20, 61, 121, 182, 203, 156, - /* 950 */ 153, 236, 237, 238, 239, 210, 72, 210, 74, 75, - /* 960 */ 234, 77, 0, 247, 115, 220, 82, 173, 203, 224, - /* 970 */ 182, 176, 260, 171, 69, 210, 259, 225, 243, 224, - /* 980 */ 224, 236, 237, 238, 239, 220, 119, 210, 225, 224, - /* 990 */ 271, 203, 272, 224, 182, 277, 222, 221, 210, 199, - /* 1000 */ 182, 236, 237, 238, 239, 69, 187, 187, 220, 210, - /* 1010 */ 206, 188, 224, 192, 192, 203, 187, 184, 180, 57, - /* 1020 */ 231, 203, 210, 61, 236, 237, 238, 239, 210, 197, - /* 1030 */ 0, 197, 220, 189, 104, 0, 224, 0, 220, 130, - /* 1040 */ 50, 182, 224, 126, 82, 0, 0, 81, 236, 237, - /* 1050 */ 238, 239, 182, 0, 236, 237, 238, 239, 0, 0, - /* 1060 */ 115, 0, 203, 101, 102, 103, 0, 105, 0, 210, - /* 1070 */ 0, 0, 0, 203, 22, 0, 0, 0, 0, 220, - /* 1080 */ 210, 0, 0, 224, 0, 43, 0, 48, 0, 182, - /* 1090 */ 220, 0, 38, 36, 224, 236, 237, 238, 239, 43, - /* 1100 */ 182, 0, 0, 0, 0, 78, 236, 237, 238, 239, - /* 1110 */ 203, 38, 76, 0, 67, 57, 22, 210, 38, 61, - /* 1120 */ 0, 203, 22, 38, 0, 38, 0, 220, 210, 22, - /* 1130 */ 182, 224, 39, 38, 38, 38, 22, 38, 220, 0, - /* 1140 */ 82, 22, 224, 236, 237, 238, 239, 0, 20, 22, - /* 1150 */ 0, 203, 182, 0, 236, 237, 238, 239, 210, 101, - /* 1160 */ 102, 103, 122, 105, 0, 43, 117, 69, 220, 158, - /* 1170 */ 81, 158, 224, 203, 69, 67, 67, 67, 152, 158, - /* 1180 */ 210, 70, 70, 67, 236, 237, 238, 239, 33, 4, - /* 1190 */ 220, 36, 69, 2, 224, 70, 81, 42, 69, 44, - /* 1200 */ 70, 69, 67, 70, 70, 67, 236, 237, 238, 239, - /* 1210 */ 70, 49, 81, 51, 38, 67, 54, 38, 38, 57, - /* 1220 */ 38, 59, 60, 68, 62, 38, 71, 38, 70, 69, - /* 1230 */ 81, 70, 69, 0, 117, 70, 69, 69, 132, 69, - /* 1240 */ 43, 120, 69, 22, 69, 79, 38, 70, 38, 38, - /* 1250 */ 81, 70, 81, 69, 80, 69, 38, 38, 70, 69, - /* 1260 */ 38, 22, 70, 69, 38, 70, 94, 69, 38, 69, - /* 1270 */ 69, 69, 117, 22, 22, 48, 121, 94, 47, 38, - /* 1280 */ 38, 82, 104, 38, 38, 38, 38, 94, 38, 22, - /* 1290 */ 94, 38, 38, 38, 38, 38, 38, 38, 38, 38, - /* 1300 */ 0, 38, 36, 0, 0, 43, 38, 37, 0, 22, - /* 1310 */ 21, 278, 22, 22, 21, 20, 278, 278, 278, 278, - /* 1320 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, - /* 1330 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, - /* 1340 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, - /* 1350 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, - /* 1360 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, - /* 1370 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, - /* 1380 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, - /* 1390 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, - /* 1400 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, - /* 1410 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, - /* 1420 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, - /* 1430 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, - /* 1440 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, - /* 1450 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, - /* 1460 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, - /* 1470 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, - /* 1480 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, - /* 1490 */ 278, 278, 278, 278, 278, + /* 0 */ 246, 267, 268, 210, 210, 207, 208, 229, 225, 216, + /* 10 */ 216, 229, 258, 259, 231, 210, 223, 223, 18, 236, + /* 20 */ 20, 0, 0, 210, 246, 232, 232, 27, 246, 216, + /* 30 */ 30, 12, 13, 14, 15, 16, 258, 259, 242, 39, + /* 40 */ 258, 259, 237, 21, 248, 232, 24, 25, 26, 27, + /* 50 */ 28, 29, 30, 31, 32, 234, 12, 13, 14, 15, + /* 60 */ 16, 242, 241, 242, 245, 218, 47, 248, 221, 20, + /* 70 */ 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + /* 80 */ 59, 60, 61, 62, 63, 64, 65, 66, 38, 70, + /* 90 */ 12, 13, 14, 15, 16, 21, 20, 78, 24, 25, + /* 100 */ 26, 27, 28, 29, 30, 31, 32, 107, 0, 210, + /* 110 */ 110, 111, 112, 113, 114, 216, 116, 117, 118, 119, + /* 120 */ 120, 121, 122, 123, 210, 47, 14, 15, 16, 46, + /* 130 */ 216, 232, 24, 25, 26, 27, 28, 29, 30, 31, + /* 140 */ 32, 225, 49, 124, 51, 69, 232, 54, 232, 20, + /* 150 */ 57, 210, 59, 60, 104, 62, 78, 216, 20, 128, + /* 160 */ 210, 142, 83, 84, 85, 86, 87, 88, 89, 90, + /* 170 */ 91, 92, 93, 232, 95, 96, 97, 98, 99, 100, + /* 180 */ 264, 176, 232, 20, 165, 166, 167, 168, 169, 170, + /* 190 */ 171, 172, 173, 2, 18, 204, 137, 20, 139, 23, + /* 200 */ 210, 217, 124, 12, 13, 14, 15, 16, 210, 225, + /* 210 */ 225, 35, 181, 182, 216, 265, 225, 233, 233, 134, + /* 220 */ 142, 45, 204, 232, 274, 275, 276, 277, 204, 279, + /* 230 */ 232, 46, 251, 242, 149, 176, 203, 246, 205, 204, + /* 240 */ 20, 251, 251, 165, 166, 167, 168, 169, 170, 171, + /* 250 */ 172, 173, 176, 262, 263, 264, 265, 266, 12, 13, + /* 260 */ 225, 270, 271, 282, 246, 210, 20, 232, 22, 80, + /* 270 */ 246, 216, 282, 282, 226, 204, 295, 242, 22, 57, + /* 280 */ 299, 246, 106, 61, 38, 295, 295, 232, 155, 299, + /* 290 */ 299, 0, 212, 47, 38, 43, 225, 262, 263, 264, + /* 300 */ 265, 266, 222, 232, 82, 270, 271, 131, 132, 133, + /* 310 */ 230, 135, 226, 242, 0, 69, 140, 246, 185, 186, + /* 320 */ 187, 188, 189, 210, 148, 210, 150, 36, 152, 153, + /* 330 */ 154, 216, 20, 262, 263, 264, 265, 266, 92, 176, + /* 340 */ 63, 270, 271, 272, 225, 232, 226, 232, 92, 212, + /* 350 */ 104, 232, 176, 210, 20, 284, 12, 13, 14, 216, + /* 360 */ 104, 290, 291, 49, 20, 51, 22, 230, 54, 12, + /* 370 */ 13, 57, 204, 59, 60, 232, 62, 20, 265, 22, + /* 380 */ 226, 69, 38, 264, 138, 108, 109, 204, 275, 276, + /* 390 */ 277, 47, 279, 225, 138, 38, 1, 2, 224, 0, + /* 400 */ 232, 155, 156, 157, 47, 159, 213, 217, 215, 235, + /* 410 */ 242, 155, 156, 69, 246, 225, 204, 12, 13, 14, + /* 420 */ 15, 16, 176, 233, 209, 204, 69, 175, 201, 246, + /* 430 */ 262, 263, 264, 265, 266, 220, 92, 225, 270, 271, + /* 440 */ 272, 225, 227, 282, 232, 46, 225, 231, 104, 92, + /* 450 */ 226, 225, 236, 232, 242, 124, 295, 231, 246, 291, + /* 460 */ 299, 104, 236, 242, 130, 70, 158, 246, 160, 161, + /* 470 */ 162, 163, 164, 142, 262, 263, 264, 265, 251, 226, + /* 480 */ 12, 13, 138, 262, 263, 264, 265, 266, 20, 204, + /* 490 */ 22, 270, 271, 272, 44, 138, 165, 204, 0, 155, + /* 500 */ 156, 157, 281, 159, 204, 254, 38, 217, 3, 282, + /* 510 */ 225, 204, 155, 156, 157, 225, 159, 232, 68, 210, + /* 520 */ 20, 71, 295, 233, 225, 225, 299, 242, 204, 22, + /* 530 */ 4, 246, 232, 204, 260, 236, 131, 69, 20, 246, + /* 540 */ 22, 232, 242, 205, 46, 38, 246, 262, 263, 264, + /* 550 */ 265, 266, 278, 246, 225, 270, 271, 272, 40, 302, + /* 560 */ 92, 232, 262, 263, 264, 265, 281, 14, 215, 204, + /* 570 */ 246, 242, 104, 20, 265, 246, 210, 204, 260, 12, + /* 580 */ 13, 14, 216, 232, 275, 276, 277, 20, 279, 22, + /* 590 */ 239, 262, 263, 264, 265, 266, 278, 204, 232, 270, + /* 600 */ 271, 272, 197, 260, 2, 38, 138, 204, 204, 251, + /* 610 */ 281, 246, 12, 13, 12, 13, 14, 15, 16, 246, + /* 620 */ 20, 278, 22, 155, 156, 157, 210, 159, 225, 209, + /* 630 */ 130, 204, 216, 204, 204, 232, 69, 204, 38, 246, + /* 640 */ 282, 204, 204, 67, 176, 242, 70, 227, 232, 246, + /* 650 */ 246, 12, 13, 295, 251, 174, 175, 299, 204, 92, + /* 660 */ 67, 22, 12, 13, 19, 262, 263, 264, 265, 69, + /* 670 */ 20, 104, 22, 246, 67, 246, 246, 38, 33, 246, + /* 680 */ 293, 36, 225, 246, 246, 282, 204, 42, 38, 44, + /* 690 */ 204, 204, 92, 236, 1, 2, 73, 192, 295, 76, + /* 700 */ 246, 235, 299, 177, 104, 138, 204, 73, 73, 73, + /* 710 */ 76, 76, 76, 68, 0, 0, 71, 0, 67, 69, + /* 720 */ 47, 70, 155, 156, 157, 69, 159, 225, 246, 199, + /* 730 */ 200, 92, 246, 246, 232, 79, 22, 22, 138, 22, + /* 740 */ 287, 69, 92, 104, 242, 21, 101, 67, 246, 67, + /* 750 */ 70, 38, 70, 81, 104, 155, 156, 157, 34, 159, + /* 760 */ 210, 207, 204, 280, 262, 263, 264, 265, 266, 261, + /* 770 */ 225, 126, 270, 271, 129, 67, 67, 138, 70, 70, + /* 780 */ 296, 20, 232, 225, 283, 210, 36, 194, 138, 144, + /* 790 */ 232, 146, 257, 38, 155, 156, 67, 214, 136, 70, + /* 800 */ 242, 251, 210, 196, 246, 155, 156, 157, 252, 159, + /* 810 */ 204, 67, 115, 67, 70, 265, 70, 104, 210, 240, + /* 820 */ 262, 263, 264, 265, 124, 275, 276, 277, 155, 279, + /* 830 */ 210, 225, 282, 12, 13, 14, 15, 16, 232, 67, + /* 840 */ 20, 35, 70, 67, 33, 295, 70, 36, 242, 299, + /* 850 */ 238, 67, 246, 42, 70, 44, 238, 67, 300, 301, + /* 860 */ 70, 256, 67, 57, 204, 70, 242, 61, 262, 263, + /* 870 */ 264, 265, 266, 204, 20, 250, 212, 271, 72, 68, + /* 880 */ 74, 75, 71, 77, 67, 225, 232, 70, 82, 20, + /* 890 */ 67, 70, 232, 70, 225, 67, 243, 212, 70, 212, + /* 900 */ 210, 232, 242, 212, 20, 206, 246, 204, 225, 249, + /* 910 */ 232, 242, 214, 225, 225, 246, 210, 225, 249, 225, + /* 920 */ 225, 225, 262, 263, 264, 265, 225, 225, 225, 225, + /* 930 */ 225, 262, 263, 264, 265, 232, 125, 214, 127, 206, + /* 940 */ 129, 145, 256, 204, 209, 242, 209, 20, 232, 246, + /* 950 */ 184, 204, 242, 292, 4, 243, 156, 146, 183, 292, + /* 960 */ 191, 250, 255, 289, 225, 262, 263, 264, 265, 19, + /* 970 */ 190, 232, 225, 247, 246, 178, 246, 204, 247, 232, + /* 980 */ 261, 242, 246, 33, 179, 246, 36, 175, 232, 242, + /* 990 */ 20, 41, 0, 246, 44, 115, 249, 294, 225, 0, + /* 1000 */ 260, 262, 263, 264, 265, 232, 204, 286, 288, 262, + /* 1010 */ 263, 264, 265, 198, 273, 242, 298, 285, 68, 246, + /* 1020 */ 195, 71, 249, 193, 297, 303, 69, 225, 269, 247, + /* 1030 */ 204, 246, 246, 246, 232, 262, 263, 264, 265, 247, + /* 1040 */ 301, 127, 244, 209, 242, 232, 243, 209, 246, 57, + /* 1050 */ 221, 225, 69, 61, 204, 214, 57, 214, 232, 232, + /* 1060 */ 61, 228, 210, 206, 262, 263, 264, 265, 242, 209, + /* 1070 */ 219, 253, 246, 211, 82, 225, 0, 219, 204, 202, + /* 1080 */ 0, 82, 232, 60, 0, 38, 151, 38, 262, 263, + /* 1090 */ 264, 265, 242, 101, 102, 103, 246, 105, 38, 225, + /* 1100 */ 101, 102, 103, 38, 105, 151, 232, 204, 0, 38, + /* 1110 */ 38, 151, 262, 263, 264, 265, 242, 0, 0, 38, + /* 1120 */ 246, 38, 0, 69, 142, 141, 104, 138, 225, 0, + /* 1130 */ 0, 134, 50, 204, 0, 232, 262, 263, 264, 265, + /* 1140 */ 0, 204, 81, 0, 0, 242, 0, 0, 0, 246, + /* 1150 */ 0, 0, 0, 0, 225, 0, 0, 0, 0, 115, + /* 1160 */ 0, 232, 225, 0, 0, 262, 263, 264, 265, 232, + /* 1170 */ 0, 242, 0, 0, 0, 246, 204, 0, 0, 242, + /* 1180 */ 0, 22, 204, 246, 0, 0, 0, 0, 0, 0, + /* 1190 */ 48, 262, 263, 264, 265, 0, 0, 225, 0, 262, + /* 1200 */ 263, 264, 265, 225, 232, 43, 38, 36, 43, 0, + /* 1210 */ 232, 204, 0, 0, 242, 78, 67, 204, 246, 38, + /* 1220 */ 242, 76, 22, 0, 246, 0, 22, 0, 38, 38, + /* 1230 */ 38, 38, 225, 22, 262, 263, 264, 265, 225, 232, + /* 1240 */ 262, 263, 264, 265, 38, 232, 38, 0, 22, 242, + /* 1250 */ 0, 22, 38, 246, 39, 242, 0, 22, 20, 246, + /* 1260 */ 0, 130, 147, 204, 0, 22, 38, 143, 130, 262, + /* 1270 */ 263, 264, 265, 0, 0, 262, 263, 264, 265, 0, + /* 1280 */ 43, 127, 180, 81, 225, 69, 125, 67, 67, 70, + /* 1290 */ 180, 232, 70, 69, 174, 4, 130, 67, 81, 81, + /* 1300 */ 69, 242, 70, 69, 38, 246, 70, 67, 69, 67, + /* 1310 */ 38, 70, 67, 180, 70, 67, 70, 2, 38, 38, + /* 1320 */ 38, 262, 263, 264, 265, 38, 0, 70, 69, 128, + /* 1330 */ 155, 69, 81, 70, 79, 70, 69, 69, 69, 43, + /* 1340 */ 69, 22, 81, 38, 69, 38, 38, 70, 70, 38, + /* 1350 */ 38, 81, 69, 69, 38, 70, 80, 69, 125, 70, + /* 1360 */ 70, 69, 69, 22, 22, 38, 38, 69, 48, 47, + /* 1370 */ 69, 69, 22, 38, 38, 38, 38, 38, 38, 22, + /* 1380 */ 94, 82, 38, 38, 38, 38, 38, 38, 94, 94, + /* 1390 */ 38, 94, 38, 38, 38, 0, 38, 36, 0, 0, + /* 1400 */ 38, 37, 43, 0, 104, 22, 21, 304, 22, 22, + /* 1410 */ 21, 20, 304, 304, 304, 304, 304, 304, 304, 304, + /* 1420 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, + /* 1430 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, + /* 1440 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, + /* 1450 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, + /* 1460 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, + /* 1470 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, + /* 1480 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, + /* 1490 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, + /* 1500 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, + /* 1510 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, + /* 1520 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, + /* 1530 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, + /* 1540 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, + /* 1550 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, + /* 1560 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, + /* 1570 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, + /* 1580 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, + /* 1590 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, + /* 1600 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, + /* 1610 */ 304, 304, 304, }; -#define YY_SHIFT_COUNT (450) +#define YY_SHIFT_COUNT (511) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (1308) +#define YY_SHIFT_MAX (1403) static const unsigned short int yy_shift_ofst[] = { - /* 0 */ 553, 186, 222, 237, 237, 237, 237, 416, 237, 237, - /* 10 */ 497, 521, 177, 461, 497, 497, 497, 497, 497, 497, - /* 20 */ 497, 497, 497, 497, 497, 497, 497, 497, 497, 497, - /* 30 */ 497, 497, 497, 23, 23, 23, 146, 753, 753, 71, - /* 40 */ 11, 11, 753, 11, 11, 11, 11, 296, 218, 354, - /* 50 */ 354, 285, 511, 218, 11, 11, 218, 11, 218, 511, - /* 60 */ 218, 218, 11, 482, 0, 13, 13, 274, 94, 884, - /* 70 */ 646, 1162, 646, 646, 646, 646, 646, 646, 646, 646, - /* 80 */ 646, 646, 646, 646, 646, 646, 646, 646, 646, 646, - /* 90 */ 646, 112, 195, 52, 52, 52, 412, 548, 511, 218, - /* 100 */ 218, 218, 522, 92, 92, 92, 92, 92, 688, 79, - /* 110 */ 157, 122, 349, 312, 24, 330, 145, 269, 145, 585, - /* 120 */ 477, 507, 666, 787, 705, 707, 707, 787, 831, 296, - /* 130 */ 548, 836, 296, 296, 787, 296, 848, 218, 218, 218, - /* 140 */ 218, 218, 218, 218, 218, 218, 218, 218, 841, 841, - /* 150 */ 787, 848, 831, 482, 548, 836, 482, 891, 759, 761, - /* 160 */ 791, 759, 761, 791, 791, 762, 772, 785, 793, 797, - /* 170 */ 548, 924, 849, 795, 794, 802, 905, 218, 761, 791, - /* 180 */ 791, 761, 791, 867, 548, 836, 482, 522, 482, 548, - /* 190 */ 936, 841, 841, 787, 482, 848, 1316, 1316, 1316, 1316, - /* 200 */ 1316, 48, 811, 825, 1155, 292, 962, 1058, 709, 850, - /* 210 */ 76, 727, 21, 21, 21, 21, 21, 21, 21, 393, - /* 220 */ 376, 211, 36, 36, 36, 36, 505, 542, 547, 562, - /* 230 */ 600, 634, 639, 629, 597, 602, 604, 680, 508, 340, - /* 240 */ 559, 628, 605, 665, 676, 679, 686, 700, 722, 732, - /* 250 */ 632, 651, 734, 736, 742, 746, 751, 780, 17, 1030, - /* 260 */ 930, 909, 1035, 1037, 990, 917, 1045, 1046, 966, 1053, - /* 270 */ 1059, 945, 1061, 1066, 1068, 1070, 1071, 1072, 1052, 1075, - /* 280 */ 1076, 1077, 1078, 1081, 1082, 1084, 1042, 1086, 1039, 1088, - /* 290 */ 1091, 1054, 1057, 1056, 1101, 1102, 1103, 1104, 1027, 1036, - /* 300 */ 1073, 1047, 1094, 1113, 1080, 1085, 1087, 1095, 1047, 1096, - /* 310 */ 1097, 1120, 1100, 1124, 1107, 1093, 1126, 1114, 1099, 1139, - /* 320 */ 1119, 1147, 1127, 1128, 1150, 1153, 1040, 1164, 1098, 1122, - /* 330 */ 1049, 1108, 1109, 1011, 1111, 1110, 1112, 1105, 1123, 1125, - /* 340 */ 1129, 1130, 1116, 1089, 1132, 1135, 1013, 1133, 1134, 1115, - /* 350 */ 1026, 1138, 1131, 1140, 1148, 1021, 1185, 1176, 1179, 1180, - /* 360 */ 1182, 1187, 1189, 1191, 1106, 1149, 1158, 1160, 1163, 1161, - /* 370 */ 1165, 1167, 1168, 1121, 1170, 1233, 1197, 1117, 1173, 1166, - /* 380 */ 1169, 1171, 1221, 1175, 1174, 1177, 1208, 1210, 1184, 1181, - /* 390 */ 1211, 1186, 1188, 1218, 1190, 1192, 1219, 1194, 1195, 1222, - /* 400 */ 1198, 1172, 1183, 1193, 1196, 1239, 1199, 1200, 1226, 1178, - /* 410 */ 1201, 1202, 1230, 1047, 1251, 1227, 1231, 1252, 1241, 1242, - /* 420 */ 1245, 1246, 1247, 1248, 1250, 1267, 1253, 1047, 1254, 1255, - /* 430 */ 1256, 1257, 1258, 1259, 1260, 1261, 1300, 1263, 1266, 1262, - /* 440 */ 1303, 1268, 1270, 1304, 1308, 1287, 1289, 1290, 1291, 1293, - /* 450 */ 1295, + /* 0 */ 176, 246, 344, 357, 357, 357, 357, 468, 357, 357, + /* 10 */ 600, 650, 76, 567, 600, 600, 600, 600, 600, 600, + /* 20 */ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, + /* 30 */ 600, 600, 600, 312, 312, 312, 163, 639, 639, 59, + /* 40 */ 49, 49, 5, 639, 49, 49, 49, 49, 49, 49, + /* 50 */ 83, 129, 138, 138, 5, 177, 129, 49, 49, 129, + /* 60 */ 49, 129, 177, 129, 129, 49, 185, 0, 19, 78, + /* 70 */ 78, 74, 806, 256, 93, 256, 256, 256, 256, 256, + /* 80 */ 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, + /* 90 */ 256, 256, 256, 256, 518, 399, 334, 334, 334, 498, + /* 100 */ 220, 177, 129, 129, 129, 189, 79, 79, 79, 79, + /* 110 */ 79, 79, 645, 22, 314, 405, 133, 222, 31, 507, + /* 120 */ 500, 481, 252, 481, 553, 505, 526, 761, 750, 755, + /* 130 */ 662, 761, 761, 697, 700, 700, 761, 820, 177, 854, + /* 140 */ 83, 220, 869, 83, 83, 761, 83, 884, 129, 129, + /* 150 */ 129, 129, 129, 129, 129, 129, 129, 129, 129, 755, + /* 160 */ 755, 761, 884, 220, 820, 796, 177, 854, 185, 220, + /* 170 */ 869, 185, 927, 766, 775, 800, 766, 775, 800, 800, + /* 180 */ 769, 780, 805, 797, 812, 220, 970, 880, 815, 825, + /* 190 */ 830, 957, 129, 775, 800, 800, 775, 800, 914, 220, + /* 200 */ 869, 185, 189, 185, 220, 983, 755, 755, 761, 185, + /* 210 */ 884, 1412, 1412, 1412, 1412, 1412, 21, 811, 108, 950, + /* 220 */ 992, 999, 191, 602, 308, 821, 44, 44, 44, 44, + /* 230 */ 44, 44, 44, 450, 277, 395, 331, 112, 112, 112, + /* 240 */ 112, 291, 85, 576, 623, 634, 635, 636, 714, 715, + /* 250 */ 717, 724, 651, 680, 682, 693, 530, 593, 607, 708, + /* 260 */ 673, 709, 672, 729, 744, 746, 772, 776, 50, 713, + /* 270 */ 784, 790, 795, 817, 823, 828, 656, 1076, 1080, 1023, + /* 280 */ 1084, 1047, 935, 1049, 1060, 1065, 954, 1108, 1071, 1072, + /* 290 */ 960, 1117, 1081, 1118, 1083, 1122, 1054, 982, 984, 1022, + /* 300 */ 989, 1129, 1130, 1082, 997, 1134, 1140, 1061, 1143, 1144, + /* 310 */ 1146, 1147, 1148, 1150, 1151, 1152, 1153, 1155, 1156, 1157, + /* 320 */ 1158, 1044, 1160, 1163, 1164, 1170, 1172, 1173, 1159, 1174, + /* 330 */ 1177, 1178, 1180, 1184, 1185, 1186, 1187, 1188, 1162, 1189, + /* 340 */ 1142, 1195, 1196, 1168, 1171, 1165, 1198, 1209, 1212, 1213, + /* 350 */ 1137, 1145, 1181, 1149, 1200, 1223, 1190, 1191, 1192, 1193, + /* 360 */ 1149, 1206, 1208, 1225, 1204, 1227, 1211, 1215, 1247, 1226, + /* 370 */ 1214, 1250, 1229, 1256, 1235, 1238, 1260, 1131, 1115, 1228, + /* 380 */ 1264, 1124, 1243, 1138, 1154, 1273, 1274, 1166, 1279, 1216, + /* 390 */ 1237, 1161, 1220, 1221, 1102, 1219, 1230, 1222, 1224, 1231, + /* 400 */ 1232, 1234, 1236, 1240, 1202, 1239, 1242, 1110, 1241, 1244, + /* 410 */ 1217, 1120, 1245, 1218, 1246, 1248, 1133, 1291, 1266, 1272, + /* 420 */ 1280, 1281, 1282, 1287, 1315, 1175, 1251, 1257, 1259, 1262, + /* 430 */ 1263, 1265, 1267, 1268, 1201, 1269, 1326, 1296, 1233, 1271, + /* 440 */ 1255, 1261, 1270, 1319, 1275, 1276, 1277, 1305, 1307, 1283, + /* 450 */ 1278, 1308, 1284, 1285, 1311, 1288, 1289, 1312, 1292, 1290, + /* 460 */ 1316, 1293, 1286, 1294, 1295, 1297, 1341, 1299, 1298, 1327, + /* 470 */ 1300, 1301, 1302, 1328, 1149, 1342, 1320, 1322, 1350, 1335, + /* 480 */ 1336, 1337, 1338, 1339, 1340, 1344, 1357, 1345, 1149, 1346, + /* 490 */ 1347, 1348, 1349, 1352, 1354, 1355, 1356, 1395, 1358, 1361, + /* 500 */ 1359, 1398, 1362, 1364, 1399, 1403, 1383, 1385, 1386, 1387, + /* 510 */ 1389, 1391, }; -#define YY_REDUCE_COUNT (200) -#define YY_REDUCE_MIN (-251) -#define YY_REDUCE_MAX (970) +#define YY_REDUCE_COUNT (215) +#define YY_REDUCE_MIN (-266) +#define YY_REDUCE_MAX (1059) static const short yy_reduce_ofst[] = { - /* 0 */ -11, -17, -171, 27, 156, 179, 223, 267, 372, 404, - /* 10 */ 455, 463, 95, 524, 544, -180, 549, 590, 595, 667, - /* 20 */ 678, 715, 745, 765, 788, 812, 818, 859, 870, 907, - /* 30 */ 918, 948, 970, -168, 276, 334, 184, -169, 75, 74, - /* 40 */ 220, 288, -224, -57, 16, 127, 129, -73, -119, -193, - /* 50 */ -149, -251, -219, 37, 210, 256, 65, 306, 154, 90, - /* 60 */ 67, 180, 357, 192, -165, -165, -165, -48, -162, -8, - /* 70 */ -28, 38, 19, 111, 227, 255, 260, 266, 273, 283, - /* 80 */ 331, 332, 336, 339, 350, 355, 356, 379, 380, 382, - /* 90 */ 395, 307, -184, 43, 193, 290, 352, 278, 215, 50, - /* 100 */ 344, 418, 373, -201, -163, 432, 442, 456, 513, 504, - /* 110 */ 414, 437, 492, 449, 543, 523, 520, 520, 520, 581, - /* 120 */ 525, 533, 566, 620, 607, 614, 630, 660, 625, 664, - /* 130 */ 645, 638, 681, 682, 685, 684, 691, 673, 675, 677, - /* 140 */ 687, 689, 692, 696, 697, 698, 704, 706, 690, 702, - /* 150 */ 701, 724, 656, 723, 703, 699, 725, 693, 657, 708, - /* 160 */ 710, 663, 711, 713, 714, 669, 668, 712, 717, 520, - /* 170 */ 747, 726, 716, 718, 720, 719, 735, 581, 752, 755, - /* 180 */ 756, 763, 769, 774, 777, 776, 819, 800, 820, 799, - /* 190 */ 804, 821, 822, 823, 829, 833, 789, 832, 834, 844, - /* 200 */ 838, + /* 0 */ 227, -9, 71, 168, 221, 285, 329, 403, 35, 502, + /* 10 */ 558, 606, 550, 660, 669, 703, 739, 747, 773, 212, + /* 20 */ 300, 802, 826, 850, 874, 903, 929, 937, 972, 978, + /* 30 */ 1007, 1013, 1059, -50, 113, 309, -10, -222, -218, -19, + /* 40 */ -207, -206, 358, -246, -187, -101, -86, -59, -2, 55, + /* 50 */ 80, -217, -84, 119, 161, -181, -16, 115, 143, 216, + /* 60 */ 366, 190, -179, 226, 290, 416, 215, -195, -266, -266, + /* 70 */ -266, 33, 174, 18, 193, 24, 183, 293, 307, 324, + /* 80 */ 365, 373, 393, 404, 427, 429, 430, 433, 437, 438, + /* 90 */ 454, 482, 486, 487, -202, 137, 274, 318, 343, 420, + /* 100 */ 351, -204, -15, 299, 457, -153, 48, 86, 120, 154, + /* 110 */ 224, 253, 251, 338, 353, 257, 387, 466, 453, 554, + /* 120 */ 508, 483, 483, 483, 545, 484, 501, 575, 535, 583, + /* 130 */ 556, 592, 608, 579, 612, 618, 620, 605, 624, 625, + /* 140 */ 664, 654, 653, 685, 687, 690, 691, 699, 683, 688, + /* 150 */ 689, 692, 694, 695, 696, 701, 702, 704, 705, 698, + /* 160 */ 723, 706, 733, 678, 686, 707, 710, 711, 735, 716, + /* 170 */ 712, 737, 719, 661, 726, 728, 667, 731, 730, 736, + /* 180 */ 674, 720, 721, 732, 483, 756, 740, 741, 722, 718, + /* 190 */ 727, 759, 545, 782, 785, 786, 792, 787, 798, 813, + /* 200 */ 803, 834, 829, 838, 827, 833, 841, 843, 852, 860, + /* 210 */ 857, 818, 851, 858, 862, 877, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, - /* 10 */ 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, - /* 20 */ 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, - /* 30 */ 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, - /* 40 */ 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1109, 1056, 1056, - /* 50 */ 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, - /* 60 */ 1056, 1056, 1056, 1107, 1056, 1338, 1056, 1225, 1056, 1056, - /* 70 */ 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, - /* 80 */ 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, - /* 90 */ 1056, 1056, 1109, 1349, 1349, 1349, 1107, 1056, 1056, 1056, - /* 100 */ 1056, 1056, 1194, 1056, 1056, 1056, 1056, 1056, 1056, 1056, - /* 110 */ 1413, 1056, 1147, 1373, 1056, 1365, 1341, 1355, 1342, 1056, - /* 120 */ 1398, 1358, 1251, 1056, 1230, 1227, 1227, 1056, 1056, 1109, - /* 130 */ 1056, 1056, 1109, 1109, 1056, 1109, 1056, 1056, 1056, 1056, - /* 140 */ 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, - /* 150 */ 1056, 1056, 1056, 1107, 1056, 1056, 1107, 1056, 1380, 1378, - /* 160 */ 1056, 1380, 1378, 1056, 1056, 1392, 1388, 1371, 1369, 1355, - /* 170 */ 1056, 1056, 1056, 1416, 1404, 1400, 1056, 1056, 1378, 1056, - /* 180 */ 1056, 1378, 1056, 1238, 1056, 1056, 1107, 1056, 1107, 1056, - /* 190 */ 1163, 1056, 1056, 1056, 1107, 1056, 1253, 1197, 1197, 1110, - /* 200 */ 1061, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, - /* 210 */ 1056, 1056, 1303, 1391, 1390, 1302, 1315, 1314, 1313, 1056, - /* 220 */ 1056, 1056, 1297, 1298, 1296, 1295, 1056, 1056, 1056, 1056, - /* 230 */ 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1339, 1056, 1401, - /* 240 */ 1405, 1056, 1056, 1056, 1281, 1056, 1056, 1056, 1056, 1056, - /* 250 */ 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, - /* 260 */ 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, - /* 270 */ 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, - /* 280 */ 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, - /* 290 */ 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, - /* 300 */ 1056, 1208, 1056, 1056, 1056, 1056, 1056, 1056, 1133, 1056, - /* 310 */ 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, - /* 320 */ 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, - /* 330 */ 1056, 1362, 1372, 1056, 1056, 1056, 1056, 1056, 1056, 1056, - /* 340 */ 1056, 1056, 1056, 1281, 1056, 1389, 1056, 1348, 1344, 1056, - /* 350 */ 1056, 1340, 1056, 1056, 1399, 1056, 1056, 1056, 1056, 1056, - /* 360 */ 1056, 1056, 1056, 1334, 1056, 1056, 1056, 1056, 1056, 1056, - /* 370 */ 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, - /* 380 */ 1280, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1191, 1056, - /* 390 */ 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, - /* 400 */ 1056, 1176, 1174, 1173, 1172, 1056, 1169, 1056, 1056, 1056, - /* 410 */ 1056, 1056, 1056, 1199, 1056, 1056, 1056, 1056, 1056, 1056, - /* 420 */ 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1119, 1056, 1056, - /* 430 */ 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, - /* 440 */ 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, 1056, - /* 450 */ 1056, + /* 0 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, + /* 10 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, + /* 20 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, + /* 30 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, + /* 40 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, + /* 50 */ 1204, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, + /* 60 */ 1151, 1151, 1151, 1151, 1151, 1151, 1202, 1331, 1151, 1462, + /* 70 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, + /* 80 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, + /* 90 */ 1151, 1151, 1151, 1151, 1151, 1204, 1473, 1473, 1473, 1202, + /* 100 */ 1151, 1151, 1151, 1151, 1151, 1289, 1151, 1151, 1151, 1151, + /* 110 */ 1151, 1151, 1365, 1151, 1151, 1537, 1151, 1242, 1497, 1151, + /* 120 */ 1489, 1465, 1479, 1466, 1151, 1522, 1482, 1151, 1151, 1151, + /* 130 */ 1357, 1151, 1151, 1336, 1333, 1333, 1151, 1151, 1151, 1151, + /* 140 */ 1204, 1151, 1151, 1204, 1204, 1151, 1204, 1151, 1151, 1151, + /* 150 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, + /* 160 */ 1151, 1151, 1151, 1151, 1151, 1367, 1151, 1151, 1202, 1151, + /* 170 */ 1151, 1202, 1151, 1504, 1502, 1151, 1504, 1502, 1151, 1151, + /* 180 */ 1516, 1512, 1495, 1493, 1479, 1151, 1151, 1151, 1540, 1528, + /* 190 */ 1524, 1151, 1151, 1502, 1151, 1151, 1502, 1151, 1344, 1151, + /* 200 */ 1151, 1202, 1151, 1202, 1151, 1258, 1151, 1151, 1151, 1202, + /* 210 */ 1151, 1359, 1292, 1292, 1205, 1156, 1151, 1151, 1151, 1151, + /* 220 */ 1151, 1151, 1151, 1151, 1151, 1151, 1427, 1515, 1514, 1426, + /* 230 */ 1439, 1438, 1437, 1151, 1151, 1151, 1151, 1421, 1422, 1420, + /* 240 */ 1419, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, + /* 250 */ 1151, 1151, 1151, 1151, 1151, 1463, 1151, 1525, 1529, 1151, + /* 260 */ 1151, 1151, 1404, 1151, 1151, 1151, 1151, 1151, 1151, 1151, + /* 270 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, + /* 280 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, + /* 290 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, + /* 300 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, + /* 310 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, + /* 320 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, + /* 330 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, + /* 340 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, + /* 350 */ 1151, 1151, 1151, 1303, 1151, 1151, 1151, 1151, 1151, 1151, + /* 360 */ 1228, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, + /* 370 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, + /* 380 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, + /* 390 */ 1151, 1151, 1486, 1496, 1151, 1151, 1151, 1151, 1151, 1151, + /* 400 */ 1151, 1151, 1151, 1151, 1404, 1151, 1513, 1151, 1472, 1468, + /* 410 */ 1151, 1151, 1464, 1151, 1151, 1523, 1151, 1151, 1151, 1151, + /* 420 */ 1151, 1151, 1151, 1151, 1458, 1151, 1151, 1151, 1151, 1151, + /* 430 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, + /* 440 */ 1151, 1403, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1286, + /* 450 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, + /* 460 */ 1151, 1151, 1271, 1269, 1268, 1267, 1151, 1264, 1151, 1151, + /* 470 */ 1151, 1151, 1151, 1151, 1294, 1151, 1151, 1151, 1151, 1151, + /* 480 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1214, 1151, + /* 490 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, + /* 500 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, + /* 510 */ 1151, 1151, }; /********** End of lemon-generated parsing tables *****************************/ @@ -842,168 +877,194 @@ static const char *const yyTokenName[] = { /* 113 */ "FUNCTIONS", /* 114 */ "INDEXES", /* 115 */ "FROM", - /* 116 */ "LIKE", - /* 117 */ "INDEX", - /* 118 */ "FULLTEXT", - /* 119 */ "FUNCTION", - /* 120 */ "INTERVAL", - /* 121 */ "TOPIC", - /* 122 */ "AS", - /* 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 */ "integer_list", - /* 193 */ "alter_db_option", - /* 194 */ "full_table_name", - /* 195 */ "column_def_list", - /* 196 */ "tags_def_opt", - /* 197 */ "table_options", - /* 198 */ "multi_create_clause", - /* 199 */ "tags_def", - /* 200 */ "multi_drop_clause", - /* 201 */ "alter_table_clause", - /* 202 */ "alter_table_options", - /* 203 */ "column_name", - /* 204 */ "type_name", - /* 205 */ "create_subtable_clause", - /* 206 */ "specific_tags_opt", - /* 207 */ "literal_list", - /* 208 */ "drop_table_clause", - /* 209 */ "col_name_list", - /* 210 */ "table_name", - /* 211 */ "column_def", - /* 212 */ "func_name_list", - /* 213 */ "alter_table_option", - /* 214 */ "col_name", - /* 215 */ "db_name_cond_opt", - /* 216 */ "like_pattern_opt", - /* 217 */ "table_name_cond", - /* 218 */ "from_db_opt", - /* 219 */ "func_name", - /* 220 */ "function_name", - /* 221 */ "index_name", - /* 222 */ "index_options", - /* 223 */ "func_list", - /* 224 */ "duration_literal", - /* 225 */ "sliding_opt", - /* 226 */ "func", - /* 227 */ "expression_list", - /* 228 */ "topic_name", - /* 229 */ "query_expression", - /* 230 */ "analyze_opt", - /* 231 */ "explain_options", - /* 232 */ "signed", - /* 233 */ "signed_literal", - /* 234 */ "table_alias", - /* 235 */ "column_alias", - /* 236 */ "expression", - /* 237 */ "pseudo_column", - /* 238 */ "column_reference", - /* 239 */ "subquery", - /* 240 */ "predicate", - /* 241 */ "compare_op", - /* 242 */ "in_op", - /* 243 */ "in_predicate_value", - /* 244 */ "boolean_value_expression", - /* 245 */ "boolean_primary", - /* 246 */ "common_expression", - /* 247 */ "from_clause", - /* 248 */ "table_reference_list", - /* 249 */ "table_reference", - /* 250 */ "table_primary", - /* 251 */ "joined_table", - /* 252 */ "alias_opt", - /* 253 */ "parenthesized_joined_table", - /* 254 */ "join_type", - /* 255 */ "search_condition", - /* 256 */ "query_specification", - /* 257 */ "set_quantifier_opt", - /* 258 */ "select_list", - /* 259 */ "where_clause_opt", - /* 260 */ "partition_by_clause_opt", - /* 261 */ "twindow_clause_opt", - /* 262 */ "group_by_clause_opt", - /* 263 */ "having_clause_opt", - /* 264 */ "select_sublist", - /* 265 */ "select_item", - /* 266 */ "fill_opt", - /* 267 */ "fill_mode", - /* 268 */ "group_by_list", - /* 269 */ "query_expression_body", - /* 270 */ "order_by_clause_opt", - /* 271 */ "slimit_clause_opt", - /* 272 */ "limit_clause_opt", - /* 273 */ "query_primary", - /* 274 */ "sort_specification_list", - /* 275 */ "sort_specification", - /* 276 */ "ordering_specification_opt", - /* 277 */ "null_ordering_opt", + /* 116 */ "ACCOUNTS", + /* 117 */ "APPS", + /* 118 */ "CONNECTIONS", + /* 119 */ "LICENCE", + /* 120 */ "QUERIES", + /* 121 */ "SCORES", + /* 122 */ "TOPICS", + /* 123 */ "VARIABLES", + /* 124 */ "LIKE", + /* 125 */ "INDEX", + /* 126 */ "FULLTEXT", + /* 127 */ "FUNCTION", + /* 128 */ "INTERVAL", + /* 129 */ "TOPIC", + /* 130 */ "AS", + /* 131 */ "DESC", + /* 132 */ "DESCRIBE", + /* 133 */ "RESET", + /* 134 */ "QUERY", + /* 135 */ "EXPLAIN", + /* 136 */ "ANALYZE", + /* 137 */ "VERBOSE", + /* 138 */ "NK_BOOL", + /* 139 */ "RATIO", + /* 140 */ "COMPACT", + /* 141 */ "VNODES", + /* 142 */ "IN", + /* 143 */ "OUTPUTTYPE", + /* 144 */ "AGGREGATE", + /* 145 */ "BUFSIZE", + /* 146 */ "STREAM", + /* 147 */ "INTO", + /* 148 */ "KILL", + /* 149 */ "CONNECTION", + /* 150 */ "MERGE", + /* 151 */ "VGROUP", + /* 152 */ "REDISTRIBUTE", + /* 153 */ "SPLIT", + /* 154 */ "SYNCDB", + /* 155 */ "NULL", + /* 156 */ "NK_VARIABLE", + /* 157 */ "NK_UNDERLINE", + /* 158 */ "ROWTS", + /* 159 */ "TBNAME", + /* 160 */ "QSTARTTS", + /* 161 */ "QENDTS", + /* 162 */ "WSTARTTS", + /* 163 */ "WENDTS", + /* 164 */ "WDURATION", + /* 165 */ "BETWEEN", + /* 166 */ "IS", + /* 167 */ "NK_LT", + /* 168 */ "NK_GT", + /* 169 */ "NK_LE", + /* 170 */ "NK_GE", + /* 171 */ "NK_NE", + /* 172 */ "MATCH", + /* 173 */ "NMATCH", + /* 174 */ "JOIN", + /* 175 */ "INNER", + /* 176 */ "SELECT", + /* 177 */ "DISTINCT", + /* 178 */ "WHERE", + /* 179 */ "PARTITION", + /* 180 */ "BY", + /* 181 */ "SESSION", + /* 182 */ "STATE_WINDOW", + /* 183 */ "SLIDING", + /* 184 */ "FILL", + /* 185 */ "VALUE", + /* 186 */ "NONE", + /* 187 */ "PREV", + /* 188 */ "LINEAR", + /* 189 */ "NEXT", + /* 190 */ "GROUP", + /* 191 */ "HAVING", + /* 192 */ "ORDER", + /* 193 */ "SLIMIT", + /* 194 */ "SOFFSET", + /* 195 */ "LIMIT", + /* 196 */ "OFFSET", + /* 197 */ "ASC", + /* 198 */ "NULLS", + /* 199 */ "FIRST", + /* 200 */ "LAST", + /* 201 */ "cmd", + /* 202 */ "account_options", + /* 203 */ "alter_account_options", + /* 204 */ "literal", + /* 205 */ "alter_account_option", + /* 206 */ "user_name", + /* 207 */ "dnode_endpoint", + /* 208 */ "dnode_host_name", + /* 209 */ "not_exists_opt", + /* 210 */ "db_name", + /* 211 */ "db_options", + /* 212 */ "exists_opt", + /* 213 */ "alter_db_options", + /* 214 */ "integer_list", + /* 215 */ "alter_db_option", + /* 216 */ "full_table_name", + /* 217 */ "column_def_list", + /* 218 */ "tags_def_opt", + /* 219 */ "table_options", + /* 220 */ "multi_create_clause", + /* 221 */ "tags_def", + /* 222 */ "multi_drop_clause", + /* 223 */ "alter_table_clause", + /* 224 */ "alter_table_options", + /* 225 */ "column_name", + /* 226 */ "type_name", + /* 227 */ "create_subtable_clause", + /* 228 */ "specific_tags_opt", + /* 229 */ "literal_list", + /* 230 */ "drop_table_clause", + /* 231 */ "col_name_list", + /* 232 */ "table_name", + /* 233 */ "column_def", + /* 234 */ "func_name_list", + /* 235 */ "alter_table_option", + /* 236 */ "col_name", + /* 237 */ "db_name_cond_opt", + /* 238 */ "like_pattern_opt", + /* 239 */ "table_name_cond", + /* 240 */ "from_db_opt", + /* 241 */ "func_name", + /* 242 */ "function_name", + /* 243 */ "index_name", + /* 244 */ "index_options", + /* 245 */ "func_list", + /* 246 */ "duration_literal", + /* 247 */ "sliding_opt", + /* 248 */ "func", + /* 249 */ "expression_list", + /* 250 */ "topic_name", + /* 251 */ "query_expression", + /* 252 */ "analyze_opt", + /* 253 */ "explain_options", + /* 254 */ "agg_func_opt", + /* 255 */ "bufsize_opt", + /* 256 */ "stream_name", + /* 257 */ "dnode_list", + /* 258 */ "signed", + /* 259 */ "signed_literal", + /* 260 */ "table_alias", + /* 261 */ "column_alias", + /* 262 */ "expression", + /* 263 */ "pseudo_column", + /* 264 */ "column_reference", + /* 265 */ "subquery", + /* 266 */ "predicate", + /* 267 */ "compare_op", + /* 268 */ "in_op", + /* 269 */ "in_predicate_value", + /* 270 */ "boolean_value_expression", + /* 271 */ "boolean_primary", + /* 272 */ "common_expression", + /* 273 */ "from_clause", + /* 274 */ "table_reference_list", + /* 275 */ "table_reference", + /* 276 */ "table_primary", + /* 277 */ "joined_table", + /* 278 */ "alias_opt", + /* 279 */ "parenthesized_joined_table", + /* 280 */ "join_type", + /* 281 */ "search_condition", + /* 282 */ "query_specification", + /* 283 */ "set_quantifier_opt", + /* 284 */ "select_list", + /* 285 */ "where_clause_opt", + /* 286 */ "partition_by_clause_opt", + /* 287 */ "twindow_clause_opt", + /* 288 */ "group_by_clause_opt", + /* 289 */ "having_clause_opt", + /* 290 */ "select_sublist", + /* 291 */ "select_item", + /* 292 */ "fill_opt", + /* 293 */ "fill_mode", + /* 294 */ "group_by_list", + /* 295 */ "query_expression_body", + /* 296 */ "order_by_clause_opt", + /* 297 */ "slimit_clause_opt", + /* 298 */ "limit_clause_opt", + /* 299 */ "query_primary", + /* 300 */ "sort_specification_list", + /* 301 */ "sort_specification", + /* 302 */ "ordering_specification_opt", + /* 303 */ "null_ordering_opt", }; #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ @@ -1177,200 +1238,229 @@ static const char *const yyRuleName[] = { /* 163 */ "cmd ::= SHOW FUNCTIONS", /* 164 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt", /* 165 */ "cmd ::= SHOW STREAMS", - /* 166 */ "db_name_cond_opt ::=", - /* 167 */ "db_name_cond_opt ::= db_name NK_DOT", - /* 168 */ "like_pattern_opt ::=", - /* 169 */ "like_pattern_opt ::= LIKE NK_STRING", - /* 170 */ "table_name_cond ::= table_name", - /* 171 */ "from_db_opt ::=", - /* 172 */ "from_db_opt ::= FROM db_name", - /* 173 */ "func_name_list ::= func_name", - /* 174 */ "func_name_list ::= func_name_list NK_COMMA col_name", - /* 175 */ "func_name ::= function_name", - /* 176 */ "cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options", - /* 177 */ "cmd ::= CREATE FULLTEXT INDEX not_exists_opt index_name ON table_name NK_LP col_name_list NK_RP", - /* 178 */ "cmd ::= DROP INDEX exists_opt index_name ON table_name", - /* 179 */ "index_options ::=", - /* 180 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt", - /* 181 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt", - /* 182 */ "func_list ::= func", - /* 183 */ "func_list ::= func_list NK_COMMA func", - /* 184 */ "func ::= function_name NK_LP expression_list NK_RP", - /* 185 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression", - /* 186 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS db_name", - /* 187 */ "cmd ::= DROP TOPIC exists_opt topic_name", - /* 188 */ "cmd ::= DESC full_table_name", - /* 189 */ "cmd ::= DESCRIBE full_table_name", - /* 190 */ "cmd ::= RESET QUERY CACHE", - /* 191 */ "cmd ::= EXPLAIN analyze_opt explain_options query_expression", - /* 192 */ "analyze_opt ::=", - /* 193 */ "analyze_opt ::= ANALYZE", - /* 194 */ "explain_options ::=", - /* 195 */ "explain_options ::= explain_options VERBOSE NK_BOOL", - /* 196 */ "explain_options ::= explain_options RATIO NK_FLOAT", - /* 197 */ "cmd ::= query_expression", - /* 198 */ "literal ::= NK_INTEGER", - /* 199 */ "literal ::= NK_FLOAT", - /* 200 */ "literal ::= NK_STRING", - /* 201 */ "literal ::= NK_BOOL", - /* 202 */ "literal ::= TIMESTAMP NK_STRING", - /* 203 */ "literal ::= duration_literal", - /* 204 */ "literal ::= NULL", - /* 205 */ "duration_literal ::= NK_VARIABLE", - /* 206 */ "signed ::= NK_INTEGER", - /* 207 */ "signed ::= NK_PLUS NK_INTEGER", - /* 208 */ "signed ::= NK_MINUS NK_INTEGER", - /* 209 */ "signed ::= NK_FLOAT", - /* 210 */ "signed ::= NK_PLUS NK_FLOAT", - /* 211 */ "signed ::= NK_MINUS NK_FLOAT", - /* 212 */ "signed_literal ::= signed", - /* 213 */ "signed_literal ::= NK_STRING", - /* 214 */ "signed_literal ::= NK_BOOL", - /* 215 */ "signed_literal ::= TIMESTAMP NK_STRING", - /* 216 */ "signed_literal ::= duration_literal", - /* 217 */ "signed_literal ::= NULL", - /* 218 */ "literal_list ::= signed_literal", - /* 219 */ "literal_list ::= literal_list NK_COMMA signed_literal", - /* 220 */ "db_name ::= NK_ID", - /* 221 */ "table_name ::= NK_ID", - /* 222 */ "column_name ::= NK_ID", - /* 223 */ "function_name ::= NK_ID", - /* 224 */ "table_alias ::= NK_ID", - /* 225 */ "column_alias ::= NK_ID", - /* 226 */ "user_name ::= NK_ID", - /* 227 */ "index_name ::= NK_ID", - /* 228 */ "topic_name ::= NK_ID", - /* 229 */ "expression ::= literal", - /* 230 */ "expression ::= pseudo_column", - /* 231 */ "expression ::= column_reference", - /* 232 */ "expression ::= function_name NK_LP expression_list NK_RP", - /* 233 */ "expression ::= function_name NK_LP NK_STAR NK_RP", - /* 234 */ "expression ::= subquery", - /* 235 */ "expression ::= NK_LP expression NK_RP", - /* 236 */ "expression ::= NK_PLUS expression", - /* 237 */ "expression ::= NK_MINUS expression", - /* 238 */ "expression ::= expression NK_PLUS expression", - /* 239 */ "expression ::= expression NK_MINUS expression", - /* 240 */ "expression ::= expression NK_STAR expression", - /* 241 */ "expression ::= expression NK_SLASH expression", - /* 242 */ "expression ::= expression NK_REM expression", - /* 243 */ "expression_list ::= expression", - /* 244 */ "expression_list ::= expression_list NK_COMMA expression", - /* 245 */ "column_reference ::= column_name", - /* 246 */ "column_reference ::= table_name NK_DOT column_name", - /* 247 */ "pseudo_column ::= NK_UNDERLINE ROWTS", - /* 248 */ "pseudo_column ::= TBNAME", - /* 249 */ "pseudo_column ::= NK_UNDERLINE QSTARTTS", - /* 250 */ "pseudo_column ::= NK_UNDERLINE QENDTS", - /* 251 */ "pseudo_column ::= NK_UNDERLINE WSTARTTS", - /* 252 */ "pseudo_column ::= NK_UNDERLINE WENDTS", - /* 253 */ "pseudo_column ::= NK_UNDERLINE WDURATION", - /* 254 */ "predicate ::= expression compare_op expression", - /* 255 */ "predicate ::= expression BETWEEN expression AND expression", - /* 256 */ "predicate ::= expression NOT BETWEEN expression AND expression", - /* 257 */ "predicate ::= expression IS NULL", - /* 258 */ "predicate ::= expression IS NOT NULL", - /* 259 */ "predicate ::= expression in_op in_predicate_value", - /* 260 */ "compare_op ::= NK_LT", - /* 261 */ "compare_op ::= NK_GT", - /* 262 */ "compare_op ::= NK_LE", - /* 263 */ "compare_op ::= NK_GE", - /* 264 */ "compare_op ::= NK_NE", - /* 265 */ "compare_op ::= NK_EQ", - /* 266 */ "compare_op ::= LIKE", - /* 267 */ "compare_op ::= NOT LIKE", - /* 268 */ "compare_op ::= MATCH", - /* 269 */ "compare_op ::= NMATCH", - /* 270 */ "in_op ::= IN", - /* 271 */ "in_op ::= NOT IN", - /* 272 */ "in_predicate_value ::= NK_LP expression_list NK_RP", - /* 273 */ "boolean_value_expression ::= boolean_primary", - /* 274 */ "boolean_value_expression ::= NOT boolean_primary", - /* 275 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", - /* 276 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", - /* 277 */ "boolean_primary ::= predicate", - /* 278 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", - /* 279 */ "common_expression ::= expression", - /* 280 */ "common_expression ::= boolean_value_expression", - /* 281 */ "from_clause ::= FROM table_reference_list", - /* 282 */ "table_reference_list ::= table_reference", - /* 283 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", - /* 284 */ "table_reference ::= table_primary", - /* 285 */ "table_reference ::= joined_table", - /* 286 */ "table_primary ::= table_name alias_opt", - /* 287 */ "table_primary ::= db_name NK_DOT table_name alias_opt", - /* 288 */ "table_primary ::= subquery alias_opt", - /* 289 */ "table_primary ::= parenthesized_joined_table", - /* 290 */ "alias_opt ::=", - /* 291 */ "alias_opt ::= table_alias", - /* 292 */ "alias_opt ::= AS table_alias", - /* 293 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", - /* 294 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", - /* 295 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", - /* 296 */ "join_type ::=", - /* 297 */ "join_type ::= INNER", - /* 298 */ "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", - /* 299 */ "set_quantifier_opt ::=", - /* 300 */ "set_quantifier_opt ::= DISTINCT", - /* 301 */ "set_quantifier_opt ::= ALL", - /* 302 */ "select_list ::= NK_STAR", - /* 303 */ "select_list ::= select_sublist", - /* 304 */ "select_sublist ::= select_item", - /* 305 */ "select_sublist ::= select_sublist NK_COMMA select_item", - /* 306 */ "select_item ::= common_expression", - /* 307 */ "select_item ::= common_expression column_alias", - /* 308 */ "select_item ::= common_expression AS column_alias", - /* 309 */ "select_item ::= table_name NK_DOT NK_STAR", - /* 310 */ "where_clause_opt ::=", - /* 311 */ "where_clause_opt ::= WHERE search_condition", - /* 312 */ "partition_by_clause_opt ::=", - /* 313 */ "partition_by_clause_opt ::= PARTITION BY expression_list", - /* 314 */ "twindow_clause_opt ::=", - /* 315 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", - /* 316 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP", - /* 317 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", - /* 318 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", - /* 319 */ "sliding_opt ::=", - /* 320 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", - /* 321 */ "fill_opt ::=", - /* 322 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", - /* 323 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", - /* 324 */ "fill_mode ::= NONE", - /* 325 */ "fill_mode ::= PREV", - /* 326 */ "fill_mode ::= NULL", - /* 327 */ "fill_mode ::= LINEAR", - /* 328 */ "fill_mode ::= NEXT", - /* 329 */ "group_by_clause_opt ::=", - /* 330 */ "group_by_clause_opt ::= GROUP BY group_by_list", - /* 331 */ "group_by_list ::= expression", - /* 332 */ "group_by_list ::= group_by_list NK_COMMA expression", - /* 333 */ "having_clause_opt ::=", - /* 334 */ "having_clause_opt ::= HAVING search_condition", - /* 335 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt", - /* 336 */ "query_expression_body ::= query_primary", - /* 337 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body", - /* 338 */ "query_primary ::= query_specification", - /* 339 */ "order_by_clause_opt ::=", - /* 340 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", - /* 341 */ "slimit_clause_opt ::=", - /* 342 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", - /* 343 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", - /* 344 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 345 */ "limit_clause_opt ::=", - /* 346 */ "limit_clause_opt ::= LIMIT NK_INTEGER", - /* 347 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", - /* 348 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 349 */ "subquery ::= NK_LP query_expression NK_RP", - /* 350 */ "search_condition ::= common_expression", - /* 351 */ "sort_specification_list ::= sort_specification", - /* 352 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", - /* 353 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt", - /* 354 */ "ordering_specification_opt ::=", - /* 355 */ "ordering_specification_opt ::= ASC", - /* 356 */ "ordering_specification_opt ::= DESC", - /* 357 */ "null_ordering_opt ::=", - /* 358 */ "null_ordering_opt ::= NULLS FIRST", - /* 359 */ "null_ordering_opt ::= NULLS LAST", + /* 166 */ "cmd ::= SHOW ACCOUNTS", + /* 167 */ "cmd ::= SHOW APPS", + /* 168 */ "cmd ::= SHOW CONNECTIONS", + /* 169 */ "cmd ::= SHOW LICENCE", + /* 170 */ "cmd ::= SHOW CREATE DATABASE db_name", + /* 171 */ "cmd ::= SHOW CREATE TABLE full_table_name", + /* 172 */ "cmd ::= SHOW CREATE STABLE full_table_name", + /* 173 */ "cmd ::= SHOW QUERIES", + /* 174 */ "cmd ::= SHOW SCORES", + /* 175 */ "cmd ::= SHOW TOPICS", + /* 176 */ "cmd ::= SHOW VARIABLES", + /* 177 */ "db_name_cond_opt ::=", + /* 178 */ "db_name_cond_opt ::= db_name NK_DOT", + /* 179 */ "like_pattern_opt ::=", + /* 180 */ "like_pattern_opt ::= LIKE NK_STRING", + /* 181 */ "table_name_cond ::= table_name", + /* 182 */ "from_db_opt ::=", + /* 183 */ "from_db_opt ::= FROM db_name", + /* 184 */ "func_name_list ::= func_name", + /* 185 */ "func_name_list ::= func_name_list NK_COMMA col_name", + /* 186 */ "func_name ::= function_name", + /* 187 */ "cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options", + /* 188 */ "cmd ::= CREATE FULLTEXT INDEX not_exists_opt index_name ON table_name NK_LP col_name_list NK_RP", + /* 189 */ "cmd ::= DROP INDEX exists_opt index_name ON table_name", + /* 190 */ "index_options ::=", + /* 191 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt", + /* 192 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt", + /* 193 */ "func_list ::= func", + /* 194 */ "func_list ::= func_list NK_COMMA func", + /* 195 */ "func ::= function_name NK_LP expression_list NK_RP", + /* 196 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression", + /* 197 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS db_name", + /* 198 */ "cmd ::= DROP TOPIC exists_opt topic_name", + /* 199 */ "cmd ::= DESC full_table_name", + /* 200 */ "cmd ::= DESCRIBE full_table_name", + /* 201 */ "cmd ::= RESET QUERY CACHE", + /* 202 */ "cmd ::= EXPLAIN analyze_opt explain_options query_expression", + /* 203 */ "analyze_opt ::=", + /* 204 */ "analyze_opt ::= ANALYZE", + /* 205 */ "explain_options ::=", + /* 206 */ "explain_options ::= explain_options VERBOSE NK_BOOL", + /* 207 */ "explain_options ::= explain_options RATIO NK_FLOAT", + /* 208 */ "cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP", + /* 209 */ "cmd ::= CREATE agg_func_opt FUNCTION function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt", + /* 210 */ "cmd ::= DROP FUNCTION function_name", + /* 211 */ "agg_func_opt ::=", + /* 212 */ "agg_func_opt ::= AGGREGATE", + /* 213 */ "bufsize_opt ::=", + /* 214 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", + /* 215 */ "cmd ::= CREATE STREAM stream_name INTO table_name AS query_expression", + /* 216 */ "cmd ::= DROP STREAM stream_name", + /* 217 */ "cmd ::= KILL CONNECTION NK_INTEGER", + /* 218 */ "cmd ::= KILL QUERY NK_INTEGER", + /* 219 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", + /* 220 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", + /* 221 */ "cmd ::= SPLIT VGROUP NK_INTEGER", + /* 222 */ "dnode_list ::= DNODE NK_INTEGER", + /* 223 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", + /* 224 */ "cmd ::= SYNCDB db_name REPLICA", + /* 225 */ "cmd ::= query_expression", + /* 226 */ "literal ::= NK_INTEGER", + /* 227 */ "literal ::= NK_FLOAT", + /* 228 */ "literal ::= NK_STRING", + /* 229 */ "literal ::= NK_BOOL", + /* 230 */ "literal ::= TIMESTAMP NK_STRING", + /* 231 */ "literal ::= duration_literal", + /* 232 */ "literal ::= NULL", + /* 233 */ "duration_literal ::= NK_VARIABLE", + /* 234 */ "signed ::= NK_INTEGER", + /* 235 */ "signed ::= NK_PLUS NK_INTEGER", + /* 236 */ "signed ::= NK_MINUS NK_INTEGER", + /* 237 */ "signed ::= NK_FLOAT", + /* 238 */ "signed ::= NK_PLUS NK_FLOAT", + /* 239 */ "signed ::= NK_MINUS NK_FLOAT", + /* 240 */ "signed_literal ::= signed", + /* 241 */ "signed_literal ::= NK_STRING", + /* 242 */ "signed_literal ::= NK_BOOL", + /* 243 */ "signed_literal ::= TIMESTAMP NK_STRING", + /* 244 */ "signed_literal ::= duration_literal", + /* 245 */ "signed_literal ::= NULL", + /* 246 */ "literal_list ::= signed_literal", + /* 247 */ "literal_list ::= literal_list NK_COMMA signed_literal", + /* 248 */ "db_name ::= NK_ID", + /* 249 */ "table_name ::= NK_ID", + /* 250 */ "column_name ::= NK_ID", + /* 251 */ "function_name ::= NK_ID", + /* 252 */ "table_alias ::= NK_ID", + /* 253 */ "column_alias ::= NK_ID", + /* 254 */ "user_name ::= NK_ID", + /* 255 */ "index_name ::= NK_ID", + /* 256 */ "topic_name ::= NK_ID", + /* 257 */ "stream_name ::= NK_ID", + /* 258 */ "expression ::= literal", + /* 259 */ "expression ::= pseudo_column", + /* 260 */ "expression ::= column_reference", + /* 261 */ "expression ::= function_name NK_LP expression_list NK_RP", + /* 262 */ "expression ::= function_name NK_LP NK_STAR NK_RP", + /* 263 */ "expression ::= subquery", + /* 264 */ "expression ::= NK_LP expression NK_RP", + /* 265 */ "expression ::= NK_PLUS expression", + /* 266 */ "expression ::= NK_MINUS expression", + /* 267 */ "expression ::= expression NK_PLUS expression", + /* 268 */ "expression ::= expression NK_MINUS expression", + /* 269 */ "expression ::= expression NK_STAR expression", + /* 270 */ "expression ::= expression NK_SLASH expression", + /* 271 */ "expression ::= expression NK_REM expression", + /* 272 */ "expression_list ::= expression", + /* 273 */ "expression_list ::= expression_list NK_COMMA expression", + /* 274 */ "column_reference ::= column_name", + /* 275 */ "column_reference ::= table_name NK_DOT column_name", + /* 276 */ "pseudo_column ::= NK_UNDERLINE ROWTS", + /* 277 */ "pseudo_column ::= TBNAME", + /* 278 */ "pseudo_column ::= NK_UNDERLINE QSTARTTS", + /* 279 */ "pseudo_column ::= NK_UNDERLINE QENDTS", + /* 280 */ "pseudo_column ::= NK_UNDERLINE WSTARTTS", + /* 281 */ "pseudo_column ::= NK_UNDERLINE WENDTS", + /* 282 */ "pseudo_column ::= NK_UNDERLINE WDURATION", + /* 283 */ "predicate ::= expression compare_op expression", + /* 284 */ "predicate ::= expression BETWEEN expression AND expression", + /* 285 */ "predicate ::= expression NOT BETWEEN expression AND expression", + /* 286 */ "predicate ::= expression IS NULL", + /* 287 */ "predicate ::= expression IS NOT NULL", + /* 288 */ "predicate ::= expression in_op in_predicate_value", + /* 289 */ "compare_op ::= NK_LT", + /* 290 */ "compare_op ::= NK_GT", + /* 291 */ "compare_op ::= NK_LE", + /* 292 */ "compare_op ::= NK_GE", + /* 293 */ "compare_op ::= NK_NE", + /* 294 */ "compare_op ::= NK_EQ", + /* 295 */ "compare_op ::= LIKE", + /* 296 */ "compare_op ::= NOT LIKE", + /* 297 */ "compare_op ::= MATCH", + /* 298 */ "compare_op ::= NMATCH", + /* 299 */ "in_op ::= IN", + /* 300 */ "in_op ::= NOT IN", + /* 301 */ "in_predicate_value ::= NK_LP expression_list NK_RP", + /* 302 */ "boolean_value_expression ::= boolean_primary", + /* 303 */ "boolean_value_expression ::= NOT boolean_primary", + /* 304 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", + /* 305 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", + /* 306 */ "boolean_primary ::= predicate", + /* 307 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", + /* 308 */ "common_expression ::= expression", + /* 309 */ "common_expression ::= boolean_value_expression", + /* 310 */ "from_clause ::= FROM table_reference_list", + /* 311 */ "table_reference_list ::= table_reference", + /* 312 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", + /* 313 */ "table_reference ::= table_primary", + /* 314 */ "table_reference ::= joined_table", + /* 315 */ "table_primary ::= table_name alias_opt", + /* 316 */ "table_primary ::= db_name NK_DOT table_name alias_opt", + /* 317 */ "table_primary ::= subquery alias_opt", + /* 318 */ "table_primary ::= parenthesized_joined_table", + /* 319 */ "alias_opt ::=", + /* 320 */ "alias_opt ::= table_alias", + /* 321 */ "alias_opt ::= AS table_alias", + /* 322 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", + /* 323 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", + /* 324 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", + /* 325 */ "join_type ::=", + /* 326 */ "join_type ::= INNER", + /* 327 */ "query_specification ::= SELECT set_quantifier_opt select_list from_clause where_clause_opt partition_by_clause_opt twindow_clause_opt group_by_clause_opt having_clause_opt", + /* 328 */ "set_quantifier_opt ::=", + /* 329 */ "set_quantifier_opt ::= DISTINCT", + /* 330 */ "set_quantifier_opt ::= ALL", + /* 331 */ "select_list ::= NK_STAR", + /* 332 */ "select_list ::= select_sublist", + /* 333 */ "select_sublist ::= select_item", + /* 334 */ "select_sublist ::= select_sublist NK_COMMA select_item", + /* 335 */ "select_item ::= common_expression", + /* 336 */ "select_item ::= common_expression column_alias", + /* 337 */ "select_item ::= common_expression AS column_alias", + /* 338 */ "select_item ::= table_name NK_DOT NK_STAR", + /* 339 */ "where_clause_opt ::=", + /* 340 */ "where_clause_opt ::= WHERE search_condition", + /* 341 */ "partition_by_clause_opt ::=", + /* 342 */ "partition_by_clause_opt ::= PARTITION BY expression_list", + /* 343 */ "twindow_clause_opt ::=", + /* 344 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", + /* 345 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP", + /* 346 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", + /* 347 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", + /* 348 */ "sliding_opt ::=", + /* 349 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", + /* 350 */ "fill_opt ::=", + /* 351 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", + /* 352 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", + /* 353 */ "fill_mode ::= NONE", + /* 354 */ "fill_mode ::= PREV", + /* 355 */ "fill_mode ::= NULL", + /* 356 */ "fill_mode ::= LINEAR", + /* 357 */ "fill_mode ::= NEXT", + /* 358 */ "group_by_clause_opt ::=", + /* 359 */ "group_by_clause_opt ::= GROUP BY group_by_list", + /* 360 */ "group_by_list ::= expression", + /* 361 */ "group_by_list ::= group_by_list NK_COMMA expression", + /* 362 */ "having_clause_opt ::=", + /* 363 */ "having_clause_opt ::= HAVING search_condition", + /* 364 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt", + /* 365 */ "query_expression_body ::= query_primary", + /* 366 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body", + /* 367 */ "query_primary ::= query_specification", + /* 368 */ "order_by_clause_opt ::=", + /* 369 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", + /* 370 */ "slimit_clause_opt ::=", + /* 371 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", + /* 372 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", + /* 373 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 374 */ "limit_clause_opt ::=", + /* 375 */ "limit_clause_opt ::= LIMIT NK_INTEGER", + /* 376 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", + /* 377 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 378 */ "subquery ::= NK_LP query_expression NK_RP", + /* 379 */ "search_condition ::= common_expression", + /* 380 */ "sort_specification_list ::= sort_specification", + /* 381 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", + /* 382 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt", + /* 383 */ "ordering_specification_opt ::=", + /* 384 */ "ordering_specification_opt ::= ASC", + /* 385 */ "ordering_specification_opt ::= DESC", + /* 386 */ "null_ordering_opt ::=", + /* 387 */ "null_ordering_opt ::= NULLS FIRST", + /* 388 */ "null_ordering_opt ::= NULLS LAST", }; #endif /* NDEBUG */ @@ -1497,149 +1587,153 @@ static void yy_destructor( */ /********* Begin destructor definitions ***************************************/ /* Default NON-TERMINAL Destructor */ - case 179: /* cmd */ - case 182: /* literal */ - case 189: /* db_options */ - case 191: /* alter_db_options */ - case 194: /* full_table_name */ - case 197: /* table_options */ - case 201: /* alter_table_clause */ - case 202: /* alter_table_options */ - case 205: /* create_subtable_clause */ - case 208: /* drop_table_clause */ - case 211: /* column_def */ - case 214: /* col_name */ - case 215: /* db_name_cond_opt */ - case 216: /* like_pattern_opt */ - case 217: /* table_name_cond */ - case 218: /* from_db_opt */ - case 219: /* func_name */ - case 222: /* index_options */ - case 224: /* duration_literal */ - case 225: /* sliding_opt */ - case 226: /* func */ - case 229: /* query_expression */ - case 231: /* explain_options */ - case 232: /* signed */ - case 233: /* signed_literal */ - case 236: /* expression */ - case 237: /* pseudo_column */ - case 238: /* column_reference */ - case 239: /* subquery */ - case 240: /* predicate */ - case 243: /* in_predicate_value */ - case 244: /* boolean_value_expression */ - case 245: /* boolean_primary */ - case 246: /* common_expression */ - case 247: /* from_clause */ - case 248: /* table_reference_list */ - case 249: /* table_reference */ - case 250: /* table_primary */ - case 251: /* joined_table */ - case 253: /* parenthesized_joined_table */ - case 255: /* search_condition */ - case 256: /* query_specification */ - case 259: /* where_clause_opt */ - case 261: /* twindow_clause_opt */ - case 263: /* having_clause_opt */ - case 265: /* select_item */ - case 266: /* fill_opt */ - case 269: /* query_expression_body */ - case 271: /* slimit_clause_opt */ - case 272: /* limit_clause_opt */ - case 273: /* query_primary */ - case 275: /* sort_specification */ + case 201: /* cmd */ + case 204: /* literal */ + case 211: /* db_options */ + case 213: /* alter_db_options */ + case 216: /* full_table_name */ + case 219: /* table_options */ + case 223: /* alter_table_clause */ + case 224: /* alter_table_options */ + case 227: /* create_subtable_clause */ + case 230: /* drop_table_clause */ + case 233: /* column_def */ + case 236: /* col_name */ + case 237: /* db_name_cond_opt */ + case 238: /* like_pattern_opt */ + case 239: /* table_name_cond */ + case 240: /* from_db_opt */ + case 241: /* func_name */ + case 244: /* index_options */ + case 246: /* duration_literal */ + case 247: /* sliding_opt */ + case 248: /* func */ + case 251: /* query_expression */ + case 253: /* explain_options */ + case 258: /* signed */ + case 259: /* signed_literal */ + case 262: /* expression */ + case 263: /* pseudo_column */ + case 264: /* column_reference */ + case 265: /* subquery */ + case 266: /* predicate */ + case 269: /* in_predicate_value */ + case 270: /* boolean_value_expression */ + case 271: /* boolean_primary */ + case 272: /* common_expression */ + case 273: /* from_clause */ + case 274: /* table_reference_list */ + case 275: /* table_reference */ + case 276: /* table_primary */ + case 277: /* joined_table */ + case 279: /* parenthesized_joined_table */ + case 281: /* search_condition */ + case 282: /* query_specification */ + case 285: /* where_clause_opt */ + case 287: /* twindow_clause_opt */ + case 289: /* having_clause_opt */ + case 291: /* select_item */ + case 292: /* fill_opt */ + case 295: /* query_expression_body */ + case 297: /* slimit_clause_opt */ + case 298: /* limit_clause_opt */ + case 299: /* query_primary */ + case 301: /* sort_specification */ { - nodesDestroyNode((yypminor->yy24)); + nodesDestroyNode((yypminor->yy104)); } break; - case 180: /* account_options */ - case 181: /* alter_account_options */ - case 183: /* alter_account_option */ + case 202: /* account_options */ + case 203: /* alter_account_options */ + case 205: /* alter_account_option */ + case 255: /* bufsize_opt */ { } break; - case 184: /* user_name */ - case 185: /* dnode_endpoint */ - case 186: /* dnode_host_name */ - case 188: /* db_name */ - case 203: /* column_name */ - case 210: /* table_name */ - case 220: /* function_name */ - case 221: /* index_name */ - case 228: /* topic_name */ - case 234: /* table_alias */ - case 235: /* column_alias */ - case 252: /* alias_opt */ + case 206: /* user_name */ + case 207: /* dnode_endpoint */ + case 208: /* dnode_host_name */ + case 210: /* db_name */ + case 225: /* column_name */ + case 232: /* table_name */ + case 242: /* function_name */ + case 243: /* index_name */ + case 250: /* topic_name */ + case 256: /* stream_name */ + case 260: /* table_alias */ + case 261: /* column_alias */ + case 278: /* alias_opt */ { } break; - case 187: /* not_exists_opt */ - case 190: /* exists_opt */ - case 230: /* analyze_opt */ - case 257: /* set_quantifier_opt */ + case 209: /* not_exists_opt */ + case 212: /* exists_opt */ + case 252: /* analyze_opt */ + case 254: /* agg_func_opt */ + case 283: /* set_quantifier_opt */ { } break; - case 192: /* integer_list */ - case 195: /* column_def_list */ - case 196: /* tags_def_opt */ - case 198: /* multi_create_clause */ - case 199: /* tags_def */ - case 200: /* multi_drop_clause */ - case 206: /* specific_tags_opt */ - case 207: /* literal_list */ - case 209: /* col_name_list */ - case 212: /* func_name_list */ - case 223: /* func_list */ - case 227: /* expression_list */ - case 258: /* select_list */ - case 260: /* partition_by_clause_opt */ - case 262: /* group_by_clause_opt */ - case 264: /* select_sublist */ - case 268: /* group_by_list */ - case 270: /* order_by_clause_opt */ - case 274: /* sort_specification_list */ + case 214: /* integer_list */ + case 217: /* column_def_list */ + case 218: /* tags_def_opt */ + case 220: /* multi_create_clause */ + case 221: /* tags_def */ + case 222: /* multi_drop_clause */ + case 228: /* specific_tags_opt */ + case 229: /* literal_list */ + case 231: /* col_name_list */ + case 234: /* func_name_list */ + case 245: /* func_list */ + case 249: /* expression_list */ + case 257: /* dnode_list */ + case 284: /* select_list */ + case 286: /* partition_by_clause_opt */ + case 288: /* group_by_clause_opt */ + case 290: /* select_sublist */ + case 294: /* group_by_list */ + case 296: /* order_by_clause_opt */ + case 300: /* sort_specification_list */ { - nodesDestroyList((yypminor->yy504)); + nodesDestroyList((yypminor->yy312)); } break; - case 193: /* alter_db_option */ - case 213: /* alter_table_option */ + case 215: /* alter_db_option */ + case 235: /* alter_table_option */ { } break; - case 204: /* type_name */ + case 226: /* type_name */ { } break; - case 241: /* compare_op */ - case 242: /* in_op */ + case 267: /* compare_op */ + case 268: /* in_op */ { } break; - case 254: /* join_type */ + case 280: /* join_type */ { } break; - case 267: /* fill_mode */ + case 293: /* fill_mode */ { } break; - case 276: /* ordering_specification_opt */ + case 302: /* ordering_specification_opt */ { } break; - case 277: /* null_ordering_opt */ + case 303: /* null_ordering_opt */ { } @@ -1938,366 +2032,395 @@ 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[] = { - { 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 integer_list */ - { 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 */ - { 193, -2 }, /* (72) alter_db_option ::= BLOCKS NK_INTEGER */ - { 193, -2 }, /* (73) alter_db_option ::= FSYNC NK_INTEGER */ - { 193, -2 }, /* (74) alter_db_option ::= KEEP integer_list */ - { 193, -2 }, /* (75) alter_db_option ::= WAL NK_INTEGER */ - { 193, -2 }, /* (76) alter_db_option ::= QUORUM NK_INTEGER */ - { 193, -2 }, /* (77) alter_db_option ::= CACHELAST NK_INTEGER */ - { 193, -2 }, /* (78) alter_db_option ::= REPLICA NK_INTEGER */ - { 192, -1 }, /* (79) integer_list ::= NK_INTEGER */ - { 192, -3 }, /* (80) integer_list ::= integer_list NK_COMMA NK_INTEGER */ - { 179, -9 }, /* (81) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ - { 179, -3 }, /* (82) cmd ::= CREATE TABLE multi_create_clause */ - { 179, -9 }, /* (83) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ - { 179, -3 }, /* (84) cmd ::= DROP TABLE multi_drop_clause */ - { 179, -4 }, /* (85) cmd ::= DROP STABLE exists_opt full_table_name */ - { 179, -3 }, /* (86) cmd ::= ALTER TABLE alter_table_clause */ - { 179, -3 }, /* (87) cmd ::= ALTER STABLE alter_table_clause */ - { 201, -2 }, /* (88) alter_table_clause ::= full_table_name alter_table_options */ - { 201, -5 }, /* (89) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ - { 201, -4 }, /* (90) alter_table_clause ::= full_table_name DROP COLUMN column_name */ - { 201, -5 }, /* (91) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ - { 201, -5 }, /* (92) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ - { 201, -5 }, /* (93) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ - { 201, -4 }, /* (94) alter_table_clause ::= full_table_name DROP TAG column_name */ - { 201, -5 }, /* (95) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ - { 201, -5 }, /* (96) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ - { 201, -6 }, /* (97) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ literal */ - { 198, -1 }, /* (98) multi_create_clause ::= create_subtable_clause */ - { 198, -2 }, /* (99) multi_create_clause ::= multi_create_clause create_subtable_clause */ - { 205, -9 }, /* (100) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP */ - { 200, -1 }, /* (101) multi_drop_clause ::= drop_table_clause */ - { 200, -2 }, /* (102) multi_drop_clause ::= multi_drop_clause drop_table_clause */ - { 208, -2 }, /* (103) drop_table_clause ::= exists_opt full_table_name */ - { 206, 0 }, /* (104) specific_tags_opt ::= */ - { 206, -3 }, /* (105) specific_tags_opt ::= NK_LP col_name_list NK_RP */ - { 194, -1 }, /* (106) full_table_name ::= table_name */ - { 194, -3 }, /* (107) full_table_name ::= db_name NK_DOT table_name */ - { 195, -1 }, /* (108) column_def_list ::= column_def */ - { 195, -3 }, /* (109) column_def_list ::= column_def_list NK_COMMA column_def */ - { 211, -2 }, /* (110) column_def ::= column_name type_name */ - { 211, -4 }, /* (111) column_def ::= column_name type_name COMMENT NK_STRING */ - { 204, -1 }, /* (112) type_name ::= BOOL */ - { 204, -1 }, /* (113) type_name ::= TINYINT */ - { 204, -1 }, /* (114) type_name ::= SMALLINT */ - { 204, -1 }, /* (115) type_name ::= INT */ - { 204, -1 }, /* (116) type_name ::= INTEGER */ - { 204, -1 }, /* (117) type_name ::= BIGINT */ - { 204, -1 }, /* (118) type_name ::= FLOAT */ - { 204, -1 }, /* (119) type_name ::= DOUBLE */ - { 204, -4 }, /* (120) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ - { 204, -1 }, /* (121) type_name ::= TIMESTAMP */ - { 204, -4 }, /* (122) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ - { 204, -2 }, /* (123) type_name ::= TINYINT UNSIGNED */ - { 204, -2 }, /* (124) type_name ::= SMALLINT UNSIGNED */ - { 204, -2 }, /* (125) type_name ::= INT UNSIGNED */ - { 204, -2 }, /* (126) type_name ::= BIGINT UNSIGNED */ - { 204, -1 }, /* (127) type_name ::= JSON */ - { 204, -4 }, /* (128) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ - { 204, -1 }, /* (129) type_name ::= MEDIUMBLOB */ - { 204, -1 }, /* (130) type_name ::= BLOB */ - { 204, -4 }, /* (131) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ - { 204, -1 }, /* (132) type_name ::= DECIMAL */ - { 204, -4 }, /* (133) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ - { 204, -6 }, /* (134) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - { 196, 0 }, /* (135) tags_def_opt ::= */ - { 196, -1 }, /* (136) tags_def_opt ::= tags_def */ - { 199, -4 }, /* (137) tags_def ::= TAGS NK_LP column_def_list NK_RP */ - { 197, 0 }, /* (138) table_options ::= */ - { 197, -3 }, /* (139) table_options ::= table_options COMMENT NK_STRING */ - { 197, -3 }, /* (140) table_options ::= table_options KEEP integer_list */ - { 197, -3 }, /* (141) table_options ::= table_options TTL NK_INTEGER */ - { 197, -5 }, /* (142) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ - { 197, -5 }, /* (143) table_options ::= table_options ROLLUP NK_LP func_name_list NK_RP */ - { 197, -3 }, /* (144) table_options ::= table_options FILE_FACTOR NK_FLOAT */ - { 197, -3 }, /* (145) table_options ::= table_options DELAY NK_INTEGER */ - { 202, -1 }, /* (146) alter_table_options ::= alter_table_option */ - { 202, -2 }, /* (147) alter_table_options ::= alter_table_options alter_table_option */ - { 213, -2 }, /* (148) alter_table_option ::= COMMENT NK_STRING */ - { 213, -2 }, /* (149) alter_table_option ::= KEEP integer_list */ - { 213, -2 }, /* (150) alter_table_option ::= TTL NK_INTEGER */ - { 209, -1 }, /* (151) col_name_list ::= col_name */ - { 209, -3 }, /* (152) col_name_list ::= col_name_list NK_COMMA col_name */ - { 214, -1 }, /* (153) col_name ::= column_name */ - { 179, -2 }, /* (154) cmd ::= SHOW DNODES */ - { 179, -2 }, /* (155) cmd ::= SHOW USERS */ - { 179, -2 }, /* (156) cmd ::= SHOW DATABASES */ - { 179, -4 }, /* (157) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ - { 179, -4 }, /* (158) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ - { 179, -3 }, /* (159) cmd ::= SHOW db_name_cond_opt VGROUPS */ - { 179, -2 }, /* (160) cmd ::= SHOW MNODES */ - { 179, -2 }, /* (161) cmd ::= SHOW MODULES */ - { 179, -2 }, /* (162) cmd ::= SHOW QNODES */ - { 179, -2 }, /* (163) cmd ::= SHOW FUNCTIONS */ - { 179, -5 }, /* (164) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ - { 179, -2 }, /* (165) cmd ::= SHOW STREAMS */ - { 215, 0 }, /* (166) db_name_cond_opt ::= */ - { 215, -2 }, /* (167) db_name_cond_opt ::= db_name NK_DOT */ - { 216, 0 }, /* (168) like_pattern_opt ::= */ - { 216, -2 }, /* (169) like_pattern_opt ::= LIKE NK_STRING */ - { 217, -1 }, /* (170) table_name_cond ::= table_name */ - { 218, 0 }, /* (171) from_db_opt ::= */ - { 218, -2 }, /* (172) from_db_opt ::= FROM db_name */ - { 212, -1 }, /* (173) func_name_list ::= func_name */ - { 212, -3 }, /* (174) func_name_list ::= func_name_list NK_COMMA col_name */ - { 219, -1 }, /* (175) func_name ::= function_name */ - { 179, -8 }, /* (176) cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ - { 179, -10 }, /* (177) cmd ::= CREATE FULLTEXT INDEX not_exists_opt index_name ON table_name NK_LP col_name_list NK_RP */ - { 179, -6 }, /* (178) cmd ::= DROP INDEX exists_opt index_name ON table_name */ - { 222, 0 }, /* (179) index_options ::= */ - { 222, -9 }, /* (180) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt */ - { 222, -11 }, /* (181) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt */ - { 223, -1 }, /* (182) func_list ::= func */ - { 223, -3 }, /* (183) func_list ::= func_list NK_COMMA func */ - { 226, -4 }, /* (184) func ::= function_name NK_LP expression_list NK_RP */ - { 179, -6 }, /* (185) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ - { 179, -6 }, /* (186) cmd ::= CREATE TOPIC not_exists_opt topic_name AS db_name */ - { 179, -4 }, /* (187) cmd ::= DROP TOPIC exists_opt topic_name */ - { 179, -2 }, /* (188) cmd ::= DESC full_table_name */ - { 179, -2 }, /* (189) cmd ::= DESCRIBE full_table_name */ - { 179, -3 }, /* (190) cmd ::= RESET QUERY CACHE */ - { 179, -4 }, /* (191) cmd ::= EXPLAIN analyze_opt explain_options query_expression */ - { 230, 0 }, /* (192) analyze_opt ::= */ - { 230, -1 }, /* (193) analyze_opt ::= ANALYZE */ - { 231, 0 }, /* (194) explain_options ::= */ - { 231, -3 }, /* (195) explain_options ::= explain_options VERBOSE NK_BOOL */ - { 231, -3 }, /* (196) explain_options ::= explain_options RATIO NK_FLOAT */ - { 179, -1 }, /* (197) cmd ::= query_expression */ - { 182, -1 }, /* (198) literal ::= NK_INTEGER */ - { 182, -1 }, /* (199) literal ::= NK_FLOAT */ - { 182, -1 }, /* (200) literal ::= NK_STRING */ - { 182, -1 }, /* (201) literal ::= NK_BOOL */ - { 182, -2 }, /* (202) literal ::= TIMESTAMP NK_STRING */ - { 182, -1 }, /* (203) literal ::= duration_literal */ - { 182, -1 }, /* (204) literal ::= NULL */ - { 224, -1 }, /* (205) duration_literal ::= NK_VARIABLE */ - { 232, -1 }, /* (206) signed ::= NK_INTEGER */ - { 232, -2 }, /* (207) signed ::= NK_PLUS NK_INTEGER */ - { 232, -2 }, /* (208) signed ::= NK_MINUS NK_INTEGER */ - { 232, -1 }, /* (209) signed ::= NK_FLOAT */ - { 232, -2 }, /* (210) signed ::= NK_PLUS NK_FLOAT */ - { 232, -2 }, /* (211) signed ::= NK_MINUS NK_FLOAT */ - { 233, -1 }, /* (212) signed_literal ::= signed */ - { 233, -1 }, /* (213) signed_literal ::= NK_STRING */ - { 233, -1 }, /* (214) signed_literal ::= NK_BOOL */ - { 233, -2 }, /* (215) signed_literal ::= TIMESTAMP NK_STRING */ - { 233, -1 }, /* (216) signed_literal ::= duration_literal */ - { 233, -1 }, /* (217) signed_literal ::= NULL */ - { 207, -1 }, /* (218) literal_list ::= signed_literal */ - { 207, -3 }, /* (219) literal_list ::= literal_list NK_COMMA signed_literal */ - { 188, -1 }, /* (220) db_name ::= NK_ID */ - { 210, -1 }, /* (221) table_name ::= NK_ID */ - { 203, -1 }, /* (222) column_name ::= NK_ID */ - { 220, -1 }, /* (223) function_name ::= NK_ID */ - { 234, -1 }, /* (224) table_alias ::= NK_ID */ - { 235, -1 }, /* (225) column_alias ::= NK_ID */ - { 184, -1 }, /* (226) user_name ::= NK_ID */ - { 221, -1 }, /* (227) index_name ::= NK_ID */ - { 228, -1 }, /* (228) topic_name ::= NK_ID */ - { 236, -1 }, /* (229) expression ::= literal */ - { 236, -1 }, /* (230) expression ::= pseudo_column */ - { 236, -1 }, /* (231) expression ::= column_reference */ - { 236, -4 }, /* (232) expression ::= function_name NK_LP expression_list NK_RP */ - { 236, -4 }, /* (233) expression ::= function_name NK_LP NK_STAR NK_RP */ - { 236, -1 }, /* (234) expression ::= subquery */ - { 236, -3 }, /* (235) expression ::= NK_LP expression NK_RP */ - { 236, -2 }, /* (236) expression ::= NK_PLUS expression */ - { 236, -2 }, /* (237) expression ::= NK_MINUS expression */ - { 236, -3 }, /* (238) expression ::= expression NK_PLUS expression */ - { 236, -3 }, /* (239) expression ::= expression NK_MINUS expression */ - { 236, -3 }, /* (240) expression ::= expression NK_STAR expression */ - { 236, -3 }, /* (241) expression ::= expression NK_SLASH expression */ - { 236, -3 }, /* (242) expression ::= expression NK_REM expression */ - { 227, -1 }, /* (243) expression_list ::= expression */ - { 227, -3 }, /* (244) expression_list ::= expression_list NK_COMMA expression */ - { 238, -1 }, /* (245) column_reference ::= column_name */ - { 238, -3 }, /* (246) column_reference ::= table_name NK_DOT column_name */ - { 237, -2 }, /* (247) pseudo_column ::= NK_UNDERLINE ROWTS */ - { 237, -1 }, /* (248) pseudo_column ::= TBNAME */ - { 237, -2 }, /* (249) pseudo_column ::= NK_UNDERLINE QSTARTTS */ - { 237, -2 }, /* (250) pseudo_column ::= NK_UNDERLINE QENDTS */ - { 237, -2 }, /* (251) pseudo_column ::= NK_UNDERLINE WSTARTTS */ - { 237, -2 }, /* (252) pseudo_column ::= NK_UNDERLINE WENDTS */ - { 237, -2 }, /* (253) pseudo_column ::= NK_UNDERLINE WDURATION */ - { 240, -3 }, /* (254) predicate ::= expression compare_op expression */ - { 240, -5 }, /* (255) predicate ::= expression BETWEEN expression AND expression */ - { 240, -6 }, /* (256) predicate ::= expression NOT BETWEEN expression AND expression */ - { 240, -3 }, /* (257) predicate ::= expression IS NULL */ - { 240, -4 }, /* (258) predicate ::= expression IS NOT NULL */ - { 240, -3 }, /* (259) predicate ::= expression in_op in_predicate_value */ - { 241, -1 }, /* (260) compare_op ::= NK_LT */ - { 241, -1 }, /* (261) compare_op ::= NK_GT */ - { 241, -1 }, /* (262) compare_op ::= NK_LE */ - { 241, -1 }, /* (263) compare_op ::= NK_GE */ - { 241, -1 }, /* (264) compare_op ::= NK_NE */ - { 241, -1 }, /* (265) compare_op ::= NK_EQ */ - { 241, -1 }, /* (266) compare_op ::= LIKE */ - { 241, -2 }, /* (267) compare_op ::= NOT LIKE */ - { 241, -1 }, /* (268) compare_op ::= MATCH */ - { 241, -1 }, /* (269) compare_op ::= NMATCH */ - { 242, -1 }, /* (270) in_op ::= IN */ - { 242, -2 }, /* (271) in_op ::= NOT IN */ - { 243, -3 }, /* (272) in_predicate_value ::= NK_LP expression_list NK_RP */ - { 244, -1 }, /* (273) boolean_value_expression ::= boolean_primary */ - { 244, -2 }, /* (274) boolean_value_expression ::= NOT boolean_primary */ - { 244, -3 }, /* (275) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - { 244, -3 }, /* (276) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - { 245, -1 }, /* (277) boolean_primary ::= predicate */ - { 245, -3 }, /* (278) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - { 246, -1 }, /* (279) common_expression ::= expression */ - { 246, -1 }, /* (280) common_expression ::= boolean_value_expression */ - { 247, -2 }, /* (281) from_clause ::= FROM table_reference_list */ - { 248, -1 }, /* (282) table_reference_list ::= table_reference */ - { 248, -3 }, /* (283) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - { 249, -1 }, /* (284) table_reference ::= table_primary */ - { 249, -1 }, /* (285) table_reference ::= joined_table */ - { 250, -2 }, /* (286) table_primary ::= table_name alias_opt */ - { 250, -4 }, /* (287) table_primary ::= db_name NK_DOT table_name alias_opt */ - { 250, -2 }, /* (288) table_primary ::= subquery alias_opt */ - { 250, -1 }, /* (289) table_primary ::= parenthesized_joined_table */ - { 252, 0 }, /* (290) alias_opt ::= */ - { 252, -1 }, /* (291) alias_opt ::= table_alias */ - { 252, -2 }, /* (292) alias_opt ::= AS table_alias */ - { 253, -3 }, /* (293) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - { 253, -3 }, /* (294) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - { 251, -6 }, /* (295) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ - { 254, 0 }, /* (296) join_type ::= */ - { 254, -1 }, /* (297) join_type ::= INNER */ - { 256, -9 }, /* (298) 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 */ - { 257, 0 }, /* (299) set_quantifier_opt ::= */ - { 257, -1 }, /* (300) set_quantifier_opt ::= DISTINCT */ - { 257, -1 }, /* (301) set_quantifier_opt ::= ALL */ - { 258, -1 }, /* (302) select_list ::= NK_STAR */ - { 258, -1 }, /* (303) select_list ::= select_sublist */ - { 264, -1 }, /* (304) select_sublist ::= select_item */ - { 264, -3 }, /* (305) select_sublist ::= select_sublist NK_COMMA select_item */ - { 265, -1 }, /* (306) select_item ::= common_expression */ - { 265, -2 }, /* (307) select_item ::= common_expression column_alias */ - { 265, -3 }, /* (308) select_item ::= common_expression AS column_alias */ - { 265, -3 }, /* (309) select_item ::= table_name NK_DOT NK_STAR */ - { 259, 0 }, /* (310) where_clause_opt ::= */ - { 259, -2 }, /* (311) where_clause_opt ::= WHERE search_condition */ - { 260, 0 }, /* (312) partition_by_clause_opt ::= */ - { 260, -3 }, /* (313) partition_by_clause_opt ::= PARTITION BY expression_list */ - { 261, 0 }, /* (314) twindow_clause_opt ::= */ - { 261, -6 }, /* (315) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ - { 261, -4 }, /* (316) twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP */ - { 261, -6 }, /* (317) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ - { 261, -8 }, /* (318) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ - { 225, 0 }, /* (319) sliding_opt ::= */ - { 225, -4 }, /* (320) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ - { 266, 0 }, /* (321) fill_opt ::= */ - { 266, -4 }, /* (322) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - { 266, -6 }, /* (323) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ - { 267, -1 }, /* (324) fill_mode ::= NONE */ - { 267, -1 }, /* (325) fill_mode ::= PREV */ - { 267, -1 }, /* (326) fill_mode ::= NULL */ - { 267, -1 }, /* (327) fill_mode ::= LINEAR */ - { 267, -1 }, /* (328) fill_mode ::= NEXT */ - { 262, 0 }, /* (329) group_by_clause_opt ::= */ - { 262, -3 }, /* (330) group_by_clause_opt ::= GROUP BY group_by_list */ - { 268, -1 }, /* (331) group_by_list ::= expression */ - { 268, -3 }, /* (332) group_by_list ::= group_by_list NK_COMMA expression */ - { 263, 0 }, /* (333) having_clause_opt ::= */ - { 263, -2 }, /* (334) having_clause_opt ::= HAVING search_condition */ - { 229, -4 }, /* (335) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ - { 269, -1 }, /* (336) query_expression_body ::= query_primary */ - { 269, -4 }, /* (337) query_expression_body ::= query_expression_body UNION ALL query_expression_body */ - { 273, -1 }, /* (338) query_primary ::= query_specification */ - { 270, 0 }, /* (339) order_by_clause_opt ::= */ - { 270, -3 }, /* (340) order_by_clause_opt ::= ORDER BY sort_specification_list */ - { 271, 0 }, /* (341) slimit_clause_opt ::= */ - { 271, -2 }, /* (342) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - { 271, -4 }, /* (343) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - { 271, -4 }, /* (344) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - { 272, 0 }, /* (345) limit_clause_opt ::= */ - { 272, -2 }, /* (346) limit_clause_opt ::= LIMIT NK_INTEGER */ - { 272, -4 }, /* (347) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - { 272, -4 }, /* (348) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - { 239, -3 }, /* (349) subquery ::= NK_LP query_expression NK_RP */ - { 255, -1 }, /* (350) search_condition ::= common_expression */ - { 274, -1 }, /* (351) sort_specification_list ::= sort_specification */ - { 274, -3 }, /* (352) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - { 275, -3 }, /* (353) sort_specification ::= expression ordering_specification_opt null_ordering_opt */ - { 276, 0 }, /* (354) ordering_specification_opt ::= */ - { 276, -1 }, /* (355) ordering_specification_opt ::= ASC */ - { 276, -1 }, /* (356) ordering_specification_opt ::= DESC */ - { 277, 0 }, /* (357) null_ordering_opt ::= */ - { 277, -2 }, /* (358) null_ordering_opt ::= NULLS FIRST */ - { 277, -2 }, /* (359) null_ordering_opt ::= NULLS LAST */ + { 201, -6 }, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ + { 201, -4 }, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ + { 202, 0 }, /* (2) account_options ::= */ + { 202, -3 }, /* (3) account_options ::= account_options PPS literal */ + { 202, -3 }, /* (4) account_options ::= account_options TSERIES literal */ + { 202, -3 }, /* (5) account_options ::= account_options STORAGE literal */ + { 202, -3 }, /* (6) account_options ::= account_options STREAMS literal */ + { 202, -3 }, /* (7) account_options ::= account_options QTIME literal */ + { 202, -3 }, /* (8) account_options ::= account_options DBS literal */ + { 202, -3 }, /* (9) account_options ::= account_options USERS literal */ + { 202, -3 }, /* (10) account_options ::= account_options CONNS literal */ + { 202, -3 }, /* (11) account_options ::= account_options STATE literal */ + { 203, -1 }, /* (12) alter_account_options ::= alter_account_option */ + { 203, -2 }, /* (13) alter_account_options ::= alter_account_options alter_account_option */ + { 205, -2 }, /* (14) alter_account_option ::= PASS literal */ + { 205, -2 }, /* (15) alter_account_option ::= PPS literal */ + { 205, -2 }, /* (16) alter_account_option ::= TSERIES literal */ + { 205, -2 }, /* (17) alter_account_option ::= STORAGE literal */ + { 205, -2 }, /* (18) alter_account_option ::= STREAMS literal */ + { 205, -2 }, /* (19) alter_account_option ::= QTIME literal */ + { 205, -2 }, /* (20) alter_account_option ::= DBS literal */ + { 205, -2 }, /* (21) alter_account_option ::= USERS literal */ + { 205, -2 }, /* (22) alter_account_option ::= CONNS literal */ + { 205, -2 }, /* (23) alter_account_option ::= STATE literal */ + { 201, -5 }, /* (24) cmd ::= CREATE USER user_name PASS NK_STRING */ + { 201, -5 }, /* (25) cmd ::= ALTER USER user_name PASS NK_STRING */ + { 201, -5 }, /* (26) cmd ::= ALTER USER user_name PRIVILEGE NK_STRING */ + { 201, -3 }, /* (27) cmd ::= DROP USER user_name */ + { 201, -3 }, /* (28) cmd ::= CREATE DNODE dnode_endpoint */ + { 201, -5 }, /* (29) cmd ::= CREATE DNODE dnode_host_name PORT NK_INTEGER */ + { 201, -3 }, /* (30) cmd ::= DROP DNODE NK_INTEGER */ + { 201, -3 }, /* (31) cmd ::= DROP DNODE dnode_endpoint */ + { 201, -4 }, /* (32) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ + { 201, -5 }, /* (33) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ + { 201, -4 }, /* (34) cmd ::= ALTER ALL DNODES NK_STRING */ + { 201, -5 }, /* (35) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ + { 207, -1 }, /* (36) dnode_endpoint ::= NK_STRING */ + { 208, -1 }, /* (37) dnode_host_name ::= NK_ID */ + { 208, -1 }, /* (38) dnode_host_name ::= NK_IPTOKEN */ + { 201, -3 }, /* (39) cmd ::= ALTER LOCAL NK_STRING */ + { 201, -4 }, /* (40) cmd ::= ALTER LOCAL NK_STRING NK_STRING */ + { 201, -5 }, /* (41) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ + { 201, -5 }, /* (42) cmd ::= DROP QNODE ON DNODE NK_INTEGER */ + { 201, -5 }, /* (43) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ + { 201, -4 }, /* (44) cmd ::= DROP DATABASE exists_opt db_name */ + { 201, -2 }, /* (45) cmd ::= USE db_name */ + { 201, -4 }, /* (46) cmd ::= ALTER DATABASE db_name alter_db_options */ + { 209, -3 }, /* (47) not_exists_opt ::= IF NOT EXISTS */ + { 209, 0 }, /* (48) not_exists_opt ::= */ + { 212, -2 }, /* (49) exists_opt ::= IF EXISTS */ + { 212, 0 }, /* (50) exists_opt ::= */ + { 211, 0 }, /* (51) db_options ::= */ + { 211, -3 }, /* (52) db_options ::= db_options BLOCKS NK_INTEGER */ + { 211, -3 }, /* (53) db_options ::= db_options CACHE NK_INTEGER */ + { 211, -3 }, /* (54) db_options ::= db_options CACHELAST NK_INTEGER */ + { 211, -3 }, /* (55) db_options ::= db_options COMP NK_INTEGER */ + { 211, -3 }, /* (56) db_options ::= db_options DAYS NK_INTEGER */ + { 211, -3 }, /* (57) db_options ::= db_options FSYNC NK_INTEGER */ + { 211, -3 }, /* (58) db_options ::= db_options MAXROWS NK_INTEGER */ + { 211, -3 }, /* (59) db_options ::= db_options MINROWS NK_INTEGER */ + { 211, -3 }, /* (60) db_options ::= db_options KEEP integer_list */ + { 211, -3 }, /* (61) db_options ::= db_options PRECISION NK_STRING */ + { 211, -3 }, /* (62) db_options ::= db_options QUORUM NK_INTEGER */ + { 211, -3 }, /* (63) db_options ::= db_options REPLICA NK_INTEGER */ + { 211, -3 }, /* (64) db_options ::= db_options TTL NK_INTEGER */ + { 211, -3 }, /* (65) db_options ::= db_options WAL NK_INTEGER */ + { 211, -3 }, /* (66) db_options ::= db_options VGROUPS NK_INTEGER */ + { 211, -3 }, /* (67) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ + { 211, -3 }, /* (68) db_options ::= db_options STREAM_MODE NK_INTEGER */ + { 211, -3 }, /* (69) db_options ::= db_options RETENTIONS NK_STRING */ + { 213, -1 }, /* (70) alter_db_options ::= alter_db_option */ + { 213, -2 }, /* (71) alter_db_options ::= alter_db_options alter_db_option */ + { 215, -2 }, /* (72) alter_db_option ::= BLOCKS NK_INTEGER */ + { 215, -2 }, /* (73) alter_db_option ::= FSYNC NK_INTEGER */ + { 215, -2 }, /* (74) alter_db_option ::= KEEP integer_list */ + { 215, -2 }, /* (75) alter_db_option ::= WAL NK_INTEGER */ + { 215, -2 }, /* (76) alter_db_option ::= QUORUM NK_INTEGER */ + { 215, -2 }, /* (77) alter_db_option ::= CACHELAST NK_INTEGER */ + { 215, -2 }, /* (78) alter_db_option ::= REPLICA NK_INTEGER */ + { 214, -1 }, /* (79) integer_list ::= NK_INTEGER */ + { 214, -3 }, /* (80) integer_list ::= integer_list NK_COMMA NK_INTEGER */ + { 201, -9 }, /* (81) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ + { 201, -3 }, /* (82) cmd ::= CREATE TABLE multi_create_clause */ + { 201, -9 }, /* (83) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ + { 201, -3 }, /* (84) cmd ::= DROP TABLE multi_drop_clause */ + { 201, -4 }, /* (85) cmd ::= DROP STABLE exists_opt full_table_name */ + { 201, -3 }, /* (86) cmd ::= ALTER TABLE alter_table_clause */ + { 201, -3 }, /* (87) cmd ::= ALTER STABLE alter_table_clause */ + { 223, -2 }, /* (88) alter_table_clause ::= full_table_name alter_table_options */ + { 223, -5 }, /* (89) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ + { 223, -4 }, /* (90) alter_table_clause ::= full_table_name DROP COLUMN column_name */ + { 223, -5 }, /* (91) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ + { 223, -5 }, /* (92) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ + { 223, -5 }, /* (93) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ + { 223, -4 }, /* (94) alter_table_clause ::= full_table_name DROP TAG column_name */ + { 223, -5 }, /* (95) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ + { 223, -5 }, /* (96) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ + { 223, -6 }, /* (97) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ literal */ + { 220, -1 }, /* (98) multi_create_clause ::= create_subtable_clause */ + { 220, -2 }, /* (99) multi_create_clause ::= multi_create_clause create_subtable_clause */ + { 227, -9 }, /* (100) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP */ + { 222, -1 }, /* (101) multi_drop_clause ::= drop_table_clause */ + { 222, -2 }, /* (102) multi_drop_clause ::= multi_drop_clause drop_table_clause */ + { 230, -2 }, /* (103) drop_table_clause ::= exists_opt full_table_name */ + { 228, 0 }, /* (104) specific_tags_opt ::= */ + { 228, -3 }, /* (105) specific_tags_opt ::= NK_LP col_name_list NK_RP */ + { 216, -1 }, /* (106) full_table_name ::= table_name */ + { 216, -3 }, /* (107) full_table_name ::= db_name NK_DOT table_name */ + { 217, -1 }, /* (108) column_def_list ::= column_def */ + { 217, -3 }, /* (109) column_def_list ::= column_def_list NK_COMMA column_def */ + { 233, -2 }, /* (110) column_def ::= column_name type_name */ + { 233, -4 }, /* (111) column_def ::= column_name type_name COMMENT NK_STRING */ + { 226, -1 }, /* (112) type_name ::= BOOL */ + { 226, -1 }, /* (113) type_name ::= TINYINT */ + { 226, -1 }, /* (114) type_name ::= SMALLINT */ + { 226, -1 }, /* (115) type_name ::= INT */ + { 226, -1 }, /* (116) type_name ::= INTEGER */ + { 226, -1 }, /* (117) type_name ::= BIGINT */ + { 226, -1 }, /* (118) type_name ::= FLOAT */ + { 226, -1 }, /* (119) type_name ::= DOUBLE */ + { 226, -4 }, /* (120) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ + { 226, -1 }, /* (121) type_name ::= TIMESTAMP */ + { 226, -4 }, /* (122) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ + { 226, -2 }, /* (123) type_name ::= TINYINT UNSIGNED */ + { 226, -2 }, /* (124) type_name ::= SMALLINT UNSIGNED */ + { 226, -2 }, /* (125) type_name ::= INT UNSIGNED */ + { 226, -2 }, /* (126) type_name ::= BIGINT UNSIGNED */ + { 226, -1 }, /* (127) type_name ::= JSON */ + { 226, -4 }, /* (128) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ + { 226, -1 }, /* (129) type_name ::= MEDIUMBLOB */ + { 226, -1 }, /* (130) type_name ::= BLOB */ + { 226, -4 }, /* (131) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ + { 226, -1 }, /* (132) type_name ::= DECIMAL */ + { 226, -4 }, /* (133) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ + { 226, -6 }, /* (134) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + { 218, 0 }, /* (135) tags_def_opt ::= */ + { 218, -1 }, /* (136) tags_def_opt ::= tags_def */ + { 221, -4 }, /* (137) tags_def ::= TAGS NK_LP column_def_list NK_RP */ + { 219, 0 }, /* (138) table_options ::= */ + { 219, -3 }, /* (139) table_options ::= table_options COMMENT NK_STRING */ + { 219, -3 }, /* (140) table_options ::= table_options KEEP integer_list */ + { 219, -3 }, /* (141) table_options ::= table_options TTL NK_INTEGER */ + { 219, -5 }, /* (142) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ + { 219, -5 }, /* (143) table_options ::= table_options ROLLUP NK_LP func_name_list NK_RP */ + { 219, -3 }, /* (144) table_options ::= table_options FILE_FACTOR NK_FLOAT */ + { 219, -3 }, /* (145) table_options ::= table_options DELAY NK_INTEGER */ + { 224, -1 }, /* (146) alter_table_options ::= alter_table_option */ + { 224, -2 }, /* (147) alter_table_options ::= alter_table_options alter_table_option */ + { 235, -2 }, /* (148) alter_table_option ::= COMMENT NK_STRING */ + { 235, -2 }, /* (149) alter_table_option ::= KEEP integer_list */ + { 235, -2 }, /* (150) alter_table_option ::= TTL NK_INTEGER */ + { 231, -1 }, /* (151) col_name_list ::= col_name */ + { 231, -3 }, /* (152) col_name_list ::= col_name_list NK_COMMA col_name */ + { 236, -1 }, /* (153) col_name ::= column_name */ + { 201, -2 }, /* (154) cmd ::= SHOW DNODES */ + { 201, -2 }, /* (155) cmd ::= SHOW USERS */ + { 201, -2 }, /* (156) cmd ::= SHOW DATABASES */ + { 201, -4 }, /* (157) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ + { 201, -4 }, /* (158) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ + { 201, -3 }, /* (159) cmd ::= SHOW db_name_cond_opt VGROUPS */ + { 201, -2 }, /* (160) cmd ::= SHOW MNODES */ + { 201, -2 }, /* (161) cmd ::= SHOW MODULES */ + { 201, -2 }, /* (162) cmd ::= SHOW QNODES */ + { 201, -2 }, /* (163) cmd ::= SHOW FUNCTIONS */ + { 201, -5 }, /* (164) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ + { 201, -2 }, /* (165) cmd ::= SHOW STREAMS */ + { 201, -2 }, /* (166) cmd ::= SHOW ACCOUNTS */ + { 201, -2 }, /* (167) cmd ::= SHOW APPS */ + { 201, -2 }, /* (168) cmd ::= SHOW CONNECTIONS */ + { 201, -2 }, /* (169) cmd ::= SHOW LICENCE */ + { 201, -4 }, /* (170) cmd ::= SHOW CREATE DATABASE db_name */ + { 201, -4 }, /* (171) cmd ::= SHOW CREATE TABLE full_table_name */ + { 201, -4 }, /* (172) cmd ::= SHOW CREATE STABLE full_table_name */ + { 201, -2 }, /* (173) cmd ::= SHOW QUERIES */ + { 201, -2 }, /* (174) cmd ::= SHOW SCORES */ + { 201, -2 }, /* (175) cmd ::= SHOW TOPICS */ + { 201, -2 }, /* (176) cmd ::= SHOW VARIABLES */ + { 237, 0 }, /* (177) db_name_cond_opt ::= */ + { 237, -2 }, /* (178) db_name_cond_opt ::= db_name NK_DOT */ + { 238, 0 }, /* (179) like_pattern_opt ::= */ + { 238, -2 }, /* (180) like_pattern_opt ::= LIKE NK_STRING */ + { 239, -1 }, /* (181) table_name_cond ::= table_name */ + { 240, 0 }, /* (182) from_db_opt ::= */ + { 240, -2 }, /* (183) from_db_opt ::= FROM db_name */ + { 234, -1 }, /* (184) func_name_list ::= func_name */ + { 234, -3 }, /* (185) func_name_list ::= func_name_list NK_COMMA col_name */ + { 241, -1 }, /* (186) func_name ::= function_name */ + { 201, -8 }, /* (187) cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ + { 201, -10 }, /* (188) cmd ::= CREATE FULLTEXT INDEX not_exists_opt index_name ON table_name NK_LP col_name_list NK_RP */ + { 201, -6 }, /* (189) cmd ::= DROP INDEX exists_opt index_name ON table_name */ + { 244, 0 }, /* (190) index_options ::= */ + { 244, -9 }, /* (191) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt */ + { 244, -11 }, /* (192) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt */ + { 245, -1 }, /* (193) func_list ::= func */ + { 245, -3 }, /* (194) func_list ::= func_list NK_COMMA func */ + { 248, -4 }, /* (195) func ::= function_name NK_LP expression_list NK_RP */ + { 201, -6 }, /* (196) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ + { 201, -6 }, /* (197) cmd ::= CREATE TOPIC not_exists_opt topic_name AS db_name */ + { 201, -4 }, /* (198) cmd ::= DROP TOPIC exists_opt topic_name */ + { 201, -2 }, /* (199) cmd ::= DESC full_table_name */ + { 201, -2 }, /* (200) cmd ::= DESCRIBE full_table_name */ + { 201, -3 }, /* (201) cmd ::= RESET QUERY CACHE */ + { 201, -4 }, /* (202) cmd ::= EXPLAIN analyze_opt explain_options query_expression */ + { 252, 0 }, /* (203) analyze_opt ::= */ + { 252, -1 }, /* (204) analyze_opt ::= ANALYZE */ + { 253, 0 }, /* (205) explain_options ::= */ + { 253, -3 }, /* (206) explain_options ::= explain_options VERBOSE NK_BOOL */ + { 253, -3 }, /* (207) explain_options ::= explain_options RATIO NK_FLOAT */ + { 201, -6 }, /* (208) cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP */ + { 201, -9 }, /* (209) cmd ::= CREATE agg_func_opt FUNCTION function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ + { 201, -3 }, /* (210) cmd ::= DROP FUNCTION function_name */ + { 254, 0 }, /* (211) agg_func_opt ::= */ + { 254, -1 }, /* (212) agg_func_opt ::= AGGREGATE */ + { 255, 0 }, /* (213) bufsize_opt ::= */ + { 255, -2 }, /* (214) bufsize_opt ::= BUFSIZE NK_INTEGER */ + { 201, -7 }, /* (215) cmd ::= CREATE STREAM stream_name INTO table_name AS query_expression */ + { 201, -3 }, /* (216) cmd ::= DROP STREAM stream_name */ + { 201, -3 }, /* (217) cmd ::= KILL CONNECTION NK_INTEGER */ + { 201, -3 }, /* (218) cmd ::= KILL QUERY NK_INTEGER */ + { 201, -4 }, /* (219) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + { 201, -4 }, /* (220) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ + { 201, -3 }, /* (221) cmd ::= SPLIT VGROUP NK_INTEGER */ + { 257, -2 }, /* (222) dnode_list ::= DNODE NK_INTEGER */ + { 257, -3 }, /* (223) dnode_list ::= dnode_list DNODE NK_INTEGER */ + { 201, -3 }, /* (224) cmd ::= SYNCDB db_name REPLICA */ + { 201, -1 }, /* (225) cmd ::= query_expression */ + { 204, -1 }, /* (226) literal ::= NK_INTEGER */ + { 204, -1 }, /* (227) literal ::= NK_FLOAT */ + { 204, -1 }, /* (228) literal ::= NK_STRING */ + { 204, -1 }, /* (229) literal ::= NK_BOOL */ + { 204, -2 }, /* (230) literal ::= TIMESTAMP NK_STRING */ + { 204, -1 }, /* (231) literal ::= duration_literal */ + { 204, -1 }, /* (232) literal ::= NULL */ + { 246, -1 }, /* (233) duration_literal ::= NK_VARIABLE */ + { 258, -1 }, /* (234) signed ::= NK_INTEGER */ + { 258, -2 }, /* (235) signed ::= NK_PLUS NK_INTEGER */ + { 258, -2 }, /* (236) signed ::= NK_MINUS NK_INTEGER */ + { 258, -1 }, /* (237) signed ::= NK_FLOAT */ + { 258, -2 }, /* (238) signed ::= NK_PLUS NK_FLOAT */ + { 258, -2 }, /* (239) signed ::= NK_MINUS NK_FLOAT */ + { 259, -1 }, /* (240) signed_literal ::= signed */ + { 259, -1 }, /* (241) signed_literal ::= NK_STRING */ + { 259, -1 }, /* (242) signed_literal ::= NK_BOOL */ + { 259, -2 }, /* (243) signed_literal ::= TIMESTAMP NK_STRING */ + { 259, -1 }, /* (244) signed_literal ::= duration_literal */ + { 259, -1 }, /* (245) signed_literal ::= NULL */ + { 229, -1 }, /* (246) literal_list ::= signed_literal */ + { 229, -3 }, /* (247) literal_list ::= literal_list NK_COMMA signed_literal */ + { 210, -1 }, /* (248) db_name ::= NK_ID */ + { 232, -1 }, /* (249) table_name ::= NK_ID */ + { 225, -1 }, /* (250) column_name ::= NK_ID */ + { 242, -1 }, /* (251) function_name ::= NK_ID */ + { 260, -1 }, /* (252) table_alias ::= NK_ID */ + { 261, -1 }, /* (253) column_alias ::= NK_ID */ + { 206, -1 }, /* (254) user_name ::= NK_ID */ + { 243, -1 }, /* (255) index_name ::= NK_ID */ + { 250, -1 }, /* (256) topic_name ::= NK_ID */ + { 256, -1 }, /* (257) stream_name ::= NK_ID */ + { 262, -1 }, /* (258) expression ::= literal */ + { 262, -1 }, /* (259) expression ::= pseudo_column */ + { 262, -1 }, /* (260) expression ::= column_reference */ + { 262, -4 }, /* (261) expression ::= function_name NK_LP expression_list NK_RP */ + { 262, -4 }, /* (262) expression ::= function_name NK_LP NK_STAR NK_RP */ + { 262, -1 }, /* (263) expression ::= subquery */ + { 262, -3 }, /* (264) expression ::= NK_LP expression NK_RP */ + { 262, -2 }, /* (265) expression ::= NK_PLUS expression */ + { 262, -2 }, /* (266) expression ::= NK_MINUS expression */ + { 262, -3 }, /* (267) expression ::= expression NK_PLUS expression */ + { 262, -3 }, /* (268) expression ::= expression NK_MINUS expression */ + { 262, -3 }, /* (269) expression ::= expression NK_STAR expression */ + { 262, -3 }, /* (270) expression ::= expression NK_SLASH expression */ + { 262, -3 }, /* (271) expression ::= expression NK_REM expression */ + { 249, -1 }, /* (272) expression_list ::= expression */ + { 249, -3 }, /* (273) expression_list ::= expression_list NK_COMMA expression */ + { 264, -1 }, /* (274) column_reference ::= column_name */ + { 264, -3 }, /* (275) column_reference ::= table_name NK_DOT column_name */ + { 263, -2 }, /* (276) pseudo_column ::= NK_UNDERLINE ROWTS */ + { 263, -1 }, /* (277) pseudo_column ::= TBNAME */ + { 263, -2 }, /* (278) pseudo_column ::= NK_UNDERLINE QSTARTTS */ + { 263, -2 }, /* (279) pseudo_column ::= NK_UNDERLINE QENDTS */ + { 263, -2 }, /* (280) pseudo_column ::= NK_UNDERLINE WSTARTTS */ + { 263, -2 }, /* (281) pseudo_column ::= NK_UNDERLINE WENDTS */ + { 263, -2 }, /* (282) pseudo_column ::= NK_UNDERLINE WDURATION */ + { 266, -3 }, /* (283) predicate ::= expression compare_op expression */ + { 266, -5 }, /* (284) predicate ::= expression BETWEEN expression AND expression */ + { 266, -6 }, /* (285) predicate ::= expression NOT BETWEEN expression AND expression */ + { 266, -3 }, /* (286) predicate ::= expression IS NULL */ + { 266, -4 }, /* (287) predicate ::= expression IS NOT NULL */ + { 266, -3 }, /* (288) predicate ::= expression in_op in_predicate_value */ + { 267, -1 }, /* (289) compare_op ::= NK_LT */ + { 267, -1 }, /* (290) compare_op ::= NK_GT */ + { 267, -1 }, /* (291) compare_op ::= NK_LE */ + { 267, -1 }, /* (292) compare_op ::= NK_GE */ + { 267, -1 }, /* (293) compare_op ::= NK_NE */ + { 267, -1 }, /* (294) compare_op ::= NK_EQ */ + { 267, -1 }, /* (295) compare_op ::= LIKE */ + { 267, -2 }, /* (296) compare_op ::= NOT LIKE */ + { 267, -1 }, /* (297) compare_op ::= MATCH */ + { 267, -1 }, /* (298) compare_op ::= NMATCH */ + { 268, -1 }, /* (299) in_op ::= IN */ + { 268, -2 }, /* (300) in_op ::= NOT IN */ + { 269, -3 }, /* (301) in_predicate_value ::= NK_LP expression_list NK_RP */ + { 270, -1 }, /* (302) boolean_value_expression ::= boolean_primary */ + { 270, -2 }, /* (303) boolean_value_expression ::= NOT boolean_primary */ + { 270, -3 }, /* (304) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + { 270, -3 }, /* (305) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + { 271, -1 }, /* (306) boolean_primary ::= predicate */ + { 271, -3 }, /* (307) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + { 272, -1 }, /* (308) common_expression ::= expression */ + { 272, -1 }, /* (309) common_expression ::= boolean_value_expression */ + { 273, -2 }, /* (310) from_clause ::= FROM table_reference_list */ + { 274, -1 }, /* (311) table_reference_list ::= table_reference */ + { 274, -3 }, /* (312) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + { 275, -1 }, /* (313) table_reference ::= table_primary */ + { 275, -1 }, /* (314) table_reference ::= joined_table */ + { 276, -2 }, /* (315) table_primary ::= table_name alias_opt */ + { 276, -4 }, /* (316) table_primary ::= db_name NK_DOT table_name alias_opt */ + { 276, -2 }, /* (317) table_primary ::= subquery alias_opt */ + { 276, -1 }, /* (318) table_primary ::= parenthesized_joined_table */ + { 278, 0 }, /* (319) alias_opt ::= */ + { 278, -1 }, /* (320) alias_opt ::= table_alias */ + { 278, -2 }, /* (321) alias_opt ::= AS table_alias */ + { 279, -3 }, /* (322) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + { 279, -3 }, /* (323) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + { 277, -6 }, /* (324) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ + { 280, 0 }, /* (325) join_type ::= */ + { 280, -1 }, /* (326) join_type ::= INNER */ + { 282, -9 }, /* (327) query_specification ::= SELECT set_quantifier_opt select_list from_clause where_clause_opt partition_by_clause_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ + { 283, 0 }, /* (328) set_quantifier_opt ::= */ + { 283, -1 }, /* (329) set_quantifier_opt ::= DISTINCT */ + { 283, -1 }, /* (330) set_quantifier_opt ::= ALL */ + { 284, -1 }, /* (331) select_list ::= NK_STAR */ + { 284, -1 }, /* (332) select_list ::= select_sublist */ + { 290, -1 }, /* (333) select_sublist ::= select_item */ + { 290, -3 }, /* (334) select_sublist ::= select_sublist NK_COMMA select_item */ + { 291, -1 }, /* (335) select_item ::= common_expression */ + { 291, -2 }, /* (336) select_item ::= common_expression column_alias */ + { 291, -3 }, /* (337) select_item ::= common_expression AS column_alias */ + { 291, -3 }, /* (338) select_item ::= table_name NK_DOT NK_STAR */ + { 285, 0 }, /* (339) where_clause_opt ::= */ + { 285, -2 }, /* (340) where_clause_opt ::= WHERE search_condition */ + { 286, 0 }, /* (341) partition_by_clause_opt ::= */ + { 286, -3 }, /* (342) partition_by_clause_opt ::= PARTITION BY expression_list */ + { 287, 0 }, /* (343) twindow_clause_opt ::= */ + { 287, -6 }, /* (344) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ + { 287, -4 }, /* (345) twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP */ + { 287, -6 }, /* (346) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ + { 287, -8 }, /* (347) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ + { 247, 0 }, /* (348) sliding_opt ::= */ + { 247, -4 }, /* (349) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ + { 292, 0 }, /* (350) fill_opt ::= */ + { 292, -4 }, /* (351) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + { 292, -6 }, /* (352) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ + { 293, -1 }, /* (353) fill_mode ::= NONE */ + { 293, -1 }, /* (354) fill_mode ::= PREV */ + { 293, -1 }, /* (355) fill_mode ::= NULL */ + { 293, -1 }, /* (356) fill_mode ::= LINEAR */ + { 293, -1 }, /* (357) fill_mode ::= NEXT */ + { 288, 0 }, /* (358) group_by_clause_opt ::= */ + { 288, -3 }, /* (359) group_by_clause_opt ::= GROUP BY group_by_list */ + { 294, -1 }, /* (360) group_by_list ::= expression */ + { 294, -3 }, /* (361) group_by_list ::= group_by_list NK_COMMA expression */ + { 289, 0 }, /* (362) having_clause_opt ::= */ + { 289, -2 }, /* (363) having_clause_opt ::= HAVING search_condition */ + { 251, -4 }, /* (364) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ + { 295, -1 }, /* (365) query_expression_body ::= query_primary */ + { 295, -4 }, /* (366) query_expression_body ::= query_expression_body UNION ALL query_expression_body */ + { 299, -1 }, /* (367) query_primary ::= query_specification */ + { 296, 0 }, /* (368) order_by_clause_opt ::= */ + { 296, -3 }, /* (369) order_by_clause_opt ::= ORDER BY sort_specification_list */ + { 297, 0 }, /* (370) slimit_clause_opt ::= */ + { 297, -2 }, /* (371) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + { 297, -4 }, /* (372) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + { 297, -4 }, /* (373) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 298, 0 }, /* (374) limit_clause_opt ::= */ + { 298, -2 }, /* (375) limit_clause_opt ::= LIMIT NK_INTEGER */ + { 298, -4 }, /* (376) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + { 298, -4 }, /* (377) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 265, -3 }, /* (378) subquery ::= NK_LP query_expression NK_RP */ + { 281, -1 }, /* (379) search_condition ::= common_expression */ + { 300, -1 }, /* (380) sort_specification_list ::= sort_specification */ + { 300, -3 }, /* (381) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + { 301, -3 }, /* (382) sort_specification ::= expression ordering_specification_opt null_ordering_opt */ + { 302, 0 }, /* (383) ordering_specification_opt ::= */ + { 302, -1 }, /* (384) ordering_specification_opt ::= ASC */ + { 302, -1 }, /* (385) ordering_specification_opt ::= DESC */ + { 303, 0 }, /* (386) null_ordering_opt ::= */ + { 303, -2 }, /* (387) null_ordering_opt ::= NULLS FIRST */ + { 303, -2 }, /* (388) null_ordering_opt ::= NULLS LAST */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -2386,11 +2509,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,180,&yymsp[0].minor); + yy_destructor(yypParser,202,&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,181,&yymsp[0].minor); + yy_destructor(yypParser,203,&yymsp[0].minor); break; case 2: /* account_options ::= */ { } @@ -2404,20 +2527,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,180,&yymsp[-2].minor); +{ yy_destructor(yypParser,202,&yymsp[-2].minor); { } - yy_destructor(yypParser,182,&yymsp[0].minor); + yy_destructor(yypParser,204,&yymsp[0].minor); } break; case 12: /* alter_account_options ::= alter_account_option */ -{ yy_destructor(yypParser,183,&yymsp[0].minor); +{ yy_destructor(yypParser,205,&yymsp[0].minor); { } } break; case 13: /* alter_account_options ::= alter_account_options alter_account_option */ -{ yy_destructor(yypParser,181,&yymsp[-1].minor); +{ yy_destructor(yypParser,203,&yymsp[-1].minor); { } - yy_destructor(yypParser,183,&yymsp[0].minor); + yy_destructor(yypParser,205,&yymsp[0].minor); } break; case 14: /* alter_account_option ::= PASS literal */ @@ -2431,31 +2554,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,182,&yymsp[0].minor); + yy_destructor(yypParser,204,&yymsp[0].minor); break; case 24: /* cmd ::= CREATE USER user_name PASS NK_STRING */ -{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-2].minor.yy337, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-2].minor.yy129, &yymsp[0].minor.yy0); } break; case 25: /* cmd ::= ALTER USER user_name PASS NK_STRING */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy337, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy129, 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.yy337, TSDB_ALTER_USER_PRIVILEGES, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy129, TSDB_ALTER_USER_PRIVILEGES, &yymsp[0].minor.yy0); } break; case 27: /* cmd ::= DROP USER user_name */ -{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy337); } +{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy129); } break; case 28: /* cmd ::= CREATE DNODE dnode_endpoint */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy337, NULL); } +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy129, NULL); } break; case 29: /* cmd ::= CREATE DNODE dnode_host_name PORT NK_INTEGER */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy337, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy129, &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.yy337); } +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy129); } break; case 32: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); } @@ -2472,17 +2595,18 @@ 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 220: /* db_name ::= NK_ID */ yytestcase(yyruleno==220); - case 221: /* table_name ::= NK_ID */ yytestcase(yyruleno==221); - case 222: /* column_name ::= NK_ID */ yytestcase(yyruleno==222); - case 223: /* function_name ::= NK_ID */ yytestcase(yyruleno==223); - case 224: /* table_alias ::= NK_ID */ yytestcase(yyruleno==224); - case 225: /* column_alias ::= NK_ID */ yytestcase(yyruleno==225); - case 226: /* user_name ::= NK_ID */ yytestcase(yyruleno==226); - case 227: /* index_name ::= NK_ID */ yytestcase(yyruleno==227); - case 228: /* topic_name ::= NK_ID */ yytestcase(yyruleno==228); -{ yylhsminor.yy337 = yymsp[0].minor.yy0; } - yymsp[0].minor.yy337 = yylhsminor.yy337; + case 248: /* db_name ::= NK_ID */ yytestcase(yyruleno==248); + case 249: /* table_name ::= NK_ID */ yytestcase(yyruleno==249); + case 250: /* column_name ::= NK_ID */ yytestcase(yyruleno==250); + case 251: /* function_name ::= NK_ID */ yytestcase(yyruleno==251); + case 252: /* table_alias ::= NK_ID */ yytestcase(yyruleno==252); + case 253: /* column_alias ::= NK_ID */ yytestcase(yyruleno==253); + case 254: /* user_name ::= NK_ID */ yytestcase(yyruleno==254); + case 255: /* index_name ::= NK_ID */ yytestcase(yyruleno==255); + case 256: /* topic_name ::= NK_ID */ yytestcase(yyruleno==256); + case 257: /* stream_name ::= NK_ID */ yytestcase(yyruleno==257); +{ yylhsminor.yy129 = yymsp[0].minor.yy0; } + yymsp[0].minor.yy129 = yylhsminor.yy129; break; case 39: /* cmd ::= ALTER LOCAL NK_STRING */ { pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[0].minor.yy0, NULL); } @@ -2497,386 +2621,388 @@ 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.yy265, &yymsp[-1].minor.yy337, yymsp[0].minor.yy24); } +{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy185, &yymsp[-1].minor.yy129, yymsp[0].minor.yy104); } break; case 44: /* cmd ::= DROP DATABASE exists_opt db_name */ -{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy265, &yymsp[0].minor.yy337); } +{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy185, &yymsp[0].minor.yy129); } break; case 45: /* cmd ::= USE db_name */ -{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy337); } +{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy129); } break; case 46: /* cmd ::= ALTER DATABASE db_name alter_db_options */ -{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy337, yymsp[0].minor.yy24); } +{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy129, yymsp[0].minor.yy104); } break; case 47: /* not_exists_opt ::= IF NOT EXISTS */ -{ yymsp[-2].minor.yy265 = true; } +{ yymsp[-2].minor.yy185 = true; } break; case 48: /* not_exists_opt ::= */ case 50: /* exists_opt ::= */ yytestcase(yyruleno==50); - case 192: /* analyze_opt ::= */ yytestcase(yyruleno==192); - case 299: /* set_quantifier_opt ::= */ yytestcase(yyruleno==299); -{ yymsp[1].minor.yy265 = false; } + case 203: /* analyze_opt ::= */ yytestcase(yyruleno==203); + case 211: /* agg_func_opt ::= */ yytestcase(yyruleno==211); + case 328: /* set_quantifier_opt ::= */ yytestcase(yyruleno==328); +{ yymsp[1].minor.yy185 = false; } break; case 49: /* exists_opt ::= IF EXISTS */ -{ yymsp[-1].minor.yy265 = true; } +{ yymsp[-1].minor.yy185 = true; } break; case 51: /* db_options ::= */ -{ yymsp[1].minor.yy24 = createDefaultDatabaseOptions(pCxt); } +{ yymsp[1].minor.yy104 = createDefaultDatabaseOptions(pCxt); } break; case 52: /* db_options ::= db_options BLOCKS NK_INTEGER */ -{ yylhsminor.yy24 = setDatabaseOption(pCxt, yymsp[-2].minor.yy24, DB_OPTION_BLOCKS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy24 = yylhsminor.yy24; +{ yylhsminor.yy104 = setDatabaseOption(pCxt, yymsp[-2].minor.yy104, DB_OPTION_BLOCKS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy104 = yylhsminor.yy104; break; case 53: /* db_options ::= db_options CACHE NK_INTEGER */ -{ yylhsminor.yy24 = setDatabaseOption(pCxt, yymsp[-2].minor.yy24, DB_OPTION_CACHE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy24 = yylhsminor.yy24; +{ yylhsminor.yy104 = setDatabaseOption(pCxt, yymsp[-2].minor.yy104, DB_OPTION_CACHE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy104 = yylhsminor.yy104; break; case 54: /* db_options ::= db_options CACHELAST NK_INTEGER */ -{ yylhsminor.yy24 = setDatabaseOption(pCxt, yymsp[-2].minor.yy24, DB_OPTION_CACHELAST, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy24 = yylhsminor.yy24; +{ yylhsminor.yy104 = setDatabaseOption(pCxt, yymsp[-2].minor.yy104, DB_OPTION_CACHELAST, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy104 = yylhsminor.yy104; break; case 55: /* db_options ::= db_options COMP NK_INTEGER */ -{ yylhsminor.yy24 = setDatabaseOption(pCxt, yymsp[-2].minor.yy24, DB_OPTION_COMP, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy24 = yylhsminor.yy24; +{ yylhsminor.yy104 = setDatabaseOption(pCxt, yymsp[-2].minor.yy104, DB_OPTION_COMP, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy104 = yylhsminor.yy104; break; case 56: /* db_options ::= db_options DAYS NK_INTEGER */ -{ yylhsminor.yy24 = setDatabaseOption(pCxt, yymsp[-2].minor.yy24, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy24 = yylhsminor.yy24; +{ yylhsminor.yy104 = setDatabaseOption(pCxt, yymsp[-2].minor.yy104, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy104 = yylhsminor.yy104; break; case 57: /* db_options ::= db_options FSYNC NK_INTEGER */ -{ yylhsminor.yy24 = setDatabaseOption(pCxt, yymsp[-2].minor.yy24, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy24 = yylhsminor.yy24; +{ yylhsminor.yy104 = setDatabaseOption(pCxt, yymsp[-2].minor.yy104, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy104 = yylhsminor.yy104; break; case 58: /* db_options ::= db_options MAXROWS NK_INTEGER */ -{ yylhsminor.yy24 = setDatabaseOption(pCxt, yymsp[-2].minor.yy24, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy24 = yylhsminor.yy24; +{ yylhsminor.yy104 = setDatabaseOption(pCxt, yymsp[-2].minor.yy104, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy104 = yylhsminor.yy104; break; case 59: /* db_options ::= db_options MINROWS NK_INTEGER */ -{ yylhsminor.yy24 = setDatabaseOption(pCxt, yymsp[-2].minor.yy24, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy24 = yylhsminor.yy24; +{ yylhsminor.yy104 = setDatabaseOption(pCxt, yymsp[-2].minor.yy104, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy104 = yylhsminor.yy104; break; case 60: /* db_options ::= db_options KEEP integer_list */ -{ yylhsminor.yy24 = setDatabaseKeepOption(pCxt, yymsp[-2].minor.yy24, yymsp[0].minor.yy504); } - yymsp[-2].minor.yy24 = yylhsminor.yy24; +{ yylhsminor.yy104 = setDatabaseKeepOption(pCxt, yymsp[-2].minor.yy104, yymsp[0].minor.yy312); } + yymsp[-2].minor.yy104 = yylhsminor.yy104; break; case 61: /* db_options ::= db_options PRECISION NK_STRING */ -{ yylhsminor.yy24 = setDatabaseOption(pCxt, yymsp[-2].minor.yy24, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy24 = yylhsminor.yy24; +{ yylhsminor.yy104 = setDatabaseOption(pCxt, yymsp[-2].minor.yy104, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy104 = yylhsminor.yy104; break; case 62: /* db_options ::= db_options QUORUM NK_INTEGER */ -{ yylhsminor.yy24 = setDatabaseOption(pCxt, yymsp[-2].minor.yy24, DB_OPTION_QUORUM, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy24 = yylhsminor.yy24; +{ yylhsminor.yy104 = setDatabaseOption(pCxt, yymsp[-2].minor.yy104, DB_OPTION_QUORUM, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy104 = yylhsminor.yy104; break; case 63: /* db_options ::= db_options REPLICA NK_INTEGER */ -{ yylhsminor.yy24 = setDatabaseOption(pCxt, yymsp[-2].minor.yy24, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy24 = yylhsminor.yy24; +{ yylhsminor.yy104 = setDatabaseOption(pCxt, yymsp[-2].minor.yy104, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy104 = yylhsminor.yy104; break; case 64: /* db_options ::= db_options TTL NK_INTEGER */ -{ yylhsminor.yy24 = setDatabaseOption(pCxt, yymsp[-2].minor.yy24, DB_OPTION_TTL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy24 = yylhsminor.yy24; +{ yylhsminor.yy104 = setDatabaseOption(pCxt, yymsp[-2].minor.yy104, DB_OPTION_TTL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy104 = yylhsminor.yy104; break; case 65: /* db_options ::= db_options WAL NK_INTEGER */ -{ yylhsminor.yy24 = setDatabaseOption(pCxt, yymsp[-2].minor.yy24, DB_OPTION_WAL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy24 = yylhsminor.yy24; +{ yylhsminor.yy104 = setDatabaseOption(pCxt, yymsp[-2].minor.yy104, DB_OPTION_WAL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy104 = yylhsminor.yy104; break; case 66: /* db_options ::= db_options VGROUPS NK_INTEGER */ -{ yylhsminor.yy24 = setDatabaseOption(pCxt, yymsp[-2].minor.yy24, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy24 = yylhsminor.yy24; +{ yylhsminor.yy104 = setDatabaseOption(pCxt, yymsp[-2].minor.yy104, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy104 = yylhsminor.yy104; break; case 67: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */ -{ yylhsminor.yy24 = setDatabaseOption(pCxt, yymsp[-2].minor.yy24, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy24 = yylhsminor.yy24; +{ yylhsminor.yy104 = setDatabaseOption(pCxt, yymsp[-2].minor.yy104, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy104 = yylhsminor.yy104; break; case 68: /* db_options ::= db_options STREAM_MODE NK_INTEGER */ -{ yylhsminor.yy24 = setDatabaseOption(pCxt, yymsp[-2].minor.yy24, DB_OPTION_STREAM_MODE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy24 = yylhsminor.yy24; +{ yylhsminor.yy104 = setDatabaseOption(pCxt, yymsp[-2].minor.yy104, DB_OPTION_STREAM_MODE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy104 = yylhsminor.yy104; break; case 69: /* db_options ::= db_options RETENTIONS NK_STRING */ -{ yylhsminor.yy24 = setDatabaseOption(pCxt, yymsp[-2].minor.yy24, DB_OPTION_RETENTIONS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy24 = yylhsminor.yy24; +{ yylhsminor.yy104 = setDatabaseOption(pCxt, yymsp[-2].minor.yy104, DB_OPTION_RETENTIONS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy104 = yylhsminor.yy104; break; case 70: /* alter_db_options ::= alter_db_option */ -{ yylhsminor.yy24 = createDefaultAlterDatabaseOptions(pCxt); yylhsminor.yy24 = setDatabaseAlterOption(pCxt, yylhsminor.yy24, &yymsp[0].minor.yy553); } - yymsp[0].minor.yy24 = yylhsminor.yy24; +{ yylhsminor.yy104 = createDefaultAlterDatabaseOptions(pCxt); yylhsminor.yy104 = setDatabaseAlterOption(pCxt, yylhsminor.yy104, &yymsp[0].minor.yy253); } + yymsp[0].minor.yy104 = yylhsminor.yy104; break; case 71: /* alter_db_options ::= alter_db_options alter_db_option */ -{ yylhsminor.yy24 = setDatabaseAlterOption(pCxt, yymsp[-1].minor.yy24, &yymsp[0].minor.yy553); } - yymsp[-1].minor.yy24 = yylhsminor.yy24; +{ yylhsminor.yy104 = setDatabaseAlterOption(pCxt, yymsp[-1].minor.yy104, &yymsp[0].minor.yy253); } + yymsp[-1].minor.yy104 = yylhsminor.yy104; break; case 72: /* alter_db_option ::= BLOCKS NK_INTEGER */ -{ yymsp[-1].minor.yy553.type = DB_OPTION_BLOCKS; yymsp[-1].minor.yy553.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy253.type = DB_OPTION_BLOCKS; yymsp[-1].minor.yy253.val = yymsp[0].minor.yy0; } break; case 73: /* alter_db_option ::= FSYNC NK_INTEGER */ -{ yymsp[-1].minor.yy553.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy553.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy253.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy253.val = yymsp[0].minor.yy0; } break; case 74: /* alter_db_option ::= KEEP integer_list */ -{ yymsp[-1].minor.yy553.type = DB_OPTION_KEEP; yymsp[-1].minor.yy553.pKeep = yymsp[0].minor.yy504; } +{ yymsp[-1].minor.yy253.type = DB_OPTION_KEEP; yymsp[-1].minor.yy253.pKeep = yymsp[0].minor.yy312; } break; case 75: /* alter_db_option ::= WAL NK_INTEGER */ -{ yymsp[-1].minor.yy553.type = DB_OPTION_WAL; yymsp[-1].minor.yy553.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy253.type = DB_OPTION_WAL; yymsp[-1].minor.yy253.val = yymsp[0].minor.yy0; } break; case 76: /* alter_db_option ::= QUORUM NK_INTEGER */ -{ yymsp[-1].minor.yy553.type = DB_OPTION_QUORUM; yymsp[-1].minor.yy553.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy253.type = DB_OPTION_QUORUM; yymsp[-1].minor.yy253.val = yymsp[0].minor.yy0; } break; case 77: /* alter_db_option ::= CACHELAST NK_INTEGER */ -{ yymsp[-1].minor.yy553.type = DB_OPTION_CACHELAST; yymsp[-1].minor.yy553.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy253.type = DB_OPTION_CACHELAST; yymsp[-1].minor.yy253.val = yymsp[0].minor.yy0; } break; case 78: /* alter_db_option ::= REPLICA NK_INTEGER */ -{ yymsp[-1].minor.yy553.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy553.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy253.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy253.val = yymsp[0].minor.yy0; } break; case 79: /* integer_list ::= NK_INTEGER */ -{ yylhsminor.yy504 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy504 = yylhsminor.yy504; +{ yylhsminor.yy312 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy312 = yylhsminor.yy312; break; case 80: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */ -{ yylhsminor.yy504 = addNodeToList(pCxt, yymsp[-2].minor.yy504, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + case 223: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==223); +{ yylhsminor.yy312 = addNodeToList(pCxt, yymsp[-2].minor.yy312, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy312 = yylhsminor.yy312; break; case 81: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ case 83: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==83); -{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy265, yymsp[-5].minor.yy24, yymsp[-3].minor.yy504, yymsp[-1].minor.yy504, yymsp[0].minor.yy24); } +{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy185, yymsp[-5].minor.yy104, yymsp[-3].minor.yy312, yymsp[-1].minor.yy312, yymsp[0].minor.yy104); } break; case 82: /* cmd ::= CREATE TABLE multi_create_clause */ -{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy504); } +{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy312); } break; case 84: /* cmd ::= DROP TABLE multi_drop_clause */ -{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy504); } +{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy312); } break; case 85: /* cmd ::= DROP STABLE exists_opt full_table_name */ -{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy265, yymsp[0].minor.yy24); } +{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy185, yymsp[0].minor.yy104); } break; case 86: /* cmd ::= ALTER TABLE alter_table_clause */ case 87: /* cmd ::= ALTER STABLE alter_table_clause */ yytestcase(yyruleno==87); - case 197: /* cmd ::= query_expression */ yytestcase(yyruleno==197); -{ pCxt->pRootNode = yymsp[0].minor.yy24; } + case 225: /* cmd ::= query_expression */ yytestcase(yyruleno==225); +{ pCxt->pRootNode = yymsp[0].minor.yy104; } break; case 88: /* alter_table_clause ::= full_table_name alter_table_options */ -{ yylhsminor.yy24 = createAlterTableOption(pCxt, yymsp[-1].minor.yy24, yymsp[0].minor.yy24); } - yymsp[-1].minor.yy24 = yylhsminor.yy24; +{ yylhsminor.yy104 = createAlterTableOption(pCxt, yymsp[-1].minor.yy104, yymsp[0].minor.yy104); } + yymsp[-1].minor.yy104 = yylhsminor.yy104; break; case 89: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ -{ yylhsminor.yy24 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy24, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy337, yymsp[0].minor.yy212); } - yymsp[-4].minor.yy24 = yylhsminor.yy24; +{ yylhsminor.yy104 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy104, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy129, yymsp[0].minor.yy336); } + yymsp[-4].minor.yy104 = yylhsminor.yy104; break; case 90: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ -{ yylhsminor.yy24 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy24, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy337); } - yymsp[-3].minor.yy24 = yylhsminor.yy24; +{ yylhsminor.yy104 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy104, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy129); } + yymsp[-3].minor.yy104 = yylhsminor.yy104; break; case 91: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ -{ yylhsminor.yy24 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy24, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy337, yymsp[0].minor.yy212); } - yymsp[-4].minor.yy24 = yylhsminor.yy24; +{ yylhsminor.yy104 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy104, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy129, yymsp[0].minor.yy336); } + yymsp[-4].minor.yy104 = yylhsminor.yy104; break; case 92: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ -{ yylhsminor.yy24 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy24, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy337, &yymsp[0].minor.yy337); } - yymsp[-4].minor.yy24 = yylhsminor.yy24; +{ yylhsminor.yy104 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy104, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy129, &yymsp[0].minor.yy129); } + yymsp[-4].minor.yy104 = yylhsminor.yy104; break; case 93: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ -{ yylhsminor.yy24 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy24, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy337, yymsp[0].minor.yy212); } - yymsp[-4].minor.yy24 = yylhsminor.yy24; +{ yylhsminor.yy104 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy104, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy129, yymsp[0].minor.yy336); } + yymsp[-4].minor.yy104 = yylhsminor.yy104; break; case 94: /* alter_table_clause ::= full_table_name DROP TAG column_name */ -{ yylhsminor.yy24 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy24, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy337); } - yymsp[-3].minor.yy24 = yylhsminor.yy24; +{ yylhsminor.yy104 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy104, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy129); } + yymsp[-3].minor.yy104 = yylhsminor.yy104; break; case 95: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ -{ yylhsminor.yy24 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy24, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy337, yymsp[0].minor.yy212); } - yymsp[-4].minor.yy24 = yylhsminor.yy24; +{ yylhsminor.yy104 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy104, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy129, yymsp[0].minor.yy336); } + yymsp[-4].minor.yy104 = yylhsminor.yy104; break; case 96: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ -{ yylhsminor.yy24 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy24, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy337, &yymsp[0].minor.yy337); } - yymsp[-4].minor.yy24 = yylhsminor.yy24; +{ yylhsminor.yy104 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy104, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy129, &yymsp[0].minor.yy129); } + yymsp[-4].minor.yy104 = yylhsminor.yy104; break; case 97: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ literal */ -{ yylhsminor.yy24 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy24, &yymsp[-2].minor.yy337, yymsp[0].minor.yy24); } - yymsp[-5].minor.yy24 = yylhsminor.yy24; +{ yylhsminor.yy104 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy104, &yymsp[-2].minor.yy129, yymsp[0].minor.yy104); } + yymsp[-5].minor.yy104 = yylhsminor.yy104; break; case 98: /* multi_create_clause ::= create_subtable_clause */ case 101: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==101); case 108: /* column_def_list ::= column_def */ yytestcase(yyruleno==108); case 151: /* col_name_list ::= col_name */ yytestcase(yyruleno==151); - case 173: /* func_name_list ::= func_name */ yytestcase(yyruleno==173); - case 182: /* func_list ::= func */ yytestcase(yyruleno==182); - case 218: /* literal_list ::= signed_literal */ yytestcase(yyruleno==218); - case 304: /* select_sublist ::= select_item */ yytestcase(yyruleno==304); - case 351: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==351); -{ yylhsminor.yy504 = createNodeList(pCxt, yymsp[0].minor.yy24); } - yymsp[0].minor.yy504 = yylhsminor.yy504; + case 184: /* func_name_list ::= func_name */ yytestcase(yyruleno==184); + case 193: /* func_list ::= func */ yytestcase(yyruleno==193); + case 246: /* literal_list ::= signed_literal */ yytestcase(yyruleno==246); + case 333: /* select_sublist ::= select_item */ yytestcase(yyruleno==333); + case 380: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==380); +{ yylhsminor.yy312 = createNodeList(pCxt, yymsp[0].minor.yy104); } + yymsp[0].minor.yy312 = yylhsminor.yy312; break; case 99: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ case 102: /* multi_drop_clause ::= multi_drop_clause drop_table_clause */ yytestcase(yyruleno==102); -{ yylhsminor.yy504 = addNodeToList(pCxt, yymsp[-1].minor.yy504, yymsp[0].minor.yy24); } - yymsp[-1].minor.yy504 = yylhsminor.yy504; +{ yylhsminor.yy312 = addNodeToList(pCxt, yymsp[-1].minor.yy312, yymsp[0].minor.yy104); } + yymsp[-1].minor.yy312 = yylhsminor.yy312; break; case 100: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP */ -{ yylhsminor.yy24 = createCreateSubTableClause(pCxt, yymsp[-8].minor.yy265, yymsp[-7].minor.yy24, yymsp[-5].minor.yy24, yymsp[-4].minor.yy504, yymsp[-1].minor.yy504); } - yymsp[-8].minor.yy24 = yylhsminor.yy24; +{ yylhsminor.yy104 = createCreateSubTableClause(pCxt, yymsp[-8].minor.yy185, yymsp[-7].minor.yy104, yymsp[-5].minor.yy104, yymsp[-4].minor.yy312, yymsp[-1].minor.yy312); } + yymsp[-8].minor.yy104 = yylhsminor.yy104; break; case 103: /* drop_table_clause ::= exists_opt full_table_name */ -{ yylhsminor.yy24 = createDropTableClause(pCxt, yymsp[-1].minor.yy265, yymsp[0].minor.yy24); } - yymsp[-1].minor.yy24 = yylhsminor.yy24; +{ yylhsminor.yy104 = createDropTableClause(pCxt, yymsp[-1].minor.yy185, yymsp[0].minor.yy104); } + yymsp[-1].minor.yy104 = yylhsminor.yy104; break; case 104: /* specific_tags_opt ::= */ case 135: /* tags_def_opt ::= */ yytestcase(yyruleno==135); - case 312: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==312); - case 329: /* group_by_clause_opt ::= */ yytestcase(yyruleno==329); - case 339: /* order_by_clause_opt ::= */ yytestcase(yyruleno==339); -{ yymsp[1].minor.yy504 = NULL; } + case 341: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==341); + case 358: /* group_by_clause_opt ::= */ yytestcase(yyruleno==358); + case 368: /* order_by_clause_opt ::= */ yytestcase(yyruleno==368); +{ yymsp[1].minor.yy312 = NULL; } break; case 105: /* specific_tags_opt ::= NK_LP col_name_list NK_RP */ -{ yymsp[-2].minor.yy504 = yymsp[-1].minor.yy504; } +{ yymsp[-2].minor.yy312 = yymsp[-1].minor.yy312; } break; case 106: /* full_table_name ::= table_name */ -{ yylhsminor.yy24 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy337, NULL); } - yymsp[0].minor.yy24 = yylhsminor.yy24; +{ yylhsminor.yy104 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy129, NULL); } + yymsp[0].minor.yy104 = yylhsminor.yy104; break; case 107: /* full_table_name ::= db_name NK_DOT table_name */ -{ yylhsminor.yy24 = createRealTableNode(pCxt, &yymsp[-2].minor.yy337, &yymsp[0].minor.yy337, NULL); } - yymsp[-2].minor.yy24 = yylhsminor.yy24; +{ yylhsminor.yy104 = createRealTableNode(pCxt, &yymsp[-2].minor.yy129, &yymsp[0].minor.yy129, NULL); } + yymsp[-2].minor.yy104 = yylhsminor.yy104; break; case 109: /* column_def_list ::= column_def_list NK_COMMA column_def */ case 152: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==152); - case 174: /* func_name_list ::= func_name_list NK_COMMA col_name */ yytestcase(yyruleno==174); - case 183: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==183); - case 219: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==219); - case 305: /* select_sublist ::= select_sublist NK_COMMA select_item */ yytestcase(yyruleno==305); - case 352: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==352); -{ yylhsminor.yy504 = addNodeToList(pCxt, yymsp[-2].minor.yy504, yymsp[0].minor.yy24); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + case 185: /* func_name_list ::= func_name_list NK_COMMA col_name */ yytestcase(yyruleno==185); + case 194: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==194); + case 247: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==247); + case 334: /* select_sublist ::= select_sublist NK_COMMA select_item */ yytestcase(yyruleno==334); + case 381: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==381); +{ yylhsminor.yy312 = addNodeToList(pCxt, yymsp[-2].minor.yy312, yymsp[0].minor.yy104); } + yymsp[-2].minor.yy312 = yylhsminor.yy312; break; case 110: /* column_def ::= column_name type_name */ -{ yylhsminor.yy24 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy337, yymsp[0].minor.yy212, NULL); } - yymsp[-1].minor.yy24 = yylhsminor.yy24; +{ yylhsminor.yy104 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy129, yymsp[0].minor.yy336, NULL); } + yymsp[-1].minor.yy104 = yylhsminor.yy104; break; case 111: /* column_def ::= column_name type_name COMMENT NK_STRING */ -{ yylhsminor.yy24 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy337, yymsp[-2].minor.yy212, &yymsp[0].minor.yy0); } - yymsp[-3].minor.yy24 = yylhsminor.yy24; +{ yylhsminor.yy104 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy129, yymsp[-2].minor.yy336, &yymsp[0].minor.yy0); } + yymsp[-3].minor.yy104 = yylhsminor.yy104; break; case 112: /* type_name ::= BOOL */ -{ yymsp[0].minor.yy212 = createDataType(TSDB_DATA_TYPE_BOOL); } +{ yymsp[0].minor.yy336 = createDataType(TSDB_DATA_TYPE_BOOL); } break; case 113: /* type_name ::= TINYINT */ -{ yymsp[0].minor.yy212 = createDataType(TSDB_DATA_TYPE_TINYINT); } +{ yymsp[0].minor.yy336 = createDataType(TSDB_DATA_TYPE_TINYINT); } break; case 114: /* type_name ::= SMALLINT */ -{ yymsp[0].minor.yy212 = createDataType(TSDB_DATA_TYPE_SMALLINT); } +{ yymsp[0].minor.yy336 = createDataType(TSDB_DATA_TYPE_SMALLINT); } break; case 115: /* type_name ::= INT */ case 116: /* type_name ::= INTEGER */ yytestcase(yyruleno==116); -{ yymsp[0].minor.yy212 = createDataType(TSDB_DATA_TYPE_INT); } +{ yymsp[0].minor.yy336 = createDataType(TSDB_DATA_TYPE_INT); } break; case 117: /* type_name ::= BIGINT */ -{ yymsp[0].minor.yy212 = createDataType(TSDB_DATA_TYPE_BIGINT); } +{ yymsp[0].minor.yy336 = createDataType(TSDB_DATA_TYPE_BIGINT); } break; case 118: /* type_name ::= FLOAT */ -{ yymsp[0].minor.yy212 = createDataType(TSDB_DATA_TYPE_FLOAT); } +{ yymsp[0].minor.yy336 = createDataType(TSDB_DATA_TYPE_FLOAT); } break; case 119: /* type_name ::= DOUBLE */ -{ yymsp[0].minor.yy212 = createDataType(TSDB_DATA_TYPE_DOUBLE); } +{ yymsp[0].minor.yy336 = createDataType(TSDB_DATA_TYPE_DOUBLE); } break; case 120: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy212 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy336 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } break; case 121: /* type_name ::= TIMESTAMP */ -{ yymsp[0].minor.yy212 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } +{ yymsp[0].minor.yy336 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } break; case 122: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy212 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy336 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } break; case 123: /* type_name ::= TINYINT UNSIGNED */ -{ yymsp[-1].minor.yy212 = createDataType(TSDB_DATA_TYPE_UTINYINT); } +{ yymsp[-1].minor.yy336 = createDataType(TSDB_DATA_TYPE_UTINYINT); } break; case 124: /* type_name ::= SMALLINT UNSIGNED */ -{ yymsp[-1].minor.yy212 = createDataType(TSDB_DATA_TYPE_USMALLINT); } +{ yymsp[-1].minor.yy336 = createDataType(TSDB_DATA_TYPE_USMALLINT); } break; case 125: /* type_name ::= INT UNSIGNED */ -{ yymsp[-1].minor.yy212 = createDataType(TSDB_DATA_TYPE_UINT); } +{ yymsp[-1].minor.yy336 = createDataType(TSDB_DATA_TYPE_UINT); } break; case 126: /* type_name ::= BIGINT UNSIGNED */ -{ yymsp[-1].minor.yy212 = createDataType(TSDB_DATA_TYPE_UBIGINT); } +{ yymsp[-1].minor.yy336 = createDataType(TSDB_DATA_TYPE_UBIGINT); } break; case 127: /* type_name ::= JSON */ -{ yymsp[0].minor.yy212 = createDataType(TSDB_DATA_TYPE_JSON); } +{ yymsp[0].minor.yy336 = createDataType(TSDB_DATA_TYPE_JSON); } break; case 128: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy212 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy336 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } break; case 129: /* type_name ::= MEDIUMBLOB */ -{ yymsp[0].minor.yy212 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } +{ yymsp[0].minor.yy336 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } break; case 130: /* type_name ::= BLOB */ -{ yymsp[0].minor.yy212 = createDataType(TSDB_DATA_TYPE_BLOB); } +{ yymsp[0].minor.yy336 = createDataType(TSDB_DATA_TYPE_BLOB); } break; case 131: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy212 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy336 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } break; case 132: /* type_name ::= DECIMAL */ -{ yymsp[0].minor.yy212 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +{ yymsp[0].minor.yy336 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 133: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy212 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +{ yymsp[-3].minor.yy336 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 134: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ -{ yymsp[-5].minor.yy212 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +{ yymsp[-5].minor.yy336 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 136: /* tags_def_opt ::= tags_def */ - case 303: /* select_list ::= select_sublist */ yytestcase(yyruleno==303); -{ yylhsminor.yy504 = yymsp[0].minor.yy504; } - yymsp[0].minor.yy504 = yylhsminor.yy504; + case 332: /* select_list ::= select_sublist */ yytestcase(yyruleno==332); +{ yylhsminor.yy312 = yymsp[0].minor.yy312; } + yymsp[0].minor.yy312 = yylhsminor.yy312; break; case 137: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */ -{ yymsp[-3].minor.yy504 = yymsp[-1].minor.yy504; } +{ yymsp[-3].minor.yy312 = yymsp[-1].minor.yy312; } break; case 138: /* table_options ::= */ -{ yymsp[1].minor.yy24 = createDefaultTableOptions(pCxt); } +{ yymsp[1].minor.yy104 = createDefaultTableOptions(pCxt); } break; case 139: /* table_options ::= table_options COMMENT NK_STRING */ -{ yylhsminor.yy24 = setTableOption(pCxt, yymsp[-2].minor.yy24, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy24 = yylhsminor.yy24; +{ yylhsminor.yy104 = setTableOption(pCxt, yymsp[-2].minor.yy104, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy104 = yylhsminor.yy104; break; case 140: /* table_options ::= table_options KEEP integer_list */ -{ yylhsminor.yy24 = setTableKeepOption(pCxt, yymsp[-2].minor.yy24, yymsp[0].minor.yy504); } - yymsp[-2].minor.yy24 = yylhsminor.yy24; +{ yylhsminor.yy104 = setTableKeepOption(pCxt, yymsp[-2].minor.yy104, yymsp[0].minor.yy312); } + yymsp[-2].minor.yy104 = yylhsminor.yy104; break; case 141: /* table_options ::= table_options TTL NK_INTEGER */ -{ yylhsminor.yy24 = setTableOption(pCxt, yymsp[-2].minor.yy24, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy24 = yylhsminor.yy24; +{ yylhsminor.yy104 = setTableOption(pCxt, yymsp[-2].minor.yy104, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy104 = yylhsminor.yy104; break; case 142: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ -{ yylhsminor.yy24 = setTableSmaOption(pCxt, yymsp[-4].minor.yy24, yymsp[-1].minor.yy504); } - yymsp[-4].minor.yy24 = yylhsminor.yy24; +{ yylhsminor.yy104 = setTableSmaOption(pCxt, yymsp[-4].minor.yy104, yymsp[-1].minor.yy312); } + yymsp[-4].minor.yy104 = yylhsminor.yy104; break; case 143: /* table_options ::= table_options ROLLUP NK_LP func_name_list NK_RP */ -{ yylhsminor.yy24 = setTableRollupOption(pCxt, yymsp[-4].minor.yy24, yymsp[-1].minor.yy504); } - yymsp[-4].minor.yy24 = yylhsminor.yy24; +{ yylhsminor.yy104 = setTableRollupOption(pCxt, yymsp[-4].minor.yy104, yymsp[-1].minor.yy312); } + yymsp[-4].minor.yy104 = yylhsminor.yy104; break; case 144: /* table_options ::= table_options FILE_FACTOR NK_FLOAT */ -{ yylhsminor.yy24 = setTableOption(pCxt, yymsp[-2].minor.yy24, TABLE_OPTION_FILE_FACTOR, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy24 = yylhsminor.yy24; +{ yylhsminor.yy104 = setTableOption(pCxt, yymsp[-2].minor.yy104, TABLE_OPTION_FILE_FACTOR, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy104 = yylhsminor.yy104; break; case 145: /* table_options ::= table_options DELAY NK_INTEGER */ -{ yylhsminor.yy24 = setTableOption(pCxt, yymsp[-2].minor.yy24, TABLE_OPTION_DELAY, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy24 = yylhsminor.yy24; +{ yylhsminor.yy104 = setTableOption(pCxt, yymsp[-2].minor.yy104, TABLE_OPTION_DELAY, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy104 = yylhsminor.yy104; break; case 146: /* alter_table_options ::= alter_table_option */ -{ yylhsminor.yy24 = createDefaultAlterTableOptions(pCxt); yylhsminor.yy24 = setTableAlterOption(pCxt, yylhsminor.yy24, &yymsp[0].minor.yy553); } - yymsp[0].minor.yy24 = yylhsminor.yy24; +{ yylhsminor.yy104 = createDefaultAlterTableOptions(pCxt); yylhsminor.yy104 = setTableAlterOption(pCxt, yylhsminor.yy104, &yymsp[0].minor.yy253); } + yymsp[0].minor.yy104 = yylhsminor.yy104; break; case 147: /* alter_table_options ::= alter_table_options alter_table_option */ -{ yylhsminor.yy24 = setTableAlterOption(pCxt, yymsp[-1].minor.yy24, &yymsp[0].minor.yy553); } - yymsp[-1].minor.yy24 = yylhsminor.yy24; +{ yylhsminor.yy104 = setTableAlterOption(pCxt, yymsp[-1].minor.yy104, &yymsp[0].minor.yy253); } + yymsp[-1].minor.yy104 = yylhsminor.yy104; break; case 148: /* alter_table_option ::= COMMENT NK_STRING */ -{ yymsp[-1].minor.yy553.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy553.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy253.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy253.val = yymsp[0].minor.yy0; } break; case 149: /* alter_table_option ::= KEEP integer_list */ -{ yymsp[-1].minor.yy553.type = TABLE_OPTION_KEEP; yymsp[-1].minor.yy553.pKeep = yymsp[0].minor.yy504; } +{ yymsp[-1].minor.yy253.type = TABLE_OPTION_KEEP; yymsp[-1].minor.yy253.pKeep = yymsp[0].minor.yy312; } break; case 150: /* alter_table_option ::= TTL NK_INTEGER */ -{ yymsp[-1].minor.yy553.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy553.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy253.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy253.val = yymsp[0].minor.yy0; } break; case 153: /* col_name ::= column_name */ -{ yylhsminor.yy24 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy337); } - yymsp[0].minor.yy24 = yylhsminor.yy24; +{ yylhsminor.yy104 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy129); } + yymsp[0].minor.yy104 = yylhsminor.yy104; break; case 154: /* cmd ::= SHOW DNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT, NULL, NULL); } @@ -2888,13 +3014,13 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT, NULL, NULL); } break; case 157: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy24, yymsp[0].minor.yy24); } +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy104, yymsp[0].minor.yy104); } break; case 158: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy24, yymsp[0].minor.yy24); } +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy104, yymsp[0].minor.yy104); } break; case 159: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy24, NULL); } +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy104, NULL); } break; case 160: /* cmd ::= SHOW MNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT, NULL, NULL); } @@ -2909,573 +3035,649 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT, NULL, NULL); } break; case 164: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[-1].minor.yy24, yymsp[0].minor.yy24); } +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[-1].minor.yy104, yymsp[0].minor.yy104); } break; case 165: /* cmd ::= SHOW STREAMS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT, NULL, NULL); } break; - case 166: /* db_name_cond_opt ::= */ - case 171: /* from_db_opt ::= */ yytestcase(yyruleno==171); -{ yymsp[1].minor.yy24 = createDefaultDatabaseCondValue(pCxt); } + case 166: /* cmd ::= SHOW ACCOUNTS */ +{ pCxt->valid = false; generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } break; - case 167: /* db_name_cond_opt ::= db_name NK_DOT */ -{ yylhsminor.yy24 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy337); } - yymsp[-1].minor.yy24 = yylhsminor.yy24; + case 167: /* cmd ::= SHOW APPS */ +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_APPS_STMT, NULL, NULL); } break; - case 168: /* like_pattern_opt ::= */ - case 179: /* index_options ::= */ yytestcase(yyruleno==179); - case 310: /* where_clause_opt ::= */ yytestcase(yyruleno==310); - case 314: /* twindow_clause_opt ::= */ yytestcase(yyruleno==314); - case 319: /* sliding_opt ::= */ yytestcase(yyruleno==319); - case 321: /* fill_opt ::= */ yytestcase(yyruleno==321); - case 333: /* having_clause_opt ::= */ yytestcase(yyruleno==333); - case 341: /* slimit_clause_opt ::= */ yytestcase(yyruleno==341); - case 345: /* limit_clause_opt ::= */ yytestcase(yyruleno==345); -{ yymsp[1].minor.yy24 = NULL; } + case 168: /* cmd ::= SHOW CONNECTIONS */ +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONNECTIONS_STMT, NULL, NULL); } break; - case 169: /* like_pattern_opt ::= LIKE NK_STRING */ -{ yymsp[-1].minor.yy24 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } + case 169: /* cmd ::= SHOW LICENCE */ +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCE_STMT, NULL, NULL); } break; - case 170: /* table_name_cond ::= table_name */ -{ yylhsminor.yy24 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy337); } - yymsp[0].minor.yy24 = yylhsminor.yy24; + case 170: /* cmd ::= SHOW CREATE DATABASE db_name */ +{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy129); } break; - case 172: /* from_db_opt ::= FROM db_name */ -{ yymsp[-1].minor.yy24 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy337); } + case 171: /* cmd ::= SHOW CREATE TABLE full_table_name */ +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy104); } break; - case 175: /* func_name ::= function_name */ -{ yylhsminor.yy24 = createFunctionNode(pCxt, &yymsp[0].minor.yy337, NULL); } - yymsp[0].minor.yy24 = yylhsminor.yy24; + case 172: /* cmd ::= SHOW CREATE STABLE full_table_name */ +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy104); } break; - case 176: /* cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ -{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy265, &yymsp[-3].minor.yy337, &yymsp[-1].minor.yy337, NULL, yymsp[0].minor.yy24); } + case 173: /* cmd ::= SHOW QUERIES */ +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT, NULL, NULL); } break; - case 177: /* 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.yy265, &yymsp[-5].minor.yy337, &yymsp[-3].minor.yy337, yymsp[-1].minor.yy504, NULL); } + case 174: /* cmd ::= SHOW SCORES */ +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SCORES_STMT, NULL, NULL); } break; - case 178: /* cmd ::= DROP INDEX exists_opt index_name ON table_name */ -{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-3].minor.yy265, &yymsp[-2].minor.yy337, &yymsp[0].minor.yy337); } + case 175: /* cmd ::= SHOW TOPICS */ +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TOPICS_STMT, NULL, NULL); } break; - case 180: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt */ -{ yymsp[-8].minor.yy24 = createIndexOption(pCxt, yymsp[-6].minor.yy504, releaseRawExprNode(pCxt, yymsp[-2].minor.yy24), NULL, yymsp[0].minor.yy24); } + case 176: /* cmd ::= SHOW VARIABLES */ +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VARIABLE_STMT, NULL, NULL); } break; - case 181: /* 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.yy24 = createIndexOption(pCxt, yymsp[-8].minor.yy504, releaseRawExprNode(pCxt, yymsp[-4].minor.yy24), releaseRawExprNode(pCxt, yymsp[-2].minor.yy24), yymsp[0].minor.yy24); } + case 177: /* db_name_cond_opt ::= */ + case 182: /* from_db_opt ::= */ yytestcase(yyruleno==182); +{ yymsp[1].minor.yy104 = createDefaultDatabaseCondValue(pCxt); } break; - case 184: /* func ::= function_name NK_LP expression_list NK_RP */ -{ yylhsminor.yy24 = createFunctionNode(pCxt, &yymsp[-3].minor.yy337, yymsp[-1].minor.yy504); } - yymsp[-3].minor.yy24 = yylhsminor.yy24; + case 178: /* db_name_cond_opt ::= db_name NK_DOT */ +{ yylhsminor.yy104 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy129); } + yymsp[-1].minor.yy104 = yylhsminor.yy104; break; - case 185: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ -{ pCxt->pRootNode = createCreateTopicStmt(pCxt, yymsp[-3].minor.yy265, &yymsp[-2].minor.yy337, yymsp[0].minor.yy24, NULL); } + case 179: /* like_pattern_opt ::= */ + case 190: /* index_options ::= */ yytestcase(yyruleno==190); + case 339: /* where_clause_opt ::= */ yytestcase(yyruleno==339); + case 343: /* twindow_clause_opt ::= */ yytestcase(yyruleno==343); + case 348: /* sliding_opt ::= */ yytestcase(yyruleno==348); + case 350: /* fill_opt ::= */ yytestcase(yyruleno==350); + case 362: /* having_clause_opt ::= */ yytestcase(yyruleno==362); + case 370: /* slimit_clause_opt ::= */ yytestcase(yyruleno==370); + case 374: /* limit_clause_opt ::= */ yytestcase(yyruleno==374); +{ yymsp[1].minor.yy104 = NULL; } break; - case 186: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS db_name */ -{ pCxt->pRootNode = createCreateTopicStmt(pCxt, yymsp[-3].minor.yy265, &yymsp[-2].minor.yy337, NULL, &yymsp[0].minor.yy337); } + case 180: /* like_pattern_opt ::= LIKE NK_STRING */ +{ yymsp[-1].minor.yy104 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } break; - case 187: /* cmd ::= DROP TOPIC exists_opt topic_name */ -{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy265, &yymsp[0].minor.yy337); } + case 181: /* table_name_cond ::= table_name */ +{ yylhsminor.yy104 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy129); } + yymsp[0].minor.yy104 = yylhsminor.yy104; break; - case 188: /* cmd ::= DESC full_table_name */ - case 189: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==189); -{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy24); } + case 183: /* from_db_opt ::= FROM db_name */ +{ yymsp[-1].minor.yy104 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy129); } break; - case 190: /* cmd ::= RESET QUERY CACHE */ + case 186: /* func_name ::= function_name */ +{ yylhsminor.yy104 = createFunctionNode(pCxt, &yymsp[0].minor.yy129, NULL); } + yymsp[0].minor.yy104 = yylhsminor.yy104; + break; + case 187: /* cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ +{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy185, &yymsp[-3].minor.yy129, &yymsp[-1].minor.yy129, NULL, yymsp[0].minor.yy104); } + break; + case 188: /* 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.yy185, &yymsp[-5].minor.yy129, &yymsp[-3].minor.yy129, yymsp[-1].minor.yy312, NULL); } + break; + case 189: /* cmd ::= DROP INDEX exists_opt index_name ON table_name */ +{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-3].minor.yy185, &yymsp[-2].minor.yy129, &yymsp[0].minor.yy129); } + break; + case 191: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt */ +{ yymsp[-8].minor.yy104 = createIndexOption(pCxt, yymsp[-6].minor.yy312, releaseRawExprNode(pCxt, yymsp[-2].minor.yy104), NULL, yymsp[0].minor.yy104); } + break; + case 192: /* 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.yy104 = createIndexOption(pCxt, yymsp[-8].minor.yy312, releaseRawExprNode(pCxt, yymsp[-4].minor.yy104), releaseRawExprNode(pCxt, yymsp[-2].minor.yy104), yymsp[0].minor.yy104); } + break; + case 195: /* func ::= function_name NK_LP expression_list NK_RP */ +{ yylhsminor.yy104 = createFunctionNode(pCxt, &yymsp[-3].minor.yy129, yymsp[-1].minor.yy312); } + yymsp[-3].minor.yy104 = yylhsminor.yy104; + break; + case 196: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ +{ pCxt->pRootNode = createCreateTopicStmt(pCxt, yymsp[-3].minor.yy185, &yymsp[-2].minor.yy129, yymsp[0].minor.yy104, NULL); } + break; + case 197: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS db_name */ +{ pCxt->pRootNode = createCreateTopicStmt(pCxt, yymsp[-3].minor.yy185, &yymsp[-2].minor.yy129, NULL, &yymsp[0].minor.yy129); } + break; + case 198: /* cmd ::= DROP TOPIC exists_opt topic_name */ +{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy185, &yymsp[0].minor.yy129); } + break; + case 199: /* cmd ::= DESC full_table_name */ + case 200: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==200); +{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy104); } + break; + case 201: /* cmd ::= RESET QUERY CACHE */ { pCxt->pRootNode = createResetQueryCacheStmt(pCxt); } break; - case 191: /* cmd ::= EXPLAIN analyze_opt explain_options query_expression */ -{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy265, yymsp[-1].minor.yy24, yymsp[0].minor.yy24); } + case 202: /* cmd ::= EXPLAIN analyze_opt explain_options query_expression */ +{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy185, yymsp[-1].minor.yy104, yymsp[0].minor.yy104); } break; - case 193: /* analyze_opt ::= ANALYZE */ - case 300: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==300); -{ yymsp[0].minor.yy265 = true; } + case 204: /* analyze_opt ::= ANALYZE */ + case 212: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==212); + case 329: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==329); +{ yymsp[0].minor.yy185 = true; } break; - case 194: /* explain_options ::= */ -{ yymsp[1].minor.yy24 = createDefaultExplainOptions(pCxt); } + case 205: /* explain_options ::= */ +{ yymsp[1].minor.yy104 = createDefaultExplainOptions(pCxt); } break; - case 195: /* explain_options ::= explain_options VERBOSE NK_BOOL */ -{ yylhsminor.yy24 = setExplainVerbose(pCxt, yymsp[-2].minor.yy24, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy24 = yylhsminor.yy24; + case 206: /* explain_options ::= explain_options VERBOSE NK_BOOL */ +{ yylhsminor.yy104 = setExplainVerbose(pCxt, yymsp[-2].minor.yy104, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy104 = yylhsminor.yy104; break; - case 196: /* explain_options ::= explain_options RATIO NK_FLOAT */ -{ yylhsminor.yy24 = setExplainRatio(pCxt, yymsp[-2].minor.yy24, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy24 = yylhsminor.yy24; + case 207: /* explain_options ::= explain_options RATIO NK_FLOAT */ +{ yylhsminor.yy104 = setExplainRatio(pCxt, yymsp[-2].minor.yy104, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy104 = yylhsminor.yy104; break; - case 198: /* literal ::= NK_INTEGER */ -{ yylhsminor.yy24 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy24 = yylhsminor.yy24; + case 208: /* cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP */ +{ pCxt->pRootNode = createCompactStmt(pCxt, yymsp[-1].minor.yy312); } break; - case 199: /* literal ::= NK_FLOAT */ -{ yylhsminor.yy24 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy24 = yylhsminor.yy24; + case 209: /* cmd ::= CREATE agg_func_opt FUNCTION function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ +{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-7].minor.yy185, &yymsp[-5].minor.yy129, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy336, yymsp[0].minor.yy196); } break; - case 200: /* literal ::= NK_STRING */ -{ yylhsminor.yy24 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy24 = yylhsminor.yy24; + case 210: /* cmd ::= DROP FUNCTION function_name */ +{ pCxt->pRootNode = createDropFunctionStmt(pCxt, &yymsp[0].minor.yy129); } break; - case 201: /* literal ::= NK_BOOL */ -{ yylhsminor.yy24 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy24 = yylhsminor.yy24; + case 213: /* bufsize_opt ::= */ +{ yymsp[1].minor.yy196 = 0; } break; - case 202: /* literal ::= TIMESTAMP NK_STRING */ -{ yylhsminor.yy24 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } - yymsp[-1].minor.yy24 = yylhsminor.yy24; + case 214: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ +{ yymsp[-1].minor.yy196 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } break; - case 203: /* literal ::= duration_literal */ - case 212: /* signed_literal ::= signed */ yytestcase(yyruleno==212); - case 229: /* expression ::= literal */ yytestcase(yyruleno==229); - case 230: /* expression ::= pseudo_column */ yytestcase(yyruleno==230); - case 231: /* expression ::= column_reference */ yytestcase(yyruleno==231); - case 234: /* expression ::= subquery */ yytestcase(yyruleno==234); - case 273: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==273); - case 277: /* boolean_primary ::= predicate */ yytestcase(yyruleno==277); - case 279: /* common_expression ::= expression */ yytestcase(yyruleno==279); - case 280: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==280); - case 282: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==282); - case 284: /* table_reference ::= table_primary */ yytestcase(yyruleno==284); - case 285: /* table_reference ::= joined_table */ yytestcase(yyruleno==285); - case 289: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==289); - case 336: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==336); - case 338: /* query_primary ::= query_specification */ yytestcase(yyruleno==338); -{ yylhsminor.yy24 = yymsp[0].minor.yy24; } - yymsp[0].minor.yy24 = yylhsminor.yy24; + case 215: /* cmd ::= CREATE STREAM stream_name INTO table_name AS query_expression */ +{ pCxt->pRootNode = createCreateStreamStmt(pCxt, &yymsp[-4].minor.yy129, &yymsp[-2].minor.yy129, yymsp[0].minor.yy104); } break; - case 204: /* literal ::= NULL */ -{ yylhsminor.yy24 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, NULL)); } - yymsp[0].minor.yy24 = yylhsminor.yy24; + case 216: /* cmd ::= DROP STREAM stream_name */ +{ pCxt->pRootNode = createDropStreamStmt(pCxt, &yymsp[0].minor.yy129); } break; - case 205: /* duration_literal ::= NK_VARIABLE */ -{ yylhsminor.yy24 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy24 = yylhsminor.yy24; + case 217: /* cmd ::= KILL CONNECTION NK_INTEGER */ +{ pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); } break; - case 206: /* signed ::= NK_INTEGER */ -{ yylhsminor.yy24 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy24 = yylhsminor.yy24; + case 218: /* cmd ::= KILL QUERY NK_INTEGER */ +{ pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_QUERY_STMT, &yymsp[0].minor.yy0); } break; - case 207: /* signed ::= NK_PLUS NK_INTEGER */ -{ yymsp[-1].minor.yy24 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } + case 219: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ +{ pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } break; - case 208: /* signed ::= NK_MINUS NK_INTEGER */ + case 220: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ +{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy312); } + break; + case 221: /* cmd ::= SPLIT VGROUP NK_INTEGER */ +{ pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); } + break; + case 222: /* dnode_list ::= DNODE NK_INTEGER */ +{ yymsp[-1].minor.yy312 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + break; + case 224: /* cmd ::= SYNCDB db_name REPLICA */ +{ pCxt->pRootNode = createSyncdbStmt(pCxt, &yymsp[-1].minor.yy129); } + break; + case 226: /* literal ::= NK_INTEGER */ +{ yylhsminor.yy104 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy104 = yylhsminor.yy104; + break; + case 227: /* literal ::= NK_FLOAT */ +{ yylhsminor.yy104 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy104 = yylhsminor.yy104; + break; + case 228: /* literal ::= NK_STRING */ +{ yylhsminor.yy104 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy104 = yylhsminor.yy104; + break; + case 229: /* literal ::= NK_BOOL */ +{ yylhsminor.yy104 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy104 = yylhsminor.yy104; + break; + case 230: /* literal ::= TIMESTAMP NK_STRING */ +{ yylhsminor.yy104 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } + yymsp[-1].minor.yy104 = yylhsminor.yy104; + break; + case 231: /* literal ::= duration_literal */ + case 240: /* signed_literal ::= signed */ yytestcase(yyruleno==240); + case 258: /* expression ::= literal */ yytestcase(yyruleno==258); + case 259: /* expression ::= pseudo_column */ yytestcase(yyruleno==259); + case 260: /* expression ::= column_reference */ yytestcase(yyruleno==260); + case 263: /* expression ::= subquery */ yytestcase(yyruleno==263); + case 302: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==302); + case 306: /* boolean_primary ::= predicate */ yytestcase(yyruleno==306); + case 308: /* common_expression ::= expression */ yytestcase(yyruleno==308); + case 309: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==309); + case 311: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==311); + case 313: /* table_reference ::= table_primary */ yytestcase(yyruleno==313); + case 314: /* table_reference ::= joined_table */ yytestcase(yyruleno==314); + case 318: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==318); + case 365: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==365); + case 367: /* query_primary ::= query_specification */ yytestcase(yyruleno==367); +{ yylhsminor.yy104 = yymsp[0].minor.yy104; } + yymsp[0].minor.yy104 = yylhsminor.yy104; + break; + case 232: /* literal ::= NULL */ +{ yylhsminor.yy104 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, NULL)); } + yymsp[0].minor.yy104 = yylhsminor.yy104; + break; + case 233: /* duration_literal ::= NK_VARIABLE */ +{ yylhsminor.yy104 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy104 = yylhsminor.yy104; + break; + case 234: /* signed ::= NK_INTEGER */ +{ yylhsminor.yy104 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy104 = yylhsminor.yy104; + break; + case 235: /* signed ::= NK_PLUS NK_INTEGER */ +{ yymsp[-1].minor.yy104 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } + break; + case 236: /* 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.yy24 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); + yylhsminor.yy104 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); } - yymsp[-1].minor.yy24 = yylhsminor.yy24; + yymsp[-1].minor.yy104 = yylhsminor.yy104; break; - case 209: /* signed ::= NK_FLOAT */ -{ yylhsminor.yy24 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy24 = yylhsminor.yy24; + case 237: /* signed ::= NK_FLOAT */ +{ yylhsminor.yy104 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy104 = yylhsminor.yy104; break; - case 210: /* signed ::= NK_PLUS NK_FLOAT */ -{ yymsp[-1].minor.yy24 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + case 238: /* signed ::= NK_PLUS NK_FLOAT */ +{ yymsp[-1].minor.yy104 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } break; - case 211: /* signed ::= NK_MINUS NK_FLOAT */ + case 239: /* 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.yy24 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); + yylhsminor.yy104 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); } - yymsp[-1].minor.yy24 = yylhsminor.yy24; + yymsp[-1].minor.yy104 = yylhsminor.yy104; break; - case 213: /* signed_literal ::= NK_STRING */ -{ yylhsminor.yy24 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy24 = yylhsminor.yy24; + case 241: /* signed_literal ::= NK_STRING */ +{ yylhsminor.yy104 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy104 = yylhsminor.yy104; break; - case 214: /* signed_literal ::= NK_BOOL */ -{ yylhsminor.yy24 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy24 = yylhsminor.yy24; + case 242: /* signed_literal ::= NK_BOOL */ +{ yylhsminor.yy104 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy104 = yylhsminor.yy104; break; - case 215: /* signed_literal ::= TIMESTAMP NK_STRING */ -{ yymsp[-1].minor.yy24 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } + case 243: /* signed_literal ::= TIMESTAMP NK_STRING */ +{ yymsp[-1].minor.yy104 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } break; - case 216: /* signed_literal ::= duration_literal */ - case 350: /* search_condition ::= common_expression */ yytestcase(yyruleno==350); -{ yylhsminor.yy24 = releaseRawExprNode(pCxt, yymsp[0].minor.yy24); } - yymsp[0].minor.yy24 = yylhsminor.yy24; + case 244: /* signed_literal ::= duration_literal */ + case 379: /* search_condition ::= common_expression */ yytestcase(yyruleno==379); +{ yylhsminor.yy104 = releaseRawExprNode(pCxt, yymsp[0].minor.yy104); } + yymsp[0].minor.yy104 = yylhsminor.yy104; break; - case 217: /* signed_literal ::= NULL */ -{ yymsp[0].minor.yy24 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, NULL); } + case 245: /* signed_literal ::= NULL */ +{ yymsp[0].minor.yy104 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, NULL); } break; - case 232: /* expression ::= function_name NK_LP expression_list NK_RP */ -{ yylhsminor.yy24 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy337, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy337, yymsp[-1].minor.yy504)); } - yymsp[-3].minor.yy24 = yylhsminor.yy24; + case 261: /* expression ::= function_name NK_LP expression_list NK_RP */ +{ yylhsminor.yy104 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy129, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy129, yymsp[-1].minor.yy312)); } + yymsp[-3].minor.yy104 = yylhsminor.yy104; break; - case 233: /* expression ::= function_name NK_LP NK_STAR NK_RP */ -{ yylhsminor.yy24 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy337, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy337, createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy0)))); } - yymsp[-3].minor.yy24 = yylhsminor.yy24; + case 262: /* expression ::= function_name NK_LP NK_STAR NK_RP */ +{ yylhsminor.yy104 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy129, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy129, createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy0)))); } + yymsp[-3].minor.yy104 = yylhsminor.yy104; break; - case 235: /* expression ::= NK_LP expression NK_RP */ - case 278: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==278); -{ yylhsminor.yy24 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy24)); } - yymsp[-2].minor.yy24 = yylhsminor.yy24; + case 264: /* expression ::= NK_LP expression NK_RP */ + case 307: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==307); +{ yylhsminor.yy104 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy104)); } + yymsp[-2].minor.yy104 = yylhsminor.yy104; break; - case 236: /* expression ::= NK_PLUS expression */ + case 265: /* expression ::= NK_PLUS expression */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy24); - yylhsminor.yy24 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy24)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104); + yylhsminor.yy104 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy104)); } - yymsp[-1].minor.yy24 = yylhsminor.yy24; + yymsp[-1].minor.yy104 = yylhsminor.yy104; break; - case 237: /* expression ::= NK_MINUS expression */ + case 266: /* expression ::= NK_MINUS expression */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy24); - yylhsminor.yy24 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[0].minor.yy24), NULL)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104); + yylhsminor.yy104 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[0].minor.yy104), NULL)); } - yymsp[-1].minor.yy24 = yylhsminor.yy24; + yymsp[-1].minor.yy104 = yylhsminor.yy104; break; - case 238: /* expression ::= expression NK_PLUS expression */ + case 267: /* expression ::= expression NK_PLUS expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy24); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy24); - yylhsminor.yy24 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy24), releaseRawExprNode(pCxt, yymsp[0].minor.yy24))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy104); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104); + yylhsminor.yy104 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy104), releaseRawExprNode(pCxt, yymsp[0].minor.yy104))); } - yymsp[-2].minor.yy24 = yylhsminor.yy24; + yymsp[-2].minor.yy104 = yylhsminor.yy104; break; - case 239: /* expression ::= expression NK_MINUS expression */ + case 268: /* expression ::= expression NK_MINUS expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy24); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy24); - yylhsminor.yy24 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy24), releaseRawExprNode(pCxt, yymsp[0].minor.yy24))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy104); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104); + yylhsminor.yy104 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy104), releaseRawExprNode(pCxt, yymsp[0].minor.yy104))); } - yymsp[-2].minor.yy24 = yylhsminor.yy24; + yymsp[-2].minor.yy104 = yylhsminor.yy104; break; - case 240: /* expression ::= expression NK_STAR expression */ + case 269: /* expression ::= expression NK_STAR expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy24); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy24); - yylhsminor.yy24 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy24), releaseRawExprNode(pCxt, yymsp[0].minor.yy24))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy104); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104); + yylhsminor.yy104 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy104), releaseRawExprNode(pCxt, yymsp[0].minor.yy104))); } - yymsp[-2].minor.yy24 = yylhsminor.yy24; + yymsp[-2].minor.yy104 = yylhsminor.yy104; break; - case 241: /* expression ::= expression NK_SLASH expression */ + case 270: /* expression ::= expression NK_SLASH expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy24); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy24); - yylhsminor.yy24 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy24), releaseRawExprNode(pCxt, yymsp[0].minor.yy24))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy104); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104); + yylhsminor.yy104 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy104), releaseRawExprNode(pCxt, yymsp[0].minor.yy104))); } - yymsp[-2].minor.yy24 = yylhsminor.yy24; + yymsp[-2].minor.yy104 = yylhsminor.yy104; break; - case 242: /* expression ::= expression NK_REM expression */ + case 271: /* expression ::= expression NK_REM expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy24); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy24); - yylhsminor.yy24 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MOD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy24), releaseRawExprNode(pCxt, yymsp[0].minor.yy24))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy104); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104); + yylhsminor.yy104 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MOD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy104), releaseRawExprNode(pCxt, yymsp[0].minor.yy104))); } - yymsp[-2].minor.yy24 = yylhsminor.yy24; + yymsp[-2].minor.yy104 = yylhsminor.yy104; break; - case 243: /* expression_list ::= expression */ -{ yylhsminor.yy504 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy24)); } - yymsp[0].minor.yy504 = yylhsminor.yy504; + case 272: /* expression_list ::= expression */ +{ yylhsminor.yy312 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy104)); } + yymsp[0].minor.yy312 = yylhsminor.yy312; break; - case 244: /* expression_list ::= expression_list NK_COMMA expression */ -{ yylhsminor.yy504 = addNodeToList(pCxt, yymsp[-2].minor.yy504, releaseRawExprNode(pCxt, yymsp[0].minor.yy24)); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + case 273: /* expression_list ::= expression_list NK_COMMA expression */ +{ yylhsminor.yy312 = addNodeToList(pCxt, yymsp[-2].minor.yy312, releaseRawExprNode(pCxt, yymsp[0].minor.yy104)); } + yymsp[-2].minor.yy312 = yylhsminor.yy312; break; - case 245: /* column_reference ::= column_name */ -{ yylhsminor.yy24 = createRawExprNode(pCxt, &yymsp[0].minor.yy337, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy337)); } - yymsp[0].minor.yy24 = yylhsminor.yy24; + case 274: /* column_reference ::= column_name */ +{ yylhsminor.yy104 = createRawExprNode(pCxt, &yymsp[0].minor.yy129, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy129)); } + yymsp[0].minor.yy104 = yylhsminor.yy104; break; - case 246: /* column_reference ::= table_name NK_DOT column_name */ -{ yylhsminor.yy24 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy337, &yymsp[0].minor.yy337, createColumnNode(pCxt, &yymsp[-2].minor.yy337, &yymsp[0].minor.yy337)); } - yymsp[-2].minor.yy24 = yylhsminor.yy24; + case 275: /* column_reference ::= table_name NK_DOT column_name */ +{ yylhsminor.yy104 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy129, &yymsp[0].minor.yy129, createColumnNode(pCxt, &yymsp[-2].minor.yy129, &yymsp[0].minor.yy129)); } + yymsp[-2].minor.yy104 = yylhsminor.yy104; break; - case 247: /* pseudo_column ::= NK_UNDERLINE ROWTS */ - case 249: /* pseudo_column ::= NK_UNDERLINE QSTARTTS */ yytestcase(yyruleno==249); - case 250: /* pseudo_column ::= NK_UNDERLINE QENDTS */ yytestcase(yyruleno==250); - case 251: /* pseudo_column ::= NK_UNDERLINE WSTARTTS */ yytestcase(yyruleno==251); - case 252: /* pseudo_column ::= NK_UNDERLINE WENDTS */ yytestcase(yyruleno==252); - case 253: /* pseudo_column ::= NK_UNDERLINE WDURATION */ yytestcase(yyruleno==253); + case 276: /* pseudo_column ::= NK_UNDERLINE ROWTS */ + case 278: /* pseudo_column ::= NK_UNDERLINE QSTARTTS */ yytestcase(yyruleno==278); + case 279: /* pseudo_column ::= NK_UNDERLINE QENDTS */ yytestcase(yyruleno==279); + case 280: /* pseudo_column ::= NK_UNDERLINE WSTARTTS */ yytestcase(yyruleno==280); + case 281: /* pseudo_column ::= NK_UNDERLINE WENDTS */ yytestcase(yyruleno==281); + case 282: /* pseudo_column ::= NK_UNDERLINE WDURATION */ yytestcase(yyruleno==282); { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy24 = createRawExprNode(pCxt, &t, createFunctionNode(pCxt, &t, NULL)); + yylhsminor.yy104 = createRawExprNode(pCxt, &t, createFunctionNode(pCxt, &t, NULL)); } - yymsp[-1].minor.yy24 = yylhsminor.yy24; + yymsp[-1].minor.yy104 = yylhsminor.yy104; break; - case 248: /* pseudo_column ::= TBNAME */ -{ yylhsminor.yy24 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } - yymsp[0].minor.yy24 = yylhsminor.yy24; + case 277: /* pseudo_column ::= TBNAME */ +{ yylhsminor.yy104 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } + yymsp[0].minor.yy104 = yylhsminor.yy104; break; - case 254: /* predicate ::= expression compare_op expression */ - case 259: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==259); + case 283: /* predicate ::= expression compare_op expression */ + case 288: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==288); { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy24); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy24); - yylhsminor.yy24 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy36, releaseRawExprNode(pCxt, yymsp[-2].minor.yy24), releaseRawExprNode(pCxt, yymsp[0].minor.yy24))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy104); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104); + yylhsminor.yy104 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy60, releaseRawExprNode(pCxt, yymsp[-2].minor.yy104), releaseRawExprNode(pCxt, yymsp[0].minor.yy104))); } - yymsp[-2].minor.yy24 = yylhsminor.yy24; + yymsp[-2].minor.yy104 = yylhsminor.yy104; break; - case 255: /* predicate ::= expression BETWEEN expression AND expression */ + case 284: /* predicate ::= expression BETWEEN expression AND expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy24); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy24); - yylhsminor.yy24 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy24), releaseRawExprNode(pCxt, yymsp[-2].minor.yy24), releaseRawExprNode(pCxt, yymsp[0].minor.yy24))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy104); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104); + yylhsminor.yy104 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy104), releaseRawExprNode(pCxt, yymsp[-2].minor.yy104), releaseRawExprNode(pCxt, yymsp[0].minor.yy104))); } - yymsp[-4].minor.yy24 = yylhsminor.yy24; + yymsp[-4].minor.yy104 = yylhsminor.yy104; break; - case 256: /* predicate ::= expression NOT BETWEEN expression AND expression */ + case 285: /* predicate ::= expression NOT BETWEEN expression AND expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy24); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy24); - yylhsminor.yy24 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy24), releaseRawExprNode(pCxt, yymsp[-5].minor.yy24), releaseRawExprNode(pCxt, yymsp[0].minor.yy24))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy104); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104); + yylhsminor.yy104 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy104), releaseRawExprNode(pCxt, yymsp[-5].minor.yy104), releaseRawExprNode(pCxt, yymsp[0].minor.yy104))); } - yymsp[-5].minor.yy24 = yylhsminor.yy24; + yymsp[-5].minor.yy104 = yylhsminor.yy104; break; - case 257: /* predicate ::= expression IS NULL */ + case 286: /* predicate ::= expression IS NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy24); - yylhsminor.yy24 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy24), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy104); + yylhsminor.yy104 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy104), NULL)); } - yymsp[-2].minor.yy24 = yylhsminor.yy24; + yymsp[-2].minor.yy104 = yylhsminor.yy104; break; - case 258: /* predicate ::= expression IS NOT NULL */ + case 287: /* predicate ::= expression IS NOT NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy24); - yylhsminor.yy24 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy24), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy104); + yylhsminor.yy104 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy104), NULL)); } - yymsp[-3].minor.yy24 = yylhsminor.yy24; + yymsp[-3].minor.yy104 = yylhsminor.yy104; break; - case 260: /* compare_op ::= NK_LT */ -{ yymsp[0].minor.yy36 = OP_TYPE_LOWER_THAN; } + case 289: /* compare_op ::= NK_LT */ +{ yymsp[0].minor.yy60 = OP_TYPE_LOWER_THAN; } break; - case 261: /* compare_op ::= NK_GT */ -{ yymsp[0].minor.yy36 = OP_TYPE_GREATER_THAN; } + case 290: /* compare_op ::= NK_GT */ +{ yymsp[0].minor.yy60 = OP_TYPE_GREATER_THAN; } break; - case 262: /* compare_op ::= NK_LE */ -{ yymsp[0].minor.yy36 = OP_TYPE_LOWER_EQUAL; } + case 291: /* compare_op ::= NK_LE */ +{ yymsp[0].minor.yy60 = OP_TYPE_LOWER_EQUAL; } break; - case 263: /* compare_op ::= NK_GE */ -{ yymsp[0].minor.yy36 = OP_TYPE_GREATER_EQUAL; } + case 292: /* compare_op ::= NK_GE */ +{ yymsp[0].minor.yy60 = OP_TYPE_GREATER_EQUAL; } break; - case 264: /* compare_op ::= NK_NE */ -{ yymsp[0].minor.yy36 = OP_TYPE_NOT_EQUAL; } + case 293: /* compare_op ::= NK_NE */ +{ yymsp[0].minor.yy60 = OP_TYPE_NOT_EQUAL; } break; - case 265: /* compare_op ::= NK_EQ */ -{ yymsp[0].minor.yy36 = OP_TYPE_EQUAL; } + case 294: /* compare_op ::= NK_EQ */ +{ yymsp[0].minor.yy60 = OP_TYPE_EQUAL; } break; - case 266: /* compare_op ::= LIKE */ -{ yymsp[0].minor.yy36 = OP_TYPE_LIKE; } + case 295: /* compare_op ::= LIKE */ +{ yymsp[0].minor.yy60 = OP_TYPE_LIKE; } break; - case 267: /* compare_op ::= NOT LIKE */ -{ yymsp[-1].minor.yy36 = OP_TYPE_NOT_LIKE; } + case 296: /* compare_op ::= NOT LIKE */ +{ yymsp[-1].minor.yy60 = OP_TYPE_NOT_LIKE; } break; - case 268: /* compare_op ::= MATCH */ -{ yymsp[0].minor.yy36 = OP_TYPE_MATCH; } + case 297: /* compare_op ::= MATCH */ +{ yymsp[0].minor.yy60 = OP_TYPE_MATCH; } break; - case 269: /* compare_op ::= NMATCH */ -{ yymsp[0].minor.yy36 = OP_TYPE_NMATCH; } + case 298: /* compare_op ::= NMATCH */ +{ yymsp[0].minor.yy60 = OP_TYPE_NMATCH; } break; - case 270: /* in_op ::= IN */ -{ yymsp[0].minor.yy36 = OP_TYPE_IN; } + case 299: /* in_op ::= IN */ +{ yymsp[0].minor.yy60 = OP_TYPE_IN; } break; - case 271: /* in_op ::= NOT IN */ -{ yymsp[-1].minor.yy36 = OP_TYPE_NOT_IN; } + case 300: /* in_op ::= NOT IN */ +{ yymsp[-1].minor.yy60 = OP_TYPE_NOT_IN; } break; - case 272: /* in_predicate_value ::= NK_LP expression_list NK_RP */ -{ yylhsminor.yy24 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy504)); } - yymsp[-2].minor.yy24 = yylhsminor.yy24; + case 301: /* in_predicate_value ::= NK_LP expression_list NK_RP */ +{ yylhsminor.yy104 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy312)); } + yymsp[-2].minor.yy104 = yylhsminor.yy104; break; - case 274: /* boolean_value_expression ::= NOT boolean_primary */ + case 303: /* boolean_value_expression ::= NOT boolean_primary */ { - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy24); - yylhsminor.yy24 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy24), NULL)); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104); + yylhsminor.yy104 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy104), NULL)); } - yymsp[-1].minor.yy24 = yylhsminor.yy24; + yymsp[-1].minor.yy104 = yylhsminor.yy104; break; - case 275: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + case 304: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy24); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy24); - yylhsminor.yy24 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy24), releaseRawExprNode(pCxt, yymsp[0].minor.yy24))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy104); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104); + yylhsminor.yy104 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy104), releaseRawExprNode(pCxt, yymsp[0].minor.yy104))); } - yymsp[-2].minor.yy24 = yylhsminor.yy24; + yymsp[-2].minor.yy104 = yylhsminor.yy104; break; - case 276: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + case 305: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy24); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy24); - yylhsminor.yy24 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy24), releaseRawExprNode(pCxt, yymsp[0].minor.yy24))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy104); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104); + yylhsminor.yy104 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy104), releaseRawExprNode(pCxt, yymsp[0].minor.yy104))); } - yymsp[-2].minor.yy24 = yylhsminor.yy24; + yymsp[-2].minor.yy104 = yylhsminor.yy104; break; - case 281: /* from_clause ::= FROM table_reference_list */ - case 311: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==311); - case 334: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==334); -{ yymsp[-1].minor.yy24 = yymsp[0].minor.yy24; } + case 310: /* from_clause ::= FROM table_reference_list */ + case 340: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==340); + case 363: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==363); +{ yymsp[-1].minor.yy104 = yymsp[0].minor.yy104; } break; - case 283: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ -{ yylhsminor.yy24 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy24, yymsp[0].minor.yy24, NULL); } - yymsp[-2].minor.yy24 = yylhsminor.yy24; + case 312: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ +{ yylhsminor.yy104 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy104, yymsp[0].minor.yy104, NULL); } + yymsp[-2].minor.yy104 = yylhsminor.yy104; break; - case 286: /* table_primary ::= table_name alias_opt */ -{ yylhsminor.yy24 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy337, &yymsp[0].minor.yy337); } - yymsp[-1].minor.yy24 = yylhsminor.yy24; + case 315: /* table_primary ::= table_name alias_opt */ +{ yylhsminor.yy104 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy129, &yymsp[0].minor.yy129); } + yymsp[-1].minor.yy104 = yylhsminor.yy104; break; - case 287: /* table_primary ::= db_name NK_DOT table_name alias_opt */ -{ yylhsminor.yy24 = createRealTableNode(pCxt, &yymsp[-3].minor.yy337, &yymsp[-1].minor.yy337, &yymsp[0].minor.yy337); } - yymsp[-3].minor.yy24 = yylhsminor.yy24; + case 316: /* table_primary ::= db_name NK_DOT table_name alias_opt */ +{ yylhsminor.yy104 = createRealTableNode(pCxt, &yymsp[-3].minor.yy129, &yymsp[-1].minor.yy129, &yymsp[0].minor.yy129); } + yymsp[-3].minor.yy104 = yylhsminor.yy104; break; - case 288: /* table_primary ::= subquery alias_opt */ -{ yylhsminor.yy24 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy24), &yymsp[0].minor.yy337); } - yymsp[-1].minor.yy24 = yylhsminor.yy24; + case 317: /* table_primary ::= subquery alias_opt */ +{ yylhsminor.yy104 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy104), &yymsp[0].minor.yy129); } + yymsp[-1].minor.yy104 = yylhsminor.yy104; break; - case 290: /* alias_opt ::= */ -{ yymsp[1].minor.yy337 = nil_token; } + case 319: /* alias_opt ::= */ +{ yymsp[1].minor.yy129 = nil_token; } break; - case 291: /* alias_opt ::= table_alias */ -{ yylhsminor.yy337 = yymsp[0].minor.yy337; } - yymsp[0].minor.yy337 = yylhsminor.yy337; + case 320: /* alias_opt ::= table_alias */ +{ yylhsminor.yy129 = yymsp[0].minor.yy129; } + yymsp[0].minor.yy129 = yylhsminor.yy129; break; - case 292: /* alias_opt ::= AS table_alias */ -{ yymsp[-1].minor.yy337 = yymsp[0].minor.yy337; } + case 321: /* alias_opt ::= AS table_alias */ +{ yymsp[-1].minor.yy129 = yymsp[0].minor.yy129; } break; - case 293: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - case 294: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==294); -{ yymsp[-2].minor.yy24 = yymsp[-1].minor.yy24; } + case 322: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + case 323: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==323); +{ yymsp[-2].minor.yy104 = yymsp[-1].minor.yy104; } break; - case 295: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ -{ yylhsminor.yy24 = createJoinTableNode(pCxt, yymsp[-4].minor.yy320, yymsp[-5].minor.yy24, yymsp[-2].minor.yy24, yymsp[0].minor.yy24); } - yymsp[-5].minor.yy24 = yylhsminor.yy24; + case 324: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ +{ yylhsminor.yy104 = createJoinTableNode(pCxt, yymsp[-4].minor.yy532, yymsp[-5].minor.yy104, yymsp[-2].minor.yy104, yymsp[0].minor.yy104); } + yymsp[-5].minor.yy104 = yylhsminor.yy104; break; - case 296: /* join_type ::= */ -{ yymsp[1].minor.yy320 = JOIN_TYPE_INNER; } + case 325: /* join_type ::= */ +{ yymsp[1].minor.yy532 = JOIN_TYPE_INNER; } break; - case 297: /* join_type ::= INNER */ -{ yymsp[0].minor.yy320 = JOIN_TYPE_INNER; } + case 326: /* join_type ::= INNER */ +{ yymsp[0].minor.yy532 = JOIN_TYPE_INNER; } break; - case 298: /* 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 327: /* query_specification ::= SELECT set_quantifier_opt select_list from_clause where_clause_opt partition_by_clause_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ { - yymsp[-8].minor.yy24 = createSelectStmt(pCxt, yymsp[-7].minor.yy265, yymsp[-6].minor.yy504, yymsp[-5].minor.yy24); - yymsp[-8].minor.yy24 = addWhereClause(pCxt, yymsp[-8].minor.yy24, yymsp[-4].minor.yy24); - yymsp[-8].minor.yy24 = addPartitionByClause(pCxt, yymsp[-8].minor.yy24, yymsp[-3].minor.yy504); - yymsp[-8].minor.yy24 = addWindowClauseClause(pCxt, yymsp[-8].minor.yy24, yymsp[-2].minor.yy24); - yymsp[-8].minor.yy24 = addGroupByClause(pCxt, yymsp[-8].minor.yy24, yymsp[-1].minor.yy504); - yymsp[-8].minor.yy24 = addHavingClause(pCxt, yymsp[-8].minor.yy24, yymsp[0].minor.yy24); + yymsp[-8].minor.yy104 = createSelectStmt(pCxt, yymsp[-7].minor.yy185, yymsp[-6].minor.yy312, yymsp[-5].minor.yy104); + yymsp[-8].minor.yy104 = addWhereClause(pCxt, yymsp[-8].minor.yy104, yymsp[-4].minor.yy104); + yymsp[-8].minor.yy104 = addPartitionByClause(pCxt, yymsp[-8].minor.yy104, yymsp[-3].minor.yy312); + yymsp[-8].minor.yy104 = addWindowClauseClause(pCxt, yymsp[-8].minor.yy104, yymsp[-2].minor.yy104); + yymsp[-8].minor.yy104 = addGroupByClause(pCxt, yymsp[-8].minor.yy104, yymsp[-1].minor.yy312); + yymsp[-8].minor.yy104 = addHavingClause(pCxt, yymsp[-8].minor.yy104, yymsp[0].minor.yy104); } break; - case 301: /* set_quantifier_opt ::= ALL */ -{ yymsp[0].minor.yy265 = false; } + case 330: /* set_quantifier_opt ::= ALL */ +{ yymsp[0].minor.yy185 = false; } break; - case 302: /* select_list ::= NK_STAR */ -{ yymsp[0].minor.yy504 = NULL; } + case 331: /* select_list ::= NK_STAR */ +{ yymsp[0].minor.yy312 = NULL; } break; - case 306: /* select_item ::= common_expression */ + case 335: /* select_item ::= common_expression */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy24); - yylhsminor.yy24 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy24), &t); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104); + yylhsminor.yy104 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy104), &t); } - yymsp[0].minor.yy24 = yylhsminor.yy24; + yymsp[0].minor.yy104 = yylhsminor.yy104; break; - case 307: /* select_item ::= common_expression column_alias */ -{ yylhsminor.yy24 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy24), &yymsp[0].minor.yy337); } - yymsp[-1].minor.yy24 = yylhsminor.yy24; + case 336: /* select_item ::= common_expression column_alias */ +{ yylhsminor.yy104 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy104), &yymsp[0].minor.yy129); } + yymsp[-1].minor.yy104 = yylhsminor.yy104; break; - case 308: /* select_item ::= common_expression AS column_alias */ -{ yylhsminor.yy24 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy24), &yymsp[0].minor.yy337); } - yymsp[-2].minor.yy24 = yylhsminor.yy24; + case 337: /* select_item ::= common_expression AS column_alias */ +{ yylhsminor.yy104 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy104), &yymsp[0].minor.yy129); } + yymsp[-2].minor.yy104 = yylhsminor.yy104; break; - case 309: /* select_item ::= table_name NK_DOT NK_STAR */ -{ yylhsminor.yy24 = createColumnNode(pCxt, &yymsp[-2].minor.yy337, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy24 = yylhsminor.yy24; + case 338: /* select_item ::= table_name NK_DOT NK_STAR */ +{ yylhsminor.yy104 = createColumnNode(pCxt, &yymsp[-2].minor.yy129, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy104 = yylhsminor.yy104; break; - case 313: /* partition_by_clause_opt ::= PARTITION BY expression_list */ - case 330: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==330); - case 340: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==340); -{ yymsp[-2].minor.yy504 = yymsp[0].minor.yy504; } + case 342: /* partition_by_clause_opt ::= PARTITION BY expression_list */ + case 359: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==359); + case 369: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==369); +{ yymsp[-2].minor.yy312 = yymsp[0].minor.yy312; } break; - case 315: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ -{ yymsp[-5].minor.yy24 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy24), releaseRawExprNode(pCxt, yymsp[-1].minor.yy24)); } + case 344: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ +{ yymsp[-5].minor.yy104 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy104), releaseRawExprNode(pCxt, yymsp[-1].minor.yy104)); } break; - case 316: /* twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP */ -{ yymsp[-3].minor.yy24 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy24)); } + case 345: /* twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP */ +{ yymsp[-3].minor.yy104 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy104)); } break; - case 317: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-5].minor.yy24 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy24), NULL, yymsp[-1].minor.yy24, yymsp[0].minor.yy24); } + case 346: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-5].minor.yy104 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy104), NULL, yymsp[-1].minor.yy104, yymsp[0].minor.yy104); } break; - case 318: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-7].minor.yy24 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy24), releaseRawExprNode(pCxt, yymsp[-3].minor.yy24), yymsp[-1].minor.yy24, yymsp[0].minor.yy24); } + case 347: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-7].minor.yy104 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy104), releaseRawExprNode(pCxt, yymsp[-3].minor.yy104), yymsp[-1].minor.yy104, yymsp[0].minor.yy104); } break; - case 320: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ -{ yymsp[-3].minor.yy24 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy24); } + case 349: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ +{ yymsp[-3].minor.yy104 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy104); } break; - case 322: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ -{ yymsp[-3].minor.yy24 = createFillNode(pCxt, yymsp[-1].minor.yy550, NULL); } + case 351: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ +{ yymsp[-3].minor.yy104 = createFillNode(pCxt, yymsp[-1].minor.yy550, NULL); } break; - case 323: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ -{ yymsp[-5].minor.yy24 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy504)); } + case 352: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ +{ yymsp[-5].minor.yy104 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy312)); } break; - case 324: /* fill_mode ::= NONE */ + case 353: /* fill_mode ::= NONE */ { yymsp[0].minor.yy550 = FILL_MODE_NONE; } break; - case 325: /* fill_mode ::= PREV */ + case 354: /* fill_mode ::= PREV */ { yymsp[0].minor.yy550 = FILL_MODE_PREV; } break; - case 326: /* fill_mode ::= NULL */ + case 355: /* fill_mode ::= NULL */ { yymsp[0].minor.yy550 = FILL_MODE_NULL; } break; - case 327: /* fill_mode ::= LINEAR */ + case 356: /* fill_mode ::= LINEAR */ { yymsp[0].minor.yy550 = FILL_MODE_LINEAR; } break; - case 328: /* fill_mode ::= NEXT */ + case 357: /* fill_mode ::= NEXT */ { yymsp[0].minor.yy550 = FILL_MODE_NEXT; } break; - case 331: /* group_by_list ::= expression */ -{ yylhsminor.yy504 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy24))); } - yymsp[0].minor.yy504 = yylhsminor.yy504; + case 360: /* group_by_list ::= expression */ +{ yylhsminor.yy312 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy104))); } + yymsp[0].minor.yy312 = yylhsminor.yy312; break; - case 332: /* group_by_list ::= group_by_list NK_COMMA expression */ -{ yylhsminor.yy504 = addNodeToList(pCxt, yymsp[-2].minor.yy504, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy24))); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + case 361: /* group_by_list ::= group_by_list NK_COMMA expression */ +{ yylhsminor.yy312 = addNodeToList(pCxt, yymsp[-2].minor.yy312, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy104))); } + yymsp[-2].minor.yy312 = yylhsminor.yy312; break; - case 335: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ + case 364: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ { - yylhsminor.yy24 = addOrderByClause(pCxt, yymsp[-3].minor.yy24, yymsp[-2].minor.yy504); - yylhsminor.yy24 = addSlimitClause(pCxt, yylhsminor.yy24, yymsp[-1].minor.yy24); - yylhsminor.yy24 = addLimitClause(pCxt, yylhsminor.yy24, yymsp[0].minor.yy24); + yylhsminor.yy104 = addOrderByClause(pCxt, yymsp[-3].minor.yy104, yymsp[-2].minor.yy312); + yylhsminor.yy104 = addSlimitClause(pCxt, yylhsminor.yy104, yymsp[-1].minor.yy104); + yylhsminor.yy104 = addLimitClause(pCxt, yylhsminor.yy104, yymsp[0].minor.yy104); } - yymsp[-3].minor.yy24 = yylhsminor.yy24; + yymsp[-3].minor.yy104 = yylhsminor.yy104; break; - case 337: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */ -{ yylhsminor.yy24 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy24, yymsp[0].minor.yy24); } - yymsp[-3].minor.yy24 = yylhsminor.yy24; + case 366: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */ +{ yylhsminor.yy104 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy104, yymsp[0].minor.yy104); } + yymsp[-3].minor.yy104 = yylhsminor.yy104; break; - case 342: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ - case 346: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==346); -{ yymsp[-1].minor.yy24 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } + case 371: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ + case 375: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==375); +{ yymsp[-1].minor.yy104 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } break; - case 343: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - case 347: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==347); -{ yymsp[-3].minor.yy24 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } + case 372: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + case 376: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==376); +{ yymsp[-3].minor.yy104 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } break; - case 344: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - case 348: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==348); -{ yymsp[-3].minor.yy24 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } + case 373: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + case 377: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==377); +{ yymsp[-3].minor.yy104 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } break; - case 349: /* subquery ::= NK_LP query_expression NK_RP */ -{ yylhsminor.yy24 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy24); } - yymsp[-2].minor.yy24 = yylhsminor.yy24; + case 378: /* subquery ::= NK_LP query_expression NK_RP */ +{ yylhsminor.yy104 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy104); } + yymsp[-2].minor.yy104 = yylhsminor.yy104; break; - case 353: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */ -{ yylhsminor.yy24 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy24), yymsp[-1].minor.yy346, yymsp[0].minor.yy45); } - yymsp[-2].minor.yy24 = yylhsminor.yy24; + case 382: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */ +{ yylhsminor.yy104 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy104), yymsp[-1].minor.yy354, yymsp[0].minor.yy489); } + yymsp[-2].minor.yy104 = yylhsminor.yy104; break; - case 354: /* ordering_specification_opt ::= */ -{ yymsp[1].minor.yy346 = ORDER_ASC; } + case 383: /* ordering_specification_opt ::= */ +{ yymsp[1].minor.yy354 = ORDER_ASC; } break; - case 355: /* ordering_specification_opt ::= ASC */ -{ yymsp[0].minor.yy346 = ORDER_ASC; } + case 384: /* ordering_specification_opt ::= ASC */ +{ yymsp[0].minor.yy354 = ORDER_ASC; } break; - case 356: /* ordering_specification_opt ::= DESC */ -{ yymsp[0].minor.yy346 = ORDER_DESC; } + case 385: /* ordering_specification_opt ::= DESC */ +{ yymsp[0].minor.yy354 = ORDER_DESC; } break; - case 357: /* null_ordering_opt ::= */ -{ yymsp[1].minor.yy45 = NULL_ORDER_DEFAULT; } + case 386: /* null_ordering_opt ::= */ +{ yymsp[1].minor.yy489 = NULL_ORDER_DEFAULT; } break; - case 358: /* null_ordering_opt ::= NULLS FIRST */ -{ yymsp[-1].minor.yy45 = NULL_ORDER_FIRST; } + case 387: /* null_ordering_opt ::= NULLS FIRST */ +{ yymsp[-1].minor.yy489 = NULL_ORDER_FIRST; } break; - case 359: /* null_ordering_opt ::= NULLS LAST */ -{ yymsp[-1].minor.yy45 = NULL_ORDER_LAST; } + case 388: /* null_ordering_opt ::= NULLS LAST */ +{ yymsp[-1].minor.yy489 = NULL_ORDER_LAST; } break; default: break; From e82f4aea099d191239fc40b013b872592451debc Mon Sep 17 00:00:00 2001 From: plum-lihui Date: Fri, 1 Apr 2022 16:35:52 +0800 Subject: [PATCH 35/68] [fixed] --- tests/script/tsim/db/alter_option.sim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/script/tsim/db/alter_option.sim b/tests/script/tsim/db/alter_option.sim index 234eb16744..f79bf88ad2 100644 --- a/tests/script/tsim/db/alter_option.sim +++ b/tests/script/tsim/db/alter_option.sim @@ -138,7 +138,7 @@ sql_error alter database db ntables 0 sql_error alter database db ntables 1 sql_error alter database db ntables 10 -#print ============== modify replica +#print ============== modify replica # TD-14409 sql_error alter database db replica 2 sql_error alter database db replica 5 sql_error alter database db replica -1 @@ -270,7 +270,7 @@ if $data12_db != 2 then return -1 endi -#sql_error alter database db wal 0 # TD-14436 +sql_error alter database db wal 0 # TD-14436 sql_error alter database db wal 3 sql_error alter database db wal 100 sql_error alter database db wal -1 From 1649d0ddda9cf119267df275cb93a66721107630 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 1 Apr 2022 16:36:36 +0800 Subject: [PATCH 36/68] shm --- include/dnode/mnode/mnode.h | 3 +-- source/dnode/mgmt/mm/src/mmFile.c | 4 ++-- source/dnode/mgmt/mm/src/mmInt.c | 15 +++++-------- source/dnode/mnode/impl/inc/mndCluster.h | 1 + source/dnode/mnode/impl/inc/mndInt.h | 1 - source/dnode/mnode/impl/src/mndCluster.c | 19 +++++++++++++++- source/dnode/mnode/impl/src/mndQnode.c | 2 +- source/dnode/mnode/impl/src/mndSnode.c | 2 +- source/dnode/mnode/impl/src/mnode.c | 28 +++++------------------- 9 files changed, 36 insertions(+), 39 deletions(-) diff --git a/include/dnode/mnode/mnode.h b/include/dnode/mnode/mnode.h index 5b88a9d6af..08ab63e55a 100644 --- a/include/dnode/mnode/mnode.h +++ b/include/dnode/mnode/mnode.h @@ -29,8 +29,7 @@ extern "C" { typedef struct SMnode SMnode; typedef struct { - int32_t dnodeId; - int64_t clusterId; + bool deploy; int8_t replica; int8_t selfIndex; SReplica replicas[TSDB_MAX_REPLICA]; diff --git a/source/dnode/mgmt/mm/src/mmFile.c b/source/dnode/mgmt/mm/src/mmFile.c index e5cc0ce087..76aba771cb 100644 --- a/source/dnode/mgmt/mm/src/mmFile.c +++ b/source/dnode/mgmt/mm/src/mmFile.c @@ -111,7 +111,7 @@ int32_t mmWriteFile(SMnodeMgmt *pMgmt, bool deployed) { TdFilePtr pFile = taosOpenFile(file, TD_FILE_CTEATE | TD_FILE_WRITE | TD_FILE_TRUNC); if (pFile == NULL) { - terrno = TAOS_SYSTEM_ERROR(errno);; + terrno = TAOS_SYSTEM_ERROR(errno); dError("failed to write %s since %s", file, terrstr()); return -1; } @@ -145,7 +145,7 @@ int32_t mmWriteFile(SMnodeMgmt *pMgmt, bool deployed) { snprintf(realfile, sizeof(realfile), "%s%smnode.json", pMgmt->path, TD_DIRSEP); if (taosRenameFile(file, realfile) != 0) { - terrno = TAOS_SYSTEM_ERROR(errno);; + terrno = TAOS_SYSTEM_ERROR(errno); dError("failed to rename %s since %s", file, terrstr()); return -1; } diff --git a/source/dnode/mgmt/mm/src/mmInt.c b/source/dnode/mgmt/mm/src/mmInt.c index 3d15c9b9ae..f4e00b5921 100644 --- a/source/dnode/mgmt/mm/src/mmInt.c +++ b/source/dnode/mgmt/mm/src/mmInt.c @@ -39,10 +39,6 @@ static int32_t mmRequire(SMgmtWrapper *pWrapper, bool *required) { } static void mmInitOption(SMnodeMgmt *pMgmt, SMnodeOpt *pOption) { - SDnode *pDnode = pMgmt->pDnode; - pOption->dnodeId = pDnode->dnodeId; - pOption->clusterId = pDnode->clusterId; - SMsgCb msgCb = {0}; msgCb.pWrapper = pMgmt->pWrapper; msgCb.queueFps[QUERY_QUEUE] = mmPutMsgToQueryQueue; @@ -66,6 +62,7 @@ static void mmBuildOptionForDeploy(SMnodeMgmt *pMgmt, SMnodeOpt *pOption) { pReplica->id = 1; pReplica->port = pDnode->serverPort; tstrncpy(pReplica->fqdn, pDnode->localFqdn, TSDB_FQDN_LEN); + pOption->deploy = true; pMgmt->selfIndex = pOption->selfIndex; pMgmt->replica = pOption->replica; @@ -77,6 +74,7 @@ static void mmBuildOptionForOpen(SMnodeMgmt *pMgmt, SMnodeOpt *pOption) { pOption->selfIndex = pMgmt->selfIndex; pOption->replica = pMgmt->replica; memcpy(&pOption->replicas, pMgmt->replicas, sizeof(SReplica) * TSDB_MAX_REPLICA); + pOption->deploy = false; } static int32_t mmBuildOptionFromReq(SMnodeMgmt *pMgmt, SMnodeOpt *pOption, SDCreateMnodeReq *pCreate) { @@ -89,7 +87,7 @@ static int32_t mmBuildOptionFromReq(SMnodeMgmt *pMgmt, SMnodeOpt *pOption, SDCre pReplica->id = pCreate->replicas[i].id; pReplica->port = pCreate->replicas[i].port; memcpy(pReplica->fqdn, pCreate->replicas[i].fqdn, TSDB_FQDN_LEN); - if (pReplica->id == pOption->dnodeId) { + if (pReplica->id == pMgmt->pDnode->dnodeId) { pOption->selfIndex = i; } } @@ -98,6 +96,7 @@ static int32_t mmBuildOptionFromReq(SMnodeMgmt *pMgmt, SMnodeOpt *pOption, SDCre dError("failed to build mnode options since %s", terrstr()); return -1; } + pOption->deploy = true; pMgmt->selfIndex = pOption->selfIndex; pMgmt->replica = pOption->replica; @@ -225,9 +224,7 @@ int32_t mmOpenFromMsg(SMgmtWrapper *pWrapper, SDCreateMnodeReq *pReq) { return code; } -static int32_t mmOpen(SMgmtWrapper *pWrapper) { - return mmOpenFromMsg(pWrapper, NULL); -} +static int32_t mmOpen(SMgmtWrapper *pWrapper) { return mmOpenFromMsg(pWrapper, NULL); } static int32_t mmStart(SMgmtWrapper *pWrapper) { dDebug("mnode-mgmt start to run"); @@ -258,7 +255,7 @@ int32_t mmGetUserAuth(SMgmtWrapper *pWrapper, char *user, char *spi, char *encry } int32_t mmMonitorMnodeInfo(SMgmtWrapper *pWrapper, SMonClusterInfo *pClusterInfo, SMonVgroupInfo *pVgroupInfo, - SMonGrantInfo *pGrantInfo) { + SMonGrantInfo *pGrantInfo) { SMnodeMgmt *pMgmt = pWrapper->pMgmt; return mndGetMonitorInfo(pMgmt->pMnode, pClusterInfo, pVgroupInfo, pGrantInfo); } diff --git a/source/dnode/mnode/impl/inc/mndCluster.h b/source/dnode/mnode/impl/inc/mndCluster.h index 0206695b88..5b7bac4486 100644 --- a/source/dnode/mnode/impl/inc/mndCluster.h +++ b/source/dnode/mnode/impl/inc/mndCluster.h @@ -25,6 +25,7 @@ extern "C" { int32_t mndInitCluster(SMnode *pMnode); void mndCleanupCluster(SMnode *pMnode); int32_t mndGetClusterName(SMnode *pMnode, char *clusterName, int32_t len); +int64_t mndGetClusterId(SMnode *pMnode); #ifdef __cplusplus } diff --git a/source/dnode/mnode/impl/inc/mndInt.h b/source/dnode/mnode/impl/inc/mndInt.h index f89e9d8fe0..1cb0c78aa5 100644 --- a/source/dnode/mnode/impl/inc/mndInt.h +++ b/source/dnode/mnode/impl/inc/mndInt.h @@ -100,7 +100,6 @@ typedef struct { } SGrantInfo; typedef struct SMnode { - int32_t dnodeId; int64_t clusterId; int8_t replica; int8_t selfIndex; diff --git a/source/dnode/mnode/impl/src/mndCluster.c b/source/dnode/mnode/impl/src/mndCluster.c index dde7e1fe8f..94e1efde61 100644 --- a/source/dnode/mnode/impl/src/mndCluster.c +++ b/source/dnode/mnode/impl/src/mndCluster.c @@ -17,7 +17,7 @@ #include "mndCluster.h" #include "mndShow.h" -#define TSDB_CLUSTER_VER_NUMBE 1 +#define TSDB_CLUSTER_VER_NUMBE 1 #define TSDB_CLUSTER_RESERVE_SIZE 64 static SSdbRaw *mndClusterActionEncode(SClusterObj *pCluster); @@ -61,6 +61,23 @@ int32_t mndGetClusterName(SMnode *pMnode, char *clusterName, int32_t len) { return 0; } +int64_t mndGetClusterId(SMnode *pMnode) { + SSdb *pSdb = pMnode->pSdb; + void *pIter = NULL; + int64_t clusterId = -1; + + while (1) { + SClusterObj *pCluster = NULL; + pIter = sdbFetch(pSdb, SDB_CLUSTER, pIter, (void **)&pCluster); + if (pIter == NULL) break; + + clusterId = pCluster->id; + sdbRelease(pSdb, pCluster); + } + + return clusterId; +} + static SSdbRaw *mndClusterActionEncode(SClusterObj *pCluster) { terrno = TSDB_CODE_OUT_OF_MEMORY; diff --git a/source/dnode/mnode/impl/src/mndQnode.c b/source/dnode/mnode/impl/src/mndQnode.c index 4b19a26bc4..85718e2037 100644 --- a/source/dnode/mnode/impl/src/mndQnode.c +++ b/source/dnode/mnode/impl/src/mndQnode.c @@ -423,7 +423,7 @@ static int32_t mndProcessDropQnodeReq(SNodeMsg *pReq) { DROP_QNODE_OVER: if (code != 0 && code != TSDB_CODE_MND_ACTION_IN_PROGRESS) { - mError("qnode:%d, failed to drop since %s", pMnode->dnodeId, terrstr()); + mError("qnode:%d, failed to drop since %s", dropReq.dnodeId, terrstr()); } mndReleaseQnode(pMnode, pObj); diff --git a/source/dnode/mnode/impl/src/mndSnode.c b/source/dnode/mnode/impl/src/mndSnode.c index 5e0d9fae9a..4f24c6f7eb 100644 --- a/source/dnode/mnode/impl/src/mndSnode.c +++ b/source/dnode/mnode/impl/src/mndSnode.c @@ -433,7 +433,7 @@ static int32_t mndProcessDropSnodeReq(SNodeMsg *pReq) { DROP_SNODE_OVER: if (code != 0 && code != TSDB_CODE_MND_ACTION_IN_PROGRESS) { - mError("snode:%d, failed to drop since %s", pMnode->dnodeId, terrstr()); + mError("snode:%d, failed to drop since %s", dropReq.dnodeId, terrstr()); } mndReleaseSnode(pMnode, pObj); diff --git a/source/dnode/mnode/impl/src/mnode.c b/source/dnode/mnode/impl/src/mnode.c index 67b7d6dd45..5c3dd778e1 100644 --- a/source/dnode/mnode/impl/src/mnode.c +++ b/source/dnode/mnode/impl/src/mnode.c @@ -187,7 +187,7 @@ static int32_t mndAllocStep(SMnode *pMnode, char *name, MndInitFp initFp, MndCle return 0; } -static int32_t mndInitSteps(SMnode *pMnode) { +static int32_t mndInitSteps(SMnode *pMnode, bool deploy) { if (mndAllocStep(pMnode, "mnode-sdb", mndInitSdb, mndCleanupSdb) != 0) return -1; if (mndAllocStep(pMnode, "mnode-trans", mndInitTrans, mndCleanupTrans) != 0) return -1; if (mndAllocStep(pMnode, "mnode-cluster", mndInitCluster, mndCleanupCluster) != 0) return -1; @@ -210,7 +210,7 @@ static int32_t mndInitSteps(SMnode *pMnode) { if (mndAllocStep(pMnode, "mnode-infos", mndInitInfos, mndCleanupInfos) != 0) return -1; if (mndAllocStep(pMnode, "mnode-db", mndInitDb, mndCleanupDb) != 0) return -1; if (mndAllocStep(pMnode, "mnode-func", mndInitFunc, mndCleanupFunc) != 0) return -1; - if (pMnode->clusterId <= 0) { + if (deploy) { if (mndAllocStep(pMnode, "mnode-sdb-deploy", mndDeploySdb, NULL) != 0) return -1; } else { if (mndAllocStep(pMnode, "mnode-sdb-read", mndReadSdb, NULL) != 0) return -1; @@ -263,23 +263,15 @@ static int32_t mndExecSteps(SMnode *pMnode) { } } + pMnode->clusterId = mndGetClusterId(pMnode); return 0; } -static int32_t mndSetOptions(SMnode *pMnode, const SMnodeOpt *pOption) { - pMnode->dnodeId = pOption->dnodeId; - pMnode->clusterId = pOption->clusterId; +static void mndSetOptions(SMnode *pMnode, const SMnodeOpt *pOption) { pMnode->replica = pOption->replica; pMnode->selfIndex = pOption->selfIndex; memcpy(&pMnode->replicas, pOption->replicas, sizeof(SReplica) * TSDB_MAX_REPLICA); pMnode->msgCb = pOption->msgCb; - - if (pMnode->dnodeId < 0 || pMnode->clusterId < 0) { - terrno = TSDB_CODE_MND_INVALID_OPTIONS; - return -1; - } - - return 0; } SMnode *mndOpen(const char *path, const SMnodeOpt *pOption) { @@ -294,6 +286,7 @@ SMnode *mndOpen(const char *path, const SMnodeOpt *pOption) { char timestr[24] = "1970-01-01 00:00:00.00"; (void)taosParseTime(timestr, &pMnode->checkTime, (int32_t)strlen(timestr), TSDB_TIME_PRECISION_MILLI, 0); + mndSetOptions(pMnode, pOption); pMnode->pSteps = taosArrayInit(24, sizeof(SMnodeStep)); if (pMnode->pSteps == NULL) { @@ -312,16 +305,7 @@ SMnode *mndOpen(const char *path, const SMnodeOpt *pOption) { return NULL; } - code = mndSetOptions(pMnode, pOption); - if (code != 0) { - code = terrno; - mError("failed to open mnode since %s", terrstr()); - mndClose(pMnode); - terrno = code; - return NULL; - } - - code = mndInitSteps(pMnode); + code = mndInitSteps(pMnode, pOption->deploy); if (code != 0) { code = terrno; mError("failed to open mnode since %s", terrstr()); From 9525e37651ac50352f8fb9869f55ce7b01a4175b Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Fri, 1 Apr 2022 08:44:59 +0000 Subject: [PATCH 37/68] 256K for 1.5G data --- source/libs/tdb/test/tdbTest.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/source/libs/tdb/test/tdbTest.cpp b/source/libs/tdb/test/tdbTest.cpp index f98eff7e5b..9e1277a53d 100644 --- a/source/libs/tdb/test/tdbTest.cpp +++ b/source/libs/tdb/test/tdbTest.cpp @@ -118,10 +118,10 @@ TEST(tdb_test, simple_test) { TENV *pEnv; TDB *pDb; FKeyComparator compFunc; - int nData = 1000000; + int nData = 50000000; // Open Env - ret = tdbEnvOpen("tdb", 4096, 8192, &pEnv); + ret = tdbEnvOpen("tdb", 4096, 64, &pEnv); GTEST_ASSERT_EQ(ret, 0); // Create a database @@ -149,6 +149,8 @@ TEST(tdb_test, simple_test) { } } + tdbCommit(pEnv); + { // Query the data void *pVal = NULL; int vLen; @@ -158,6 +160,7 @@ TEST(tdb_test, simple_test) { sprintf(val, "value%d", i); ret = tdbDbGet(pDb, key, strlen(key), &pVal, &vLen); + ASSERT(ret == 0); GTEST_ASSERT_EQ(ret, 0); GTEST_ASSERT_EQ(vLen, strlen(val)); From c3917c2544d19e756d113267d2da2d0cb986c340 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 1 Apr 2022 16:46:31 +0800 Subject: [PATCH 38/68] shm --- source/dnode/mgmt/test/vnode/vnode.cpp | 40 -------------------------- source/dnode/mgmt/vm/src/vmMsg.c | 6 ---- 2 files changed, 46 deletions(-) diff --git a/source/dnode/mgmt/test/vnode/vnode.cpp b/source/dnode/mgmt/test/vnode/vnode.cpp index e2de3fc33a..35a98154c2 100644 --- a/source/dnode/mgmt/test/vnode/vnode.cpp +++ b/source/dnode/mgmt/test/vnode/vnode.cpp @@ -70,46 +70,6 @@ TEST_F(DndTestVnode, 01_Create_Vnode) { ASSERT_EQ(pRsp->code, TSDB_CODE_DND_VNODE_ALREADY_DEPLOYED); } } - - { - SCreateVnodeReq createReq = {0}; - createReq.vgId = 2; - createReq.dnodeId = 3; - strcpy(createReq.db, "1.d1"); - createReq.dbUid = 9527; - createReq.vgVersion = 1; - createReq.cacheBlockSize = 16; - createReq.totalBlocks = 10; - createReq.daysPerFile = 10; - createReq.daysToKeep0 = 3650; - createReq.daysToKeep1 = 3650; - createReq.daysToKeep2 = 3650; - createReq.minRows = 100; - createReq.minRows = 4096; - createReq.commitTime = 3600; - createReq.fsyncPeriod = 3000; - createReq.walLevel = 1; - createReq.precision = 0; - createReq.compression = 2; - createReq.replica = 1; - createReq.quorum = 1; - createReq.update = 0; - createReq.cacheLastRow = 0; - createReq.selfIndex = 0; - for (int r = 0; r < createReq.replica; ++r) { - SReplica* pReplica = &createReq.replicas[r]; - pReplica->id = 1; - pReplica->port = 9527; - } - - int32_t contLen = tSerializeSCreateVnodeReq(NULL, 0, &createReq); - void* pReq = rpcMallocCont(contLen); - tSerializeSCreateVnodeReq(pReq, contLen, &createReq); - - SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_VNODE, pReq, contLen); - ASSERT_NE(pRsp, nullptr); - ASSERT_EQ(pRsp->code, TSDB_CODE_DND_VNODE_INVALID_OPTION); - } } TEST_F(DndTestVnode, 02_Alter_Vnode) { diff --git a/source/dnode/mgmt/vm/src/vmMsg.c b/source/dnode/mgmt/vm/src/vmMsg.c index f00bb89354..89cf8dc5da 100644 --- a/source/dnode/mgmt/vm/src/vmMsg.c +++ b/source/dnode/mgmt/vm/src/vmMsg.c @@ -68,12 +68,6 @@ int32_t vmProcessCreateVnodeReq(SVnodesMgmt *pMgmt, SNodeMsg *pMsg) { SWrapperCfg wrapperCfg = {0}; vmGenerateWrapperCfg(pMgmt, &createReq, &wrapperCfg); - if (createReq.dnodeId != pMgmt->pDnode->dnodeId) { - terrno = TSDB_CODE_DND_VNODE_INVALID_OPTION; - dDebug("vgId:%d, failed to create vnode since %s", createReq.vgId, terrstr()); - return -1; - } - SVnodeObj *pVnode = vmAcquireVnode(pMgmt, createReq.vgId); if (pVnode != NULL) { dDebug("vgId:%d, already exist", createReq.vgId); From 3295a5889426e584f087e71c679a0e9fff643dcd Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Fri, 1 Apr 2022 17:27:56 +0800 Subject: [PATCH 39/68] [TD-14423]: abs(0.000) return -0.00000 --- source/libs/scalar/src/sclfunc.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/source/libs/scalar/src/sclfunc.c b/source/libs/scalar/src/sclfunc.c index d8e97e7e12..429bc6e66f 100644 --- a/source/libs/scalar/src/sclfunc.c +++ b/source/libs/scalar/src/sclfunc.c @@ -23,7 +23,7 @@ int32_t absFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutpu colDataSetNull_f(pOutputData->nullbitmap, i); continue; } - out[i] = (in[i] > 0)? in[i] : -in[i]; + out[i] = (in[i] >= 0)? in[i] : -in[i]; } break; } @@ -36,7 +36,7 @@ int32_t absFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutpu colDataSetNull_f(pOutputData->nullbitmap, i); continue; } - out[i] = (in[i] > 0)? in[i] : -in[i]; + out[i] = (in[i] >= 0)? in[i] : -in[i]; } break; } @@ -49,7 +49,7 @@ int32_t absFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutpu colDataSetNull_f(pOutputData->nullbitmap, i); continue; } - out[i] = (in[i] > 0)? in[i] : -in[i]; + out[i] = (in[i] >= 0)? in[i] : -in[i]; } break; } @@ -62,7 +62,7 @@ int32_t absFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutpu colDataSetNull_f(pOutputData->nullbitmap, i); continue; } - out[i] = (in[i] > 0)? in[i] : -in[i]; + out[i] = (in[i] >= 0)? in[i] : -in[i]; } break; } @@ -75,7 +75,7 @@ int32_t absFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutpu colDataSetNull_f(pOutputData->nullbitmap, i); continue; } - out[i] = (in[i] > 0)? in[i] : -in[i]; + out[i] = (in[i] >= 0)? in[i] : -in[i]; } break; } @@ -88,7 +88,7 @@ int32_t absFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutpu colDataSetNull_f(pOutputData->nullbitmap, i); continue; } - out[i] = (in[i] > 0)? in[i] : -in[i]; + out[i] = (in[i] >= 0)? in[i] : -in[i]; } break; } @@ -407,4 +407,4 @@ int32_t winEndTsFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *p ASSERT(inputNum == 1); colDataAppendInt64(pOutput->columnData, pOutput->numOfRows, (int64_t*) colDataGetData(pInput->columnData, 4)); return TSDB_CODE_SUCCESS; -} \ No newline at end of file +} From cf68440a5995faf9903797e0cf7ba86769682a6c Mon Sep 17 00:00:00 2001 From: Cary Xu Date: Fri, 1 Apr 2022 17:43:50 +0800 Subject: [PATCH 40/68] bSma grammar integrate --- include/client/taos.h | 1 + include/common/taosdef.h | 7 ++ include/common/tdataformat.h | 4 +- include/common/tmsg.h | 39 +++++++---- include/os/osMemory.h | 6 +- include/util/tcoding.h | 2 + source/common/src/tdataformat.c | 11 +-- source/common/src/tmsg.c | 62 ++++++----------- source/common/src/ttypes.c | 2 +- source/dnode/mgmt/test/vnode/vnode.cpp | 32 ++++----- source/dnode/mnode/impl/src/mndStb.c | 69 ++++++++++++++++-- source/dnode/vnode/src/meta/metaBDBImpl.c | 85 ++++++++++++++++++----- source/dnode/vnode/src/meta/metaTDBImpl.c | 64 +++++++++++++++-- source/dnode/vnode/src/vnd/vnodeWrite.c | 4 -- source/libs/parser/src/parTranslater.c | 6 +- 15 files changed, 282 insertions(+), 112 deletions(-) diff --git a/include/client/taos.h b/include/client/taos.h index 111cd8ad3b..8e852107c7 100644 --- a/include/client/taos.h +++ b/include/client/taos.h @@ -54,6 +54,7 @@ typedef void TAOS_SUB; #define TSDB_DATA_TYPE_BLOB 18 // binary #define TSDB_DATA_TYPE_MEDIUMBLOB 19 #define TSDB_DATA_TYPE_BINARY TSDB_DATA_TYPE_VARCHAR // string +#define TSDB_DATA_TYPE_MAX 20 typedef enum { TSDB_OPTION_LOCALE, diff --git a/include/common/taosdef.h b/include/common/taosdef.h index 797ebf29c5..5001a99c2a 100644 --- a/include/common/taosdef.h +++ b/include/common/taosdef.h @@ -76,6 +76,13 @@ typedef enum { TSDB_SMA_TYPE_ROLLUP = 2, // Rollup SMA } ETsdbSmaType; +typedef enum { + TSDB_BSMA_TYPE_NONE = 0, // no block-wise SMA + TSDB_BSMA_TYPE_I = 1, // sum/min/max(default) +} ETsdbBSmaType; + +#define TSDB_BSMA_TYPE_LATEST TSDB_BSMA_TYPE_I + extern char *qtypeStr[]; #define TSDB_PORT_HTTP 11 diff --git a/include/common/tdataformat.h b/include/common/tdataformat.h index 4a3ce2db86..da724206d9 100644 --- a/include/common/tdataformat.h +++ b/include/common/tdataformat.h @@ -70,11 +70,13 @@ typedef struct { #pragma pack(pop) #define colType(col) ((col)->type) +#define colSma(col) ((col)->sma) #define colColId(col) ((col)->colId) #define colBytes(col) ((col)->bytes) #define colOffset(col) ((col)->offset) #define colSetType(col, t) (colType(col) = (t)) +#define colSetSma(col, s) (colSma(col) = (s)) #define colSetColId(col, id) (colColId(col) = (id)) #define colSetBytes(col, b) (colBytes(col) = (b)) #define colSetOffset(col, o) (colOffset(col) = (o)) @@ -139,7 +141,7 @@ typedef struct { int32_t tdInitTSchemaBuilder(STSchemaBuilder *pBuilder, schema_ver_t version); void tdDestroyTSchemaBuilder(STSchemaBuilder *pBuilder); void tdResetTSchemaBuilder(STSchemaBuilder *pBuilder, schema_ver_t version); -int32_t tdAddColToSchema(STSchemaBuilder *pBuilder, int8_t type, col_id_t colId, col_bytes_t bytes); +int32_t tdAddColToSchema(STSchemaBuilder *pBuilder, int8_t type, int8_t sma, col_id_t colId, col_bytes_t bytes); STSchema *tdGetSchemaFromBuilder(STSchemaBuilder *pBuilder); // ----------------- Semantic timestamp key definition diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 31b316861b..12909875d5 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -265,6 +265,20 @@ typedef struct SSchema { char name[TSDB_COL_NAME_LEN]; } SSchema; +typedef struct { + int8_t type; + int8_t sma; // ETsdbBSmaType and default is TSDB_BSMA_TYPE_I + col_id_t colId; + int32_t bytes; + char name[TSDB_COL_NAME_LEN]; +} SSchemaEx; + +#define SSCHMEA_TYPE(s) ((s)->type) +#define SSCHMEA_SMA(s) ((s)->sma) +#define SSCHMEA_COLID(s) ((s)->colId) +#define SSCHMEA_BYTES(s) ((s)->bytes) +#define SSCHMEA_NAME(s) ((s)->name) + typedef struct { char name[TSDB_TABLE_FNAME_LEN]; int8_t igExists; @@ -1403,13 +1417,12 @@ typedef struct SVCreateTbReq { }; union { struct { - tb_uid_t suid; - uint32_t nCols; - SSchema* pSchema; - uint32_t nTagCols; - SSchema* pTagSchema; - col_id_t nBSmaCols; - col_id_t* pBSmaCols; + tb_uid_t suid; + col_id_t nCols; + col_id_t nBSmaCols; + SSchemaEx* pSchema; + col_id_t nTagCols; + SSchema* pTagSchema; SRSmaParam* pRSmaParam; } stbCfg; struct { @@ -1417,10 +1430,9 @@ typedef struct SVCreateTbReq { SKVRow pTag; } ctbCfg; struct { - uint32_t nCols; - SSchema* pSchema; - col_id_t nBSmaCols; - col_id_t* pBSmaCols; + col_id_t nCols; + col_id_t nBSmaCols; + SSchemaEx* pSchema; SRSmaParam* pRSmaParam; } ntbCfg; }; @@ -1899,7 +1911,10 @@ int32_t tDecodeSMqCMCommitOffsetReq(SCoder* decoder, SMqCMCommitOffsetReq* pReq) typedef struct { uint32_t nCols; - SSchema* pSchema; + union { + SSchema* pSchema; + SSchemaEx* pSchemaEx; + }; } SSchemaWrapper; static FORCE_INLINE int32_t taosEncodeSSchema(void** buf, const SSchema* pSchema) { diff --git a/include/os/osMemory.h b/include/os/osMemory.h index 62ac82782c..5a12aab0f4 100644 --- a/include/os/osMemory.h +++ b/include/os/osMemory.h @@ -37,8 +37,10 @@ int32_t taosMemorySize(void *ptr); #define taosMemoryFreeClear(ptr) \ do { \ - taosMemoryFree(ptr); \ - (ptr)=NULL; \ + if (ptr) { \ + taosMemoryFree(ptr); \ + (ptr) = NULL; \ + } \ } while (0) #ifdef __cplusplus diff --git a/include/util/tcoding.h b/include/util/tcoding.h index 838b175a28..3f00c79f46 100644 --- a/include/util/tcoding.h +++ b/include/util/tcoding.h @@ -57,6 +57,8 @@ static FORCE_INLINE void *taosDecodeFixedI8(const void *buf, int8_t *value) { return POINTER_SHIFT(buf, sizeof(*value)); } +static FORCE_INLINE void *taosSkipFixedLen(const void *buf, size_t len) { return POINTER_SHIFT(buf, len); } + // ---- Fixed U16 static FORCE_INLINE int32_t taosEncodeFixedU16(void **buf, uint16_t value) { if (buf != NULL) { diff --git a/source/common/src/tdataformat.c b/source/common/src/tdataformat.c index 7fd66e95ad..1d7a4aeb8f 100644 --- a/source/common/src/tdataformat.c +++ b/source/common/src/tdataformat.c @@ -85,6 +85,7 @@ int tdEncodeSchema(void **buf, STSchema *pSchema) { for (int i = 0; i < schemaNCols(pSchema); i++) { STColumn *pCol = schemaColAt(pSchema, i); tlen += taosEncodeFixedI8(buf, colType(pCol)); + tlen += taosEncodeFixedI8(buf, colSma(pCol)); tlen += taosEncodeFixedI16(buf, colColId(pCol)); tlen += taosEncodeFixedI16(buf, colBytes(pCol)); } @@ -107,12 +108,14 @@ void *tdDecodeSchema(void *buf, STSchema **pRSchema) { for (int i = 0; i < numOfCols; i++) { col_type_t type = 0; + int8_t sma = TSDB_BSMA_TYPE_NONE; col_id_t colId = 0; col_bytes_t bytes = 0; buf = taosDecodeFixedI8(buf, &type); + buf = taosDecodeFixedI8(buf, &sma); buf = taosDecodeFixedI16(buf, &colId); buf = taosDecodeFixedI32(buf, &bytes); - if (tdAddColToSchema(&schemaBuilder, type, colId, bytes) < 0) { + if (tdAddColToSchema(&schemaBuilder, type, sma, colId, bytes) < 0) { tdDestroyTSchemaBuilder(&schemaBuilder); return NULL; } @@ -148,7 +151,7 @@ void tdResetTSchemaBuilder(STSchemaBuilder *pBuilder, schema_ver_t version) { pBuilder->version = version; } -int tdAddColToSchema(STSchemaBuilder *pBuilder, int8_t type, col_id_t colId, col_bytes_t bytes) { +int32_t tdAddColToSchema(STSchemaBuilder *pBuilder, int8_t type, int8_t sma, col_id_t colId, col_bytes_t bytes) { if (!isValidDataType(type)) return -1; if (pBuilder->nCols >= pBuilder->tCols) { @@ -161,6 +164,7 @@ int tdAddColToSchema(STSchemaBuilder *pBuilder, int8_t type, col_id_t colId, col STColumn *pCol = &(pBuilder->columns[pBuilder->nCols]); colSetType(pCol, type); colSetColId(pCol, colId); + colSetSma(pCol, sma); if (pBuilder->nCols == 0) { colSetOffset(pCol, 0); } else { @@ -168,9 +172,6 @@ int tdAddColToSchema(STSchemaBuilder *pBuilder, int8_t type, col_id_t colId, col colSetOffset(pCol, pTCol->offset + TYPE_BYTES[pTCol->type]); } - // TODO: set sma value by user input - pCol->sma = 1; - if (IS_VAR_DATA_TYPE(type)) { colSetBytes(pCol, bytes); pBuilder->tlen += (TYPE_BYTES[type] + bytes); diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index 06dd2906be..d75fa6e9c5 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -296,24 +296,22 @@ int32_t tSerializeSVCreateTbReq(void **buf, SVCreateTbReq *pReq) { switch (pReq->type) { case TD_SUPER_TABLE: tlen += taosEncodeFixedI64(buf, pReq->stbCfg.suid); - tlen += taosEncodeFixedU32(buf, pReq->stbCfg.nCols); - for (uint32_t i = 0; i < pReq->stbCfg.nCols; i++) { + tlen += taosEncodeFixedI16(buf, pReq->stbCfg.nCols); + tlen += taosEncodeFixedI16(buf, pReq->stbCfg.nBSmaCols); + for (col_id_t i = 0; i < pReq->stbCfg.nCols; ++i) { tlen += taosEncodeFixedI8(buf, pReq->stbCfg.pSchema[i].type); + tlen += taosEncodeFixedI8(buf, pReq->stbCfg.pSchema[i].sma); tlen += taosEncodeFixedI16(buf, pReq->stbCfg.pSchema[i].colId); tlen += taosEncodeFixedI32(buf, pReq->stbCfg.pSchema[i].bytes); tlen += taosEncodeString(buf, pReq->stbCfg.pSchema[i].name); } - tlen += taosEncodeFixedU32(buf, pReq->stbCfg.nTagCols); - for (uint32_t i = 0; i < pReq->stbCfg.nTagCols; i++) { + tlen += taosEncodeFixedI16(buf, pReq->stbCfg.nTagCols); + for (col_id_t i = 0; i < pReq->stbCfg.nTagCols; ++i) { tlen += taosEncodeFixedI8(buf, pReq->stbCfg.pTagSchema[i].type); tlen += taosEncodeFixedI16(buf, pReq->stbCfg.pTagSchema[i].colId); tlen += taosEncodeFixedI32(buf, pReq->stbCfg.pTagSchema[i].bytes); tlen += taosEncodeString(buf, pReq->stbCfg.pTagSchema[i].name); } - tlen += taosEncodeFixedI16(buf, pReq->stbCfg.nBSmaCols); - for (col_id_t i = 0; i < pReq->stbCfg.nBSmaCols; ++i) { - tlen += taosEncodeFixedI16(buf, pReq->stbCfg.pBSmaCols[i]); - } if (pReq->rollup && pReq->stbCfg.pRSmaParam) { SRSmaParam *param = pReq->stbCfg.pRSmaParam; tlen += taosEncodeFixedU32(buf, (uint32_t)param->xFilesFactor); @@ -330,17 +328,15 @@ int32_t tSerializeSVCreateTbReq(void **buf, SVCreateTbReq *pReq) { tlen += tdEncodeKVRow(buf, pReq->ctbCfg.pTag); break; case TD_NORMAL_TABLE: - tlen += taosEncodeFixedU32(buf, pReq->ntbCfg.nCols); - for (uint32_t i = 0; i < pReq->ntbCfg.nCols; i++) { + tlen += taosEncodeFixedI16(buf, pReq->ntbCfg.nCols); + tlen += taosEncodeFixedI16(buf, pReq->ntbCfg.nBSmaCols); + for (col_id_t i = 0; i < pReq->ntbCfg.nCols; ++i) { tlen += taosEncodeFixedI8(buf, pReq->ntbCfg.pSchema[i].type); + tlen += taosEncodeFixedI8(buf, pReq->ntbCfg.pSchema[i].sma); tlen += taosEncodeFixedI16(buf, pReq->ntbCfg.pSchema[i].colId); tlen += taosEncodeFixedI32(buf, pReq->ntbCfg.pSchema[i].bytes); tlen += taosEncodeString(buf, pReq->ntbCfg.pSchema[i].name); } - tlen += taosEncodeFixedI16(buf, pReq->ntbCfg.nBSmaCols); - for (col_id_t i = 0; i < pReq->ntbCfg.nBSmaCols; ++i) { - tlen += taosEncodeFixedI16(buf, pReq->ntbCfg.pBSmaCols[i]); - } if (pReq->rollup && pReq->ntbCfg.pRSmaParam) { SRSmaParam *param = pReq->ntbCfg.pRSmaParam; tlen += taosEncodeFixedU32(buf, (uint32_t)param->xFilesFactor); @@ -370,31 +366,24 @@ void *tDeserializeSVCreateTbReq(void *buf, SVCreateTbReq *pReq) { switch (pReq->type) { case TD_SUPER_TABLE: buf = taosDecodeFixedI64(buf, &(pReq->stbCfg.suid)); - buf = taosDecodeFixedU32(buf, &(pReq->stbCfg.nCols)); - pReq->stbCfg.pSchema = (SSchema *)taosMemoryMalloc(pReq->stbCfg.nCols * sizeof(SSchema)); - for (uint32_t i = 0; i < pReq->stbCfg.nCols; i++) { + buf = taosDecodeFixedI16(buf, &(pReq->stbCfg.nCols)); + buf = taosDecodeFixedI16(buf, &(pReq->stbCfg.nBSmaCols)); + pReq->stbCfg.pSchema = (SSchemaEx *)taosMemoryMalloc(pReq->stbCfg.nCols * sizeof(SSchemaEx)); + for (col_id_t i = 0; i < pReq->stbCfg.nCols; i++) { buf = taosDecodeFixedI8(buf, &(pReq->stbCfg.pSchema[i].type)); + buf = taosDecodeFixedI8(buf, &(pReq->stbCfg.pSchema[i].sma)); buf = taosDecodeFixedI16(buf, &(pReq->stbCfg.pSchema[i].colId)); buf = taosDecodeFixedI32(buf, &(pReq->stbCfg.pSchema[i].bytes)); buf = taosDecodeStringTo(buf, pReq->stbCfg.pSchema[i].name); } - buf = taosDecodeFixedU32(buf, &pReq->stbCfg.nTagCols); + buf = taosDecodeFixedI16(buf, &pReq->stbCfg.nTagCols); pReq->stbCfg.pTagSchema = (SSchema *)taosMemoryMalloc(pReq->stbCfg.nTagCols * sizeof(SSchema)); - for (uint32_t i = 0; i < pReq->stbCfg.nTagCols; i++) { + for (col_id_t i = 0; i < pReq->stbCfg.nTagCols; i++) { buf = taosDecodeFixedI8(buf, &(pReq->stbCfg.pTagSchema[i].type)); buf = taosDecodeFixedI16(buf, &pReq->stbCfg.pTagSchema[i].colId); buf = taosDecodeFixedI32(buf, &pReq->stbCfg.pTagSchema[i].bytes); buf = taosDecodeStringTo(buf, pReq->stbCfg.pTagSchema[i].name); } - buf = taosDecodeFixedI16(buf, &(pReq->stbCfg.nBSmaCols)); - if (pReq->stbCfg.nBSmaCols > 0) { - pReq->stbCfg.pBSmaCols = (col_id_t *)taosMemoryMalloc(pReq->stbCfg.nBSmaCols * sizeof(col_id_t)); - for (col_id_t i = 0; i < pReq->stbCfg.nBSmaCols; ++i) { - buf = taosDecodeFixedI16(buf, pReq->stbCfg.pBSmaCols + i); - } - } else { - pReq->stbCfg.pBSmaCols = NULL; - } if (pReq->rollup) { pReq->stbCfg.pRSmaParam = (SRSmaParam *)taosMemoryMalloc(sizeof(SRSmaParam)); SRSmaParam *param = pReq->stbCfg.pRSmaParam; @@ -418,23 +407,16 @@ void *tDeserializeSVCreateTbReq(void *buf, SVCreateTbReq *pReq) { buf = tdDecodeKVRow(buf, &pReq->ctbCfg.pTag); break; case TD_NORMAL_TABLE: - buf = taosDecodeFixedU32(buf, &pReq->ntbCfg.nCols); - pReq->ntbCfg.pSchema = (SSchema *)taosMemoryMalloc(pReq->ntbCfg.nCols * sizeof(SSchema)); - for (uint32_t i = 0; i < pReq->ntbCfg.nCols; i++) { + buf = taosDecodeFixedI16(buf, &pReq->ntbCfg.nCols); + buf = taosDecodeFixedI16(buf, &(pReq->ntbCfg.nBSmaCols)); + pReq->ntbCfg.pSchema = (SSchemaEx *)taosMemoryMalloc(pReq->ntbCfg.nCols * sizeof(SSchemaEx)); + for (col_id_t i = 0; i < pReq->ntbCfg.nCols; i++) { buf = taosDecodeFixedI8(buf, &pReq->ntbCfg.pSchema[i].type); + buf = taosDecodeFixedI8(buf, &pReq->ntbCfg.pSchema[i].sma); buf = taosDecodeFixedI16(buf, &pReq->ntbCfg.pSchema[i].colId); buf = taosDecodeFixedI32(buf, &pReq->ntbCfg.pSchema[i].bytes); buf = taosDecodeStringTo(buf, pReq->ntbCfg.pSchema[i].name); } - buf = taosDecodeFixedI16(buf, &(pReq->ntbCfg.nBSmaCols)); - if (pReq->ntbCfg.nBSmaCols > 0) { - pReq->ntbCfg.pBSmaCols = (col_id_t *)taosMemoryMalloc(pReq->ntbCfg.nBSmaCols * sizeof(col_id_t)); - for (col_id_t i = 0; i < pReq->ntbCfg.nBSmaCols; ++i) { - buf = taosDecodeFixedI16(buf, pReq->ntbCfg.pBSmaCols + i); - } - } else { - pReq->ntbCfg.pBSmaCols = NULL; - } if (pReq->rollup) { pReq->ntbCfg.pRSmaParam = (SRSmaParam *)taosMemoryMalloc(sizeof(SRSmaParam)); SRSmaParam *param = pReq->ntbCfg.pRSmaParam; diff --git a/source/common/src/ttypes.c b/source/common/src/ttypes.c index 0c1bafbeb8..ef75adeb5d 100644 --- a/source/common/src/ttypes.c +++ b/source/common/src/ttypes.c @@ -431,7 +431,7 @@ FORCE_INLINE void *getDataMax(int32_t type) { } } -bool isValidDataType(int32_t type) { return type >= TSDB_DATA_TYPE_NULL && type <= TSDB_DATA_TYPE_UBIGINT; } +bool isValidDataType(int32_t type) { return type >= TSDB_DATA_TYPE_NULL && type < TSDB_DATA_TYPE_MAX; } void setVardataNull(void *val, int32_t type) { if (type == TSDB_DATA_TYPE_BINARY) { diff --git a/source/dnode/mgmt/test/vnode/vnode.cpp b/source/dnode/mgmt/test/vnode/vnode.cpp index e2de3fc33a..39de533b73 100644 --- a/source/dnode/mgmt/test/vnode/vnode.cpp +++ b/source/dnode/mgmt/test/vnode/vnode.cpp @@ -164,37 +164,37 @@ TEST_F(DndTestVnode, 03_Create_Stb) { req.keep = 0; req.type = TD_SUPER_TABLE; - SSchema schemas[5] = {0}; + SSchemaEx schemas[2] = {0}; { - SSchema* pSchema = &schemas[0]; + SSchemaEx* pSchema = &schemas[0]; pSchema->bytes = htonl(8); pSchema->type = TSDB_DATA_TYPE_TIMESTAMP; strcpy(pSchema->name, "ts"); } { - SSchema* pSchema = &schemas[1]; + SSchemaEx* pSchema = &schemas[1]; pSchema->bytes = htonl(4); pSchema->type = TSDB_DATA_TYPE_INT; strcpy(pSchema->name, "col1"); } - + SSchema tagSchemas[3] = {0}; { - SSchema* pSchema = &schemas[2]; + SSchema* pSchema = &tagSchemas[0]; pSchema->bytes = htonl(2); pSchema->type = TSDB_DATA_TYPE_TINYINT; strcpy(pSchema->name, "tag1"); } { - SSchema* pSchema = &schemas[3]; + SSchema* pSchema = &tagSchemas[1]; pSchema->bytes = htonl(8); pSchema->type = TSDB_DATA_TYPE_BIGINT; strcpy(pSchema->name, "tag2"); } { - SSchema* pSchema = &schemas[4]; + SSchema* pSchema = &tagSchemas[2]; pSchema->bytes = htonl(16); pSchema->type = TSDB_DATA_TYPE_BINARY; strcpy(pSchema->name, "tag3"); @@ -204,7 +204,7 @@ TEST_F(DndTestVnode, 03_Create_Stb) { req.stbCfg.nCols = 2; req.stbCfg.pSchema = &schemas[0]; req.stbCfg.nTagCols = 3; - req.stbCfg.pTagSchema = &schemas[2]; + req.stbCfg.pTagSchema = &tagSchemas[0]; int32_t contLen = tSerializeSVCreateTbReq(NULL, &req) + sizeof(SMsgHead); SMsgHead* pHead = (SMsgHead*)rpcMallocCont(contLen); @@ -236,37 +236,37 @@ TEST_F(DndTestVnode, 04_Alter_Stb) { req.keep = 0; req.type = TD_SUPER_TABLE; - SSchema schemas[5] = {0}; + SSchemaEx schemas[2] = {0}; { - SSchema* pSchema = &schemas[0]; + SSchemaEx* pSchema = &schemas[0]; pSchema->bytes = htonl(8); pSchema->type = TSDB_DATA_TYPE_TIMESTAMP; strcpy(pSchema->name, "ts"); } { - SSchema* pSchema = &schemas[1]; + SSchemaEx* pSchema = &schemas[1]; pSchema->bytes = htonl(4); pSchema->type = TSDB_DATA_TYPE_INT; strcpy(pSchema->name, "col1"); } - + SSchema tagSchemas[3] = {0}; { - SSchema* pSchema = &schemas[2]; + SSchema* pSchema = &tagSchemas[0]; pSchema->bytes = htonl(2); pSchema->type = TSDB_DATA_TYPE_TINYINT; strcpy(pSchema->name, "_tag1"); } { - SSchema* pSchema = &schemas[3]; + SSchema* pSchema = &tagSchemas[1]; pSchema->bytes = htonl(8); pSchema->type = TSDB_DATA_TYPE_BIGINT; strcpy(pSchema->name, "_tag2"); } { - SSchema* pSchema = &schemas[4]; + SSchema* pSchema = &tagSchemas[2]; pSchema->bytes = htonl(16); pSchema->type = TSDB_DATA_TYPE_BINARY; strcpy(pSchema->name, "_tag3"); @@ -276,7 +276,7 @@ TEST_F(DndTestVnode, 04_Alter_Stb) { req.stbCfg.nCols = 2; req.stbCfg.pSchema = &schemas[0]; req.stbCfg.nTagCols = 3; - req.stbCfg.pTagSchema = &schemas[2]; + req.stbCfg.pTagSchema = &tagSchemas[0]; int32_t contLen = tSerializeSVCreateTbReq(NULL, &req) + sizeof(SMsgHead); SMsgHead* pHead = (SMsgHead*)rpcMallocCont(contLen); diff --git a/source/dnode/mnode/impl/src/mndStb.c b/source/dnode/mnode/impl/src/mndStb.c index 196767462e..b551b71724 100644 --- a/source/dnode/mnode/impl/src/mndStb.c +++ b/source/dnode/mnode/impl/src/mndStb.c @@ -333,6 +333,15 @@ static SDbObj *mndAcquireDbByStb(SMnode *pMnode, const char *stbName) { return mndAcquireDb(pMnode, db); } +static FORCE_INLINE int schemaExColIdCompare(const void *colId, const void *pSchema) { + if (*(col_id_t *)colId < ((SSchemaEx *)pSchema)->colId) { + return -1; + } else if (*(col_id_t *)colId > ((SSchemaEx *)pSchema)->colId) { + return 1; + } + return 0; +} + static void *mndBuildVCreateStbReq(SMnode *pMnode, SVgObj *pVgroup, SStbObj *pStb, int32_t *pContLen) { SName name = {0}; tNameFromString(&name, pStb->name, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE); @@ -348,13 +357,60 @@ static void *mndBuildVCreateStbReq(SMnode *pMnode, SVgObj *pVgroup, SStbObj *pSt req.type = TD_SUPER_TABLE; req.stbCfg.suid = pStb->uid; req.stbCfg.nCols = pStb->numOfColumns; - req.stbCfg.pSchema = pStb->pColumns; req.stbCfg.nTagCols = pStb->numOfTags; req.stbCfg.pTagSchema = pStb->pTags; + req.stbCfg.nBSmaCols = pStb->numOfSmas; + req.stbCfg.pSchema = (SSchemaEx *)taosMemoryCalloc(pStb->numOfColumns, sizeof(SSchemaEx)); + if (req.stbCfg.pSchema == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + return NULL; + } + + int bSmaStat = 0; // no column has bsma + if (pStb->numOfSmas == pStb->numOfColumns) { // assume pColumns > 0 + bSmaStat = 1; // all columns have bsma + TASSERT(pStb->pSmas == NULL); // TODO: remove the assert + } else if (pStb->numOfSmas != 0) { + bSmaStat = 2; // partial columns have bsma + TASSERT(pStb->pSmas != NULL); // TODO: remove the assert + } else { + TASSERT(pStb->pSmas == NULL); // TODO: remove the assert + } + for (int32_t i = 0; i < req.stbCfg.nCols; ++i) { + SSchemaEx *pSchemaEx = req.stbCfg.pSchema + i; + SSchema *pSchema = pStb->pColumns + i; + pSchemaEx->type = pSchema->type; + pSchemaEx->sma = (bSmaStat == 1) ? TSDB_BSMA_TYPE_LATEST : TSDB_BSMA_TYPE_NONE; + pSchemaEx->colId = pSchema->colId; + pSchemaEx->bytes = pSchema->bytes; + memcpy(pSchemaEx->name, pSchema->name, TSDB_COL_NAME_LEN); + } - int32_t contLen = tSerializeSVCreateTbReq(NULL, &req) + sizeof(SMsgHead); + if (bSmaStat == 2) { + if (pStb->pSmas == NULL) { + mError("stb:%s, sma options is empty", pStb->name); + taosMemoryFreeClear(req.stbCfg.pSchema); + terrno = TSDB_CODE_MND_INVALID_STB_OPTION; + return NULL; + } + for (int32_t i = 0; i < pStb->numOfSmas; ++i) { + SSchema *pSmaSchema = pStb->pSmas + i; + SSchemaEx *pColSchema = taosbsearch(&pSmaSchema->colId, req.stbCfg.pSchema, req.stbCfg.nCols, sizeof(SSchemaEx), + schemaExColIdCompare, TD_EQ); + if (pColSchema == NULL) { + terrno = TSDB_CODE_MND_INVALID_STB_OPTION; + taosMemoryFreeClear(req.stbCfg.pSchema); + mError("stb:%s, sma col:%s not found in columns", pStb->name, pSmaSchema->name); + return NULL; + } + pColSchema->sma = TSDB_BSMA_TYPE_LATEST; + } + } + + int32_t contLen = tSerializeSVCreateTbReq(NULL, &req) + sizeof(SMsgHead); SMsgHead *pHead = taosMemoryMalloc(contLen); if (pHead == NULL) { + taosMemoryFreeClear(req.stbCfg.pSchema); terrno = TSDB_CODE_OUT_OF_MEMORY; return NULL; } @@ -366,6 +422,7 @@ static void *mndBuildVCreateStbReq(SMnode *pMnode, SVgObj *pVgroup, SStbObj *pSt tSerializeSVCreateTbReq(&pBuf, &req); *pContLen = contLen; + taosMemoryFreeClear(req.stbCfg.pSchema); return pHead; } @@ -498,7 +555,6 @@ static int32_t mndSetCreateStbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj if (pReq == NULL) { sdbCancelFetch(pSdb, pIter); sdbRelease(pSdb, pVgroup); - terrno = TSDB_CODE_OUT_OF_MEMORY; return -1; } @@ -559,9 +615,9 @@ static int32_t mndSetCreateStbUndoActions(SMnode *pMnode, STrans *pTrans, SDbObj } static SSchema *mndFindStbColumns(const SStbObj *pStb, const char *colName) { - for (int32_t col = 0; col < pStb->numOfColumns; col++) { + for (int32_t col = 0; col < pStb->numOfColumns; ++col) { SSchema *pSchema = &pStb->pColumns[col]; - if (strcasecmp(pStb->pColumns[col].name, colName) == 0) { + if (strncasecmp(pSchema->name, colName, TSDB_COL_NAME_LEN) == 0) { return pSchema; } } @@ -625,7 +681,7 @@ static int32_t mndCreateStb(SMnode *pMnode, SNodeMsg *pReq, SMCreateStbReq *pCre SSchema *pSchema = &stbObj.pSmas[i]; SSchema *pColSchema = mndFindStbColumns(&stbObj, pField->name); if (pColSchema == NULL) { - mError("stb:%s, sma:%s not found in columns", stbObj.name, pSchema->name); + mError("stb:%s, sma:%s not found in columns", stbObj.name, pField->name); terrno = TSDB_CODE_MND_INVALID_STB_OPTION; return -1; } @@ -1061,7 +1117,6 @@ static int32_t mndSetAlterStbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj if (pReq == NULL) { sdbCancelFetch(pSdb, pIter); sdbRelease(pSdb, pVgroup); - terrno = TSDB_CODE_OUT_OF_MEMORY; return -1; } diff --git a/source/dnode/vnode/src/meta/metaBDBImpl.c b/source/dnode/vnode/src/meta/metaBDBImpl.c index b91c6cd9e3..9485c291ae 100644 --- a/source/dnode/vnode/src/meta/metaBDBImpl.c +++ b/source/dnode/vnode/src/meta/metaBDBImpl.c @@ -70,9 +70,12 @@ static void *metaDecodeTbInfo(void *buf, STbCfg *pTbCfg); static void metaClearTbCfg(STbCfg *pTbCfg); static int metaEncodeSchema(void **buf, SSchemaWrapper *pSW); static void *metaDecodeSchema(void *buf, SSchemaWrapper *pSW); +static int metaEncodeSchemaEx(void **buf, SSchemaWrapper *pSW); +static void *metaDecodeSchemaEx(void *buf, SSchemaWrapper *pSW, bool isGetEx); static void metaDBWLock(SMetaDB *pDB); static void metaDBRLock(SMetaDB *pDB); static void metaDBULock(SMetaDB *pDB); +static SSchemaWrapper *metaGetTableSchemaImpl(SMeta *pMeta, tb_uid_t uid, int32_t sver, bool isinline, bool isGetEx); #define BDB_PERR(info, code) fprintf(stderr, info " reason: %s", db_strerror(code)) @@ -155,13 +158,13 @@ void metaCloseDB(SMeta *pMeta) { } int metaSaveTableToDB(SMeta *pMeta, STbCfg *pTbCfg) { - tb_uid_t uid; - char buf[512]; - char buf1[512]; - void *pBuf; - DBT key1, value1; - DBT key2, value2; - SSchema *pSchema = NULL; + tb_uid_t uid; + char buf[512]; + char buf1[512]; + void *pBuf; + DBT key1, value1; + DBT key2, value2; + SSchemaEx *pSchema = NULL; if (pTbCfg->type == META_SUPER_TABLE) { uid = pTbCfg->stbCfg.suid; @@ -204,8 +207,8 @@ int metaSaveTableToDB(SMeta *pMeta, STbCfg *pTbCfg) { key2.data = &schemaKey; key2.size = sizeof(schemaKey); - SSchemaWrapper sw = {.nCols = ncols, .pSchema = pSchema}; - metaEncodeSchema(&pBuf, &sw); + SSchemaWrapper sw = {.nCols = ncols, .pSchemaEx = pSchema}; + metaEncodeSchemaEx(&pBuf, &sw); value2.data = buf1; value2.size = POINTER_DISTANCE(pBuf, buf1); @@ -298,6 +301,8 @@ static void *metaDecodeSchema(void *buf, SSchemaWrapper *pSW) { buf = taosDecodeFixedU32(buf, &pSW->nCols); pSW->pSchema = (SSchema *)taosMemoryMalloc(sizeof(SSchema) * pSW->nCols); + + int8_t dummy; for (int i = 0; i < pSW->nCols; i++) { pSchema = pSW->pSchema + i; buf = taosDecodeFixedI8(buf, &pSchema->type); @@ -309,6 +314,50 @@ static void *metaDecodeSchema(void *buf, SSchemaWrapper *pSW) { return buf; } +static int metaEncodeSchemaEx(void **buf, SSchemaWrapper *pSW) { + int tlen = 0; + SSchemaEx *pSchema; + + tlen += taosEncodeFixedU32(buf, pSW->nCols); + for (int i = 0; i < pSW->nCols; i++) { + pSchema = pSW->pSchemaEx + i; + tlen += taosEncodeFixedI8(buf, pSchema->type); + tlen += taosEncodeFixedI8(buf, pSchema->sma); + tlen += taosEncodeFixedI16(buf, pSchema->colId); + tlen += taosEncodeFixedI32(buf, pSchema->bytes); + tlen += taosEncodeString(buf, pSchema->name); + } + + return tlen; +} + +static void *metaDecodeSchemaEx(void *buf, SSchemaWrapper *pSW, bool isGetEx) { + buf = taosDecodeFixedU32(buf, &pSW->nCols); + if (isGetEx) { + pSW->pSchemaEx = (SSchemaEx *)taosMemoryMalloc(sizeof(SSchemaEx) * pSW->nCols); + for (int i = 0; i < pSW->nCols; i++) { + SSchemaEx *pSchema = pSW->pSchemaEx + i; + buf = taosDecodeFixedI8(buf, &pSchema->type); + buf = taosDecodeFixedI8(buf, &pSchema->sma); + buf = taosDecodeFixedI16(buf, &pSchema->colId); + buf = taosDecodeFixedI32(buf, &pSchema->bytes); + buf = taosDecodeStringTo(buf, pSchema->name); + } + } else { + pSW->pSchema = (SSchema *)taosMemoryMalloc(sizeof(SSchema) * pSW->nCols); + for (int i = 0; i < pSW->nCols; i++) { + SSchema *pSchema = pSW->pSchema + i; + buf = taosDecodeFixedI8(buf, &pSchema->type); + buf = taosSkipFixedLen(buf, sizeof(int8_t)); + buf = taosDecodeFixedI16(buf, &pSchema->colId); + buf = taosDecodeFixedI32(buf, &pSchema->bytes); + buf = taosDecodeStringTo(buf, pSchema->name); + } + } + + return buf; +} + static SMetaDB *metaNewDB() { SMetaDB *pDB = NULL; pDB = (SMetaDB *)taosMemoryCalloc(1, sizeof(*pDB)); @@ -652,12 +701,16 @@ STSma *metaGetSmaInfoByIndex(SMeta *pMeta, int64_t indexUid) { } SSchemaWrapper *metaGetTableSchema(SMeta *pMeta, tb_uid_t uid, int32_t sver, bool isinline) { + return metaGetTableSchemaImpl(pMeta, uid, sver, isinline, false); +} + +static SSchemaWrapper *metaGetTableSchemaImpl(SMeta *pMeta, tb_uid_t uid, int32_t sver, bool isinline, bool isGetEx) { uint32_t nCols; SSchemaWrapper *pSW = NULL; SMetaDB *pDB = pMeta->pDB; int ret; void *pBuf; - SSchema *pSchema; + // SSchema *pSchema; SSchemaKey schemaKey = {uid, sver, 0}; DBT key = {0}; DBT value = {0}; @@ -678,7 +731,7 @@ SSchemaWrapper *metaGetTableSchema(SMeta *pMeta, tb_uid_t uid, int32_t sver, boo // Decode the schema pBuf = value.data; pSW = taosMemoryMalloc(sizeof(*pSW)); - metaDecodeSchema(pBuf, pSW); + metaDecodeSchemaEx(pBuf, pSW, isGetEx); return pSW; } @@ -755,7 +808,7 @@ char *metaTbCursorNext(SMTbCursor *pTbCur) { STSchema *metaGetTbTSchema(SMeta *pMeta, tb_uid_t uid, int32_t sver) { STSchemaBuilder sb; STSchema *pTSchema = NULL; - SSchema *pSchema; + SSchemaEx *pSchema; SSchemaWrapper *pSW; STbCfg *pTbCfg; tb_uid_t quid; @@ -767,16 +820,16 @@ STSchema *metaGetTbTSchema(SMeta *pMeta, tb_uid_t uid, int32_t sver) { quid = uid; } - pSW = metaGetTableSchema(pMeta, quid, sver, true); + pSW = metaGetTableSchemaImpl(pMeta, quid, sver, true, true); if (pSW == NULL) { return NULL; } // Rebuild a schema tdInitTSchemaBuilder(&sb, 0); - for (int32_t i = 0; i < pSW->nCols; i++) { - pSchema = pSW->pSchema + i; - tdAddColToSchema(&sb, pSchema->type, pSchema->colId, pSchema->bytes); + for (int32_t i = 0; i < pSW->nCols; ++i) { + pSchema = pSW->pSchemaEx + i; + tdAddColToSchema(&sb, pSchema->type, pSchema->sma, pSchema->colId, pSchema->bytes); } pTSchema = tdGetSchemaFromBuilder(&sb); tdDestroyTSchemaBuilder(&sb); diff --git a/source/dnode/vnode/src/meta/metaTDBImpl.c b/source/dnode/vnode/src/meta/metaTDBImpl.c index ee928ef039..8e82cf1abc 100644 --- a/source/dnode/vnode/src/meta/metaTDBImpl.c +++ b/source/dnode/vnode/src/meta/metaTDBImpl.c @@ -46,6 +46,10 @@ static int metaEncodeTbInfo(void **buf, STbCfg *pTbCfg); static void *metaDecodeTbInfo(void *buf, STbCfg *pTbCfg); static int metaEncodeSchema(void **buf, SSchemaWrapper *pSW); static void *metaDecodeSchema(void *buf, SSchemaWrapper *pSW); +static int metaEncodeSchemaEx(void **buf, SSchemaWrapper *pSW); +static void *metaDecodeSchemaEx(void *buf, SSchemaWrapper *pSW, bool isGetEx); + +static SSchemaWrapper *metaGetTableSchemaImpl(SMeta *pMeta, tb_uid_t uid, int32_t sver, bool isinline, bool isGetEx); static inline int metaUidCmpr(const void *arg1, int len1, const void *arg2, int len2) { tb_uid_t uid1, uid2; @@ -228,7 +232,7 @@ int metaSaveTableToDB(SMeta *pMeta, STbCfg *pTbCfg) { schemaWrapper.pSchema = pTbCfg->ntbCfg.pSchema; } pVal = pBuf = buf; - metaEncodeSchema(&pBuf, &schemaWrapper); + metaEncodeSchemaEx(&pBuf, &schemaWrapper); vLen = POINTER_DISTANCE(pBuf, buf); ret = tdbDbInsert(pMetaDb->pSchemaDB, pKey, kLen, pVal, vLen); if (ret < 0) { @@ -345,6 +349,10 @@ STbCfg *metaGetTbInfoByName(SMeta *pMeta, char *tbname, tb_uid_t *uid) { } SSchemaWrapper *metaGetTableSchema(SMeta *pMeta, tb_uid_t uid, int32_t sver, bool isinline) { + return *metaGetTableSchemaImpl(pMeta, uid, sver, isinline, false); +} + +static SSchemaWrapper *metaGetTableSchemaImpl(SMeta *pMeta, tb_uid_t uid, int32_t sver, bool isinline, bool isGetEx) { void *pKey; void *pVal; int kLen; @@ -368,7 +376,7 @@ SSchemaWrapper *metaGetTableSchema(SMeta *pMeta, tb_uid_t uid, int32_t sver, boo // decode pBuf = pVal; pSchemaWrapper = taosMemoryMalloc(sizeof(*pSchemaWrapper)); - metaDecodeSchema(pBuf, pSchemaWrapper); + metaDecodeSchemaEx(pBuf, pSchemaWrapper, isGetEx); TDB_FREE(pVal); @@ -379,7 +387,7 @@ STSchema *metaGetTbTSchema(SMeta *pMeta, tb_uid_t uid, int32_t sver) { tb_uid_t quid; SSchemaWrapper *pSW; STSchemaBuilder sb; - SSchema *pSchema; + SSchemaEx *pSchema; STSchema *pTSchema; STbCfg *pTbCfg; @@ -390,15 +398,15 @@ STSchema *metaGetTbTSchema(SMeta *pMeta, tb_uid_t uid, int32_t sver) { quid = uid; } - pSW = metaGetTableSchema(pMeta, quid, sver, true); + pSW = metaGetTableSchemaImpl(pMeta, quid, sver, true, true); if (pSW == NULL) { return NULL; } tdInitTSchemaBuilder(&sb, 0); for (int i = 0; i < pSW->nCols; i++) { - pSchema = pSW->pSchema + i; - tdAddColToSchema(&sb, pSchema->type, pSchema->colId, pSchema->bytes); + pSchema = pSW->pSchemaEx + i; + tdAddColToSchema(&sb, pSchema->type, pSchema->sma, pSchema->colId, pSchema->bytes); } pTSchema = tdGetSchemaFromBuilder(&sb); tdDestroyTSchemaBuilder(&sb); @@ -605,6 +613,50 @@ static void *metaDecodeSchema(void *buf, SSchemaWrapper *pSW) { return buf; } +static int metaEncodeSchemaEx(void **buf, SSchemaWrapper *pSW) { + int tlen = 0; + SSchemaEx *pSchema; + + tlen += taosEncodeFixedU32(buf, pSW->nCols); + for (int i = 0; i < pSW->nCols; ++i) { + pSchema = pSW->pSchemaEx + i; + tlen += taosEncodeFixedI8(buf, pSchema->type); + tlen += taosEncodeFixedI8(buf, pSchema->sma); + tlen += taosEncodeFixedI16(buf, pSchema->colId); + tlen += taosEncodeFixedI32(buf, pSchema->bytes); + tlen += taosEncodeString(buf, pSchema->name); + } + + return tlen; +} + +static void *metaDecodeSchemaEx(void *buf, SSchemaWrapper *pSW, bool isGetEx) { + buf = taosDecodeFixedU32(buf, &pSW->nCols); + if (isGetEx) { + pSW->pSchemaEx = (SSchemaEx *)taosMemoryMalloc(sizeof(SSchemaEx) * pSW->nCols); + for (int i = 0; i < pSW->nCols; i++) { + SSchemaEx *pSchema = pSW->pSchemaEx + i; + buf = taosDecodeFixedI8(buf, &pSchema->type); + buf = taosDecodeFixedI8(buf, &pSchema->sma); + buf = taosDecodeFixedI16(buf, &pSchema->colId); + buf = taosDecodeFixedI32(buf, &pSchema->bytes); + buf = taosDecodeStringTo(buf, pSchema->name); + } + } else { + pSW->pSchema = (SSchema *)taosMemoryMalloc(sizeof(SSchema) * pSW->nCols); + for (int i = 0; i < pSW->nCols; i++) { + SSchema *pSchema = pSW->pSchema + i; + buf = taosDecodeFixedI8(buf, &pSchema->type); + buf = taosSkipFixedLen(buf, sizeof(int8_t)); + buf = taosDecodeFixedI16(buf, &pSchema->colId); + buf = taosDecodeFixedI32(buf, &pSchema->bytes); + buf = taosDecodeStringTo(buf, pSchema->name); + } + } + + return buf; +} + static int metaEncodeTbInfo(void **buf, STbCfg *pTbCfg) { int tsize = 0; diff --git a/source/dnode/vnode/src/vnd/vnodeWrite.c b/source/dnode/vnode/src/vnd/vnodeWrite.c index 38eed46c9d..59b027e370 100644 --- a/source/dnode/vnode/src/vnd/vnodeWrite.c +++ b/source/dnode/vnode/src/vnd/vnodeWrite.c @@ -81,7 +81,6 @@ int vnodeApplyWMsg(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) { // TODO: maybe need to clear the request struct taosMemoryFree(vCreateTbReq.stbCfg.pSchema); taosMemoryFree(vCreateTbReq.stbCfg.pTagSchema); - taosMemoryFree(vCreateTbReq.stbCfg.pBSmaCols); taosMemoryFree(vCreateTbReq.stbCfg.pRSmaParam); taosMemoryFree(vCreateTbReq.dbFName); taosMemoryFree(vCreateTbReq.name); @@ -116,13 +115,11 @@ int vnodeApplyWMsg(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) { if (pCreateTbReq->type == TD_SUPER_TABLE) { taosMemoryFree(pCreateTbReq->stbCfg.pSchema); taosMemoryFree(pCreateTbReq->stbCfg.pTagSchema); - taosMemoryFree(pCreateTbReq->stbCfg.pBSmaCols); taosMemoryFree(pCreateTbReq->stbCfg.pRSmaParam); } else if (pCreateTbReq->type == TD_CHILD_TABLE) { taosMemoryFree(pCreateTbReq->ctbCfg.pTag); } else { taosMemoryFree(pCreateTbReq->ntbCfg.pSchema); - taosMemoryFree(pCreateTbReq->ntbCfg.pBSmaCols); taosMemoryFree(pCreateTbReq->ntbCfg.pRSmaParam); } } @@ -150,7 +147,6 @@ int vnodeApplyWMsg(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) { tDeserializeSVCreateTbReq(POINTER_SHIFT(pMsg->pCont, sizeof(SMsgHead)), &vAlterTbReq); taosMemoryFree(vAlterTbReq.stbCfg.pSchema); taosMemoryFree(vAlterTbReq.stbCfg.pTagSchema); - taosMemoryFree(vAlterTbReq.stbCfg.pBSmaCols); taosMemoryFree(vAlterTbReq.stbCfg.pRSmaParam); taosMemoryFree(vAlterTbReq.dbFName); taosMemoryFree(vAlterTbReq.name); diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index f8bd51ded6..b13fd1c2cd 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -2169,10 +2169,11 @@ typedef struct SVgroupTablesBatch { char dbName[TSDB_DB_NAME_LEN]; } SVgroupTablesBatch; -static void toSchema(const SColumnDefNode* pCol, col_id_t colId, SSchema* pSchema) { +static void toSchema(const SColumnDefNode* pCol, col_id_t colId, SSchemaEx* pSchema) { pSchema->colId = colId; pSchema->type = pCol->dataType.type; pSchema->bytes = calcTypeBytes(pCol->dataType); + pSchema->sma = TSDB_BSMA_TYPE_LATEST; // TODO: use default value currently, and use the real value later. strcpy(pSchema->name, pCol->colName); } @@ -2194,7 +2195,7 @@ static int32_t buildNormalTableBatchReq(int32_t acctId, const char* pDbName, con req.dbFName = strdup(dbFName); req.name = strdup(pTableName); req.ntbCfg.nCols = LIST_LENGTH(pColumns); - req.ntbCfg.pSchema = taosMemoryCalloc(req.ntbCfg.nCols, sizeof(SSchema)); + req.ntbCfg.pSchema = taosMemoryCalloc(req.ntbCfg.nCols, sizeof(SSchemaEx)); if (NULL == req.name || NULL == req.ntbCfg.pSchema) { destroyCreateTbReq(&req); return TSDB_CODE_OUT_OF_MEMORY; @@ -2205,6 +2206,7 @@ static int32_t buildNormalTableBatchReq(int32_t acctId, const char* pDbName, con toSchema((SColumnDefNode*)pCol, index + 1, req.ntbCfg.pSchema + index); ++index; } + // TODO: use the real sma for normal table. pBatch->info = *pVgroupInfo; strcpy(pBatch->dbName, pDbName); From 52e393a42db1c1692ae0fa1d4aea4f1cf2d03fba Mon Sep 17 00:00:00 2001 From: plum-lihui Date: Fri, 1 Apr 2022 17:46:02 +0800 Subject: [PATCH 41/68] [add cases] --- tests/script/jenkins/basic.txt | 2 +- tests/script/tsim/parser/groupby-basic.sim | 120 ++++++++++++--------- 2 files changed, 71 insertions(+), 51 deletions(-) diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index 811c9941f7..4849ba0871 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -23,7 +23,7 @@ ./test.sh -f tsim/insert/null.sim # ---- parser -#./test.sh -f tsim/parser/groupby-basic.sim +./test.sh -f tsim/parser/groupby-basic.sim #./test.sh -f tsim/parser/fourArithmetic-basic.sim # ---- query diff --git a/tests/script/tsim/parser/groupby-basic.sim b/tests/script/tsim/parser/groupby-basic.sim index 601888f3c2..e26f849b13 100644 --- a/tests/script/tsim/parser/groupby-basic.sim +++ b/tests/script/tsim/parser/groupby-basic.sim @@ -45,7 +45,7 @@ $tstart = 1640966400000 # 2022-01-01 00:00:00.000 print ==== create db, stable, ctables, insert data sql drop database if exists $db -x step1 step1: -sql create database if not exists $db keep 3650 +sql create database if not exists $db sql use $db sql create table $mt (ts timestamp, c1 int, c2 float, c3 bigint, c4 smallint, c5 tinyint, c6 double, c7 bool, c8 binary(10), c9 nchar(9)) TAGS(t1 int, t2 binary(12)) @@ -131,6 +131,7 @@ if $data91 != 9 then return -1 endi +print ==== select first(ts),c1 from group_tb0 group by c1; sql select first(ts),c1 from group_tb0 group by c1; print rows: $rows print $data00 $data01 $data02 $data03 @@ -155,55 +156,74 @@ if $data91 != 9 then return -1 endi -print ============> filter not supported yet. -#sql select sum(c1), c1, avg(c1), min(c1), max(c2) from group_tb0 where c1 < 20 group by c1; -#if $row != 20 then -# return -1 -#endi -# -#if $data00 != 0 then -# return -1 -#endi -# -#if $data01 != 0 then -# return -1 -#endi -# -#print $data02 -#if $data02 != 0.000000000 then -# return -1 -#endi -# -#if $data03 != 0 then -# return -1 -#endi -# -#print $data04 -#if $data04 != 0.00000 then -# return -1 -#endi -# -#if $data10 != 100 then -# return -1 -#endi -# -#if $data11 != 1 then -# return -1 -#endi -# -#print $data12 -#if $data12 != 1.000000000 then -# return -1 -#endi -# -#if $data13 != 1 then -# return -1 -#endi -# -#if $data14 != 1.00000 then -# print expect 1.00000, actual:$data14 -# return -1 -#endi +print ==== select first(ts),c1 from interval(5m) group_tb0 group by c1; +sql select first(ts),c1 from group_tb0 group by c1; +print rows: $rows +print $data00 $data01 $data02 $data03 +print $data10 $data11 $data12 $data13 +print $data20 $data21 $data22 $data23 +print $data80 $data81 $data82 $data83 +print $data90 $data91 $data92 $data93 + +return + + + + + + + + + + +sql select sum(c1), c1, avg(c1), min(c1), max(c2) from group_tb0 where c1 < 20 group by c1; +if $row != 20 then + return -1 +endi + +if $data00 != 0 then + return -1 +endi + +if $data01 != 0 then + return -1 +endi + +print $data02 +if $data02 != 0.000000000 then + return -1 +endi + +if $data03 != 0 then + return -1 +endi + +print $data04 +if $data04 != 0.00000 then + return -1 +endi + +if $data10 != 100 then + return -1 +endi + +if $data11 != 1 then + return -1 +endi + +print $data12 +if $data12 != 1.000000000 then + return -1 +endi + +if $data13 != 1 then + return -1 +endi + +if $data14 != 1.00000 then + print expect 1.00000, actual:$data14 + return -1 +endi sql_error select sum(c1), ts, c1 from group_tb0 where c1<20 group by c1; sql_error select first(ts), ts, c2 from group_tb0 where c1 < 20 group by c1; From e1660a127658880ce6ca5687766cfac979b8c4a8 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 1 Apr 2022 17:56:57 +0800 Subject: [PATCH 42/68] shm --- source/dnode/mgmt/main/exe/dndMain.c | 5 +++-- source/dnode/mgmt/main/src/dndExec.c | 10 ++++++++-- source/dnode/mgmt/main/src/dndInt.c | 9 --------- source/os/src/osSignal.c | 2 +- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/source/dnode/mgmt/main/exe/dndMain.c b/source/dnode/mgmt/main/exe/dndMain.c index 0d2ddbfbbc..c6a109d62a 100644 --- a/source/dnode/mgmt/main/exe/dndMain.c +++ b/source/dnode/mgmt/main/exe/dndMain.c @@ -30,7 +30,6 @@ static struct { } global = {0}; static void dndStopDnode(int signum, void *info, void *ctx) { - dInfo("system signal:%d received", signum); SDnode *pDnode = atomic_val_compare_exchange_ptr(&global.pDnode, 0, global.pDnode); if (pDnode != NULL) { dndHandleEvent(pDnode, DND_EVENT_STOP); @@ -41,8 +40,10 @@ static void dndSetSignalHandle() { taosSetSignal(SIGTERM, dndStopDnode); taosSetSignal(SIGHUP, dndStopDnode); taosSetSignal(SIGINT, dndStopDnode); + taosSetSignal(SIGTSTP, dndStopDnode); taosSetSignal(SIGABRT, dndStopDnode); taosSetSignal(SIGBREAK, dndStopDnode); + taosSetSignal(SIGQUIT, dndStopDnode); if (!tsMultiProcess) { } else if (global.ntype == DNODE || global.ntype == NODE_MAX) { @@ -72,7 +73,7 @@ static int32_t dndParseArgs(int32_t argc, char const *argv[]) { } else if (strcmp(argv[i], "-n") == 0) { global.ntype = atoi(argv[++i]); if (global.ntype <= DNODE || global.ntype > NODE_MAX) { - printf("'-n' range is [1-5], default is 0\n"); + printf("'-n' range is [1 - %d], default is 0\n", NODE_MAX - 1); return -1; } } else if (strcmp(argv[i], "-k") == 0) { diff --git a/source/dnode/mgmt/main/src/dndExec.c b/source/dnode/mgmt/main/src/dndExec.c index 0cc429c0d9..281bc752ca 100644 --- a/source/dnode/mgmt/main/src/dndExec.c +++ b/source/dnode/mgmt/main/src/dndExec.c @@ -180,6 +180,7 @@ static int32_t dndRunInSingleProcess(SDnode *pDnode) { while (1) { if (pDnode->event == DND_EVENT_STOP) { dInfo("dnode is about to stop"); + dndSetStatus(pDnode, DND_STAT_STOPPED); break; } taosMsleep(100); @@ -255,14 +256,16 @@ static int32_t dndRunInParentProcess(SDnode *pDnode) { while (1) { if (pDnode->event == DND_EVENT_STOP) { dInfo("dnode is about to stop"); + dndSetStatus(pDnode, DND_STAT_STOPPED); + for (ENodeType n = DNODE + 1; n < NODE_MAX; ++n) { SMgmtWrapper *pWrapper = &pDnode->wrappers[n]; if (!pWrapper->required) continue; if (pDnode->ntype == NODE_MAX) continue; if (pWrapper->procId > 0 && taosProcExist(pWrapper->procId)) { - // dInfo("node:%s, send kill signal to the child process:%d", pWrapper->name, pWrapper->procId); - // taosKillProc(pWrapper->procId); + dInfo("node:%s, send kill signal to the child process:%d", pWrapper->name, pWrapper->procId); + taosKillProc(pWrapper->procId); dInfo("node:%s, wait for child process:%d to stop", pWrapper->name, pWrapper->procId); taosWaitProc(pWrapper->procId); dInfo("node:%s, child process:%d is stopped", pWrapper->name, pWrapper->procId); @@ -332,10 +335,13 @@ static int32_t dndRunInChildProcess(SDnode *pDnode) { while (1) { if (pDnode->event == DND_EVENT_STOP) { dInfo("%s is about to stop", pWrapper->name); + dndSetStatus(pDnode, DND_STAT_STOPPED); break; } taosMsleep(100); } + + return 0; } int32_t dndRun(SDnode *pDnode) { diff --git a/source/dnode/mgmt/main/src/dndInt.c b/source/dnode/mgmt/main/src/dndInt.c index 602ebc6b3c..6f6e21b983 100644 --- a/source/dnode/mgmt/main/src/dndInt.c +++ b/source/dnode/mgmt/main/src/dndInt.c @@ -133,14 +133,6 @@ _OVER: void dndClose(SDnode *pDnode) { if (pDnode == NULL) return; - if (dndGetStatus(pDnode) == DND_STAT_STOPPED) { - dError("dnode is shutting down, data:%p", pDnode); - return; - } - - dInfo("start to close dnode, data:%p", pDnode); - dndSetStatus(pDnode, DND_STAT_STOPPED); - for (ENodeType n = 0; n < NODE_MAX; ++n) { SMgmtWrapper *pWrapper = &pDnode->wrappers[n]; dndCloseNode(pWrapper); @@ -151,7 +143,6 @@ void dndClose(SDnode *pDnode) { } void dndHandleEvent(SDnode *pDnode, EDndEvent event) { - dInfo("dnode receive %s event, data:%p", dndEventStr(event), pDnode); if (event == DND_EVENT_STOP) { pDnode->event = event; } diff --git a/source/os/src/osSignal.c b/source/os/src/osSignal.c index d4e6cb3318..1d7fa517e5 100644 --- a/source/os/src/osSignal.c +++ b/source/os/src/osSignal.c @@ -59,7 +59,7 @@ void taosSetSignal(int32_t signum, FSignalHandler sigfp) { struct sigaction act; memset(&act, 0, sizeof(act)); #if 1 - act.sa_flags = SA_SIGINFO; + act.sa_flags = SA_SIGINFO | SA_RESTART; act.sa_sigaction = (FLinuxSignalHandler)sigfp; #else act.sa_handler = sigfp; From ad682364811b0b7ca432a3a282954ba077706aed Mon Sep 17 00:00:00 2001 From: Cary Xu Date: Fri, 1 Apr 2022 17:58:09 +0800 Subject: [PATCH 43/68] remove the assert to pass CI --- source/dnode/mnode/impl/src/mndStb.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndStb.c b/source/dnode/mnode/impl/src/mndStb.c index b551b71724..f3fda102f4 100644 --- a/source/dnode/mnode/impl/src/mndStb.c +++ b/source/dnode/mnode/impl/src/mndStb.c @@ -369,13 +369,11 @@ static void *mndBuildVCreateStbReq(SMnode *pMnode, SVgObj *pVgroup, SStbObj *pSt int bSmaStat = 0; // no column has bsma if (pStb->numOfSmas == pStb->numOfColumns) { // assume pColumns > 0 bSmaStat = 1; // all columns have bsma - TASSERT(pStb->pSmas == NULL); // TODO: remove the assert } else if (pStb->numOfSmas != 0) { bSmaStat = 2; // partial columns have bsma TASSERT(pStb->pSmas != NULL); // TODO: remove the assert - } else { - TASSERT(pStb->pSmas == NULL); // TODO: remove the assert } + for (int32_t i = 0; i < req.stbCfg.nCols; ++i) { SSchemaEx *pSchemaEx = req.stbCfg.pSchema + i; SSchema *pSchema = pStb->pColumns + i; From 8fe14087299c6db780974b9e0146cafb90150029 Mon Sep 17 00:00:00 2001 From: plum-lihui Date: Fri, 1 Apr 2022 18:02:45 +0800 Subject: [PATCH 44/68] [TD-14426 FIXED] --- tests/script/tsim/query/scalarFunction.sim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/script/tsim/query/scalarFunction.sim b/tests/script/tsim/query/scalarFunction.sim index 6a2a602703..9e6d378bd0 100644 --- a/tests/script/tsim/query/scalarFunction.sim +++ b/tests/script/tsim/query/scalarFunction.sim @@ -202,7 +202,7 @@ if $rows != $rowNum then endi print ====> sin -#sql select c1, sin(c1), sin(c1) * 3.14159265 / 180 from ct1 # TD-14426 +sql select c1, sin(c1), sin(c1) * 3.14159265 / 180 from ct1 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 From 94759bb1dbfbc208d73ca576a3adf175d1d951af Mon Sep 17 00:00:00 2001 From: plum-lihui Date: Fri, 1 Apr 2022 18:07:42 +0800 Subject: [PATCH 45/68] [add cases] --- tests/script/jenkins/basic.txt | 2 +- .../tsim/parser/fourArithmetic-basic.sim | 31 +++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index 4849ba0871..9cf2e9318b 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -24,7 +24,7 @@ # ---- parser ./test.sh -f tsim/parser/groupby-basic.sim -#./test.sh -f tsim/parser/fourArithmetic-basic.sim +./test.sh -f tsim/parser/fourArithmetic-basic.sim # ---- query ./test.sh -f tsim/query/interval.sim diff --git a/tests/script/tsim/parser/fourArithmetic-basic.sim b/tests/script/tsim/parser/fourArithmetic-basic.sim index 2ade01522e..bb35df5a90 100644 --- a/tests/script/tsim/parser/fourArithmetic-basic.sim +++ b/tests/script/tsim/parser/fourArithmetic-basic.sim @@ -78,6 +78,10 @@ while $i < $tbNum $tstart = 1640966400000 endw + +$loop_test = 0 +loop_test_pos: + sql select ts, c2-c1, c3/c1, c4+c1, c1*9, c1%3 from ct0 print ===> rows: $rows print ===> $data00 $data01 $data02 $data03 $data04 $data05 @@ -107,4 +111,31 @@ endi if $data93 != 8.000000000 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 From 9ebdee326f2d53c76056ae1d4a5bcc474646ba12 Mon Sep 17 00:00:00 2001 From: Liu Jicong Date: Fri, 1 Apr 2022 18:13:46 +0800 Subject: [PATCH 46/68] fix txn --- source/client/src/tmq.c | 29 ++++++++++++++-------- source/dnode/mnode/impl/src/mndConsumer.c | 1 + source/dnode/mnode/impl/src/mndSubscribe.c | 25 ++++++++----------- source/dnode/vnode/src/tq/tq.c | 11 ++++---- source/libs/catalog/src/catalog.c | 4 +-- tests/script/tsim/tmq/basic1.sim | 2 +- 6 files changed, 37 insertions(+), 35 deletions(-) diff --git a/source/client/src/tmq.c b/source/client/src/tmq.c index 3e4b25c9e7..f17df3e6f1 100644 --- a/source/client/src/tmq.c +++ b/source/client/src/tmq.c @@ -78,6 +78,7 @@ struct tmq_t { STscObj* pTscObj; tmq_commit_cb* commit_cb; int32_t nextTopicIdx; + int8_t epStatus; int32_t waitingRequest; int32_t readyRequest; SArray* clientTopics; // SArray @@ -311,6 +312,7 @@ tmq_t* tmq_consumer_new(void* conn, tmq_conf_t* conf, char* errstr, int32_t errs pTmq->epoch = 0; pTmq->waitingRequest = 0; pTmq->readyRequest = 0; + pTmq->epStatus = 0; // set conf strcpy(pTmq->clientId, conf->clientId); strcpy(pTmq->groupId, conf->groupId); @@ -833,7 +835,7 @@ int32_t tmqPollCb(void* param, const SDataBuf* pMsg, int32_t code) { tmq_t* tmq = pParam->tmq; if (code != 0) { tscWarn("msg discard, code:%x", code); - goto WRITE_QUEUE_FAIL; + goto CREATE_MSG_FAIL; } int32_t msgEpoch = ((SMqRspHead*)pMsg->pData)->epoch; @@ -873,7 +875,7 @@ int32_t tmqPollCb(void* param, const SDataBuf* pMsg, int32_t code) { /*SMqConsumeRsp* pRsp = taosMemoryCalloc(1, sizeof(SMqConsumeRsp));*/ tmq_message_t* pRsp = taosAllocateQitem(sizeof(tmq_message_t)); if (pRsp == NULL) { - goto WRITE_QUEUE_FAIL; + goto CREATE_MSG_FAIL; } memcpy(pRsp, pMsg->pData, sizeof(SMqRspHead)); tDecodeSMqPollRsp(POINTER_SHIFT(pMsg->pData, sizeof(SMqRspHead)), &pRsp->msg); @@ -886,7 +888,7 @@ int32_t tmqPollCb(void* param, const SDataBuf* pMsg, int32_t code) { if (pRsp->msg.numOfTopics == 0) { /*printf("no data\n");*/ taosFreeQitem(pRsp); - goto WRITE_QUEUE_FAIL; + goto CREATE_MSG_FAIL; } #endif @@ -899,7 +901,7 @@ int32_t tmqPollCb(void* param, const SDataBuf* pMsg, int32_t code) { tsem_post(&tmq->rspSem); return 0; -WRITE_QUEUE_FAIL: +CREATE_MSG_FAIL: if (pParam->epoch == tmq->epoch) { atomic_store_32(&pVg->vgStatus, TMQ_VG_STATUS__IDLE); } @@ -940,7 +942,7 @@ bool tmqUpdateEp(tmq_t* tmq, int32_t epoch, SMqCMGetSubEpRsp* pRsp) { for (int32_t k = 0; k < vgNumCur; k++) { SMqClientVg* pVgCur = taosArrayGet(pTopicCur->vgs, k); sprintf(vgKey, "%s:%d", topic.topicName, pVgCur->vgId); - printf("epoch %d vg %d build %s\n", epoch, pVgCur->vgId, vgKey); + tscDebug("epoch %d vg %d build %s\n", epoch, pVgCur->vgId, vgKey); taosHashPut(pHash, vgKey, strlen(vgKey), &pVgCur->currentOffset, sizeof(int64_t)); } break; @@ -954,12 +956,12 @@ bool tmqUpdateEp(tmq_t* tmq, int32_t epoch, SMqCMGetSubEpRsp* pRsp) { sprintf(vgKey, "%s:%d", topic.topicName, pVgEp->vgId); int64_t* pOffset = taosHashGet(pHash, vgKey, strlen(vgKey)); int64_t offset = pVgEp->offset; - printf("epoch %d vg %d offset og to %ld\n", epoch, pVgEp->vgId, offset); + tscDebug("epoch %d vg %d offset og to %ld\n", epoch, pVgEp->vgId, offset); if (pOffset != NULL) { offset = *pOffset; - printf("epoch %d vg %d found %s\n", epoch, pVgEp->vgId, vgKey); + tscDebug("epoch %d vg %d found %s\n", epoch, pVgEp->vgId, vgKey); } - printf("epoch %d vg %d offset set to %ld\n", epoch, pVgEp->vgId, offset); + tscDebug("epoch %d vg %d offset set to %ld\n", epoch, pVgEp->vgId, offset); SMqClientVg clientVg = { .pollCnt = 0, .currentOffset = offset, @@ -1020,6 +1022,7 @@ int32_t tmqAskEpCb(void* param, const SDataBuf* pMsg, int32_t code) { } END: + atomic_store_8(&tmq->epStatus, 0); if (pParam->sync) { tsem_post(&pParam->rspSem); } @@ -1027,6 +1030,10 @@ END: } int32_t tmqAskEp(tmq_t* tmq, bool sync) { + int8_t epStatus = atomic_val_compare_exchange_8(&tmq->epStatus, 0, 1); + if (epStatus == 1) { + return 0; + } int32_t tlen = sizeof(SMqCMGetSubEpReq); SMqCMGetSubEpReq* req = taosMemoryMalloc(tlen); if (req == NULL) { @@ -1207,7 +1214,7 @@ int32_t tmqPollImpl(tmq_t* tmq, int64_t blockingTime) { SMqClientVg* pVg = taosArrayGet(pTopic->vgs, j); int32_t vgStatus = atomic_val_compare_exchange_32(&pVg->vgStatus, TMQ_VG_STATUS__IDLE, TMQ_VG_STATUS__WAIT); if (vgStatus != TMQ_VG_STATUS__IDLE) { - /*printf("skip vg %d\n", pVg->vgId);*/ + tscDebug("skip vg %d", pVg->vgId); continue; } SMqPollReq* pReq = tmqBuildConsumeReqImpl(tmq, blockingTime, pTopic, pVg); @@ -1251,7 +1258,7 @@ int32_t tmqPollImpl(tmq_t* tmq, int64_t blockingTime) { int64_t transporterId = 0; /*printf("send poll\n");*/ atomic_add_fetch_32(&tmq->waitingRequest, 1); - /*tscDebug("tmq send poll: vg %d, req offset %ld", pVg->vgId, pVg->currentOffset);*/ + tscDebug("tmq send poll: vg %d, req offset %ld", pVg->vgId, pVg->currentOffset); /*printf("send vg %d %ld\n", pVg->vgId, pVg->currentOffset);*/ asyncSendMsgToServer(tmq->pTscObj->pAppInfo->pTransporter, &pVg->epSet, &transporterId, sendInfo); pVg->pollCnt++; @@ -1315,7 +1322,7 @@ tmq_message_t* tmqHandleAllRsp(tmq_t* tmq, int64_t blockingTime, bool pollIfRese tmqHandleNoPollRsp(tmq, rspHead, &reset); taosFreeQitem(rspHead); if (pollIfReset && reset) { - printf("reset and repoll\n"); + tscDebug("reset and repoll\n"); tmqPollImpl(tmq, blockingTime); } } diff --git a/source/dnode/mnode/impl/src/mndConsumer.c b/source/dnode/mnode/impl/src/mndConsumer.c index 8eceea3d06..c4c93b7fc9 100644 --- a/source/dnode/mnode/impl/src/mndConsumer.c +++ b/source/dnode/mnode/impl/src/mndConsumer.c @@ -160,6 +160,7 @@ static int32_t mndConsumerActionDelete(SSdb *pSdb, SMqConsumerObj *pConsumer) { static int32_t mndConsumerActionUpdate(SSdb *pSdb, SMqConsumerObj *pOldConsumer, SMqConsumerObj *pNewConsumer) { mTrace("consumer:%" PRId64 ", perform update action", pOldConsumer->consumerId); + pOldConsumer->epoch++; // TODO handle update /*taosWLockLatch(&pOldConsumer->lock);*/ diff --git a/source/dnode/mnode/impl/src/mndSubscribe.c b/source/dnode/mnode/impl/src/mndSubscribe.c index 195afa3848..1afbb74067 100644 --- a/source/dnode/mnode/impl/src/mndSubscribe.c +++ b/source/dnode/mnode/impl/src/mndSubscribe.c @@ -446,26 +446,21 @@ static int32_t mndProcessDoRebalanceMsg(SNodeMsg *pMsg) { if (vgThisConsumerAfterRb != vgThisConsumerBeforeRb || (vgThisConsumerAfterRb != 0 && status != MQ_CONSUMER_STATUS__ACTIVE) || (vgThisConsumerAfterRb == 0 && status != MQ_CONSUMER_STATUS__LOST)) { - SMqConsumerObj* pNewRebConsumer = taosMemoryMalloc(sizeof(SMqConsumerObj)); - ASSERT(pNewRebConsumer); - memcpy(pNewRebConsumer, pRebConsumer, sizeof(SMqConsumerObj)); - pNewRebConsumer->currentTopics = taosArrayDup(pRebConsumer->currentTopics); - pNewRebConsumer->recentRemovedTopics = taosArrayDup(pRebConsumer->recentRemovedTopics); - if (vgThisConsumerAfterRb != vgThisConsumerBeforeRb) { - pNewRebConsumer->epoch++; - } + /*if (vgThisConsumerAfterRb != vgThisConsumerBeforeRb) {*/ + /*pRebConsumer->epoch++;*/ + /*}*/ if (vgThisConsumerAfterRb != 0) { - atomic_store_32(&pNewRebConsumer->status, MQ_CONSUMER_STATUS__ACTIVE); + atomic_store_32(&pRebConsumer->status, MQ_CONSUMER_STATUS__ACTIVE); } else { - atomic_store_32(&pNewRebConsumer->status, MQ_CONSUMER_STATUS__IDLE); + atomic_store_32(&pRebConsumer->status, MQ_CONSUMER_STATUS__IDLE); } - mInfo("mq consumer:%" PRId64 ", status change from %d to %d", pNewRebConsumer->consumerId, status, - pNewRebConsumer->status); + mInfo("mq consumer:%" PRId64 ", status change from %d to %d", pRebConsumer->consumerId, status, + pRebConsumer->status); - SSdbRaw *pConsumerRaw = mndConsumerActionEncode(pNewRebConsumer); + SSdbRaw *pConsumerRaw = mndConsumerActionEncode(pRebConsumer); sdbSetRawStatus(pConsumerRaw, SDB_STATUS_READY); - mndTransAppendRedolog(pTrans, pConsumerRaw); + mndTransAppendCommitlog(pTrans, pConsumerRaw); } mndReleaseConsumer(pMnode, pRebConsumer); } @@ -512,7 +507,7 @@ static int32_t mndProcessDoRebalanceMsg(SNodeMsg *pMsg) { // TODO: log rebalance statistics SSdbRaw *pSubRaw = mndSubActionEncode(pSub); - sdbSetRawStatus(pSubRaw, SDB_STATUS_READY); + sdbSetRawStatus(pSubRaw, SDB_STATUS_UPDATING); mndTransAppendRedolog(pTrans, pSubRaw); } mndReleaseSubscribe(pMnode, pSub); diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c index 438a584842..68ade46efd 100644 --- a/source/dnode/vnode/src/tq/tq.c +++ b/source/dnode/vnode/src/tq/tq.c @@ -264,7 +264,7 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) { fetchOffset = pReq->currentOffset + 1; } - printf("tmq poll vg %d req %ld %ld\n", pTq->pVnode->vgId, pReq->currentOffset, fetchOffset); + /*printf("tmq poll vg %d req %ld %ld\n", pTq->pVnode->vgId, pReq->currentOffset, fetchOffset);*/ SMqPollRsp rsp = { /*.consumerId = consumerId,*/ @@ -299,8 +299,7 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) { // response to user break; } - printf("vg %d offset %ld msgType %d from epoch %d\n", pTq->pVnode->vgId, fetchOffset, pHead->msgType, - pReq->epoch); + /*printf("vg %d offset %ld msgType %d from epoch %d\n", pTq->pVnode->vgId, fetchOffset, pHead->msgType, pReq->epoch);*/ /*int8_t pos = fetchOffset % TQ_BUFFER_SIZE;*/ /*pHead = pTopic->pReadhandle->pHead;*/ if (pHead->msgType == TDMT_VND_SUBMIT) { @@ -353,7 +352,7 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) { pMsg->pCont = buf; pMsg->contLen = tlen; pMsg->code = 0; - printf("vg %d offset %ld msgType %d from epoch %d actual rsp\n", pTq->pVnode->vgId, fetchOffset, pHead->msgType, pReq->epoch); + /*printf("vg %d offset %ld msgType %d from epoch %d actual rsp\n", pTq->pVnode->vgId, fetchOffset, pHead->msgType, pReq->epoch);*/ tmsgSendRsp(pMsg); taosMemoryFree(pHead); return 0; @@ -384,7 +383,7 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) { pMsg->contLen = tlen; pMsg->code = 0; tmsgSendRsp(pMsg); - printf("vg %d offset %ld from epoch %d not rsp\n", pTq->pVnode->vgId, fetchOffset, pReq->epoch); + /*printf("vg %d offset %ld from epoch %d not rsp\n", pTq->pVnode->vgId, fetchOffset, pReq->epoch);*/ /*}*/ return 0; @@ -451,7 +450,7 @@ int32_t tqProcessSetConnReq(STQ* pTq, char* msg) { pTopic->buffer.output[i].task = qCreateStreamExecTaskInfo(req.qmsg, &handle); ASSERT(pTopic->buffer.output[i].task); } - printf("set topic %s to consumer %ld on vg %d\n", pTopic->topicName, req.consumerId, pTq->pVnode->vgId); + /*printf("set topic %s to consumer %ld on vg %d\n", pTopic->topicName, req.consumerId, pTq->pVnode->vgId);*/ taosArrayPush(pConsumer->topics, pTopic); tqHandleMovePut(pTq->tqMeta, req.consumerId, pConsumer); tqHandleCommit(pTq->tqMeta, req.consumerId); diff --git a/source/libs/catalog/src/catalog.c b/source/libs/catalog/src/catalog.c index e87fdba71d..a3019d8d56 100644 --- a/source/libs/catalog/src/catalog.c +++ b/source/libs/catalog/src/catalog.c @@ -2304,8 +2304,6 @@ int32_t catalogInit(SCatalogCfg *cfg) { CTG_ERR_RET(TSDB_CODE_CTG_INTERNAL_ERROR); } - CTG_ERR_RET(ctgStartUpdateThread()); - tsem_init(&gCtgMgmt.queue.reqSem, 0, 0); tsem_init(&gCtgMgmt.queue.rspSem, 0, 0); @@ -2316,6 +2314,8 @@ int32_t catalogInit(SCatalogCfg *cfg) { } gCtgMgmt.queue.tail = gCtgMgmt.queue.head; + CTG_ERR_RET(ctgStartUpdateThread()); + qDebug("catalog initialized, maxDb:%u, maxTbl:%u, dbRentSec:%u, stbRentSec:%u", gCtgMgmt.cfg.maxDBCacheNum, gCtgMgmt.cfg.maxTblCacheNum, gCtgMgmt.cfg.dbRentSec, gCtgMgmt.cfg.stbRentSec); return TSDB_CODE_SUCCESS; diff --git a/tests/script/tsim/tmq/basic1.sim b/tests/script/tsim/tmq/basic1.sim index afd3f0f9b0..cfcb1ac992 100644 --- a/tests/script/tsim/tmq/basic1.sim +++ b/tests/script/tsim/tmq/basic1.sim @@ -35,7 +35,7 @@ sql connect $dbNamme = d0 print =============== create database , vgroup 1 -sql create database $dbNamme vgroups 10 +sql create database $dbNamme vgroups 1 sql show databases print $data00 $data01 $data02 if $rows != 2 then From 84c71d5d3c0646956b678956bd8d2f3171821a52 Mon Sep 17 00:00:00 2001 From: plum-lihui Date: Fri, 1 Apr 2022 18:40:36 +0800 Subject: [PATCH 47/68] [add tmq case] --- tests/script/jenkins/basic.txt | 1 + tests/script/tsim/parser/groupby-basic.sim | 27 ++++++++-------------- 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index 9cf2e9318b..48e36d7f86 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -40,6 +40,7 @@ # ---- tmq ./test.sh -f tsim/tmq/basic.sim ./test.sh -f tsim/tmq/basic1.sim +./test.sh -f tsim/tmq/oneTopic.sim # --- stable ./test.sh -f tsim/stable/disk.sim diff --git a/tests/script/tsim/parser/groupby-basic.sim b/tests/script/tsim/parser/groupby-basic.sim index e26f849b13..f073200a05 100644 --- a/tests/script/tsim/parser/groupby-basic.sim +++ b/tests/script/tsim/parser/groupby-basic.sim @@ -112,21 +112,21 @@ print $data90 $data91 $data92 $data93 if $rows != 10 then return -1 endi -#if $data00 != 10 then -# return -1 -#endi +if $data00 != 10 then + return -1 +endi if $data01 != 0 then return -1 endi -#if $data10 != 10 then -# return -1 -#endi +if $data10 != 10 then + return -1 +endi if $data11 != 1 then return -1 endi -#if $data90 != 10 then -# return -1 -#endi +if $data90 != 10 then + return -1 +endi if $data91 != 9 then return -1 endi @@ -167,15 +167,6 @@ print $data90 $data91 $data92 $data93 return - - - - - - - - - sql select sum(c1), c1, avg(c1), min(c1), max(c2) from group_tb0 where c1 < 20 group by c1; if $row != 20 then return -1 From 3b9e868e2a3e29e6d205ebb6f76ccadfae25434c Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Fri, 1 Apr 2022 06:40:47 -0400 Subject: [PATCH 48/68] fill plan implement --- source/libs/nodes/src/nodesCloneFuncs.c | 8 +++++++ source/libs/nodes/src/nodesCodeFuncs.c | 29 +++++++++++++++++++++++- source/libs/parser/src/parTokenizer.c | 1 + source/libs/planner/test/plannerTest.cpp | 12 +++++++--- 4 files changed, 46 insertions(+), 4 deletions(-) diff --git a/source/libs/nodes/src/nodesCloneFuncs.c b/source/libs/nodes/src/nodesCloneFuncs.c index e728078a38..f8bc99b975 100644 --- a/source/libs/nodes/src/nodesCloneFuncs.c +++ b/source/libs/nodes/src/nodesCloneFuncs.c @@ -206,6 +206,12 @@ static SNode* orderByExprNodeCopy(const SOrderByExprNode* pSrc, SOrderByExprNode return (SNode*)pDst; } +static SNode* nodeListNodeCopy(const SNodeListNode* pSrc, SNodeListNode* pDst) { + COPY_ALL_SCALAR_FIELDS; + CLONE_NODE_LIST_FIELD(pNodeList); + return (SNode*)pDst; +} + static SNode* fillNodeCopy(const SFillNode* pSrc, SFillNode* pDst) { COPY_SCALAR_FIELD(mode); CLONE_NODE_FIELD(pValues); @@ -360,6 +366,8 @@ SNodeptr nodesCloneNode(const SNodeptr pNode) { return orderByExprNodeCopy((const SOrderByExprNode*)pNode, (SOrderByExprNode*)pDst); case QUERY_NODE_LIMIT: break; + case QUERY_NODE_NODE_LIST: + return nodeListNodeCopy((const SNodeListNode*)pNode, (SNodeListNode*)pDst); case QUERY_NODE_FILL: return fillNodeCopy((const SFillNode*)pNode, (SFillNode*)pDst); case QUERY_NODE_DATABLOCK_DESC: diff --git a/source/libs/nodes/src/nodesCodeFuncs.c b/source/libs/nodes/src/nodesCodeFuncs.c index 32040a2e3f..5337965164 100644 --- a/source/libs/nodes/src/nodesCodeFuncs.c +++ b/source/libs/nodes/src/nodesCodeFuncs.c @@ -2015,6 +2015,31 @@ static int32_t jsonToNodeListNode(const SJson* pJson, void* pObj) { return code; } +static const char* jkFillMode = "Mode"; +static const char* jkFillValues = "Values"; + +static int32_t fillNodeToJson(const void* pObj, SJson* pJson) { + const SFillNode* pNode = (const SFillNode*)pObj; + + int32_t code = tjsonAddIntegerToObject(pJson, jkFillMode, pNode->mode); + if (TSDB_CODE_SUCCESS == code) { + code = tjsonAddObject(pJson, jkFillValues, nodeToJson, pNode->pValues); + } + + return code; +} + +static int32_t jsonToFillNode(const SJson* pJson, void* pObj) { + SFillNode* pNode = (SFillNode*)pObj; + + int32_t code = tjsonGetNumberValue(pJson, jkFillMode, pNode->mode); + if (TSDB_CODE_SUCCESS == code) { + code = jsonToNodeObject(pJson, jkFillValues, &pNode->pValues); + } + + return code; +} + static const char* jkTargetDataBlockId = "DataBlockId"; static const char* jkTargetSlotId = "SlotId"; static const char* jkTargetExpr = "Expr"; @@ -2328,6 +2353,7 @@ static int32_t specificNodeToJson(const void* pObj, SJson* pJson) { case QUERY_NODE_NODE_LIST: return nodeListNodeToJson(pObj, pJson); case QUERY_NODE_FILL: + return fillNodeToJson(pObj, pJson); case QUERY_NODE_RAW_EXPR: break; case QUERY_NODE_TARGET: @@ -2431,7 +2457,8 @@ static int32_t jsonToSpecificNode(const SJson* pJson, void* pObj) { return jsonToIntervalWindowNode(pJson, pObj); case QUERY_NODE_NODE_LIST: return jsonToNodeListNode(pJson, pObj); - // case QUERY_NODE_FILL: + case QUERY_NODE_FILL: + return jsonToFillNode(pJson, pObj); case QUERY_NODE_TARGET: return jsonToTargetNode(pJson, pObj); // case QUERY_NODE_RAW_EXPR: diff --git a/source/libs/parser/src/parTokenizer.c b/source/libs/parser/src/parTokenizer.c index be2bd0d0b6..d89bee6fdc 100644 --- a/source/libs/parser/src/parTokenizer.c +++ b/source/libs/parser/src/parTokenizer.c @@ -176,6 +176,7 @@ static SKeyword keywordTable[] = { {"USER", TK_USER}, {"USERS", TK_USERS}, {"USING", TK_USING}, + {"VALUE", TK_VALUE}, {"VALUES", TK_VALUES}, {"VARCHAR", TK_VARCHAR}, {"VARIABLES", TK_VARIABLES}, diff --git a/source/libs/planner/test/plannerTest.cpp b/source/libs/planner/test/plannerTest.cpp index d19d88f455..00af808078 100644 --- a/source/libs/planner/test/plannerTest.cpp +++ b/source/libs/planner/test/plannerTest.cpp @@ -190,10 +190,16 @@ TEST_F(PlannerTest, subquery) { TEST_F(PlannerTest, interval) { setDatabase("root", "test"); - bind("SELECT count(*) FROM t1 interval(10s)"); - ASSERT_TRUE(run()); + // bind("SELECT count(*) FROM t1 interval(10s)"); + // ASSERT_TRUE(run()); - bind("SELECT _wstartts, _wduration, _wendts, count(*) FROM t1 interval(10s)"); + // bind("SELECT _wstartts, _wduration, _wendts, count(*) FROM t1 interval(10s)"); + // ASSERT_TRUE(run()); + + // bind("SELECT count(*) FROM t1 interval(10s) fill(linear)"); + // ASSERT_TRUE(run()); + + bind("SELECT count(*), sum(c1) FROM t1 interval(10s) fill(value, 10, 20)"); ASSERT_TRUE(run()); } From 5a2a34f1bd8593ad7d2f6d587c26fa57f610a189 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 1 Apr 2022 19:07:05 +0800 Subject: [PATCH 49/68] add multiprocess mode to CI --- tests/script/jenkins/basic.txt | 7 +++++++ tests/script/sh/deploy.sh | 15 ++++++--------- tests/script/test.sh | 16 ++++++++++++---- tests/tsim/inc/simInt.h | 1 + tests/tsim/src/simExe.c | 31 +++++++++++++++++-------------- tests/tsim/src/simMain.c | 3 +++ 6 files changed, 46 insertions(+), 27 deletions(-) diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index 811c9941f7..3a5d782716 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -50,4 +50,11 @@ ./test.sh -f tsim/stable/values.sim ./test.sh -f tsim/stable/vnode3.sim + +# --- for multi process mode +./test.sh -f tsim/user/basic1.sim -m +./test.sh -f tsim/insert/basic1.sim -m +./test.sh -f tsim/stable/vnode3.sim -m +./test.sh -f tsim/tmq/basic.sim -m + #======================b1-end=============== diff --git a/tests/script/sh/deploy.sh b/tests/script/sh/deploy.sh index 1bbfccf989..38b6d9aadb 100755 --- a/tests/script/sh/deploy.sh +++ b/tests/script/sh/deploy.sh @@ -5,18 +5,12 @@ set +e echo "Executing deploy.sh" -if [ $# != 4 ]; then - echo "argument list need input : " - echo " -n nodeName" - echo " -i nodePort" - exit 1 -fi - UNAME_BIN=`which uname` OS_TYPE=`$UNAME_BIN` NODE_NAME= NODE= -while getopts "n:i:" arg +MULTIPROCESS=0 +while getopts "n:i:m" arg do case $arg in n) @@ -25,6 +19,9 @@ do i) NODE=$OPTARG ;; + m) + MULTIPROCESS=1 + ;; ?) echo "unkonw argument" ;; @@ -145,5 +142,5 @@ echo "statusInterval 1" >> $TAOS_CFG echo "asyncLog 0" >> $TAOS_CFG echo "locale en_US.UTF-8" >> $TAOS_CFG echo "telemetryReporting 0" >> $TAOS_CFG -echo "multiProcess 0" >> $TAOS_CFG +echo "multiProcess ${MULTIPROCESS}" >> $TAOS_CFG echo " " >> $TAOS_CFG diff --git a/tests/script/test.sh b/tests/script/test.sh index f89b9fb1a2..efd193d256 100755 --- a/tests/script/test.sh +++ b/tests/script/test.sh @@ -7,7 +7,6 @@ ################################################## set +e -#set -x FILE_NAME= RELEASE=0 @@ -16,7 +15,8 @@ VALGRIND=0 UNIQUE=0 UNAME_BIN=`which uname` OS_TYPE=`$UNAME_BIN` -while getopts "f:avu" arg +MULTIPROCESS=1 +while getopts "f:avum" arg do case $arg in f) @@ -28,6 +28,9 @@ do u) UNIQUE=1 ;; + m) + MULTIPROCESS=1 + ;; ?) echo "unknow argument" ;; @@ -125,8 +128,13 @@ if [ -n "$FILE_NAME" ]; then echo valgrind --tool=memcheck --leak-check=full --show-reachable=no --track-origins=yes --show-leak-kinds=all -v --workaround-gcc296-bugs=yes --log-file=${CODE_DIR}/../script/valgrind.log $PROGRAM -c $CFG_DIR -f $FILE_NAME valgrind --tool=memcheck --leak-check=full --show-reachable=no --track-origins=yes --show-leak-kinds=all -v --workaround-gcc296-bugs=yes --log-file=${CODE_DIR}/../script/valgrind.log $PROGRAM -c $CFG_DIR -f $FILE_NAME else - echo "ExcuteCmd:" $PROGRAM -c $CFG_DIR -f $FILE_NAME - $PROGRAM -c $CFG_DIR -f $FILE_NAME + if [[ $MULTIPROCESS -eq 1 ]];then + echo "ExcuteCmd(multiprocess):" $PROGRAM -m -c $CFG_DIR -f $FILE_NAME + $PROGRAM -m -c $CFG_DIR -f $FILE_NAME + else + echo "ExcuteCmd(singleprocess):" $PROGRAM -c $CFG_DIR -f $FILE_NAME + $PROGRAM -c $CFG_DIR -f $FILE_NAME + fi fi else echo "ExcuteCmd:" $PROGRAM -c $CFG_DIR -f basicSuite.sim diff --git a/tests/tsim/inc/simInt.h b/tests/tsim/inc/simInt.h index 1e2190e308..a667139de1 100644 --- a/tests/tsim/inc/simInt.h +++ b/tests/tsim/inc/simInt.h @@ -155,6 +155,7 @@ extern int32_t simScriptSucced; extern int32_t simDebugFlag; extern char simScriptDir[]; extern bool abortExecution; +extern bool useMultiProcess; SScript *simParseScript(char *fileName); SScript *simProcessCallOver(SScript *script); diff --git a/tests/tsim/src/simExe.c b/tests/tsim/src/simExe.c index 855705e904..9a0b48197a 100644 --- a/tests/tsim/src/simExe.c +++ b/tests/tsim/src/simExe.c @@ -305,25 +305,24 @@ bool simExecuteRunBackCmd(SScript *script, char *option) { return true; } -void simReplaceShToBat(char *dst) { - char *sh = strstr(dst, ".sh"); - if (sh != NULL) { +void simReplaceStr(char *buf, char *src, char *dst) { + char *begin = strstr(buf, src); + if (begin != NULL) { + int32_t srcLen = (int32_t)strlen(src); int32_t dstLen = (int32_t)strlen(dst); - char *end = dst + dstLen; - *(end + 1) = 0; + int32_t interval = (dstLen - srcLen); + int32_t remainLen = (int32_t)strlen(buf); + char *end = buf + remainLen; + *(end + interval) = 0; - for (char *p = end; p >= sh; p--) { - *(p + 1) = *p; + for (char *p = end; p >= begin; p--) { + *(p + interval) = *p; } - sh[0] = '.'; - sh[1] = 'b'; - sh[2] = 'a'; - sh[3] = 't'; - sh[4] = ' '; + memcpy(begin, dst, dstLen); } - simDebug("system cmd is %s", dst); + simInfo("system cmd is %s", buf); } bool simExecuteSystemCmd(SScript *script, char *option) { @@ -334,9 +333,13 @@ bool simExecuteSystemCmd(SScript *script, char *option) { simVisuallizeOption(script, option, buf + strlen(buf)); #else sprintf(buf, "%s%s", simScriptDir, option); - simReplaceShToBat(buf); + simReplaceStr(buf, ".sh", ".bat"); #endif + if (useMultiProcess) { + simReplaceStr(buf, "deploy.sh", "deploy.sh -m"); + } + simLogSql(buf, true); int32_t code = system(buf); int32_t repeatTimes = 0; diff --git a/tests/tsim/src/simMain.c b/tests/tsim/src/simMain.c index b57299e752..8898f1b201 100644 --- a/tests/tsim/src/simMain.c +++ b/tests/tsim/src/simMain.c @@ -18,6 +18,7 @@ bool simExecSuccess = false; bool abortExecution = false; +bool useMultiProcess = false; void simHandleSignal(int32_t signo, void *sigInfo, void *context) { simSystemCleanUp(); @@ -32,6 +33,8 @@ int32_t main(int32_t argc, char *argv[]) { tstrncpy(configDir, argv[++i], 128); } else if (strcmp(argv[i], "-f") == 0 && i < argc - 1) { strcpy(scriptFile, argv[++i]); + } else if (strcmp(argv[i], "-m") == 0) { + useMultiProcess = true; } else { printf("usage: %s [options] \n", argv[0]); printf(" [-c config]: config directory, default is: %s\n", configDir); From 420390c0ef5d85d72921f88c0f79e8b66c590016 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 1 Apr 2022 19:13:28 +0800 Subject: [PATCH 50/68] minor changes --- tests/script/test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/script/test.sh b/tests/script/test.sh index efd193d256..8b77575e18 100755 --- a/tests/script/test.sh +++ b/tests/script/test.sh @@ -15,7 +15,7 @@ VALGRIND=0 UNIQUE=0 UNAME_BIN=`which uname` OS_TYPE=`$UNAME_BIN` -MULTIPROCESS=1 +MULTIPROCESS=0 while getopts "f:avum" arg do case $arg in From b80a755bb96f8250fe60b42e7a34f043a63ab0b9 Mon Sep 17 00:00:00 2001 From: plum-lihui Date: Fri, 1 Apr 2022 19:32:47 +0800 Subject: [PATCH 51/68] [add session cases] --- tests/script/tsim/query/session.sim | 229 ++++++++++++++++++++++++++++ 1 file changed, 229 insertions(+) create mode 100644 tests/script/tsim/query/session.sim diff --git a/tests/script/tsim/query/session.sim b/tests/script/tsim/query/session.sim new file mode 100644 index 0000000000..43923fc572 --- /dev/null +++ b/tests/script/tsim/query/session.sim @@ -0,0 +1,229 @@ +#### session windows + +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, child table and insert data +sql create table if not exists st (ts timestamp, tagtype int) tags(dev nchar(50), tag2 binary(16)) +sql create table if not exists dev_001 using st tags("dev_01", "tag_01") +sql create table if not exists dev_002 using st tags("dev_02", "tag_02") + +sql INSERT INTO dev_001 VALUES('2020-05-13 10:00:00.000', 1)('2020-05-13 10:00:00.005', 2)('2020-05-13 10:00:00.011', 3) +sql INSERT INTO dev_001 VALUES('2020-05-13 10:00:01.011', 4)('2020-05-13 10:00:01.611', 5)('2020-05-13 10:00:02.612', 6) +sql INSERT INTO dev_001 VALUES('2020-05-13 10:01:02.612', 7)('2020-05-13 10:02:02.612', 8)('2020-05-13 10:03:02.613', 9) +sql INSERT INTO dev_001 VALUES('2020-05-13 11:00:00.000', 10)('2020-05-13 12:00:00.000', 11)('2020-05-13 13:00:00.001', 12) +sql INSERT INTO dev_001 VALUES('2020-05-14 13:00:00.001', 13)('2020-05-15 14:00:00.000', 14)('2020-05-20 10:00:00.000', 15) +sql INSERT INTO dev_001 VALUES('2020-05-27 10:00:00.001', 16) + +sql INSERT INTO dev_002 VALUES('2020-05-13 10:00:00.000', 1)('2020-05-13 10:00:00.005', 2)('2020-05-13 10:00:00.009', 3) +sql INSERT INTO dev_002 VALUES('2020-05-13 10:00:00.0021', 4)('2020-05-13 10:00:00.031', 5)('2020-05-13 10:00:00.036', 6)('2020-05-13 10:00:00.51', 7) + + + +# session(ts,5a) +print ====> select count(*) from dev_001 session(ts,5a) +sql select count(*) from dev_001 session(ts,5a) +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 != 15 then + return -1 +endi +if $data01 != 2 then + return -1 +endi + +return + +# +# # session(ts,5a) main query +# tdSql.query("select count(*) from (select * from dev_001) session(ts,5a)") +# tdSql.checkRows(15) +# tdSql.checkData(0, 1, 2) +# +# +# # session(ts,1s) +# tdSql.query("select count(*) from dev_001 session(ts,1s)") +# tdSql.checkRows(12) +# tdSql.checkData(0, 1, 5) +# +# # session(ts,1s) main query +# tdSql.query("select count(*) from (select * from dev_001) session(ts,1s)") +# tdSql.checkRows(12) +# tdSql.checkData(0, 1, 5) +# +# tdSql.query("select count(*) from dev_001 session(ts,1000a)") +# tdSql.checkRows(12) +# tdSql.checkData(0, 1, 5) +# +# tdSql.query("select count(*) from (select * from dev_001) session(ts,1000a)") +# tdSql.checkRows(12) +# tdSql.checkData(0, 1, 5) +# +# # session(ts,1m) +# tdSql.query("select count(*) from dev_001 session(ts,1m)") +# tdSql.checkRows(9) +# tdSql.checkData(0, 1, 8) +# +# # session(ts,1m) +# tdSql.query("select count(*) from (select * from dev_001) session(ts,1m)") +# tdSql.checkRows(9) +# tdSql.checkData(0, 1, 8) +# +# # session(ts,1h) +# tdSql.query("select count(*) from dev_001 session(ts,1h)") +# tdSql.checkRows(6) +# tdSql.checkData(0, 1, 11) +# +# # session(ts,1h) +# tdSql.query("select count(*) from (select * from dev_001) session(ts,1h)") +# tdSql.checkRows(6) +# tdSql.checkData(0, 1, 11) +# +# # session(ts,1d) +# tdSql.query("select count(*) from dev_001 session(ts,1d)") +# tdSql.checkRows(4) +# tdSql.checkData(0, 1, 13) +# +# # session(ts,1d) +# tdSql.query("select count(*) from (select * from dev_001) session(ts,1d)") +# tdSql.checkRows(4) +# tdSql.checkData(0, 1, 13) +# +# # session(ts,1w) +# tdSql.query("select count(*) from dev_001 session(ts,1w)") +# tdSql.checkRows(2) +# tdSql.checkData(0, 1, 15) +# +# # session(ts,1w) +# tdSql.query("select count(*) from (select * from dev_001) session(ts,1w)") +# tdSql.checkRows(2) +# tdSql.checkData(0, 1, 15) +# +# # session with where +# tdSql.query("select count(*),first(tagtype),last(tagtype),avg(tagtype),sum(tagtype),min(tagtype),max(tagtype),leastsquares(tagtype, 1, 1),spread(tagtype),stddev(tagtype),percentile(tagtype,0) from dev_001 where ts <'2020-05-20 0:0:0' session(ts,1d)") +# +# tdSql.checkRows(2) +# tdSql.checkData(0, 1, 13) +# tdSql.checkData(0, 2, 1) +# tdSql.checkData(0, 3, 13) +# tdSql.checkData(0, 4, 7) +# tdSql.checkData(0, 5, 91) +# tdSql.checkData(0, 6, 1) +# tdSql.checkData(0, 7, 13) +# tdSql.checkData(0, 8, '{slop:1.000000, intercept:0.000000}') +# tdSql.checkData(0, 9, 12) +# tdSql.checkData(0, 10, 3.741657387) +# tdSql.checkData(0, 11, 1) +# tdSql.checkData(1, 11, 14) +# +# # session with where main +# +# tdSql.query("select count(*),first(tagtype),last(tagtype),avg(tagtype),sum(tagtype),min(tagtype),max(tagtype),leastsquares(tagtype, 1, 1) from (select * from dev_001 where ts <'2020-05-20 0:0:0') session(ts,1d)") +# +# tdSql.checkRows(2) +# tdSql.checkData(0, 1, 13) +# tdSql.checkData(0, 2, 1) +# tdSql.checkData(0, 3, 13) +# tdSql.checkData(0, 4, 7) +# tdSql.checkData(0, 5, 91) +# tdSql.checkData(0, 6, 1) +# tdSql.checkData(0, 7, 13) +# tdSql.checkData(0, 8, '{slop:1.000000, intercept:0.000000}') +# +# # tdsql err +# tdSql.error("select * from dev_001 session(ts,1w)") +# tdSql.error("select count(*) from st session(ts,1w)") +# tdSql.error("select count(*) from dev_001 group by tagtype session(ts,1w) ") +# tdSql.error("select count(*) from dev_001 session(ts,1n)") +# tdSql.error("select count(*) from dev_001 session(ts,1y)") +# tdSql.error("select count(*) from dev_001 session(ts,0s)") +# tdSql.error("select count(*) from dev_001 session(i,1y)") +# tdSql.error("select count(*) from dev_001 session(ts,1d) where ts <'2020-05-20 0:0:0'") +# +# #test precision us +# tdSql.execute("create database test precision 'us'") +# tdSql.execute("use test") +# tdSql.execute("create table dev_001 (ts timestamp ,i timestamp ,j int)") +# tdSql.execute("insert into dev_001 values(1623046993681000,now,1)(1623046993681001,now+1s,2)(1623046993681002,now+2s,3)(1623046993681004,now+5s,4)") +# +# # session(ts,1u) +# tdSql.query("select count(*) from dev_001 session(ts,1u)") +# tdSql.checkRows(2) +# tdSql.checkData(0, 1, 3) +# tdSql.error("select count(*) from dev_001 session(i,1s)") +# # test second timestamp fileds +# tdSql.execute("create table secondts(ts timestamp,t2 timestamp,i int)") +# tdSql.error("select count(*) from secondts session(t2,2s)") +# +# + + +#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 From 2fa66fe38ed7fa0b29df61181265d4a75ae82f58 Mon Sep 17 00:00:00 2001 From: plum-lihui Date: Fri, 1 Apr 2022 19:36:25 +0800 Subject: [PATCH 52/68] [modify] --- tests/script/jenkins/basic.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index 48e36d7f86..5c503c39bb 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -40,7 +40,8 @@ # ---- tmq ./test.sh -f tsim/tmq/basic.sim ./test.sh -f tsim/tmq/basic1.sim -./test.sh -f tsim/tmq/oneTopic.sim +#./test.sh -f tsim/tmq/oneTopic.sim +#./test.sh -f tsim/tmq/multiTopic.sim # --- stable ./test.sh -f tsim/stable/disk.sim From 8176ff04d14c521450be575f4b3742d28b39ad84 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 1 Apr 2022 19:43:29 +0800 Subject: [PATCH 53/68] minor changes --- source/dnode/mgmt/main/src/dndExec.c | 4 ++-- tests/script/jenkins/basic.txt | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/source/dnode/mgmt/main/src/dndExec.c b/source/dnode/mgmt/main/src/dndExec.c index 281bc752ca..54cadb177a 100644 --- a/source/dnode/mgmt/main/src/dndExec.c +++ b/source/dnode/mgmt/main/src/dndExec.c @@ -45,7 +45,7 @@ int32_t dndOpenNode(SMgmtWrapper *pWrapper) { } void dndCloseNode(SMgmtWrapper *pWrapper) { - dDebug("node:%s, start to close", pWrapper->name); + dDebug("node:%s, mgmt start to close", pWrapper->name); pWrapper->required = false; taosWLockLatch(&pWrapper->latch); if (pWrapper->deployed) { @@ -62,7 +62,7 @@ void dndCloseNode(SMgmtWrapper *pWrapper) { taosProcCleanup(pWrapper->pProc); pWrapper->pProc = NULL; } - dDebug("node:%s, has been closed", pWrapper->name); + dDebug("node:%s, mgmt has been closed", pWrapper->name); } static void dndConsumeChildQueue(SMgmtWrapper *pWrapper, SNodeMsg *pMsg, int16_t msgLen, void *pCont, int32_t contLen, diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index d2f19d766f..fc87776658 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -54,7 +54,6 @@ # --- for multi process mode ./test.sh -f tsim/user/basic1.sim -m -./test.sh -f tsim/insert/basic1.sim -m ./test.sh -f tsim/stable/vnode3.sim -m ./test.sh -f tsim/tmq/basic.sim -m From 44311425db094fba75c0b7ad6ad83b8d42f45931 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 1 Apr 2022 19:52:14 +0800 Subject: [PATCH 54/68] multi process --- include/common/tmsgcb.h | 2 -- source/common/src/tmsgcb.c | 4 ---- source/dnode/mgmt/bm/src/bmInt.c | 1 - source/dnode/mgmt/main/src/dndTransport.c | 1 - source/dnode/mgmt/mm/src/mmInt.c | 7 +------ source/dnode/mgmt/qm/src/qmInt.c | 7 +------ source/dnode/mgmt/sm/src/smInt.c | 7 +------ source/dnode/mgmt/vm/src/vmInt.c | 6 +----- source/dnode/mgmt/vm/src/vmMsg.c | 6 +----- source/dnode/mnode/impl/src/mndProfile.c | 6 ------ 10 files changed, 5 insertions(+), 42 deletions(-) diff --git a/include/common/tmsgcb.h b/include/common/tmsgcb.h index cb59599d9a..6c3671a8d6 100644 --- a/include/common/tmsgcb.h +++ b/include/common/tmsgcb.h @@ -50,7 +50,6 @@ typedef struct { PutToQueueFp queueFps[QUEUE_MAX]; GetQueueSizeFp qsizeFp; SendReqFp sendReqFp; - SendMnodeReqFp sendMnodeReqFp; SendRspFp sendRspFp; RegisterBrokenLinkArgFp registerBrokenLinkArgFp; ReleaseHandleFp releaseHandleFp; @@ -60,7 +59,6 @@ void tmsgSetDefaultMsgCb(const SMsgCb* pMsgCb); int32_t tmsgPutToQueue(const SMsgCb* pMsgCb, EQueueType qtype, SRpcMsg* pReq); int32_t tmsgGetQueueSize(const SMsgCb* pMsgCb, int32_t vgId, EQueueType qtype); int32_t tmsgSendReq(const SMsgCb* pMsgCb, const SEpSet* epSet, SRpcMsg* pReq); -int32_t tmsgSendMnodeReq(const SMsgCb* pMsgCb, SRpcMsg* pReq); void tmsgSendRsp(const SRpcMsg* pRsp); void tmsgRegisterBrokenLinkArg(const SMsgCb* pMsgCb, SRpcMsg* pMsg); void tmsgReleaseHandle(void* handle, int8_t type); diff --git a/source/common/src/tmsgcb.c b/source/common/src/tmsgcb.c index e90634a604..cb5e2b07c1 100644 --- a/source/common/src/tmsgcb.c +++ b/source/common/src/tmsgcb.c @@ -32,10 +32,6 @@ int32_t tmsgSendReq(const SMsgCb* pMsgCb, const SEpSet* epSet, SRpcMsg* pReq) { return (*pMsgCb->sendReqFp)(pMsgCb->pWrapper, epSet, pReq); } -int32_t tmsgSendMnodeReq(const SMsgCb* pMsgCb, SRpcMsg* pReq) { - return (*pMsgCb->sendMnodeReqFp)(pMsgCb->pWrapper, pReq); -} - void tmsgSendRsp(const SRpcMsg* pRsp) { return (*tsDefaultMsgCb.sendRspFp)(tsDefaultMsgCb.pWrapper, pRsp); } void tmsgRegisterBrokenLinkArg(const SMsgCb* pMsgCb, SRpcMsg* pMsg) { diff --git a/source/dnode/mgmt/bm/src/bmInt.c b/source/dnode/mgmt/bm/src/bmInt.c index 4b87f4463c..cbaf247a5b 100644 --- a/source/dnode/mgmt/bm/src/bmInt.c +++ b/source/dnode/mgmt/bm/src/bmInt.c @@ -22,7 +22,6 @@ static void bmInitOption(SBnodeMgmt *pMgmt, SBnodeOpt *pOption) { SMsgCb msgCb = {0}; msgCb.pWrapper = pMgmt->pWrapper; msgCb.sendReqFp = dndSendReqToDnode; - msgCb.sendMnodeReqFp = dndSendReqToMnode; msgCb.sendRspFp = dndSendRsp; msgCb.registerBrokenLinkArgFp = dndRegisterBrokenLinkArg; pOption->msgCb = msgCb; diff --git a/source/dnode/mgmt/main/src/dndTransport.c b/source/dnode/mgmt/main/src/dndTransport.c index 07ea0309a8..a87937bc8d 100644 --- a/source/dnode/mgmt/main/src/dndTransport.c +++ b/source/dnode/mgmt/main/src/dndTransport.c @@ -398,7 +398,6 @@ SMsgCb dndCreateMsgcb(SMgmtWrapper *pWrapper) { .pWrapper = pWrapper, .registerBrokenLinkArgFp = dndRegisterBrokenLinkArg, .releaseHandleFp = dndReleaseHandle, - .sendMnodeReqFp = dndSendReqToMnode, .sendReqFp = dndSendReqToDnode, .sendRspFp = dndSendRsp, }; diff --git a/source/dnode/mgmt/mm/src/mmInt.c b/source/dnode/mgmt/mm/src/mmInt.c index f4e00b5921..301ca598e6 100644 --- a/source/dnode/mgmt/mm/src/mmInt.c +++ b/source/dnode/mgmt/mm/src/mmInt.c @@ -39,16 +39,11 @@ static int32_t mmRequire(SMgmtWrapper *pWrapper, bool *required) { } static void mmInitOption(SMnodeMgmt *pMgmt, SMnodeOpt *pOption) { - SMsgCb msgCb = {0}; - msgCb.pWrapper = pMgmt->pWrapper; + SMsgCb msgCb = dndCreateMsgcb(pMgmt->pWrapper); msgCb.queueFps[QUERY_QUEUE] = mmPutMsgToQueryQueue; msgCb.queueFps[READ_QUEUE] = mmPutMsgToReadQueue; msgCb.queueFps[WRITE_QUEUE] = mmPutMsgToWriteQueue; msgCb.queueFps[SYNC_QUEUE] = mmPutMsgToWriteQueue; - msgCb.sendReqFp = dndSendReqToDnode; - msgCb.sendMnodeReqFp = dndSendReqToMnode; - msgCb.sendRspFp = dndSendRsp; - msgCb.registerBrokenLinkArgFp = dndRegisterBrokenLinkArg; pOption->msgCb = msgCb; } diff --git a/source/dnode/mgmt/qm/src/qmInt.c b/source/dnode/mgmt/qm/src/qmInt.c index 11c80a2904..8079859b96 100644 --- a/source/dnode/mgmt/qm/src/qmInt.c +++ b/source/dnode/mgmt/qm/src/qmInt.c @@ -19,15 +19,10 @@ static int32_t qmRequire(SMgmtWrapper *pWrapper, bool *required) { return dndReadFile(pWrapper, required); } static void qmInitOption(SQnodeMgmt *pMgmt, SQnodeOpt *pOption) { - SMsgCb msgCb = {0}; - msgCb.pWrapper = pMgmt->pWrapper; + SMsgCb msgCb = dndCreateMsgcb(pMgmt->pWrapper); msgCb.queueFps[QUERY_QUEUE] = qmPutMsgToQueryQueue; msgCb.queueFps[FETCH_QUEUE] = qmPutMsgToFetchQueue; msgCb.qsizeFp = qmGetQueueSize; - msgCb.sendReqFp = dndSendReqToDnode; - msgCb.sendMnodeReqFp = dndSendReqToMnode; - msgCb.sendRspFp = dndSendRsp; - msgCb.registerBrokenLinkArgFp = dndRegisterBrokenLinkArg; pOption->msgCb = msgCb; } diff --git a/source/dnode/mgmt/sm/src/smInt.c b/source/dnode/mgmt/sm/src/smInt.c index a639fc76bb..6d2e2aaefd 100644 --- a/source/dnode/mgmt/sm/src/smInt.c +++ b/source/dnode/mgmt/sm/src/smInt.c @@ -19,12 +19,7 @@ static int32_t smRequire(SMgmtWrapper *pWrapper, bool *required) { return dndReadFile(pWrapper, required); } static void smInitOption(SSnodeMgmt *pMgmt, SSnodeOpt *pOption) { - SMsgCb msgCb = {0}; - msgCb.pWrapper = pMgmt->pWrapper; - msgCb.sendReqFp = dndSendReqToDnode; - msgCb.sendMnodeReqFp = dndSendReqToMnode; - msgCb.sendRspFp = dndSendRsp; - msgCb.registerBrokenLinkArgFp = dndRegisterBrokenLinkArg; + SMsgCb msgCb = dndCreateMsgcb(pMgmt->pWrapper); pOption->msgCb = msgCb; } diff --git a/source/dnode/mgmt/vm/src/vmInt.c b/source/dnode/mgmt/vm/src/vmInt.c index b52c6253dc..d9ef7b5ae6 100644 --- a/source/dnode/mgmt/vm/src/vmInt.c +++ b/source/dnode/mgmt/vm/src/vmInt.c @@ -128,16 +128,12 @@ static void *vmOpenVnodeFunc(void *param) { pMgmt->state.openVnodes, pMgmt->state.totalVnodes); dndReportStartup(pDnode, "open-vnodes", stepDesc); - SMsgCb msgCb = {0}; + SMsgCb msgCb = dndCreateMsgcb(pMgmt->pWrapper); msgCb.pWrapper = pMgmt->pWrapper; msgCb.queueFps[QUERY_QUEUE] = vmPutMsgToQueryQueue; msgCb.queueFps[FETCH_QUEUE] = vmPutMsgToFetchQueue; msgCb.queueFps[APPLY_QUEUE] = vmPutMsgToApplyQueue; msgCb.qsizeFp = vmGetQueueSize; - msgCb.sendReqFp = dndSendReqToDnode; - msgCb.sendMnodeReqFp = dndSendReqToMnode; - msgCb.sendRspFp = dndSendRsp; - msgCb.registerBrokenLinkArgFp = dndRegisterBrokenLinkArg; SVnodeCfg cfg = {.msgCb = msgCb, .pTfs = pMgmt->pTfs, .vgId = pCfg->vgId, .dbId = pCfg->dbUid}; SVnode *pImpl = vnodeOpen(pCfg->path, &cfg); if (pImpl == NULL) { diff --git a/source/dnode/mgmt/vm/src/vmMsg.c b/source/dnode/mgmt/vm/src/vmMsg.c index 89cf8dc5da..c3ad74d246 100644 --- a/source/dnode/mgmt/vm/src/vmMsg.c +++ b/source/dnode/mgmt/vm/src/vmMsg.c @@ -76,16 +76,12 @@ int32_t vmProcessCreateVnodeReq(SVnodesMgmt *pMgmt, SNodeMsg *pMsg) { return -1; } - SMsgCb msgCb = {0}; + SMsgCb msgCb = dndCreateMsgcb(pMgmt->pWrapper); msgCb.pWrapper = pMgmt->pWrapper; msgCb.queueFps[QUERY_QUEUE] = vmPutMsgToQueryQueue; msgCb.queueFps[FETCH_QUEUE] = vmPutMsgToFetchQueue; msgCb.queueFps[APPLY_QUEUE] = vmPutMsgToApplyQueue; msgCb.qsizeFp = vmGetQueueSize; - msgCb.sendReqFp = dndSendReqToDnode; - msgCb.sendMnodeReqFp = dndSendReqToMnode; - msgCb.sendRspFp = dndSendRsp; - msgCb.registerBrokenLinkArgFp = dndRegisterBrokenLinkArg; vnodeCfg.msgCb = msgCb; vnodeCfg.pTfs = pMgmt->pTfs; diff --git a/source/dnode/mnode/impl/src/mndProfile.c b/source/dnode/mnode/impl/src/mndProfile.c index 6c38d8626c..cad89399a3 100644 --- a/source/dnode/mnode/impl/src/mndProfile.c +++ b/source/dnode/mnode/impl/src/mndProfile.c @@ -433,12 +433,6 @@ static int32_t mndProcessHeartBeatReq(SNodeMsg *pReq) { pHeartbeat->connId = htonl(pHeartbeat->connId); pHeartbeat->pid = htonl(pHeartbeat->pid); - SRpcConnInfo info = {0}; - if (rpcGetConnInfo(pReq->rpcMsg.handle, &info) != 0) { - mError("user:%s, connId:%d failed to process hb since %s", pReq->user, pHeartbeat->connId, terrstr()); - return -1; - } - SConnObj *pConn = mndAcquireConn(pMnode, pHeartbeat->connId); if (pConn == NULL) { pConn = mndCreateConn(pMnode, &info, pHeartbeat->pid, pHeartbeat->app, 0); From 5015a6a78b252bbe523e5cd45c8a3e12f2a5df45 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 1 Apr 2022 21:27:47 +0800 Subject: [PATCH 55/68] shm --- include/util/tprocess.h | 4 +- source/dnode/mgmt/bm/src/bmInt.c | 6 +-- source/dnode/mgmt/main/inc/dnd.h | 2 +- source/dnode/mgmt/main/src/dndExec.c | 13 +++-- source/dnode/mgmt/main/src/dndTransport.c | 58 ++++++++++++----------- source/util/src/tprocess.c | 8 ++-- 6 files changed, 49 insertions(+), 42 deletions(-) diff --git a/include/util/tprocess.h b/include/util/tprocess.h index 3a47450eec..bc0c8fe5a4 100644 --- a/include/util/tprocess.h +++ b/include/util/tprocess.h @@ -22,7 +22,7 @@ extern "C" { #endif -typedef enum { PROC_REQ, PROC_RSP, PROC_REG, PROC_RELEASE } ProcFuncType; +typedef enum { PROC_QUEUE, PROC_REQ, PROC_RSP, PROC_REGIST, PROC_RELEASE } ProcFuncType; typedef struct SProcQueue SProcQueue; typedef struct SProcObj SProcObj; @@ -53,7 +53,7 @@ void taosProcCleanup(SProcObj *pProc); int32_t taosProcRun(SProcObj *pProc); int32_t taosProcPutToChildQ(SProcObj *pProc, const void *pHead, int16_t headLen, const void *pBody, int32_t bodyLen, ProcFuncType ftype); -int32_t taosProcPutToParentQ(SProcObj *pProc, const void *pHead, int16_t headLen, const void *pBody, int32_t bodyLen, +void taosProcPutToParentQ(SProcObj *pProc, const void *pHead, int16_t headLen, const void *pBody, int32_t bodyLen, ProcFuncType ftype); #ifdef __cplusplus diff --git a/source/dnode/mgmt/bm/src/bmInt.c b/source/dnode/mgmt/bm/src/bmInt.c index cbaf247a5b..4ca7afbb6d 100644 --- a/source/dnode/mgmt/bm/src/bmInt.c +++ b/source/dnode/mgmt/bm/src/bmInt.c @@ -19,11 +19,7 @@ static int32_t bmRequire(SMgmtWrapper *pWrapper, bool *required) { return dndReadFile(pWrapper, required); } static void bmInitOption(SBnodeMgmt *pMgmt, SBnodeOpt *pOption) { - SMsgCb msgCb = {0}; - msgCb.pWrapper = pMgmt->pWrapper; - msgCb.sendReqFp = dndSendReqToDnode; - msgCb.sendRspFp = dndSendRsp; - msgCb.registerBrokenLinkArgFp = dndRegisterBrokenLinkArg; + SMsgCb msgCb = dndCreateMsgcb(pMgmt->pWrapper); pOption->msgCb = msgCb; } diff --git a/source/dnode/mgmt/main/inc/dnd.h b/source/dnode/mgmt/main/inc/dnd.h index b9c760c980..255a739add 100644 --- a/source/dnode/mgmt/main/inc/dnd.h +++ b/source/dnode/mgmt/main/inc/dnd.h @@ -149,7 +149,7 @@ int32_t dndInitClient(SDnode *pDnode); void dndCleanupClient(SDnode *pDnode); int32_t dndProcessNodeMsg(SDnode *pDnode, SNodeMsg *pMsg); int32_t dndSendReqToMnode(SMgmtWrapper *pWrapper, SRpcMsg *pMsg); -int32_t dndSendReqToDnode(SMgmtWrapper *pWrapper, const SEpSet *pEpSet, SRpcMsg *pMsg); +int32_t dndSendReq(SMgmtWrapper *pWrapper, const SEpSet *pEpSet, SRpcMsg *pMsg); void dndSendRsp(SMgmtWrapper *pWrapper, const SRpcMsg *pRsp); void dndRegisterBrokenLinkArg(SMgmtWrapper *pWrapper, SRpcMsg *pMsg); SMsgCb dndCreateMsgcb(SMgmtWrapper *pWrapper); diff --git a/source/dnode/mgmt/main/src/dndExec.c b/source/dnode/mgmt/main/src/dndExec.c index 54cadb177a..8837da6d48 100644 --- a/source/dnode/mgmt/main/src/dndExec.c +++ b/source/dnode/mgmt/main/src/dndExec.c @@ -90,10 +90,10 @@ static void dndConsumeChildQueue(SMgmtWrapper *pWrapper, SNodeMsg *pMsg, int16_t static void dndConsumeParentQueue(SMgmtWrapper *pWrapper, SRpcMsg *pMsg, int16_t msgLen, void *pCont, int32_t contLen, ProcFuncType ftype) { pMsg->pCont = pCont; - dTrace("msg:%p, get from parent queue, handle:%p app:%p", pMsg, pMsg->handle, pMsg->ahandle); + dTrace("msg:%p, get from parent queue, ftype:%d handle:%p, app:%p", pMsg, ftype, pMsg->handle, pMsg->ahandle); switch (ftype) { - case PROC_REG: + case PROC_REGIST: rpcRegisterBrokenLinkArg(pMsg); break; case PROC_RELEASE: @@ -101,11 +101,14 @@ static void dndConsumeParentQueue(SMgmtWrapper *pWrapper, SRpcMsg *pMsg, int16_t rpcFreeCont(pCont); break; case PROC_REQ: - // todo send to dnode dndSendReqToMnode(pWrapper, pMsg); - default: + // dndSendReq(pWrapper, (const SEpSet *)((char *)pMsg + sizeof(SRpcMsg)), pMsg); + break; + case PROC_RSP: dndSendRpcRsp(pWrapper, pMsg); break; + default: + break; } taosMemoryFree(pMsg); } @@ -325,6 +328,8 @@ static int32_t dndRunInChildProcess(SDnode *pDnode) { } } + dndSetStatus(pDnode, DND_STAT_RUNNING); + if (taosProcRun(pWrapper->pProc) != 0) { dError("node:%s, failed to run proc since %s", pWrapper->name, terrstr()); return -1; diff --git a/source/dnode/mgmt/main/src/dndTransport.c b/source/dnode/mgmt/main/src/dndTransport.c index a87937bc8d..d463f2ba7a 100644 --- a/source/dnode/mgmt/main/src/dndTransport.c +++ b/source/dnode/mgmt/main/src/dndTransport.c @@ -319,22 +319,6 @@ static int32_t dndSendRpcReq(STransMgmt *pMgmt, const SEpSet *pEpSet, SRpcMsg *p return 0; } -int32_t dndSendReqToDnode(SMgmtWrapper *pWrapper, const SEpSet *pEpSet, SRpcMsg *pReq) { - if (pWrapper->procType != PROC_CHILD) { - SDnode *pDnode = pWrapper->pDnode; - if (dndGetStatus(pDnode) != DND_STAT_RUNNING) { - terrno = TSDB_CODE_DND_OFFLINE; - dError("failed to send rpc msg since %s, handle:%p", terrstr(), pReq->handle); - return -1; - } - return dndSendRpcReq(&pDnode->trans, pEpSet, pReq); - } else { - while (taosProcPutToParentQ(pWrapper->pProc, pReq, sizeof(SRpcMsg), pReq->pCont, pReq->contLen, PROC_REQ) != 0) { - taosMsleep(1); - } - } -} - int32_t dndSendReqToMnode(SMgmtWrapper *pWrapper, SRpcMsg *pReq) { SDnode *pDnode = pWrapper->pDnode; STransMgmt *pTrans = &pDnode->trans; @@ -362,13 +346,37 @@ void dndSendRpcRsp(SMgmtWrapper *pWrapper, const SRpcMsg *pRsp) { } } +int32_t dndSendReq(SMgmtWrapper *pWrapper, const SEpSet *pEpSet, SRpcMsg *pReq) { + SDnode *pDnode = pWrapper->pDnode; + if (dndGetStatus(pDnode) != DND_STAT_RUNNING) { + terrno = TSDB_CODE_DND_OFFLINE; + dError("failed to send rpc msg since %s, handle:%p", terrstr(), pReq->handle); + return -1; + } + + if (pWrapper->procType != PROC_CHILD) { + return dndSendRpcReq(&pDnode->trans, pEpSet, pReq); + } else { + int32_t headLen = sizeof(SRpcMsg) + sizeof(SEpSet); + char *pHead = taosMemoryMalloc(headLen); + if (pHead == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + return -1; + } + memcpy(pHead, pReq, sizeof(SRpcMsg)); + memcpy(pHead + sizeof(SRpcMsg), pEpSet, sizeof(SEpSet)); + + taosProcPutToParentQ(pWrapper->pProc, pReq, headLen, pReq->pCont, pReq->contLen, PROC_REQ); + taosMemoryFree(pHead); + return 0; + } +} + void dndSendRsp(SMgmtWrapper *pWrapper, const SRpcMsg *pRsp) { if (pWrapper->procType != PROC_CHILD) { dndSendRpcRsp(pWrapper, pRsp); } else { - while (taosProcPutToParentQ(pWrapper->pProc, pRsp, sizeof(SRpcMsg), pRsp->pCont, pRsp->contLen, PROC_RSP) != 0) { - taosMsleep(1); - } + taosProcPutToParentQ(pWrapper->pProc, pRsp, sizeof(SRpcMsg), pRsp->pCont, pRsp->contLen, PROC_RSP); } } @@ -376,9 +384,7 @@ void dndRegisterBrokenLinkArg(SMgmtWrapper *pWrapper, SRpcMsg *pMsg) { if (pWrapper->procType != PROC_CHILD) { rpcRegisterBrokenLinkArg(pMsg); } else { - while (taosProcPutToParentQ(pWrapper->pProc, pMsg, sizeof(SRpcMsg), pMsg->pCont, pMsg->contLen, PROC_REG) != 0) { - taosMsleep(1); - } + taosProcPutToParentQ(pWrapper->pProc, pMsg, sizeof(SRpcMsg), pMsg->pCont, pMsg->contLen, PROC_REGIST); } } @@ -387,19 +393,17 @@ static void dndReleaseHandle(SMgmtWrapper *pWrapper, void *handle, int8_t type) rpcReleaseHandle(handle, type); } else { SRpcMsg msg = {.handle = handle, .code = type}; - while (taosProcPutToParentQ(pWrapper->pProc, &msg, sizeof(SRpcMsg), NULL, 0, PROC_RELEASE) != 0) { - taosMsleep(1); - } + taosProcPutToParentQ(pWrapper->pProc, &msg, sizeof(SRpcMsg), NULL, 0, PROC_RELEASE); } } SMsgCb dndCreateMsgcb(SMgmtWrapper *pWrapper) { SMsgCb msgCb = { .pWrapper = pWrapper, + .sendReqFp = dndSendReq, + .sendRspFp = dndSendRsp, .registerBrokenLinkArgFp = dndRegisterBrokenLinkArg, .releaseHandleFp = dndReleaseHandle, - .sendReqFp = dndSendReqToDnode, - .sendRspFp = dndSendRsp, }; return msgCb; } \ No newline at end of file diff --git a/source/util/src/tprocess.c b/source/util/src/tprocess.c index 1d41bd4a48..600413068c 100644 --- a/source/util/src/tprocess.c +++ b/source/util/src/tprocess.c @@ -434,7 +434,9 @@ int32_t taosProcPutToChildQ(SProcObj *pProc, const void *pHead, int16_t headLen, return taosProcQueuePush(pProc->pChildQueue, pHead, headLen, pBody, bodyLen, ftype); } -int32_t taosProcPutToParentQ(SProcObj *pProc, const void *pHead, int16_t headLen, const void *pBody, int32_t bodyLen, - ProcFuncType ftype) { - return taosProcQueuePush(pProc->pParentQueue, pHead, headLen, pBody, bodyLen, ftype); +void taosProcPutToParentQ(SProcObj *pProc, const void *pHead, int16_t headLen, const void *pBody, int32_t bodyLen, + ProcFuncType ftype) { + while (taosProcQueuePush(pProc->pParentQueue, pHead, headLen, pBody, bodyLen, ftype) != 0) { + taosMsleep(1); + } } From adf8bd5e820fd43886e221116d818a29a04ef398 Mon Sep 17 00:00:00 2001 From: Liu Jicong Date: Fri, 1 Apr 2022 21:30:06 +0800 Subject: [PATCH 56/68] add log --- source/client/src/tmq.c | 36 +++++++--------------- source/dnode/mnode/impl/src/mndSubscribe.c | 2 +- source/dnode/mnode/sdb/src/sdbHash.c | 4 +++ 3 files changed, 16 insertions(+), 26 deletions(-) diff --git a/source/client/src/tmq.c b/source/client/src/tmq.c index f17df3e6f1..426a62433b 100644 --- a/source/client/src/tmq.c +++ b/source/client/src/tmq.c @@ -911,7 +911,7 @@ CREATE_MSG_FAIL: bool tmqUpdateEp(tmq_t* tmq, int32_t epoch, SMqCMGetSubEpRsp* pRsp) { /*printf("call update ep %d\n", epoch);*/ - /*printf("tmq update ep epoch %d to epoch %d\n", tmq->epoch, epoch);*/ + tscDebug("tmq update ep epoch %d to epoch %d", tmq->epoch, epoch); bool set = false; int32_t topicNumGet = taosArrayGetSize(pRsp->topics); char vgKey[TSDB_TOPIC_FNAME_LEN + 22]; @@ -984,6 +984,7 @@ bool tmqUpdateEp(tmq_t* tmq, int32_t epoch, SMqCMGetSubEpRsp* pRsp) { int32_t tmqAskEpCb(void* param, const SDataBuf* pMsg, int32_t code) { SMqAskEpCbParam* pParam = (SMqAskEpCbParam*)param; tmq_t* tmq = pParam->tmq; + tscDebug("consumer %ld recv ep", tmq->consumerId); if (code != 0) { tscError("get topic endpoint error, not ready, wait:%d\n", pParam->sync); goto END; @@ -1032,12 +1033,14 @@ END: int32_t tmqAskEp(tmq_t* tmq, bool sync) { int8_t epStatus = atomic_val_compare_exchange_8(&tmq->epStatus, 0, 1); if (epStatus == 1) { + tscDebug("consumer %ld skip ask ep", tmq->consumerId); return 0; } int32_t tlen = sizeof(SMqCMGetSubEpReq); SMqCMGetSubEpReq* req = taosMemoryMalloc(tlen); if (req == NULL) { tscError("failed to malloc get subscribe ep buf"); + atomic_store_8(&tmq->epStatus, 0); return -1; } req->consumerId = htobe64(tmq->consumerId); @@ -1048,6 +1051,7 @@ int32_t tmqAskEp(tmq_t* tmq, bool sync) { if (pParam == NULL) { tscError("failed to malloc subscribe param"); taosMemoryFree(req); + atomic_store_8(&tmq->epStatus, 0); return -1; } pParam->tmq = tmq; @@ -1059,6 +1063,7 @@ int32_t tmqAskEp(tmq_t* tmq, bool sync) { tsem_destroy(&pParam->rspSem); taosMemoryFree(pParam); taosMemoryFree(req); + atomic_store_8(&tmq->epStatus, 0); return -1; } @@ -1076,6 +1081,8 @@ int32_t tmqAskEp(tmq_t* tmq, bool sync) { SEpSet epSet = getEpSet_s(&tmq->pTscObj->pAppInfo->mgmtEp); + tscDebug("consumer %ld ask ep", tmq->consumerId); + int64_t transporterId = 0; asyncSendMsgToServer(tmq->pTscObj->pAppInfo->pTransporter, &epSet, &transporterId, sendInfo); @@ -1214,7 +1221,7 @@ int32_t tmqPollImpl(tmq_t* tmq, int64_t blockingTime) { SMqClientVg* pVg = taosArrayGet(pTopic->vgs, j); int32_t vgStatus = atomic_val_compare_exchange_32(&pVg->vgStatus, TMQ_VG_STATUS__IDLE, TMQ_VG_STATUS__WAIT); if (vgStatus != TMQ_VG_STATUS__IDLE) { - tscDebug("skip vg %d", pVg->vgId); + tscDebug("consumer %ld skip vg %d", tmq->consumerId, pVg->vgId); continue; } SMqPollReq* pReq = tmqBuildConsumeReqImpl(tmq, blockingTime, pTopic, pVg); @@ -1258,7 +1265,7 @@ int32_t tmqPollImpl(tmq_t* tmq, int64_t blockingTime) { int64_t transporterId = 0; /*printf("send poll\n");*/ atomic_add_fetch_32(&tmq->waitingRequest, 1); - tscDebug("tmq send poll: vg %d, req offset %ld", pVg->vgId, pVg->currentOffset); + tscDebug("consumer %ld send poll: vg %d, req offset %ld", tmq->consumerId, pVg->vgId, pVg->currentOffset); /*printf("send vg %d %ld\n", pVg->vgId, pVg->currentOffset);*/ asyncSendMsgToServer(tmq->pTscObj->pAppInfo->pTransporter, &pVg->epSet, &transporterId, sendInfo); pVg->pollCnt++; @@ -1322,7 +1329,7 @@ tmq_message_t* tmqHandleAllRsp(tmq_t* tmq, int64_t blockingTime, bool pollIfRese tmqHandleNoPollRsp(tmq, rspHead, &reset); taosFreeQitem(rspHead); if (pollIfReset && reset) { - tscDebug("reset and repoll\n"); + tscDebug("consumer %ld reset and repoll", tmq->consumerId); tmqPollImpl(tmq, blockingTime); } } @@ -1561,24 +1568,3 @@ TAOS_ROW tmq_get_row(tmq_message_t* message) { } char* tmq_get_topic_name(tmq_message_t* message) { return "not implemented yet"; } - -#if 0 -tmq_t* tmqCreateConsumerImpl(TAOS* conn, tmq_conf_t* conf) { - tmq_t* pTmq = taosMemoryMalloc(sizeof(tmq_t)); - if (pTmq == NULL) { - return NULL; - } - strcpy(pTmq->groupId, conf->groupId); - strcpy(pTmq->clientId, conf->clientId); - pTmq->pTscObj = (STscObj*)conn; - pTmq->pTscObj->connType = HEARTBEAT_TYPE_MQ; - return pTmq; -} - - -static void destroySendMsgInfo(SMsgSendInfo* pMsgBody) { - assert(pMsgBody != NULL); - taosMemoryFreeClear(pMsgBody->msgInfo.pData); - taosMemoryFreeClear(pMsgBody); -} -#endif diff --git a/source/dnode/mnode/impl/src/mndSubscribe.c b/source/dnode/mnode/impl/src/mndSubscribe.c index 1afbb74067..211163ce35 100644 --- a/source/dnode/mnode/impl/src/mndSubscribe.c +++ b/source/dnode/mnode/impl/src/mndSubscribe.c @@ -507,7 +507,7 @@ static int32_t mndProcessDoRebalanceMsg(SNodeMsg *pMsg) { // TODO: log rebalance statistics SSdbRaw *pSubRaw = mndSubActionEncode(pSub); - sdbSetRawStatus(pSubRaw, SDB_STATUS_UPDATING); + sdbSetRawStatus(pSubRaw, SDB_STATUS_READY); mndTransAppendRedolog(pTrans, pSubRaw); } mndReleaseSubscribe(pMnode, pSub); diff --git a/source/dnode/mnode/sdb/src/sdbHash.c b/source/dnode/mnode/sdb/src/sdbHash.c index 204cd870f4..dc2c12a2c4 100644 --- a/source/dnode/mnode/sdb/src/sdbHash.c +++ b/source/dnode/mnode/sdb/src/sdbHash.c @@ -40,6 +40,10 @@ const char *sdbTableName(ESdbType type) { return "auth"; case SDB_ACCT: return "acct"; + case SDB_STREAM: + return "stream"; + case SDB_OFFSET: + return "offset"; case SDB_SUBSCRIBE: return "subscribe"; case SDB_CONSUMER: From 8e8728a06924959ebc5a7034342c892708098835 Mon Sep 17 00:00:00 2001 From: Shengliang Date: Sat, 2 Apr 2022 09:47:55 +0800 Subject: [PATCH 57/68] [sync cases] --- tests/script/jenkins/basic.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index fc87776658..d8fbfce55f 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -40,7 +40,8 @@ # ---- tmq ./test.sh -f tsim/tmq/basic.sim ./test.sh -f tsim/tmq/basic1.sim -./test.sh -f tsim/tmq/oneTopic.sim +#./test.sh -f tsim/tmq/oneTopic.sim +#./test.sh -f tsim/tmq/multiTopic.sim # --- stable ./test.sh -f tsim/stable/disk.sim From 42231d76910c03cb51ba25f17f1282877f9bc643 Mon Sep 17 00:00:00 2001 From: afwerar <1296468573@qq.com> Date: Sat, 2 Apr 2022 10:31:07 +0800 Subject: [PATCH 58/68] [TD-13756]: log file open fail error. --- source/util/src/tlog.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/util/src/tlog.c b/source/util/src/tlog.c index ef15f44f8f..f5ca634099 100644 --- a/source/util/src/tlog.c +++ b/source/util/src/tlog.c @@ -347,12 +347,13 @@ static int32_t taosOpenLogFile(char *fn, int32_t maxLines, int32_t maxFileNum) { taosThreadMutexInit(&tsLogObj.logMutex, NULL); taosUmaskFile(0); - tsLogObj.logHandle->pFile = taosOpenFile(fileName, TD_FILE_CTEATE | TD_FILE_WRITE); + TdFilePtr pFile = taosOpenFile(fileName, TD_FILE_CTEATE | TD_FILE_WRITE); - if (tsLogObj.logHandle->pFile == NULL) { + if (pFile == NULL) { printf("\nfailed to open log file:%s, reason:%s\n", fileName, strerror(errno)); return -1; } + tsLogObj.logHandle->pFile = pFile; taosLockLogFile(tsLogObj.logHandle->pFile); // only an estimate for number of lines From e9f2c1cdc0c7892f0a4df3c75dc334db957c3115 Mon Sep 17 00:00:00 2001 From: afwerar <1296468573@qq.com> Date: Sat, 2 Apr 2022 10:33:35 +0800 Subject: [PATCH 59/68] [TD-13756]: log file open fail error. --- source/util/src/tlog.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source/util/src/tlog.c b/source/util/src/tlog.c index f5ca634099..11e6edf022 100644 --- a/source/util/src/tlog.c +++ b/source/util/src/tlog.c @@ -353,6 +353,7 @@ static int32_t taosOpenLogFile(char *fn, int32_t maxLines, int32_t maxFileNum) { printf("\nfailed to open log file:%s, reason:%s\n", fileName, strerror(errno)); return -1; } + taosCloseFile(&tsLogObj.logHandle->pFile); tsLogObj.logHandle->pFile = pFile; taosLockLogFile(tsLogObj.logHandle->pFile); From 37245334d5a7db37bfbc10e508a28c5d84dac722 Mon Sep 17 00:00:00 2001 From: Cary Xu Date: Sat, 2 Apr 2022 10:37:17 +0800 Subject: [PATCH 60/68] rollup sma grammar integrate --- include/common/tmsg.h | 9 +++--- include/common/ttypes.h | 1 + source/common/src/tmsg.c | 22 +++++++------- source/dnode/mnode/impl/src/mndStb.c | 39 ++++++++++++++++++++++++- source/dnode/vnode/src/vnd/vnodeWrite.c | 24 +++++++++++---- 5 files changed, 72 insertions(+), 23 deletions(-) diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 12909875d5..6ec7d8c75b 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -1395,11 +1395,10 @@ typedef struct { } SDDropTopicReq; typedef struct { - float xFilesFactor; - int8_t delayUnit; - int8_t nFuncIds; - int32_t* pFuncIds; - int64_t delay; + float xFilesFactor; + int32_t delay; + int8_t nFuncIds; + func_id_t* pFuncIds; } SRSmaParam; typedef struct SVCreateTbReq { diff --git a/include/common/ttypes.h b/include/common/ttypes.h index 19442af206..1cb398fb85 100644 --- a/include/common/ttypes.h +++ b/include/common/ttypes.h @@ -31,6 +31,7 @@ typedef int16_t col_id_t; typedef int8_t col_type_t; typedef int32_t col_bytes_t; typedef uint16_t schema_ver_t; +typedef int32_t func_id_t; #pragma pack(push, 1) typedef struct { diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index d75fa6e9c5..2a16b58565 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -314,13 +314,12 @@ int32_t tSerializeSVCreateTbReq(void **buf, SVCreateTbReq *pReq) { } if (pReq->rollup && pReq->stbCfg.pRSmaParam) { SRSmaParam *param = pReq->stbCfg.pRSmaParam; - tlen += taosEncodeFixedU32(buf, (uint32_t)param->xFilesFactor); - tlen += taosEncodeFixedI8(buf, param->delayUnit); + tlen += taosEncodeBinary(buf, (const void *)¶m->xFilesFactor, sizeof(param->xFilesFactor)); + tlen += taosEncodeFixedI32(buf, param->delay); tlen += taosEncodeFixedI8(buf, param->nFuncIds); for (int8_t i = 0; i < param->nFuncIds; ++i) { tlen += taosEncodeFixedI32(buf, param->pFuncIds[i]); } - tlen += taosEncodeFixedI64(buf, param->delay); } break; case TD_CHILD_TABLE: @@ -339,13 +338,12 @@ int32_t tSerializeSVCreateTbReq(void **buf, SVCreateTbReq *pReq) { } if (pReq->rollup && pReq->ntbCfg.pRSmaParam) { SRSmaParam *param = pReq->ntbCfg.pRSmaParam; - tlen += taosEncodeFixedU32(buf, (uint32_t)param->xFilesFactor); - tlen += taosEncodeFixedI8(buf, param->delayUnit); + tlen += taosEncodeBinary(buf, (const void *)¶m->xFilesFactor, sizeof(param->xFilesFactor)); + tlen += taosEncodeFixedI32(buf, param->delay); tlen += taosEncodeFixedI8(buf, param->nFuncIds); for (int8_t i = 0; i < param->nFuncIds; ++i) { tlen += taosEncodeFixedI32(buf, param->pFuncIds[i]); } - tlen += taosEncodeFixedI64(buf, param->delay); } break; default: @@ -387,17 +385,17 @@ void *tDeserializeSVCreateTbReq(void *buf, SVCreateTbReq *pReq) { if (pReq->rollup) { pReq->stbCfg.pRSmaParam = (SRSmaParam *)taosMemoryMalloc(sizeof(SRSmaParam)); SRSmaParam *param = pReq->stbCfg.pRSmaParam; - buf = taosDecodeFixedU32(buf, (uint32_t *)¶m->xFilesFactor); - buf = taosDecodeFixedI8(buf, ¶m->delayUnit); + buf = taosDecodeBinaryTo(buf, (void*)¶m->xFilesFactor, sizeof(param->xFilesFactor)); + buf = taosDecodeFixedI32(buf, ¶m->delay); buf = taosDecodeFixedI8(buf, ¶m->nFuncIds); if (param->nFuncIds > 0) { + param->pFuncIds = (func_id_t *)taosMemoryMalloc(param->nFuncIds * sizeof(func_id_t)); for (int8_t i = 0; i < param->nFuncIds; ++i) { buf = taosDecodeFixedI32(buf, param->pFuncIds + i); } } else { param->pFuncIds = NULL; } - buf = taosDecodeFixedI64(buf, ¶m->delay); } else { pReq->stbCfg.pRSmaParam = NULL; } @@ -420,17 +418,17 @@ void *tDeserializeSVCreateTbReq(void *buf, SVCreateTbReq *pReq) { if (pReq->rollup) { pReq->ntbCfg.pRSmaParam = (SRSmaParam *)taosMemoryMalloc(sizeof(SRSmaParam)); SRSmaParam *param = pReq->ntbCfg.pRSmaParam; - buf = taosDecodeFixedU32(buf, (uint32_t *)¶m->xFilesFactor); - buf = taosDecodeFixedI8(buf, ¶m->delayUnit); + buf = taosDecodeBinaryTo(buf, (void*)¶m->xFilesFactor, sizeof(param->xFilesFactor)); + buf = taosDecodeFixedI32(buf, ¶m->delay); buf = taosDecodeFixedI8(buf, ¶m->nFuncIds); if (param->nFuncIds > 0) { + param->pFuncIds = (func_id_t *)taosMemoryMalloc(param->nFuncIds * sizeof(func_id_t)); for (int8_t i = 0; i < param->nFuncIds; ++i) { buf = taosDecodeFixedI32(buf, param->pFuncIds + i); } } else { param->pFuncIds = NULL; } - buf = taosDecodeFixedI64(buf, ¶m->delay); } else { pReq->ntbCfg.pRSmaParam = NULL; } diff --git a/source/dnode/mnode/impl/src/mndStb.c b/source/dnode/mnode/impl/src/mndStb.c index f3fda102f4..85e7ade462 100644 --- a/source/dnode/mnode/impl/src/mndStb.c +++ b/source/dnode/mnode/impl/src/mndStb.c @@ -354,6 +354,7 @@ static void *mndBuildVCreateStbReq(SMnode *pMnode, SVgObj *pVgroup, SStbObj *pSt req.name = (char *)tNameGetTableName(&name); req.ttl = 0; req.keep = 0; + req.rollup = pStb->aggregationMethod > -1 ? 1 : 0; req.type = TD_SUPER_TABLE; req.stbCfg.suid = pStb->uid; req.stbCfg.nCols = pStb->numOfColumns; @@ -365,7 +366,7 @@ static void *mndBuildVCreateStbReq(SMnode *pMnode, SVgObj *pVgroup, SStbObj *pSt terrno = TSDB_CODE_OUT_OF_MEMORY; return NULL; } - + int bSmaStat = 0; // no column has bsma if (pStb->numOfSmas == pStb->numOfColumns) { // assume pColumns > 0 bSmaStat = 1; // all columns have bsma @@ -405,9 +406,38 @@ static void *mndBuildVCreateStbReq(SMnode *pMnode, SVgObj *pVgroup, SStbObj *pSt } } + SRSmaParam *pRSmaParam = NULL; + if (req.rollup) { + pRSmaParam = (SRSmaParam *)taosMemoryCalloc(1, sizeof(SRSmaParam)); + if (pRSmaParam == NULL) { + taosMemoryFreeClear(req.stbCfg.pSchema); + terrno = TSDB_CODE_OUT_OF_MEMORY; + return NULL; + } + + pRSmaParam->xFilesFactor = pStb->xFilesFactor; + pRSmaParam->delay = pStb->delay; + pRSmaParam->nFuncIds = 1; // only 1 aggregation method supported currently + pRSmaParam->pFuncIds = (func_id_t *)taosMemoryCalloc(pRSmaParam->nFuncIds, sizeof(func_id_t)); + if (pRSmaParam->pFuncIds == NULL) { + taosMemoryFreeClear(req.stbCfg.pRSmaParam); + taosMemoryFreeClear(req.stbCfg.pSchema); + terrno = TSDB_CODE_OUT_OF_MEMORY; + return NULL; + } + for (int32_t f = 0; f < pRSmaParam->nFuncIds; ++f) { + *(pRSmaParam->pFuncIds + f) = pStb->aggregationMethod; + } + req.stbCfg.pRSmaParam = pRSmaParam; + } + int32_t contLen = tSerializeSVCreateTbReq(NULL, &req) + sizeof(SMsgHead); SMsgHead *pHead = taosMemoryMalloc(contLen); if (pHead == NULL) { + if (pRSmaParam) { + taosMemoryFreeClear(pRSmaParam->pFuncIds); + taosMemoryFreeClear(pRSmaParam); + } taosMemoryFreeClear(req.stbCfg.pSchema); terrno = TSDB_CODE_OUT_OF_MEMORY; return NULL; @@ -420,6 +450,10 @@ static void *mndBuildVCreateStbReq(SMnode *pMnode, SVgObj *pVgroup, SStbObj *pSt tSerializeSVCreateTbReq(&pBuf, &req); *pContLen = contLen; + if (pRSmaParam) { + taosMemoryFreeClear(pRSmaParam->pFuncIds); + taosMemoryFreeClear(pRSmaParam); + } taosMemoryFreeClear(req.stbCfg.pSchema); return pHead; } @@ -632,6 +666,9 @@ static int32_t mndCreateStb(SMnode *pMnode, SNodeMsg *pReq, SMCreateStbReq *pCre stbObj.dbUid = pDb->uid; stbObj.version = 1; stbObj.nextColId = 1; + stbObj.xFilesFactor = pCreate->xFilesFactor; + stbObj.aggregationMethod = pCreate->aggregationMethod; + stbObj.delay = pCreate->delay; stbObj.ttl = pCreate->ttl; stbObj.numOfColumns = pCreate->numOfColumns; stbObj.numOfTags = pCreate->numOfTags; diff --git a/source/dnode/vnode/src/vnd/vnodeWrite.c b/source/dnode/vnode/src/vnd/vnodeWrite.c index 59b027e370..7ef0b50402 100644 --- a/source/dnode/vnode/src/vnd/vnodeWrite.c +++ b/source/dnode/vnode/src/vnd/vnodeWrite.c @@ -78,10 +78,13 @@ int vnodeApplyWMsg(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) { // TODO: handle error } - // TODO: maybe need to clear the request struct + // TODO: to encapsule a free API taosMemoryFree(vCreateTbReq.stbCfg.pSchema); taosMemoryFree(vCreateTbReq.stbCfg.pTagSchema); - taosMemoryFree(vCreateTbReq.stbCfg.pRSmaParam); + if(vCreateTbReq.stbCfg.pRSmaParam) { + taosMemoryFree(vCreateTbReq.stbCfg.pRSmaParam->pFuncIds); + taosMemoryFree(vCreateTbReq.stbCfg.pRSmaParam); + } taosMemoryFree(vCreateTbReq.dbFName); taosMemoryFree(vCreateTbReq.name); break; @@ -110,17 +113,24 @@ int vnodeApplyWMsg(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) { // TODO: handle error vError("vgId:%d, failed to create table: %s", pVnode->vgId, pCreateTbReq->name); } + // TODO: to encapsule a free API taosMemoryFree(pCreateTbReq->name); taosMemoryFree(pCreateTbReq->dbFName); if (pCreateTbReq->type == TD_SUPER_TABLE) { taosMemoryFree(pCreateTbReq->stbCfg.pSchema); taosMemoryFree(pCreateTbReq->stbCfg.pTagSchema); - taosMemoryFree(pCreateTbReq->stbCfg.pRSmaParam); + if (pCreateTbReq->stbCfg.pRSmaParam) { + taosMemoryFree(pCreateTbReq->stbCfg.pRSmaParam->pFuncIds); + taosMemoryFree(pCreateTbReq->stbCfg.pRSmaParam); + } } else if (pCreateTbReq->type == TD_CHILD_TABLE) { taosMemoryFree(pCreateTbReq->ctbCfg.pTag); } else { taosMemoryFree(pCreateTbReq->ntbCfg.pSchema); - taosMemoryFree(pCreateTbReq->ntbCfg.pRSmaParam); + if (pCreateTbReq->ntbCfg.pRSmaParam) { + taosMemoryFree(pCreateTbReq->ntbCfg.pRSmaParam->pFuncIds); + taosMemoryFree(pCreateTbReq->ntbCfg.pRSmaParam); + } } } @@ -145,9 +155,13 @@ int vnodeApplyWMsg(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) { SVCreateTbReq vAlterTbReq = {0}; vTrace("vgId:%d, process alter stb req", pVnode->vgId); tDeserializeSVCreateTbReq(POINTER_SHIFT(pMsg->pCont, sizeof(SMsgHead)), &vAlterTbReq); + // TODO: to encapsule a free API taosMemoryFree(vAlterTbReq.stbCfg.pSchema); taosMemoryFree(vAlterTbReq.stbCfg.pTagSchema); - taosMemoryFree(vAlterTbReq.stbCfg.pRSmaParam); + if (vAlterTbReq.stbCfg.pRSmaParam) { + taosMemoryFree(vAlterTbReq.stbCfg.pRSmaParam->pFuncIds); + taosMemoryFree(vAlterTbReq.stbCfg.pRSmaParam); + } taosMemoryFree(vAlterTbReq.dbFName); taosMemoryFree(vAlterTbReq.name); break; From 62856b045ef2c4f5272aa73274762991a3a2f9ca Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Fri, 1 Apr 2022 22:37:47 -0400 Subject: [PATCH 61/68] insert using implement --- source/libs/parser/inc/parInsertData.h | 1 - source/libs/parser/inc/sql.y | 11 ++--- source/libs/parser/src/parInsert.c | 62 ++++++++++++++++++++++---- source/libs/parser/src/parTokenizer.c | 10 ++--- 4 files changed, 65 insertions(+), 19 deletions(-) diff --git a/source/libs/parser/inc/parInsertData.h b/source/libs/parser/inc/parInsertData.h index dbf7d379ec..5894fc88cc 100644 --- a/source/libs/parser/inc/parInsertData.h +++ b/source/libs/parser/inc/parInsertData.h @@ -77,7 +77,6 @@ typedef struct STableDataBlocks { STableMeta *pTableMeta; // the tableMeta of current table, the table meta will be used during submit, keep a ref to avoid to be removed from cache char *pData; bool cloned; - STagData tagData; SParsedDataColInfo boundColumnInfo; SRowBuilder rowBuilder; diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index 29b1d8857a..32020ee7f1 100644 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -550,11 +550,12 @@ column_reference(A) ::= column_name(B). column_reference(A) ::= table_name(B) NK_DOT column_name(C). { A = createRawExprNodeExt(pCxt, &B, &C, createColumnNode(pCxt, &B, &C)); } //pseudo_column(A) ::= NK_NOW. { A = createFunctionNode(pCxt, NULL, NULL); } -pseudo_column(A) ::= NK_UNDERLINE(B) ROWTS(C). { - SToken t = B; - t.n = (C.z + C.n) - B.z; - A = createRawExprNode(pCxt, &t, createFunctionNode(pCxt, &t, NULL)); - } +//pseudo_column(A) ::= NK_UNDERLINE(B) ROWTS(C). { +// SToken t = B; +// t.n = (C.z + C.n) - B.z; +// A = createRawExprNode(pCxt, &t, createFunctionNode(pCxt, &t, NULL)); +// } +pseudo_column(A) ::= ROWTS(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } pseudo_column(A) ::= TBNAME(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } pseudo_column(A) ::= NK_UNDERLINE(B) QSTARTTS(C). { SToken t = B; diff --git a/source/libs/parser/src/parInsert.c b/source/libs/parser/src/parInsert.c index 11b552fb94..d7eb31b6cd 100644 --- a/source/libs/parser/src/parInsert.c +++ b/source/libs/parser/src/parInsert.c @@ -55,8 +55,10 @@ typedef struct SInsertParseContext { STableMeta* pTableMeta; // each table SParsedDataColInfo tags; // each table SKVRowBuilder tagsBuilder; // each table + SVCreateTbReq createTblReq; // each table SHashObj* pVgroupsHashObj; // global SHashObj* pTableBlockHashObj; // global + SHashObj* pSubTableHashObj; // global SArray* pTableDataBlocks; // global SArray* pVgDataBlocks; // global int32_t totalNum; @@ -738,8 +740,20 @@ static int32_t KvRowAppend(SMsgBuf* pMsgBuf, const void *value, int32_t len, voi return TSDB_CODE_SUCCESS; } +static int32_t buildCreateTbReq(SInsertParseContext* pCxt, const SName* pName, SKVRow row) { + char dbFName[TSDB_DB_FNAME_LEN] = {0}; + tNameGetFullDbName(pName, dbFName); + pCxt->createTblReq.type = TD_CHILD_TABLE; + pCxt->createTblReq.dbFName = strdup(dbFName); + pCxt->createTblReq.name = strdup(pName->tname); + pCxt->createTblReq.ctbCfg.suid = pCxt->pTableMeta->suid; + pCxt->createTblReq.ctbCfg.pTag = row; + + return TSDB_CODE_SUCCESS; +} + // pSql -> tag1_value, ...) -static int32_t parseTagsClause(SInsertParseContext* pCxt, SSchema* pTagsSchema, uint8_t precision) { +static int32_t parseTagsClause(SInsertParseContext* pCxt, SSchema* pTagsSchema, uint8_t precision, const SName* pName) { if (tdInitKVRowBuilder(&pCxt->tagsBuilder) < 0) { return TSDB_CODE_TSC_OUT_OF_MEMORY; } @@ -760,23 +774,46 @@ static int32_t parseTagsClause(SInsertParseContext* pCxt, SSchema* pTagsSchema, } tdSortKVRowByColIdx(row); - // todo construct payload + return buildCreateTbReq(pCxt, pName, row); +} - taosMemoryFreeClear(row); +static int32_t cloneTableMeta(STableMeta* pSrc, STableMeta** pDst) { + *pDst = taosMemoryMalloc(TABLE_META_SIZE(pSrc)); + if (NULL == *pDst) { + return TSDB_CODE_TSC_OUT_OF_MEMORY; + } + memcpy(*pDst, pSrc, TABLE_META_SIZE(pSrc)); + return TSDB_CODE_SUCCESS; +} - return 0; +static int32_t storeTableMeta(SHashObj* pHash, const char* pName, int32_t len, STableMeta* pMeta) { + STableMeta* pBackup = NULL; + if (TSDB_CODE_SUCCESS != cloneTableMeta(pMeta, &pBackup)) { + return TSDB_CODE_TSC_OUT_OF_MEMORY; + } + return taosHashPut(pHash, pName, len, &pBackup, POINTER_BYTES); } // pSql -> stb_name [(tag1_name, ...)] TAGS (tag1_value, ...) static int32_t parseUsingClause(SInsertParseContext* pCxt, SToken* pTbnameToken) { - SToken sToken; + SName name; + createSName(&name, pTbnameToken, pCxt->pComCxt, &pCxt->msg); + char tbFName[TSDB_TABLE_FNAME_LEN]; + tNameExtractFullName(&name, tbFName); + int32_t len = strlen(tbFName); + STableMeta** pMeta = taosHashGet(pCxt->pSubTableHashObj, tbFName, len); + if (NULL != pMeta) { + return cloneTableMeta(*pMeta, &pCxt->pTableMeta); + } + SToken sToken; // pSql -> stb_name [(tag1_name, ...)] TAGS (tag1_value, ...) NEXT_TOKEN(pCxt->pSql, sToken); CHECK_CODE(getTableMeta(pCxt, &sToken)); if (TSDB_SUPER_TABLE != pCxt->pTableMeta->tableType) { return buildInvalidOperationMsg(&pCxt->msg, "create table only from super table is allowed"); } + CHECK_CODE(storeTableMeta(pCxt->pSubTableHashObj, tbFName, len, pCxt->pTableMeta)); SSchema* pTagsSchema = getTableTagSchema(pCxt->pTableMeta); setBoundColumnInfo(&pCxt->tags, pTagsSchema, getNumOfTags(pCxt->pTableMeta)); @@ -796,7 +833,7 @@ static int32_t parseUsingClause(SInsertParseContext* pCxt, SToken* pTbnameToken) if (TK_NK_LP != sToken.type) { return buildSyntaxErrMsg(&pCxt->msg, "( is expected", sToken.z); } - CHECK_CODE(parseTagsClause(pCxt, pTagsSchema, getTableInfo(pCxt->pTableMeta).precision)); + CHECK_CODE(parseTagsClause(pCxt, pTagsSchema, getTableInfo(pCxt->pTableMeta).precision, &name)); return TSDB_CODE_SUCCESS; } @@ -904,10 +941,17 @@ static int32_t parseValuesClause(SInsertParseContext* pCxt, STableDataBlocks* da return TSDB_CODE_SUCCESS; } +static void destroyCreateSubTbReq(SVCreateTbReq* pReq) { + taosMemoryFreeClear(pReq->dbFName); + taosMemoryFreeClear(pReq->name); + taosMemoryFreeClear(pReq->ctbCfg.pTag); +} + static void destroyInsertParseContextForTable(SInsertParseContext* pCxt) { taosMemoryFreeClear(pCxt->pTableMeta); destroyBoundColumnInfo(&pCxt->tags); tdDestroyKVRowBuilder(&pCxt->tagsBuilder); + destroyCreateSubTbReq(&pCxt->createTblReq); } static void destroyDataBlock(STableDataBlocks* pDataBlock) { @@ -972,7 +1016,7 @@ static int32_t parseInsertBody(SInsertParseContext* pCxt) { STableDataBlocks *dataBuf = NULL; CHECK_CODE(getDataBlockFromList(pCxt->pTableBlockHashObj, pCxt->pTableMeta->uid, TSDB_DEFAULT_PAYLOAD_SIZE, sizeof(SSubmitBlk), getTableInfo(pCxt->pTableMeta).rowSize, pCxt->pTableMeta, &dataBuf, NULL)); - + if (TK_NK_LP == sToken.type) { // pSql -> field1_name, ...) CHECK_CODE(parseBoundColumns(pCxt, &dataBuf->boundColumnInfo, getTableColumnSchema(pCxt->pTableMeta))); @@ -1021,11 +1065,13 @@ int32_t parseInsertSql(SParseContext* pContext, SQuery** pQuery) { .pTableMeta = NULL, .pVgroupsHashObj = taosHashInit(128, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, false), .pTableBlockHashObj = taosHashInit(128, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), true, false), + .pSubTableHashObj = taosHashInit(128, taosGetDefaultHashFunction(TSDB_DATA_TYPE_VARCHAR), true, false), .totalNum = 0, .pOutput = (SVnodeModifOpStmt*)nodesMakeNode(QUERY_NODE_VNODE_MODIF_STMT) }; - if (NULL == context.pVgroupsHashObj || NULL == context.pTableBlockHashObj || NULL == context.pOutput) { + if (NULL == context.pVgroupsHashObj || NULL == context.pTableBlockHashObj || + NULL == context.pSubTableHashObj || NULL == context.pOutput) { return TSDB_CODE_TSC_OUT_OF_MEMORY; } diff --git a/source/libs/parser/src/parTokenizer.c b/source/libs/parser/src/parTokenizer.c index d89bee6fdc..8149eeeb26 100644 --- a/source/libs/parser/src/parTokenizer.c +++ b/source/libs/parser/src/parTokenizer.c @@ -138,7 +138,7 @@ static SKeyword keywordTable[] = { {"RESET", TK_RESET}, {"RETENTIONS", TK_RETENTIONS}, {"ROLLUP", TK_ROLLUP}, - {"ROWTS", TK_ROWTS}, + {"_ROWTS", TK_ROWTS}, {"SCORES", TK_SCORES}, {"SELECT", TK_SELECT}, {"SESSION", TK_SESSION}, @@ -440,10 +440,10 @@ uint32_t tGetToken(const char* z, uint32_t* tokenId) { *tokenId = TK_NK_QUESTION; return 1; } - case '_': { - *tokenId = TK_NK_UNDERLINE; - return 1; - } + // case '_': { + // *tokenId = TK_NK_UNDERLINE; + // return 1; + // } case '`': case '\'': case '"': { From aa20f058315f6e70d5e8b46658ad49c5d1ae9742 Mon Sep 17 00:00:00 2001 From: plum-lihui Date: Sat, 2 Apr 2022 10:47:54 +0800 Subject: [PATCH 62/68] [modify] --- tests/test-all.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/test-all.sh b/tests/test-all.sh index aa7c4240bc..ff9905e209 100755 --- a/tests/test-all.sh +++ b/tests/test-all.sh @@ -91,20 +91,23 @@ function runSimCaseOneByOnefq { for ((i=$start;i<=$end;i++)) ; do line=`sed -n "$i"p jenkins/basic.txt` if [[ $line =~ ^./test.sh* ]] || [[ $line =~ ^run* ]]; then - case=`echo $line | grep sim$ |awk '{print $NF}'` + #case=`echo $line | grep sim$ |awk '{print $NF}'` + case=`echo $line | grep -o ".*\.sim" |awk '{print $NF}'` start_time=`date +%s` date +%F\ %T | tee -a out.log if [[ "$tests_dir" == *"$IN_TDINTERNAL"* ]]; then - echo -n $case - ./test.sh -f $case > case.log 2>&1 \ + #echo -n $case + echo -n $line + $line > case.log 2>&1 \ && \ ([ -f ../../../sim/tsim/log/taoslog0.0 ] && grep -q 'script.*'$case'.*failed.*, err.*lineNum' ../../../sim/tsim/log/taoslog0.0 && echo -e "${RED} failed${NC}" | tee -a out.log || echo -e "${GREEN} success${NC}" | tee -a out.log )|| \ ([ -f ../../../sim/tsim/log/taoslog0.0 ] && grep -q 'script.*success.*m$' ../../../sim/tsim/log/taoslog0.0 && echo -e "${GREEN} success${NC}" | tee -a out.log ) || \ ( echo -e "${RED} failed${NC}" | tee -a out.log && echo '=====================log=====================' && cat case.log ) else - echo -n $case - ./test.sh -f $case > ../../sim/case.log 2>&1 && \ + #echo -n $case + echo -n $line + $line > ../../sim/case.log 2>&1 && \ ([ -f ../../sim/tsim/log/taoslog0.0 ] && grep -q 'script.*'$case'.*failed.*, err.*lineNum' ../../sim/tsim/log/taoslog0.0 && echo -e "${RED} failed${NC}" | tee -a out.log || echo -e "${GREEN} success${NC}" | tee -a out.log )|| \ ([ -f ../../sim/tsim/log/taoslog0.0 ] && grep -q 'script.*success.*m$' ../../sim/tsim/log/taoslog0.0 && echo -e "${GREEN} success${NC}" | tee -a out.log ) || \ ( echo -e "${RED} failed${NC}" | tee -a out.log && echo '=====================log=====================' && pwd && cat ../../sim/case.log ) From 131bf46854b1afdc01185c6a483efe3d60376b26 Mon Sep 17 00:00:00 2001 From: afwerar <1296468573@qq.com> Date: Sat, 2 Apr 2022 10:51:46 +0800 Subject: [PATCH 63/68] [TD-13756]: log file open fail error. --- source/util/src/tlog.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/util/src/tlog.c b/source/util/src/tlog.c index 11e6edf022..fe02070bcb 100644 --- a/source/util/src/tlog.c +++ b/source/util/src/tlog.c @@ -353,7 +353,9 @@ static int32_t taosOpenLogFile(char *fn, int32_t maxLines, int32_t maxFileNum) { printf("\nfailed to open log file:%s, reason:%s\n", fileName, strerror(errno)); return -1; } - taosCloseFile(&tsLogObj.logHandle->pFile); + TdFilePtr pOldFile = tsLogObj.logHandle->pFile; + taosUnLockLogFile(pOldFile); + taosCloseFile(&pOldFile); tsLogObj.logHandle->pFile = pFile; taosLockLogFile(tsLogObj.logHandle->pFile); From 563500862f6eaf0a6f1b8a08e252f03ac2c14371 Mon Sep 17 00:00:00 2001 From: afwerar <1296468573@qq.com> Date: Sat, 2 Apr 2022 10:54:17 +0800 Subject: [PATCH 64/68] [TD-13756]: log file open fail error. --- source/util/src/tlog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/util/src/tlog.c b/source/util/src/tlog.c index fe02070bcb..1f26ab7c51 100644 --- a/source/util/src/tlog.c +++ b/source/util/src/tlog.c @@ -354,9 +354,9 @@ static int32_t taosOpenLogFile(char *fn, int32_t maxLines, int32_t maxFileNum) { return -1; } TdFilePtr pOldFile = tsLogObj.logHandle->pFile; + tsLogObj.logHandle->pFile = pFile; taosUnLockLogFile(pOldFile); taosCloseFile(&pOldFile); - tsLogObj.logHandle->pFile = pFile; taosLockLogFile(tsLogObj.logHandle->pFile); // only an estimate for number of lines From ed2fa5a8fad88338f544f389b069b5e711b17bbc Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Sat, 2 Apr 2022 11:21:27 +0800 Subject: [PATCH 65/68] fix uv crash --- source/os/src/osProc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/os/src/osProc.c b/source/os/src/osProc.c index 262160c033..1cdd41ad78 100644 --- a/source/os/src/osProc.c +++ b/source/os/src/osProc.c @@ -23,9 +23,9 @@ int32_t taosNewProc(char **args) { int32_t pid = fork(); if (pid == 0) { args[0] = tsProcPath; - close(STDIN_FILENO); + // close(STDIN_FILENO); close(STDOUT_FILENO); - close(STDERR_FILENO); + // close(STDERR_FILENO); return execvp(tsProcPath, args); } else { return pid; From 12513f444a6cb74bf3de23a71c5bbe0f39b85f25 Mon Sep 17 00:00:00 2001 From: plum-lihui Date: Sat, 2 Apr 2022 11:46:34 +0800 Subject: [PATCH 66/68] [add case] --- tests/script/tsim/query/session.sim | 425 +++++++++++++++++----------- 1 file changed, 267 insertions(+), 158 deletions(-) diff --git a/tests/script/tsim/query/session.sim b/tests/script/tsim/query/session.sim index 43923fc572..98f63f42e3 100644 --- a/tests/script/tsim/query/session.sim +++ b/tests/script/tsim/query/session.sim @@ -27,7 +27,15 @@ sql connect $vgroups = 4 $dbNamme = d0 -print =============== create database $dbNamme vgroups $vgroups +print ====> create database d1 precision 'us' +sql create database d1 precision 'us' +sql use d1 +sql create table dev_001 (ts timestamp ,i timestamp ,j int) +sql insert into dev_001 values(1623046993681000,now,1)(1623046993681001,now+1s,2)(1623046993681002,now+2s,3)(1623046993681004,now+5s,4) +sql create table secondts(ts timestamp,t2 timestamp,i int) +sql insert into secondts values(1623046993681000,now,1)(1623046993681001,now+1s,2)(1623046993681002,now+2s,3)(1623046993681004,now+5s,4) + +print ====> create database $dbNamme vgroups $vgroups sql create database $dbNamme vgroups $vgroups sql show databases print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 @@ -41,17 +49,33 @@ sql create table if not exists st (ts timestamp, tagtype int) tags(dev nchar(50) sql create table if not exists dev_001 using st tags("dev_01", "tag_01") sql create table if not exists dev_002 using st tags("dev_02", "tag_02") -sql INSERT INTO dev_001 VALUES('2020-05-13 10:00:00.000', 1)('2020-05-13 10:00:00.005', 2)('2020-05-13 10:00:00.011', 3) -sql INSERT INTO dev_001 VALUES('2020-05-13 10:00:01.011', 4)('2020-05-13 10:00:01.611', 5)('2020-05-13 10:00:02.612', 6) -sql INSERT INTO dev_001 VALUES('2020-05-13 10:01:02.612', 7)('2020-05-13 10:02:02.612', 8)('2020-05-13 10:03:02.613', 9) -sql INSERT INTO dev_001 VALUES('2020-05-13 11:00:00.000', 10)('2020-05-13 12:00:00.000', 11)('2020-05-13 13:00:00.001', 12) -sql INSERT INTO dev_001 VALUES('2020-05-14 13:00:00.001', 13)('2020-05-15 14:00:00.000', 14)('2020-05-20 10:00:00.000', 15) +sql INSERT INTO dev_001 VALUES('2020-05-13 10:00:00.000', 1) +sql INSERT INTO dev_001 VALUES('2020-05-13 10:00:00.005', 2) +sql INSERT INTO dev_001 VALUES('2020-05-13 10:00:00.011', 3) +sql INSERT INTO dev_001 VALUES('2020-05-13 10:00:01.011', 4) +sql INSERT INTO dev_001 VALUES('2020-05-13 10:00:01.611', 5) +sql INSERT INTO dev_001 VALUES('2020-05-13 10:00:02.612', 6) +sql INSERT INTO dev_001 VALUES('2020-05-13 10:01:02.612', 7) +sql INSERT INTO dev_001 VALUES('2020-05-13 10:02:02.612', 8) +sql INSERT INTO dev_001 VALUES('2020-05-13 10:03:02.613', 9) +sql INSERT INTO dev_001 VALUES('2020-05-13 11:00:00.000', 10) +sql INSERT INTO dev_001 VALUES('2020-05-13 12:00:00.000', 11) +sql INSERT INTO dev_001 VALUES('2020-05-13 13:00:00.001', 12) +sql INSERT INTO dev_001 VALUES('2020-05-14 13:00:00.001', 13) +sql INSERT INTO dev_001 VALUES('2020-05-15 14:00:00.000', 14) +sql INSERT INTO dev_001 VALUES('2020-05-20 10:00:00.000', 15) sql INSERT INTO dev_001 VALUES('2020-05-27 10:00:00.001', 16) -sql INSERT INTO dev_002 VALUES('2020-05-13 10:00:00.000', 1)('2020-05-13 10:00:00.005', 2)('2020-05-13 10:00:00.009', 3) -sql INSERT INTO dev_002 VALUES('2020-05-13 10:00:00.0021', 4)('2020-05-13 10:00:00.031', 5)('2020-05-13 10:00:00.036', 6)('2020-05-13 10:00:00.51', 7) - +sql INSERT INTO dev_002 VALUES('2020-05-13 10:00:00.000', 1) +sql INSERT INTO dev_002 VALUES('2020-05-13 10:00:00.005', 2) +sql INSERT INTO dev_002 VALUES('2020-05-13 10:00:00.009', 3) +sql INSERT INTO dev_002 VALUES('2020-05-13 10:00:00.0021', 4) +sql INSERT INTO dev_002 VALUES('2020-05-13 10:00:00.031', 5) +sql INSERT INTO dev_002 VALUES('2020-05-13 10:00:00.036', 6) +sql INSERT INTO dev_002 VALUES('2020-05-13 10:00:00.51', 7) +$loop_test = 0 +loop_test_pos: # session(ts,5a) print ====> select count(*) from dev_001 session(ts,5a) @@ -74,156 +98,241 @@ if $data01 != 2 then return -1 endi -return -# -# # session(ts,5a) main query -# tdSql.query("select count(*) from (select * from dev_001) session(ts,5a)") -# tdSql.checkRows(15) -# tdSql.checkData(0, 1, 2) -# -# -# # session(ts,1s) -# tdSql.query("select count(*) from dev_001 session(ts,1s)") -# tdSql.checkRows(12) -# tdSql.checkData(0, 1, 5) -# -# # session(ts,1s) main query -# tdSql.query("select count(*) from (select * from dev_001) session(ts,1s)") -# tdSql.checkRows(12) -# tdSql.checkData(0, 1, 5) -# -# tdSql.query("select count(*) from dev_001 session(ts,1000a)") -# tdSql.checkRows(12) -# tdSql.checkData(0, 1, 5) -# -# tdSql.query("select count(*) from (select * from dev_001) session(ts,1000a)") -# tdSql.checkRows(12) -# tdSql.checkData(0, 1, 5) -# -# # session(ts,1m) -# tdSql.query("select count(*) from dev_001 session(ts,1m)") -# tdSql.checkRows(9) -# tdSql.checkData(0, 1, 8) -# -# # session(ts,1m) -# tdSql.query("select count(*) from (select * from dev_001) session(ts,1m)") -# tdSql.checkRows(9) -# tdSql.checkData(0, 1, 8) -# -# # session(ts,1h) -# tdSql.query("select count(*) from dev_001 session(ts,1h)") -# tdSql.checkRows(6) -# tdSql.checkData(0, 1, 11) -# -# # session(ts,1h) -# tdSql.query("select count(*) from (select * from dev_001) session(ts,1h)") -# tdSql.checkRows(6) -# tdSql.checkData(0, 1, 11) -# -# # session(ts,1d) -# tdSql.query("select count(*) from dev_001 session(ts,1d)") -# tdSql.checkRows(4) -# tdSql.checkData(0, 1, 13) -# -# # session(ts,1d) -# tdSql.query("select count(*) from (select * from dev_001) session(ts,1d)") -# tdSql.checkRows(4) -# tdSql.checkData(0, 1, 13) -# -# # session(ts,1w) -# tdSql.query("select count(*) from dev_001 session(ts,1w)") -# tdSql.checkRows(2) -# tdSql.checkData(0, 1, 15) -# -# # session(ts,1w) -# tdSql.query("select count(*) from (select * from dev_001) session(ts,1w)") -# tdSql.checkRows(2) -# tdSql.checkData(0, 1, 15) -# -# # session with where -# tdSql.query("select count(*),first(tagtype),last(tagtype),avg(tagtype),sum(tagtype),min(tagtype),max(tagtype),leastsquares(tagtype, 1, 1),spread(tagtype),stddev(tagtype),percentile(tagtype,0) from dev_001 where ts <'2020-05-20 0:0:0' session(ts,1d)") -# -# tdSql.checkRows(2) -# tdSql.checkData(0, 1, 13) -# tdSql.checkData(0, 2, 1) -# tdSql.checkData(0, 3, 13) -# tdSql.checkData(0, 4, 7) -# tdSql.checkData(0, 5, 91) -# tdSql.checkData(0, 6, 1) -# tdSql.checkData(0, 7, 13) -# tdSql.checkData(0, 8, '{slop:1.000000, intercept:0.000000}') -# tdSql.checkData(0, 9, 12) -# tdSql.checkData(0, 10, 3.741657387) -# tdSql.checkData(0, 11, 1) -# tdSql.checkData(1, 11, 14) -# -# # session with where main -# -# tdSql.query("select count(*),first(tagtype),last(tagtype),avg(tagtype),sum(tagtype),min(tagtype),max(tagtype),leastsquares(tagtype, 1, 1) from (select * from dev_001 where ts <'2020-05-20 0:0:0') session(ts,1d)") -# -# tdSql.checkRows(2) -# tdSql.checkData(0, 1, 13) -# tdSql.checkData(0, 2, 1) -# tdSql.checkData(0, 3, 13) -# tdSql.checkData(0, 4, 7) -# tdSql.checkData(0, 5, 91) -# tdSql.checkData(0, 6, 1) -# tdSql.checkData(0, 7, 13) -# tdSql.checkData(0, 8, '{slop:1.000000, intercept:0.000000}') -# -# # tdsql err -# tdSql.error("select * from dev_001 session(ts,1w)") -# tdSql.error("select count(*) from st session(ts,1w)") -# tdSql.error("select count(*) from dev_001 group by tagtype session(ts,1w) ") -# tdSql.error("select count(*) from dev_001 session(ts,1n)") -# tdSql.error("select count(*) from dev_001 session(ts,1y)") -# tdSql.error("select count(*) from dev_001 session(ts,0s)") -# tdSql.error("select count(*) from dev_001 session(i,1y)") -# tdSql.error("select count(*) from dev_001 session(ts,1d) where ts <'2020-05-20 0:0:0'") -# -# #test precision us -# tdSql.execute("create database test precision 'us'") -# tdSql.execute("use test") -# tdSql.execute("create table dev_001 (ts timestamp ,i timestamp ,j int)") -# tdSql.execute("insert into dev_001 values(1623046993681000,now,1)(1623046993681001,now+1s,2)(1623046993681002,now+2s,3)(1623046993681004,now+5s,4)") -# -# # session(ts,1u) -# tdSql.query("select count(*) from dev_001 session(ts,1u)") -# tdSql.checkRows(2) -# tdSql.checkData(0, 1, 3) -# tdSql.error("select count(*) from dev_001 session(i,1s)") -# # test second timestamp fileds -# tdSql.execute("create table secondts(ts timestamp,t2 timestamp,i int)") -# tdSql.error("select count(*) from secondts session(t2,2s)") -# -# +print ====> select count(*) from (select * from dev_001) session(ts,5a) +sql select count(*) from (select * from dev_001) session(ts,5a) +if $rows != 15 then + return -1 +endi +if $data01 != 2 then + return -1 +endi + +print ====> select count(*) from dev_001 session(ts,1s) +sql select count(*) from dev_001 session(ts,1s) +if $rows != 12 then + return -1 +endi +if $data01 != 5 then + return -1 +endi + +print ====> select count(*) from (select * from dev_001) session(ts,1s) +sql select count(*) from (select * from dev_001) session(ts,1s) +if $rows != 12 then + return -1 +endi +if $data01 != 5 then + return -1 +endi + +print ====> select count(*) from dev_001 session(ts,1000a) +sql select count(*) from dev_001 session(ts,1000a) +if $rows != 12 then + return -1 +endi +if $data01 != 5 then + return -1 +endi + +print ====> select count(*) from (select * from dev_001) session(ts,1000a) +sql select count(*) from (select * from dev_001) session(ts,1000a) +if $rows != 12 then + return -1 +endi +if $data01 != 5 then + return -1 +endi + +print ====> select count(*) from dev_001 session(ts,1m) +sql select count(*) from dev_001 session(ts,1m) +if $rows != 9 then + return -1 +endi +if $data01 != 8 then + return -1 +endi + +print ====> select count(*) from (select * from dev_001) session(ts,1m) +sql select count(*) from (select * from dev_001) session(ts,1m) +if $rows != 9 then + return -1 +endi +if $data01 != 8 then + return -1 +endi + +print ====> select count(*) from dev_001 session(ts,1h) +sql select count(*) from dev_001 session(ts,1h) +if $rows != 6 then + return -1 +endi +if $data01 != 11 then + return -1 +endi + +print ====> select count(*) from (select * from dev_001) session(ts,1h) +sql select count(*) from (select * from dev_001) session(ts,1h) +if $rows != 6 then + return -1 +endi +if $data01 != 11 then + return -1 +endi + +print ====> select count(*) from dev_001 session(ts,1d) +sql select count(*) from dev_001 session(ts,1d) +if $rows != 4 then + return -1 +endi +if $data01 != 13 then + return -1 +endi + +print ====> select count(*) from (select * from dev_001) session(ts,1d) +sql select count(*) from (select * from dev_001) session(ts,1d) +if $rows != 4 then + return -1 +endi +if $data01 != 13 then + return -1 +endi + +print ====> select count(*) from dev_001 session(ts,1w) +sql select count(*) from dev_001 session(ts,1w) +if $rows != 2 then + return -1 +endi +if $data01 != 15 then + return -1 +endi + +print ====> select count(*) from (select * from dev_001) session(ts,1w) +sql select count(*) from (select * from dev_001) session(ts,1w) +if $rows != 2 then + return -1 +endi +if $data01 != 15 then + return -1 +endi + +print ====> select count(*),first(tagtype),last(tagtype),avg(tagtype),sum(tagtype),min(tagtype),max(tagtype),leastsquares(tagtype, 1, 1),spread(tagtype),stddev(tagtype),percentile(tagtype,0) from dev_001 where ts <'2020-05-20 0:0:0' session(ts,1d) +sql select count(*),first(tagtype),last(tagtype),avg(tagtype),sum(tagtype),min(tagtype),max(tagtype),leastsquares(tagtype, 1, 1),spread(tagtype),stddev(tagtype),percentile(tagtype,0) from dev_001 where ts <'2020-05-20 0:0:0' session(ts,1d) +if $rows != 2 then + return -1 +endi +if $data01 != 13 then + return -1 +endi +if $data02 != 1 then + return -1 +endi +if $data03 != 13 then + return -1 +endi +if $data04 != 7 then + return -1 +endi +if $data05 != 91 then + return -1 +endi +if $data06 != 1 then + return -1 +endi +if $data07 != 13 then + return -1 +endi +if $data08 != @{slop:1.000000, intercept:0.000000}@ then + return -1 +endi +if $data09 != 12 then + return -1 +endi +# $data0-10 != 3.741657387 +# $data0-11 != 1 +# $data1-11 != 14 + +print ====> select count(*),first(tagtype),last(tagtype),avg(tagtype),sum(tagtype),min(tagtype),max(tagtype),leastsquares(tagtype, 1, 1) from (select * from dev_001 where ts <'2020-05-20 0:0:0') session(ts,1d) +sql select count(*),first(tagtype),last(tagtype),avg(tagtype),sum(tagtype),min(tagtype),max(tagtype),leastsquares(tagtype, 1, 1) from (select * from dev_001 where ts <'2020-05-20 0:0:0') session(ts,1d) +if $rows != 2 then + return -1 +endi +if $data01 != 13 then + return -1 +endi +if $data02 != 1 then + return -1 +endi +if $data03 != 13 then + return -1 +endi +if $data04 != 7 then + return -1 +endi +if $data05 != 91 then + return -1 +endi +if $data06 != 1 then + return -1 +endi +if $data07 != 13 then + return -1 +endi +if $data08 != @{slop:1.000000, intercept:0.000000}@ then + return -1 +endi + +sql_error select * from dev_001 session(ts,1w) +sql_error select count(*) from st session(ts,1w) +sql_error select count(*) from dev_001 group by tagtype session(ts,1w) +sql_error select count(*) from dev_001 session(ts,1n) +sql_error select count(*) from dev_001 session(ts,1y) +sql_error select count(*) from dev_001 session(ts,0s) +sql_error select count(*) from dev_001 session(i,1y) +sql_error select count(*) from dev_001 session(ts,1d) where ts <'2020-05-20 0:0:0' + +print ====> create database d1 precision 'us' +sql create database d1 precision 'us' +sql use d1 +sql create table dev_001 (ts timestamp ,i timestamp ,j int) +sql insert into dev_001 values(1623046993681000,now,1)(1623046993681001,now+1s,2)(1623046993681002,now+2s,3)(1623046993681004,now+5s,4) +print ====> select count(*) from dev_001 session(ts,1u) +sql select count(*) from dev_001 session(ts,1u) +if $rows != 2 then + return -1 +endi +if $data01 != 3 then + return -1 +endi +sql_error select count(*) from dev_001 session(i,1s) +sql create table secondts(ts timestamp,t2 timestamp,i int) +sql_error select count(*) from secondts session(t2,2s) -#if $loop_test == 0 then -# print =============== stop and restart taosd -# system sh/exec.sh -n dnode1 -s stop -x SIGINT -# system sh/exec.sh -n dnode1 -s start -# -# $loop_cnt = 0 -# check_dnode_ready_0: -# $loop_cnt = $loop_cnt + 1 -# sleep 200 -# if $loop_cnt == 10 then -# print ====> dnode not ready! -# return -1 -# endi -# sql show dnodes -# print ===> $rows $data00 $data01 $data02 $data03 $data04 $data05 -# if $data00 != 1 then -# return -1 -# endi -# if $data04 != ready then -# goto check_dnode_ready_0 -# endi -# -# $loop_test = 1 -# goto loop_test_pos -#endi -# +if $loop_test == 0 then + print =============== stop and restart taosd + system sh/exec.sh -n dnode1 -s stop -x SIGINT + system sh/exec.sh -n dnode1 -s start + + $loop_cnt = 0 + check_dnode_ready_0: + $loop_cnt = $loop_cnt + 1 + sleep 200 + if $loop_cnt == 10 then + print ====> dnode not ready! + return -1 + endi + sql show dnodes + print ===> $rows $data00 $data01 $data02 $data03 $data04 $data05 + if $data00 != 1 then + return -1 + endi + if $data04 != ready then + goto check_dnode_ready_0 + endi + + $loop_test = 1 + goto loop_test_pos +endi + #system sh/exec.sh -n dnode1 -s stop -x SIGINT From 9e9805f7b7ba423eb177468ea38bfb0f962ac16e Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Sat, 2 Apr 2022 01:13:20 -0400 Subject: [PATCH 67/68] condition bugfix --- include/common/ttokendef.h | 3 +- include/libs/nodes/querynodes.h | 1 + include/util/tdef.h | 7 +- source/libs/function/src/builtins.c | 14 +- source/libs/nodes/src/nodesUtilFuncs.c | 18 + source/libs/parser/inc/sql.y | 39 +- source/libs/parser/src/parTokenizer.c | 14 +- source/libs/parser/src/parTranslater.c | 3 + source/libs/parser/src/sql.c | 1554 +++++++++++----------- source/libs/planner/test/plannerTest.cpp | 7 +- 10 files changed, 836 insertions(+), 824 deletions(-) diff --git a/include/common/ttokendef.h b/include/common/ttokendef.h index 8d996be21e..afd2a01540 100644 --- a/include/common/ttokendef.h +++ b/include/common/ttokendef.h @@ -172,7 +172,7 @@ #define TK_SYNCDB 154 #define TK_NULL 155 #define TK_NK_VARIABLE 156 -#define TK_NK_UNDERLINE 157 +#define TK_NOW 157 #define TK_ROWTS 158 #define TK_TBNAME 159 #define TK_QSTARTTS 160 @@ -229,7 +229,6 @@ #define TK_NK_COLON 500 #define TK_NK_BITNOT 501 #define TK_INSERT 502 -#define TK_NOW 504 #define TK_VALUES 507 #define TK_IMPORT 509 #define TK_NK_SEMI 508 diff --git a/include/libs/nodes/querynodes.h b/include/libs/nodes/querynodes.h index ddcbaa0bee..dec709535f 100644 --- a/include/libs/nodes/querynodes.h +++ b/include/libs/nodes/querynodes.h @@ -306,6 +306,7 @@ int32_t nodesCollectFuncs(SSelectStmt* pSelect, FFuncClassifier classifier, SNod bool nodesIsExprNode(const SNode* pNode); +bool nodesIsUnaryOp(const SOperatorNode* pOp); bool nodesIsArithmeticOp(const SOperatorNode* pOp); bool nodesIsComparisonOp(const SOperatorNode* pOp); bool nodesIsJsonOp(const SOperatorNode* pOp); diff --git a/include/util/tdef.h b/include/util/tdef.h index 517cb8baee..b1bebcee46 100644 --- a/include/util/tdef.h +++ b/include/util/tdef.h @@ -128,18 +128,20 @@ extern const int32_t TYPE_BYTES[15]; } while (0) typedef enum EOperatorType { - // arithmetic operator + // binary arithmetic operator OP_TYPE_ADD = 1, OP_TYPE_SUB, OP_TYPE_MULTI, OP_TYPE_DIV, OP_TYPE_MOD, + // unary arithmetic operator + OP_TYPE_MINUS, // bit operator OP_TYPE_BIT_AND, OP_TYPE_BIT_OR, - // comparison operator + // binary comparison operator OP_TYPE_GREATER_THAN, OP_TYPE_GREATER_EQUAL, OP_TYPE_LOWER_THAN, @@ -152,6 +154,7 @@ typedef enum EOperatorType { OP_TYPE_NOT_LIKE, OP_TYPE_MATCH, OP_TYPE_NMATCH, + // unary comparison operator OP_TYPE_IS_NULL, OP_TYPE_IS_NOT_NULL, OP_TYPE_IS_TRUE, diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index 024da4e04b..348c7a4368 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -361,6 +361,16 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .initFunc = NULL, .sprocessFunc = winDurFunction, .finalizeFunc = NULL + }, + { + .name = "now", + .type = FUNCTION_TYPE_NOW, + .classification = FUNC_MGT_SCALAR_FUNC | FUNC_MGT_DATETIME_FUNC, + .checkFunc = stubCheckAndGetResultType, + .getEnvFunc = getTimePseudoFuncEnv, + .initFunc = NULL, + .sprocessFunc = winDurFunction, + .finalizeFunc = NULL } }; @@ -436,7 +446,9 @@ int32_t stubCheckAndGetResultType(SFunctionNode* pFunc) { pFunc->node.resType = (SDataType) { .bytes = tDataTypes[TSDB_DATA_TYPE_DOUBLE].bytes, .type = TSDB_DATA_TYPE_DOUBLE }; break; } - + case FUNCTION_TYPE_NOW: + // todo + break; default: ASSERT(0); // to found the fault ASAP. } diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index 732d9acfbe..90f06c6c9c 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -860,6 +860,24 @@ bool nodesIsExprNode(const SNode* pNode) { return (QUERY_NODE_COLUMN == type || QUERY_NODE_VALUE == type || QUERY_NODE_OPERATOR == type || QUERY_NODE_FUNCTION == type); } +bool nodesIsUnaryOp(const SOperatorNode* pOp) { + switch (pOp->opType) { + case OP_TYPE_MINUS: + case OP_TYPE_IS_NULL: + case OP_TYPE_IS_NOT_NULL: + case OP_TYPE_IS_TRUE: + case OP_TYPE_IS_FALSE: + case OP_TYPE_IS_UNKNOWN: + case OP_TYPE_IS_NOT_TRUE: + case OP_TYPE_IS_NOT_FALSE: + case OP_TYPE_IS_NOT_UNKNOWN: + return true; + default: + break; + } + return false; +} + bool nodesIsArithmeticOp(const SOperatorNode* pOp) { switch (pOp->opType) { case OP_TYPE_ADD: diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index 32020ee7f1..4ae33e5c5c 100644 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -513,7 +513,7 @@ expression(A) ::= NK_PLUS(B) expression(C). } expression(A) ::= NK_MINUS(B) expression(C). { SToken t = getTokenFromRawExprNode(pCxt, C); - A = createRawExprNodeExt(pCxt, &B, &t, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, C), NULL)); + A = createRawExprNodeExt(pCxt, &B, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, C), NULL)); } expression(A) ::= expression(B) NK_PLUS expression(C). { SToken s = getTokenFromRawExprNode(pCxt, B); @@ -549,39 +549,14 @@ expression_list(A) ::= expression_list(B) NK_COMMA expression(C). column_reference(A) ::= column_name(B). { A = createRawExprNode(pCxt, &B, createColumnNode(pCxt, NULL, &B)); } column_reference(A) ::= table_name(B) NK_DOT column_name(C). { A = createRawExprNodeExt(pCxt, &B, &C, createColumnNode(pCxt, &B, &C)); } -//pseudo_column(A) ::= NK_NOW. { A = createFunctionNode(pCxt, NULL, NULL); } -//pseudo_column(A) ::= NK_UNDERLINE(B) ROWTS(C). { -// SToken t = B; -// t.n = (C.z + C.n) - B.z; -// A = createRawExprNode(pCxt, &t, createFunctionNode(pCxt, &t, NULL)); -// } +pseudo_column(A) ::= NOW(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } pseudo_column(A) ::= ROWTS(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } pseudo_column(A) ::= TBNAME(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } -pseudo_column(A) ::= NK_UNDERLINE(B) QSTARTTS(C). { - SToken t = B; - t.n = (C.z + C.n) - B.z; - A = createRawExprNode(pCxt, &t, createFunctionNode(pCxt, &t, NULL)); - } -pseudo_column(A) ::= NK_UNDERLINE(B) QENDTS(C). { - SToken t = B; - t.n = (C.z + C.n) - B.z; - A = createRawExprNode(pCxt, &t, createFunctionNode(pCxt, &t, NULL)); - } -pseudo_column(A) ::= NK_UNDERLINE(B) WSTARTTS(C). { - SToken t = B; - t.n = (C.z + C.n) - B.z; - A = createRawExprNode(pCxt, &t, createFunctionNode(pCxt, &t, NULL)); - } -pseudo_column(A) ::= NK_UNDERLINE(B) WENDTS(C). { - SToken t = B; - t.n = (C.z + C.n) - B.z; - A = createRawExprNode(pCxt, &t, createFunctionNode(pCxt, &t, NULL)); - } -pseudo_column(A) ::= NK_UNDERLINE(B) WDURATION(C). { - SToken t = B; - t.n = (C.z + C.n) - B.z; - A = createRawExprNode(pCxt, &t, createFunctionNode(pCxt, &t, NULL)); - } +pseudo_column(A) ::= QSTARTTS(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } +pseudo_column(A) ::= QENDTS(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } +pseudo_column(A) ::= WSTARTTS(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } +pseudo_column(A) ::= WENDTS(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } +pseudo_column(A) ::= WDURATION(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } /************************************************ predicate ***********************************************************/ predicate(A) ::= expression(B) compare_op(C) expression(D). { diff --git a/source/libs/parser/src/parTokenizer.c b/source/libs/parser/src/parTokenizer.c index 8149eeeb26..21191563e1 100644 --- a/source/libs/parser/src/parTokenizer.c +++ b/source/libs/parser/src/parTokenizer.c @@ -125,10 +125,10 @@ static SKeyword keywordTable[] = { {"PRECISION", TK_PRECISION}, {"PRIVILEGE", TK_PRIVILEGE}, {"PREV", TK_PREV}, - {"QENDTS", TK_QENDTS}, + {"_QENDTS", TK_QENDTS}, {"QNODE", TK_QNODE}, {"QNODES", TK_QNODES}, - {"QSTARTTS", TK_QSTARTTS}, + {"_QSTARTTS", TK_QSTARTTS}, {"QTIME", TK_QTIME}, {"QUERIES", TK_QUERIES}, {"QUERY", TK_QUERY}, @@ -184,10 +184,10 @@ static SKeyword keywordTable[] = { {"VGROUPS", TK_VGROUPS}, {"VNODES", TK_VNODES}, {"WAL", TK_WAL}, - {"WDURATION", TK_WDURATION}, - {"WENDTS", TK_WENDTS}, + {"_WDURATION", TK_WDURATION}, + {"_WENDTS", TK_WENDTS}, {"WHERE", TK_WHERE}, - {"WSTARTTS", TK_WSTARTTS}, + {"_WSTARTTS", TK_WSTARTTS}, // {"ID", TK_ID}, // {"STRING", TK_STRING}, // {"EQ", TK_EQ}, @@ -440,10 +440,6 @@ uint32_t tGetToken(const char* z, uint32_t* tokenId) { *tokenId = TK_NK_QUESTION; return 1; } - // case '_': { - // *tokenId = TK_NK_UNDERLINE; - // return 1; - // } case '`': case '\'': case '"': { diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 2947d25e1f..641750cd98 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -439,6 +439,9 @@ static EDealRes translateValue(STranslateContext* pCxt, SValueNode* pVal) { } static EDealRes translateOperator(STranslateContext* pCxt, SOperatorNode* pOp) { + if (nodesIsUnaryOp(pOp)) { + return DEAL_RES_CONTINUE; + } SDataType ldt = ((SExprNode*)(pOp->pLeft))->resType; SDataType rdt = ((SExprNode*)(pOp->pRight))->resType; if (nodesIsArithmeticOp(pOp)) { diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index 618e80cbfe..86e564adab 100644 --- a/source/libs/parser/src/sql.c +++ b/source/libs/parser/src/sql.c @@ -132,17 +132,17 @@ typedef union { #define ParseCTX_PARAM #define ParseCTX_FETCH #define ParseCTX_STORE -#define YYNSTATE 512 -#define YYNRULE 389 +#define YYNSTATE 511 +#define YYNRULE 390 #define YYNTOKEN 201 -#define YY_MAX_SHIFT 511 +#define YY_MAX_SHIFT 510 #define YY_MIN_SHIFTREDUCE 762 -#define YY_MAX_SHIFTREDUCE 1150 -#define YY_ERROR_ACTION 1151 -#define YY_ACCEPT_ACTION 1152 -#define YY_NO_ACTION 1153 -#define YY_MIN_REDUCE 1154 -#define YY_MAX_REDUCE 1542 +#define YY_MAX_SHIFTREDUCE 1151 +#define YY_ERROR_ACTION 1152 +#define YY_ACCEPT_ACTION 1153 +#define YY_NO_ACTION 1154 +#define YY_MIN_REDUCE 1155 +#define YY_MAX_REDUCE 1544 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -209,297 +209,300 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (1412) +#define YY_ACTTAB_COUNT (1448) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 1398, 24, 191, 442, 442, 504, 503, 253, 1307, 72, - /* 10 */ 72, 270, 1394, 1401, 252, 307, 349, 355, 233, 1305, - /* 20 */ 1010, 1197, 1155, 442, 1398, 1260, 1260, 319, 1398, 305, - /* 30 */ 331, 31, 29, 27, 26, 25, 1394, 1400, 429, 332, - /* 40 */ 1394, 1400, 234, 84, 1348, 1260, 83, 82, 81, 80, - /* 50 */ 79, 78, 77, 76, 75, 273, 31, 29, 27, 26, - /* 60 */ 25, 429, 1338, 1340, 265, 213, 236, 1347, 1290, 441, - /* 70 */ 496, 495, 494, 493, 492, 491, 490, 489, 207, 486, - /* 80 */ 485, 484, 483, 482, 481, 480, 479, 478, 998, 1026, - /* 90 */ 31, 29, 27, 26, 25, 84, 441, 1056, 83, 82, - /* 100 */ 81, 80, 79, 78, 77, 76, 75, 330, 1154, 442, - /* 110 */ 325, 324, 323, 322, 321, 306, 318, 317, 316, 315, - /* 120 */ 311, 310, 309, 308, 442, 236, 27, 26, 25, 340, - /* 130 */ 312, 1260, 93, 92, 91, 90, 89, 88, 87, 86, - /* 140 */ 85, 1428, 362, 1057, 357, 12, 1260, 361, 426, 1012, - /* 150 */ 160, 442, 358, 356, 1001, 359, 1056, 313, 404, 399, - /* 160 */ 410, 1061, 874, 465, 464, 463, 878, 462, 880, 881, - /* 170 */ 461, 883, 458, 1260, 889, 455, 891, 892, 452, 449, - /* 180 */ 400, 126, 98, 1010, 23, 260, 1051, 1052, 1053, 1054, - /* 190 */ 1055, 1059, 1060, 20, 112, 1412, 300, 1013, 299, 219, - /* 200 */ 385, 266, 1057, 31, 29, 27, 26, 25, 442, 111, - /* 210 */ 111, 217, 405, 401, 339, 96, 1428, 1262, 1263, 292, - /* 220 */ 1061, 136, 1251, 426, 412, 121, 1467, 1468, 1177, 1472, - /* 230 */ 1260, 477, 301, 428, 294, 126, 113, 1385, 1166, 1412, - /* 240 */ 1011, 386, 414, 23, 260, 1051, 1052, 1053, 1054, 1055, - /* 250 */ 1059, 1060, 126, 68, 1413, 1414, 1417, 1460, 30, 28, - /* 260 */ 1428, 235, 1456, 1521, 1385, 442, 262, 426, 990, 468, - /* 270 */ 1385, 1257, 1521, 1521, 1249, 1412, 125, 428, 990, 159, - /* 280 */ 1519, 1385, 67, 352, 988, 125, 125, 1260, 1117, 1519, - /* 290 */ 1519, 1374, 49, 11, 988, 6, 1428, 70, 1413, 1414, - /* 300 */ 1417, 1460, 95, 413, 354, 1459, 1456, 45, 44, 304, - /* 310 */ 1255, 130, 1245, 428, 1200, 1, 298, 1385, 396, 1115, - /* 320 */ 1116, 1118, 1119, 410, 242, 442, 290, 284, 286, 282, - /* 330 */ 127, 439, 441, 69, 1413, 1414, 1417, 1460, 508, 126, - /* 340 */ 326, 255, 1456, 120, 1428, 98, 1247, 1260, 508, 49, - /* 350 */ 989, 426, 126, 442, 1014, 187, 30, 28, 1093, 440, - /* 360 */ 989, 392, 1487, 362, 262, 357, 990, 1256, 361, 30, - /* 370 */ 28, 160, 1412, 358, 356, 1260, 359, 262, 96, 990, - /* 380 */ 1243, 12, 988, 403, 991, 135, 134, 1176, 122, 1467, - /* 390 */ 1468, 11, 1472, 1428, 991, 988, 9, 8, 117, 1238, - /* 400 */ 413, 994, 995, 224, 11, 1039, 114, 272, 1224, 1300, - /* 410 */ 428, 994, 995, 1, 1385, 111, 1412, 31, 29, 27, - /* 420 */ 26, 25, 126, 1262, 65, 1412, 1, 1088, 1152, 1385, - /* 430 */ 69, 1413, 1414, 1417, 1460, 99, 508, 1428, 255, 1456, - /* 440 */ 120, 1307, 1252, 1521, 426, 340, 1428, 267, 989, 508, - /* 450 */ 165, 1307, 1305, 426, 428, 1058, 1520, 274, 1385, 1488, - /* 460 */ 1519, 989, 1305, 428, 186, 1069, 1038, 1385, 1040, 1041, - /* 470 */ 1042, 1043, 1044, 1062, 227, 1413, 1414, 1417, 277, 467, - /* 480 */ 30, 28, 991, 69, 1413, 1414, 1417, 1460, 262, 1412, - /* 490 */ 990, 255, 1456, 1533, 131, 991, 21, 1175, 1236, 994, - /* 500 */ 995, 224, 1494, 1039, 1412, 384, 988, 275, 417, 1521, - /* 510 */ 1428, 1174, 994, 995, 224, 111, 1039, 426, 47, 410, - /* 520 */ 1015, 46, 125, 1262, 1307, 1428, 1519, 428, 1173, 798, - /* 530 */ 1092, 1385, 426, 1412, 1474, 1339, 1147, 7, 799, 1385, - /* 540 */ 798, 98, 428, 1167, 477, 347, 1385, 69, 1413, 1414, - /* 550 */ 1417, 1460, 1471, 1385, 1428, 255, 1456, 1533, 800, 188, - /* 560 */ 508, 426, 230, 1413, 1414, 1417, 1517, 1100, 1225, 1172, - /* 570 */ 1385, 428, 989, 1012, 96, 1385, 442, 1171, 1474, 30, - /* 580 */ 28, 427, 205, 1335, 123, 1467, 1468, 262, 1472, 990, - /* 590 */ 133, 69, 1413, 1414, 1417, 1460, 1470, 1170, 1260, 255, - /* 600 */ 1456, 1533, 1146, 1474, 22, 988, 991, 1412, 1169, 376, - /* 610 */ 1478, 1385, 30, 28, 31, 29, 27, 26, 25, 1385, - /* 620 */ 262, 1469, 990, 994, 995, 224, 442, 1039, 1428, 58, - /* 630 */ 172, 1168, 276, 1165, 1164, 426, 7, 1163, 988, 1385, - /* 640 */ 1521, 1162, 1161, 487, 126, 428, 295, 1253, 1260, 1385, - /* 650 */ 1385, 269, 268, 125, 414, 1479, 1088, 1519, 1160, 508, - /* 660 */ 418, 1003, 30, 28, 511, 225, 1413, 1414, 1417, 7, - /* 670 */ 262, 989, 990, 1385, 421, 1385, 1385, 996, 210, 1385, - /* 680 */ 397, 94, 1307, 1385, 1385, 1521, 1159, 500, 988, 209, - /* 690 */ 1158, 1157, 508, 1306, 9, 8, 152, 416, 125, 150, - /* 700 */ 1385, 1301, 1519, 1091, 989, 991, 1412, 154, 156, 158, - /* 710 */ 153, 155, 157, 66, 1193, 1188, 203, 1186, 104, 1, - /* 720 */ 425, 388, 994, 995, 224, 64, 1039, 1428, 1385, 1149, - /* 730 */ 1150, 443, 1385, 1385, 426, 60, 363, 365, 991, 368, - /* 740 */ 181, 1405, 508, 999, 428, 374, 438, 43, 1385, 175, - /* 750 */ 1114, 997, 177, 1403, 989, 994, 995, 224, 372, 1039, - /* 760 */ 410, 346, 1412, 411, 70, 1413, 1414, 1417, 1460, 1490, - /* 770 */ 1429, 391, 424, 1456, 168, 32, 32, 1004, 1063, 1023, - /* 780 */ 190, 1010, 98, 1428, 2, 279, 283, 419, 991, 974, - /* 790 */ 426, 164, 241, 841, 1007, 995, 32, 243, 966, 957, - /* 800 */ 428, 414, 314, 422, 1385, 994, 995, 224, 211, 1039, - /* 810 */ 1412, 194, 132, 101, 196, 96, 434, 1000, 1337, 320, - /* 820 */ 115, 1413, 1414, 1417, 328, 184, 1467, 409, 1048, 408, - /* 830 */ 333, 1428, 1521, 31, 29, 27, 26, 25, 426, 102, - /* 840 */ 1019, 246, 202, 104, 147, 125, 867, 119, 428, 1519, - /* 850 */ 327, 43, 1385, 345, 862, 146, 329, 447, 415, 1534, - /* 860 */ 895, 334, 102, 159, 1412, 899, 335, 352, 70, 1413, - /* 870 */ 1414, 1417, 1460, 1412, 1018, 336, 139, 1457, 247, 50, - /* 880 */ 245, 244, 144, 351, 103, 1428, 337, 905, 354, 1017, - /* 890 */ 104, 1026, 426, 904, 1428, 102, 338, 142, 105, 48, - /* 900 */ 341, 426, 428, 145, 1016, 348, 1385, 1412, 350, 261, - /* 910 */ 377, 428, 353, 1250, 149, 1385, 74, 1246, 393, 151, - /* 920 */ 106, 107, 229, 1413, 1414, 1417, 1248, 1244, 1428, 108, - /* 930 */ 109, 229, 1413, 1414, 1417, 426, 143, 360, 138, 251, - /* 940 */ 140, 379, 378, 1412, 167, 428, 170, 1015, 389, 1385, - /* 950 */ 398, 1412, 383, 1501, 367, 390, 995, 137, 432, 1500, - /* 960 */ 5, 387, 380, 1481, 1428, 228, 1413, 1414, 1417, 375, - /* 970 */ 407, 426, 1428, 173, 395, 4, 254, 1412, 176, 426, - /* 980 */ 1491, 428, 402, 162, 394, 1385, 370, 1088, 97, 428, - /* 990 */ 1014, 364, 1237, 1385, 161, 33, 259, 406, 1428, 1235, - /* 1000 */ 1475, 115, 1413, 1414, 1417, 426, 1412, 118, 180, 229, - /* 1010 */ 1413, 1414, 1417, 256, 183, 428, 1518, 182, 41, 1385, - /* 1020 */ 423, 40, 263, 420, 189, 1536, 17, 1428, 1442, 1346, - /* 1030 */ 1412, 430, 431, 264, 426, 229, 1413, 1414, 1417, 1345, - /* 1040 */ 1535, 435, 436, 200, 428, 198, 437, 57, 1385, 206, - /* 1050 */ 212, 1428, 59, 473, 1412, 474, 206, 488, 426, 1261, - /* 1060 */ 473, 445, 214, 507, 222, 1413, 1414, 1417, 428, 208, - /* 1070 */ 220, 39, 1385, 216, 475, 1428, 1379, 221, 1412, 218, - /* 1080 */ 1378, 475, 426, 278, 1375, 280, 281, 984, 231, 1413, - /* 1090 */ 1414, 1417, 428, 472, 471, 470, 1385, 469, 985, 1428, - /* 1100 */ 472, 471, 470, 128, 469, 285, 426, 1412, 1373, 287, - /* 1110 */ 288, 289, 223, 1413, 1414, 1417, 428, 1372, 1371, 291, - /* 1120 */ 1385, 293, 1362, 129, 296, 297, 969, 968, 1428, 1356, - /* 1130 */ 1355, 303, 302, 1412, 1354, 426, 232, 1413, 1414, 1417, - /* 1140 */ 1353, 1412, 940, 1330, 1329, 428, 1328, 1327, 1326, 1385, - /* 1150 */ 1325, 1324, 1323, 1322, 1428, 1321, 1320, 1319, 1318, 100, - /* 1160 */ 1317, 426, 1428, 1316, 1315, 1425, 1413, 1414, 1417, 426, - /* 1170 */ 1314, 428, 1313, 1312, 1311, 1385, 1412, 1310, 1309, 428, - /* 1180 */ 1308, 942, 1412, 1385, 1199, 1370, 1364, 1352, 1343, 1239, - /* 1190 */ 811, 1424, 1413, 1414, 1417, 1198, 1196, 1428, 1185, 1423, - /* 1200 */ 1413, 1414, 1417, 1428, 426, 141, 342, 343, 344, 1184, - /* 1210 */ 426, 1412, 1181, 1241, 428, 73, 487, 1412, 1385, 912, - /* 1220 */ 428, 148, 910, 1240, 1385, 1194, 248, 1189, 840, 839, - /* 1230 */ 838, 837, 1428, 249, 239, 1413, 1414, 1417, 1428, 426, - /* 1240 */ 238, 1413, 1414, 1417, 835, 426, 834, 1187, 250, 428, - /* 1250 */ 1180, 371, 369, 1385, 366, 428, 1179, 373, 71, 1385, - /* 1260 */ 1369, 42, 163, 1412, 1363, 381, 976, 110, 382, 240, - /* 1270 */ 1413, 1414, 1417, 1351, 1350, 237, 1413, 1414, 1417, 1342, - /* 1280 */ 169, 166, 14, 1403, 1428, 51, 171, 3, 32, 174, - /* 1290 */ 15, 426, 1113, 116, 34, 54, 36, 37, 185, 124, - /* 1300 */ 178, 428, 1107, 52, 1135, 1385, 1106, 179, 53, 19, - /* 1310 */ 1134, 1085, 35, 10, 1084, 16, 1140, 8, 257, 1139, - /* 1320 */ 1138, 226, 1413, 1414, 1417, 258, 1341, 1024, 13, 433, - /* 1330 */ 1049, 18, 192, 193, 60, 1111, 195, 197, 55, 199, - /* 1340 */ 56, 1005, 1402, 446, 38, 271, 450, 896, 893, 453, - /* 1350 */ 456, 204, 448, 451, 459, 890, 444, 454, 201, 884, - /* 1360 */ 882, 457, 460, 873, 901, 907, 903, 61, 809, 476, - /* 1370 */ 62, 63, 831, 830, 829, 828, 827, 826, 825, 823, - /* 1380 */ 888, 466, 824, 842, 821, 820, 819, 818, 887, 886, - /* 1390 */ 817, 885, 816, 815, 814, 1195, 497, 498, 1183, 1182, - /* 1400 */ 501, 502, 499, 1178, 906, 505, 506, 1153, 992, 215, - /* 1410 */ 509, 510, + /* 0 */ 1250, 441, 441, 265, 441, 1246, 1413, 72, 304, 306, + /* 10 */ 72, 111, 30, 28, 348, 409, 252, 354, 20, 1263, + /* 20 */ 261, 1153, 990, 1261, 1261, 269, 1261, 1429, 31, 29, + /* 30 */ 27, 26, 25, 1399, 412, 441, 233, 98, 988, 117, + /* 40 */ 409, 305, 1399, 1014, 427, 1395, 1401, 11, 1386, 1429, + /* 50 */ 1301, 30, 28, 1094, 1395, 1401, 425, 1261, 799, 261, + /* 60 */ 798, 990, 98, 409, 69, 1414, 1415, 1418, 1462, 1, + /* 70 */ 96, 276, 254, 1458, 120, 1413, 1308, 988, 800, 411, + /* 80 */ 121, 1469, 1470, 1308, 1474, 98, 11, 1340, 399, 251, + /* 90 */ 30, 28, 507, 1490, 1306, 96, 1429, 1252, 261, 325, + /* 100 */ 990, 440, 1523, 425, 989, 122, 1469, 1470, 1, 1474, + /* 110 */ 22, 24, 191, 427, 1399, 125, 988, 1386, 96, 1521, + /* 120 */ 31, 29, 27, 26, 25, 11, 1395, 1402, 123, 1469, + /* 130 */ 1470, 507, 1474, 70, 1414, 1415, 1418, 1462, 991, 1386, + /* 140 */ 440, 1461, 1458, 989, 135, 134, 1413, 1, 31, 29, + /* 150 */ 27, 26, 25, 186, 65, 994, 995, 1038, 1039, 1040, + /* 160 */ 1041, 1042, 1043, 1044, 1045, 99, 232, 1429, 1010, 1406, + /* 170 */ 507, 299, 1253, 298, 425, 318, 126, 991, 330, 1010, + /* 180 */ 428, 1404, 989, 264, 427, 1429, 1348, 331, 1386, 12, + /* 190 */ 1413, 398, 425, 131, 994, 995, 1038, 1039, 1040, 1041, + /* 200 */ 1042, 1043, 1044, 1045, 69, 1414, 1415, 1418, 1462, 441, + /* 210 */ 126, 1429, 254, 1458, 1535, 311, 991, 47, 425, 1308, + /* 220 */ 46, 441, 1336, 1496, 402, 266, 440, 312, 427, 133, + /* 230 */ 1306, 1261, 1386, 994, 995, 1038, 1039, 1040, 1041, 1042, + /* 240 */ 1043, 1044, 1045, 1261, 404, 400, 30, 28, 70, 1414, + /* 250 */ 1415, 1418, 1462, 64, 261, 329, 990, 1459, 324, 323, + /* 260 */ 322, 321, 320, 60, 317, 316, 315, 314, 310, 309, + /* 270 */ 308, 307, 988, 84, 1118, 12, 83, 82, 81, 80, + /* 280 */ 79, 78, 77, 76, 75, 30, 28, 426, 1156, 361, + /* 290 */ 111, 356, 300, 261, 360, 990, 126, 160, 1264, 357, + /* 300 */ 355, 126, 358, 7, 395, 1116, 1117, 1119, 1120, 84, + /* 310 */ 6, 988, 83, 82, 81, 80, 79, 78, 77, 76, + /* 320 */ 75, 441, 1308, 1523, 30, 28, 507, 338, 273, 503, + /* 330 */ 502, 441, 261, 1306, 990, 126, 125, 1258, 989, 114, + /* 340 */ 1521, 1225, 7, 1261, 272, 31, 29, 27, 26, 25, + /* 350 */ 988, 1339, 1341, 1261, 874, 464, 463, 462, 878, 461, + /* 360 */ 880, 881, 460, 883, 457, 507, 889, 454, 891, 892, + /* 370 */ 451, 448, 991, 27, 26, 25, 113, 989, 1167, 213, + /* 380 */ 1413, 7, 1291, 1375, 31, 29, 27, 26, 25, 994, + /* 390 */ 995, 1038, 1039, 1040, 1041, 1042, 1043, 1044, 1045, 441, + /* 400 */ 1523, 1429, 1201, 1026, 507, 438, 339, 384, 425, 1239, + /* 410 */ 126, 991, 1178, 1522, 428, 1012, 989, 1521, 427, 283, + /* 420 */ 1349, 1261, 1386, 31, 29, 27, 26, 25, 994, 995, + /* 430 */ 1038, 1039, 1040, 1041, 1042, 1043, 1044, 1045, 115, 1414, + /* 440 */ 1415, 1418, 1089, 31, 29, 27, 26, 25, 385, 271, + /* 450 */ 991, 361, 1015, 356, 1386, 339, 360, 111, 235, 160, + /* 460 */ 245, 357, 355, 1177, 358, 1263, 1413, 994, 995, 1038, + /* 470 */ 1039, 1040, 1041, 1042, 1043, 1044, 1045, 1537, 235, 1523, + /* 480 */ 30, 28, 159, 9, 8, 403, 351, 1429, 261, 1057, + /* 490 */ 990, 1155, 125, 49, 425, 291, 1521, 246, 375, 244, + /* 500 */ 243, 1026, 350, 1148, 427, 1386, 988, 353, 1386, 1057, + /* 510 */ 293, 1257, 1176, 413, 1175, 93, 92, 91, 90, 89, + /* 520 */ 88, 87, 86, 85, 68, 1414, 1415, 1418, 1462, 1523, + /* 530 */ 49, 274, 234, 1458, 159, 1058, 416, 1, 351, 111, + /* 540 */ 95, 1093, 125, 1174, 1523, 441, 1521, 1263, 1256, 1013, + /* 550 */ 1059, 439, 1070, 1062, 1386, 1058, 1386, 125, 476, 353, + /* 560 */ 507, 1521, 172, 1308, 441, 441, 1173, 1261, 1063, 1147, + /* 570 */ 205, 275, 989, 1062, 1307, 1172, 23, 259, 1052, 1053, + /* 580 */ 1054, 1055, 1056, 1060, 1061, 1386, 1261, 1261, 1011, 1476, + /* 590 */ 1194, 21, 1171, 1170, 1169, 1166, 23, 259, 1052, 1053, + /* 600 */ 1054, 1055, 1056, 1060, 1061, 1198, 991, 1473, 1386, 1101, + /* 610 */ 1165, 147, 362, 1248, 119, 1012, 112, 1386, 1481, 1089, + /* 620 */ 344, 219, 146, 994, 995, 1038, 1039, 1040, 1041, 1042, + /* 630 */ 1043, 1044, 1045, 217, 1386, 1386, 1386, 1386, 1164, 1163, + /* 640 */ 1162, 1161, 1160, 136, 1159, 1158, 50, 9, 8, 144, + /* 650 */ 1237, 1413, 1386, 420, 495, 494, 493, 492, 491, 490, + /* 660 */ 489, 488, 207, 485, 484, 483, 482, 481, 480, 479, + /* 670 */ 478, 477, 1429, 1476, 1476, 486, 58, 467, 294, 425, + /* 680 */ 1386, 1386, 1386, 1386, 1386, 798, 1386, 1386, 417, 427, + /* 690 */ 424, 1472, 1471, 1386, 1254, 152, 476, 154, 150, 1413, + /* 700 */ 153, 346, 373, 143, 67, 138, 998, 140, 383, 69, + /* 710 */ 1414, 1415, 1418, 1462, 1092, 371, 1244, 254, 1458, 1535, + /* 720 */ 1429, 1150, 1151, 165, 137, 415, 466, 412, 1519, 45, + /* 730 */ 44, 303, 156, 130, 1189, 155, 104, 427, 297, 387, + /* 740 */ 158, 1386, 1413, 157, 1168, 1226, 241, 1187, 289, 396, + /* 750 */ 285, 281, 127, 188, 1302, 345, 364, 69, 1414, 1415, + /* 760 */ 1418, 1462, 181, 1429, 1492, 254, 1458, 120, 43, 367, + /* 770 */ 425, 1115, 1001, 175, 126, 997, 177, 1430, 1413, 187, + /* 780 */ 427, 410, 421, 190, 1386, 391, 1489, 32, 32, 32, + /* 790 */ 1064, 1023, 957, 194, 2, 1010, 196, 278, 1049, 1429, + /* 800 */ 69, 1414, 1415, 1418, 1462, 1413, 425, 282, 254, 1458, + /* 810 */ 1535, 101, 240, 242, 433, 418, 427, 841, 102, 1480, + /* 820 */ 1386, 202, 966, 211, 313, 413, 1429, 409, 510, 1338, + /* 830 */ 132, 104, 319, 425, 867, 327, 224, 1414, 1415, 1418, + /* 840 */ 326, 1000, 210, 427, 328, 94, 332, 1386, 1019, 98, + /* 850 */ 333, 499, 43, 209, 446, 862, 1523, 895, 102, 103, + /* 860 */ 1413, 899, 905, 70, 1414, 1415, 1418, 1462, 413, 125, + /* 870 */ 334, 423, 1458, 1521, 1018, 335, 139, 66, 1017, 336, + /* 880 */ 203, 1429, 96, 104, 102, 337, 904, 105, 425, 142, + /* 890 */ 48, 145, 184, 1469, 408, 340, 407, 1016, 427, 1523, + /* 900 */ 347, 349, 1386, 74, 1413, 1251, 376, 149, 1247, 1413, + /* 910 */ 437, 377, 125, 151, 106, 107, 1521, 1249, 115, 1414, + /* 920 */ 1415, 1418, 1245, 108, 109, 1429, 352, 359, 378, 250, + /* 930 */ 1429, 1015, 425, 382, 167, 390, 388, 425, 168, 379, + /* 940 */ 170, 397, 427, 1503, 431, 386, 1386, 427, 1493, 260, + /* 950 */ 389, 1386, 995, 974, 392, 164, 414, 1536, 1502, 5, + /* 960 */ 1483, 173, 228, 1414, 1415, 1418, 1413, 228, 1414, 1415, + /* 970 */ 1418, 1413, 406, 394, 393, 176, 253, 4, 401, 1089, + /* 980 */ 97, 1014, 33, 183, 180, 422, 255, 1429, 118, 1477, + /* 990 */ 419, 429, 1429, 182, 425, 17, 1347, 1346, 430, 425, + /* 1000 */ 263, 434, 1444, 435, 427, 198, 1538, 1413, 1386, 427, + /* 1010 */ 200, 57, 436, 1386, 1520, 1413, 258, 59, 1262, 212, + /* 1020 */ 473, 189, 444, 214, 227, 1414, 1415, 1418, 1429, 228, + /* 1030 */ 1414, 1415, 1418, 487, 208, 425, 1429, 506, 216, 220, + /* 1040 */ 221, 1413, 39, 425, 218, 427, 1380, 1379, 277, 1386, + /* 1050 */ 1413, 279, 262, 427, 1376, 280, 405, 1386, 984, 985, + /* 1060 */ 128, 284, 1429, 1374, 286, 228, 1414, 1415, 1418, 425, + /* 1070 */ 287, 1429, 288, 226, 1414, 1415, 1418, 1413, 425, 427, + /* 1080 */ 1373, 290, 1372, 1386, 1363, 1413, 292, 129, 427, 295, + /* 1090 */ 296, 969, 1386, 968, 1357, 1356, 302, 1355, 1429, 229, + /* 1100 */ 1414, 1415, 1418, 301, 1354, 425, 1429, 1331, 222, 1414, + /* 1110 */ 1415, 1418, 940, 425, 1330, 427, 1329, 1328, 1327, 1386, + /* 1120 */ 1326, 1413, 1325, 427, 1324, 1323, 1413, 1386, 1322, 1321, + /* 1130 */ 1320, 1319, 100, 1318, 1317, 230, 1414, 1415, 1418, 1316, + /* 1140 */ 1315, 1314, 1429, 223, 1414, 1415, 1418, 1429, 1313, 425, + /* 1150 */ 1312, 1311, 1310, 1309, 425, 1200, 1371, 942, 1365, 427, + /* 1160 */ 1353, 1344, 1413, 1386, 427, 1240, 141, 1413, 1386, 811, + /* 1170 */ 1199, 1197, 1186, 1413, 341, 343, 1185, 1182, 342, 231, + /* 1180 */ 1414, 1415, 1418, 1429, 1426, 1414, 1415, 1418, 1429, 1242, + /* 1190 */ 425, 73, 912, 486, 1429, 425, 910, 1241, 1195, 1190, + /* 1200 */ 427, 425, 1238, 148, 1386, 427, 840, 839, 247, 1386, + /* 1210 */ 248, 427, 365, 838, 1413, 1386, 837, 835, 834, 1188, + /* 1220 */ 1425, 1414, 1415, 1418, 1236, 1424, 1414, 1415, 1418, 1413, + /* 1230 */ 249, 238, 1414, 1415, 1418, 1429, 1181, 370, 268, 267, + /* 1240 */ 1413, 368, 425, 1180, 372, 71, 1370, 163, 1003, 42, + /* 1250 */ 1429, 976, 427, 1364, 990, 1413, 1386, 425, 110, 206, + /* 1260 */ 380, 1429, 1352, 472, 996, 166, 1351, 427, 425, 1343, + /* 1270 */ 988, 1386, 237, 1414, 1415, 1418, 1429, 381, 427, 36, + /* 1280 */ 366, 206, 1386, 425, 474, 472, 51, 239, 1414, 1415, + /* 1290 */ 1418, 169, 171, 427, 3, 374, 32, 1386, 236, 1414, + /* 1300 */ 1415, 1418, 37, 471, 470, 469, 474, 468, 116, 162, + /* 1310 */ 174, 1114, 369, 225, 1414, 1415, 1418, 363, 442, 178, + /* 1320 */ 161, 1108, 1107, 14, 507, 471, 470, 469, 52, 468, + /* 1330 */ 999, 179, 53, 34, 19, 1404, 989, 15, 1086, 185, + /* 1340 */ 1085, 35, 124, 1141, 41, 16, 10, 40, 54, 1136, + /* 1350 */ 1135, 256, 1140, 1139, 257, 8, 1050, 1024, 192, 13, + /* 1360 */ 18, 432, 193, 1112, 1004, 195, 197, 55, 1342, 199, + /* 1370 */ 991, 56, 201, 60, 1005, 38, 1403, 896, 445, 270, + /* 1380 */ 204, 1007, 995, 443, 449, 452, 447, 994, 995, 893, + /* 1390 */ 450, 873, 890, 453, 455, 884, 456, 458, 882, 459, + /* 1400 */ 61, 907, 888, 887, 886, 465, 62, 63, 906, 903, + /* 1410 */ 901, 475, 885, 809, 831, 830, 829, 828, 827, 826, + /* 1420 */ 825, 824, 823, 842, 821, 820, 1196, 819, 818, 817, + /* 1430 */ 1184, 816, 815, 814, 496, 497, 500, 1183, 501, 1179, + /* 1440 */ 498, 504, 505, 1154, 992, 215, 508, 509, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 246, 267, 268, 210, 210, 207, 208, 229, 225, 216, - /* 10 */ 216, 229, 258, 259, 231, 210, 223, 223, 18, 236, - /* 20 */ 20, 0, 0, 210, 246, 232, 232, 27, 246, 216, - /* 30 */ 30, 12, 13, 14, 15, 16, 258, 259, 242, 39, - /* 40 */ 258, 259, 237, 21, 248, 232, 24, 25, 26, 27, - /* 50 */ 28, 29, 30, 31, 32, 234, 12, 13, 14, 15, - /* 60 */ 16, 242, 241, 242, 245, 218, 47, 248, 221, 20, - /* 70 */ 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, - /* 80 */ 59, 60, 61, 62, 63, 64, 65, 66, 38, 70, - /* 90 */ 12, 13, 14, 15, 16, 21, 20, 78, 24, 25, - /* 100 */ 26, 27, 28, 29, 30, 31, 32, 107, 0, 210, - /* 110 */ 110, 111, 112, 113, 114, 216, 116, 117, 118, 119, - /* 120 */ 120, 121, 122, 123, 210, 47, 14, 15, 16, 46, - /* 130 */ 216, 232, 24, 25, 26, 27, 28, 29, 30, 31, - /* 140 */ 32, 225, 49, 124, 51, 69, 232, 54, 232, 20, - /* 150 */ 57, 210, 59, 60, 104, 62, 78, 216, 20, 128, - /* 160 */ 210, 142, 83, 84, 85, 86, 87, 88, 89, 90, - /* 170 */ 91, 92, 93, 232, 95, 96, 97, 98, 99, 100, - /* 180 */ 264, 176, 232, 20, 165, 166, 167, 168, 169, 170, - /* 190 */ 171, 172, 173, 2, 18, 204, 137, 20, 139, 23, - /* 200 */ 210, 217, 124, 12, 13, 14, 15, 16, 210, 225, - /* 210 */ 225, 35, 181, 182, 216, 265, 225, 233, 233, 134, - /* 220 */ 142, 45, 204, 232, 274, 275, 276, 277, 204, 279, - /* 230 */ 232, 46, 251, 242, 149, 176, 203, 246, 205, 204, - /* 240 */ 20, 251, 251, 165, 166, 167, 168, 169, 170, 171, - /* 250 */ 172, 173, 176, 262, 263, 264, 265, 266, 12, 13, - /* 260 */ 225, 270, 271, 282, 246, 210, 20, 232, 22, 80, - /* 270 */ 246, 216, 282, 282, 226, 204, 295, 242, 22, 57, - /* 280 */ 299, 246, 106, 61, 38, 295, 295, 232, 155, 299, - /* 290 */ 299, 0, 212, 47, 38, 43, 225, 262, 263, 264, - /* 300 */ 265, 266, 222, 232, 82, 270, 271, 131, 132, 133, - /* 310 */ 230, 135, 226, 242, 0, 69, 140, 246, 185, 186, - /* 320 */ 187, 188, 189, 210, 148, 210, 150, 36, 152, 153, - /* 330 */ 154, 216, 20, 262, 263, 264, 265, 266, 92, 176, - /* 340 */ 63, 270, 271, 272, 225, 232, 226, 232, 92, 212, - /* 350 */ 104, 232, 176, 210, 20, 284, 12, 13, 14, 216, - /* 360 */ 104, 290, 291, 49, 20, 51, 22, 230, 54, 12, - /* 370 */ 13, 57, 204, 59, 60, 232, 62, 20, 265, 22, - /* 380 */ 226, 69, 38, 264, 138, 108, 109, 204, 275, 276, - /* 390 */ 277, 47, 279, 225, 138, 38, 1, 2, 224, 0, - /* 400 */ 232, 155, 156, 157, 47, 159, 213, 217, 215, 235, - /* 410 */ 242, 155, 156, 69, 246, 225, 204, 12, 13, 14, - /* 420 */ 15, 16, 176, 233, 209, 204, 69, 175, 201, 246, - /* 430 */ 262, 263, 264, 265, 266, 220, 92, 225, 270, 271, - /* 440 */ 272, 225, 227, 282, 232, 46, 225, 231, 104, 92, - /* 450 */ 226, 225, 236, 232, 242, 124, 295, 231, 246, 291, - /* 460 */ 299, 104, 236, 242, 130, 70, 158, 246, 160, 161, - /* 470 */ 162, 163, 164, 142, 262, 263, 264, 265, 251, 226, - /* 480 */ 12, 13, 138, 262, 263, 264, 265, 266, 20, 204, - /* 490 */ 22, 270, 271, 272, 44, 138, 165, 204, 0, 155, - /* 500 */ 156, 157, 281, 159, 204, 254, 38, 217, 3, 282, - /* 510 */ 225, 204, 155, 156, 157, 225, 159, 232, 68, 210, - /* 520 */ 20, 71, 295, 233, 225, 225, 299, 242, 204, 22, - /* 530 */ 4, 246, 232, 204, 260, 236, 131, 69, 20, 246, - /* 540 */ 22, 232, 242, 205, 46, 38, 246, 262, 263, 264, - /* 550 */ 265, 266, 278, 246, 225, 270, 271, 272, 40, 302, - /* 560 */ 92, 232, 262, 263, 264, 265, 281, 14, 215, 204, - /* 570 */ 246, 242, 104, 20, 265, 246, 210, 204, 260, 12, - /* 580 */ 13, 14, 216, 232, 275, 276, 277, 20, 279, 22, - /* 590 */ 239, 262, 263, 264, 265, 266, 278, 204, 232, 270, - /* 600 */ 271, 272, 197, 260, 2, 38, 138, 204, 204, 251, - /* 610 */ 281, 246, 12, 13, 12, 13, 14, 15, 16, 246, - /* 620 */ 20, 278, 22, 155, 156, 157, 210, 159, 225, 209, - /* 630 */ 130, 204, 216, 204, 204, 232, 69, 204, 38, 246, - /* 640 */ 282, 204, 204, 67, 176, 242, 70, 227, 232, 246, - /* 650 */ 246, 12, 13, 295, 251, 174, 175, 299, 204, 92, - /* 660 */ 67, 22, 12, 13, 19, 262, 263, 264, 265, 69, - /* 670 */ 20, 104, 22, 246, 67, 246, 246, 38, 33, 246, - /* 680 */ 293, 36, 225, 246, 246, 282, 204, 42, 38, 44, - /* 690 */ 204, 204, 92, 236, 1, 2, 73, 192, 295, 76, - /* 700 */ 246, 235, 299, 177, 104, 138, 204, 73, 73, 73, - /* 710 */ 76, 76, 76, 68, 0, 0, 71, 0, 67, 69, - /* 720 */ 47, 70, 155, 156, 157, 69, 159, 225, 246, 199, - /* 730 */ 200, 92, 246, 246, 232, 79, 22, 22, 138, 22, - /* 740 */ 287, 69, 92, 104, 242, 21, 101, 67, 246, 67, - /* 750 */ 70, 38, 70, 81, 104, 155, 156, 157, 34, 159, - /* 760 */ 210, 207, 204, 280, 262, 263, 264, 265, 266, 261, - /* 770 */ 225, 126, 270, 271, 129, 67, 67, 138, 70, 70, - /* 780 */ 296, 20, 232, 225, 283, 210, 36, 194, 138, 144, - /* 790 */ 232, 146, 257, 38, 155, 156, 67, 214, 136, 70, - /* 800 */ 242, 251, 210, 196, 246, 155, 156, 157, 252, 159, - /* 810 */ 204, 67, 115, 67, 70, 265, 70, 104, 210, 240, - /* 820 */ 262, 263, 264, 265, 124, 275, 276, 277, 155, 279, - /* 830 */ 210, 225, 282, 12, 13, 14, 15, 16, 232, 67, - /* 840 */ 20, 35, 70, 67, 33, 295, 70, 36, 242, 299, - /* 850 */ 238, 67, 246, 42, 70, 44, 238, 67, 300, 301, - /* 860 */ 70, 256, 67, 57, 204, 70, 242, 61, 262, 263, - /* 870 */ 264, 265, 266, 204, 20, 250, 212, 271, 72, 68, - /* 880 */ 74, 75, 71, 77, 67, 225, 232, 70, 82, 20, - /* 890 */ 67, 70, 232, 70, 225, 67, 243, 212, 70, 212, - /* 900 */ 210, 232, 242, 212, 20, 206, 246, 204, 225, 249, - /* 910 */ 232, 242, 214, 225, 225, 246, 210, 225, 249, 225, - /* 920 */ 225, 225, 262, 263, 264, 265, 225, 225, 225, 225, - /* 930 */ 225, 262, 263, 264, 265, 232, 125, 214, 127, 206, - /* 940 */ 129, 145, 256, 204, 209, 242, 209, 20, 232, 246, - /* 950 */ 184, 204, 242, 292, 4, 243, 156, 146, 183, 292, - /* 960 */ 191, 250, 255, 289, 225, 262, 263, 264, 265, 19, - /* 970 */ 190, 232, 225, 247, 246, 178, 246, 204, 247, 232, - /* 980 */ 261, 242, 246, 33, 179, 246, 36, 175, 232, 242, - /* 990 */ 20, 41, 0, 246, 44, 115, 249, 294, 225, 0, - /* 1000 */ 260, 262, 263, 264, 265, 232, 204, 286, 288, 262, - /* 1010 */ 263, 264, 265, 198, 273, 242, 298, 285, 68, 246, - /* 1020 */ 195, 71, 249, 193, 297, 303, 69, 225, 269, 247, - /* 1030 */ 204, 246, 246, 246, 232, 262, 263, 264, 265, 247, - /* 1040 */ 301, 127, 244, 209, 242, 232, 243, 209, 246, 57, - /* 1050 */ 221, 225, 69, 61, 204, 214, 57, 214, 232, 232, - /* 1060 */ 61, 228, 210, 206, 262, 263, 264, 265, 242, 209, - /* 1070 */ 219, 253, 246, 211, 82, 225, 0, 219, 204, 202, - /* 1080 */ 0, 82, 232, 60, 0, 38, 151, 38, 262, 263, - /* 1090 */ 264, 265, 242, 101, 102, 103, 246, 105, 38, 225, - /* 1100 */ 101, 102, 103, 38, 105, 151, 232, 204, 0, 38, - /* 1110 */ 38, 151, 262, 263, 264, 265, 242, 0, 0, 38, - /* 1120 */ 246, 38, 0, 69, 142, 141, 104, 138, 225, 0, - /* 1130 */ 0, 134, 50, 204, 0, 232, 262, 263, 264, 265, - /* 1140 */ 0, 204, 81, 0, 0, 242, 0, 0, 0, 246, - /* 1150 */ 0, 0, 0, 0, 225, 0, 0, 0, 0, 115, - /* 1160 */ 0, 232, 225, 0, 0, 262, 263, 264, 265, 232, - /* 1170 */ 0, 242, 0, 0, 0, 246, 204, 0, 0, 242, - /* 1180 */ 0, 22, 204, 246, 0, 0, 0, 0, 0, 0, - /* 1190 */ 48, 262, 263, 264, 265, 0, 0, 225, 0, 262, - /* 1200 */ 263, 264, 265, 225, 232, 43, 38, 36, 43, 0, - /* 1210 */ 232, 204, 0, 0, 242, 78, 67, 204, 246, 38, - /* 1220 */ 242, 76, 22, 0, 246, 0, 22, 0, 38, 38, - /* 1230 */ 38, 38, 225, 22, 262, 263, 264, 265, 225, 232, - /* 1240 */ 262, 263, 264, 265, 38, 232, 38, 0, 22, 242, - /* 1250 */ 0, 22, 38, 246, 39, 242, 0, 22, 20, 246, - /* 1260 */ 0, 130, 147, 204, 0, 22, 38, 143, 130, 262, - /* 1270 */ 263, 264, 265, 0, 0, 262, 263, 264, 265, 0, - /* 1280 */ 43, 127, 180, 81, 225, 69, 125, 67, 67, 70, - /* 1290 */ 180, 232, 70, 69, 174, 4, 130, 67, 81, 81, - /* 1300 */ 69, 242, 70, 69, 38, 246, 70, 67, 69, 67, - /* 1310 */ 38, 70, 67, 180, 70, 67, 70, 2, 38, 38, - /* 1320 */ 38, 262, 263, 264, 265, 38, 0, 70, 69, 128, - /* 1330 */ 155, 69, 81, 70, 79, 70, 69, 69, 69, 43, - /* 1340 */ 69, 22, 81, 38, 69, 38, 38, 70, 70, 38, - /* 1350 */ 38, 81, 69, 69, 38, 70, 80, 69, 125, 70, - /* 1360 */ 70, 69, 69, 22, 22, 38, 38, 69, 48, 47, - /* 1370 */ 69, 69, 22, 38, 38, 38, 38, 38, 38, 22, - /* 1380 */ 94, 82, 38, 38, 38, 38, 38, 38, 94, 94, - /* 1390 */ 38, 94, 38, 38, 38, 0, 38, 36, 0, 0, - /* 1400 */ 38, 37, 43, 0, 104, 22, 21, 304, 22, 22, - /* 1410 */ 21, 20, 304, 304, 304, 304, 304, 304, 304, 304, - /* 1420 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, - /* 1430 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, - /* 1440 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, + /* 0 */ 226, 210, 210, 217, 210, 226, 204, 216, 216, 210, + /* 10 */ 216, 225, 12, 13, 223, 210, 229, 223, 2, 233, + /* 20 */ 20, 201, 22, 232, 232, 229, 232, 225, 12, 13, + /* 30 */ 14, 15, 16, 246, 232, 210, 237, 232, 38, 224, + /* 40 */ 210, 216, 246, 20, 242, 258, 259, 47, 246, 225, + /* 50 */ 235, 12, 13, 14, 258, 259, 232, 232, 20, 20, + /* 60 */ 22, 22, 232, 210, 262, 263, 264, 265, 266, 69, + /* 70 */ 265, 251, 270, 271, 272, 204, 225, 38, 40, 274, + /* 80 */ 275, 276, 277, 225, 279, 232, 47, 236, 264, 231, + /* 90 */ 12, 13, 92, 291, 236, 265, 225, 204, 20, 63, + /* 100 */ 22, 20, 282, 232, 104, 275, 276, 277, 69, 279, + /* 110 */ 2, 267, 268, 242, 246, 295, 38, 246, 265, 299, + /* 120 */ 12, 13, 14, 15, 16, 47, 258, 259, 275, 276, + /* 130 */ 277, 92, 279, 262, 263, 264, 265, 266, 138, 246, + /* 140 */ 20, 270, 271, 104, 108, 109, 204, 69, 12, 13, + /* 150 */ 14, 15, 16, 130, 209, 155, 156, 157, 158, 159, + /* 160 */ 160, 161, 162, 163, 164, 220, 18, 225, 20, 69, + /* 170 */ 92, 137, 227, 139, 232, 27, 176, 138, 30, 20, + /* 180 */ 242, 81, 104, 245, 242, 225, 248, 39, 246, 69, + /* 190 */ 204, 128, 232, 44, 155, 156, 157, 158, 159, 160, + /* 200 */ 161, 162, 163, 164, 262, 263, 264, 265, 266, 210, + /* 210 */ 176, 225, 270, 271, 272, 216, 138, 68, 232, 225, + /* 220 */ 71, 210, 232, 281, 264, 231, 20, 216, 242, 239, + /* 230 */ 236, 232, 246, 155, 156, 157, 158, 159, 160, 161, + /* 240 */ 162, 163, 164, 232, 181, 182, 12, 13, 262, 263, + /* 250 */ 264, 265, 266, 69, 20, 107, 22, 271, 110, 111, + /* 260 */ 112, 113, 114, 79, 116, 117, 118, 119, 120, 121, + /* 270 */ 122, 123, 38, 21, 155, 69, 24, 25, 26, 27, + /* 280 */ 28, 29, 30, 31, 32, 12, 13, 14, 0, 49, + /* 290 */ 225, 51, 251, 20, 54, 22, 176, 57, 233, 59, + /* 300 */ 60, 176, 62, 69, 185, 186, 187, 188, 189, 21, + /* 310 */ 43, 38, 24, 25, 26, 27, 28, 29, 30, 31, + /* 320 */ 32, 210, 225, 282, 12, 13, 92, 216, 231, 207, + /* 330 */ 208, 210, 20, 236, 22, 176, 295, 216, 104, 213, + /* 340 */ 299, 215, 69, 232, 234, 12, 13, 14, 15, 16, + /* 350 */ 38, 241, 242, 232, 83, 84, 85, 86, 87, 88, + /* 360 */ 89, 90, 91, 92, 93, 92, 95, 96, 97, 98, + /* 370 */ 99, 100, 138, 14, 15, 16, 203, 104, 205, 218, + /* 380 */ 204, 69, 221, 0, 12, 13, 14, 15, 16, 155, + /* 390 */ 156, 157, 158, 159, 160, 161, 162, 163, 164, 210, + /* 400 */ 282, 225, 0, 70, 92, 216, 46, 210, 232, 0, + /* 410 */ 176, 138, 204, 295, 242, 20, 104, 299, 242, 36, + /* 420 */ 248, 232, 246, 12, 13, 14, 15, 16, 155, 156, + /* 430 */ 157, 158, 159, 160, 161, 162, 163, 164, 262, 263, + /* 440 */ 264, 265, 175, 12, 13, 14, 15, 16, 251, 217, + /* 450 */ 138, 49, 20, 51, 246, 46, 54, 225, 47, 57, + /* 460 */ 35, 59, 60, 204, 62, 233, 204, 155, 156, 157, + /* 470 */ 158, 159, 160, 161, 162, 163, 164, 301, 47, 282, + /* 480 */ 12, 13, 57, 1, 2, 20, 61, 225, 20, 78, + /* 490 */ 22, 0, 295, 212, 232, 134, 299, 72, 251, 74, + /* 500 */ 75, 70, 77, 131, 242, 246, 38, 82, 246, 78, + /* 510 */ 149, 230, 204, 251, 204, 24, 25, 26, 27, 28, + /* 520 */ 29, 30, 31, 32, 262, 263, 264, 265, 266, 282, + /* 530 */ 212, 217, 270, 271, 57, 124, 3, 69, 61, 225, + /* 540 */ 222, 4, 295, 204, 282, 210, 299, 233, 230, 20, + /* 550 */ 124, 216, 70, 142, 246, 124, 246, 295, 46, 82, + /* 560 */ 92, 299, 130, 225, 210, 210, 204, 232, 142, 197, + /* 570 */ 216, 216, 104, 142, 236, 204, 165, 166, 167, 168, + /* 580 */ 169, 170, 171, 172, 173, 246, 232, 232, 20, 260, + /* 590 */ 0, 165, 204, 204, 204, 204, 165, 166, 167, 168, + /* 600 */ 169, 170, 171, 172, 173, 0, 138, 278, 246, 14, + /* 610 */ 204, 33, 22, 226, 36, 20, 18, 246, 174, 175, + /* 620 */ 42, 23, 44, 155, 156, 157, 158, 159, 160, 161, + /* 630 */ 162, 163, 164, 35, 246, 246, 246, 246, 204, 204, + /* 640 */ 204, 204, 204, 45, 204, 204, 68, 1, 2, 71, + /* 650 */ 0, 204, 246, 67, 49, 50, 51, 52, 53, 54, + /* 660 */ 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + /* 670 */ 65, 66, 225, 260, 260, 67, 209, 80, 70, 232, + /* 680 */ 246, 246, 246, 246, 246, 22, 246, 246, 67, 242, + /* 690 */ 47, 278, 278, 246, 227, 73, 46, 73, 76, 204, + /* 700 */ 76, 38, 21, 125, 106, 127, 38, 129, 254, 262, + /* 710 */ 263, 264, 265, 266, 177, 34, 226, 270, 271, 272, + /* 720 */ 225, 199, 200, 226, 146, 192, 226, 232, 281, 131, + /* 730 */ 132, 133, 73, 135, 0, 76, 67, 242, 140, 70, + /* 740 */ 73, 246, 204, 76, 205, 215, 148, 0, 150, 293, + /* 750 */ 152, 153, 154, 302, 235, 207, 22, 262, 263, 264, + /* 760 */ 265, 266, 287, 225, 261, 270, 271, 272, 67, 22, + /* 770 */ 232, 70, 104, 67, 176, 38, 70, 225, 204, 284, + /* 780 */ 242, 280, 196, 296, 246, 290, 291, 67, 67, 67, + /* 790 */ 70, 70, 70, 67, 283, 20, 70, 210, 155, 225, + /* 800 */ 262, 263, 264, 265, 266, 204, 232, 36, 270, 271, + /* 810 */ 272, 67, 257, 214, 70, 194, 242, 38, 67, 281, + /* 820 */ 246, 70, 136, 252, 210, 251, 225, 210, 19, 210, + /* 830 */ 115, 67, 240, 232, 70, 124, 262, 263, 264, 265, + /* 840 */ 238, 104, 33, 242, 238, 36, 210, 246, 20, 232, + /* 850 */ 256, 42, 67, 44, 67, 70, 282, 70, 67, 67, + /* 860 */ 204, 70, 70, 262, 263, 264, 265, 266, 251, 295, + /* 870 */ 242, 270, 271, 299, 20, 250, 212, 68, 20, 232, + /* 880 */ 71, 225, 265, 67, 67, 243, 70, 70, 232, 212, + /* 890 */ 212, 212, 275, 276, 277, 210, 279, 20, 242, 282, + /* 900 */ 206, 225, 246, 210, 204, 225, 232, 225, 225, 204, + /* 910 */ 101, 256, 295, 225, 225, 225, 299, 225, 262, 263, + /* 920 */ 264, 265, 225, 225, 225, 225, 214, 214, 145, 206, + /* 930 */ 225, 20, 232, 242, 209, 126, 232, 232, 129, 255, + /* 940 */ 209, 184, 242, 292, 183, 250, 246, 242, 261, 249, + /* 950 */ 243, 246, 156, 144, 249, 146, 300, 301, 292, 191, + /* 960 */ 289, 247, 262, 263, 264, 265, 204, 262, 263, 264, + /* 970 */ 265, 204, 190, 246, 179, 247, 246, 178, 246, 175, + /* 980 */ 232, 20, 115, 273, 288, 195, 198, 225, 286, 260, + /* 990 */ 193, 246, 225, 285, 232, 69, 247, 247, 246, 232, + /* 1000 */ 246, 127, 269, 244, 242, 232, 303, 204, 246, 242, + /* 1010 */ 209, 209, 243, 246, 298, 204, 249, 69, 232, 221, + /* 1020 */ 214, 297, 228, 210, 262, 263, 264, 265, 225, 262, + /* 1030 */ 263, 264, 265, 214, 209, 232, 225, 206, 211, 219, + /* 1040 */ 219, 204, 253, 232, 202, 242, 0, 0, 60, 246, + /* 1050 */ 204, 38, 249, 242, 0, 151, 294, 246, 38, 38, + /* 1060 */ 38, 151, 225, 0, 38, 262, 263, 264, 265, 232, + /* 1070 */ 38, 225, 151, 262, 263, 264, 265, 204, 232, 242, + /* 1080 */ 0, 38, 0, 246, 0, 204, 38, 69, 242, 142, + /* 1090 */ 141, 104, 246, 138, 0, 0, 134, 0, 225, 262, + /* 1100 */ 263, 264, 265, 50, 0, 232, 225, 0, 262, 263, + /* 1110 */ 264, 265, 81, 232, 0, 242, 0, 0, 0, 246, + /* 1120 */ 0, 204, 0, 242, 0, 0, 204, 246, 0, 0, + /* 1130 */ 0, 0, 115, 0, 0, 262, 263, 264, 265, 0, + /* 1140 */ 0, 0, 225, 262, 263, 264, 265, 225, 0, 232, + /* 1150 */ 0, 0, 0, 0, 232, 0, 0, 22, 0, 242, + /* 1160 */ 0, 0, 204, 246, 242, 0, 43, 204, 246, 48, + /* 1170 */ 0, 0, 0, 204, 38, 43, 0, 0, 36, 262, + /* 1180 */ 263, 264, 265, 225, 262, 263, 264, 265, 225, 0, + /* 1190 */ 232, 78, 38, 67, 225, 232, 22, 0, 0, 0, + /* 1200 */ 242, 232, 0, 76, 246, 242, 38, 38, 22, 246, + /* 1210 */ 22, 242, 39, 38, 204, 246, 38, 38, 38, 0, + /* 1220 */ 262, 263, 264, 265, 0, 262, 263, 264, 265, 204, + /* 1230 */ 22, 262, 263, 264, 265, 225, 0, 22, 12, 13, + /* 1240 */ 204, 38, 232, 0, 22, 20, 0, 147, 22, 130, + /* 1250 */ 225, 38, 242, 0, 22, 204, 246, 232, 143, 57, + /* 1260 */ 22, 225, 0, 61, 38, 127, 0, 242, 232, 0, + /* 1270 */ 38, 246, 262, 263, 264, 265, 225, 130, 242, 130, + /* 1280 */ 4, 57, 246, 232, 82, 61, 69, 262, 263, 264, + /* 1290 */ 265, 43, 125, 242, 67, 19, 67, 246, 262, 263, + /* 1300 */ 264, 265, 67, 101, 102, 103, 82, 105, 69, 33, + /* 1310 */ 70, 70, 36, 262, 263, 264, 265, 41, 92, 69, + /* 1320 */ 44, 70, 70, 180, 92, 101, 102, 103, 69, 105, + /* 1330 */ 104, 67, 69, 174, 67, 81, 104, 180, 70, 81, + /* 1340 */ 70, 67, 81, 70, 68, 67, 180, 71, 4, 38, + /* 1350 */ 38, 38, 38, 38, 38, 2, 155, 70, 81, 69, + /* 1360 */ 69, 128, 70, 70, 138, 69, 69, 69, 0, 43, + /* 1370 */ 138, 69, 125, 79, 22, 69, 81, 70, 38, 38, + /* 1380 */ 81, 155, 156, 80, 38, 38, 69, 155, 156, 70, + /* 1390 */ 69, 22, 70, 69, 38, 70, 69, 38, 70, 69, + /* 1400 */ 69, 38, 94, 94, 94, 82, 69, 69, 104, 38, + /* 1410 */ 22, 47, 94, 48, 22, 38, 38, 38, 38, 38, + /* 1420 */ 38, 38, 22, 38, 38, 38, 0, 38, 38, 38, + /* 1430 */ 0, 38, 38, 38, 38, 36, 38, 0, 37, 0, + /* 1440 */ 43, 22, 21, 304, 22, 22, 21, 20, 304, 304, /* 1450 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, /* 1460 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, /* 1470 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, @@ -516,145 +519,148 @@ static const YYCODETYPE yy_lookahead[] = { /* 1580 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, /* 1590 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, /* 1600 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, - /* 1610 */ 304, 304, 304, + /* 1610 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, + /* 1620 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, + /* 1630 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, + /* 1640 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, }; -#define YY_SHIFT_COUNT (511) +#define YY_SHIFT_COUNT (510) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (1403) +#define YY_SHIFT_MAX (1439) static const unsigned short int yy_shift_ofst[] = { - /* 0 */ 176, 246, 344, 357, 357, 357, 357, 468, 357, 357, - /* 10 */ 600, 650, 76, 567, 600, 600, 600, 600, 600, 600, - /* 20 */ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, - /* 30 */ 600, 600, 600, 312, 312, 312, 163, 639, 639, 59, - /* 40 */ 49, 49, 5, 639, 49, 49, 49, 49, 49, 49, - /* 50 */ 83, 129, 138, 138, 5, 177, 129, 49, 49, 129, - /* 60 */ 49, 129, 177, 129, 129, 49, 185, 0, 19, 78, - /* 70 */ 78, 74, 806, 256, 93, 256, 256, 256, 256, 256, - /* 80 */ 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - /* 90 */ 256, 256, 256, 256, 518, 399, 334, 334, 334, 498, - /* 100 */ 220, 177, 129, 129, 129, 189, 79, 79, 79, 79, - /* 110 */ 79, 79, 645, 22, 314, 405, 133, 222, 31, 507, - /* 120 */ 500, 481, 252, 481, 553, 505, 526, 761, 750, 755, - /* 130 */ 662, 761, 761, 697, 700, 700, 761, 820, 177, 854, - /* 140 */ 83, 220, 869, 83, 83, 761, 83, 884, 129, 129, - /* 150 */ 129, 129, 129, 129, 129, 129, 129, 129, 129, 755, - /* 160 */ 755, 761, 884, 220, 820, 796, 177, 854, 185, 220, - /* 170 */ 869, 185, 927, 766, 775, 800, 766, 775, 800, 800, - /* 180 */ 769, 780, 805, 797, 812, 220, 970, 880, 815, 825, - /* 190 */ 830, 957, 129, 775, 800, 800, 775, 800, 914, 220, - /* 200 */ 869, 185, 189, 185, 220, 983, 755, 755, 761, 185, - /* 210 */ 884, 1412, 1412, 1412, 1412, 1412, 21, 811, 108, 950, - /* 220 */ 992, 999, 191, 602, 308, 821, 44, 44, 44, 44, - /* 230 */ 44, 44, 44, 450, 277, 395, 331, 112, 112, 112, - /* 240 */ 112, 291, 85, 576, 623, 634, 635, 636, 714, 715, - /* 250 */ 717, 724, 651, 680, 682, 693, 530, 593, 607, 708, - /* 260 */ 673, 709, 672, 729, 744, 746, 772, 776, 50, 713, - /* 270 */ 784, 790, 795, 817, 823, 828, 656, 1076, 1080, 1023, - /* 280 */ 1084, 1047, 935, 1049, 1060, 1065, 954, 1108, 1071, 1072, - /* 290 */ 960, 1117, 1081, 1118, 1083, 1122, 1054, 982, 984, 1022, - /* 300 */ 989, 1129, 1130, 1082, 997, 1134, 1140, 1061, 1143, 1144, - /* 310 */ 1146, 1147, 1148, 1150, 1151, 1152, 1153, 1155, 1156, 1157, - /* 320 */ 1158, 1044, 1160, 1163, 1164, 1170, 1172, 1173, 1159, 1174, - /* 330 */ 1177, 1178, 1180, 1184, 1185, 1186, 1187, 1188, 1162, 1189, - /* 340 */ 1142, 1195, 1196, 1168, 1171, 1165, 1198, 1209, 1212, 1213, - /* 350 */ 1137, 1145, 1181, 1149, 1200, 1223, 1190, 1191, 1192, 1193, - /* 360 */ 1149, 1206, 1208, 1225, 1204, 1227, 1211, 1215, 1247, 1226, - /* 370 */ 1214, 1250, 1229, 1256, 1235, 1238, 1260, 1131, 1115, 1228, - /* 380 */ 1264, 1124, 1243, 1138, 1154, 1273, 1274, 1166, 1279, 1216, - /* 390 */ 1237, 1161, 1220, 1221, 1102, 1219, 1230, 1222, 1224, 1231, - /* 400 */ 1232, 1234, 1236, 1240, 1202, 1239, 1242, 1110, 1241, 1244, - /* 410 */ 1217, 1120, 1245, 1218, 1246, 1248, 1133, 1291, 1266, 1272, - /* 420 */ 1280, 1281, 1282, 1287, 1315, 1175, 1251, 1257, 1259, 1262, - /* 430 */ 1263, 1265, 1267, 1268, 1201, 1269, 1326, 1296, 1233, 1271, - /* 440 */ 1255, 1261, 1270, 1319, 1275, 1276, 1277, 1305, 1307, 1283, - /* 450 */ 1278, 1308, 1284, 1285, 1311, 1288, 1289, 1312, 1292, 1290, - /* 460 */ 1316, 1293, 1286, 1294, 1295, 1297, 1341, 1299, 1298, 1327, - /* 470 */ 1300, 1301, 1302, 1328, 1149, 1342, 1320, 1322, 1350, 1335, - /* 480 */ 1336, 1337, 1338, 1339, 1340, 1344, 1357, 1345, 1149, 1346, - /* 490 */ 1347, 1348, 1349, 1352, 1354, 1355, 1356, 1395, 1358, 1361, - /* 500 */ 1359, 1398, 1362, 1364, 1399, 1403, 1383, 1385, 1386, 1387, - /* 510 */ 1389, 1391, + /* 0 */ 598, 0, 39, 78, 78, 78, 78, 234, 78, 78, + /* 10 */ 312, 468, 120, 273, 312, 312, 312, 312, 312, 312, + /* 20 */ 312, 312, 312, 312, 312, 312, 312, 312, 312, 312, + /* 30 */ 312, 312, 312, 206, 206, 206, 159, 1226, 1226, 34, + /* 40 */ 81, 81, 125, 1226, 81, 81, 81, 81, 81, 81, + /* 50 */ 360, 395, 465, 465, 125, 529, 395, 81, 81, 395, + /* 60 */ 81, 395, 529, 395, 395, 81, 512, 148, 431, 411, + /* 70 */ 411, 252, 425, 1232, 240, 1232, 1232, 1232, 1232, 1232, + /* 80 */ 1232, 1232, 1232, 1232, 1232, 1232, 1232, 1232, 1232, 1232, + /* 90 */ 1232, 1232, 1232, 1232, 38, 409, 23, 23, 23, 650, + /* 100 */ 568, 529, 395, 395, 395, 597, 271, 271, 271, 271, + /* 110 */ 271, 271, 809, 288, 402, 372, 119, 477, 63, 663, + /* 120 */ 432, 444, 267, 444, 595, 533, 537, 775, 771, 779, + /* 130 */ 686, 775, 775, 715, 711, 711, 775, 828, 529, 854, + /* 140 */ 360, 568, 858, 360, 360, 775, 360, 877, 395, 395, + /* 150 */ 395, 395, 395, 395, 395, 395, 395, 395, 395, 779, + /* 160 */ 779, 775, 877, 568, 828, 783, 529, 854, 512, 568, + /* 170 */ 858, 512, 911, 757, 761, 796, 757, 761, 796, 796, + /* 180 */ 768, 782, 795, 799, 804, 568, 961, 867, 788, 790, + /* 190 */ 797, 926, 395, 761, 796, 796, 761, 796, 874, 568, + /* 200 */ 858, 512, 597, 512, 568, 948, 779, 779, 775, 512, + /* 210 */ 877, 1448, 1448, 1448, 1448, 1448, 605, 578, 491, 1276, + /* 220 */ 1202, 1224, 16, 108, 333, 136, 136, 136, 136, 136, + /* 230 */ 136, 136, 149, 36, 482, 426, 359, 359, 359, 359, + /* 240 */ 383, 361, 608, 622, 624, 659, 667, 590, 734, 747, + /* 250 */ 681, 669, 701, 706, 646, 522, 621, 586, 720, 643, + /* 260 */ 721, 100, 722, 726, 744, 751, 764, 668, 737, 785, + /* 270 */ 787, 791, 792, 816, 817, 184, 1046, 1047, 988, 1054, + /* 280 */ 1013, 904, 1020, 1021, 1022, 910, 1063, 1026, 1032, 921, + /* 290 */ 1080, 1043, 1082, 1048, 1084, 1018, 947, 949, 987, 955, + /* 300 */ 1094, 1095, 1053, 962, 1097, 1104, 1031, 1107, 1114, 1116, + /* 310 */ 1117, 1118, 1120, 1122, 1124, 1125, 1128, 1129, 1130, 1131, + /* 320 */ 1017, 1133, 1134, 1139, 1140, 1141, 1148, 1135, 1150, 1151, + /* 330 */ 1152, 1153, 1155, 1156, 1158, 1160, 1161, 1123, 1165, 1121, + /* 340 */ 1170, 1171, 1136, 1142, 1132, 1172, 1176, 1177, 1189, 1113, + /* 350 */ 1127, 1154, 1126, 1174, 1197, 1168, 1169, 1175, 1178, 1126, + /* 360 */ 1179, 1180, 1198, 1186, 1199, 1188, 1173, 1219, 1208, 1203, + /* 370 */ 1236, 1215, 1243, 1222, 1225, 1246, 1119, 1100, 1213, 1253, + /* 380 */ 1115, 1238, 1147, 1138, 1262, 1266, 1149, 1269, 1217, 1248, + /* 390 */ 1167, 1227, 1229, 1143, 1240, 1235, 1241, 1239, 1250, 1251, + /* 400 */ 1259, 1252, 1264, 1254, 1263, 1267, 1157, 1268, 1270, 1258, + /* 410 */ 1159, 1274, 1261, 1273, 1278, 1166, 1344, 1311, 1312, 1313, + /* 420 */ 1314, 1315, 1316, 1353, 1201, 1277, 1287, 1290, 1291, 1292, + /* 430 */ 1293, 1296, 1297, 1233, 1298, 1368, 1326, 1247, 1302, 1294, + /* 440 */ 1295, 1299, 1352, 1306, 1303, 1307, 1340, 1341, 1317, 1319, + /* 450 */ 1346, 1321, 1322, 1347, 1324, 1325, 1356, 1327, 1328, 1359, + /* 460 */ 1330, 1308, 1309, 1310, 1318, 1369, 1323, 1331, 1363, 1304, + /* 470 */ 1337, 1338, 1371, 1126, 1388, 1365, 1364, 1392, 1377, 1378, + /* 480 */ 1379, 1380, 1381, 1382, 1383, 1400, 1385, 1126, 1386, 1387, + /* 490 */ 1389, 1390, 1391, 1393, 1394, 1395, 1426, 1396, 1399, 1397, + /* 500 */ 1430, 1398, 1401, 1437, 1439, 1419, 1421, 1422, 1423, 1425, + /* 510 */ 1427, }; #define YY_REDUCE_COUNT (215) -#define YY_REDUCE_MIN (-266) -#define YY_REDUCE_MAX (1059) +#define YY_REDUCE_MIN (-226) +#define YY_REDUCE_MAX (1051) static const short yy_reduce_ofst[] = { - /* 0 */ 227, -9, 71, 168, 221, 285, 329, 403, 35, 502, - /* 10 */ 558, 606, 550, 660, 669, 703, 739, 747, 773, 212, - /* 20 */ 300, 802, 826, 850, 874, 903, 929, 937, 972, 978, - /* 30 */ 1007, 1013, 1059, -50, 113, 309, -10, -222, -218, -19, - /* 40 */ -207, -206, 358, -246, -187, -101, -86, -59, -2, 55, - /* 50 */ 80, -217, -84, 119, 161, -181, -16, 115, 143, 216, - /* 60 */ 366, 190, -179, 226, 290, 416, 215, -195, -266, -266, - /* 70 */ -266, 33, 174, 18, 193, 24, 183, 293, 307, 324, - /* 80 */ 365, 373, 393, 404, 427, 429, 430, 433, 437, 438, - /* 90 */ 454, 482, 486, 487, -202, 137, 274, 318, 343, 420, - /* 100 */ 351, -204, -15, 299, 457, -153, 48, 86, 120, 154, - /* 110 */ 224, 253, 251, 338, 353, 257, 387, 466, 453, 554, - /* 120 */ 508, 483, 483, 483, 545, 484, 501, 575, 535, 583, - /* 130 */ 556, 592, 608, 579, 612, 618, 620, 605, 624, 625, - /* 140 */ 664, 654, 653, 685, 687, 690, 691, 699, 683, 688, - /* 150 */ 689, 692, 694, 695, 696, 701, 702, 704, 705, 698, - /* 160 */ 723, 706, 733, 678, 686, 707, 710, 711, 735, 716, - /* 170 */ 712, 737, 719, 661, 726, 728, 667, 731, 730, 736, - /* 180 */ 674, 720, 721, 732, 483, 756, 740, 741, 722, 718, - /* 190 */ 727, 759, 545, 782, 785, 786, 792, 787, 798, 813, - /* 200 */ 803, 834, 829, 838, 827, 833, 841, 843, 852, 860, - /* 210 */ 857, 818, 851, 858, 862, 877, + /* 0 */ -180, 262, 495, -198, -58, 447, 538, 574, -129, 601, + /* 10 */ 656, -14, 617, 700, 705, 762, 176, 767, 803, 811, + /* 20 */ 837, 846, 873, 881, 917, 922, 958, 963, 969, 1010, + /* 30 */ 1025, 1036, 1051, -195, -170, -147, 197, -213, -204, 41, + /* 40 */ -209, -206, 247, -132, -208, -175, -1, 11, 111, 121, + /* 50 */ 318, -142, -176, -40, 118, -62, -214, 189, 335, -6, + /* 60 */ 354, 232, 110, 97, 314, 355, -55, -201, -156, -156, + /* 70 */ -156, 173, -185, -107, 126, 208, 259, 308, 310, 339, + /* 80 */ 362, 371, 388, 389, 390, 391, 406, 434, 435, 436, + /* 90 */ 437, 438, 440, 441, 122, 281, 329, 413, 414, 467, + /* 100 */ -10, 172, 65, -149, 338, 161, -226, -221, 387, 490, + /* 110 */ 497, 500, 454, 539, 530, 451, 456, 519, 475, 548, + /* 120 */ 503, 501, 501, 501, 552, 487, 511, 587, 555, 599, + /* 130 */ 571, 614, 619, 592, 602, 606, 636, 594, 628, 625, + /* 140 */ 664, 647, 642, 677, 678, 685, 679, 694, 676, 680, + /* 150 */ 682, 683, 688, 689, 690, 692, 697, 698, 699, 712, + /* 160 */ 713, 693, 723, 674, 655, 684, 691, 695, 725, 704, + /* 170 */ 707, 731, 687, 651, 714, 727, 666, 728, 730, 732, + /* 180 */ 671, 696, 702, 708, 501, 748, 729, 710, 703, 716, + /* 190 */ 724, 733, 552, 749, 745, 752, 750, 754, 759, 773, + /* 200 */ 769, 801, 798, 802, 786, 794, 806, 819, 813, 825, + /* 210 */ 831, 789, 820, 821, 827, 842, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, - /* 10 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, - /* 20 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, - /* 30 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, - /* 40 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, - /* 50 */ 1204, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, - /* 60 */ 1151, 1151, 1151, 1151, 1151, 1151, 1202, 1331, 1151, 1462, - /* 70 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, - /* 80 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, - /* 90 */ 1151, 1151, 1151, 1151, 1151, 1204, 1473, 1473, 1473, 1202, - /* 100 */ 1151, 1151, 1151, 1151, 1151, 1289, 1151, 1151, 1151, 1151, - /* 110 */ 1151, 1151, 1365, 1151, 1151, 1537, 1151, 1242, 1497, 1151, - /* 120 */ 1489, 1465, 1479, 1466, 1151, 1522, 1482, 1151, 1151, 1151, - /* 130 */ 1357, 1151, 1151, 1336, 1333, 1333, 1151, 1151, 1151, 1151, - /* 140 */ 1204, 1151, 1151, 1204, 1204, 1151, 1204, 1151, 1151, 1151, - /* 150 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, - /* 160 */ 1151, 1151, 1151, 1151, 1151, 1367, 1151, 1151, 1202, 1151, - /* 170 */ 1151, 1202, 1151, 1504, 1502, 1151, 1504, 1502, 1151, 1151, - /* 180 */ 1516, 1512, 1495, 1493, 1479, 1151, 1151, 1151, 1540, 1528, - /* 190 */ 1524, 1151, 1151, 1502, 1151, 1151, 1502, 1151, 1344, 1151, - /* 200 */ 1151, 1202, 1151, 1202, 1151, 1258, 1151, 1151, 1151, 1202, - /* 210 */ 1151, 1359, 1292, 1292, 1205, 1156, 1151, 1151, 1151, 1151, - /* 220 */ 1151, 1151, 1151, 1151, 1151, 1151, 1427, 1515, 1514, 1426, - /* 230 */ 1439, 1438, 1437, 1151, 1151, 1151, 1151, 1421, 1422, 1420, - /* 240 */ 1419, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, - /* 250 */ 1151, 1151, 1151, 1151, 1151, 1463, 1151, 1525, 1529, 1151, - /* 260 */ 1151, 1151, 1404, 1151, 1151, 1151, 1151, 1151, 1151, 1151, - /* 270 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, - /* 280 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, - /* 290 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, - /* 300 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, - /* 310 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, - /* 320 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, - /* 330 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, - /* 340 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, - /* 350 */ 1151, 1151, 1151, 1303, 1151, 1151, 1151, 1151, 1151, 1151, - /* 360 */ 1228, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, - /* 370 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, - /* 380 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, - /* 390 */ 1151, 1151, 1486, 1496, 1151, 1151, 1151, 1151, 1151, 1151, - /* 400 */ 1151, 1151, 1151, 1151, 1404, 1151, 1513, 1151, 1472, 1468, - /* 410 */ 1151, 1151, 1464, 1151, 1151, 1523, 1151, 1151, 1151, 1151, - /* 420 */ 1151, 1151, 1151, 1151, 1458, 1151, 1151, 1151, 1151, 1151, - /* 430 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, - /* 440 */ 1151, 1403, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1286, - /* 450 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, - /* 460 */ 1151, 1151, 1271, 1269, 1268, 1267, 1151, 1264, 1151, 1151, - /* 470 */ 1151, 1151, 1151, 1151, 1294, 1151, 1151, 1151, 1151, 1151, - /* 480 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1214, 1151, - /* 490 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, - /* 500 */ 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, 1151, - /* 510 */ 1151, 1151, + /* 0 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, + /* 10 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, + /* 20 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, + /* 30 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, + /* 40 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, + /* 50 */ 1205, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, + /* 60 */ 1152, 1152, 1152, 1152, 1152, 1152, 1203, 1332, 1152, 1464, + /* 70 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, + /* 80 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, + /* 90 */ 1152, 1152, 1152, 1152, 1152, 1205, 1475, 1475, 1475, 1203, + /* 100 */ 1152, 1152, 1152, 1152, 1152, 1290, 1152, 1152, 1152, 1152, + /* 110 */ 1152, 1152, 1366, 1152, 1152, 1539, 1152, 1243, 1499, 1152, + /* 120 */ 1491, 1467, 1481, 1468, 1152, 1524, 1484, 1152, 1152, 1152, + /* 130 */ 1358, 1152, 1152, 1337, 1334, 1334, 1152, 1152, 1152, 1152, + /* 140 */ 1205, 1152, 1152, 1205, 1205, 1152, 1205, 1152, 1152, 1152, + /* 150 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, + /* 160 */ 1152, 1152, 1152, 1152, 1152, 1368, 1152, 1152, 1203, 1152, + /* 170 */ 1152, 1203, 1152, 1506, 1504, 1152, 1506, 1504, 1152, 1152, + /* 180 */ 1518, 1514, 1497, 1495, 1481, 1152, 1152, 1152, 1542, 1530, + /* 190 */ 1526, 1152, 1152, 1504, 1152, 1152, 1504, 1152, 1345, 1152, + /* 200 */ 1152, 1203, 1152, 1203, 1152, 1259, 1152, 1152, 1152, 1203, + /* 210 */ 1152, 1360, 1293, 1293, 1206, 1157, 1152, 1152, 1152, 1152, + /* 220 */ 1152, 1152, 1152, 1152, 1152, 1428, 1517, 1516, 1427, 1441, + /* 230 */ 1440, 1439, 1152, 1152, 1152, 1152, 1422, 1423, 1421, 1420, + /* 240 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, + /* 250 */ 1152, 1152, 1152, 1152, 1465, 1152, 1527, 1531, 1152, 1152, + /* 260 */ 1152, 1405, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, + /* 270 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, + /* 280 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, + /* 290 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, + /* 300 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, + /* 310 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, + /* 320 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, + /* 330 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, + /* 340 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, + /* 350 */ 1152, 1152, 1304, 1152, 1152, 1152, 1152, 1152, 1152, 1229, + /* 360 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, + /* 370 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, + /* 380 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, + /* 390 */ 1152, 1488, 1498, 1152, 1152, 1152, 1152, 1152, 1152, 1152, + /* 400 */ 1152, 1152, 1152, 1405, 1152, 1515, 1152, 1474, 1470, 1152, + /* 410 */ 1152, 1466, 1152, 1152, 1525, 1152, 1152, 1152, 1152, 1152, + /* 420 */ 1152, 1152, 1152, 1460, 1152, 1152, 1152, 1152, 1152, 1152, + /* 430 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, + /* 440 */ 1404, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1287, 1152, + /* 450 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, + /* 460 */ 1152, 1272, 1270, 1269, 1268, 1152, 1265, 1152, 1152, 1152, + /* 470 */ 1152, 1152, 1152, 1295, 1152, 1152, 1152, 1152, 1152, 1152, + /* 480 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1215, 1152, 1152, + /* 490 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, + /* 500 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, + /* 510 */ 1152, }; /********** End of lemon-generated parsing tables *****************************/ @@ -918,7 +924,7 @@ static const char *const yyTokenName[] = { /* 154 */ "SYNCDB", /* 155 */ "NULL", /* 156 */ "NK_VARIABLE", - /* 157 */ "NK_UNDERLINE", + /* 157 */ "NOW", /* 158 */ "ROWTS", /* 159 */ "TBNAME", /* 160 */ "QSTARTTS", @@ -1348,119 +1354,120 @@ static const char *const yyRuleName[] = { /* 273 */ "expression_list ::= expression_list NK_COMMA expression", /* 274 */ "column_reference ::= column_name", /* 275 */ "column_reference ::= table_name NK_DOT column_name", - /* 276 */ "pseudo_column ::= NK_UNDERLINE ROWTS", - /* 277 */ "pseudo_column ::= TBNAME", - /* 278 */ "pseudo_column ::= NK_UNDERLINE QSTARTTS", - /* 279 */ "pseudo_column ::= NK_UNDERLINE QENDTS", - /* 280 */ "pseudo_column ::= NK_UNDERLINE WSTARTTS", - /* 281 */ "pseudo_column ::= NK_UNDERLINE WENDTS", - /* 282 */ "pseudo_column ::= NK_UNDERLINE WDURATION", - /* 283 */ "predicate ::= expression compare_op expression", - /* 284 */ "predicate ::= expression BETWEEN expression AND expression", - /* 285 */ "predicate ::= expression NOT BETWEEN expression AND expression", - /* 286 */ "predicate ::= expression IS NULL", - /* 287 */ "predicate ::= expression IS NOT NULL", - /* 288 */ "predicate ::= expression in_op in_predicate_value", - /* 289 */ "compare_op ::= NK_LT", - /* 290 */ "compare_op ::= NK_GT", - /* 291 */ "compare_op ::= NK_LE", - /* 292 */ "compare_op ::= NK_GE", - /* 293 */ "compare_op ::= NK_NE", - /* 294 */ "compare_op ::= NK_EQ", - /* 295 */ "compare_op ::= LIKE", - /* 296 */ "compare_op ::= NOT LIKE", - /* 297 */ "compare_op ::= MATCH", - /* 298 */ "compare_op ::= NMATCH", - /* 299 */ "in_op ::= IN", - /* 300 */ "in_op ::= NOT IN", - /* 301 */ "in_predicate_value ::= NK_LP expression_list NK_RP", - /* 302 */ "boolean_value_expression ::= boolean_primary", - /* 303 */ "boolean_value_expression ::= NOT boolean_primary", - /* 304 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", - /* 305 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", - /* 306 */ "boolean_primary ::= predicate", - /* 307 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", - /* 308 */ "common_expression ::= expression", - /* 309 */ "common_expression ::= boolean_value_expression", - /* 310 */ "from_clause ::= FROM table_reference_list", - /* 311 */ "table_reference_list ::= table_reference", - /* 312 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", - /* 313 */ "table_reference ::= table_primary", - /* 314 */ "table_reference ::= joined_table", - /* 315 */ "table_primary ::= table_name alias_opt", - /* 316 */ "table_primary ::= db_name NK_DOT table_name alias_opt", - /* 317 */ "table_primary ::= subquery alias_opt", - /* 318 */ "table_primary ::= parenthesized_joined_table", - /* 319 */ "alias_opt ::=", - /* 320 */ "alias_opt ::= table_alias", - /* 321 */ "alias_opt ::= AS table_alias", - /* 322 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", - /* 323 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", - /* 324 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", - /* 325 */ "join_type ::=", - /* 326 */ "join_type ::= INNER", - /* 327 */ "query_specification ::= SELECT set_quantifier_opt select_list from_clause where_clause_opt partition_by_clause_opt twindow_clause_opt group_by_clause_opt having_clause_opt", - /* 328 */ "set_quantifier_opt ::=", - /* 329 */ "set_quantifier_opt ::= DISTINCT", - /* 330 */ "set_quantifier_opt ::= ALL", - /* 331 */ "select_list ::= NK_STAR", - /* 332 */ "select_list ::= select_sublist", - /* 333 */ "select_sublist ::= select_item", - /* 334 */ "select_sublist ::= select_sublist NK_COMMA select_item", - /* 335 */ "select_item ::= common_expression", - /* 336 */ "select_item ::= common_expression column_alias", - /* 337 */ "select_item ::= common_expression AS column_alias", - /* 338 */ "select_item ::= table_name NK_DOT NK_STAR", - /* 339 */ "where_clause_opt ::=", - /* 340 */ "where_clause_opt ::= WHERE search_condition", - /* 341 */ "partition_by_clause_opt ::=", - /* 342 */ "partition_by_clause_opt ::= PARTITION BY expression_list", - /* 343 */ "twindow_clause_opt ::=", - /* 344 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", - /* 345 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP", - /* 346 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", - /* 347 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", - /* 348 */ "sliding_opt ::=", - /* 349 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", - /* 350 */ "fill_opt ::=", - /* 351 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", - /* 352 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", - /* 353 */ "fill_mode ::= NONE", - /* 354 */ "fill_mode ::= PREV", - /* 355 */ "fill_mode ::= NULL", - /* 356 */ "fill_mode ::= LINEAR", - /* 357 */ "fill_mode ::= NEXT", - /* 358 */ "group_by_clause_opt ::=", - /* 359 */ "group_by_clause_opt ::= GROUP BY group_by_list", - /* 360 */ "group_by_list ::= expression", - /* 361 */ "group_by_list ::= group_by_list NK_COMMA expression", - /* 362 */ "having_clause_opt ::=", - /* 363 */ "having_clause_opt ::= HAVING search_condition", - /* 364 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt", - /* 365 */ "query_expression_body ::= query_primary", - /* 366 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body", - /* 367 */ "query_primary ::= query_specification", - /* 368 */ "order_by_clause_opt ::=", - /* 369 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", - /* 370 */ "slimit_clause_opt ::=", - /* 371 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", - /* 372 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", - /* 373 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 374 */ "limit_clause_opt ::=", - /* 375 */ "limit_clause_opt ::= LIMIT NK_INTEGER", - /* 376 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", - /* 377 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 378 */ "subquery ::= NK_LP query_expression NK_RP", - /* 379 */ "search_condition ::= common_expression", - /* 380 */ "sort_specification_list ::= sort_specification", - /* 381 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", - /* 382 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt", - /* 383 */ "ordering_specification_opt ::=", - /* 384 */ "ordering_specification_opt ::= ASC", - /* 385 */ "ordering_specification_opt ::= DESC", - /* 386 */ "null_ordering_opt ::=", - /* 387 */ "null_ordering_opt ::= NULLS FIRST", - /* 388 */ "null_ordering_opt ::= NULLS LAST", + /* 276 */ "pseudo_column ::= NOW", + /* 277 */ "pseudo_column ::= ROWTS", + /* 278 */ "pseudo_column ::= TBNAME", + /* 279 */ "pseudo_column ::= QSTARTTS", + /* 280 */ "pseudo_column ::= QENDTS", + /* 281 */ "pseudo_column ::= WSTARTTS", + /* 282 */ "pseudo_column ::= WENDTS", + /* 283 */ "pseudo_column ::= WDURATION", + /* 284 */ "predicate ::= expression compare_op expression", + /* 285 */ "predicate ::= expression BETWEEN expression AND expression", + /* 286 */ "predicate ::= expression NOT BETWEEN expression AND expression", + /* 287 */ "predicate ::= expression IS NULL", + /* 288 */ "predicate ::= expression IS NOT NULL", + /* 289 */ "predicate ::= expression in_op in_predicate_value", + /* 290 */ "compare_op ::= NK_LT", + /* 291 */ "compare_op ::= NK_GT", + /* 292 */ "compare_op ::= NK_LE", + /* 293 */ "compare_op ::= NK_GE", + /* 294 */ "compare_op ::= NK_NE", + /* 295 */ "compare_op ::= NK_EQ", + /* 296 */ "compare_op ::= LIKE", + /* 297 */ "compare_op ::= NOT LIKE", + /* 298 */ "compare_op ::= MATCH", + /* 299 */ "compare_op ::= NMATCH", + /* 300 */ "in_op ::= IN", + /* 301 */ "in_op ::= NOT IN", + /* 302 */ "in_predicate_value ::= NK_LP expression_list NK_RP", + /* 303 */ "boolean_value_expression ::= boolean_primary", + /* 304 */ "boolean_value_expression ::= NOT boolean_primary", + /* 305 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", + /* 306 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", + /* 307 */ "boolean_primary ::= predicate", + /* 308 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", + /* 309 */ "common_expression ::= expression", + /* 310 */ "common_expression ::= boolean_value_expression", + /* 311 */ "from_clause ::= FROM table_reference_list", + /* 312 */ "table_reference_list ::= table_reference", + /* 313 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", + /* 314 */ "table_reference ::= table_primary", + /* 315 */ "table_reference ::= joined_table", + /* 316 */ "table_primary ::= table_name alias_opt", + /* 317 */ "table_primary ::= db_name NK_DOT table_name alias_opt", + /* 318 */ "table_primary ::= subquery alias_opt", + /* 319 */ "table_primary ::= parenthesized_joined_table", + /* 320 */ "alias_opt ::=", + /* 321 */ "alias_opt ::= table_alias", + /* 322 */ "alias_opt ::= AS table_alias", + /* 323 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", + /* 324 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", + /* 325 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", + /* 326 */ "join_type ::=", + /* 327 */ "join_type ::= INNER", + /* 328 */ "query_specification ::= SELECT set_quantifier_opt select_list from_clause where_clause_opt partition_by_clause_opt twindow_clause_opt group_by_clause_opt having_clause_opt", + /* 329 */ "set_quantifier_opt ::=", + /* 330 */ "set_quantifier_opt ::= DISTINCT", + /* 331 */ "set_quantifier_opt ::= ALL", + /* 332 */ "select_list ::= NK_STAR", + /* 333 */ "select_list ::= select_sublist", + /* 334 */ "select_sublist ::= select_item", + /* 335 */ "select_sublist ::= select_sublist NK_COMMA select_item", + /* 336 */ "select_item ::= common_expression", + /* 337 */ "select_item ::= common_expression column_alias", + /* 338 */ "select_item ::= common_expression AS column_alias", + /* 339 */ "select_item ::= table_name NK_DOT NK_STAR", + /* 340 */ "where_clause_opt ::=", + /* 341 */ "where_clause_opt ::= WHERE search_condition", + /* 342 */ "partition_by_clause_opt ::=", + /* 343 */ "partition_by_clause_opt ::= PARTITION BY expression_list", + /* 344 */ "twindow_clause_opt ::=", + /* 345 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", + /* 346 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP", + /* 347 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", + /* 348 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", + /* 349 */ "sliding_opt ::=", + /* 350 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", + /* 351 */ "fill_opt ::=", + /* 352 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", + /* 353 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", + /* 354 */ "fill_mode ::= NONE", + /* 355 */ "fill_mode ::= PREV", + /* 356 */ "fill_mode ::= NULL", + /* 357 */ "fill_mode ::= LINEAR", + /* 358 */ "fill_mode ::= NEXT", + /* 359 */ "group_by_clause_opt ::=", + /* 360 */ "group_by_clause_opt ::= GROUP BY group_by_list", + /* 361 */ "group_by_list ::= expression", + /* 362 */ "group_by_list ::= group_by_list NK_COMMA expression", + /* 363 */ "having_clause_opt ::=", + /* 364 */ "having_clause_opt ::= HAVING search_condition", + /* 365 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt", + /* 366 */ "query_expression_body ::= query_primary", + /* 367 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body", + /* 368 */ "query_primary ::= query_specification", + /* 369 */ "order_by_clause_opt ::=", + /* 370 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", + /* 371 */ "slimit_clause_opt ::=", + /* 372 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", + /* 373 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", + /* 374 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 375 */ "limit_clause_opt ::=", + /* 376 */ "limit_clause_opt ::= LIMIT NK_INTEGER", + /* 377 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", + /* 378 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 379 */ "subquery ::= NK_LP query_expression NK_RP", + /* 380 */ "search_condition ::= common_expression", + /* 381 */ "sort_specification_list ::= sort_specification", + /* 382 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", + /* 383 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt", + /* 384 */ "ordering_specification_opt ::=", + /* 385 */ "ordering_specification_opt ::= ASC", + /* 386 */ "ordering_specification_opt ::= DESC", + /* 387 */ "null_ordering_opt ::=", + /* 388 */ "null_ordering_opt ::= NULLS FIRST", + /* 389 */ "null_ordering_opt ::= NULLS LAST", }; #endif /* NDEBUG */ @@ -2308,119 +2315,120 @@ static const struct { { 249, -3 }, /* (273) expression_list ::= expression_list NK_COMMA expression */ { 264, -1 }, /* (274) column_reference ::= column_name */ { 264, -3 }, /* (275) column_reference ::= table_name NK_DOT column_name */ - { 263, -2 }, /* (276) pseudo_column ::= NK_UNDERLINE ROWTS */ - { 263, -1 }, /* (277) pseudo_column ::= TBNAME */ - { 263, -2 }, /* (278) pseudo_column ::= NK_UNDERLINE QSTARTTS */ - { 263, -2 }, /* (279) pseudo_column ::= NK_UNDERLINE QENDTS */ - { 263, -2 }, /* (280) pseudo_column ::= NK_UNDERLINE WSTARTTS */ - { 263, -2 }, /* (281) pseudo_column ::= NK_UNDERLINE WENDTS */ - { 263, -2 }, /* (282) pseudo_column ::= NK_UNDERLINE WDURATION */ - { 266, -3 }, /* (283) predicate ::= expression compare_op expression */ - { 266, -5 }, /* (284) predicate ::= expression BETWEEN expression AND expression */ - { 266, -6 }, /* (285) predicate ::= expression NOT BETWEEN expression AND expression */ - { 266, -3 }, /* (286) predicate ::= expression IS NULL */ - { 266, -4 }, /* (287) predicate ::= expression IS NOT NULL */ - { 266, -3 }, /* (288) predicate ::= expression in_op in_predicate_value */ - { 267, -1 }, /* (289) compare_op ::= NK_LT */ - { 267, -1 }, /* (290) compare_op ::= NK_GT */ - { 267, -1 }, /* (291) compare_op ::= NK_LE */ - { 267, -1 }, /* (292) compare_op ::= NK_GE */ - { 267, -1 }, /* (293) compare_op ::= NK_NE */ - { 267, -1 }, /* (294) compare_op ::= NK_EQ */ - { 267, -1 }, /* (295) compare_op ::= LIKE */ - { 267, -2 }, /* (296) compare_op ::= NOT LIKE */ - { 267, -1 }, /* (297) compare_op ::= MATCH */ - { 267, -1 }, /* (298) compare_op ::= NMATCH */ - { 268, -1 }, /* (299) in_op ::= IN */ - { 268, -2 }, /* (300) in_op ::= NOT IN */ - { 269, -3 }, /* (301) in_predicate_value ::= NK_LP expression_list NK_RP */ - { 270, -1 }, /* (302) boolean_value_expression ::= boolean_primary */ - { 270, -2 }, /* (303) boolean_value_expression ::= NOT boolean_primary */ - { 270, -3 }, /* (304) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - { 270, -3 }, /* (305) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - { 271, -1 }, /* (306) boolean_primary ::= predicate */ - { 271, -3 }, /* (307) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - { 272, -1 }, /* (308) common_expression ::= expression */ - { 272, -1 }, /* (309) common_expression ::= boolean_value_expression */ - { 273, -2 }, /* (310) from_clause ::= FROM table_reference_list */ - { 274, -1 }, /* (311) table_reference_list ::= table_reference */ - { 274, -3 }, /* (312) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - { 275, -1 }, /* (313) table_reference ::= table_primary */ - { 275, -1 }, /* (314) table_reference ::= joined_table */ - { 276, -2 }, /* (315) table_primary ::= table_name alias_opt */ - { 276, -4 }, /* (316) table_primary ::= db_name NK_DOT table_name alias_opt */ - { 276, -2 }, /* (317) table_primary ::= subquery alias_opt */ - { 276, -1 }, /* (318) table_primary ::= parenthesized_joined_table */ - { 278, 0 }, /* (319) alias_opt ::= */ - { 278, -1 }, /* (320) alias_opt ::= table_alias */ - { 278, -2 }, /* (321) alias_opt ::= AS table_alias */ - { 279, -3 }, /* (322) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - { 279, -3 }, /* (323) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - { 277, -6 }, /* (324) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ - { 280, 0 }, /* (325) join_type ::= */ - { 280, -1 }, /* (326) join_type ::= INNER */ - { 282, -9 }, /* (327) query_specification ::= SELECT set_quantifier_opt select_list from_clause where_clause_opt partition_by_clause_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ - { 283, 0 }, /* (328) set_quantifier_opt ::= */ - { 283, -1 }, /* (329) set_quantifier_opt ::= DISTINCT */ - { 283, -1 }, /* (330) set_quantifier_opt ::= ALL */ - { 284, -1 }, /* (331) select_list ::= NK_STAR */ - { 284, -1 }, /* (332) select_list ::= select_sublist */ - { 290, -1 }, /* (333) select_sublist ::= select_item */ - { 290, -3 }, /* (334) select_sublist ::= select_sublist NK_COMMA select_item */ - { 291, -1 }, /* (335) select_item ::= common_expression */ - { 291, -2 }, /* (336) select_item ::= common_expression column_alias */ - { 291, -3 }, /* (337) select_item ::= common_expression AS column_alias */ - { 291, -3 }, /* (338) select_item ::= table_name NK_DOT NK_STAR */ - { 285, 0 }, /* (339) where_clause_opt ::= */ - { 285, -2 }, /* (340) where_clause_opt ::= WHERE search_condition */ - { 286, 0 }, /* (341) partition_by_clause_opt ::= */ - { 286, -3 }, /* (342) partition_by_clause_opt ::= PARTITION BY expression_list */ - { 287, 0 }, /* (343) twindow_clause_opt ::= */ - { 287, -6 }, /* (344) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ - { 287, -4 }, /* (345) twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP */ - { 287, -6 }, /* (346) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ - { 287, -8 }, /* (347) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ - { 247, 0 }, /* (348) sliding_opt ::= */ - { 247, -4 }, /* (349) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ - { 292, 0 }, /* (350) fill_opt ::= */ - { 292, -4 }, /* (351) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - { 292, -6 }, /* (352) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ - { 293, -1 }, /* (353) fill_mode ::= NONE */ - { 293, -1 }, /* (354) fill_mode ::= PREV */ - { 293, -1 }, /* (355) fill_mode ::= NULL */ - { 293, -1 }, /* (356) fill_mode ::= LINEAR */ - { 293, -1 }, /* (357) fill_mode ::= NEXT */ - { 288, 0 }, /* (358) group_by_clause_opt ::= */ - { 288, -3 }, /* (359) group_by_clause_opt ::= GROUP BY group_by_list */ - { 294, -1 }, /* (360) group_by_list ::= expression */ - { 294, -3 }, /* (361) group_by_list ::= group_by_list NK_COMMA expression */ - { 289, 0 }, /* (362) having_clause_opt ::= */ - { 289, -2 }, /* (363) having_clause_opt ::= HAVING search_condition */ - { 251, -4 }, /* (364) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ - { 295, -1 }, /* (365) query_expression_body ::= query_primary */ - { 295, -4 }, /* (366) query_expression_body ::= query_expression_body UNION ALL query_expression_body */ - { 299, -1 }, /* (367) query_primary ::= query_specification */ - { 296, 0 }, /* (368) order_by_clause_opt ::= */ - { 296, -3 }, /* (369) order_by_clause_opt ::= ORDER BY sort_specification_list */ - { 297, 0 }, /* (370) slimit_clause_opt ::= */ - { 297, -2 }, /* (371) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - { 297, -4 }, /* (372) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - { 297, -4 }, /* (373) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - { 298, 0 }, /* (374) limit_clause_opt ::= */ - { 298, -2 }, /* (375) limit_clause_opt ::= LIMIT NK_INTEGER */ - { 298, -4 }, /* (376) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - { 298, -4 }, /* (377) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - { 265, -3 }, /* (378) subquery ::= NK_LP query_expression NK_RP */ - { 281, -1 }, /* (379) search_condition ::= common_expression */ - { 300, -1 }, /* (380) sort_specification_list ::= sort_specification */ - { 300, -3 }, /* (381) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - { 301, -3 }, /* (382) sort_specification ::= expression ordering_specification_opt null_ordering_opt */ - { 302, 0 }, /* (383) ordering_specification_opt ::= */ - { 302, -1 }, /* (384) ordering_specification_opt ::= ASC */ - { 302, -1 }, /* (385) ordering_specification_opt ::= DESC */ - { 303, 0 }, /* (386) null_ordering_opt ::= */ - { 303, -2 }, /* (387) null_ordering_opt ::= NULLS FIRST */ - { 303, -2 }, /* (388) null_ordering_opt ::= NULLS LAST */ + { 263, -1 }, /* (276) pseudo_column ::= NOW */ + { 263, -1 }, /* (277) pseudo_column ::= ROWTS */ + { 263, -1 }, /* (278) pseudo_column ::= TBNAME */ + { 263, -1 }, /* (279) pseudo_column ::= QSTARTTS */ + { 263, -1 }, /* (280) pseudo_column ::= QENDTS */ + { 263, -1 }, /* (281) pseudo_column ::= WSTARTTS */ + { 263, -1 }, /* (282) pseudo_column ::= WENDTS */ + { 263, -1 }, /* (283) pseudo_column ::= WDURATION */ + { 266, -3 }, /* (284) predicate ::= expression compare_op expression */ + { 266, -5 }, /* (285) predicate ::= expression BETWEEN expression AND expression */ + { 266, -6 }, /* (286) predicate ::= expression NOT BETWEEN expression AND expression */ + { 266, -3 }, /* (287) predicate ::= expression IS NULL */ + { 266, -4 }, /* (288) predicate ::= expression IS NOT NULL */ + { 266, -3 }, /* (289) predicate ::= expression in_op in_predicate_value */ + { 267, -1 }, /* (290) compare_op ::= NK_LT */ + { 267, -1 }, /* (291) compare_op ::= NK_GT */ + { 267, -1 }, /* (292) compare_op ::= NK_LE */ + { 267, -1 }, /* (293) compare_op ::= NK_GE */ + { 267, -1 }, /* (294) compare_op ::= NK_NE */ + { 267, -1 }, /* (295) compare_op ::= NK_EQ */ + { 267, -1 }, /* (296) compare_op ::= LIKE */ + { 267, -2 }, /* (297) compare_op ::= NOT LIKE */ + { 267, -1 }, /* (298) compare_op ::= MATCH */ + { 267, -1 }, /* (299) compare_op ::= NMATCH */ + { 268, -1 }, /* (300) in_op ::= IN */ + { 268, -2 }, /* (301) in_op ::= NOT IN */ + { 269, -3 }, /* (302) in_predicate_value ::= NK_LP expression_list NK_RP */ + { 270, -1 }, /* (303) boolean_value_expression ::= boolean_primary */ + { 270, -2 }, /* (304) boolean_value_expression ::= NOT boolean_primary */ + { 270, -3 }, /* (305) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + { 270, -3 }, /* (306) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + { 271, -1 }, /* (307) boolean_primary ::= predicate */ + { 271, -3 }, /* (308) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + { 272, -1 }, /* (309) common_expression ::= expression */ + { 272, -1 }, /* (310) common_expression ::= boolean_value_expression */ + { 273, -2 }, /* (311) from_clause ::= FROM table_reference_list */ + { 274, -1 }, /* (312) table_reference_list ::= table_reference */ + { 274, -3 }, /* (313) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + { 275, -1 }, /* (314) table_reference ::= table_primary */ + { 275, -1 }, /* (315) table_reference ::= joined_table */ + { 276, -2 }, /* (316) table_primary ::= table_name alias_opt */ + { 276, -4 }, /* (317) table_primary ::= db_name NK_DOT table_name alias_opt */ + { 276, -2 }, /* (318) table_primary ::= subquery alias_opt */ + { 276, -1 }, /* (319) table_primary ::= parenthesized_joined_table */ + { 278, 0 }, /* (320) alias_opt ::= */ + { 278, -1 }, /* (321) alias_opt ::= table_alias */ + { 278, -2 }, /* (322) alias_opt ::= AS table_alias */ + { 279, -3 }, /* (323) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + { 279, -3 }, /* (324) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + { 277, -6 }, /* (325) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ + { 280, 0 }, /* (326) join_type ::= */ + { 280, -1 }, /* (327) join_type ::= INNER */ + { 282, -9 }, /* (328) query_specification ::= SELECT set_quantifier_opt select_list from_clause where_clause_opt partition_by_clause_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ + { 283, 0 }, /* (329) set_quantifier_opt ::= */ + { 283, -1 }, /* (330) set_quantifier_opt ::= DISTINCT */ + { 283, -1 }, /* (331) set_quantifier_opt ::= ALL */ + { 284, -1 }, /* (332) select_list ::= NK_STAR */ + { 284, -1 }, /* (333) select_list ::= select_sublist */ + { 290, -1 }, /* (334) select_sublist ::= select_item */ + { 290, -3 }, /* (335) select_sublist ::= select_sublist NK_COMMA select_item */ + { 291, -1 }, /* (336) select_item ::= common_expression */ + { 291, -2 }, /* (337) select_item ::= common_expression column_alias */ + { 291, -3 }, /* (338) select_item ::= common_expression AS column_alias */ + { 291, -3 }, /* (339) select_item ::= table_name NK_DOT NK_STAR */ + { 285, 0 }, /* (340) where_clause_opt ::= */ + { 285, -2 }, /* (341) where_clause_opt ::= WHERE search_condition */ + { 286, 0 }, /* (342) partition_by_clause_opt ::= */ + { 286, -3 }, /* (343) partition_by_clause_opt ::= PARTITION BY expression_list */ + { 287, 0 }, /* (344) twindow_clause_opt ::= */ + { 287, -6 }, /* (345) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ + { 287, -4 }, /* (346) twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP */ + { 287, -6 }, /* (347) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ + { 287, -8 }, /* (348) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ + { 247, 0 }, /* (349) sliding_opt ::= */ + { 247, -4 }, /* (350) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ + { 292, 0 }, /* (351) fill_opt ::= */ + { 292, -4 }, /* (352) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + { 292, -6 }, /* (353) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ + { 293, -1 }, /* (354) fill_mode ::= NONE */ + { 293, -1 }, /* (355) fill_mode ::= PREV */ + { 293, -1 }, /* (356) fill_mode ::= NULL */ + { 293, -1 }, /* (357) fill_mode ::= LINEAR */ + { 293, -1 }, /* (358) fill_mode ::= NEXT */ + { 288, 0 }, /* (359) group_by_clause_opt ::= */ + { 288, -3 }, /* (360) group_by_clause_opt ::= GROUP BY group_by_list */ + { 294, -1 }, /* (361) group_by_list ::= expression */ + { 294, -3 }, /* (362) group_by_list ::= group_by_list NK_COMMA expression */ + { 289, 0 }, /* (363) having_clause_opt ::= */ + { 289, -2 }, /* (364) having_clause_opt ::= HAVING search_condition */ + { 251, -4 }, /* (365) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ + { 295, -1 }, /* (366) query_expression_body ::= query_primary */ + { 295, -4 }, /* (367) query_expression_body ::= query_expression_body UNION ALL query_expression_body */ + { 299, -1 }, /* (368) query_primary ::= query_specification */ + { 296, 0 }, /* (369) order_by_clause_opt ::= */ + { 296, -3 }, /* (370) order_by_clause_opt ::= ORDER BY sort_specification_list */ + { 297, 0 }, /* (371) slimit_clause_opt ::= */ + { 297, -2 }, /* (372) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + { 297, -4 }, /* (373) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + { 297, -4 }, /* (374) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 298, 0 }, /* (375) limit_clause_opt ::= */ + { 298, -2 }, /* (376) limit_clause_opt ::= LIMIT NK_INTEGER */ + { 298, -4 }, /* (377) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + { 298, -4 }, /* (378) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 265, -3 }, /* (379) subquery ::= NK_LP query_expression NK_RP */ + { 281, -1 }, /* (380) search_condition ::= common_expression */ + { 300, -1 }, /* (381) sort_specification_list ::= sort_specification */ + { 300, -3 }, /* (382) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + { 301, -3 }, /* (383) sort_specification ::= expression ordering_specification_opt null_ordering_opt */ + { 302, 0 }, /* (384) ordering_specification_opt ::= */ + { 302, -1 }, /* (385) ordering_specification_opt ::= ASC */ + { 302, -1 }, /* (386) ordering_specification_opt ::= DESC */ + { 303, 0 }, /* (387) null_ordering_opt ::= */ + { 303, -2 }, /* (388) null_ordering_opt ::= NULLS FIRST */ + { 303, -2 }, /* (389) null_ordering_opt ::= NULLS LAST */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -2639,7 +2647,7 @@ static YYACTIONTYPE yy_reduce( case 50: /* exists_opt ::= */ yytestcase(yyruleno==50); case 203: /* analyze_opt ::= */ yytestcase(yyruleno==203); case 211: /* agg_func_opt ::= */ yytestcase(yyruleno==211); - case 328: /* set_quantifier_opt ::= */ yytestcase(yyruleno==328); + case 329: /* set_quantifier_opt ::= */ yytestcase(yyruleno==329); { yymsp[1].minor.yy185 = false; } break; case 49: /* exists_opt ::= IF EXISTS */ @@ -2823,8 +2831,8 @@ static YYACTIONTYPE yy_reduce( case 184: /* func_name_list ::= func_name */ yytestcase(yyruleno==184); case 193: /* func_list ::= func */ yytestcase(yyruleno==193); case 246: /* literal_list ::= signed_literal */ yytestcase(yyruleno==246); - case 333: /* select_sublist ::= select_item */ yytestcase(yyruleno==333); - case 380: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==380); + case 334: /* select_sublist ::= select_item */ yytestcase(yyruleno==334); + case 381: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==381); { yylhsminor.yy312 = createNodeList(pCxt, yymsp[0].minor.yy104); } yymsp[0].minor.yy312 = yylhsminor.yy312; break; @@ -2843,9 +2851,9 @@ static YYACTIONTYPE yy_reduce( break; case 104: /* specific_tags_opt ::= */ case 135: /* tags_def_opt ::= */ yytestcase(yyruleno==135); - case 341: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==341); - case 358: /* group_by_clause_opt ::= */ yytestcase(yyruleno==358); - case 368: /* order_by_clause_opt ::= */ yytestcase(yyruleno==368); + case 342: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==342); + case 359: /* group_by_clause_opt ::= */ yytestcase(yyruleno==359); + case 369: /* order_by_clause_opt ::= */ yytestcase(yyruleno==369); { yymsp[1].minor.yy312 = NULL; } break; case 105: /* specific_tags_opt ::= NK_LP col_name_list NK_RP */ @@ -2864,8 +2872,8 @@ static YYACTIONTYPE yy_reduce( case 185: /* func_name_list ::= func_name_list NK_COMMA col_name */ yytestcase(yyruleno==185); case 194: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==194); case 247: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==247); - case 334: /* select_sublist ::= select_sublist NK_COMMA select_item */ yytestcase(yyruleno==334); - case 381: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==381); + case 335: /* select_sublist ::= select_sublist NK_COMMA select_item */ yytestcase(yyruleno==335); + case 382: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==382); { yylhsminor.yy312 = addNodeToList(pCxt, yymsp[-2].minor.yy312, yymsp[0].minor.yy104); } yymsp[-2].minor.yy312 = yylhsminor.yy312; break; @@ -2945,7 +2953,7 @@ static YYACTIONTYPE yy_reduce( { yymsp[-5].minor.yy336 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 136: /* tags_def_opt ::= tags_def */ - case 332: /* select_list ::= select_sublist */ yytestcase(yyruleno==332); + case 333: /* select_list ::= select_sublist */ yytestcase(yyruleno==333); { yylhsminor.yy312 = yymsp[0].minor.yy312; } yymsp[0].minor.yy312 = yylhsminor.yy312; break; @@ -3083,13 +3091,13 @@ static YYACTIONTYPE yy_reduce( break; case 179: /* like_pattern_opt ::= */ case 190: /* index_options ::= */ yytestcase(yyruleno==190); - case 339: /* where_clause_opt ::= */ yytestcase(yyruleno==339); - case 343: /* twindow_clause_opt ::= */ yytestcase(yyruleno==343); - case 348: /* sliding_opt ::= */ yytestcase(yyruleno==348); - case 350: /* fill_opt ::= */ yytestcase(yyruleno==350); - case 362: /* having_clause_opt ::= */ yytestcase(yyruleno==362); - case 370: /* slimit_clause_opt ::= */ yytestcase(yyruleno==370); - case 374: /* limit_clause_opt ::= */ yytestcase(yyruleno==374); + case 340: /* where_clause_opt ::= */ yytestcase(yyruleno==340); + case 344: /* twindow_clause_opt ::= */ yytestcase(yyruleno==344); + case 349: /* sliding_opt ::= */ yytestcase(yyruleno==349); + case 351: /* fill_opt ::= */ yytestcase(yyruleno==351); + case 363: /* having_clause_opt ::= */ yytestcase(yyruleno==363); + case 371: /* slimit_clause_opt ::= */ yytestcase(yyruleno==371); + case 375: /* limit_clause_opt ::= */ yytestcase(yyruleno==375); { yymsp[1].minor.yy104 = NULL; } break; case 180: /* like_pattern_opt ::= LIKE NK_STRING */ @@ -3146,7 +3154,7 @@ static YYACTIONTYPE yy_reduce( break; case 204: /* analyze_opt ::= ANALYZE */ case 212: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==212); - case 329: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==329); + case 330: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==330); { yymsp[0].minor.yy185 = true; } break; case 205: /* explain_options ::= */ @@ -3228,16 +3236,16 @@ static YYACTIONTYPE yy_reduce( case 259: /* expression ::= pseudo_column */ yytestcase(yyruleno==259); case 260: /* expression ::= column_reference */ yytestcase(yyruleno==260); case 263: /* expression ::= subquery */ yytestcase(yyruleno==263); - case 302: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==302); - case 306: /* boolean_primary ::= predicate */ yytestcase(yyruleno==306); - case 308: /* common_expression ::= expression */ yytestcase(yyruleno==308); - case 309: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==309); - case 311: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==311); - case 313: /* table_reference ::= table_primary */ yytestcase(yyruleno==313); - case 314: /* table_reference ::= joined_table */ yytestcase(yyruleno==314); - case 318: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==318); - case 365: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==365); - case 367: /* query_primary ::= query_specification */ yytestcase(yyruleno==367); + case 303: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==303); + case 307: /* boolean_primary ::= predicate */ yytestcase(yyruleno==307); + case 309: /* common_expression ::= expression */ yytestcase(yyruleno==309); + case 310: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==310); + case 312: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==312); + case 314: /* table_reference ::= table_primary */ yytestcase(yyruleno==314); + case 315: /* table_reference ::= joined_table */ yytestcase(yyruleno==315); + case 319: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==319); + case 366: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==366); + case 368: /* query_primary ::= query_specification */ yytestcase(yyruleno==368); { yylhsminor.yy104 = yymsp[0].minor.yy104; } yymsp[0].minor.yy104 = yylhsminor.yy104; break; @@ -3291,7 +3299,7 @@ static YYACTIONTYPE yy_reduce( { yymsp[-1].minor.yy104 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } break; case 244: /* signed_literal ::= duration_literal */ - case 379: /* search_condition ::= common_expression */ yytestcase(yyruleno==379); + case 380: /* search_condition ::= common_expression */ yytestcase(yyruleno==380); { yylhsminor.yy104 = releaseRawExprNode(pCxt, yymsp[0].minor.yy104); } yymsp[0].minor.yy104 = yylhsminor.yy104; break; @@ -3307,7 +3315,7 @@ static YYACTIONTYPE yy_reduce( yymsp[-3].minor.yy104 = yylhsminor.yy104; break; case 264: /* expression ::= NK_LP expression NK_RP */ - case 307: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==307); + case 308: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==308); { yylhsminor.yy104 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy104)); } yymsp[-2].minor.yy104 = yylhsminor.yy104; break; @@ -3321,7 +3329,7 @@ static YYACTIONTYPE yy_reduce( case 266: /* expression ::= NK_MINUS expression */ { SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104); - yylhsminor.yy104 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[0].minor.yy104), NULL)); + yylhsminor.yy104 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy104), NULL)); } yymsp[-1].minor.yy104 = yylhsminor.yy104; break; @@ -3381,25 +3389,19 @@ static YYACTIONTYPE yy_reduce( { yylhsminor.yy104 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy129, &yymsp[0].minor.yy129, createColumnNode(pCxt, &yymsp[-2].minor.yy129, &yymsp[0].minor.yy129)); } yymsp[-2].minor.yy104 = yylhsminor.yy104; break; - case 276: /* pseudo_column ::= NK_UNDERLINE ROWTS */ - case 278: /* pseudo_column ::= NK_UNDERLINE QSTARTTS */ yytestcase(yyruleno==278); - case 279: /* pseudo_column ::= NK_UNDERLINE QENDTS */ yytestcase(yyruleno==279); - case 280: /* pseudo_column ::= NK_UNDERLINE WSTARTTS */ yytestcase(yyruleno==280); - case 281: /* pseudo_column ::= NK_UNDERLINE WENDTS */ yytestcase(yyruleno==281); - case 282: /* pseudo_column ::= NK_UNDERLINE WDURATION */ yytestcase(yyruleno==282); -{ - SToken t = yymsp[-1].minor.yy0; - t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy104 = createRawExprNode(pCxt, &t, createFunctionNode(pCxt, &t, NULL)); - } - yymsp[-1].minor.yy104 = yylhsminor.yy104; - break; - case 277: /* pseudo_column ::= TBNAME */ + case 276: /* pseudo_column ::= NOW */ + case 277: /* pseudo_column ::= ROWTS */ yytestcase(yyruleno==277); + case 278: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==278); + case 279: /* pseudo_column ::= QSTARTTS */ yytestcase(yyruleno==279); + case 280: /* pseudo_column ::= QENDTS */ yytestcase(yyruleno==280); + case 281: /* pseudo_column ::= WSTARTTS */ yytestcase(yyruleno==281); + case 282: /* pseudo_column ::= WENDTS */ yytestcase(yyruleno==282); + case 283: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==283); { yylhsminor.yy104 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } yymsp[0].minor.yy104 = yylhsminor.yy104; break; - case 283: /* predicate ::= expression compare_op expression */ - case 288: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==288); + case 284: /* predicate ::= expression compare_op expression */ + case 289: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==289); { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy104); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104); @@ -3407,7 +3409,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy104 = yylhsminor.yy104; break; - case 284: /* predicate ::= expression BETWEEN expression AND expression */ + case 285: /* predicate ::= expression BETWEEN expression AND expression */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy104); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104); @@ -3415,7 +3417,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-4].minor.yy104 = yylhsminor.yy104; break; - case 285: /* predicate ::= expression NOT BETWEEN expression AND expression */ + case 286: /* predicate ::= expression NOT BETWEEN expression AND expression */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy104); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104); @@ -3423,68 +3425,68 @@ static YYACTIONTYPE yy_reduce( } yymsp[-5].minor.yy104 = yylhsminor.yy104; break; - case 286: /* predicate ::= expression IS NULL */ + case 287: /* predicate ::= expression IS NULL */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy104); yylhsminor.yy104 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy104), NULL)); } yymsp[-2].minor.yy104 = yylhsminor.yy104; break; - case 287: /* predicate ::= expression IS NOT NULL */ + case 288: /* predicate ::= expression IS NOT NULL */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy104); yylhsminor.yy104 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy104), NULL)); } yymsp[-3].minor.yy104 = yylhsminor.yy104; break; - case 289: /* compare_op ::= NK_LT */ + case 290: /* compare_op ::= NK_LT */ { yymsp[0].minor.yy60 = OP_TYPE_LOWER_THAN; } break; - case 290: /* compare_op ::= NK_GT */ + case 291: /* compare_op ::= NK_GT */ { yymsp[0].minor.yy60 = OP_TYPE_GREATER_THAN; } break; - case 291: /* compare_op ::= NK_LE */ + case 292: /* compare_op ::= NK_LE */ { yymsp[0].minor.yy60 = OP_TYPE_LOWER_EQUAL; } break; - case 292: /* compare_op ::= NK_GE */ + case 293: /* compare_op ::= NK_GE */ { yymsp[0].minor.yy60 = OP_TYPE_GREATER_EQUAL; } break; - case 293: /* compare_op ::= NK_NE */ + case 294: /* compare_op ::= NK_NE */ { yymsp[0].minor.yy60 = OP_TYPE_NOT_EQUAL; } break; - case 294: /* compare_op ::= NK_EQ */ + case 295: /* compare_op ::= NK_EQ */ { yymsp[0].minor.yy60 = OP_TYPE_EQUAL; } break; - case 295: /* compare_op ::= LIKE */ + case 296: /* compare_op ::= LIKE */ { yymsp[0].minor.yy60 = OP_TYPE_LIKE; } break; - case 296: /* compare_op ::= NOT LIKE */ + case 297: /* compare_op ::= NOT LIKE */ { yymsp[-1].minor.yy60 = OP_TYPE_NOT_LIKE; } break; - case 297: /* compare_op ::= MATCH */ + case 298: /* compare_op ::= MATCH */ { yymsp[0].minor.yy60 = OP_TYPE_MATCH; } break; - case 298: /* compare_op ::= NMATCH */ + case 299: /* compare_op ::= NMATCH */ { yymsp[0].minor.yy60 = OP_TYPE_NMATCH; } break; - case 299: /* in_op ::= IN */ + case 300: /* in_op ::= IN */ { yymsp[0].minor.yy60 = OP_TYPE_IN; } break; - case 300: /* in_op ::= NOT IN */ + case 301: /* in_op ::= NOT IN */ { yymsp[-1].minor.yy60 = OP_TYPE_NOT_IN; } break; - case 301: /* in_predicate_value ::= NK_LP expression_list NK_RP */ + case 302: /* in_predicate_value ::= NK_LP expression_list NK_RP */ { yylhsminor.yy104 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy312)); } yymsp[-2].minor.yy104 = yylhsminor.yy104; break; - case 303: /* boolean_value_expression ::= NOT boolean_primary */ + case 304: /* boolean_value_expression ::= NOT boolean_primary */ { SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104); yylhsminor.yy104 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy104), NULL)); } yymsp[-1].minor.yy104 = yylhsminor.yy104; break; - case 304: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + case 305: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy104); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104); @@ -3492,7 +3494,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy104 = yylhsminor.yy104; break; - case 305: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + case 306: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy104); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104); @@ -3500,52 +3502,52 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy104 = yylhsminor.yy104; break; - case 310: /* from_clause ::= FROM table_reference_list */ - case 340: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==340); - case 363: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==363); + case 311: /* from_clause ::= FROM table_reference_list */ + case 341: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==341); + case 364: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==364); { yymsp[-1].minor.yy104 = yymsp[0].minor.yy104; } break; - case 312: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ + case 313: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ { yylhsminor.yy104 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy104, yymsp[0].minor.yy104, NULL); } yymsp[-2].minor.yy104 = yylhsminor.yy104; break; - case 315: /* table_primary ::= table_name alias_opt */ + case 316: /* table_primary ::= table_name alias_opt */ { yylhsminor.yy104 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy129, &yymsp[0].minor.yy129); } yymsp[-1].minor.yy104 = yylhsminor.yy104; break; - case 316: /* table_primary ::= db_name NK_DOT table_name alias_opt */ + case 317: /* table_primary ::= db_name NK_DOT table_name alias_opt */ { yylhsminor.yy104 = createRealTableNode(pCxt, &yymsp[-3].minor.yy129, &yymsp[-1].minor.yy129, &yymsp[0].minor.yy129); } yymsp[-3].minor.yy104 = yylhsminor.yy104; break; - case 317: /* table_primary ::= subquery alias_opt */ + case 318: /* table_primary ::= subquery alias_opt */ { yylhsminor.yy104 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy104), &yymsp[0].minor.yy129); } yymsp[-1].minor.yy104 = yylhsminor.yy104; break; - case 319: /* alias_opt ::= */ + case 320: /* alias_opt ::= */ { yymsp[1].minor.yy129 = nil_token; } break; - case 320: /* alias_opt ::= table_alias */ + case 321: /* alias_opt ::= table_alias */ { yylhsminor.yy129 = yymsp[0].minor.yy129; } yymsp[0].minor.yy129 = yylhsminor.yy129; break; - case 321: /* alias_opt ::= AS table_alias */ + case 322: /* alias_opt ::= AS table_alias */ { yymsp[-1].minor.yy129 = yymsp[0].minor.yy129; } break; - case 322: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - case 323: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==323); + case 323: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + case 324: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==324); { yymsp[-2].minor.yy104 = yymsp[-1].minor.yy104; } break; - case 324: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ + case 325: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ { yylhsminor.yy104 = createJoinTableNode(pCxt, yymsp[-4].minor.yy532, yymsp[-5].minor.yy104, yymsp[-2].minor.yy104, yymsp[0].minor.yy104); } yymsp[-5].minor.yy104 = yylhsminor.yy104; break; - case 325: /* join_type ::= */ + case 326: /* join_type ::= */ { yymsp[1].minor.yy532 = JOIN_TYPE_INNER; } break; - case 326: /* join_type ::= INNER */ + case 327: /* join_type ::= INNER */ { yymsp[0].minor.yy532 = JOIN_TYPE_INNER; } break; - case 327: /* query_specification ::= SELECT set_quantifier_opt select_list from_clause where_clause_opt partition_by_clause_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ + case 328: /* query_specification ::= SELECT set_quantifier_opt select_list from_clause where_clause_opt partition_by_clause_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ { yymsp[-8].minor.yy104 = createSelectStmt(pCxt, yymsp[-7].minor.yy185, yymsp[-6].minor.yy312, yymsp[-5].minor.yy104); yymsp[-8].minor.yy104 = addWhereClause(pCxt, yymsp[-8].minor.yy104, yymsp[-4].minor.yy104); @@ -3555,81 +3557,81 @@ static YYACTIONTYPE yy_reduce( yymsp[-8].minor.yy104 = addHavingClause(pCxt, yymsp[-8].minor.yy104, yymsp[0].minor.yy104); } break; - case 330: /* set_quantifier_opt ::= ALL */ + case 331: /* set_quantifier_opt ::= ALL */ { yymsp[0].minor.yy185 = false; } break; - case 331: /* select_list ::= NK_STAR */ + case 332: /* select_list ::= NK_STAR */ { yymsp[0].minor.yy312 = NULL; } break; - case 335: /* select_item ::= common_expression */ + case 336: /* select_item ::= common_expression */ { SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104); yylhsminor.yy104 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy104), &t); } yymsp[0].minor.yy104 = yylhsminor.yy104; break; - case 336: /* select_item ::= common_expression column_alias */ + case 337: /* select_item ::= common_expression column_alias */ { yylhsminor.yy104 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy104), &yymsp[0].minor.yy129); } yymsp[-1].minor.yy104 = yylhsminor.yy104; break; - case 337: /* select_item ::= common_expression AS column_alias */ + case 338: /* select_item ::= common_expression AS column_alias */ { yylhsminor.yy104 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy104), &yymsp[0].minor.yy129); } yymsp[-2].minor.yy104 = yylhsminor.yy104; break; - case 338: /* select_item ::= table_name NK_DOT NK_STAR */ + case 339: /* select_item ::= table_name NK_DOT NK_STAR */ { yylhsminor.yy104 = createColumnNode(pCxt, &yymsp[-2].minor.yy129, &yymsp[0].minor.yy0); } yymsp[-2].minor.yy104 = yylhsminor.yy104; break; - case 342: /* partition_by_clause_opt ::= PARTITION BY expression_list */ - case 359: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==359); - case 369: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==369); + case 343: /* partition_by_clause_opt ::= PARTITION BY expression_list */ + case 360: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==360); + case 370: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==370); { yymsp[-2].minor.yy312 = yymsp[0].minor.yy312; } break; - case 344: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ + case 345: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ { yymsp[-5].minor.yy104 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy104), releaseRawExprNode(pCxt, yymsp[-1].minor.yy104)); } break; - case 345: /* twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP */ + case 346: /* twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP */ { yymsp[-3].minor.yy104 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy104)); } break; - case 346: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ + case 347: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ { yymsp[-5].minor.yy104 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy104), NULL, yymsp[-1].minor.yy104, yymsp[0].minor.yy104); } break; - case 347: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ + case 348: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ { yymsp[-7].minor.yy104 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy104), releaseRawExprNode(pCxt, yymsp[-3].minor.yy104), yymsp[-1].minor.yy104, yymsp[0].minor.yy104); } break; - case 349: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ + case 350: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ { yymsp[-3].minor.yy104 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy104); } break; - case 351: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ + case 352: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ { yymsp[-3].minor.yy104 = createFillNode(pCxt, yymsp[-1].minor.yy550, NULL); } break; - case 352: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ + case 353: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ { yymsp[-5].minor.yy104 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy312)); } break; - case 353: /* fill_mode ::= NONE */ + case 354: /* fill_mode ::= NONE */ { yymsp[0].minor.yy550 = FILL_MODE_NONE; } break; - case 354: /* fill_mode ::= PREV */ + case 355: /* fill_mode ::= PREV */ { yymsp[0].minor.yy550 = FILL_MODE_PREV; } break; - case 355: /* fill_mode ::= NULL */ + case 356: /* fill_mode ::= NULL */ { yymsp[0].minor.yy550 = FILL_MODE_NULL; } break; - case 356: /* fill_mode ::= LINEAR */ + case 357: /* fill_mode ::= LINEAR */ { yymsp[0].minor.yy550 = FILL_MODE_LINEAR; } break; - case 357: /* fill_mode ::= NEXT */ + case 358: /* fill_mode ::= NEXT */ { yymsp[0].minor.yy550 = FILL_MODE_NEXT; } break; - case 360: /* group_by_list ::= expression */ + case 361: /* group_by_list ::= expression */ { yylhsminor.yy312 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy104))); } yymsp[0].minor.yy312 = yylhsminor.yy312; break; - case 361: /* group_by_list ::= group_by_list NK_COMMA expression */ + case 362: /* group_by_list ::= group_by_list NK_COMMA expression */ { yylhsminor.yy312 = addNodeToList(pCxt, yymsp[-2].minor.yy312, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy104))); } yymsp[-2].minor.yy312 = yylhsminor.yy312; break; - case 364: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ + case 365: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ { yylhsminor.yy104 = addOrderByClause(pCxt, yymsp[-3].minor.yy104, yymsp[-2].minor.yy312); yylhsminor.yy104 = addSlimitClause(pCxt, yylhsminor.yy104, yymsp[-1].minor.yy104); @@ -3637,46 +3639,46 @@ static YYACTIONTYPE yy_reduce( } yymsp[-3].minor.yy104 = yylhsminor.yy104; break; - case 366: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */ + case 367: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */ { yylhsminor.yy104 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy104, yymsp[0].minor.yy104); } yymsp[-3].minor.yy104 = yylhsminor.yy104; break; - case 371: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ - case 375: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==375); + case 372: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ + case 376: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==376); { yymsp[-1].minor.yy104 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } break; - case 372: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - case 376: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==376); + case 373: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + case 377: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==377); { yymsp[-3].minor.yy104 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } break; - case 373: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - case 377: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==377); + case 374: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + case 378: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==378); { yymsp[-3].minor.yy104 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } break; - case 378: /* subquery ::= NK_LP query_expression NK_RP */ + case 379: /* subquery ::= NK_LP query_expression NK_RP */ { yylhsminor.yy104 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy104); } yymsp[-2].minor.yy104 = yylhsminor.yy104; break; - case 382: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */ + case 383: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */ { yylhsminor.yy104 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy104), yymsp[-1].minor.yy354, yymsp[0].minor.yy489); } yymsp[-2].minor.yy104 = yylhsminor.yy104; break; - case 383: /* ordering_specification_opt ::= */ + case 384: /* ordering_specification_opt ::= */ { yymsp[1].minor.yy354 = ORDER_ASC; } break; - case 384: /* ordering_specification_opt ::= ASC */ + case 385: /* ordering_specification_opt ::= ASC */ { yymsp[0].minor.yy354 = ORDER_ASC; } break; - case 385: /* ordering_specification_opt ::= DESC */ + case 386: /* ordering_specification_opt ::= DESC */ { yymsp[0].minor.yy354 = ORDER_DESC; } break; - case 386: /* null_ordering_opt ::= */ + case 387: /* null_ordering_opt ::= */ { yymsp[1].minor.yy489 = NULL_ORDER_DEFAULT; } break; - case 387: /* null_ordering_opt ::= NULLS FIRST */ + case 388: /* null_ordering_opt ::= NULLS FIRST */ { yymsp[-1].minor.yy489 = NULL_ORDER_FIRST; } break; - case 388: /* null_ordering_opt ::= NULLS LAST */ + case 389: /* null_ordering_opt ::= NULLS LAST */ { yymsp[-1].minor.yy489 = NULL_ORDER_LAST; } break; default: diff --git a/source/libs/planner/test/plannerTest.cpp b/source/libs/planner/test/plannerTest.cpp index 00af808078..f98d95ad96 100644 --- a/source/libs/planner/test/plannerTest.cpp +++ b/source/libs/planner/test/plannerTest.cpp @@ -193,14 +193,17 @@ TEST_F(PlannerTest, interval) { // bind("SELECT count(*) FROM t1 interval(10s)"); // ASSERT_TRUE(run()); + bind("SELECT _wstartts, count(*) FROM t1 interval(10s)"); + ASSERT_TRUE(run()); + // bind("SELECT _wstartts, _wduration, _wendts, count(*) FROM t1 interval(10s)"); // ASSERT_TRUE(run()); // bind("SELECT count(*) FROM t1 interval(10s) fill(linear)"); // ASSERT_TRUE(run()); - bind("SELECT count(*), sum(c1) FROM t1 interval(10s) fill(value, 10, 20)"); - ASSERT_TRUE(run()); + // bind("SELECT count(*), sum(c1) FROM t1 interval(10s) fill(value, 10, 20)"); + // ASSERT_TRUE(run()); } TEST_F(PlannerTest, sessionWindow) { From c70eb15bb9cc5192afb0a5ae8d1fd91d8922663a Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Sat, 2 Apr 2022 01:22:03 -0400 Subject: [PATCH 68/68] condition bugfix --- source/libs/planner/test/plannerTest.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/source/libs/planner/test/plannerTest.cpp b/source/libs/planner/test/plannerTest.cpp index f98d95ad96..ad76c8f879 100644 --- a/source/libs/planner/test/plannerTest.cpp +++ b/source/libs/planner/test/plannerTest.cpp @@ -190,20 +190,17 @@ TEST_F(PlannerTest, subquery) { TEST_F(PlannerTest, interval) { setDatabase("root", "test"); - // bind("SELECT count(*) FROM t1 interval(10s)"); - // ASSERT_TRUE(run()); - - bind("SELECT _wstartts, count(*) FROM t1 interval(10s)"); + bind("SELECT count(*) FROM t1 interval(10s)"); ASSERT_TRUE(run()); - // bind("SELECT _wstartts, _wduration, _wendts, count(*) FROM t1 interval(10s)"); - // ASSERT_TRUE(run()); + bind("SELECT _wstartts, _wduration, _wendts, count(*) FROM t1 interval(10s)"); + ASSERT_TRUE(run()); - // bind("SELECT count(*) FROM t1 interval(10s) fill(linear)"); - // ASSERT_TRUE(run()); + bind("SELECT count(*) FROM t1 interval(10s) fill(linear)"); + ASSERT_TRUE(run()); - // bind("SELECT count(*), sum(c1) FROM t1 interval(10s) fill(value, 10, 20)"); - // ASSERT_TRUE(run()); + bind("SELECT count(*), sum(c1) FROM t1 interval(10s) fill(value, 10, 20)"); + ASSERT_TRUE(run()); } TEST_F(PlannerTest, sessionWindow) {