From 762086c22be6ef2996977c8d05e6e954b2a438c6 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Sat, 26 Mar 2022 18:10:26 +0800 Subject: [PATCH 01/47] feature/qnode --- source/libs/catalog/inc/catalogInt.h | 17 +- source/libs/catalog/src/catalog.c | 187 +----------------- source/libs/catalog/src/catalogDbg.c | 222 ++++++++++++++++++++++ source/libs/catalog/test/catalogTests.cpp | 82 ++++---- 4 files changed, 284 insertions(+), 224 deletions(-) create mode 100644 source/libs/catalog/src/catalogDbg.c diff --git a/source/libs/catalog/inc/catalogInt.h b/source/libs/catalog/inc/catalogInt.h index 9bd5c1c016..a5887e8807 100644 --- a/source/libs/catalog/inc/catalogInt.h +++ b/source/libs/catalog/inc/catalogInt.h @@ -112,7 +112,13 @@ typedef struct SCtgRuntimeStat { } SCtgRuntimeStat; typedef struct SCtgCacheStat { - + uint64_t clusterNum; + uint64_t dbNum; + uint64_t tblNum; + uint64_t vgHitNum; + uint64_t vgMissNum; + uint64_t tblHitNum; + uint64_t tblMissNum; } SCtgCacheStat; typedef struct SCatalogStat { @@ -186,7 +192,7 @@ typedef struct SCatalogMgmt { bool exit; SRWLatch lock; SCtgQueue queue; - TdThread updateThread; + TdThread updateThread; SHashObj *pCluster; //key: clusterId, value: SCatalog* SCatalogStat stat; SCatalogCfg cfg; @@ -206,6 +212,10 @@ typedef struct SCtgAction { #define CTG_STAT_ADD(n) atomic_add_fetch_64(&(n), 1) #define CTG_STAT_SUB(n) atomic_sub_fetch_64(&(n), 1) +#define CTG_STAT_GET(n) atomic_load_64(&(n)) + +#define CTG_RUNTIME_STAT_ADD(_item) (CTG_STAT_ADD(gCtgMgmt.stat.runtime._item)) +#define CTG_CACHE_STAT_ADD(_item) (CTG_STAT_ADD(gCtgMgmt.stat.cache._item)) #define CTG_IS_META_NULL(type) ((type) == META_TYPE_NULL_TABLE) #define CTG_IS_META_CTABLE(type) ((type) == META_TYPE_CTABLE) @@ -291,6 +301,9 @@ typedef struct SCtgAction { #define CTG_API_ENTER() do { CTG_API_DEBUG("CTG API enter %s", __FUNCTION__); CTG_LOCK(CTG_READ, &gCtgMgmt.lock); if (atomic_load_8((int8_t*)&gCtgMgmt.exit)) { CTG_API_LEAVE(TSDB_CODE_CTG_OUT_OF_SERVICE); } } while (0) +extern void ctgdShowTableMeta(SCatalog* pCtg, const char *tbName, STableMeta* p); +extern void ctgdShowClusterCache(SCatalog* pCtg); +extern int32_t ctgdShowCacheInfo(void); #ifdef __cplusplus } diff --git a/source/libs/catalog/src/catalog.c b/source/libs/catalog/src/catalog.c index 6eab0d280b..73b363ec5c 100644 --- a/source/libs/catalog/src/catalog.c +++ b/source/libs/catalog/src/catalog.c @@ -24,8 +24,8 @@ int32_t ctgActRemoveDB(SCtgMetaAction *action); int32_t ctgActRemoveStb(SCtgMetaAction *action); int32_t ctgActRemoveTbl(SCtgMetaAction *action); +extern SCtgDebug gCTGDebug; SCatalogMgmt gCtgMgmt = {0}; -SCtgDebug gCTGDebug = {0}; SCtgAction gCtgAction[CTG_ACT_MAX] = {{ CTG_ACT_UPDATE_VG, "update vgInfo", @@ -53,181 +53,6 @@ SCtgAction gCtgAction[CTG_ACT_MAX] = {{ } }; -int32_t ctgDbgEnableDebug(char *option) { - if (0 == strcasecmp(option, "lock")) { - gCTGDebug.lockEnable = true; - qDebug("lock debug enabled"); - return TSDB_CODE_SUCCESS; - } - - if (0 == strcasecmp(option, "cache")) { - gCTGDebug.cacheEnable = true; - qDebug("cache debug enabled"); - return TSDB_CODE_SUCCESS; - } - - if (0 == strcasecmp(option, "api")) { - gCTGDebug.apiEnable = true; - qDebug("api debug enabled"); - return TSDB_CODE_SUCCESS; - } - - if (0 == strcasecmp(option, "meta")) { - gCTGDebug.metaEnable = true; - qDebug("api debug enabled"); - return TSDB_CODE_SUCCESS; - } - - qError("invalid debug option:%s", option); - - return TSDB_CODE_CTG_INTERNAL_ERROR; -} - -int32_t ctgDbgGetStatNum(char *option, void *res) { - if (0 == strcasecmp(option, "runtime.qDoneNum")) { - *(uint64_t *)res = atomic_load_64(&gCtgMgmt.stat.runtime.qDoneNum); - return TSDB_CODE_SUCCESS; - } - - qError("invalid stat option:%s", option); - - return TSDB_CODE_CTG_INTERNAL_ERROR; -} - -int32_t ctgDbgGetTbMetaNum(SCtgDBCache *dbCache) { - return dbCache->tbCache.metaCache ? (int32_t)taosHashGetSize(dbCache->tbCache.metaCache) : 0; -} - -int32_t ctgDbgGetStbNum(SCtgDBCache *dbCache) { - return dbCache->tbCache.stbCache ? (int32_t)taosHashGetSize(dbCache->tbCache.stbCache) : 0; -} - -int32_t ctgDbgGetRentNum(SCtgRentMgmt *rent) { - int32_t num = 0; - for (uint16_t i = 0; i < rent->slotNum; ++i) { - SCtgRentSlot *slot = &rent->slots[i]; - if (NULL == slot->meta) { - continue; - } - - num += taosArrayGetSize(slot->meta); - } - - return num; -} - -int32_t ctgDbgGetClusterCacheNum(SCatalog* pCtg, int32_t type) { - if (NULL == pCtg || NULL == pCtg->dbCache) { - return 0; - } - - switch (type) { - case CTG_DBG_DB_NUM: - return (int32_t)taosHashGetSize(pCtg->dbCache); - case CTG_DBG_DB_RENT_NUM: - return ctgDbgGetRentNum(&pCtg->dbRent); - case CTG_DBG_STB_RENT_NUM: - return ctgDbgGetRentNum(&pCtg->stbRent); - default: - break; - } - - SCtgDBCache *dbCache = NULL; - int32_t num = 0; - void *pIter = taosHashIterate(pCtg->dbCache, NULL); - while (pIter) { - dbCache = (SCtgDBCache *)pIter; - switch (type) { - case CTG_DBG_META_NUM: - num += ctgDbgGetTbMetaNum(dbCache); - break; - case CTG_DBG_STB_NUM: - num += ctgDbgGetStbNum(dbCache); - break; - default: - ctgError("invalid type:%d", type); - break; - } - pIter = taosHashIterate(pCtg->dbCache, pIter); - } - - return num; -} - -void ctgDbgShowTableMeta(SCatalog* pCtg, const char *tbName, STableMeta* p) { - if (!gCTGDebug.metaEnable) { - return; - } - - STableComInfo *c = &p->tableInfo; - - if (TSDB_CHILD_TABLE == p->tableType) { - ctgDebug("table [%s] meta: type:%d, vgId:%d, uid:%" PRIx64 ",suid:%" PRIx64, tbName, p->tableType, p->vgId, p->uid, p->suid); - return; - } else { - ctgDebug("table [%s] meta: type:%d, vgId:%d, uid:%" PRIx64 ",suid:%" PRIx64 ",sv:%d, tv:%d, tagNum:%d, precision:%d, colNum:%d, rowSize:%d", - tbName, p->tableType, p->vgId, p->uid, p->suid, p->sversion, p->tversion, c->numOfTags, c->precision, c->numOfColumns, c->rowSize); - } - - int32_t colNum = c->numOfColumns + c->numOfTags; - for (int32_t i = 0; i < colNum; ++i) { - SSchema *s = &p->schema[i]; - ctgDebug("[%d] name:%s, type:%d, colId:%d, bytes:%d", i, s->name, s->type, s->colId, s->bytes); - } -} - -void ctgDbgShowDBCache(SCatalog* pCtg, SHashObj *dbHash) { - if (NULL == dbHash || !gCTGDebug.cacheEnable) { - return; - } - - int32_t i = 0; - SCtgDBCache *dbCache = NULL; - void *pIter = taosHashIterate(dbHash, NULL); - while (pIter) { - char *dbFName = NULL; - size_t len = 0; - - dbCache = (SCtgDBCache *)pIter; - - dbFName = taosHashGetKey(pIter, &len); - - int32_t metaNum = dbCache->tbCache.metaCache ? taosHashGetSize(dbCache->tbCache.metaCache) : 0; - int32_t stbNum = dbCache->tbCache.stbCache ? taosHashGetSize(dbCache->tbCache.stbCache) : 0; - int32_t vgVersion = CTG_DEFAULT_INVALID_VERSION; - int32_t hashMethod = -1; - int32_t vgNum = 0; - - if (dbCache->vgInfo) { - vgVersion = dbCache->vgInfo->vgVersion; - hashMethod = dbCache->vgInfo->hashMethod; - if (dbCache->vgInfo->vgHash) { - vgNum = taosHashGetSize(dbCache->vgInfo->vgHash); - } - } - - ctgDebug("[%d] db [%.*s][%"PRIx64"] %s: metaNum:%d, stbNum:%d, vgVersion:%d, hashMethod:%d, vgNum:%d", - i, (int32_t)len, dbFName, dbCache->dbId, dbCache->deleted?"deleted":"", metaNum, stbNum, vgVersion, hashMethod, vgNum); - - pIter = taosHashIterate(dbHash, pIter); - } -} - - - - -void ctgDbgShowClusterCache(SCatalog* pCtg) { - if (!gCTGDebug.cacheEnable || NULL == pCtg) { - return; - } - - ctgDebug("## cluster %"PRIx64" %p cache Info ##", pCtg->clusterId, pCtg); - ctgDebug("db:%d meta:%d stb:%d dbRent:%d stbRent:%d", ctgDbgGetClusterCacheNum(pCtg, CTG_DBG_DB_NUM), ctgDbgGetClusterCacheNum(pCtg, CTG_DBG_META_NUM), - ctgDbgGetClusterCacheNum(pCtg, CTG_DBG_STB_NUM), ctgDbgGetClusterCacheNum(pCtg, CTG_DBG_DB_RENT_NUM), ctgDbgGetClusterCacheNum(pCtg, CTG_DBG_STB_RENT_NUM)); - - ctgDbgShowDBCache(pCtg, pCtg->dbCache); -} - void ctgFreeMetaRent(SCtgRentMgmt *mgmt) { if (NULL == mgmt->slots) { @@ -361,7 +186,7 @@ int32_t ctgPushAction(SCatalog* pCtg, SCtgMetaAction *action) { CTG_UNLOCK(CTG_WRITE, &gCtgMgmt.queue.qlock); CTG_QUEUE_ADD(); - CTG_STAT_ADD(gCtgMgmt.stat.runtime.qNum); + CTG_RUNTIME_STAT_ADD(qNum); tsem_post(&gCtgMgmt.queue.reqSem); @@ -1595,7 +1420,7 @@ int32_t ctgUpdateTblMeta(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFName, ui } ctgDebug("tbmeta updated to cache, dbFName:%s, tbName:%s, tbType:%d", dbFName, tbName, meta->tableType); - ctgDbgShowTableMeta(pCtg, tbName, meta); + ctgdShowTableMeta(pCtg, tbName, meta); if (!isStb) { CTG_UNLOCK(CTG_READ, &tbCache->metaLock); @@ -1962,7 +1787,7 @@ _return: if (*pTableMeta) { ctgDebug("tbmeta returned, tbName:%s, tbType:%d", pTableName->tname, (*pTableMeta)->tableType); - ctgDbgShowTableMeta(pCtg, pTableName->tname, *pTableMeta); + ctgdShowTableMeta(pCtg, pTableName->tname, *pTableMeta); } CTG_RET(code); @@ -2161,9 +1986,9 @@ void* ctgUpdateThreadFunc(void* param) { tsem_post(&gCtgMgmt.queue.rspSem); } - CTG_STAT_ADD(gCtgMgmt.stat.runtime.qDoneNum); + CTG_RUNTIME_STAT_ADD(qDoneNum); - ctgDbgShowClusterCache(pCtg); + ctgdShowClusterCache(pCtg); } CTG_UNLOCK(CTG_READ, &gCtgMgmt.lock); diff --git a/source/libs/catalog/src/catalogDbg.c b/source/libs/catalog/src/catalogDbg.c new file mode 100644 index 0000000000..1d4ad0082c --- /dev/null +++ b/source/libs/catalog/src/catalogDbg.c @@ -0,0 +1,222 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#include "trpc.h" +#include "query.h" +#include "tname.h" +#include "catalogInt.h" + +extern SCatalogMgmt gCtgMgmt; +SCtgDebug gCTGDebug = {0}; + +int32_t ctgdEnableDebug(char *option) { + if (0 == strcasecmp(option, "lock")) { + gCTGDebug.lockEnable = true; + qDebug("lock debug enabled"); + return TSDB_CODE_SUCCESS; + } + + if (0 == strcasecmp(option, "cache")) { + gCTGDebug.cacheEnable = true; + qDebug("cache debug enabled"); + return TSDB_CODE_SUCCESS; + } + + if (0 == strcasecmp(option, "api")) { + gCTGDebug.apiEnable = true; + qDebug("api debug enabled"); + return TSDB_CODE_SUCCESS; + } + + if (0 == strcasecmp(option, "meta")) { + gCTGDebug.metaEnable = true; + qDebug("api debug enabled"); + return TSDB_CODE_SUCCESS; + } + + qError("invalid debug option:%s", option); + + return TSDB_CODE_CTG_INTERNAL_ERROR; +} + +int32_t ctgdGetStatNum(char *option, void *res) { + if (0 == strcasecmp(option, "runtime.qDoneNum")) { + *(uint64_t *)res = atomic_load_64(&gCtgMgmt.stat.runtime.qDoneNum); + return TSDB_CODE_SUCCESS; + } + + qError("invalid stat option:%s", option); + + return TSDB_CODE_CTG_INTERNAL_ERROR; +} + +int32_t ctgdGetTbMetaNum(SCtgDBCache *dbCache) { + return dbCache->tbCache.metaCache ? (int32_t)taosHashGetSize(dbCache->tbCache.metaCache) : 0; +} + +int32_t ctgdGetStbNum(SCtgDBCache *dbCache) { + return dbCache->tbCache.stbCache ? (int32_t)taosHashGetSize(dbCache->tbCache.stbCache) : 0; +} + +int32_t ctgdGetRentNum(SCtgRentMgmt *rent) { + int32_t num = 0; + for (uint16_t i = 0; i < rent->slotNum; ++i) { + SCtgRentSlot *slot = &rent->slots[i]; + if (NULL == slot->meta) { + continue; + } + + num += taosArrayGetSize(slot->meta); + } + + return num; +} + +int32_t ctgdGetClusterCacheNum(SCatalog* pCtg, int32_t type) { + if (NULL == pCtg || NULL == pCtg->dbCache) { + return 0; + } + + switch (type) { + case CTG_DBG_DB_NUM: + return (int32_t)taosHashGetSize(pCtg->dbCache); + case CTG_DBG_DB_RENT_NUM: + return ctgdGetRentNum(&pCtg->dbRent); + case CTG_DBG_STB_RENT_NUM: + return ctgdGetRentNum(&pCtg->stbRent); + default: + break; + } + + SCtgDBCache *dbCache = NULL; + int32_t num = 0; + void *pIter = taosHashIterate(pCtg->dbCache, NULL); + while (pIter) { + dbCache = (SCtgDBCache *)pIter; + switch (type) { + case CTG_DBG_META_NUM: + num += ctgdGetTbMetaNum(dbCache); + break; + case CTG_DBG_STB_NUM: + num += ctgdGetStbNum(dbCache); + break; + default: + ctgError("invalid type:%d", type); + break; + } + pIter = taosHashIterate(pCtg->dbCache, pIter); + } + + return num; +} + +void ctgdShowTableMeta(SCatalog* pCtg, const char *tbName, STableMeta* p) { + if (!gCTGDebug.metaEnable) { + return; + } + + STableComInfo *c = &p->tableInfo; + + if (TSDB_CHILD_TABLE == p->tableType) { + ctgDebug("table [%s] meta: type:%d, vgId:%d, uid:%" PRIx64 ",suid:%" PRIx64, tbName, p->tableType, p->vgId, p->uid, p->suid); + return; + } else { + ctgDebug("table [%s] meta: type:%d, vgId:%d, uid:%" PRIx64 ",suid:%" PRIx64 ",sv:%d, tv:%d, tagNum:%d, precision:%d, colNum:%d, rowSize:%d", + tbName, p->tableType, p->vgId, p->uid, p->suid, p->sversion, p->tversion, c->numOfTags, c->precision, c->numOfColumns, c->rowSize); + } + + int32_t colNum = c->numOfColumns + c->numOfTags; + for (int32_t i = 0; i < colNum; ++i) { + SSchema *s = &p->schema[i]; + ctgDebug("[%d] name:%s, type:%d, colId:%d, bytes:%d", i, s->name, s->type, s->colId, s->bytes); + } +} + +void ctgdShowDBCache(SCatalog* pCtg, SHashObj *dbHash) { + if (NULL == dbHash || !gCTGDebug.cacheEnable) { + return; + } + + int32_t i = 0; + SCtgDBCache *dbCache = NULL; + void *pIter = taosHashIterate(dbHash, NULL); + while (pIter) { + char *dbFName = NULL; + size_t len = 0; + + dbCache = (SCtgDBCache *)pIter; + + dbFName = taosHashGetKey(pIter, &len); + + int32_t metaNum = dbCache->tbCache.metaCache ? taosHashGetSize(dbCache->tbCache.metaCache) : 0; + int32_t stbNum = dbCache->tbCache.stbCache ? taosHashGetSize(dbCache->tbCache.stbCache) : 0; + int32_t vgVersion = CTG_DEFAULT_INVALID_VERSION; + int32_t hashMethod = -1; + int32_t vgNum = 0; + + if (dbCache->vgInfo) { + vgVersion = dbCache->vgInfo->vgVersion; + hashMethod = dbCache->vgInfo->hashMethod; + if (dbCache->vgInfo->vgHash) { + vgNum = taosHashGetSize(dbCache->vgInfo->vgHash); + } + } + + ctgDebug("[%d] db [%.*s][%"PRIx64"] %s: metaNum:%d, stbNum:%d, vgVersion:%d, hashMethod:%d, vgNum:%d", + i, (int32_t)len, dbFName, dbCache->dbId, dbCache->deleted?"deleted":"", metaNum, stbNum, vgVersion, hashMethod, vgNum); + + pIter = taosHashIterate(dbHash, pIter); + } +} + + + + +void ctgdShowClusterCache(SCatalog* pCtg) { + if (!gCTGDebug.cacheEnable || NULL == pCtg) { + return; + } + + ctgDebug("## cluster %"PRIx64" %p cache Info BEGIN ##", pCtg->clusterId, pCtg); + ctgDebug("db:%d meta:%d stb:%d dbRent:%d stbRent:%d", ctgdGetClusterCacheNum(pCtg, CTG_DBG_DB_NUM), ctgdGetClusterCacheNum(pCtg, CTG_DBG_META_NUM), + ctgdGetClusterCacheNum(pCtg, CTG_DBG_STB_NUM), ctgdGetClusterCacheNum(pCtg, CTG_DBG_DB_RENT_NUM), ctgdGetClusterCacheNum(pCtg, CTG_DBG_STB_RENT_NUM)); + + ctgdShowDBCache(pCtg, pCtg->dbCache); + + ctgDebug("## cluster %"PRIx64" %p cache Info END ##", pCtg->clusterId, pCtg); +} + +int32_t ctgdShowCacheInfo(void) { + if (!gCTGDebug.cacheEnable) { + return TSDB_CODE_CTG_OUT_OF_SERVICE; + } + + CTG_API_ENTER(); + + SCatalog *pCtg = NULL; + void *pIter = taosHashIterate(gCtgMgmt.pCluster, NULL); + while (pIter) { + pCtg = *(SCatalog **)pIter; + + if (pCtg) { + ctgdShowClusterCache(pCtg); + } + + pIter = taosHashIterate(gCtgMgmt.pCluster, pIter); + } + + CTG_API_LEAVE(TSDB_CODE_SUCCESS); +} + diff --git a/source/libs/catalog/test/catalogTests.cpp b/source/libs/catalog/test/catalogTests.cpp index e62819b078..27d08f6428 100644 --- a/source/libs/catalog/test/catalogTests.cpp +++ b/source/libs/catalog/test/catalogTests.cpp @@ -39,10 +39,10 @@ namespace { extern "C" int32_t ctgGetTableMetaFromCache(struct SCatalog *pCatalog, const SName *pTableName, STableMeta **pTableMeta, int32_t *exist, int32_t flag, uint64_t *dbId); -extern "C" int32_t ctgDbgGetClusterCacheNum(struct SCatalog* pCatalog, int32_t type); +extern "C" int32_t ctgdGetClusterCacheNum(struct SCatalog* pCatalog, int32_t type); extern "C" int32_t ctgActUpdateTbl(SCtgMetaAction *action); -extern "C" int32_t ctgDbgEnableDebug(char *option); -extern "C" int32_t ctgDbgGetStatNum(char *option, void *res); +extern "C" int32_t ctgdEnableDebug(char *option); +extern "C" int32_t ctgdGetStatNum(char *option, void *res); void ctgTestSetRspTableMeta(); void ctgTestSetRspCTableMeta(); @@ -140,9 +140,9 @@ void ctgTestInitLogFile() { qDebugFlag = 159; strcpy(tsLogDir, "/var/log/taos"); - ctgDbgEnableDebug("api"); - ctgDbgEnableDebug("meta"); - ctgDbgEnableDebug("cache"); + ctgdEnableDebug("api"); + ctgdEnableDebug("meta"); + ctgdEnableDebug("cache"); if (taosInitLog(defaultLogFileNamePrefix, maxLogFileNum) < 0) { printf("failed to open log file in directory:%s\n", tsLogDir); @@ -879,7 +879,7 @@ TEST(tableMeta, normalTable) { ASSERT_EQ(vgInfo.vgId, 8); ASSERT_EQ(vgInfo.epSet.numOfEps, 3); - while (0 == ctgDbgGetClusterCacheNum(pCtg, CTG_DBG_DB_NUM)) { + while (0 == ctgdGetClusterCacheNum(pCtg, CTG_DBG_DB_NUM)) { taosMsleep(50); } @@ -899,7 +899,7 @@ TEST(tableMeta, normalTable) { ASSERT_EQ(tableMeta->tableInfo.rowSize, 12); while (true) { - uint32_t n = ctgDbgGetClusterCacheNum(pCtg, CTG_DBG_META_NUM); + uint32_t n = ctgdGetClusterCacheNum(pCtg, CTG_DBG_META_NUM); if (0 == n) { taosMsleep(50); } else { @@ -994,7 +994,7 @@ TEST(tableMeta, childTableCase) { ASSERT_EQ(tableMeta->tableInfo.rowSize, 12); while (true) { - uint32_t n = ctgDbgGetClusterCacheNum(pCtg, CTG_DBG_META_NUM); + uint32_t n = ctgdGetClusterCacheNum(pCtg, CTG_DBG_META_NUM); if (0 == n) { taosMsleep(50); } else { @@ -1103,7 +1103,7 @@ TEST(tableMeta, superTableCase) { ASSERT_EQ(tableMeta->tableInfo.rowSize, 12); while (true) { - uint32_t n = ctgDbgGetClusterCacheNum(pCtg, CTG_DBG_META_NUM); + uint32_t n = ctgdGetClusterCacheNum(pCtg, CTG_DBG_META_NUM); if (0 == n) { taosMsleep(50); } else { @@ -1130,7 +1130,7 @@ TEST(tableMeta, superTableCase) { ASSERT_EQ(tableMeta->tableInfo.rowSize, 12); while (true) { - uint32_t n = ctgDbgGetClusterCacheNum(pCtg, CTG_DBG_META_NUM); + uint32_t n = ctgdGetClusterCacheNum(pCtg, CTG_DBG_META_NUM); if (2 != n) { taosMsleep(50); } else { @@ -1228,7 +1228,7 @@ TEST(tableMeta, rmStbMeta) { ASSERT_EQ(tableMeta->tableInfo.rowSize, 12); while (true) { - uint32_t n = ctgDbgGetClusterCacheNum(pCtg, CTG_DBG_META_NUM); + uint32_t n = ctgdGetClusterCacheNum(pCtg, CTG_DBG_META_NUM); if (0 == n) { taosMsleep(50); } else { @@ -1241,8 +1241,8 @@ TEST(tableMeta, rmStbMeta) { ASSERT_EQ(code, 0); while (true) { - int32_t n = ctgDbgGetClusterCacheNum(pCtg, CTG_DBG_META_NUM); - int32_t m = ctgDbgGetClusterCacheNum(pCtg, CTG_DBG_STB_RENT_NUM); + int32_t n = ctgdGetClusterCacheNum(pCtg, CTG_DBG_META_NUM); + int32_t m = ctgdGetClusterCacheNum(pCtg, CTG_DBG_STB_RENT_NUM); if (n || m) { taosMsleep(50); } else { @@ -1251,11 +1251,11 @@ TEST(tableMeta, rmStbMeta) { } - ASSERT_EQ(ctgDbgGetClusterCacheNum(pCtg, CTG_DBG_DB_NUM), 1); - ASSERT_EQ(ctgDbgGetClusterCacheNum(pCtg, CTG_DBG_META_NUM), 0); - ASSERT_EQ(ctgDbgGetClusterCacheNum(pCtg, CTG_DBG_STB_NUM), 0); - ASSERT_EQ(ctgDbgGetClusterCacheNum(pCtg, CTG_DBG_DB_RENT_NUM), 1); - ASSERT_EQ(ctgDbgGetClusterCacheNum(pCtg, CTG_DBG_STB_RENT_NUM), 0); + ASSERT_EQ(ctgdGetClusterCacheNum(pCtg, CTG_DBG_DB_NUM), 1); + ASSERT_EQ(ctgdGetClusterCacheNum(pCtg, CTG_DBG_META_NUM), 0); + ASSERT_EQ(ctgdGetClusterCacheNum(pCtg, CTG_DBG_STB_NUM), 0); + ASSERT_EQ(ctgdGetClusterCacheNum(pCtg, CTG_DBG_DB_RENT_NUM), 1); + ASSERT_EQ(ctgdGetClusterCacheNum(pCtg, CTG_DBG_STB_RENT_NUM), 0); catalogDestroy(); memset(&gCtgMgmt, 0, sizeof(gCtgMgmt)); @@ -1298,7 +1298,7 @@ TEST(tableMeta, updateStbMeta) { ASSERT_EQ(tableMeta->tableInfo.rowSize, 12); while (true) { - uint32_t n = ctgDbgGetClusterCacheNum(pCtg, CTG_DBG_META_NUM); + uint32_t n = ctgdGetClusterCacheNum(pCtg, CTG_DBG_META_NUM); if (0 == n) { taosMsleep(50); } else { @@ -1318,7 +1318,7 @@ TEST(tableMeta, updateStbMeta) { while (true) { uint64_t n = 0; - ctgDbgGetStatNum("runtime.qDoneNum", (void *)&n); + ctgdGetStatNum("runtime.qDoneNum", (void *)&n); if (n != 3) { taosMsleep(50); } else { @@ -1326,11 +1326,11 @@ TEST(tableMeta, updateStbMeta) { } } - ASSERT_EQ(ctgDbgGetClusterCacheNum(pCtg, CTG_DBG_DB_NUM), 1); - ASSERT_EQ(ctgDbgGetClusterCacheNum(pCtg, CTG_DBG_META_NUM), 1); - ASSERT_EQ(ctgDbgGetClusterCacheNum(pCtg, CTG_DBG_STB_NUM), 1); - ASSERT_EQ(ctgDbgGetClusterCacheNum(pCtg, CTG_DBG_DB_RENT_NUM), 1); - ASSERT_EQ(ctgDbgGetClusterCacheNum(pCtg, CTG_DBG_STB_RENT_NUM), 1); + ASSERT_EQ(ctgdGetClusterCacheNum(pCtg, CTG_DBG_DB_NUM), 1); + ASSERT_EQ(ctgdGetClusterCacheNum(pCtg, CTG_DBG_META_NUM), 1); + ASSERT_EQ(ctgdGetClusterCacheNum(pCtg, CTG_DBG_STB_NUM), 1); + ASSERT_EQ(ctgdGetClusterCacheNum(pCtg, CTG_DBG_DB_RENT_NUM), 1); + ASSERT_EQ(ctgdGetClusterCacheNum(pCtg, CTG_DBG_STB_RENT_NUM), 1); code = catalogGetTableMeta(pCtg, mockPointer, (const SEpSet *)mockPointer, &n, &tableMeta); ASSERT_EQ(code, 0); @@ -1388,7 +1388,7 @@ TEST(refreshGetMeta, normal2normal) { while (true) { uint64_t n = 0; - ctgDbgGetStatNum("runtime.qDoneNum", (void *)&n); + ctgdGetStatNum("runtime.qDoneNum", (void *)&n); if (n > 0) { break; } @@ -1409,7 +1409,7 @@ TEST(refreshGetMeta, normal2normal) { ASSERT_EQ(tableMeta->tableInfo.rowSize, 12); taosMemoryFreeClear(tableMeta); - while (0 == ctgDbgGetClusterCacheNum(pCtg, CTG_DBG_META_NUM)) { + while (0 == ctgdGetClusterCacheNum(pCtg, CTG_DBG_META_NUM)) { taosMsleep(50); } @@ -1467,7 +1467,7 @@ TEST(refreshGetMeta, normal2notexist) { while (true) { uint64_t n = 0; - ctgDbgGetStatNum("runtime.qDoneNum", (void *)&n); + ctgdGetStatNum("runtime.qDoneNum", (void *)&n); if (n > 0) { break; } @@ -1488,7 +1488,7 @@ TEST(refreshGetMeta, normal2notexist) { ASSERT_EQ(tableMeta->tableInfo.rowSize, 12); taosMemoryFreeClear(tableMeta); - while (0 == ctgDbgGetClusterCacheNum(pCtg, CTG_DBG_META_NUM)) { + while (0 == ctgdGetClusterCacheNum(pCtg, CTG_DBG_META_NUM)) { taosMsleep(50); } @@ -1541,7 +1541,7 @@ TEST(refreshGetMeta, normal2child) { while (true) { uint64_t n = 0; - ctgDbgGetStatNum("runtime.qDoneNum", (void *)&n); + ctgdGetStatNum("runtime.qDoneNum", (void *)&n); if (n > 0) { break; } @@ -1562,7 +1562,7 @@ TEST(refreshGetMeta, normal2child) { ASSERT_EQ(tableMeta->tableInfo.rowSize, 12); taosMemoryFreeClear(tableMeta); - while (0 == ctgDbgGetClusterCacheNum(pCtg, CTG_DBG_META_NUM)) { + while (0 == ctgdGetClusterCacheNum(pCtg, CTG_DBG_META_NUM)) { taosMsleep(50); } @@ -1625,7 +1625,7 @@ TEST(refreshGetMeta, stable2child) { while (true) { uint64_t n = 0; - ctgDbgGetStatNum("runtime.qDoneNum", (void *)&n); + ctgdGetStatNum("runtime.qDoneNum", (void *)&n); if (n > 0) { break; } @@ -1647,7 +1647,7 @@ TEST(refreshGetMeta, stable2child) { ASSERT_EQ(tableMeta->tableInfo.rowSize, 12); taosMemoryFreeClear(tableMeta); - while (0 == ctgDbgGetClusterCacheNum(pCtg, CTG_DBG_META_NUM)) { + while (0 == ctgdGetClusterCacheNum(pCtg, CTG_DBG_META_NUM)) { taosMsleep(50); } @@ -1710,7 +1710,7 @@ TEST(refreshGetMeta, stable2stable) { while (true) { uint64_t n = 0; - ctgDbgGetStatNum("runtime.qDoneNum", (void *)&n); + ctgdGetStatNum("runtime.qDoneNum", (void *)&n); if (n > 0) { break; } @@ -1732,7 +1732,7 @@ TEST(refreshGetMeta, stable2stable) { ASSERT_EQ(tableMeta->tableInfo.rowSize, 12); taosMemoryFreeClear(tableMeta); - while (0 == ctgDbgGetClusterCacheNum(pCtg, CTG_DBG_META_NUM)) { + while (0 == ctgdGetClusterCacheNum(pCtg, CTG_DBG_META_NUM)) { taosMsleep(50); } @@ -1798,7 +1798,7 @@ TEST(refreshGetMeta, child2stable) { while (true) { uint64_t n = 0; - ctgDbgGetStatNum("runtime.qDoneNum", (void *)&n); + ctgdGetStatNum("runtime.qDoneNum", (void *)&n); if (n > 0) { break; } @@ -1818,7 +1818,7 @@ TEST(refreshGetMeta, child2stable) { ASSERT_EQ(tableMeta->tableInfo.rowSize, 12); taosMemoryFreeClear(tableMeta); - while (2 != ctgDbgGetClusterCacheNum(pCtg, CTG_DBG_META_NUM)) { + while (2 != ctgdGetClusterCacheNum(pCtg, CTG_DBG_META_NUM)) { taosMsleep(50); } @@ -2015,7 +2015,7 @@ TEST(dbVgroup, getSetDbVgroupCase) { while (true) { uint64_t n = 0; - ctgDbgGetStatNum("runtime.qDoneNum", (void *)&n); + ctgdGetStatNum("runtime.qDoneNum", (void *)&n); if (n > 0) { break; } @@ -2041,7 +2041,7 @@ TEST(dbVgroup, getSetDbVgroupCase) { while (true) { uint64_t n = 0; - ctgDbgGetStatNum("runtime.qDoneNum", (void *)&n); + ctgdGetStatNum("runtime.qDoneNum", (void *)&n); if (n != 3) { taosMsleep(50); } else { @@ -2266,7 +2266,7 @@ TEST(rentTest, allRent) { ASSERT_EQ(tableMeta->tableInfo.precision, 1); ASSERT_EQ(tableMeta->tableInfo.rowSize, 12); - while (ctgDbgGetClusterCacheNum(pCtg, CTG_DBG_META_NUM) < i) { + while (ctgdGetClusterCacheNum(pCtg, CTG_DBG_META_NUM) < i) { taosMsleep(50); } From 9e3f03ad745602fef4f0f07e6636a05d2225e5cd Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Mon, 28 Mar 2022 13:49:21 +0800 Subject: [PATCH 02/47] feature/qnode --- source/libs/catalog/inc/catalogInt.h | 12 +- source/libs/catalog/src/catalog.c | 145 ++++++++++++++-------- source/libs/catalog/test/catalogTests.cpp | 8 +- 3 files changed, 105 insertions(+), 60 deletions(-) diff --git a/source/libs/catalog/inc/catalogInt.h b/source/libs/catalog/inc/catalogInt.h index a5887e8807..09f51dc03e 100644 --- a/source/libs/catalog/inc/catalogInt.h +++ b/source/libs/catalog/inc/catalogInt.h @@ -115,6 +115,7 @@ typedef struct SCtgCacheStat { uint64_t clusterNum; uint64_t dbNum; uint64_t tblNum; + uint64_t stblNum; uint64_t vgHitNum; uint64_t vgMissNum; uint64_t tblHitNum; @@ -210,12 +211,13 @@ typedef struct SCtgAction { #define CTG_QUEUE_ADD() atomic_add_fetch_64(&gCtgMgmt.queue.qRemainNum, 1) #define CTG_QUEUE_SUB() atomic_sub_fetch_64(&gCtgMgmt.queue.qRemainNum, 1) -#define CTG_STAT_ADD(n) atomic_add_fetch_64(&(n), 1) -#define CTG_STAT_SUB(n) atomic_sub_fetch_64(&(n), 1) -#define CTG_STAT_GET(n) atomic_load_64(&(n)) +#define CTG_STAT_ADD(_item, _n) atomic_add_fetch_64(&(_item), _n) +#define CTG_STAT_SUB(_item, _n) atomic_sub_fetch_64(&(_item), _n) +#define CTG_STAT_GET(_item) atomic_load_64(&(_item)) -#define CTG_RUNTIME_STAT_ADD(_item) (CTG_STAT_ADD(gCtgMgmt.stat.runtime._item)) -#define CTG_CACHE_STAT_ADD(_item) (CTG_STAT_ADD(gCtgMgmt.stat.cache._item)) +#define CTG_RUNTIME_STAT_ADD(item, n) (CTG_STAT_ADD(gCtgMgmt.stat.runtime.item, n)) +#define CTG_CACHE_STAT_ADD(item, n) (CTG_STAT_ADD(gCtgMgmt.stat.cache.item, n)) +#define CTG_CACHE_STAT_SUB(item, n) (CTG_STAT_SUB(gCtgMgmt.stat.cache.item, n)) #define CTG_IS_META_NULL(type) ((type) == META_TYPE_NULL_TABLE) #define CTG_IS_META_CTABLE(type) ((type) == META_TYPE_CTABLE) diff --git a/source/libs/catalog/src/catalog.c b/source/libs/catalog/src/catalog.c index 73b363ec5c..04f93c31f3 100644 --- a/source/libs/catalog/src/catalog.c +++ b/source/libs/catalog/src/catalog.c @@ -74,15 +74,19 @@ void ctgFreeMetaRent(SCtgRentMgmt *mgmt) { void ctgFreeTableMetaCache(SCtgTbMetaCache *cache) { CTG_LOCK(CTG_WRITE, &cache->stbLock); if (cache->stbCache) { + int32_t stblNum = taosHashGetSize(cache->stbCache); taosHashCleanup(cache->stbCache); cache->stbCache = NULL; + CTG_CACHE_STAT_SUB(stblNum, stblNum); } CTG_UNLOCK(CTG_WRITE, &cache->stbLock); CTG_LOCK(CTG_WRITE, &cache->metaLock); if (cache->metaCache) { + int32_t tblNum = taosHashGetSize(cache->metaCache); taosHashCleanup(cache->metaCache); cache->metaCache = NULL; + CTG_CACHE_STAT_SUB(tblNum, tblNum); } CTG_UNLOCK(CTG_WRITE, &cache->metaLock); } @@ -118,6 +122,8 @@ void ctgFreeHandle(SCatalog* pCtg) { ctgFreeMetaRent(&pCtg->stbRent); if (pCtg->dbCache) { + int32_t dbNum = taosHashGetSize(pCtg->dbCache); + void *pIter = taosHashIterate(pCtg->dbCache, NULL); while (pIter) { SCtgDBCache *dbCache = pIter; @@ -130,6 +136,8 @@ void ctgFreeHandle(SCatalog* pCtg) { } taosHashCleanup(pCtg->dbCache); + + CTG_CACHE_STAT_SUB(dbNum, dbNum); } taosMemoryFree(pCtg); @@ -186,7 +194,7 @@ int32_t ctgPushAction(SCatalog* pCtg, SCtgMetaAction *action) { CTG_UNLOCK(CTG_WRITE, &gCtgMgmt.queue.qlock); CTG_QUEUE_ADD(); - CTG_RUNTIME_STAT_ADD(qNum); + CTG_RUNTIME_STAT_ADD(qNum, 1); tsem_post(&gCtgMgmt.queue.reqSem); @@ -445,34 +453,45 @@ int32_t ctgGetDBCache(SCatalog* pCtg, const char *dbFName, SCtgDBCache **pCache) int32_t ctgAcquireVgInfoFromCache(SCatalog* pCtg, const char *dbFName, SCtgDBCache **pCache, bool *inCache) { + SCtgDBCache *dbCache = NULL; + if (NULL == pCtg->dbCache) { - *pCache = NULL; - *inCache = false; - ctgWarn("empty db cache, dbFName:%s", dbFName); - return TSDB_CODE_SUCCESS; + ctgDebug("empty db cache, dbFName:%s", dbFName); + goto _return; } - SCtgDBCache *dbCache = NULL; ctgAcquireDBCache(pCtg, dbFName, &dbCache); if (NULL == dbCache) { - *pCache = NULL; - *inCache = false; - return TSDB_CODE_SUCCESS; + ctgDebug("db %s not in cache", dbFName); + goto _return; } ctgAcquireVgInfo(pCtg, dbCache, inCache); if (!(*inCache)) { - ctgReleaseDBCache(pCtg, dbCache); - - *pCache = NULL; - return TSDB_CODE_SUCCESS; + ctgDebug("vgInfo of db %s not in cache", dbFName); + goto _return; } *pCache = dbCache; *inCache = true; + CTG_CACHE_STAT_ADD(vgHitNum, 1); + ctgDebug("Got db vgInfo from cache, dbFName:%s", dbFName); + return TSDB_CODE_SUCCESS; + +_return: + + if (dbCache) { + ctgReleaseDBCache(pCtg, dbCache); + } + + *pCache = NULL; + *inCache = false; + + CTG_CACHE_STAT_ADD(vgMissNum, 1); + return TSDB_CODE_SUCCESS; } @@ -588,11 +607,10 @@ int32_t ctgIsTableMetaExistInCache(SCatalog* pCtg, char *dbFName, char* tbName, } -int32_t ctgGetTableMetaFromCache(SCatalog* pCtg, const SName* pTableName, STableMeta** pTableMeta, int32_t *exist, int32_t flag, uint64_t *dbId) { +int32_t ctgGetTableMetaFromCache(SCatalog* pCtg, const SName* pTableName, STableMeta** pTableMeta, bool *inCache, int32_t flag, uint64_t *dbId) { if (NULL == pCtg->dbCache) { - *exist = 0; - ctgWarn("empty tbmeta cache, tbName:%s", pTableName->tname); - return TSDB_CODE_SUCCESS; + ctgDebug("empty tbmeta cache, tbName:%s", pTableName->tname); + goto _return; } char dbFName[TSDB_DB_FNAME_LEN] = {0}; @@ -607,8 +625,8 @@ int32_t ctgGetTableMetaFromCache(SCatalog* pCtg, const SName* pTableName, STable SCtgDBCache *dbCache = NULL; ctgAcquireDBCache(pCtg, dbFName, &dbCache); if (NULL == dbCache) { - *exist = 0; - return TSDB_CODE_SUCCESS; + ctgDebug("db %s not in cache", pTableName->tname); + goto _return; } int32_t sz = 0; @@ -617,13 +635,11 @@ int32_t ctgGetTableMetaFromCache(SCatalog* pCtg, const SName* pTableName, STable CTG_UNLOCK(CTG_READ, &dbCache->tbCache.metaLock); if (NULL == *pTableMeta) { - *exist = 0; ctgReleaseDBCache(pCtg, dbCache); ctgDebug("tbl not in cache, dbFName:%s, tbName:%s", dbFName, pTableName->tname); - return TSDB_CODE_SUCCESS; + goto _return; } - *exist = 1; if (dbId) { *dbId = dbCache->dbId; } @@ -633,6 +649,10 @@ int32_t ctgGetTableMetaFromCache(SCatalog* pCtg, const SName* pTableName, STable if (tbMeta->tableType != TSDB_CHILD_TABLE) { ctgReleaseDBCache(pCtg, dbCache); ctgDebug("Got meta from cache, type:%d, dbFName:%s, tbName:%s", tbMeta->tableType, dbFName, pTableName->tname); + + *inCache = true; + CTG_CACHE_STAT_ADD(tblHitNum, 1); + return TSDB_CODE_SUCCESS; } @@ -644,8 +664,7 @@ int32_t ctgGetTableMetaFromCache(SCatalog* pCtg, const SName* pTableName, STable ctgReleaseDBCache(pCtg, dbCache); ctgError("stb not in stbCache, suid:%"PRIx64, tbMeta->suid); taosMemoryFreeClear(*pTableMeta); - *exist = 0; - return TSDB_CODE_SUCCESS; + goto _return; } if ((*stbMeta)->suid != tbMeta->suid) { @@ -671,8 +690,18 @@ int32_t ctgGetTableMetaFromCache(SCatalog* pCtg, const SName* pTableName, STable ctgReleaseDBCache(pCtg, dbCache); + *inCache = true; + CTG_CACHE_STAT_ADD(tblHitNum, 1); + ctgDebug("Got tbmeta from cache, dbFName:%s, tbName:%s", dbFName, pTableName->tname); + return TSDB_CODE_SUCCESS; + +_return: + + *inCache = false; + CTG_CACHE_STAT_ADD(tblMissNum, 1); + return TSDB_CODE_SUCCESS; } @@ -1202,6 +1231,8 @@ int32_t ctgAddNewDBCache(SCatalog *pCtg, const char *dbFName, uint64_t dbId) { ctgError("taosHashPut db to cache failed, dbFName:%s", dbFName); CTG_ERR_JRET(TSDB_CODE_CTG_MEM_ERROR); } + + CTG_CACHE_STAT_ADD(dbNum, 1); SDbVgVersion vgVersion = {.dbId = newDBCache.dbId, .vgVersion = -1}; strncpy(vgVersion.dbFName, dbFName, sizeof(vgVersion.dbFName)); @@ -1261,6 +1292,8 @@ int32_t ctgRemoveDB(SCatalog* pCtg, SCtgDBCache *dbCache, const char* dbFName) { CTG_ERR_RET(TSDB_CODE_CTG_DB_DROPPED); } + CTG_CACHE_STAT_SUB(dbNum, 1); + ctgInfo("db removed from cache, dbFName:%s, dbId:%"PRIx64, dbFName, dbId); return TSDB_CODE_SUCCESS; @@ -1393,6 +1426,8 @@ int32_t ctgUpdateTblMeta(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFName, ui CTG_LOCK(CTG_WRITE, &tbCache->stbLock); if (taosHashRemove(tbCache->stbCache, &orig->suid, sizeof(orig->suid))) { ctgError("stb not exist in stbCache, dbFName:%s, stb:%s, suid:%"PRIx64, dbFName, tbName, orig->suid); + } else { + CTG_CACHE_STAT_SUB(stblNum, 1); } CTG_UNLOCK(CTG_WRITE, &tbCache->stbLock); @@ -1419,6 +1454,10 @@ int32_t ctgUpdateTblMeta(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFName, ui CTG_ERR_RET(TSDB_CODE_CTG_MEM_ERROR); } + if (NULL == orig) { + CTG_CACHE_STAT_ADD(tblNum, 1); + } + ctgDebug("tbmeta updated to cache, dbFName:%s, tbName:%s, tbType:%d", dbFName, tbName, meta->tableType); ctgdShowTableMeta(pCtg, tbName, meta); @@ -1440,6 +1479,8 @@ int32_t ctgUpdateTblMeta(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFName, ui ctgError("taosHashPut stable to stable cache failed, suid:%"PRIx64, meta->suid); CTG_ERR_RET(TSDB_CODE_CTG_MEM_ERROR); } + + CTG_CACHE_STAT_ADD(stblNum, 1); CTG_UNLOCK(CTG_WRITE, &tbCache->stbLock); @@ -1699,7 +1740,7 @@ int32_t ctgGetTableMeta(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmtEps, cons CTG_ERR_RET(TSDB_CODE_CTG_INVALID_INPUT); } - int32_t exist = 0; + bool inCache = false; int32_t code = 0; uint64_t dbId = 0; uint64_t suid = 0; @@ -1709,11 +1750,11 @@ int32_t ctgGetTableMeta(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmtEps, cons CTG_FLAG_SET_INF_DB(flag); } - CTG_ERR_RET(ctgGetTableMetaFromCache(pCtg, pTableName, pTableMeta, &exist, flag, &dbId)); + CTG_ERR_RET(ctgGetTableMetaFromCache(pCtg, pTableName, pTableMeta, &inCache, flag, &dbId)); int32_t tbType = 0; - if (exist) { + if (inCache) { if (CTG_FLAG_MATCH_STB(flag, (*pTableMeta)->tableType) && ((!CTG_FLAG_IS_FORCE_UPDATE(flag)) || (CTG_FLAG_IS_INF_DB(flag)))) { goto _return; } @@ -1755,8 +1796,8 @@ int32_t ctgGetTableMeta(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmtEps, cons SName stbName = *pTableName; strcpy(stbName.tname, output->tbName); - CTG_ERR_JRET(ctgGetTableMetaFromCache(pCtg, &stbName, pTableMeta, &exist, flag, NULL)); - if (0 == exist) { + CTG_ERR_JRET(ctgGetTableMetaFromCache(pCtg, &stbName, pTableMeta, &inCache, flag, NULL)); + if (!inCache) { ctgDebug("stb no longer exist, dbFName:%s, tbName:%s", output->dbFName, pTableName->tname); continue; } @@ -1768,7 +1809,7 @@ int32_t ctgGetTableMeta(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmtEps, cons _return: - if (CTG_TABLE_NOT_EXIST(code) && exist) { + if (CTG_TABLE_NOT_EXIST(code) && inCache) { char dbFName[TSDB_DB_FNAME_LEN] = {0}; if (CTG_FLAG_IS_INF_DB(flag)) { strcpy(dbFName, pTableName->dbname); @@ -1900,12 +1941,16 @@ int32_t ctgActRemoveStb(SCtgMetaAction *action) { CTG_LOCK(CTG_WRITE, &dbCache->tbCache.stbLock); if (taosHashRemove(dbCache->tbCache.stbCache, &msg->suid, sizeof(msg->suid))) { ctgDebug("stb not exist in stbCache, may be removed, dbFName:%s, stb:%s, suid:%"PRIx64, msg->dbFName, msg->stbName, msg->suid); + } else { + CTG_CACHE_STAT_SUB(stblNum, 1); } CTG_LOCK(CTG_READ, &dbCache->tbCache.metaLock); if (taosHashRemove(dbCache->tbCache.metaCache, msg->stbName, strlen(msg->stbName))) { ctgError("stb not exist in cache, dbFName:%s, stb:%s, suid:%"PRIx64, msg->dbFName, msg->stbName, msg->suid); - } + } else { + CTG_CACHE_STAT_SUB(tblNum, 1); + } CTG_UNLOCK(CTG_READ, &dbCache->tbCache.metaLock); CTG_UNLOCK(CTG_WRITE, &dbCache->tbCache.stbLock); @@ -1944,6 +1989,8 @@ int32_t ctgActRemoveTbl(SCtgMetaAction *action) { CTG_UNLOCK(CTG_READ, &dbCache->tbCache.metaLock); ctgError("stb not exist in cache, dbFName:%s, tbName:%s", msg->dbFName, msg->tbName); CTG_ERR_RET(TSDB_CODE_CTG_INTERNAL_ERROR); + } else { + CTG_CACHE_STAT_SUB(tblNum, 1); } CTG_UNLOCK(CTG_READ, &dbCache->tbCache.metaLock); @@ -1986,7 +2033,7 @@ void* ctgUpdateThreadFunc(void* param) { tsem_post(&gCtgMgmt.queue.rspSem); } - CTG_RUNTIME_STAT_ADD(qDoneNum); + CTG_RUNTIME_STAT_ADD(qDoneNum, 1); ctgdShowClusterCache(pCtg); } @@ -2208,6 +2255,8 @@ int32_t catalogGetHandle(uint64_t clusterId, SCatalog** catalogHandle) { } *catalogHandle = clusterCtg; + + CTG_CACHE_STAT_ADD(clusterNum, 1); return TSDB_CODE_SUCCESS; @@ -2228,10 +2277,12 @@ void catalogFreeHandle(SCatalog* pCtg) { return; } + CTG_CACHE_STAT_SUB(clusterNum, 1); + uint64_t clusterId = pCtg->clusterId; ctgFreeHandle(pCtg); - + ctgInfo("handle freed, culsterId:%"PRIx64, clusterId); } @@ -2242,24 +2293,12 @@ int32_t catalogGetDBVgVersion(SCatalog* pCtg, const char* dbFName, int32_t* vers CTG_API_LEAVE(TSDB_CODE_CTG_INVALID_INPUT); } - if (NULL == pCtg->dbCache) { - *version = CTG_DEFAULT_INVALID_VERSION; - ctgInfo("empty db cache, dbFName:%s", dbFName); - CTG_API_LEAVE(TSDB_CODE_SUCCESS); - } - SCtgDBCache *dbCache = NULL; - ctgAcquireDBCache(pCtg, dbFName, &dbCache); - if (NULL == dbCache) { - *version = CTG_DEFAULT_INVALID_VERSION; - CTG_API_LEAVE(TSDB_CODE_SUCCESS); - } - bool inCache = false; - ctgAcquireVgInfo(pCtg, dbCache, &inCache); - if (!inCache) { - ctgReleaseDBCache(pCtg, dbCache); + int32_t code = 0; + CTG_ERR_JRET(ctgAcquireVgInfoFromCache(pCtg, dbFName, &dbCache, &inCache)); + if (!inCache) { *version = CTG_DEFAULT_INVALID_VERSION; CTG_API_LEAVE(TSDB_CODE_SUCCESS); } @@ -2274,6 +2313,10 @@ int32_t catalogGetDBVgVersion(SCatalog* pCtg, const char* dbFName, int32_t* vers ctgDebug("Got db vgVersion from cache, dbFName:%s, vgVersion:%d", dbFName, *version); CTG_API_LEAVE(TSDB_CODE_SUCCESS); + +_return: + + CTG_API_LEAVE(code); } int32_t catalogGetDBVgInfo(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmtEps, const char* dbFName, SArray** vgroupList) { @@ -2374,11 +2417,11 @@ int32_t catalogRemoveTableMeta(SCatalog* pCtg, const SName* pTableName) { } STableMeta *tblMeta = NULL; - int32_t exist = 0; + bool inCache = false; uint64_t dbId = 0; - CTG_ERR_JRET(ctgGetTableMetaFromCache(pCtg, pTableName, &tblMeta, &exist, 0, &dbId)); + CTG_ERR_JRET(ctgGetTableMetaFromCache(pCtg, pTableName, &tblMeta, &inCache, 0, &dbId)); - if (0 == exist) { + if (!inCache) { ctgDebug("table already not in cache, db:%s, tblName:%s", pTableName->dbname, pTableName->tname); goto _return; } diff --git a/source/libs/catalog/test/catalogTests.cpp b/source/libs/catalog/test/catalogTests.cpp index 27d08f6428..73d0dc2011 100644 --- a/source/libs/catalog/test/catalogTests.cpp +++ b/source/libs/catalog/test/catalogTests.cpp @@ -38,7 +38,7 @@ namespace { extern "C" int32_t ctgGetTableMetaFromCache(struct SCatalog *pCatalog, const SName *pTableName, STableMeta **pTableMeta, - int32_t *exist, int32_t flag, uint64_t *dbId); + bool *inCache, int32_t flag, uint64_t *dbId); extern "C" int32_t ctgdGetClusterCacheNum(struct SCatalog* pCatalog, int32_t type); extern "C" int32_t ctgActUpdateTbl(SCtgMetaAction *action); extern "C" int32_t ctgdEnableDebug(char *option); @@ -786,15 +786,15 @@ void *ctgTestGetCtableMetaThread(void *param) { int32_t code = 0; int32_t n = 0; STableMeta *tbMeta = NULL; - int32_t exist = 0; + bool inCache = false; SName cn = {.type = TSDB_TABLE_NAME_T, .acctId = 1}; strcpy(cn.dbname, "db1"); strcpy(cn.tname, ctgTestCTablename); while (!ctgTestStop) { - code = ctgGetTableMetaFromCache(pCtg, &cn, &tbMeta, &exist, 0, NULL); - if (code || 0 == exist) { + code = ctgGetTableMetaFromCache(pCtg, &cn, &tbMeta, &inCache, 0, NULL); + if (code || !inCache) { assert(0); } From f867538446cd02cf60417efe06cea70d8e21eccf Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Mon, 28 Mar 2022 19:48:47 +0800 Subject: [PATCH 03/47] feature/qnode --- include/libs/qcom/query.h | 6 + source/libs/qcom/inc/queryInt.h | 19 +++ source/libs/qcom/src/queryExplain.c | 199 ++++++++++++++++++++++++++++ 3 files changed, 224 insertions(+) create mode 100644 source/libs/qcom/src/queryExplain.c diff --git a/include/libs/qcom/query.h b/include/libs/qcom/query.h index f487e5ae22..c3870665a6 100644 --- a/include/libs/qcom/query.h +++ b/include/libs/qcom/query.h @@ -53,6 +53,12 @@ typedef struct SIndexMeta { } SIndexMeta; +typedef struct SPhysiNodeExplainResNode { + SNodeList* pChildren; + SPhysiNode* pNode; + void* pExecInfo; +} SPhysiNodeExplainResNode; + /* * ASSERT(sizeof(SCTableMeta) == 24) * ASSERT(tableType == TSDB_CHILD_TABLE) diff --git a/source/libs/qcom/inc/queryInt.h b/source/libs/qcom/inc/queryInt.h index 75c1e134cd..86a1e04ae5 100644 --- a/source/libs/qcom/inc/queryInt.h +++ b/source/libs/qcom/inc/queryInt.h @@ -20,6 +20,25 @@ extern "C" { #endif +#define QUERY_EXPLAIN_MAX_RES_LEN 1024 + +#define EXPLAIN_TAG_SCAN_FORMAT "Tag scan on %s" +#define EXPLAIN_ORDER_FORMAT "Order: " + +typedef struct SQueryExplainRowInfo { + int32_t level; + int32_t len; + char *buf; +} SQueryExplainRowInfo; + + +#define QUERY_EXPLAIN_NEWLINE(_format, ...) tlen = snprintf(tbuf + tlen, QUERY_EXPLAIN_MAX_RES_LEN - tlen, _format, __VA_ARGS__) +#define QUERY_EXPLAIN_APPEND(_format, ...) tlen += snprintf(tbuf + tlen, QUERY_EXPLAIN_MAX_RES_LEN - tlen, _format, __VA_ARGS__) + + +#define QRY_ERR_RET(c) do { int32_t _code = c; if (_code != TSDB_CODE_SUCCESS) { terrno = _code; return _code; } } while (0) +#define QRY_RET(c) do { int32_t _code = c; if (_code != TSDB_CODE_SUCCESS) { terrno = _code; } return _code; } while (0) +#define QRY_ERR_JRET(c) do { code = c; if (code != TSDB_CODE_SUCCESS) { terrno = code; goto _return; } } while (0) #ifdef __cplusplus diff --git a/source/libs/qcom/src/queryExplain.c b/source/libs/qcom/src/queryExplain.c new file mode 100644 index 0000000000..d547e67170 --- /dev/null +++ b/source/libs/qcom/src/queryExplain.c @@ -0,0 +1,199 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#include "queryInt.h" +#include "query.h" + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat-truncation" + +void qFreeExplainRes(SPhysiNodeExplainRes *res) { + +} + +int32_t qMakeExplainResChildrenInfo(SPhysiNode *pNode, void *pExecInfo, SNodeList **pChildren) { + +} + +int32_t qMakeExplainResNode(SPhysiNode *pNode, void *pExecInfo, SPhysiNodeExplainResNode **pRes) { + if (NULL == pNode) { + *pRes = NULL; + qError("physical node is NULL"); + return TSDB_CODE_QRY_APP_ERROR; + } + + SPhysiNodeExplainResNode *res = calloc(1, sizeof(SPhysiNodeExplainResNode)); + if (NULL == res) { + qError("calloc SPhysiNodeExplainRes failed"); + return TSDB_CODE_QRY_OUT_OF_MEMORY; + } + + int32_t code = 0; + res->pNode = pNode; + res->pExecInfo = pExecInfo; + QRY_ERR_JRET(qMakeExplainResChildrenInfo(pNode, pExecInfo, &res->pChildren)); + + *pRes = res; + + return TSDB_CODE_SUCCESS; + +_return: + + qFreeExplainRes(res); + + QRY_RET(code); +} + +int32_t qMakeTaskExplainResTree(struct SSubplan *plan, void *pExecTree, SPhysiNodeExplainResNode **pRes) { + char *tbuf = taosMemoryMalloc(QUERY_EXPLAIN_MAX_RES_LEN); + if (NULL == tbuf) { + qError("malloc size %d failed", QUERY_EXPLAIN_MAX_RES_LEN); + return TSDB_CODE_QRY_OUT_OF_MEMORY; + } + + void *pExecInfo = NULL; // TODO + int32_t code = qMakeExplainResNode(plan->pNode, pExecInfo, pRes); + + taosMemoryFree(tbuf); + + QRY_RET(code); +} + +int32_t qExplainResNodeAppendExecInfo(void *pExecInfo, char *tbuf) { + +} + +int32_t qExplainResAppendRow(SArray *pRows, char *tbuf, int32_t len, int32_t level) { + SQueryExplainRowInfo row = {0}; + row.buf = strdup(tbuf); + if (NULL == row.buf) { + qError("strdup %s failed", tbuf); + QRY_ERR_RET(TSDB_CODE_QRY_OUT_OF_MEMORY); + } + + row.level = level; + row.len = len; + + if (taosArrayPush(pRows, &row)) { + qError("taosArrayPush row to explain res rows failed"); + taosMemoryFree(row.buf); + QRY_ERR_RET(TSDB_CODE_QRY_OUT_OF_MEMORY); + } + + return TSDB_CODE_SUCCESS; +} + + +int32_t qExplainResNodeToRowsImpl(SPhysiNodeExplainResNode *pResNode, SArray *pRows, char *tbuf, int32_t level) { + int32_t tlen = 0; + SPhysiNode* pNode = pResNode->pNode; + if (NULL == pNode) { + qError("pyhsical node in explain res node is NULL"); + return TSDB_CODE_QRY_APP_ERROR; + } + + switch (pNode->type) { + case QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN: { + STagScanPhysiNode *pTagScanNode = (STagScanPhysiNode *)pNode; + QUERY_EXPLAIN_NEWLINE(EXPLAIN_TAG_SCAN_FORMAT, pTagScanNode->tableName.tname); + if (pResNode->pExecInfo) { + QRY_ERR_RET(qExplainResNodeAppendExecInfo(pResNode->pExecInfo, tbuf)); + } + QRY_ERR_RET(qExplainResAppendRow(pRows, tbuf, tlen, level)); + } + case QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN: + case QUERY_NODE_PHYSICAL_PLAN_TABLE_SEQ_SCAN: + case QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN: + case QUERY_NODE_PHYSICAL_PLAN_SYSTABLE_SCAN: + case QUERY_NODE_PHYSICAL_PLAN_PROJECT: + case QUERY_NODE_PHYSICAL_PLAN_JOIN: + case QUERY_NODE_PHYSICAL_PLAN_AGG: + case QUERY_NODE_PHYSICAL_PLAN_EXCHANGE: + case QUERY_NODE_PHYSICAL_PLAN_SORT: + case QUERY_NODE_PHYSICAL_PLAN_INTERVAL: + case QUERY_NODE_PHYSICAL_PLAN_SESSION_WINDOW: + case QUERY_NODE_PHYSICAL_PLAN_DISPATCH: + case QUERY_NODE_PHYSICAL_PLAN_INSERT: + default: + qError("not supported physical node type %d", pNode->type); + return TSDB_CODE_QRY_APP_ERROR; + } + + return TSDB_CODE_SUCCESS; +} + + +int32_t qExplainResNodeToRows(SPhysiNodeExplainResNode *pResNode, SArray *pRsp, char *tbuf, int32_t level) { + if (NULL == pResNode) { + qError("explain res node is NULL"); + QRY_ERR_RET(TSDB_CODE_QRY_APP_ERROR); + } + + int32_t code = 0; + QRY_ERR_RET(qExplainResNodeToRowsImpl(pResNode, pRsp, tbuf, level)); + + SNode* pNode = NULL; + FOREACH(pNode, pResNode->pChildren) { + QRY_ERR_RET(qExplainResNodeToRows((SPhysiNodeExplainResNode *)pNode, pRsp, tbuf, level + 1)); + } + + return TSDB_CODE_SUCCESS; +} + + +int32_t qMakeTaskExplainResRows(SPhysiNodeExplainResNode *pResNode, SRetrieveTableRsp **pRsp) { + if (NULL == pResNode) { + qError("explain res node is NULL"); + QRY_RET(TSDB_CODE_QRY_APP_ERROR); + } + + int32_t code = 0; + char *tbuf = taosMemoryMalloc(QUERY_EXPLAIN_MAX_RES_LEN); + if (NULL == tbuf) { + qError("malloc size %d failed", QUERY_EXPLAIN_MAX_RES_LEN); + QRY_RET(TSDB_CODE_QRY_OUT_OF_MEMORY); + } + + SArray *rows = taosArrayInit(10, sizeof(SQueryExplainRowInfo)); + if (NULL == rows) { + qError("taosArrayInit SQueryExplainRowInfo failed"); + QRY_RET(TSDB_CODE_QRY_OUT_OF_MEMORY); + } + + QRY_ERR_JRET(qExplainResNodeToRows(pResNode, rows, tbuf, 0)); + + int32_t rspSize = sizeof(SRetrieveTableRsp) + ; + SRetrieveTableRsp *rsp = (SRetrieveTableRsp *)taosMemoryCalloc(1, rspSize); + if (NULL == rsp) { + qError("malloc SRetrieveTableRsp failed"); + QRY_ERR_JRET(TSDB_CODE_QRY_OUT_OF_MEMORY); + } + + QRY_ERR_JRET(qExplainRowsToRsp(rows, rsp)); + + *pRsp = rsp; + rsp = NULL; + +_return: + + taosMemoryFree(tbuf); + taosMemoryFree(rsp); + taosArrayDestroy(rows); + + QRY_RET(code); +} + + +#pragma GCC diagnostic pop From d1102c5f96a2d69fd759627d6790c6fbbf62733f Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Tue, 29 Mar 2022 08:55:22 +0800 Subject: [PATCH 04/47] feature/qnode --- source/libs/qcom/inc/queryInt.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/qcom/inc/queryInt.h b/source/libs/qcom/inc/queryInt.h index 86a1e04ae5..2de0c89a13 100644 --- a/source/libs/qcom/inc/queryInt.h +++ b/source/libs/qcom/inc/queryInt.h @@ -32,7 +32,7 @@ typedef struct SQueryExplainRowInfo { } SQueryExplainRowInfo; -#define QUERY_EXPLAIN_NEWLINE(_format, ...) tlen = snprintf(tbuf + tlen, QUERY_EXPLAIN_MAX_RES_LEN - tlen, _format, __VA_ARGS__) +#define QUERY_EXPLAIN_NEWLINE(_format, ...) tlen = snprintf(tbuf, QUERY_EXPLAIN_MAX_RES_LEN, _format, __VA_ARGS__) #define QUERY_EXPLAIN_APPEND(_format, ...) tlen += snprintf(tbuf + tlen, QUERY_EXPLAIN_MAX_RES_LEN - tlen, _format, __VA_ARGS__) From c8e132052a02fc787205a76f67273b469cea7d3d Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Tue, 29 Mar 2022 19:51:11 +0800 Subject: [PATCH 05/47] feature/qnode --- include/libs/qcom/query.h | 4 +- source/libs/nodes/src/nodesToSQLFuncs.c | 134 +++++++++ source/libs/nodes/src/nodesTraverseFuncs.c | 3 +- source/libs/nodes/src/nodesUtilFuncs.c | 63 ++++ source/libs/qcom/inc/queryInt.h | 26 +- source/libs/qcom/src/queryExplain.c | 321 ++++++++++++++++++--- source/libs/scheduler/src/scheduler.c | 15 +- 7 files changed, 519 insertions(+), 47 deletions(-) create mode 100644 source/libs/nodes/src/nodesToSQLFuncs.c diff --git a/include/libs/qcom/query.h b/include/libs/qcom/query.h index c3870665a6..c0fc8c630e 100644 --- a/include/libs/qcom/query.h +++ b/include/libs/qcom/query.h @@ -53,11 +53,11 @@ typedef struct SIndexMeta { } SIndexMeta; -typedef struct SPhysiNodeExplainResNode { +typedef struct SExplainResNode { SNodeList* pChildren; SPhysiNode* pNode; void* pExecInfo; -} SPhysiNodeExplainResNode; +} SExplainResNode; /* * ASSERT(sizeof(SCTableMeta) == 24) diff --git a/source/libs/nodes/src/nodesToSQLFuncs.c b/source/libs/nodes/src/nodesToSQLFuncs.c new file mode 100644 index 0000000000..6e4cd0f04e --- /dev/null +++ b/source/libs/nodes/src/nodesToSQLFuncs.c @@ -0,0 +1,134 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#include "cmdnodes.h" +#include "nodesUtil.h" +#include "plannodes.h" +#include "querynodes.h" +#include "taos.h" +#include "taoserror.h" +#include "thash.h" + +char *gOperatorStr[] = {NULL, "+", "-", "*", "/", "%", "&", "|", ">", ">=", "<", "<=", "=", "<>", + "IN", "NOT IN", "LIKE", "NOT LIKE", "MATCH", "NMATCH", "IS NULL", "IS NOT NULL", + "IS TRUE", "IS FALSE", "IS UNKNOWN", "IS NOT TRUE", "IS NOT FALSE", "IS NOT UNKNOWN"}; +char *gLogicConditionStr[] = {"AND", "OR", "NOT"}; + +int32_t nodesNodeToSQL(SNode *pNode, char *buf, int32_t bufSize, int32_t *len) { + switch (pNode->type) { + case QUERY_NODE_COLUMN: { + SColumnNode *colNode = (SColumnNode *)pNode; + *len = 0; + if (colNode->dbName[0]) { + *len += snprintf(buf, bufSize - *len, "`%s`.", colNode->dbName); + } + + if (colNode->tableAlias[0]) { + *len += snprintf(buf, bufSize - *len, "`%s`.", colNode->tableAlias); + } else if (colNode->tableName[0]) { + *len += snprintf(buf, bufSize - *len, "`%s`.", colNode->tableName); + } + + *len += snprintf(buf, bufSize - *len, "`%s`", colNode->colName); + + return TSDB_CODE_SUCCESS; + } + case QUERY_NODE_VALUE:{ + SValueNode *colNode = (SValueNode *)pNode; + char *t = nodesGetStrValueFromNode(colNode); + if (NULL == t) { + nodesError("fail to get str value from valueNode"); + return TSDB_CODE_QRY_APP_ERROR; + } + + *len += snprintf(buf, bufSize - *len, "%s", t); + taosMemoryFree(t); + + return TSDB_CODE_SUCCESS; + } + case QUERY_NODE_OPERATOR: { + SOperatorNode* pOpNode = (SOperatorNode*)pNode; + *len += snprintf(buf, bufSize - *len, "("); + if (pOpNode->pLeft) { + QRY_ERR_RET(nodesNodeToSQL(pOpNode->pLeft, buf, bufSize, len)); + } + + if (pOpNode->opType >= (sizeof(gOperatorStr) / sizeof(gOperatorStr[0]))) { + nodesError("unknown operation type:%d", pOpNode->opType); + return TSDB_CODE_QRY_APP_ERROR; + } + + *len += snprintf(buf, bufSize - *len, " %s ", gOperatorStr[pOpNode->opType]); + + if (pOpNode->pRight) { + QRY_ERR_RET(nodesNodeToSQL(pOpNode->pRight, buf, bufSize, len)); + } + + *len += snprintf(buf, bufSize - *len, ")"); + + return TSDB_CODE_SUCCESS; + } + case QUERY_NODE_LOGIC_CONDITION:{ + SLogicConditionNode* pLogicNode = (SLogicConditionNode*)pNode; + SNode* node = NULL; + bool first = true; + + *len += snprintf(buf, bufSize - *len, "("); + + FOREACH(node, pLogicNode->pParameterList) { + if (!first) { + *len += snprintf(buf, bufSize - *len, " %s ", gLogicConditionStr[pLogicNode->condType]); + } + QRY_ERR_RET(nodesNodeToSQL(node, buf, bufSize, len)); + first = false; + } + + *len += snprintf(buf, bufSize - *len, ")"); + + return TSDB_CODE_SUCCESS; + } + case QUERY_NODE_FUNCTION:{ + SFunctionNode* pFuncNode = (SFunctionNode*)pNode; + SNode* node = NULL; + bool first = true; + + *len += snprintf(buf, bufSize - *len, "%s(", pFuncNode->functionName); + + FOREACH(node, pFuncNode->pParameterList) { + if (!first) { + *len += snprintf(buf, bufSize - *len, ", "); + } + QRY_ERR_RET(nodesNodeToSQL(node, buf, bufSize, len)); + first = false; + } + + *len += snprintf(buf, bufSize - *len, ")"); + + return TSDB_CODE_SUCCESS; + } + case QUERY_NODE_NODE_LIST:{ + SNodeListNode* pListNode = (SNodeListNode *)pNode; + + //TODO + + return TSDB_CODE_SUCCESS; + } + default: + break; + } + + nodesError("nodesNodeToSQL unknown node = %s", nodesNodeName(pNode->type)); + return TSDB_CODE_QRY_APP_ERROR; +} diff --git a/source/libs/nodes/src/nodesTraverseFuncs.c b/source/libs/nodes/src/nodesTraverseFuncs.c index 7eaa049946..bbd0473edd 100644 --- a/source/libs/nodes/src/nodesTraverseFuncs.c +++ b/source/libs/nodes/src/nodesTraverseFuncs.c @@ -17,7 +17,8 @@ typedef enum ETraversalOrder { TRAVERSAL_PREORDER = 1, - TRAVERSAL_POSTORDER + TRAVERSAL_INORDER, + TRAVERSAL_POSTORDER, } ETraversalOrder; static EDealRes walkList(SNodeList* pNodeList, ETraversalOrder order, FNodeWalker walker, void* pContext); diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index 035a2f1caa..7b2be5e355 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -467,6 +467,69 @@ void* nodesGetValueFromNode(SValueNode *pNode) { return NULL; } +char* nodesGetStrValueFromNode(SValueNode *pNode) { + switch (pNode->node.resType.type) { + case TSDB_DATA_TYPE_BOOL: + void *buf = taosMemoryMalloc(MAX_NUM_STR_SIZE); + if (NULL == buf) { + return NULL; + } + + sprintf(buf, "%s", pNode->datum.b ? "true" : "false"); + return buf; + case TSDB_DATA_TYPE_TINYINT: + case TSDB_DATA_TYPE_SMALLINT: + case TSDB_DATA_TYPE_INT: + case TSDB_DATA_TYPE_BIGINT: + case TSDB_DATA_TYPE_TIMESTAMP: { + void *buf = taosMemoryMalloc(MAX_NUM_STR_SIZE); + if (NULL == buf) { + return NULL; + } + + sprintf(buf, "%" PRId64, pNode->datum.i); + return buf; + } + case TSDB_DATA_TYPE_UTINYINT: + case TSDB_DATA_TYPE_USMALLINT: + case TSDB_DATA_TYPE_UINT: + case TSDB_DATA_TYPE_UBIGINT: { + void *buf = taosMemoryMalloc(MAX_NUM_STR_SIZE); + if (NULL == buf) { + return NULL; + } + + sprintf(buf, "%" PRIu64, pNode->datum.u); + return buf; + } + case TSDB_DATA_TYPE_FLOAT: + case TSDB_DATA_TYPE_DOUBLE: { + void *buf = taosMemoryMalloc(MAX_NUM_STR_SIZE); + if (NULL == buf) { + return NULL; + } + + sprintf(buf, "%e", pNode->datum.d); + return buf; + } + case TSDB_DATA_TYPE_NCHAR: + case TSDB_DATA_TYPE_VARCHAR: + case TSDB_DATA_TYPE_VARBINARY: { + void *buf = taosMemoryMalloc(varDataLen(pNode->datum.p) + 1); + if (NULL == buf) { + return NULL; + } + + strncpy(buf, varDataVal(pNode->datum.p), varDataLen(pNode->datum.p) + 1); + return buf; + } + default: + break; + } + + return NULL; +} + bool nodesIsExprNode(const SNode* pNode) { ENodeType type = nodeType(pNode); return (QUERY_NODE_COLUMN == type || QUERY_NODE_VALUE == type || QUERY_NODE_OPERATOR == type || QUERY_NODE_FUNCTION == type); diff --git a/source/libs/qcom/inc/queryInt.h b/source/libs/qcom/inc/queryInt.h index 2de0c89a13..7b6b7d44ef 100644 --- a/source/libs/qcom/inc/queryInt.h +++ b/source/libs/qcom/inc/queryInt.h @@ -22,8 +22,24 @@ extern "C" { #define QUERY_EXPLAIN_MAX_RES_LEN 1024 -#define EXPLAIN_TAG_SCAN_FORMAT "Tag scan on %s" -#define EXPLAIN_ORDER_FORMAT "Order: " +#define EXPLAIN_TAG_SCAN_FORMAT "Tag scan on %s columns=%d" +#define EXPLAIN_TBL_SCAN_FORMAT "Table scan on %s columns=%d" +#define EXPLAIN_SYSTBL_SCAN_FORMAT "System table scan on %s columns=%d" +#define EXPLAIN_PROJECTION_FORMAT "Projection columns=%d width=%d" +#define EXPLAIN_JOIN_FORMAT "%s between %d tables width=%d" +#define EXPLAIN_AGG_FORMAT "Aggragate functions=%d groups=%d width=%d" +#define EXPLAIN_EXCHANGE_FORMAT "Exchange %d:1 width=%d" +#define EXPLAIN_SORT_FORMAT "Sort on %d columns width=%d" +#define EXPLAIN_INTERVAL_FORMAT "Interval on column %s functions=%d interval=%d%c offset=%d%c sliding=%d%c width=%d" +#define EXPLAIN_SESSION_FORMAT "Session gap=%" PRId64 " functions=%d width=%d" + +#define EXPLAIN_ORDER_FORMAT "Order: %s" +#define EXPLAIN_FILTER_FORMAT "Filter: " +#define EXPLAIN_FILL_FORMAT "Fill: %s" +#define EXPLAIN_ON_CONDITIONS_FORMAT "ON Conditions: " +#define EXPLAIN_TIMERANGE_FORMAT "Time range: [%" PRId64 ", %" PRId64 "]" +#define EXPLAIN_LOOPS_FORMAT "loops %d" +#define EXPLAIN_REVERSE_FORMAT "reverse %d" typedef struct SQueryExplainRowInfo { int32_t level; @@ -31,9 +47,11 @@ typedef struct SQueryExplainRowInfo { char *buf; } SQueryExplainRowInfo; +#define EXPLAIN_ORDER_STRING(_order) ((TSDB_ORDER_ASC == _order) ? "Ascending" : "Descending") +#define EXPLAIN_JOIN_STRING(_type) ((JOIN_TYPE_INNER == _type) ? "Inner join" : "Join") -#define QUERY_EXPLAIN_NEWLINE(_format, ...) tlen = snprintf(tbuf, QUERY_EXPLAIN_MAX_RES_LEN, _format, __VA_ARGS__) -#define QUERY_EXPLAIN_APPEND(_format, ...) tlen += snprintf(tbuf + tlen, QUERY_EXPLAIN_MAX_RES_LEN - tlen, _format, __VA_ARGS__) +#define QUERY_EXPLAIN_NEWLINE(...) tlen = snprintf(tbuf, QUERY_EXPLAIN_MAX_RES_LEN, __VA_ARGS__) +#define QUERY_EXPLAIN_APPEND(...) tlen += snprintf(tbuf + tlen, QUERY_EXPLAIN_MAX_RES_LEN - tlen, __VA_ARGS__) #define QRY_ERR_RET(c) do { int32_t _code = c; if (_code != TSDB_CODE_SUCCESS) { terrno = _code; return _code; } } while (0) diff --git a/source/libs/qcom/src/queryExplain.c b/source/libs/qcom/src/queryExplain.c index d547e67170..d6da9ab0e2 100644 --- a/source/libs/qcom/src/queryExplain.c +++ b/source/libs/qcom/src/queryExplain.c @@ -19,22 +19,124 @@ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wformat-truncation" -void qFreeExplainRes(SPhysiNodeExplainRes *res) { +void qFreeExplainRes(SExplainResNode *res) { } +char *qFillModeString(EFillMode mode) { + switch (mode) { + case FILL_MODE_NONE: + return "none"; + case FILL_MODE_VALUE: + return "value"; + case FILL_MODE_PREV: + return "prev"; + case FILL_MODE_NULL: + return "null"; + case FILL_MODE_LINEAR: + return "linear"; + case FILL_MODE_NEXT: + return "next"; + default: + return "unknown"; + } +} + +char *qGetNameFromColumnNode(SNode *pNode) { + if (NULL == pNode || QUERY_NODE_COLUMN != pNode->type) { + return "NULL"; + } + + return ((SColumnNode *)pNode)->colName; +} + int32_t qMakeExplainResChildrenInfo(SPhysiNode *pNode, void *pExecInfo, SNodeList **pChildren) { + int32_t tlen = 0; + SNodeList *pPhysiChildren = NULL; + + switch (pNode->type) { + case QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN: { + STagScanPhysiNode *pTagScanNode = (STagScanPhysiNode *)pNode; + pPhysiChildren = pTagScanNode->node.pChildren; + break; + } + case QUERY_NODE_PHYSICAL_PLAN_TABLE_SEQ_SCAN: + case QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN:{ + STableScanPhysiNode *pTblScanNode = (STableScanPhysiNode *)pNode; + pPhysiChildren = pTblScanNode->scan.node.pChildren; + break; + } + case QUERY_NODE_PHYSICAL_PLAN_SYSTABLE_SCAN:{ + SSystemTableScanPhysiNode *pSTblScanNode = (SSystemTableScanPhysiNode *)pNode; + pPhysiChildren = pSTblScanNode->scan.node.pChildren; + break; + } + case QUERY_NODE_PHYSICAL_PLAN_PROJECT:{ + SProjectPhysiNode *pPrjNode = (SProjectPhysiNode *)pNode; + pPhysiChildren = pPrjNode->node.pChildren; + break; + } + case QUERY_NODE_PHYSICAL_PLAN_JOIN:{ + SJoinPhysiNode *pJoinNode = (SJoinPhysiNode *)pNode; + pPhysiChildren = pJoinNode->node.pChildren; + break; + } + case QUERY_NODE_PHYSICAL_PLAN_AGG:{ + SAggPhysiNode *pAggNode = (SAggPhysiNode *)pNode; + pPhysiChildren = pAggNode->node.pChildren; + break; + } + case QUERY_NODE_PHYSICAL_PLAN_EXCHANGE:{ + SExchangePhysiNode *pExchNode = (SExchangePhysiNode *)pNode; + pPhysiChildren = pExchNode->node.pChildren; + break; + } + case QUERY_NODE_PHYSICAL_PLAN_SORT:{ + SSortPhysiNode *pSortNode = (SSortPhysiNode *)pNode; + pPhysiChildren = pSortNode->node.pChildren; + break; + } + case QUERY_NODE_PHYSICAL_PLAN_INTERVAL:{ + SIntervalPhysiNode *pIntNode = (SIntervalPhysiNode *)pNode; + pPhysiChildren = pIntNode->window.node.pChildren; + break; + } + case QUERY_NODE_PHYSICAL_PLAN_SESSION_WINDOW:{ + SSessionWinodwPhysiNode *pSessNode = (SSessionWinodwPhysiNode *)pNode; + pPhysiChildren = pSessNode->window.node.pChildren; + break; + } + default: + qError("not supported physical node type %d", pNode->type); + QRY_ERR_RET(TSDB_CODE_QRY_APP_ERROR); + } + if (pPhysiChildren) { + *pChildren = nodesMakeList(); + if (NULL == *pChildren) { + qError("nodesMakeList failed"); + QRY_ERR_RET(TSDB_CODE_QRY_OUT_OF_MEMORY); + } + } + + SNode* node = NULL; + SExplainResNode *pResNode = NULL; + FOREACH(node, pPhysiChildren) { + QRY_ERR_RET(qMakeExplainResNode((SPhysiNode *)node, pExecInfo, &pResNode)); + QRY_ERR_RET(nodesListAppend(*pChildren, pResNode)); + } + + return TSDB_CODE_SUCCESS; } -int32_t qMakeExplainResNode(SPhysiNode *pNode, void *pExecInfo, SPhysiNodeExplainResNode **pRes) { +int32_t qMakeExplainResNode(SPhysiNode *pNode, void *pExecInfo, SExplainResNode **pRes) { if (NULL == pNode) { *pRes = NULL; qError("physical node is NULL"); return TSDB_CODE_QRY_APP_ERROR; } - SPhysiNodeExplainResNode *res = calloc(1, sizeof(SPhysiNodeExplainResNode)); + SExplainResNode *res = taosMemoryCalloc(1, sizeof(SExplainResNode)); if (NULL == res) { qError("calloc SPhysiNodeExplainRes failed"); return TSDB_CODE_QRY_OUT_OF_MEMORY; @@ -56,7 +158,7 @@ _return: QRY_RET(code); } -int32_t qMakeTaskExplainResTree(struct SSubplan *plan, void *pExecTree, SPhysiNodeExplainResNode **pRes) { +int32_t qMakeTaskExplainResTree(struct SSubplan *plan, void *pExecTree, SExplainResNode **pRes) { char *tbuf = taosMemoryMalloc(QUERY_EXPLAIN_MAX_RES_LEN); if (NULL == tbuf) { qError("malloc size %d failed", QUERY_EXPLAIN_MAX_RES_LEN); @@ -71,7 +173,7 @@ int32_t qMakeTaskExplainResTree(struct SSubplan *plan, void *pExecTree, SPhysiNo QRY_RET(code); } -int32_t qExplainResNodeAppendExecInfo(void *pExecInfo, char *tbuf) { +int32_t qExplainBufAppendExecInfo(void *pExecInfo, char *tbuf, int32_t tlen) { } @@ -96,7 +198,7 @@ int32_t qExplainResAppendRow(SArray *pRows, char *tbuf, int32_t len, int32_t lev } -int32_t qExplainResNodeToRowsImpl(SPhysiNodeExplainResNode *pResNode, SArray *pRows, char *tbuf, int32_t level) { +int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SArray *pRows, char *tbuf, int32_t level) { int32_t tlen = 0; SPhysiNode* pNode = pResNode->pNode; if (NULL == pNode) { @@ -107,25 +209,177 @@ int32_t qExplainResNodeToRowsImpl(SPhysiNodeExplainResNode *pResNode, SArray *pR switch (pNode->type) { case QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN: { STagScanPhysiNode *pTagScanNode = (STagScanPhysiNode *)pNode; - QUERY_EXPLAIN_NEWLINE(EXPLAIN_TAG_SCAN_FORMAT, pTagScanNode->tableName.tname); + QUERY_EXPLAIN_NEWLINE(EXPLAIN_TAG_SCAN_FORMAT, pTagScanNode->tableName.tname, pTagScanNode->pScanCols->length); if (pResNode->pExecInfo) { - QRY_ERR_RET(qExplainResNodeAppendExecInfo(pResNode->pExecInfo, tbuf)); + QRY_ERR_RET(qExplainBufAppendExecInfo(pResNode->pExecInfo, tbuf)); + } + QUERY_EXPLAIN_APPEND(EXPLAIN_LOOPS_FORMAT, pTagScanNode->count); + if (pTagScanNode->reverse) { + QUERY_EXPLAIN_APPEND(EXPLAIN_REVERSE_FORMAT, pTagScanNode->reverse); } QRY_ERR_RET(qExplainResAppendRow(pRows, tbuf, tlen, level)); + + QUERY_EXPLAIN_NEWLINE(EXPLAIN_ORDER_FORMAT, EXPLAIN_ORDER_STRING(pTagScanNode->order)); + QRY_ERR_RET(qExplainResAppendRow(pRows, tbuf, tlen, level + 1)); + break; } - case QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN: case QUERY_NODE_PHYSICAL_PLAN_TABLE_SEQ_SCAN: - case QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN: - case QUERY_NODE_PHYSICAL_PLAN_SYSTABLE_SCAN: - case QUERY_NODE_PHYSICAL_PLAN_PROJECT: - case QUERY_NODE_PHYSICAL_PLAN_JOIN: - case QUERY_NODE_PHYSICAL_PLAN_AGG: - case QUERY_NODE_PHYSICAL_PLAN_EXCHANGE: - case QUERY_NODE_PHYSICAL_PLAN_SORT: - case QUERY_NODE_PHYSICAL_PLAN_INTERVAL: - case QUERY_NODE_PHYSICAL_PLAN_SESSION_WINDOW: - case QUERY_NODE_PHYSICAL_PLAN_DISPATCH: - case QUERY_NODE_PHYSICAL_PLAN_INSERT: + case QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN:{ + STableScanPhysiNode *pTblScanNode = (STableScanPhysiNode *)pNode; + QUERY_EXPLAIN_NEWLINE(EXPLAIN_TBL_SCAN_FORMAT, pTblScanNode->scan.tableName.tname, pTblScanNode->scan.pScanCols->length); + if (pResNode->pExecInfo) { + QRY_ERR_RET(qExplainBufAppendExecInfo(pResNode->pExecInfo, tbuf, tlen)); + } + QUERY_EXPLAIN_APPEND(EXPLAIN_LOOPS_FORMAT, pTblScanNode->scan.count); + if (pTblScanNode->scan.reverse) { + QUERY_EXPLAIN_APPEND(EXPLAIN_REVERSE_FORMAT, pTblScanNode->scan.reverse); + } + QRY_ERR_RET(qExplainResAppendRow(pRows, tbuf, tlen, level)); + + QUERY_EXPLAIN_NEWLINE(EXPLAIN_ORDER_FORMAT, EXPLAIN_ORDER_STRING(pTblScanNode->scan.order)); + QRY_ERR_RET(qExplainResAppendRow(pRows, tbuf, tlen, level + 1)); + + QUERY_EXPLAIN_NEWLINE(EXPLAIN_TIMERANGE_FORMAT, pTblScanNode->scanRange.skey, pTblScanNode->scanRange.ekey); + QRY_ERR_RET(qExplainResAppendRow(pRows, tbuf, tlen, level + 1)); + + if (pTblScanNode->pScanConditions) { + QUERY_EXPLAIN_NEWLINE(EXPLAIN_FILTER_FORMAT); + QRY_ERR_RET(nodesNodeToSQL(pTblScanNode->pScanConditions, tbuf, QUERY_EXPLAIN_MAX_RES_LEN, &tlen)); + QRY_ERR_RET(qExplainResAppendRow(pRows, tbuf, tlen, level + 1)); + } + break; + } + case QUERY_NODE_PHYSICAL_PLAN_SYSTABLE_SCAN:{ + SSystemTableScanPhysiNode *pSTblScanNode = (SSystemTableScanPhysiNode *)pNode; + QUERY_EXPLAIN_NEWLINE(EXPLAIN_SYSTBL_SCAN_FORMAT, pSTblScanNode->scan.tableName.tname, pSTblScanNode->scan.pScanCols->length); + if (pResNode->pExecInfo) { + QRY_ERR_RET(qExplainBufAppendExecInfo(pResNode->pExecInfo, tbuf, tlen)); + } + QUERY_EXPLAIN_APPEND(EXPLAIN_LOOPS_FORMAT, pSTblScanNode->scan.count); + if (pSTblScanNode->scan.reverse) { + QUERY_EXPLAIN_APPEND(EXPLAIN_REVERSE_FORMAT, pSTblScanNode->scan.reverse); + } + QRY_ERR_RET(qExplainResAppendRow(pRows, tbuf, tlen, level)); + + QUERY_EXPLAIN_NEWLINE(EXPLAIN_ORDER_FORMAT, EXPLAIN_ORDER_STRING(pSTblScanNode->scan.order)); + QRY_ERR_RET(qExplainResAppendRow(pRows, tbuf, tlen, level + 1)); + break; + } + case QUERY_NODE_PHYSICAL_PLAN_PROJECT:{ + SProjectPhysiNode *pPrjNode = (SProjectPhysiNode *)pNode; + QUERY_EXPLAIN_NEWLINE(EXPLAIN_PROJECTION_FORMAT, pPrjNode->pProjections->length, pPrjNode->node.pOutputDataBlockDesc->resultRowSize); + if (pResNode->pExecInfo) { + QRY_ERR_RET(qExplainBufAppendExecInfo(pResNode->pExecInfo, tbuf, tlen)); + } + QRY_ERR_RET(qExplainResAppendRow(pRows, tbuf, tlen, level)); + + if (pPrjNode->node.pConditions) { + QUERY_EXPLAIN_NEWLINE(EXPLAIN_FILTER_FORMAT); + QRY_ERR_RET(nodesNodeToSQL(pPrjNode->node.pConditions, tbuf, QUERY_EXPLAIN_MAX_RES_LEN, &tlen)); + QRY_ERR_RET(qExplainResAppendRow(pRows, tbuf, tlen, level + 1)); + } + break; + } + case QUERY_NODE_PHYSICAL_PLAN_JOIN:{ + SJoinPhysiNode *pJoinNode = (SJoinPhysiNode *)pNode; + QUERY_EXPLAIN_NEWLINE(EXPLAIN_JOIN_FORMAT, EXPLAIN_JOIN_STRING(pJoinNode->joinType), pJoinNode->pTargets->length, pJoinNode->node.pOutputDataBlockDesc->resultRowSize); + if (pResNode->pExecInfo) { + QRY_ERR_RET(qExplainBufAppendExecInfo(pResNode->pExecInfo, tbuf, tlen)); + } + QRY_ERR_RET(qExplainResAppendRow(pRows, tbuf, tlen, level)); + + if (pJoinNode->node.pConditions) { + QUERY_EXPLAIN_NEWLINE(EXPLAIN_FILTER_FORMAT); + QRY_ERR_RET(nodesNodeToSQL(pJoinNode->node.pConditions, tbuf, QUERY_EXPLAIN_MAX_RES_LEN, &tlen)); + QRY_ERR_RET(qExplainResAppendRow(pRows, tbuf, tlen, level + 1)); + } + + QUERY_EXPLAIN_NEWLINE(EXPLAIN_ON_CONDITIONS_FORMAT); + QRY_ERR_RET(nodesNodeToSQL(pJoinNode->pOnConditions, tbuf, QUERY_EXPLAIN_MAX_RES_LEN, &tlen)); + QRY_ERR_RET(qExplainResAppendRow(pRows, tbuf, tlen, level + 1)); + break; + } + case QUERY_NODE_PHYSICAL_PLAN_AGG:{ + SAggPhysiNode *pAggNode = (SAggPhysiNode *)pNode; + QUERY_EXPLAIN_NEWLINE(EXPLAIN_AGG_FORMAT, pAggNode->pAggFuncs->length, pAggNode->pGroupKeys->length, pAggNode->node.pOutputDataBlockDesc->resultRowSize); + if (pResNode->pExecInfo) { + QRY_ERR_RET(qExplainBufAppendExecInfo(pResNode->pExecInfo, tbuf, tlen)); + } + QRY_ERR_RET(qExplainResAppendRow(pRows, tbuf, tlen, level)); + + if (pAggNode->node.pConditions) { + QUERY_EXPLAIN_NEWLINE(EXPLAIN_FILTER_FORMAT); + QRY_ERR_RET(nodesNodeToSQL(pAggNode->node.pConditions, tbuf, QUERY_EXPLAIN_MAX_RES_LEN, &tlen)); + QRY_ERR_RET(qExplainResAppendRow(pRows, tbuf, tlen, level + 1)); + } + break; + } + case QUERY_NODE_PHYSICAL_PLAN_EXCHANGE:{ + SExchangePhysiNode *pExchNode = (SExchangePhysiNode *)pNode; + QUERY_EXPLAIN_NEWLINE(EXPLAIN_EXCHANGE_FORMAT, pExchNode->pSrcEndPoints->length, pExchNode->node.pOutputDataBlockDesc->resultRowSize); + if (pResNode->pExecInfo) { + QRY_ERR_RET(qExplainBufAppendExecInfo(pResNode->pExecInfo, tbuf, tlen)); + } + QRY_ERR_RET(qExplainResAppendRow(pRows, tbuf, tlen, level)); + + if (pExchNode->node.pConditions) { + QUERY_EXPLAIN_NEWLINE(EXPLAIN_FILTER_FORMAT); + QRY_ERR_RET(nodesNodeToSQL(pExchNode->node.pConditions, tbuf, QUERY_EXPLAIN_MAX_RES_LEN, &tlen)); + QRY_ERR_RET(qExplainResAppendRow(pRows, tbuf, tlen, level + 1)); + } + break; + } + case QUERY_NODE_PHYSICAL_PLAN_SORT:{ + SSortPhysiNode *pSortNode = (SSortPhysiNode *)pNode; + QUERY_EXPLAIN_NEWLINE(EXPLAIN_SORT_FORMAT, pSortNode->pSortKeys->length, pSortNode->node.pOutputDataBlockDesc->resultRowSize); + if (pResNode->pExecInfo) { + QRY_ERR_RET(qExplainBufAppendExecInfo(pResNode->pExecInfo, tbuf, tlen)); + } + QRY_ERR_RET(qExplainResAppendRow(pRows, tbuf, tlen, level)); + + if (pSortNode->node.pConditions) { + QUERY_EXPLAIN_NEWLINE(EXPLAIN_FILTER_FORMAT); + QRY_ERR_RET(nodesNodeToSQL(pSortNode->node.pConditions, tbuf, QUERY_EXPLAIN_MAX_RES_LEN, &tlen)); + QRY_ERR_RET(qExplainResAppendRow(pRows, tbuf, tlen, level + 1)); + } + break; + } + case QUERY_NODE_PHYSICAL_PLAN_INTERVAL:{ + SIntervalPhysiNode *pIntNode = (SIntervalPhysiNode *)pNode; + QUERY_EXPLAIN_NEWLINE(EXPLAIN_INTERVAL_FORMAT, qGetNameFromColumnNode(pIntNode->pTspk), pIntNode->window.pFuncs->length, + pIntNode->interval, pIntNode->intervalUnit, pIntNode->offset, pIntNode->intervalUnit, pIntNode->sliding, pIntNode->slidingUnit, pIntNode->window.node.pOutputDataBlockDesc->resultRowSize); + if (pResNode->pExecInfo) { + QRY_ERR_RET(qExplainBufAppendExecInfo(pResNode->pExecInfo, tbuf, tlen)); + } + QRY_ERR_RET(qExplainResAppendRow(pRows, tbuf, tlen, level)); + + if (pIntNode->pFill) { + QUERY_EXPLAIN_NEWLINE(EXPLAIN_FILL_FORMAT, qFillModeString(pIntNode->pFill->mode)); + QRY_ERR_RET(qExplainResAppendRow(pRows, tbuf, tlen, level + 1)); + } + + if (pIntNode->window.node.pConditions) { + QUERY_EXPLAIN_NEWLINE(EXPLAIN_FILTER_FORMAT); + QRY_ERR_RET(nodesNodeToSQL(pIntNode->window.node.pConditions, tbuf, QUERY_EXPLAIN_MAX_RES_LEN, &tlen)); + QRY_ERR_RET(qExplainResAppendRow(pRows, tbuf, tlen, level + 1)); + } + break; + } + case QUERY_NODE_PHYSICAL_PLAN_SESSION_WINDOW:{ + SSessionWinodwPhysiNode *pIntNode = (SSessionWinodwPhysiNode *)pNode; + QUERY_EXPLAIN_NEWLINE(EXPLAIN_SESSION_FORMAT, pIntNode->gap, pIntNode->window.pFuncs->length, pIntNode->window.node.pOutputDataBlockDesc->resultRowSize); + if (pResNode->pExecInfo) { + QRY_ERR_RET(qExplainBufAppendExecInfo(pResNode->pExecInfo, tbuf, tlen)); + } + QRY_ERR_RET(qExplainResAppendRow(pRows, tbuf, tlen, level)); + + if (pIntNode->window.node.pConditions) { + QUERY_EXPLAIN_NEWLINE(EXPLAIN_FILTER_FORMAT); + QRY_ERR_RET(nodesNodeToSQL(pIntNode->window.node.pConditions, tbuf, QUERY_EXPLAIN_MAX_RES_LEN, &tlen)); + QRY_ERR_RET(qExplainResAppendRow(pRows, tbuf, tlen, level + 1)); + } + break; + } default: qError("not supported physical node type %d", pNode->type); return TSDB_CODE_QRY_APP_ERROR; @@ -135,7 +389,7 @@ int32_t qExplainResNodeToRowsImpl(SPhysiNodeExplainResNode *pResNode, SArray *pR } -int32_t qExplainResNodeToRows(SPhysiNodeExplainResNode *pResNode, SArray *pRsp, char *tbuf, int32_t level) { +int32_t qExplainResNodeToRows(SExplainResNode *pResNode, SArray *pRsp, char *tbuf, int32_t level) { if (NULL == pResNode) { qError("explain res node is NULL"); QRY_ERR_RET(TSDB_CODE_QRY_APP_ERROR); @@ -146,14 +400,22 @@ int32_t qExplainResNodeToRows(SPhysiNodeExplainResNode *pResNode, SArray *pRsp, SNode* pNode = NULL; FOREACH(pNode, pResNode->pChildren) { - QRY_ERR_RET(qExplainResNodeToRows((SPhysiNodeExplainResNode *)pNode, pRsp, tbuf, level + 1)); + QRY_ERR_RET(qExplainResNodeToRows((SExplainResNode *)pNode, pRsp, tbuf, level + 1)); } return TSDB_CODE_SUCCESS; } +int32_t qExplainRowsToRsp(SArray *rows, SRetrieveTableRsp **pRsp) { + int32_t rspSize = sizeof(SRetrieveTableRsp) + ; + SRetrieveTableRsp *rsp = (SRetrieveTableRsp *)taosMemoryCalloc(1, rspSize); + if (NULL == rsp) { + qError("malloc SRetrieveTableRsp failed"); + QRY_ERR_JRET(TSDB_CODE_QRY_OUT_OF_MEMORY); + } +} -int32_t qMakeTaskExplainResRows(SPhysiNodeExplainResNode *pResNode, SRetrieveTableRsp **pRsp) { +int32_t qMakeTaskExplainResRows(SExplainResNode *pResNode, SRetrieveTableRsp **pRsp) { if (NULL == pResNode) { qError("explain res node is NULL"); QRY_RET(TSDB_CODE_QRY_APP_ERROR); @@ -174,22 +436,11 @@ int32_t qMakeTaskExplainResRows(SPhysiNodeExplainResNode *pResNode, SRetrieveTab QRY_ERR_JRET(qExplainResNodeToRows(pResNode, rows, tbuf, 0)); - int32_t rspSize = sizeof(SRetrieveTableRsp) + ; - SRetrieveTableRsp *rsp = (SRetrieveTableRsp *)taosMemoryCalloc(1, rspSize); - if (NULL == rsp) { - qError("malloc SRetrieveTableRsp failed"); - QRY_ERR_JRET(TSDB_CODE_QRY_OUT_OF_MEMORY); - } - - QRY_ERR_JRET(qExplainRowsToRsp(rows, rsp)); - - *pRsp = rsp; - rsp = NULL; + QRY_ERR_JRET(qExplainRowsToRsp(rows, pRsp)); _return: taosMemoryFree(tbuf); - taosMemoryFree(rsp); taosArrayDestroy(rows); QRY_RET(code); diff --git a/source/libs/scheduler/src/scheduler.c b/source/libs/scheduler/src/scheduler.c index 5af13d97ca..fdb0b6498c 100644 --- a/source/libs/scheduler/src/scheduler.c +++ b/source/libs/scheduler/src/scheduler.c @@ -2126,19 +2126,24 @@ static int32_t schExecJobImpl(void *transport, SArray *pNodeList, SQueryPlan *pD tsem_init(&pJob->rspSem, 0, 0); - pJob->refId = taosAddRef(schMgmt.jobRef, pJob); - if (pJob->refId < 0) { - SCH_JOB_ELOG("taosHashPut job failed, error:%s", tstrerror(terrno)); + int64_t refId = taosAddRef(schMgmt.jobRef, pJob); + if (refId < 0) { + SCH_JOB_ELOG("taosAddRef job failed, error:%s", tstrerror(terrno)); SCH_ERR_JRET(terrno); } + if (NULL == schAcquireJob(refId)) { + SCH_JOB_ELOG("schAcquireJob job failed, refId:%" PRIx64, refId); + SCH_RET(TSDB_CODE_SCH_STATUS_ERROR); + } + + pJob->refId = refId; + SCH_JOB_DLOG("job refId:%" PRIx64, pJob->refId); pJob->status = JOB_TASK_STATUS_NOT_START; SCH_ERR_JRET(schLaunchJob(pJob)); - schAcquireJob(pJob->refId); - *job = pJob->refId; if (syncSchedule) { From 6982f2b7bda6660bdfc1d04b8ebd688b211a741f Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Wed, 30 Mar 2022 17:09:30 +0800 Subject: [PATCH 06/47] feature/qnode --- include/libs/nodes/nodes.h | 2 + include/libs/nodes/plannodes.h | 12 + include/libs/nodes/querynodes.h | 1 + include/libs/qcom/query.h | 9 +- include/util/tdef.h | 4 + source/libs/nodes/inc/nodesUtil.h | 16 +- source/libs/nodes/src/nodesToSQLFuncs.c | 30 +- source/libs/nodes/src/nodesUtilFuncs.c | 3 +- source/libs/qcom/CMakeLists.txt | 2 +- source/libs/qcom/inc/queryInt.h | 33 ++- source/libs/qcom/src/queryExplain.c | 335 +++++++++++++++-------- source/libs/scalar/inc/filterInt.h | 2 - source/libs/scheduler/inc/schedulerInt.h | 7 +- source/libs/scheduler/src/scheduler.c | 136 ++++++++- 14 files changed, 447 insertions(+), 145 deletions(-) diff --git a/include/libs/nodes/nodes.h b/include/libs/nodes/nodes.h index 9b8739a4f3..031445ac79 100644 --- a/include/libs/nodes/nodes.h +++ b/include/libs/nodes/nodes.h @@ -210,6 +210,8 @@ int32_t nodesStringToNode(const char* pStr, SNode** pNode); int32_t nodesListToString(const SNodeList* pList, bool format, char** pStr, int32_t* pLen); int32_t nodesStringToList(const char* pStr, SNodeList** pList); +int32_t nodesNodeToSQL(SNode *pNode, char *buf, int32_t bufSize, int32_t *len); + #ifdef __cplusplus } #endif diff --git a/include/libs/nodes/plannodes.h b/include/libs/nodes/plannodes.h index 08792b6f8f..fb4def4440 100644 --- a/include/libs/nodes/plannodes.h +++ b/include/libs/nodes/plannodes.h @@ -283,11 +283,23 @@ typedef struct SSubplan { SDataSinkNode* pDataSink; // data of the subplan flow into the datasink } SSubplan; +typedef enum EExplainMode { + EXPLAIN_MODE_DISABLE = 1, + EXPLAIN_MODE_STATIC, + EXPLAIN_MODE_ANALYZE +} EExplainMode; + +typedef struct SExplainInfo { + EExplainMode mode; + bool verbose; +} SExplainInfo; + typedef struct SQueryPlan { ENodeType type; uint64_t queryId; int32_t numOfSubplans; SNodeList* pSubplans; // Element is SNodeListNode. The execution level of subplan, starting from 0. + SExplainInfo explainInfo; } SQueryPlan; #ifdef __cplusplus diff --git a/include/libs/nodes/querynodes.h b/include/libs/nodes/querynodes.h index 66f60bde98..2f4f938652 100644 --- a/include/libs/nodes/querynodes.h +++ b/include/libs/nodes/querynodes.h @@ -300,6 +300,7 @@ bool nodesIsTimeorderQuery(const SNode* pQuery); bool nodesIsTimelineQuery(const SNode* pQuery); void* nodesGetValueFromNode(SValueNode *pNode); +char* nodesGetStrValueFromNode(SValueNode *pNode); #ifdef __cplusplus } diff --git a/include/libs/qcom/query.h b/include/libs/qcom/query.h index c0fc8c630e..2a9dd28819 100644 --- a/include/libs/qcom/query.h +++ b/include/libs/qcom/query.h @@ -53,11 +53,6 @@ typedef struct SIndexMeta { } SIndexMeta; -typedef struct SExplainResNode { - SNodeList* pChildren; - SPhysiNode* pNode; - void* pExecInfo; -} SExplainResNode; /* * ASSERT(sizeof(SCTableMeta) == 24) @@ -179,6 +174,10 @@ bool tIsValidSchema(struct SSchema* pSchema, int32_t numOfCols, int32_ int32_t queryCreateTableMetaFromMsg(STableMetaRsp* msg, bool isSuperTable, STableMeta** pMeta); char *jobTaskStatusStr(int32_t status); +int32_t qAppendTaskExplainResRows(void **pRowCtx, struct SSubplan *plan, void *pExecTree, int32_t level); +int32_t qGetExplainRspFromRowCtx(void *ctx, SRetrieveTableRsp **pRsp); +void qFreeExplainRowCtx(void *ctx); + SSchema createSchema(int8_t type, int32_t bytes, col_id_t colId, const char* name); extern int32_t (*queryBuildMsg[TDMT_MAX])(void* input, char** msg, int32_t msgSize, int32_t* msgLen); diff --git a/include/util/tdef.h b/include/util/tdef.h index 193be4a3e6..7db06bbafb 100644 --- a/include/util/tdef.h +++ b/include/util/tdef.h @@ -224,6 +224,7 @@ typedef enum ELogicConditionType { #define TSDB_APP_NAME_LEN TSDB_UNI_LEN #define TSDB_STB_COMMENT_LEN 1024 + /** * In some scenarios uint16_t (0~65535) is used to store the row len. * - Firstly, we use 65531(65535 - 4), as the SDataRow/SKVRow contains 4 bits header. @@ -471,6 +472,9 @@ enum { #define QND_VGID 1 #define VND_VGID 0 +#define MAX_NUM_STR_SIZE 40 + + #ifdef __cplusplus } #endif diff --git a/source/libs/nodes/inc/nodesUtil.h b/source/libs/nodes/inc/nodesUtil.h index de00b6bca4..976044c16f 100644 --- a/source/libs/nodes/inc/nodesUtil.h +++ b/source/libs/nodes/inc/nodesUtil.h @@ -20,12 +20,16 @@ extern "C" { #endif -#define nodesFatal(param, ...) qFatal("NODES: " param, __VA_ARGS__) -#define nodesError(param, ...) qError("NODES: " param, __VA_ARGS__) -#define nodesWarn(param, ...) qWarn("NODES: " param, __VA_ARGS__) -#define nodesInfo(param, ...) qInfo("NODES: " param, __VA_ARGS__) -#define nodesDebug(param, ...) qDebug("NODES: " param, __VA_ARGS__) -#define nodesTrace(param, ...) qTrace("NODES: " param, __VA_ARGS__) +#define nodesFatal(...) qFatal("NODES: " __VA_ARGS__) +#define nodesError(...) qError("NODES: " __VA_ARGS__) +#define nodesWarn(...) qWarn("NODES: " __VA_ARGS__) +#define nodesInfo(...) qInfo("NODES: " __VA_ARGS__) +#define nodesDebug(...) qDebug("NODES: " __VA_ARGS__) +#define nodesTrace(...) qTrace("NODES: " __VA_ARGS__) + +#define NODES_ERR_RET(c) do { int32_t _code = c; if (_code != TSDB_CODE_SUCCESS) { terrno = _code; return _code; } } while (0) +#define NODES_RET(c) do { int32_t _code = c; if (_code != TSDB_CODE_SUCCESS) { terrno = _code; } return _code; } while (0) +#define NODES_ERR_JRET(c) do { code = c; if (code != TSDB_CODE_SUCCESS) { terrno = code; goto _return; } } while (0) #ifdef __cplusplus } diff --git a/source/libs/nodes/src/nodesToSQLFuncs.c b/source/libs/nodes/src/nodesToSQLFuncs.c index 6e4cd0f04e..fa941cfe9c 100644 --- a/source/libs/nodes/src/nodesToSQLFuncs.c +++ b/source/libs/nodes/src/nodesToSQLFuncs.c @@ -50,7 +50,7 @@ int32_t nodesNodeToSQL(SNode *pNode, char *buf, int32_t bufSize, int32_t *len) { char *t = nodesGetStrValueFromNode(colNode); if (NULL == t) { nodesError("fail to get str value from valueNode"); - return TSDB_CODE_QRY_APP_ERROR; + NODES_ERR_RET(TSDB_CODE_QRY_APP_ERROR); } *len += snprintf(buf, bufSize - *len, "%s", t); @@ -62,18 +62,18 @@ int32_t nodesNodeToSQL(SNode *pNode, char *buf, int32_t bufSize, int32_t *len) { SOperatorNode* pOpNode = (SOperatorNode*)pNode; *len += snprintf(buf, bufSize - *len, "("); if (pOpNode->pLeft) { - QRY_ERR_RET(nodesNodeToSQL(pOpNode->pLeft, buf, bufSize, len)); + NODES_ERR_RET(nodesNodeToSQL(pOpNode->pLeft, buf, bufSize, len)); } if (pOpNode->opType >= (sizeof(gOperatorStr) / sizeof(gOperatorStr[0]))) { nodesError("unknown operation type:%d", pOpNode->opType); - return TSDB_CODE_QRY_APP_ERROR; + NODES_ERR_RET(TSDB_CODE_QRY_APP_ERROR); } *len += snprintf(buf, bufSize - *len, " %s ", gOperatorStr[pOpNode->opType]); if (pOpNode->pRight) { - QRY_ERR_RET(nodesNodeToSQL(pOpNode->pRight, buf, bufSize, len)); + NODES_ERR_RET(nodesNodeToSQL(pOpNode->pRight, buf, bufSize, len)); } *len += snprintf(buf, bufSize - *len, ")"); @@ -91,7 +91,7 @@ int32_t nodesNodeToSQL(SNode *pNode, char *buf, int32_t bufSize, int32_t *len) { if (!first) { *len += snprintf(buf, bufSize - *len, " %s ", gLogicConditionStr[pLogicNode->condType]); } - QRY_ERR_RET(nodesNodeToSQL(node, buf, bufSize, len)); + NODES_ERR_RET(nodesNodeToSQL(node, buf, bufSize, len)); first = false; } @@ -110,7 +110,7 @@ int32_t nodesNodeToSQL(SNode *pNode, char *buf, int32_t bufSize, int32_t *len) { if (!first) { *len += snprintf(buf, bufSize - *len, ", "); } - QRY_ERR_RET(nodesNodeToSQL(node, buf, bufSize, len)); + NODES_ERR_RET(nodesNodeToSQL(node, buf, bufSize, len)); first = false; } @@ -120,8 +120,20 @@ int32_t nodesNodeToSQL(SNode *pNode, char *buf, int32_t bufSize, int32_t *len) { } case QUERY_NODE_NODE_LIST:{ SNodeListNode* pListNode = (SNodeListNode *)pNode; - - //TODO + SNode* node = NULL; + bool first = true; + + *len += snprintf(buf, bufSize - *len, "("); + + FOREACH(node, pListNode->pNodeList) { + if (!first) { + *len += snprintf(buf, bufSize - *len, ", "); + } + NODES_ERR_RET(nodesNodeToSQL(node, buf, bufSize, len)); + first = false; + } + + *len += snprintf(buf, bufSize - *len, ")"); return TSDB_CODE_SUCCESS; } @@ -130,5 +142,5 @@ int32_t nodesNodeToSQL(SNode *pNode, char *buf, int32_t bufSize, int32_t *len) { } nodesError("nodesNodeToSQL unknown node = %s", nodesNodeName(pNode->type)); - return TSDB_CODE_QRY_APP_ERROR; + NODES_RET(TSDB_CODE_QRY_APP_ERROR); } diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index 7b2be5e355..2725ad85dd 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -469,7 +469,7 @@ void* nodesGetValueFromNode(SValueNode *pNode) { char* nodesGetStrValueFromNode(SValueNode *pNode) { switch (pNode->node.resType.type) { - case TSDB_DATA_TYPE_BOOL: + case TSDB_DATA_TYPE_BOOL: { void *buf = taosMemoryMalloc(MAX_NUM_STR_SIZE); if (NULL == buf) { return NULL; @@ -477,6 +477,7 @@ char* nodesGetStrValueFromNode(SValueNode *pNode) { sprintf(buf, "%s", pNode->datum.b ? "true" : "false"); return buf; + } case TSDB_DATA_TYPE_TINYINT: case TSDB_DATA_TYPE_SMALLINT: case TSDB_DATA_TYPE_INT: diff --git a/source/libs/qcom/CMakeLists.txt b/source/libs/qcom/CMakeLists.txt index a9bf0f5594..d50047e592 100644 --- a/source/libs/qcom/CMakeLists.txt +++ b/source/libs/qcom/CMakeLists.txt @@ -8,7 +8,7 @@ target_include_directories( target_link_libraries( qcom - PRIVATE os util transport + PRIVATE os util transport nodes ) if(${BUILD_TEST}) diff --git a/source/libs/qcom/inc/queryInt.h b/source/libs/qcom/inc/queryInt.h index 7b6b7d44ef..6fc15aacfc 100644 --- a/source/libs/qcom/inc/queryInt.h +++ b/source/libs/qcom/inc/queryInt.h @@ -19,9 +19,12 @@ #ifdef __cplusplus extern "C" { #endif +#include "nodes.h" +#include "plannodes.h" #define QUERY_EXPLAIN_MAX_RES_LEN 1024 +//newline area #define EXPLAIN_TAG_SCAN_FORMAT "Tag scan on %s columns=%d" #define EXPLAIN_TBL_SCAN_FORMAT "Table scan on %s columns=%d" #define EXPLAIN_SYSTBL_SCAN_FORMAT "System table scan on %s columns=%d" @@ -30,29 +33,47 @@ extern "C" { #define EXPLAIN_AGG_FORMAT "Aggragate functions=%d groups=%d width=%d" #define EXPLAIN_EXCHANGE_FORMAT "Exchange %d:1 width=%d" #define EXPLAIN_SORT_FORMAT "Sort on %d columns width=%d" -#define EXPLAIN_INTERVAL_FORMAT "Interval on column %s functions=%d interval=%d%c offset=%d%c sliding=%d%c width=%d" +#define EXPLAIN_INTERVAL_FORMAT "Interval on column %s functions=%d interval=%" PRId64 "%c offset=%" PRId64 "%c sliding=%" PRId64 "%c width=%d" #define EXPLAIN_SESSION_FORMAT "Session gap=%" PRId64 " functions=%d width=%d" - #define EXPLAIN_ORDER_FORMAT "Order: %s" #define EXPLAIN_FILTER_FORMAT "Filter: " #define EXPLAIN_FILL_FORMAT "Fill: %s" -#define EXPLAIN_ON_CONDITIONS_FORMAT "ON Conditions: " +#define EXPLAIN_ON_CONDITIONS_FORMAT "Join Cond: " #define EXPLAIN_TIMERANGE_FORMAT "Time range: [%" PRId64 ", %" PRId64 "]" + +//append area #define EXPLAIN_LOOPS_FORMAT "loops %d" #define EXPLAIN_REVERSE_FORMAT "reverse %d" + +typedef struct SExplainResNode { + SNodeList* pChildren; + SPhysiNode* pNode; + void* pExecInfo; +} SExplainResNode; + typedef struct SQueryExplainRowInfo { int32_t level; int32_t len; char *buf; } SQueryExplainRowInfo; +typedef struct SExplainRowCtx { + int32_t totalSize; + SArray *rows; +} SExplainRowCtx; + #define EXPLAIN_ORDER_STRING(_order) ((TSDB_ORDER_ASC == _order) ? "Ascending" : "Descending") #define EXPLAIN_JOIN_STRING(_type) ((JOIN_TYPE_INNER == _type) ? "Inner join" : "Join") -#define QUERY_EXPLAIN_NEWLINE(...) tlen = snprintf(tbuf, QUERY_EXPLAIN_MAX_RES_LEN, __VA_ARGS__) -#define QUERY_EXPLAIN_APPEND(...) tlen += snprintf(tbuf + tlen, QUERY_EXPLAIN_MAX_RES_LEN - tlen, __VA_ARGS__) - +#define EXPLAIN_ROW_NEW(level, ...) \ + do { \ + tlen = snprintf(tbuf + VARSTR_HEADER_SIZE, QUERY_EXPLAIN_MAX_RES_LEN, "%*s", level, ""); \ + tlen += snprintf(tbuf + VARSTR_HEADER_SIZE + tlen, QUERY_EXPLAIN_MAX_RES_LEN - tlen, __VA_ARGS__); \ + } while (0) + +#define EXPLAIN_ROW_APPEND(...) tlen += snprintf(tbuf + VARSTR_HEADER_SIZE + tlen, QUERY_EXPLAIN_MAX_RES_LEN - tlen, __VA_ARGS__) +#define EXPLAIN_ROW_END() do { varDataSetLen(tbuf, tlen); tlen += VARSTR_HEADER_SIZE; } while (0) #define QRY_ERR_RET(c) do { int32_t _code = c; if (_code != TSDB_CODE_SUCCESS) { terrno = _code; return _code; } } while (0) #define QRY_RET(c) do { int32_t _code = c; if (_code != TSDB_CODE_SUCCESS) { terrno = _code; } return _code; } while (0) diff --git a/source/libs/qcom/src/queryExplain.c b/source/libs/qcom/src/queryExplain.c index d6da9ab0e2..d352a29e3c 100644 --- a/source/libs/qcom/src/queryExplain.c +++ b/source/libs/qcom/src/queryExplain.c @@ -15,12 +15,41 @@ #include "queryInt.h" #include "query.h" +#include "plannodes.h" -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wformat-truncation" +int32_t qGenerateExplainResNode(SPhysiNode *pNode, void *pExecInfo, SExplainResNode **pRes); -void qFreeExplainRes(SExplainResNode *res) { +void qFreeExplainResTree(SExplainResNode *res) { + if (NULL == res) { + return; + } + + taosMemoryFreeClear(res->pExecInfo); + + SNode* node = NULL; + FOREACH(node, res->pChildren) { + qFreeExplainResTree((SExplainResNode *)node); + } + nodesDestroyList(res->pChildren); + + taosMemoryFreeClear(res); +} + +void qFreeExplainRowCtx(void *ctx) { + if (NULL == ctx) { + return; + } + + SExplainRowCtx *pCtx = (SExplainRowCtx *)ctx; + int32_t rowSize = taosArrayGetSize(pCtx->rows); + for (int32_t i = 0; i < rowSize; ++i) { + SQueryExplainRowInfo *row = taosArrayGet(pCtx->rows, i); + taosMemoryFreeClear(row->buf); + } + + taosArrayDestroy(pCtx->rows); + taosMemoryFree(pCtx); } char *qFillModeString(EFillMode mode) { @@ -50,7 +79,7 @@ char *qGetNameFromColumnNode(SNode *pNode) { return ((SColumnNode *)pNode)->colName; } -int32_t qMakeExplainResChildrenInfo(SPhysiNode *pNode, void *pExecInfo, SNodeList **pChildren) { +int32_t qGenerateExplainResChildren(SPhysiNode *pNode, void *pExecInfo, SNodeList **pChildren) { int32_t tlen = 0; SNodeList *pPhysiChildren = NULL; @@ -122,14 +151,14 @@ int32_t qMakeExplainResChildrenInfo(SPhysiNode *pNode, void *pExecInfo, SNodeLis SNode* node = NULL; SExplainResNode *pResNode = NULL; FOREACH(node, pPhysiChildren) { - QRY_ERR_RET(qMakeExplainResNode((SPhysiNode *)node, pExecInfo, &pResNode)); + QRY_ERR_RET(qGenerateExplainResNode((SPhysiNode *)node, pExecInfo, &pResNode)); QRY_ERR_RET(nodesListAppend(*pChildren, pResNode)); } return TSDB_CODE_SUCCESS; } -int32_t qMakeExplainResNode(SPhysiNode *pNode, void *pExecInfo, SExplainResNode **pRes) { +int32_t qGenerateExplainResNode(SPhysiNode *pNode, void *pExecInfo, SExplainResNode **pRes) { if (NULL == pNode) { *pRes = NULL; qError("physical node is NULL"); @@ -145,7 +174,7 @@ int32_t qMakeExplainResNode(SPhysiNode *pNode, void *pExecInfo, SExplainResNode int32_t code = 0; res->pNode = pNode; res->pExecInfo = pExecInfo; - QRY_ERR_JRET(qMakeExplainResChildrenInfo(pNode, pExecInfo, &res->pChildren)); + QRY_ERR_JRET(qGenerateExplainResChildren(pNode, pExecInfo, &res->pChildren)); *pRes = res; @@ -153,31 +182,27 @@ int32_t qMakeExplainResNode(SPhysiNode *pNode, void *pExecInfo, SExplainResNode _return: - qFreeExplainRes(res); + qFreeExplainResTree(res); QRY_RET(code); } -int32_t qMakeTaskExplainResTree(struct SSubplan *plan, void *pExecTree, SExplainResNode **pRes) { - char *tbuf = taosMemoryMalloc(QUERY_EXPLAIN_MAX_RES_LEN); - if (NULL == tbuf) { - qError("malloc size %d failed", QUERY_EXPLAIN_MAX_RES_LEN); - return TSDB_CODE_QRY_OUT_OF_MEMORY; - } - +int32_t qGenerateExplainResNodeTree(struct SSubplan *plan, void *pExecTree, SExplainResNode **pRes) { void *pExecInfo = NULL; // TODO - int32_t code = qMakeExplainResNode(plan->pNode, pExecInfo, pRes); - - taosMemoryFree(tbuf); - - QRY_RET(code); + QRY_RET(qGenerateExplainResNode(plan->pNode, pExecInfo, pRes)); } -int32_t qExplainBufAppendExecInfo(void *pExecInfo, char *tbuf, int32_t tlen) { - +int32_t qExplainBufAppendExecInfo(void *pExecInfo, char *tbuf, int32_t *len) { + int32_t tlen = *len; + + EXPLAIN_ROW_APPEND("(exec info here)"); + + *len = tlen; + + return TSDB_CODE_SUCCESS; } -int32_t qExplainResAppendRow(SArray *pRows, char *tbuf, int32_t len, int32_t level) { +int32_t qExplainResAppendRow(SExplainRowCtx *ctx, char *tbuf, int32_t len, int32_t level) { SQueryExplainRowInfo row = {0}; row.buf = strdup(tbuf); if (NULL == row.buf) { @@ -187,8 +212,9 @@ int32_t qExplainResAppendRow(SArray *pRows, char *tbuf, int32_t len, int32_t lev row.level = level; row.len = len; + ctx->totalSize += len; - if (taosArrayPush(pRows, &row)) { + if (taosArrayPush(ctx->rows, &row)) { qError("taosArrayPush row to explain res rows failed"); taosMemoryFree(row.buf); QRY_ERR_RET(TSDB_CODE_QRY_OUT_OF_MEMORY); @@ -198,7 +224,7 @@ int32_t qExplainResAppendRow(SArray *pRows, char *tbuf, int32_t len, int32_t lev } -int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SArray *pRows, char *tbuf, int32_t level) { +int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainRowCtx *ctx, char *tbuf, int32_t level) { int32_t tlen = 0; SPhysiNode* pNode = pResNode->pNode; if (NULL == pNode) { @@ -209,174 +235,198 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SArray *pRows, char switch (pNode->type) { case QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN: { STagScanPhysiNode *pTagScanNode = (STagScanPhysiNode *)pNode; - QUERY_EXPLAIN_NEWLINE(EXPLAIN_TAG_SCAN_FORMAT, pTagScanNode->tableName.tname, pTagScanNode->pScanCols->length); + EXPLAIN_ROW_NEW(level, EXPLAIN_TAG_SCAN_FORMAT, pTagScanNode->tableName.tname, pTagScanNode->pScanCols->length); if (pResNode->pExecInfo) { - QRY_ERR_RET(qExplainBufAppendExecInfo(pResNode->pExecInfo, tbuf)); + QRY_ERR_RET(qExplainBufAppendExecInfo(pResNode->pExecInfo, tbuf, &tlen)); } - QUERY_EXPLAIN_APPEND(EXPLAIN_LOOPS_FORMAT, pTagScanNode->count); + EXPLAIN_ROW_APPEND(EXPLAIN_LOOPS_FORMAT, pTagScanNode->count); if (pTagScanNode->reverse) { - QUERY_EXPLAIN_APPEND(EXPLAIN_REVERSE_FORMAT, pTagScanNode->reverse); + EXPLAIN_ROW_APPEND(EXPLAIN_REVERSE_FORMAT, pTagScanNode->reverse); } - QRY_ERR_RET(qExplainResAppendRow(pRows, tbuf, tlen, level)); + EXPLAIN_ROW_END(); + QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level)); - QUERY_EXPLAIN_NEWLINE(EXPLAIN_ORDER_FORMAT, EXPLAIN_ORDER_STRING(pTagScanNode->order)); - QRY_ERR_RET(qExplainResAppendRow(pRows, tbuf, tlen, level + 1)); + EXPLAIN_ROW_NEW(level + 1, EXPLAIN_ORDER_FORMAT, EXPLAIN_ORDER_STRING(pTagScanNode->order)); + EXPLAIN_ROW_END(); + QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); break; } case QUERY_NODE_PHYSICAL_PLAN_TABLE_SEQ_SCAN: case QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN:{ STableScanPhysiNode *pTblScanNode = (STableScanPhysiNode *)pNode; - QUERY_EXPLAIN_NEWLINE(EXPLAIN_TBL_SCAN_FORMAT, pTblScanNode->scan.tableName.tname, pTblScanNode->scan.pScanCols->length); + EXPLAIN_ROW_NEW(level, EXPLAIN_TBL_SCAN_FORMAT, pTblScanNode->scan.tableName.tname, pTblScanNode->scan.pScanCols->length); if (pResNode->pExecInfo) { - QRY_ERR_RET(qExplainBufAppendExecInfo(pResNode->pExecInfo, tbuf, tlen)); + QRY_ERR_RET(qExplainBufAppendExecInfo(pResNode->pExecInfo, tbuf, &tlen)); } - QUERY_EXPLAIN_APPEND(EXPLAIN_LOOPS_FORMAT, pTblScanNode->scan.count); + EXPLAIN_ROW_APPEND(EXPLAIN_LOOPS_FORMAT, pTblScanNode->scan.count); if (pTblScanNode->scan.reverse) { - QUERY_EXPLAIN_APPEND(EXPLAIN_REVERSE_FORMAT, pTblScanNode->scan.reverse); + EXPLAIN_ROW_APPEND(EXPLAIN_REVERSE_FORMAT, pTblScanNode->scan.reverse); } - QRY_ERR_RET(qExplainResAppendRow(pRows, tbuf, tlen, level)); + EXPLAIN_ROW_END(); + QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level)); - QUERY_EXPLAIN_NEWLINE(EXPLAIN_ORDER_FORMAT, EXPLAIN_ORDER_STRING(pTblScanNode->scan.order)); - QRY_ERR_RET(qExplainResAppendRow(pRows, tbuf, tlen, level + 1)); + EXPLAIN_ROW_NEW(level + 1, EXPLAIN_ORDER_FORMAT, EXPLAIN_ORDER_STRING(pTblScanNode->scan.order)); + EXPLAIN_ROW_END(); + QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); - QUERY_EXPLAIN_NEWLINE(EXPLAIN_TIMERANGE_FORMAT, pTblScanNode->scanRange.skey, pTblScanNode->scanRange.ekey); - QRY_ERR_RET(qExplainResAppendRow(pRows, tbuf, tlen, level + 1)); + EXPLAIN_ROW_NEW(level + 1, EXPLAIN_TIMERANGE_FORMAT, pTblScanNode->scanRange.skey, pTblScanNode->scanRange.ekey); + EXPLAIN_ROW_END(); + QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); if (pTblScanNode->pScanConditions) { - QUERY_EXPLAIN_NEWLINE(EXPLAIN_FILTER_FORMAT); + EXPLAIN_ROW_NEW(level + 1, EXPLAIN_FILTER_FORMAT); QRY_ERR_RET(nodesNodeToSQL(pTblScanNode->pScanConditions, tbuf, QUERY_EXPLAIN_MAX_RES_LEN, &tlen)); - QRY_ERR_RET(qExplainResAppendRow(pRows, tbuf, tlen, level + 1)); + EXPLAIN_ROW_END(); + QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); } break; } case QUERY_NODE_PHYSICAL_PLAN_SYSTABLE_SCAN:{ SSystemTableScanPhysiNode *pSTblScanNode = (SSystemTableScanPhysiNode *)pNode; - QUERY_EXPLAIN_NEWLINE(EXPLAIN_SYSTBL_SCAN_FORMAT, pSTblScanNode->scan.tableName.tname, pSTblScanNode->scan.pScanCols->length); + EXPLAIN_ROW_NEW(level, EXPLAIN_SYSTBL_SCAN_FORMAT, pSTblScanNode->scan.tableName.tname, pSTblScanNode->scan.pScanCols->length); if (pResNode->pExecInfo) { - QRY_ERR_RET(qExplainBufAppendExecInfo(pResNode->pExecInfo, tbuf, tlen)); + QRY_ERR_RET(qExplainBufAppendExecInfo(pResNode->pExecInfo, tbuf, &tlen)); } - QUERY_EXPLAIN_APPEND(EXPLAIN_LOOPS_FORMAT, pSTblScanNode->scan.count); + EXPLAIN_ROW_APPEND(EXPLAIN_LOOPS_FORMAT, pSTblScanNode->scan.count); if (pSTblScanNode->scan.reverse) { - QUERY_EXPLAIN_APPEND(EXPLAIN_REVERSE_FORMAT, pSTblScanNode->scan.reverse); + EXPLAIN_ROW_APPEND(EXPLAIN_REVERSE_FORMAT, pSTblScanNode->scan.reverse); } - QRY_ERR_RET(qExplainResAppendRow(pRows, tbuf, tlen, level)); + EXPLAIN_ROW_END(); + QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level)); - QUERY_EXPLAIN_NEWLINE(EXPLAIN_ORDER_FORMAT, EXPLAIN_ORDER_STRING(pSTblScanNode->scan.order)); - QRY_ERR_RET(qExplainResAppendRow(pRows, tbuf, tlen, level + 1)); + EXPLAIN_ROW_NEW(level + 1, EXPLAIN_ORDER_FORMAT, EXPLAIN_ORDER_STRING(pSTblScanNode->scan.order)); + EXPLAIN_ROW_END(); + QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); break; } case QUERY_NODE_PHYSICAL_PLAN_PROJECT:{ SProjectPhysiNode *pPrjNode = (SProjectPhysiNode *)pNode; - QUERY_EXPLAIN_NEWLINE(EXPLAIN_PROJECTION_FORMAT, pPrjNode->pProjections->length, pPrjNode->node.pOutputDataBlockDesc->resultRowSize); + EXPLAIN_ROW_NEW(level, EXPLAIN_PROJECTION_FORMAT, pPrjNode->pProjections->length, pPrjNode->node.pOutputDataBlockDesc->resultRowSize); if (pResNode->pExecInfo) { - QRY_ERR_RET(qExplainBufAppendExecInfo(pResNode->pExecInfo, tbuf, tlen)); + QRY_ERR_RET(qExplainBufAppendExecInfo(pResNode->pExecInfo, tbuf, &tlen)); } - QRY_ERR_RET(qExplainResAppendRow(pRows, tbuf, tlen, level)); + EXPLAIN_ROW_END(); + QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level)); if (pPrjNode->node.pConditions) { - QUERY_EXPLAIN_NEWLINE(EXPLAIN_FILTER_FORMAT); + EXPLAIN_ROW_NEW(level + 1, EXPLAIN_FILTER_FORMAT); QRY_ERR_RET(nodesNodeToSQL(pPrjNode->node.pConditions, tbuf, QUERY_EXPLAIN_MAX_RES_LEN, &tlen)); - QRY_ERR_RET(qExplainResAppendRow(pRows, tbuf, tlen, level + 1)); + EXPLAIN_ROW_END(); + QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); } break; } case QUERY_NODE_PHYSICAL_PLAN_JOIN:{ SJoinPhysiNode *pJoinNode = (SJoinPhysiNode *)pNode; - QUERY_EXPLAIN_NEWLINE(EXPLAIN_JOIN_FORMAT, EXPLAIN_JOIN_STRING(pJoinNode->joinType), pJoinNode->pTargets->length, pJoinNode->node.pOutputDataBlockDesc->resultRowSize); + EXPLAIN_ROW_NEW(level, EXPLAIN_JOIN_FORMAT, EXPLAIN_JOIN_STRING(pJoinNode->joinType), pJoinNode->pTargets->length, pJoinNode->node.pOutputDataBlockDesc->resultRowSize); if (pResNode->pExecInfo) { - QRY_ERR_RET(qExplainBufAppendExecInfo(pResNode->pExecInfo, tbuf, tlen)); + QRY_ERR_RET(qExplainBufAppendExecInfo(pResNode->pExecInfo, tbuf, &tlen)); } - QRY_ERR_RET(qExplainResAppendRow(pRows, tbuf, tlen, level)); + EXPLAIN_ROW_END(); + QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level)); if (pJoinNode->node.pConditions) { - QUERY_EXPLAIN_NEWLINE(EXPLAIN_FILTER_FORMAT); + EXPLAIN_ROW_NEW(level + 1, EXPLAIN_FILTER_FORMAT); QRY_ERR_RET(nodesNodeToSQL(pJoinNode->node.pConditions, tbuf, QUERY_EXPLAIN_MAX_RES_LEN, &tlen)); - QRY_ERR_RET(qExplainResAppendRow(pRows, tbuf, tlen, level + 1)); + EXPLAIN_ROW_END(); + QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); } - QUERY_EXPLAIN_NEWLINE(EXPLAIN_ON_CONDITIONS_FORMAT); + EXPLAIN_ROW_NEW(level + 1, EXPLAIN_ON_CONDITIONS_FORMAT); QRY_ERR_RET(nodesNodeToSQL(pJoinNode->pOnConditions, tbuf, QUERY_EXPLAIN_MAX_RES_LEN, &tlen)); - QRY_ERR_RET(qExplainResAppendRow(pRows, tbuf, tlen, level + 1)); + EXPLAIN_ROW_END(); + QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); break; } case QUERY_NODE_PHYSICAL_PLAN_AGG:{ SAggPhysiNode *pAggNode = (SAggPhysiNode *)pNode; - QUERY_EXPLAIN_NEWLINE(EXPLAIN_AGG_FORMAT, pAggNode->pAggFuncs->length, pAggNode->pGroupKeys->length, pAggNode->node.pOutputDataBlockDesc->resultRowSize); + EXPLAIN_ROW_NEW(level, EXPLAIN_AGG_FORMAT, pAggNode->pAggFuncs->length, pAggNode->pGroupKeys->length, pAggNode->node.pOutputDataBlockDesc->resultRowSize); if (pResNode->pExecInfo) { - QRY_ERR_RET(qExplainBufAppendExecInfo(pResNode->pExecInfo, tbuf, tlen)); + QRY_ERR_RET(qExplainBufAppendExecInfo(pResNode->pExecInfo, tbuf, &tlen)); } - QRY_ERR_RET(qExplainResAppendRow(pRows, tbuf, tlen, level)); + EXPLAIN_ROW_END(); + QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level)); if (pAggNode->node.pConditions) { - QUERY_EXPLAIN_NEWLINE(EXPLAIN_FILTER_FORMAT); + EXPLAIN_ROW_NEW(level + 1, EXPLAIN_FILTER_FORMAT); QRY_ERR_RET(nodesNodeToSQL(pAggNode->node.pConditions, tbuf, QUERY_EXPLAIN_MAX_RES_LEN, &tlen)); - QRY_ERR_RET(qExplainResAppendRow(pRows, tbuf, tlen, level + 1)); + EXPLAIN_ROW_END(); + QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); } break; } case QUERY_NODE_PHYSICAL_PLAN_EXCHANGE:{ SExchangePhysiNode *pExchNode = (SExchangePhysiNode *)pNode; - QUERY_EXPLAIN_NEWLINE(EXPLAIN_EXCHANGE_FORMAT, pExchNode->pSrcEndPoints->length, pExchNode->node.pOutputDataBlockDesc->resultRowSize); + EXPLAIN_ROW_NEW(level, EXPLAIN_EXCHANGE_FORMAT, pExchNode->pSrcEndPoints->length, pExchNode->node.pOutputDataBlockDesc->resultRowSize); if (pResNode->pExecInfo) { - QRY_ERR_RET(qExplainBufAppendExecInfo(pResNode->pExecInfo, tbuf, tlen)); + QRY_ERR_RET(qExplainBufAppendExecInfo(pResNode->pExecInfo, tbuf, &tlen)); } - QRY_ERR_RET(qExplainResAppendRow(pRows, tbuf, tlen, level)); + EXPLAIN_ROW_END(); + QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level)); if (pExchNode->node.pConditions) { - QUERY_EXPLAIN_NEWLINE(EXPLAIN_FILTER_FORMAT); + EXPLAIN_ROW_NEW(level + 1, EXPLAIN_FILTER_FORMAT); QRY_ERR_RET(nodesNodeToSQL(pExchNode->node.pConditions, tbuf, QUERY_EXPLAIN_MAX_RES_LEN, &tlen)); - QRY_ERR_RET(qExplainResAppendRow(pRows, tbuf, tlen, level + 1)); + EXPLAIN_ROW_END(); + QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); } break; } case QUERY_NODE_PHYSICAL_PLAN_SORT:{ SSortPhysiNode *pSortNode = (SSortPhysiNode *)pNode; - QUERY_EXPLAIN_NEWLINE(EXPLAIN_SORT_FORMAT, pSortNode->pSortKeys->length, pSortNode->node.pOutputDataBlockDesc->resultRowSize); + EXPLAIN_ROW_NEW(level, EXPLAIN_SORT_FORMAT, pSortNode->pSortKeys->length, pSortNode->node.pOutputDataBlockDesc->resultRowSize); if (pResNode->pExecInfo) { - QRY_ERR_RET(qExplainBufAppendExecInfo(pResNode->pExecInfo, tbuf, tlen)); + QRY_ERR_RET(qExplainBufAppendExecInfo(pResNode->pExecInfo, tbuf, &tlen)); } - QRY_ERR_RET(qExplainResAppendRow(pRows, tbuf, tlen, level)); + EXPLAIN_ROW_END(); + QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level)); if (pSortNode->node.pConditions) { - QUERY_EXPLAIN_NEWLINE(EXPLAIN_FILTER_FORMAT); + EXPLAIN_ROW_NEW(level + 1, EXPLAIN_FILTER_FORMAT); QRY_ERR_RET(nodesNodeToSQL(pSortNode->node.pConditions, tbuf, QUERY_EXPLAIN_MAX_RES_LEN, &tlen)); - QRY_ERR_RET(qExplainResAppendRow(pRows, tbuf, tlen, level + 1)); + EXPLAIN_ROW_END(); + QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); } break; } case QUERY_NODE_PHYSICAL_PLAN_INTERVAL:{ SIntervalPhysiNode *pIntNode = (SIntervalPhysiNode *)pNode; - QUERY_EXPLAIN_NEWLINE(EXPLAIN_INTERVAL_FORMAT, qGetNameFromColumnNode(pIntNode->pTspk), pIntNode->window.pFuncs->length, + EXPLAIN_ROW_NEW(level, EXPLAIN_INTERVAL_FORMAT, qGetNameFromColumnNode(pIntNode->pTspk), pIntNode->window.pFuncs->length, pIntNode->interval, pIntNode->intervalUnit, pIntNode->offset, pIntNode->intervalUnit, pIntNode->sliding, pIntNode->slidingUnit, pIntNode->window.node.pOutputDataBlockDesc->resultRowSize); if (pResNode->pExecInfo) { - QRY_ERR_RET(qExplainBufAppendExecInfo(pResNode->pExecInfo, tbuf, tlen)); + QRY_ERR_RET(qExplainBufAppendExecInfo(pResNode->pExecInfo, tbuf, &tlen)); } - QRY_ERR_RET(qExplainResAppendRow(pRows, tbuf, tlen, level)); + EXPLAIN_ROW_END(); + QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level)); if (pIntNode->pFill) { - QUERY_EXPLAIN_NEWLINE(EXPLAIN_FILL_FORMAT, qFillModeString(pIntNode->pFill->mode)); - QRY_ERR_RET(qExplainResAppendRow(pRows, tbuf, tlen, level + 1)); + EXPLAIN_ROW_NEW(level + 1, EXPLAIN_FILL_FORMAT, qFillModeString(pIntNode->pFill->mode)); + EXPLAIN_ROW_END(); + QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); } if (pIntNode->window.node.pConditions) { - QUERY_EXPLAIN_NEWLINE(EXPLAIN_FILTER_FORMAT); + EXPLAIN_ROW_NEW(level + 1, EXPLAIN_FILTER_FORMAT); QRY_ERR_RET(nodesNodeToSQL(pIntNode->window.node.pConditions, tbuf, QUERY_EXPLAIN_MAX_RES_LEN, &tlen)); - QRY_ERR_RET(qExplainResAppendRow(pRows, tbuf, tlen, level + 1)); + EXPLAIN_ROW_END(); + QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); } break; } case QUERY_NODE_PHYSICAL_PLAN_SESSION_WINDOW:{ SSessionWinodwPhysiNode *pIntNode = (SSessionWinodwPhysiNode *)pNode; - QUERY_EXPLAIN_NEWLINE(EXPLAIN_SESSION_FORMAT, pIntNode->gap, pIntNode->window.pFuncs->length, pIntNode->window.node.pOutputDataBlockDesc->resultRowSize); + EXPLAIN_ROW_NEW(level, EXPLAIN_SESSION_FORMAT, pIntNode->gap, pIntNode->window.pFuncs->length, pIntNode->window.node.pOutputDataBlockDesc->resultRowSize); if (pResNode->pExecInfo) { - QRY_ERR_RET(qExplainBufAppendExecInfo(pResNode->pExecInfo, tbuf, tlen)); + QRY_ERR_RET(qExplainBufAppendExecInfo(pResNode->pExecInfo, tbuf, &tlen)); } - QRY_ERR_RET(qExplainResAppendRow(pRows, tbuf, tlen, level)); + EXPLAIN_ROW_END(); + QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level)); if (pIntNode->window.node.pConditions) { - QUERY_EXPLAIN_NEWLINE(EXPLAIN_FILTER_FORMAT); + EXPLAIN_ROW_NEW(level + 1, EXPLAIN_FILTER_FORMAT); QRY_ERR_RET(nodesNodeToSQL(pIntNode->window.node.pConditions, tbuf, QUERY_EXPLAIN_MAX_RES_LEN, &tlen)); - QRY_ERR_RET(qExplainResAppendRow(pRows, tbuf, tlen, level + 1)); + EXPLAIN_ROW_END(); + QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); } break; } @@ -389,33 +439,24 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SArray *pRows, char } -int32_t qExplainResNodeToRows(SExplainResNode *pResNode, SArray *pRsp, char *tbuf, int32_t level) { +int32_t qExplainResNodeToRows(SExplainResNode *pResNode, SExplainRowCtx *ctx, char *tbuf, int32_t level) { if (NULL == pResNode) { qError("explain res node is NULL"); QRY_ERR_RET(TSDB_CODE_QRY_APP_ERROR); } int32_t code = 0; - QRY_ERR_RET(qExplainResNodeToRowsImpl(pResNode, pRsp, tbuf, level)); + QRY_ERR_RET(qExplainResNodeToRowsImpl(pResNode, ctx, tbuf, level)); SNode* pNode = NULL; FOREACH(pNode, pResNode->pChildren) { - QRY_ERR_RET(qExplainResNodeToRows((SExplainResNode *)pNode, pRsp, tbuf, level + 1)); + QRY_ERR_RET(qExplainResNodeToRows((SExplainResNode *)pNode, ctx, tbuf, level + 1)); } return TSDB_CODE_SUCCESS; } -int32_t qExplainRowsToRsp(SArray *rows, SRetrieveTableRsp **pRsp) { - int32_t rspSize = sizeof(SRetrieveTableRsp) + ; - SRetrieveTableRsp *rsp = (SRetrieveTableRsp *)taosMemoryCalloc(1, rspSize); - if (NULL == rsp) { - qError("malloc SRetrieveTableRsp failed"); - QRY_ERR_JRET(TSDB_CODE_QRY_OUT_OF_MEMORY); - } -} - -int32_t qMakeTaskExplainResRows(SExplainResNode *pResNode, SRetrieveTableRsp **pRsp) { +int32_t qGenerateExplainResRowsFromNode(SExplainResNode *pResNode, SExplainRowCtx *ctx, int32_t level) { if (NULL == pResNode) { qError("explain res node is NULL"); QRY_RET(TSDB_CODE_QRY_APP_ERROR); @@ -427,24 +468,92 @@ int32_t qMakeTaskExplainResRows(SExplainResNode *pResNode, SRetrieveTableRsp **p qError("malloc size %d failed", QUERY_EXPLAIN_MAX_RES_LEN); QRY_RET(TSDB_CODE_QRY_OUT_OF_MEMORY); } - - SArray *rows = taosArrayInit(10, sizeof(SQueryExplainRowInfo)); - if (NULL == rows) { - qError("taosArrayInit SQueryExplainRowInfo failed"); - QRY_RET(TSDB_CODE_QRY_OUT_OF_MEMORY); - } - QRY_ERR_JRET(qExplainResNodeToRows(pResNode, rows, tbuf, 0)); - - QRY_ERR_JRET(qExplainRowsToRsp(rows, pRsp)); + QRY_ERR_JRET(qExplainResNodeToRows(pResNode, ctx, tbuf, level)); _return: taosMemoryFree(tbuf); - taosArrayDestroy(rows); QRY_RET(code); } +int32_t qAppendTaskExplainResRows(void **pRowCtx, struct SSubplan *plan, void *pExecTree, int32_t level) { + SExplainResNode *node = NULL; + int32_t code = 0; + + QRY_ERR_RET(qGenerateExplainResNodeTree(plan, pExecTree, &node)); + + if (NULL == *pRowCtx) { + *pRowCtx = taosMemoryCalloc(1, sizeof(SExplainRowCtx)); + if (NULL == *pRowCtx) { + qError("calloc SExplainRowCtx failed"); + QRY_ERR_JRET(TSDB_CODE_QRY_OUT_OF_MEMORY); + } + + SArray *rows = taosArrayInit(10, sizeof(SQueryExplainRowInfo)); + if (NULL == rows) { + qError("taosArrayInit SQueryExplainRowInfo failed"); + QRY_ERR_JRET(TSDB_CODE_QRY_OUT_OF_MEMORY); + } + + (*pRowCtx)->rows = rows; + } + + QRY_ERR_JRET(qGenerateExplainResRowsFromNode(node, *pRowCtx, level)); + +_return: + + qFreeExplainResTree(node); + + if (code) { + taosArrayDestroy((*pRowCtx)->rows); + taosMemoryFree(*pRowCtx); + *pRowCtx = NULL; + } + + QRY_RET(code); +} + + +int32_t qGetExplainRspFromRowCtx(void *ctx, SRetrieveTableRsp **pRsp) { + SExplainRowCtx *pCtx = (SExplainRowCtx *)ctx; + int32_t rowNum = taosArrayGetSize(pCtx->rows); + if (rowNum <= 0) { + qError("empty explain res rows"); + QRY_ERR_RET(TSDB_CODE_QRY_APP_ERROR); + } + + int32_t colNum = 1; + int32_t rspSize = sizeof(SRetrieveTableRsp) + sizeof(int32_t) * colNum + sizeof(int32_t) * rowNum + pCtx->totalSize; + SRetrieveTableRsp *rsp = (SRetrieveTableRsp *)taosMemoryCalloc(1, rspSize); + if (NULL == rsp) { + qError("malloc SRetrieveTableRsp failed, size:%d", rspSize); + QRY_ERR_RET(TSDB_CODE_QRY_OUT_OF_MEMORY); + } + + rsp->completed = 1; + rsp->numOfRows = rowNum; + + *(int32_t *)rsp->data = pCtx->totalSize; + + int32_t *offset = (int32_t *)((char *)rsp->data + sizeof(int32_t)); + char *data = (char *)(offset + rowNum); + int32_t tOffset = 0; + + for (int32_t i = 0; i < rowNum; ++i) { + SQueryExplainRowInfo *row = taosArrayGet(pCtx->rows, i); + *offset = tOffset; + tOffset += row->len; + + memcpy(data, row->buf, row->len); + + ++offset; + data += row->len; + } + + return TSDB_CODE_SUCCESS; +} + + -#pragma GCC diagnostic pop diff --git a/source/libs/scalar/inc/filterInt.h b/source/libs/scalar/inc/filterInt.h index 834a722bd8..3e04e7b30a 100644 --- a/source/libs/scalar/inc/filterInt.h +++ b/source/libs/scalar/inc/filterInt.h @@ -36,8 +36,6 @@ extern "C" { #define FILTER_DUMMY_EMPTY_OPTR 127 -#define MAX_NUM_STR_SIZE 40 - #define FILTER_RM_UNIT_MIN_ROWS 100 enum { diff --git a/source/libs/scheduler/inc/schedulerInt.h b/source/libs/scheduler/inc/schedulerInt.h index 518da6e2b8..579a995056 100644 --- a/source/libs/scheduler/inc/schedulerInt.h +++ b/source/libs/scheduler/inc/schedulerInt.h @@ -38,6 +38,11 @@ enum { SCH_WRITE, }; +typedef struct SSchExplainGroup { + int32_t nodeNum; + SSubplan *plan; +} SSchExplainGroup; + typedef struct SSchTrans { void *transInst; void *transHandle; @@ -142,7 +147,7 @@ typedef struct SSchTask { } SSchTask; typedef struct SSchJobAttr { - bool needFetch; + bool analyzeExplain; bool syncSchedule; bool queryJob; bool needFlowCtrl; diff --git a/source/libs/scheduler/src/scheduler.c b/source/libs/scheduler/src/scheduler.c index fdb0b6498c..376febcdf3 100644 --- a/source/libs/scheduler/src/scheduler.c +++ b/source/libs/scheduler/src/scheduler.c @@ -476,6 +476,90 @@ _return: SCH_RET(code); } +int32_t schValidateAndBuildJobExplain(SQueryPlan *pDag, SSchJob *pJob) { + int32_t code = 0; + pJob->queryId = pDag->queryId; + + if (pDag->numOfSubplans <= 0) { + SCH_JOB_ELOG("invalid subplan num:%d", pDag->numOfSubplans); + SCH_ERR_RET(TSDB_CODE_QRY_INVALID_INPUT); + } + + int32_t levelNum = (int32_t)LIST_LENGTH(pDag->pSubplans); + if (levelNum <= 0) { + SCH_JOB_ELOG("invalid level num:%d", levelNum); + SCH_ERR_RET(TSDB_CODE_QRY_INVALID_INPUT); + } + + SHashObj *groupHash = taosHashInit(SCHEDULE_DEFAULT_MAX_TASK_NUM, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), false, HASH_NO_LOCK); + if (NULL == groupHash) { + SCH_JOB_ELOG("groupHash %d failed", SCHEDULE_DEFAULT_MAX_TASK_NUM); + SCH_ERR_RET(TSDB_CODE_QRY_OUT_OF_MEMORY); + } + + pJob->subPlans = pDag->pSubplans; + + SNodeListNode *plans = NULL; + int32_t taskNum = 0; + SSchExplainGroup *pGroup = NULL; + void *rowCtx = NULL; + + for (int32_t i = 0; i < levelNum; ++i) { + plans = (SNodeListNode *)nodesListGetNode(pDag->pSubplans, i); + if (NULL == plans) { + SCH_JOB_ELOG("empty level plan, level:%d", i); + SCH_ERR_JRET(TSDB_CODE_QRY_INVALID_INPUT); + } + + taskNum = (int32_t)LIST_LENGTH(plans->pNodeList); + if (taskNum <= 0) { + SCH_JOB_ELOG("invalid level plan number:%d, level:%d", taskNum, i); + SCH_ERR_JRET(TSDB_CODE_QRY_INVALID_INPUT); + } + + for (int32_t n = 0; n < taskNum; ++n) { + SSubplan *plan = (SSubplan *)nodesListGetNode(plans->pNodeList, n); + pGroup = taosHashGet(groupHash, &plan->id.groupId, sizeof(plan->id.groupId)); + if (pGroup) { + ++pGroup->nodeNum; + continue; + } + + SSchExplainGroup group = {.nodeNum = 1, .plan = plan}; + if (0 != taosHashPut(groupHash, &plan->id.groupId, sizeof(plan->id.groupId), &group, sizeof(group))) { + SCH_TASK_ELOG("taosHashPut to explainGroupHash failed, taskIdx:%d", n); + SCH_ERR_JRET(TSDB_CODE_QRY_OUT_OF_MEMORY); + } + } + + void *pIter = taosHashIterate(groupHash, NULL); + while (pIter) { + pGroup = (SSchExplainGroup *)pIter; + + SCH_ERR_JRET(qAppendTaskExplainResRows(&rowCtx, pGroup->plan, NULL, i)); + + pIter = taosHashIterate(groupHash, pIter); + } + + taosHashClear(groupHash); + + SCH_JOB_DLOG("level initialized, taskNum:%d", taskNum); + } + + SRetrieveTableRsp *pRsp = NULL; + SCH_ERR_JRET(qGetExplainRspFromRowCtx(rowCtx, &pRsp)); + + pJob->resData = pRsp; + +_return: + + taosHashCleanup(groupHash); + qFreeExplainRowCtx(rowCtx); + + SCH_RET(code); +} + + int32_t schSetTaskCandidateAddrs(SSchJob *pJob, SSchTask *pTask) { if (NULL != pTask->candidateAddrs) { return TSDB_CODE_SUCCESS; @@ -2093,6 +2177,7 @@ static int32_t schExecJobImpl(void *transport, SArray *pNodeList, SQueryPlan *pD SCH_ERR_RET(TSDB_CODE_QRY_OUT_OF_MEMORY); } + pJob->attr.analyzeExplain = (EXPLAIN_MODE_ANALYZE == pDag->explainInfo.mode); pJob->attr.syncSchedule = syncSchedule; pJob->transport = transport; pJob->sql = sql; @@ -2163,6 +2248,51 @@ _return: SCH_RET(code); } +int32_t schStaticExplain(void *transport, SArray *pNodeList, SQueryPlan *pDag, int64_t *job, const char *sql, + bool syncSchedule) { + qDebug("QID:0x%" PRIx64 " job started", pDag->queryId); + + int32_t code = 0; + SSchJob *pJob = taosMemoryCalloc(1, sizeof(SSchJob)); + if (NULL == pJob) { + qError("QID:%" PRIx64 " calloc %d failed", pDag->queryId, (int32_t)sizeof(SSchJob)); + SCH_ERR_RET(TSDB_CODE_QRY_OUT_OF_MEMORY); + } + + pJob->sql = sql; + pJob->attr.queryJob = true; + + SCH_ERR_JRET(schValidateAndBuildJobExplain(pDag, pJob)); + + int64_t refId = taosAddRef(schMgmt.jobRef, pJob); + if (refId < 0) { + SCH_JOB_ELOG("taosAddRef job failed, error:%s", tstrerror(terrno)); + SCH_ERR_JRET(terrno); + } + + if (NULL == schAcquireJob(refId)) { + SCH_JOB_ELOG("schAcquireJob job failed, refId:%" PRIx64, refId); + SCH_RET(TSDB_CODE_SCH_STATUS_ERROR); + } + + pJob->refId = refId; + + SCH_JOB_DLOG("job refId:%" PRIx64, pJob->refId); + + pJob->status = JOB_TASK_STATUS_PARTIAL_SUCCEED; + *job = pJob->refId; + SCH_JOB_DLOG("job exec done, job status:%s", SCH_GET_JOB_STATUS_STR(pJob)); + + schReleaseJob(pJob->refId); + + return TSDB_CODE_SUCCESS; + +_return: + + schFreeJobImpl(pJob); + SCH_RET(code); +} + int32_t schedulerInit(SSchedulerCfg *cfg) { if (schMgmt.jobRef) { qError("scheduler already initialized"); @@ -2211,7 +2341,11 @@ int32_t schedulerExecJob(void *transport, SArray *nodeList, SQueryPlan *pDag, in SCH_ERR_RET(TSDB_CODE_QRY_INVALID_INPUT); } - SCH_ERR_RET(schExecJobImpl(transport, nodeList, pDag, pJob, sql, true)); + if (EXPLAIN_MODE_STATIC == pDag->explainInfo.mode) { + SCH_ERR_RET(schStaticExplain(transport, nodeList, pDag, pJob, sql, true)); + } else { + SCH_ERR_RET(schExecJobImpl(transport, nodeList, pDag, pJob, sql, true)); + } SSchJob *job = schAcquireJob(*pJob); From 100d3230a01fb3587347904756361afb3dc0f7e4 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Wed, 30 Mar 2022 17:21:47 +0800 Subject: [PATCH 07/47] feature/qnode --- include/libs/qcom/query.h | 2 +- source/libs/qcom/src/queryExplain.c | 17 ++++++++++------- source/libs/scheduler/src/scheduler.c | 2 +- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/include/libs/qcom/query.h b/include/libs/qcom/query.h index 2a9dd28819..dd2dccc02d 100644 --- a/include/libs/qcom/query.h +++ b/include/libs/qcom/query.h @@ -174,7 +174,7 @@ bool tIsValidSchema(struct SSchema* pSchema, int32_t numOfCols, int32_ int32_t queryCreateTableMetaFromMsg(STableMetaRsp* msg, bool isSuperTable, STableMeta** pMeta); char *jobTaskStatusStr(int32_t status); -int32_t qAppendTaskExplainResRows(void **pRowCtx, struct SSubplan *plan, void *pExecTree, int32_t level); +int32_t qAppendTaskExplainResRows(void **pRowCtx, void *plan, void *pExecTree, int32_t level); int32_t qGetExplainRspFromRowCtx(void *ctx, SRetrieveTableRsp **pRsp); void qFreeExplainRowCtx(void *ctx); diff --git a/source/libs/qcom/src/queryExplain.c b/source/libs/qcom/src/queryExplain.c index d352a29e3c..e1bdf96331 100644 --- a/source/libs/qcom/src/queryExplain.c +++ b/source/libs/qcom/src/queryExplain.c @@ -478,11 +478,13 @@ _return: QRY_RET(code); } -int32_t qAppendTaskExplainResRows(void **pRowCtx, struct SSubplan *plan, void *pExecTree, int32_t level) { +int32_t qAppendTaskExplainResRows(void **pRowCtx, void *plan, void *pExecTree, int32_t level) { SExplainResNode *node = NULL; int32_t code = 0; + struct SSubplan *pPlan = (struct SSubplan *)plan; + SExplainRowCtx *ctx = (SExplainRowCtx *)*pRowCtx; - QRY_ERR_RET(qGenerateExplainResNodeTree(plan, pExecTree, &node)); + QRY_ERR_RET(qGenerateExplainResNodeTree(pPlan, pExecTree, &node)); if (NULL == *pRowCtx) { *pRowCtx = taosMemoryCalloc(1, sizeof(SExplainRowCtx)); @@ -491,24 +493,25 @@ int32_t qAppendTaskExplainResRows(void **pRowCtx, struct SSubplan *plan, void *p QRY_ERR_JRET(TSDB_CODE_QRY_OUT_OF_MEMORY); } + ctx = (SExplainRowCtx *)*pRowCtx; + SArray *rows = taosArrayInit(10, sizeof(SQueryExplainRowInfo)); if (NULL == rows) { qError("taosArrayInit SQueryExplainRowInfo failed"); QRY_ERR_JRET(TSDB_CODE_QRY_OUT_OF_MEMORY); } - (*pRowCtx)->rows = rows; + ctx->rows = rows; } - - QRY_ERR_JRET(qGenerateExplainResRowsFromNode(node, *pRowCtx, level)); + + QRY_ERR_JRET(qGenerateExplainResRowsFromNode(node, ctx, level)); _return: qFreeExplainResTree(node); if (code) { - taosArrayDestroy((*pRowCtx)->rows); - taosMemoryFree(*pRowCtx); + qFreeExplainRowCtx(*pRowCtx); *pRowCtx = NULL; } diff --git a/source/libs/scheduler/src/scheduler.c b/source/libs/scheduler/src/scheduler.c index 376febcdf3..d11dafb19b 100644 --- a/source/libs/scheduler/src/scheduler.c +++ b/source/libs/scheduler/src/scheduler.c @@ -527,7 +527,7 @@ int32_t schValidateAndBuildJobExplain(SQueryPlan *pDag, SSchJob *pJob) { SSchExplainGroup group = {.nodeNum = 1, .plan = plan}; if (0 != taosHashPut(groupHash, &plan->id.groupId, sizeof(plan->id.groupId), &group, sizeof(group))) { - SCH_TASK_ELOG("taosHashPut to explainGroupHash failed, taskIdx:%d", n); + SCH_JOB_ELOG("taosHashPut to explainGroupHash failed, taskIdx:%d", n); SCH_ERR_JRET(TSDB_CODE_QRY_OUT_OF_MEMORY); } } From 08bd344d2ff0bfdca8fa18233076a16a9920d976 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Wed, 30 Mar 2022 17:59:05 +0800 Subject: [PATCH 08/47] feature/qnode --- source/libs/qcom/src/queryExplain.c | 22 +++++++++++----------- source/libs/scheduler/inc/schedulerInt.h | 8 ++++---- source/libs/scheduler/src/scheduler.c | 12 ++++++++---- 3 files changed, 23 insertions(+), 19 deletions(-) diff --git a/source/libs/qcom/src/queryExplain.c b/source/libs/qcom/src/queryExplain.c index e1bdf96331..91ca7f54b0 100644 --- a/source/libs/qcom/src/queryExplain.c +++ b/source/libs/qcom/src/queryExplain.c @@ -31,7 +31,7 @@ void qFreeExplainResTree(SExplainResNode *res) { FOREACH(node, res->pChildren) { qFreeExplainResTree((SExplainResNode *)node); } - nodesDestroyList(res->pChildren); + nodesClearList(res->pChildren); taosMemoryFreeClear(res); } @@ -214,7 +214,7 @@ int32_t qExplainResAppendRow(SExplainRowCtx *ctx, char *tbuf, int32_t len, int32 row.len = len; ctx->totalSize += len; - if (taosArrayPush(ctx->rows, &row)) { + if (NULL == taosArrayPush(ctx->rows, &row)) { qError("taosArrayPush row to explain res rows failed"); taosMemoryFree(row.buf); QRY_ERR_RET(TSDB_CODE_QRY_OUT_OF_MEMORY); @@ -273,9 +273,9 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainRowCtx *ctx EXPLAIN_ROW_END(); QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); - if (pTblScanNode->pScanConditions) { + if (pTblScanNode->scan.node.pConditions) { EXPLAIN_ROW_NEW(level + 1, EXPLAIN_FILTER_FORMAT); - QRY_ERR_RET(nodesNodeToSQL(pTblScanNode->pScanConditions, tbuf, QUERY_EXPLAIN_MAX_RES_LEN, &tlen)); + QRY_ERR_RET(nodesNodeToSQL(pTblScanNode->scan.node.pConditions, tbuf, QUERY_EXPLAIN_MAX_RES_LEN, &tlen)); EXPLAIN_ROW_END(); QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); } @@ -301,7 +301,7 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainRowCtx *ctx } case QUERY_NODE_PHYSICAL_PLAN_PROJECT:{ SProjectPhysiNode *pPrjNode = (SProjectPhysiNode *)pNode; - EXPLAIN_ROW_NEW(level, EXPLAIN_PROJECTION_FORMAT, pPrjNode->pProjections->length, pPrjNode->node.pOutputDataBlockDesc->resultRowSize); + EXPLAIN_ROW_NEW(level, EXPLAIN_PROJECTION_FORMAT, pPrjNode->pProjections->length, pPrjNode->node.pOutputDataBlockDesc->outputRowSize); if (pResNode->pExecInfo) { QRY_ERR_RET(qExplainBufAppendExecInfo(pResNode->pExecInfo, tbuf, &tlen)); } @@ -318,7 +318,7 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainRowCtx *ctx } case QUERY_NODE_PHYSICAL_PLAN_JOIN:{ SJoinPhysiNode *pJoinNode = (SJoinPhysiNode *)pNode; - EXPLAIN_ROW_NEW(level, EXPLAIN_JOIN_FORMAT, EXPLAIN_JOIN_STRING(pJoinNode->joinType), pJoinNode->pTargets->length, pJoinNode->node.pOutputDataBlockDesc->resultRowSize); + EXPLAIN_ROW_NEW(level, EXPLAIN_JOIN_FORMAT, EXPLAIN_JOIN_STRING(pJoinNode->joinType), pJoinNode->pTargets->length, pJoinNode->node.pOutputDataBlockDesc->outputRowSize); if (pResNode->pExecInfo) { QRY_ERR_RET(qExplainBufAppendExecInfo(pResNode->pExecInfo, tbuf, &tlen)); } @@ -340,7 +340,7 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainRowCtx *ctx } case QUERY_NODE_PHYSICAL_PLAN_AGG:{ SAggPhysiNode *pAggNode = (SAggPhysiNode *)pNode; - EXPLAIN_ROW_NEW(level, EXPLAIN_AGG_FORMAT, pAggNode->pAggFuncs->length, pAggNode->pGroupKeys->length, pAggNode->node.pOutputDataBlockDesc->resultRowSize); + EXPLAIN_ROW_NEW(level, EXPLAIN_AGG_FORMAT, pAggNode->pAggFuncs->length, pAggNode->pGroupKeys->length, pAggNode->node.pOutputDataBlockDesc->outputRowSize); if (pResNode->pExecInfo) { QRY_ERR_RET(qExplainBufAppendExecInfo(pResNode->pExecInfo, tbuf, &tlen)); } @@ -357,7 +357,7 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainRowCtx *ctx } case QUERY_NODE_PHYSICAL_PLAN_EXCHANGE:{ SExchangePhysiNode *pExchNode = (SExchangePhysiNode *)pNode; - EXPLAIN_ROW_NEW(level, EXPLAIN_EXCHANGE_FORMAT, pExchNode->pSrcEndPoints->length, pExchNode->node.pOutputDataBlockDesc->resultRowSize); + EXPLAIN_ROW_NEW(level, EXPLAIN_EXCHANGE_FORMAT, pExchNode->pSrcEndPoints->length, pExchNode->node.pOutputDataBlockDesc->outputRowSize); if (pResNode->pExecInfo) { QRY_ERR_RET(qExplainBufAppendExecInfo(pResNode->pExecInfo, tbuf, &tlen)); } @@ -374,7 +374,7 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainRowCtx *ctx } case QUERY_NODE_PHYSICAL_PLAN_SORT:{ SSortPhysiNode *pSortNode = (SSortPhysiNode *)pNode; - EXPLAIN_ROW_NEW(level, EXPLAIN_SORT_FORMAT, pSortNode->pSortKeys->length, pSortNode->node.pOutputDataBlockDesc->resultRowSize); + EXPLAIN_ROW_NEW(level, EXPLAIN_SORT_FORMAT, pSortNode->pSortKeys->length, pSortNode->node.pOutputDataBlockDesc->outputRowSize); if (pResNode->pExecInfo) { QRY_ERR_RET(qExplainBufAppendExecInfo(pResNode->pExecInfo, tbuf, &tlen)); } @@ -392,7 +392,7 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainRowCtx *ctx case QUERY_NODE_PHYSICAL_PLAN_INTERVAL:{ SIntervalPhysiNode *pIntNode = (SIntervalPhysiNode *)pNode; EXPLAIN_ROW_NEW(level, EXPLAIN_INTERVAL_FORMAT, qGetNameFromColumnNode(pIntNode->pTspk), pIntNode->window.pFuncs->length, - pIntNode->interval, pIntNode->intervalUnit, pIntNode->offset, pIntNode->intervalUnit, pIntNode->sliding, pIntNode->slidingUnit, pIntNode->window.node.pOutputDataBlockDesc->resultRowSize); + pIntNode->interval, pIntNode->intervalUnit, pIntNode->offset, pIntNode->intervalUnit, pIntNode->sliding, pIntNode->slidingUnit, pIntNode->window.node.pOutputDataBlockDesc->outputRowSize); if (pResNode->pExecInfo) { QRY_ERR_RET(qExplainBufAppendExecInfo(pResNode->pExecInfo, tbuf, &tlen)); } @@ -415,7 +415,7 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainRowCtx *ctx } case QUERY_NODE_PHYSICAL_PLAN_SESSION_WINDOW:{ SSessionWinodwPhysiNode *pIntNode = (SSessionWinodwPhysiNode *)pNode; - EXPLAIN_ROW_NEW(level, EXPLAIN_SESSION_FORMAT, pIntNode->gap, pIntNode->window.pFuncs->length, pIntNode->window.node.pOutputDataBlockDesc->resultRowSize); + EXPLAIN_ROW_NEW(level, EXPLAIN_SESSION_FORMAT, pIntNode->gap, pIntNode->window.pFuncs->length, pIntNode->window.node.pOutputDataBlockDesc->outputRowSize); if (pResNode->pExecInfo) { QRY_ERR_RET(qExplainBufAppendExecInfo(pResNode->pExecInfo, tbuf, &tlen)); } diff --git a/source/libs/scheduler/inc/schedulerInt.h b/source/libs/scheduler/inc/schedulerInt.h index 579a995056..1b2c7d54e2 100644 --- a/source/libs/scheduler/inc/schedulerInt.h +++ b/source/libs/scheduler/inc/schedulerInt.h @@ -147,10 +147,10 @@ typedef struct SSchTask { } SSchTask; typedef struct SSchJobAttr { - bool analyzeExplain; - bool syncSchedule; - bool queryJob; - bool needFlowCtrl; + EExplainMode explainMode; + bool syncSchedule; + bool queryJob; + bool needFlowCtrl; } SSchJobAttr; typedef struct SSchJob { diff --git a/source/libs/scheduler/src/scheduler.c b/source/libs/scheduler/src/scheduler.c index d11dafb19b..a26b5f32f3 100644 --- a/source/libs/scheduler/src/scheduler.c +++ b/source/libs/scheduler/src/scheduler.c @@ -2177,7 +2177,7 @@ static int32_t schExecJobImpl(void *transport, SArray *pNodeList, SQueryPlan *pD SCH_ERR_RET(TSDB_CODE_QRY_OUT_OF_MEMORY); } - pJob->attr.analyzeExplain = (EXPLAIN_MODE_ANALYZE == pDag->explainInfo.mode); + pJob->attr.explainMode = pDag->explainInfo.mode; pJob->attr.syncSchedule = syncSchedule; pJob->transport = transport; pJob->sql = sql; @@ -2528,11 +2528,15 @@ int32_t schedulerFetchRows(int64_t job, void **pData) { SCH_JOB_DLOG("job already succeed, status:%s", jobTaskStatusStr(status)); goto _return; } else if (status == JOB_TASK_STATUS_PARTIAL_SUCCEED) { - SCH_ERR_JRET(schFetchFromRemote(pJob)); + if (!pJob->attr.explainMode == EXPLAIN_MODE_STATIC) { + SCH_ERR_JRET(schFetchFromRemote(pJob)); + tsem_wait(&pJob->rspSem); + } + } else { + SCH_JOB_ELOG("job status error for fetch, status:%s", jobTaskStatusStr(status)); + SCH_ERR_JRET(TSDB_CODE_SCH_STATUS_ERROR); } - tsem_wait(&pJob->rspSem); - status = SCH_GET_JOB_STATUS(pJob); if (JOB_TASK_STATUS_FAILED == status || JOB_TASK_STATUS_DROPPING == status) { From 35f8a337af018d3afcfdebe9258f14349ac3fc77 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Wed, 30 Mar 2022 19:37:21 +0800 Subject: [PATCH 09/47] feature/qnode --- include/util/tdef.h | 1 + source/libs/parser/src/parTranslater.c | 1 + source/libs/qcom/inc/queryInt.h | 12 ++++------ source/libs/qcom/src/queryExplain.c | 33 ++++++++++++++------------ source/libs/scheduler/src/scheduler.c | 3 ++- 5 files changed, 27 insertions(+), 23 deletions(-) diff --git a/include/util/tdef.h b/include/util/tdef.h index 4b53cde6f5..38c0000ccc 100644 --- a/include/util/tdef.h +++ b/include/util/tdef.h @@ -389,6 +389,7 @@ typedef enum ELogicConditionType { #define TSDB_DEFAULT_EXPLAIN_RATIO 0.001 #define TSDB_EXPLAIN_RESULT_ROW_SIZE 1024 +#define TSDB_EXPLAIN_RESULT_COLUMN_NAME "QUERY PLAN" #define TSDB_MAX_JOIN_TABLE_NUM 10 #define TSDB_MAX_UNION_CLAUSE 5 diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index d453193d0f..ee22529f1d 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -1944,6 +1944,7 @@ int32_t qExtractResultSchema(const SNode* pRoot, int32_t* numOfCols, SSchema** p } (*pSchema)[0].type = TSDB_DATA_TYPE_BINARY; (*pSchema)[0].bytes = TSDB_EXPLAIN_RESULT_ROW_SIZE; + strcpy((*pSchema)[0].name, TSDB_EXPLAIN_RESULT_COLUMN_NAME); } return TSDB_CODE_SUCCESS; diff --git a/source/libs/qcom/inc/queryInt.h b/source/libs/qcom/inc/queryInt.h index 6fc15aacfc..510ba92a86 100644 --- a/source/libs/qcom/inc/queryInt.h +++ b/source/libs/qcom/inc/queryInt.h @@ -22,8 +22,6 @@ extern "C" { #include "nodes.h" #include "plannodes.h" -#define QUERY_EXPLAIN_MAX_RES_LEN 1024 - //newline area #define EXPLAIN_TAG_SCAN_FORMAT "Tag scan on %s columns=%d" #define EXPLAIN_TBL_SCAN_FORMAT "Table scan on %s columns=%d" @@ -42,8 +40,8 @@ extern "C" { #define EXPLAIN_TIMERANGE_FORMAT "Time range: [%" PRId64 ", %" PRId64 "]" //append area -#define EXPLAIN_LOOPS_FORMAT "loops %d" -#define EXPLAIN_REVERSE_FORMAT "reverse %d" +#define EXPLAIN_LOOPS_FORMAT "loops=%d" +#define EXPLAIN_REVERSE_FORMAT "reverse=%d" typedef struct SExplainResNode { @@ -68,11 +66,11 @@ typedef struct SExplainRowCtx { #define EXPLAIN_ROW_NEW(level, ...) \ do { \ - tlen = snprintf(tbuf + VARSTR_HEADER_SIZE, QUERY_EXPLAIN_MAX_RES_LEN, "%*s", level, ""); \ - tlen += snprintf(tbuf + VARSTR_HEADER_SIZE + tlen, QUERY_EXPLAIN_MAX_RES_LEN - tlen, __VA_ARGS__); \ + tlen = snprintf(tbuf + VARSTR_HEADER_SIZE, TSDB_EXPLAIN_RESULT_ROW_SIZE, "%*s", (level) * 2, ""); \ + tlen += snprintf(tbuf + VARSTR_HEADER_SIZE + tlen, TSDB_EXPLAIN_RESULT_ROW_SIZE - tlen, __VA_ARGS__); \ } while (0) -#define EXPLAIN_ROW_APPEND(...) tlen += snprintf(tbuf + VARSTR_HEADER_SIZE + tlen, QUERY_EXPLAIN_MAX_RES_LEN - tlen, __VA_ARGS__) +#define EXPLAIN_ROW_APPEND(...) tlen += snprintf(tbuf + VARSTR_HEADER_SIZE + tlen, TSDB_EXPLAIN_RESULT_ROW_SIZE - tlen, __VA_ARGS__) #define EXPLAIN_ROW_END() do { varDataSetLen(tbuf, tlen); tlen += VARSTR_HEADER_SIZE; } while (0) #define QRY_ERR_RET(c) do { int32_t _code = c; if (_code != TSDB_CODE_SUCCESS) { terrno = _code; return _code; } } while (0) diff --git a/source/libs/qcom/src/queryExplain.c b/source/libs/qcom/src/queryExplain.c index 91ca7f54b0..b2b061cee0 100644 --- a/source/libs/qcom/src/queryExplain.c +++ b/source/libs/qcom/src/queryExplain.c @@ -204,12 +204,13 @@ int32_t qExplainBufAppendExecInfo(void *pExecInfo, char *tbuf, int32_t *len) { int32_t qExplainResAppendRow(SExplainRowCtx *ctx, char *tbuf, int32_t len, int32_t level) { SQueryExplainRowInfo row = {0}; - row.buf = strdup(tbuf); + row.buf = taosMemoryMalloc(len); if (NULL == row.buf) { - qError("strdup %s failed", tbuf); + qError("taosMemoryMalloc %d failed", len); QRY_ERR_RET(TSDB_CODE_QRY_OUT_OF_MEMORY); } + memcpy(row.buf, tbuf, len); row.level = level; row.len = len; ctx->totalSize += len; @@ -275,7 +276,7 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainRowCtx *ctx if (pTblScanNode->scan.node.pConditions) { EXPLAIN_ROW_NEW(level + 1, EXPLAIN_FILTER_FORMAT); - QRY_ERR_RET(nodesNodeToSQL(pTblScanNode->scan.node.pConditions, tbuf, QUERY_EXPLAIN_MAX_RES_LEN, &tlen)); + QRY_ERR_RET(nodesNodeToSQL(pTblScanNode->scan.node.pConditions, tbuf, TSDB_EXPLAIN_RESULT_ROW_SIZE, &tlen)); EXPLAIN_ROW_END(); QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); } @@ -310,7 +311,7 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainRowCtx *ctx if (pPrjNode->node.pConditions) { EXPLAIN_ROW_NEW(level + 1, EXPLAIN_FILTER_FORMAT); - QRY_ERR_RET(nodesNodeToSQL(pPrjNode->node.pConditions, tbuf, QUERY_EXPLAIN_MAX_RES_LEN, &tlen)); + QRY_ERR_RET(nodesNodeToSQL(pPrjNode->node.pConditions, tbuf, TSDB_EXPLAIN_RESULT_ROW_SIZE, &tlen)); EXPLAIN_ROW_END(); QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); } @@ -327,13 +328,13 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainRowCtx *ctx if (pJoinNode->node.pConditions) { EXPLAIN_ROW_NEW(level + 1, EXPLAIN_FILTER_FORMAT); - QRY_ERR_RET(nodesNodeToSQL(pJoinNode->node.pConditions, tbuf, QUERY_EXPLAIN_MAX_RES_LEN, &tlen)); + QRY_ERR_RET(nodesNodeToSQL(pJoinNode->node.pConditions, tbuf, TSDB_EXPLAIN_RESULT_ROW_SIZE, &tlen)); EXPLAIN_ROW_END(); QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); } EXPLAIN_ROW_NEW(level + 1, EXPLAIN_ON_CONDITIONS_FORMAT); - QRY_ERR_RET(nodesNodeToSQL(pJoinNode->pOnConditions, tbuf, QUERY_EXPLAIN_MAX_RES_LEN, &tlen)); + QRY_ERR_RET(nodesNodeToSQL(pJoinNode->pOnConditions, tbuf, TSDB_EXPLAIN_RESULT_ROW_SIZE, &tlen)); EXPLAIN_ROW_END(); QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); break; @@ -349,7 +350,7 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainRowCtx *ctx if (pAggNode->node.pConditions) { EXPLAIN_ROW_NEW(level + 1, EXPLAIN_FILTER_FORMAT); - QRY_ERR_RET(nodesNodeToSQL(pAggNode->node.pConditions, tbuf, QUERY_EXPLAIN_MAX_RES_LEN, &tlen)); + QRY_ERR_RET(nodesNodeToSQL(pAggNode->node.pConditions, tbuf, TSDB_EXPLAIN_RESULT_ROW_SIZE, &tlen)); EXPLAIN_ROW_END(); QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); } @@ -366,7 +367,7 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainRowCtx *ctx if (pExchNode->node.pConditions) { EXPLAIN_ROW_NEW(level + 1, EXPLAIN_FILTER_FORMAT); - QRY_ERR_RET(nodesNodeToSQL(pExchNode->node.pConditions, tbuf, QUERY_EXPLAIN_MAX_RES_LEN, &tlen)); + QRY_ERR_RET(nodesNodeToSQL(pExchNode->node.pConditions, tbuf, TSDB_EXPLAIN_RESULT_ROW_SIZE, &tlen)); EXPLAIN_ROW_END(); QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); } @@ -383,7 +384,7 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainRowCtx *ctx if (pSortNode->node.pConditions) { EXPLAIN_ROW_NEW(level + 1, EXPLAIN_FILTER_FORMAT); - QRY_ERR_RET(nodesNodeToSQL(pSortNode->node.pConditions, tbuf, QUERY_EXPLAIN_MAX_RES_LEN, &tlen)); + QRY_ERR_RET(nodesNodeToSQL(pSortNode->node.pConditions, tbuf, TSDB_EXPLAIN_RESULT_ROW_SIZE, &tlen)); EXPLAIN_ROW_END(); QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); } @@ -407,7 +408,7 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainRowCtx *ctx if (pIntNode->window.node.pConditions) { EXPLAIN_ROW_NEW(level + 1, EXPLAIN_FILTER_FORMAT); - QRY_ERR_RET(nodesNodeToSQL(pIntNode->window.node.pConditions, tbuf, QUERY_EXPLAIN_MAX_RES_LEN, &tlen)); + QRY_ERR_RET(nodesNodeToSQL(pIntNode->window.node.pConditions, tbuf, TSDB_EXPLAIN_RESULT_ROW_SIZE, &tlen)); EXPLAIN_ROW_END(); QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); } @@ -424,7 +425,7 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainRowCtx *ctx if (pIntNode->window.node.pConditions) { EXPLAIN_ROW_NEW(level + 1, EXPLAIN_FILTER_FORMAT); - QRY_ERR_RET(nodesNodeToSQL(pIntNode->window.node.pConditions, tbuf, QUERY_EXPLAIN_MAX_RES_LEN, &tlen)); + QRY_ERR_RET(nodesNodeToSQL(pIntNode->window.node.pConditions, tbuf, TSDB_EXPLAIN_RESULT_ROW_SIZE, &tlen)); EXPLAIN_ROW_END(); QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); } @@ -463,9 +464,9 @@ int32_t qGenerateExplainResRowsFromNode(SExplainResNode *pResNode, SExplainRowCt } int32_t code = 0; - char *tbuf = taosMemoryMalloc(QUERY_EXPLAIN_MAX_RES_LEN); + char *tbuf = taosMemoryMalloc(TSDB_EXPLAIN_RESULT_ROW_SIZE); if (NULL == tbuf) { - qError("malloc size %d failed", QUERY_EXPLAIN_MAX_RES_LEN); + qError("malloc size %d failed", TSDB_EXPLAIN_RESULT_ROW_SIZE); QRY_RET(TSDB_CODE_QRY_OUT_OF_MEMORY); } @@ -536,9 +537,9 @@ int32_t qGetExplainRspFromRowCtx(void *ctx, SRetrieveTableRsp **pRsp) { } rsp->completed = 1; - rsp->numOfRows = rowNum; + rsp->numOfRows = htonl(rowNum); - *(int32_t *)rsp->data = pCtx->totalSize; + *(int32_t *)rsp->data = htonl(pCtx->totalSize); int32_t *offset = (int32_t *)((char *)rsp->data + sizeof(int32_t)); char *data = (char *)(offset + rowNum); @@ -555,6 +556,8 @@ int32_t qGetExplainRspFromRowCtx(void *ctx, SRetrieveTableRsp **pRsp) { data += row->len; } + *pRsp = rsp; + return TSDB_CODE_SUCCESS; } diff --git a/source/libs/scheduler/src/scheduler.c b/source/libs/scheduler/src/scheduler.c index a26b5f32f3..4a84536d00 100644 --- a/source/libs/scheduler/src/scheduler.c +++ b/source/libs/scheduler/src/scheduler.c @@ -2261,6 +2261,7 @@ int32_t schStaticExplain(void *transport, SArray *pNodeList, SQueryPlan *pDag, i pJob->sql = sql; pJob->attr.queryJob = true; + pJob->attr.explainMode = pDag->explainInfo.mode; SCH_ERR_JRET(schValidateAndBuildJobExplain(pDag, pJob)); @@ -2528,7 +2529,7 @@ int32_t schedulerFetchRows(int64_t job, void **pData) { SCH_JOB_DLOG("job already succeed, status:%s", jobTaskStatusStr(status)); goto _return; } else if (status == JOB_TASK_STATUS_PARTIAL_SUCCEED) { - if (!pJob->attr.explainMode == EXPLAIN_MODE_STATIC) { + if (!(pJob->attr.explainMode == EXPLAIN_MODE_STATIC)) { SCH_ERR_JRET(schFetchFromRemote(pJob)); tsem_wait(&pJob->rspSem); } From a1d40669dced293cb289bcfd608b2cb3cd20c52c Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Thu, 31 Mar 2022 11:21:53 +0800 Subject: [PATCH 10/47] add fuzzy search --- source/libs/index/src/index.c | 2 +- source/libs/index/src/indexCache.c | 4 ++-- source/libs/index/src/indexFstCommon.c | 2 +- source/libs/index/src/{indexSparse.c => indexFstSparse.c} | 0 4 files changed, 4 insertions(+), 4 deletions(-) rename source/libs/index/src/{indexSparse.c => indexFstSparse.c} (100%) diff --git a/source/libs/index/src/index.c b/source/libs/index/src/index.c index d3ca3a1acf..7d52abcd1b 100644 --- a/source/libs/index/src/index.c +++ b/source/libs/index/src/index.c @@ -27,7 +27,7 @@ #endif #define INDEX_NUM_OF_THREADS 4 -#define INDEX_QUEUE_SIZE 200 +#define INDEX_QUEUE_SIZE 200 void* indexQhandle = NULL; diff --git a/source/libs/index/src/indexCache.c b/source/libs/index/src/indexCache.c index ca26cf38e5..df3c0b6e7b 100644 --- a/source/libs/index/src/indexCache.c +++ b/source/libs/index/src/indexCache.c @@ -21,8 +21,8 @@ #define MAX_INDEX_KEY_LEN 256 // test only, change later -#define MEM_TERM_LIMIT 10 * 10000 -#define MEM_THRESHOLD 1024 * 1024 +#define MEM_TERM_LIMIT 10 * 10000 +#define MEM_THRESHOLD 1024 * 1024 #define MEM_ESTIMATE_RADIO 1.5 static void indexMemRef(MemTable* tbl); diff --git a/source/libs/index/src/indexFstCommon.c b/source/libs/index/src/indexFstCommon.c index e2544c7ac3..902e68ce09 100644 --- a/source/libs/index/src/indexFstCommon.c +++ b/source/libs/index/src/indexFstCommon.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 TAOS Data, Inc. +YAML:9:25: error: unknown key 'AlignConsecutiveMacros' * Copyright (c) 2019 TAOS Data, Inc. * * This program is free software: you can use, redistribute, and/or modify * it under the terms of the GNU Affero General Public License, version 3 diff --git a/source/libs/index/src/indexSparse.c b/source/libs/index/src/indexFstSparse.c similarity index 100% rename from source/libs/index/src/indexSparse.c rename to source/libs/index/src/indexFstSparse.c From 9da56a412ab99239ae60fa02c0d85c64a5d0f55d Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Thu, 31 Mar 2022 13:56:09 +0800 Subject: [PATCH 11/47] add fuzzy search --- source/libs/index/inc/indexFstRegex.h | 2 +- source/libs/index/src/indexFstRegex.c | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/source/libs/index/inc/indexFstRegex.h b/source/libs/index/inc/indexFstRegex.h index 50b9cae7ff..a58906c242 100644 --- a/source/libs/index/inc/indexFstRegex.h +++ b/source/libs/index/inc/indexFstRegex.h @@ -63,7 +63,7 @@ typedef struct { FstRegex *regexCreate(const char *str); -void regexSetup(FstRegex *regex, uint32_t size, const char *str); +// void regexSetup(FstRegex *regex, uint32_t size, const char *str); // uint32_t regexStart() diff --git a/source/libs/index/src/indexFstRegex.c b/source/libs/index/src/indexFstRegex.c index ec41a7f58e..2b8c8b6708 100644 --- a/source/libs/index/src/indexFstRegex.c +++ b/source/libs/index/src/indexFstRegex.c @@ -14,6 +14,7 @@ */ #include "indexFstRegex.h" +#include "indexFstDfa.h" #include "indexFstSparse.h" FstRegex *regexCreate(const char *str) { @@ -26,9 +27,11 @@ FstRegex *regexCreate(const char *str) { memcpy(orig, str, sz); regex->orig = orig; -} -void regexSetup(FstRegex *regex, uint32_t size, const char *str) { - // return - // return; + // construct insts based on str + SArray *insts = NULL; + + FstDfaBuilder *builder = dfaBuilderCreate(insts); + regex->dfa = dfaBuilderBuild(builder); + return regex; } From aae1ba31ac617b8639f9d51097f0302fe49ebbc6 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Thu, 31 Mar 2022 14:45:26 +0800 Subject: [PATCH 12/47] add fuzzy search --- source/libs/index/inc/indexFstRegex.h | 4 ++++ source/libs/index/src/indexFstRegex.c | 24 ++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/source/libs/index/inc/indexFstRegex.h b/source/libs/index/inc/indexFstRegex.h index a58906c242..a80e768feb 100644 --- a/source/libs/index/inc/indexFstRegex.h +++ b/source/libs/index/inc/indexFstRegex.h @@ -63,6 +63,10 @@ typedef struct { FstRegex *regexCreate(const char *str); +uint32_t regexAutomStart(FstRegex *regex); +bool regexAutomIsMatch(FstRegex *regex, uint32_t state); +bool regexAutomCanMatch(FstRegex *regex, uint32_t state, bool null); +bool regexAutomAccept(FstRegex *regex, uint32_t state, uint8_t byte, uint32_t *result); // void regexSetup(FstRegex *regex, uint32_t size, const char *str); // uint32_t regexStart() diff --git a/source/libs/index/src/indexFstRegex.c b/source/libs/index/src/indexFstRegex.c index 2b8c8b6708..33eeae802e 100644 --- a/source/libs/index/src/indexFstRegex.c +++ b/source/libs/index/src/indexFstRegex.c @@ -35,3 +35,27 @@ FstRegex *regexCreate(const char *str) { regex->dfa = dfaBuilderBuild(builder); return regex; } + +uint32_t regexAutomStart(FstRegex *regex) { + ///// no nothing + return 0; +} +bool regexAutomIsMatch(FstRegex *regex, uint32_t state) { + if (regex->dfa != NULL && dfaIsMatch(regex->dfa, state)) { + return true; + } else { + return false; + } +} + +bool regexAutomCanMatch(FstRegex *regex, uint32_t state, bool null) { + // make frame happy + return null; +} + +bool regexAutomAccept(FstRegex *regex, uint32_t state, uint8_t byte, uint32_t *result) { + if (regex->dfa == NULL) { + return false; + } + return dfaAccept(regex->dfa, state, byte, result); +} From 3e5da8bedbd39db852ae7935d04d901602d11463 Mon Sep 17 00:00:00 2001 From: Liu Jicong Date: Thu, 31 Mar 2022 15:52:54 +0800 Subject: [PATCH 13/47] fix --- example/src/tmq.c | 52 +++++++++++-- example/src/tstream.c | 4 +- include/common/tcommon.h | 29 ++++--- include/common/trow.h | 78 +++++++++---------- include/libs/wal/wal.h | 34 ++++---- source/client/src/tmq.c | 15 +++- source/dnode/mnode/impl/inc/mndDef.h | 3 + source/dnode/vnode/src/inc/vnd.h | 2 +- source/dnode/vnode/src/meta/metaTbUid.c | 2 +- source/dnode/vnode/src/tq/tq.c | 91 +++++++++++++--------- source/dnode/vnode/src/tq/tqRead.c | 2 +- source/dnode/vnode/src/vnd/vnodeQuery.c | 2 +- source/dnode/vnode/src/vnd/vnodeWrite.c | 1 + source/libs/executor/src/executorimpl.c | 5 +- source/libs/planner/src/planPhysiCreater.c | 5 ++ source/libs/stream/src/tstream.c | 2 +- source/libs/wal/src/walRead.c | 23 +++++- source/util/src/tjson.c | 13 ++-- tests/script/tsim/tmq/basic1.sim | 2 +- tests/test/c/tmqSim.c | 2 +- 20 files changed, 240 insertions(+), 127 deletions(-) diff --git a/example/src/tmq.c b/example/src/tmq.c index 8757104ad9..efb4d1830e 100644 --- a/example/src/tmq.c +++ b/example/src/tmq.c @@ -28,7 +28,7 @@ int32_t init_env() { return -1; } - TAOS_RES* pRes = taos_query(pConn, "create database if not exists abc1 vgroups 1"); + TAOS_RES* pRes = taos_query(pConn, "create database if not exists abc1 vgroups 2"); if (taos_errno(pRes) != 0) { printf("error in create db, reason:%s\n", taos_errstr(pRes)); return -1; @@ -42,25 +42,33 @@ int32_t init_env() { } taos_free_result(pRes); - pRes = taos_query(pConn, "create stable if not exists st1 (ts timestamp, k int) tags(a int)"); + pRes = + taos_query(pConn, "create stable if not exists st1 (ts timestamp, c1 int, c2 float, c3 binary(10)) tags(t1 int)"); if (taos_errno(pRes) != 0) { printf("failed to create super table st1, reason:%s\n", taos_errstr(pRes)); return -1; } taos_free_result(pRes); - pRes = taos_query(pConn, "create table if not exists tu1 using st1 tags(1)"); + pRes = taos_query(pConn, "create table if not exists ct0 using st1 tags(1000)"); if (taos_errno(pRes) != 0) { printf("failed to create child table tu1, reason:%s\n", taos_errstr(pRes)); return -1; } taos_free_result(pRes); - pRes = taos_query(pConn, "create table if not exists tu2 using st1 tags(2)"); + pRes = taos_query(pConn, "create table if not exists ct1 using st1 tags(2000)"); if (taos_errno(pRes) != 0) { printf("failed to create child table tu2, reason:%s\n", taos_errstr(pRes)); return -1; } + + pRes = taos_query(pConn, "create table if not exists ct3 using st1 tags(3000)"); + if (taos_errno(pRes) != 0) { + printf("failed to create child table tu3, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); return 0; } @@ -82,12 +90,40 @@ int32_t create_topic() { /*const char* sql = "select * from tu1";*/ /*pRes = tmq_create_topic(pConn, "test_stb_topic_1", sql, strlen(sql));*/ - pRes = taos_query(pConn, "create topic test_stb_topic_1 as select * from tu1"); + pRes = taos_query(pConn, "create topic topic_ctb_column as select ts, c1 from ct1"); if (taos_errno(pRes) != 0) { - printf("failed to create topic test_stb_topic_1, reason:%s\n", taos_errstr(pRes)); + printf("failed to create topic topic_ctb_column, reason:%s\n", taos_errstr(pRes)); return -1; } taos_free_result(pRes); + +#if 0 + pRes = taos_query(pConn, "insert into tu1 values(now, 1, 1.0, 'bi1')"); + if (taos_errno(pRes) != 0) { + printf("failed to insert, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); + pRes = taos_query(pConn, "insert into tu1 values(now+1d, 1, 1.0, 'bi1')"); + if (taos_errno(pRes) != 0) { + printf("failed to insert, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); + pRes = taos_query(pConn, "insert into tu2 values(now, 2, 2.0, 'bi2')"); + if (taos_errno(pRes) != 0) { + printf("failed to insert, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); + pRes = taos_query(pConn, "insert into tu2 values(now+1d, 2, 2.0, 'bi2')"); + if (taos_errno(pRes) != 0) { + printf("failed to insert, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); +#endif + taos_close(pConn); return 0; } @@ -115,7 +151,7 @@ tmq_t* build_consumer() { tmq_list_t* build_topic_list() { tmq_list_t* topic_list = tmq_list_new(); - tmq_list_append(topic_list, "test_stb_topic_1"); + tmq_list_append(topic_list, "topic_ctb_column"); return topic_list; } @@ -215,8 +251,8 @@ int main(int argc, char* argv[]) { if (argc > 1) { printf("env init\n"); code = init_env(); + create_topic(); } - create_topic(); tmq_t* tmq = build_consumer(); tmq_list_t* topic_list = build_topic_list(); /*perf_loop(tmq, topic_list);*/ diff --git a/example/src/tstream.c b/example/src/tstream.c index 40d8ff9b0b..8ffa932bd2 100644 --- a/example/src/tstream.c +++ b/example/src/tstream.c @@ -20,7 +20,7 @@ #include "taos.h" int32_t init_env() { - TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 7010); + TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0); if (pConn == NULL) { return -1; } @@ -65,7 +65,7 @@ int32_t init_env() { int32_t create_stream() { printf("create stream\n"); TAOS_RES* pRes; - TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 7010); + TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0); if (pConn == NULL) { return -1; } diff --git a/include/common/tcommon.h b/include/common/tcommon.h index 51eabb7d61..b57de3660b 100644 --- a/include/common/tcommon.h +++ b/include/common/tcommon.h @@ -37,6 +37,14 @@ enum { TMQ_MSG_TYPE__EP_RSP, }; +enum { + STREAM_TRIGGER__AT_ONCE = 1, + STREAM_TRIGGER__WINDOW_CLOSE, + STREAM_TRIGGER__BY_COUNT, + STREAM_TRIGGER__BY_BATCH_COUNT, + STREAM_TRIGGER__BY_EVENT_TIME, +}; + typedef struct { uint32_t numOfTables; SArray* pGroupList; @@ -54,13 +62,16 @@ typedef struct SColumnDataAgg { } SColumnDataAgg; typedef struct SDataBlockInfo { - STimeWindow window; - int32_t rows; - int32_t rowSize; - int16_t numOfCols; - int16_t hasVarCol; - union {int64_t uid; int64_t blockId;}; - int64_t groupId; // no need to serialize + STimeWindow window; + int32_t rows; + int32_t rowSize; + int16_t numOfCols; + int16_t hasVarCol; + union { + int64_t uid; + int64_t blockId; + }; + int64_t groupId; // no need to serialize } SDataBlockInfo; typedef struct SSDataBlock { @@ -93,7 +104,7 @@ void* tDecodeDataBlock(const void* buf, SSDataBlock* pBlock); int32_t tEncodeDataBlocks(void** buf, const SArray* blocks); void* tDecodeDataBlocks(const void* buf, SArray** blocks); -void colDataDestroy(SColumnInfoData* pColData) ; +void colDataDestroy(SColumnInfoData* pColData); static FORCE_INLINE void blockDestroyInner(SSDataBlock* pBlock) { // WARNING: do not use info.numOfCols, @@ -239,7 +250,7 @@ typedef struct SSessionWindow { SColumn col; } SSessionWindow; -#define QUERY_ASC_FORWARD_STEP 1 +#define QUERY_ASC_FORWARD_STEP 1 #define QUERY_DESC_FORWARD_STEP -1 #define GET_FORWARD_DIRECTION_FACTOR(ord) (((ord) == TSDB_ORDER_ASC) ? QUERY_ASC_FORWARD_STEP : QUERY_DESC_FORWARD_STEP) diff --git a/include/common/trow.h b/include/common/trow.h index df28bc9962..fb6d3ece44 100644 --- a/include/common/trow.h +++ b/include/common/trow.h @@ -47,21 +47,21 @@ extern "C" { #define TD_VTYPE_NONE 0x0U // none or unknown/undefined #define TD_VTYPE_NULL 0x01U // null val #define TD_VTYPE_NORM 0x02U // normal val: not none, not null -#define TD_VTYPE_MAX 0x03U // +#define TD_VTYPE_MAX 0x03U // #define TD_VTYPE_NONE_BYTE 0x0U #define TD_VTYPE_NULL_BYTE 0x55U #define TD_VTYPE_NORM_BYTE 0xAAU -#define TD_ROWS_ALL_NORM 0x01U +#define TD_ROWS_ALL_NORM 0x01U #define TD_ROWS_NULL_NORM 0x0U -#define TD_COL_ROWS_NORM(c) ((c)->bitmap == TD_ROWS_ALL_NORM) // all rows of SDataCol/SBlockCol is NORM +#define TD_COL_ROWS_NORM(c) ((c)->bitmap == TD_ROWS_ALL_NORM) // all rows of SDataCol/SBlockCol is NORM #define TD_SET_COL_ROWS_BTIMAP(c, v) ((c)->bitmap = (v)) -#define TD_SET_COL_ROWS_NORM(c) TD_SET_COL_ROWS_BTIMAP((c), TD_ROWS_ALL_NORM) -#define TD_SET_COL_ROWS_MISC(c) TD_SET_COL_ROWS_BTIMAP((c), TD_ROWS_NULL_NORM) +#define TD_SET_COL_ROWS_NORM(c) TD_SET_COL_ROWS_BTIMAP((c), TD_ROWS_ALL_NORM) +#define TD_SET_COL_ROWS_MISC(c) TD_SET_COL_ROWS_BTIMAP((c), TD_ROWS_NULL_NORM) -#define KvConvertRatio (0.9f) +#define KvConvertRatio (0.9f) #define isSelectKVRow(klen, tlen) ((klen) < ((tlen)*KvConvertRatio)) #ifdef TD_SUPPORT_BITMAP @@ -98,7 +98,7 @@ typedef void *SRow; typedef struct { TDRowValT valType; - void * val; + void *val; } SCellVal; typedef struct { @@ -158,43 +158,43 @@ typedef struct { int16_t nBitmaps; int16_t nBoundBitmaps; int32_t offset; - void * pBitmap; - void * pOffset; + void *pBitmap; + void *pOffset; int32_t extendedRowSize; } SRowBuilder; -#define TD_ROW_HEAD_LEN (sizeof(STSRow)) +#define TD_ROW_HEAD_LEN (sizeof(STSRow)) #define TD_ROW_NCOLS_LEN (sizeof(col_id_t)) -#define TD_ROW_INFO(r) ((r)->info) -#define TD_ROW_TYPE(r) ((r)->type) -#define TD_ROW_DELETE(r) ((r)->del) -#define TD_ROW_ENDIAN(r) ((r)->endian) -#define TD_ROW_SVER(r) ((r)->sver) -#define TD_ROW_NCOLS(r) ((r)->data) // only valid for SKvRow -#define TD_ROW_DATA(r) ((r)->data) -#define TD_ROW_LEN(r) ((r)->len) -#define TD_ROW_KEY(r) ((r)->ts) +#define TD_ROW_INFO(r) ((r)->info) +#define TD_ROW_TYPE(r) ((r)->type) +#define TD_ROW_DELETE(r) ((r)->del) +#define TD_ROW_ENDIAN(r) ((r)->endian) +#define TD_ROW_SVER(r) ((r)->sver) +#define TD_ROW_NCOLS(r) ((r)->data) // only valid for SKvRow +#define TD_ROW_DATA(r) ((r)->data) +#define TD_ROW_LEN(r) ((r)->len) +#define TD_ROW_KEY(r) ((r)->ts) #define TD_ROW_KEY_ADDR(r) (r) // N.B. If without STSchema, getExtendedRowSize() is used to get the rowMaxBytes and // (int32_t)ceil((double)nCols/TD_VTYPE_PARTS) should be added if TD_SUPPORT_BITMAP defined. #define TD_ROW_MAX_BYTES_FROM_SCHEMA(s) (schemaTLen(s) + TD_ROW_HEAD_LEN) -#define TD_ROW_SET_INFO(r, i) (TD_ROW_INFO(r) = (i)) -#define TD_ROW_SET_TYPE(r, t) (TD_ROW_TYPE(r) = (t)) -#define TD_ROW_SET_DELETE(r) (TD_ROW_DELETE(r) = 1) -#define TD_ROW_SET_SVER(r, v) (TD_ROW_SVER(r) = (v)) -#define TD_ROW_SET_LEN(r, l) (TD_ROW_LEN(r) = (l)) +#define TD_ROW_SET_INFO(r, i) (TD_ROW_INFO(r) = (i)) +#define TD_ROW_SET_TYPE(r, t) (TD_ROW_TYPE(r) = (t)) +#define TD_ROW_SET_DELETE(r) (TD_ROW_DELETE(r) = 1) +#define TD_ROW_SET_SVER(r, v) (TD_ROW_SVER(r) = (v)) +#define TD_ROW_SET_LEN(r, l) (TD_ROW_LEN(r) = (l)) #define TD_ROW_SET_NCOLS(r, n) (*(col_id_t *)TD_ROW_NCOLS(r) = (n)) #define TD_ROW_IS_DELETED(r) (TD_ROW_DELETE(r) == 1) -#define TD_IS_TP_ROW(r) (TD_ROW_TYPE(r) == TD_ROW_TP) -#define TD_IS_KV_ROW(r) (TD_ROW_TYPE(r) == TD_ROW_KV) -#define TD_IS_TP_ROW_T(t) ((t) == TD_ROW_TP) -#define TD_IS_KV_ROW_T(t) ((t) == TD_ROW_KV) +#define TD_IS_TP_ROW(r) (TD_ROW_TYPE(r) == TD_ROW_TP) +#define TD_IS_KV_ROW(r) (TD_ROW_TYPE(r) == TD_ROW_KV) +#define TD_IS_TP_ROW_T(t) ((t) == TD_ROW_TP) +#define TD_IS_KV_ROW_T(t) ((t) == TD_ROW_KV) -#define TD_BOOL_STR(b) ((b) ? "true" : "false") +#define TD_BOOL_STR(b) ((b) ? "true" : "false") #define isUtilizeKVRow(k, d) ((k) < ((d)*KVRatioConvert)) #define TD_ROW_COL_IDX(r) POINTER_SHIFT(TD_ROW_DATA(r), sizeof(col_id_t)) @@ -275,7 +275,7 @@ static FORCE_INLINE int32_t tdSetBitmapValType(void *pBitmap, int16_t colIdx, TD } int16_t nBytes = colIdx / TD_VTYPE_PARTS; int16_t nOffset = colIdx & TD_VTYPE_OPTR; - char * pDestByte = (char *)POINTER_SHIFT(pBitmap, nBytes); + char *pDestByte = (char *)POINTER_SHIFT(pBitmap, nBytes); switch (nOffset) { case 0: *pDestByte = ((*pDestByte) & 0x3F) | (valType << 6); @@ -313,7 +313,7 @@ static FORCE_INLINE int32_t tdGetBitmapValType(void *pBitmap, int16_t colIdx, TD } int16_t nBytes = colIdx / TD_VTYPE_PARTS; int16_t nOffset = colIdx & TD_VTYPE_OPTR; - char * pDestByte = (char *)POINTER_SHIFT(pBitmap, nBytes); + char *pDestByte = (char *)POINTER_SHIFT(pBitmap, nBytes); switch (nOffset) { case 0: *pValType = (((*pDestByte) & 0xC0) >> 6); @@ -620,7 +620,7 @@ static FORCE_INLINE int32_t tdAppendColValToKvRow(SRowBuilder *pBuilder, TDRowVa if (tdValIsNorm(valType, val, colType)) { // ts key stored in STSRow.ts SKvRowIdx *pColIdx = (SKvRowIdx *)POINTER_SHIFT(TD_ROW_COL_IDX(row), offset); - char * ptr = (char *)POINTER_SHIFT(row, TD_ROW_LEN(row)); + char *ptr = (char *)POINTER_SHIFT(row, TD_ROW_LEN(row)); pColIdx->colId = colId; pColIdx->offset = TD_ROW_LEN(row); // the offset include the TD_ROW_HEAD_LEN @@ -638,7 +638,7 @@ static FORCE_INLINE int32_t tdAppendColValToKvRow(SRowBuilder *pBuilder, TDRowVa // NULL/None value else { SKvRowIdx *pColIdx = (SKvRowIdx *)POINTER_SHIFT(TD_ROW_COL_IDX(row), offset); - char * ptr = (char *)POINTER_SHIFT(row, TD_ROW_LEN(row)); + char *ptr = (char *)POINTER_SHIFT(row, TD_ROW_LEN(row)); pColIdx->colId = colId; pColIdx->offset = TD_ROW_LEN(row); // the offset include the TD_ROW_HEAD_LEN const void *nullVal = getNullValue(colType); @@ -775,8 +775,8 @@ static FORCE_INLINE int32_t tdGetKvRowValOfCol(SCellVal *output, STSRow *pRow, v typedef struct { STSchema *pSchema; - STSRow * pRow; - void * pBitmap; + STSRow *pRow; + void *pBitmap; uint32_t offset; col_id_t maxColId; col_id_t colIdx; // [PRIMARYKEY_TIMESTAMP_COL_ID, nSchemaCols], PRIMARYKEY_TIMESTAMP_COL_ID equals 1 @@ -881,7 +881,7 @@ static FORCE_INLINE bool tdGetTpRowDataOfCol(STSRowIter *pIter, col_type_t colTy // internal static FORCE_INLINE bool tdGetKvRowValOfColEx(STSRowIter *pIter, col_id_t colId, col_type_t colType, col_id_t *nIdx, SCellVal *pVal) { - STSRow * pRow = pIter->pRow; + STSRow *pRow = pIter->pRow; SKvRowIdx *pKvIdx = NULL; bool colFound = false; col_id_t kvNCols = tdRowGetNCols(pRow); @@ -939,7 +939,6 @@ static FORCE_INLINE bool tdSTSRowIterNext(STSRowIter *pIter, col_id_t colId, col while (pIter->colIdx <= pSchema->numOfCols) { pCol = &pSchema->columns[pIter->colIdx]; if (colId == pCol->colId) { - ++pIter->colIdx; break; } else if (colId < pCol->colId) { ++pIter->colIdx; @@ -948,7 +947,8 @@ static FORCE_INLINE bool tdSTSRowIterNext(STSRowIter *pIter, col_id_t colId, col return false; } } - return tdGetTpRowDataOfCol(pIter, pCol->type, pCol->offset - sizeof(TSKEY), pVal); + tdGetTpRowDataOfCol(pIter, pCol->type, pCol->offset - sizeof(TSKEY), pVal); + ++pIter->colIdx; } else if (TD_IS_KV_ROW(pIter->pRow)) { return tdGetKvRowValOfColEx(pIter, colId, colType, &pIter->kvIdx, pVal); } else { @@ -1076,7 +1076,7 @@ typedef struct { typedef struct { STSchema *pSchema; - STSRow * pRow; + STSRow *pRow; } STSRowReader; typedef struct { diff --git a/include/libs/wal/wal.h b/include/libs/wal/wal.h index 8b1ac3ed8d..e635227eaa 100644 --- a/include/libs/wal/wal.h +++ b/include/libs/wal/wal.h @@ -61,16 +61,16 @@ extern "C" { } \ } -#define WAL_HEAD_VER 0 +#define WAL_HEAD_VER 0 #define WAL_NOSUFFIX_LEN 20 -#define WAL_SUFFIX_AT (WAL_NOSUFFIX_LEN + 1) -#define WAL_LOG_SUFFIX "log" +#define WAL_SUFFIX_AT (WAL_NOSUFFIX_LEN + 1) +#define WAL_LOG_SUFFIX "log" #define WAL_INDEX_SUFFIX "idx" -#define WAL_REFRESH_MS 1000 -#define WAL_MAX_SIZE (TSDB_MAX_WAL_SIZE + sizeof(SWalHead)) -#define WAL_PATH_LEN (TSDB_FILENAME_LEN + 12) -#define WAL_FILE_LEN (WAL_PATH_LEN + 32) -#define WAL_MAGIC 0xFAFBFCFDULL +#define WAL_REFRESH_MS 1000 +#define WAL_MAX_SIZE (TSDB_MAX_WAL_SIZE + sizeof(SWalHead)) +#define WAL_PATH_LEN (TSDB_FILENAME_LEN + 12) +#define WAL_FILE_LEN (WAL_PATH_LEN + 32) +#define WAL_MAGIC 0xFAFBFCFDULL #define WAL_CUR_FAILED 1 @@ -150,14 +150,15 @@ typedef struct SWal { } SWal; // WAL HANDLE typedef struct SWalReadHandle { - SWal *pWal; - TdFilePtr pReadLogTFile; - TdFilePtr pReadIdxTFile; - int64_t curFileFirstVer; - int64_t curVersion; - int64_t capacity; - int64_t status; // if cursor valid - SWalHead *pHead; + SWal *pWal; + TdFilePtr pReadLogTFile; + TdFilePtr pReadIdxTFile; + int64_t curFileFirstVer; + int64_t curVersion; + int64_t capacity; + int64_t status; // if cursor valid + TdThreadMutex mutex; + SWalHead *pHead; } SWalReadHandle; #pragma pack(pop) @@ -191,6 +192,7 @@ int32_t walEndSnapshot(SWal *); SWalReadHandle *walOpenReadHandle(SWal *); void walCloseReadHandle(SWalReadHandle *); int32_t walReadWithHandle(SWalReadHandle *pRead, int64_t ver); +int32_t walReadWithHandle_s(SWalReadHandle *pRead, int64_t ver, SWalReadHead **ppHead); // deprecated #if 0 diff --git a/source/client/src/tmq.c b/source/client/src/tmq.c index 1fa267ae7e..5d1e95be7c 100644 --- a/source/client/src/tmq.c +++ b/source/client/src/tmq.c @@ -255,6 +255,7 @@ void tmqClearUnhandleMsg(tmq_t* tmq) { break; } + msg = NULL; taosReadAllQitems(tmq->mqueue, tmq->qall); while (1) { taosGetQitem(tmq->qall, (void**)&msg); @@ -787,7 +788,7 @@ void tmqShowMsg(tmq_message_t* tmq_message) { static bool noPrintSchema; char pBuf[128]; SMqPollRsp* pRsp = &tmq_message->msg; - int32_t colNum = pRsp->schema->nCols; + int32_t colNum = 2; if (!noPrintSchema) { printf("|"); for (int32_t i = 0; i < colNum; i++) { @@ -838,6 +839,7 @@ int32_t tmqPollCb(void* param, const SDataBuf* pMsg, int32_t code) { int32_t msgEpoch = ((SMqRspHead*)pMsg->pData)->epoch; int32_t tmqEpoch = atomic_load_32(&tmq->epoch); if (msgEpoch < tmqEpoch) { + /*printf("discard rsp epoch %d, current epoch %d\n", msgEpoch, tmqEpoch);*/ tsem_post(&tmq->rspSem); tscWarn("discard rsp epoch %d, current epoch %d", msgEpoch, tmqEpoch); return 0; @@ -886,6 +888,9 @@ int32_t tmqPollCb(void* param, const SDataBuf* pMsg, int32_t code) { goto WRITE_QUEUE_FAIL; } + tscError("tmq recv poll: vg %d, req offset %ld, rsp offset %ld", pParam->pVg->vgId, pRsp->msg.reqOffset, + pRsp->msg.rspOffset); + pRsp->vg = pParam->pVg; taosWriteQitem(tmq->mqueue, pRsp); atomic_add_fetch_32(&tmq->readyRequest, 1); @@ -902,6 +907,7 @@ WRITE_QUEUE_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);*/ bool set = false; int32_t topicNumGet = taosArrayGetSize(pRsp->topics); char vgKey[TSDB_TOPIC_FNAME_LEN + 22]; @@ -932,6 +938,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);*/ taosHashPut(pHash, vgKey, strlen(vgKey), &pVgCur->currentOffset, sizeof(int64_t)); } break; @@ -945,9 +952,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);*/ if (pOffset != NULL) { offset = *pOffset; + /*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);*/ SMqClientVg clientVg = { .pollCnt = 0, .currentOffset = offset, @@ -1195,6 +1205,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);*/ continue; } SMqPollReq* pReq = tmqBuildConsumeReqImpl(tmq, blockingTime, pTopic, pVg); @@ -1238,6 +1249,8 @@ 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);*/ + /*printf("send vg %d %ld\n", pVg->vgId, pVg->currentOffset);*/ asyncSendMsgToServer(tmq->pTscObj->pAppInfo->pTransporter, &pVg->epSet, &transporterId, sendInfo); pVg->pollCnt++; tmq->pollCnt++; diff --git a/source/dnode/mnode/impl/inc/mndDef.h b/source/dnode/mnode/impl/inc/mndDef.h index 6976d83abd..7891c690e3 100644 --- a/source/dnode/mnode/impl/inc/mndDef.h +++ b/source/dnode/mnode/impl/inc/mndDef.h @@ -735,6 +735,9 @@ typedef struct { int8_t createdBy; // STREAM_CREATED_BY__USER or SMA int32_t fixedSinkVgId; // 0 for shuffle int64_t smaId; // 0 for unused + int8_t trigger; + int32_t triggerParam; + int64_t waterMark; char* sql; char* logicalPlan; char* physicalPlan; diff --git a/source/dnode/vnode/src/inc/vnd.h b/source/dnode/vnode/src/inc/vnd.h index e5d1f952a8..aa4a9fc1de 100644 --- a/source/dnode/vnode/src/inc/vnd.h +++ b/source/dnode/vnode/src/inc/vnd.h @@ -194,7 +194,7 @@ void tqClose(STQ*); int tqPushMsg(STQ*, void* msg, int32_t msgLen, tmsg_t msgType, int64_t version); int tqCommit(STQ*); -int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg); +int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId); int32_t tqProcessSetConnReq(STQ* pTq, char* msg); int32_t tqProcessRebReq(STQ* pTq, char* msg); int32_t tqProcessTaskExec(STQ* pTq, char* msg, int32_t msgLen, int32_t workerId); diff --git a/source/dnode/vnode/src/meta/metaTbUid.c b/source/dnode/vnode/src/meta/metaTbUid.c index cad1eba134..b488630024 100644 --- a/source/dnode/vnode/src/meta/metaTbUid.c +++ b/source/dnode/vnode/src/meta/metaTbUid.c @@ -27,5 +27,5 @@ void metaCloseUidGnrt(SMeta *pMeta) { /* TODO */ tb_uid_t metaGenerateUid(SMeta *pMeta) { // Generate a new table UID - return ++(pMeta->uidGnrt.nextUid); + return tGenIdPI64(); } diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c index 06a2350aab..f34fa9e19c 100644 --- a/source/dnode/vnode/src/tq/tq.c +++ b/source/dnode/vnode/src/tq/tq.c @@ -250,7 +250,7 @@ int32_t tqDeserializeConsumer(STQ* pTq, const STqSerializedHead* pHead, STqConsu return 0; } -int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg) { +int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) { SMqPollReq* pReq = pMsg->pCont; int64_t consumerId = pReq->consumerId; int64_t fetchOffset; @@ -264,6 +264,8 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg) { fetchOffset = pReq->currentOffset + 1; } + printf("tmq poll vg %d req %ld %ld\n", pTq->pVnode->vgId, pReq->currentOffset, fetchOffset); + SMqPollRsp rsp = { /*.consumerId = consumerId,*/ .numOfTopics = 0, @@ -288,62 +290,76 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg) { rsp.reqOffset = pReq->currentOffset; rsp.skipLogNum = 0; - SWalHead* pHead; while (1) { /*if (fetchOffset > walGetLastVer(pTq->pWal) || walReadWithHandle(pTopic->pReadhandle, fetchOffset) < 0) {*/ - if (walReadWithHandle(pTopic->pReadhandle, fetchOffset) < 0) { + SWalReadHead* pHead; + if (walReadWithHandle_s(pTopic->pReadhandle, fetchOffset, &pHead) < 0) { // TODO: no more log, set timer to wait blocking time // if data inserted during waiting, launch query and // response to user break; } - int8_t pos = fetchOffset % TQ_BUFFER_SIZE; - pHead = pTopic->pReadhandle->pHead; - if (pHead->head.msgType == TDMT_VND_SUBMIT) { - SSubmitReq* pCont = (SSubmitReq*)&pHead->head.body; - qTaskInfo_t task = pTopic->buffer.output[pos].task; + /*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) { + SSubmitReq* pCont = (SSubmitReq*)&pHead->body; + printf("from topic %s from consumer\n", pTopic->topicName, consumerId); + qTaskInfo_t task = pTopic->buffer.output[workerId].task; + ASSERT(task); qSetStreamInput(task, pCont, STREAM_DATA_TYPE_SUBMIT_BLOCK); SArray* pRes = taosArrayInit(0, sizeof(SSDataBlock)); while (1) { - SSDataBlock* pDataBlock; + SSDataBlock* pDataBlock = NULL; uint64_t ts; if (qExecTask(task, &pDataBlock, &ts) < 0) { ASSERT(false); } if (pDataBlock == NULL) { - fetchOffset++; - pos = fetchOffset % TQ_BUFFER_SIZE; - rsp.skipLogNum++; + /*pos = fetchOffset % TQ_BUFFER_SIZE;*/ break; } taosArrayPush(pRes, pDataBlock); - rsp.schema = pTopic->buffer.output[pos].pReadHandle->pSchemaWrapper; - rsp.rspOffset = fetchOffset; - - rsp.numOfTopics = 1; - rsp.pBlockData = pRes; - - int32_t tlen = sizeof(SMqRspHead) + tEncodeSMqPollRsp(NULL, &rsp); - void* buf = rpcMallocCont(tlen); - if (buf == NULL) { - pMsg->code = -1; - return -1; - } - ((SMqRspHead*)buf)->mqMsgType = TMQ_MSG_TYPE__POLL_RSP; - ((SMqRspHead*)buf)->epoch = pReq->epoch; - ((SMqRspHead*)buf)->consumerId = consumerId; - - void* abuf = POINTER_SHIFT(buf, sizeof(SMqRspHead)); - tEncodeSMqPollRsp(&abuf, &rsp); - /*taosArrayDestroyEx(rsp.pBlockData, (void (*)(void*))tDeleteSSDataBlock);*/ - pMsg->pCont = buf; - pMsg->contLen = tlen; - pMsg->code = 0; - tmsgSendRsp(pMsg); - return 0; } + + if (taosArrayGetSize(pRes) == 0) { + fetchOffset++; + rsp.skipLogNum++; + taosArrayDestroy(pRes); + continue; + } + rsp.schema = pTopic->buffer.output[workerId].pReadHandle->pSchemaWrapper; + rsp.rspOffset = fetchOffset; + + rsp.numOfTopics = 1; + rsp.pBlockData = pRes; + + int32_t tlen = sizeof(SMqRspHead) + tEncodeSMqPollRsp(NULL, &rsp); + void* buf = rpcMallocCont(tlen); + if (buf == NULL) { + pMsg->code = -1; + taosMemoryFree(pHead); + return -1; + } + ((SMqRspHead*)buf)->mqMsgType = TMQ_MSG_TYPE__POLL_RSP; + ((SMqRspHead*)buf)->epoch = pReq->epoch; + ((SMqRspHead*)buf)->consumerId = consumerId; + + void* abuf = POINTER_SHIFT(buf, sizeof(SMqRspHead)); + tEncodeSMqPollRsp(&abuf, &rsp); + /*taosArrayDestroyEx(rsp.pBlockData, (void (*)(void*))tDeleteSSDataBlock);*/ + 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); + tmsgSendRsp(pMsg); + taosMemoryFree(pHead); + return 0; } else { + taosMemoryFree(pHead); fetchOffset++; rsp.skipLogNum++; } @@ -368,6 +384,7 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg) { 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); /*}*/ return 0; @@ -432,7 +449,9 @@ int32_t tqProcessSetConnReq(STQ* pTq, char* msg) { }; pTopic->buffer.output[i].pReadHandle = pReadHandle; 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); taosArrayPush(pConsumer->topics, pTopic); tqHandleMovePut(pTq->tqMeta, req.consumerId, pConsumer); tqHandleCommit(pTq->tqMeta, req.consumerId); diff --git a/source/dnode/vnode/src/tq/tqRead.c b/source/dnode/vnode/src/tq/tqRead.c index 9c0b0802ab..344b4fa655 100644 --- a/source/dnode/vnode/src/tq/tqRead.c +++ b/source/dnode/vnode/src/tq/tqRead.c @@ -167,7 +167,7 @@ SArray* tqRetrieveDataBlock(STqReadHandle* pHandle) { if (!tdSTSRowIterNext(&iter, pColData->info.colId, pColData->info.type, &sVal)) { break; } - if (colDataAppend(pColData, curRow, sVal.val, sVal.valType == TD_VTYPE_NULL) < 0) { + if (colDataAppend(pColData, curRow, sVal.val, false) < 0) { taosArrayDestroyEx(pArray, (void (*)(void*))tDeleteSSDataBlock); return NULL; } diff --git a/source/dnode/vnode/src/vnd/vnodeQuery.c b/source/dnode/vnode/src/vnd/vnodeQuery.c index 598647f797..053c03cc97 100644 --- a/source/dnode/vnode/src/vnd/vnodeQuery.c +++ b/source/dnode/vnode/src/vnd/vnodeQuery.c @@ -66,7 +66,7 @@ int vnodeProcessFetchMsg(SVnode *pVnode, SRpcMsg *pMsg, SQueueInfo *pInfo) { case TDMT_VND_TABLE_META: return vnodeGetTableMeta(pVnode, pMsg); case TDMT_VND_CONSUME: - return tqProcessPollReq(pVnode->pTq, pMsg); + return tqProcessPollReq(pVnode->pTq, pMsg, pInfo->workerId); case TDMT_VND_TASK_PIPE_EXEC: case TDMT_VND_TASK_MERGE_EXEC: return tqProcessTaskExec(pVnode->pTq, msgstr, msgLen, pInfo->workerId); diff --git a/source/dnode/vnode/src/vnd/vnodeWrite.c b/source/dnode/vnode/src/vnd/vnodeWrite.c index 8875090b43..631727fd5b 100644 --- a/source/dnode/vnode/src/vnd/vnodeWrite.c +++ b/source/dnode/vnode/src/vnd/vnodeWrite.c @@ -163,6 +163,7 @@ int vnodeApplyWMsg(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) { // } break; case TDMT_VND_SUBMIT: + printf("vnode %d write data %ld\n", pVnode->vgId, ver); if (pVnode->config.streamMode == 0) { if (tsdbInsertData(pVnode->pTsdb, (SSubmitReq *)ptr, NULL) < 0) { // TODO: handle error diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index 2df18f135c..d6c07b6659 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -1551,8 +1551,8 @@ static SArray* hashIntervalAgg(SOperatorInfo* pOperatorInfo, SResultRowInfo* pRe if (pSDataBlock->pDataBlock != NULL) { SColumnInfoData* pColDataInfo = taosArrayGet(pSDataBlock->pDataBlock, 0); tsCols = (int64_t*)pColDataInfo->pData; - assert(tsCols[0] == pSDataBlock->info.window.skey && - tsCols[pSDataBlock->info.rows - 1] == pSDataBlock->info.window.ekey); + /*assert(tsCols[0] == pSDataBlock->info.window.skey &&*/ + /*tsCols[pSDataBlock->info.rows - 1] == pSDataBlock->info.window.ekey);*/ } int32_t startPos = ascScan? 0 : (pSDataBlock->info.rows - 1); @@ -6994,6 +6994,7 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo *pOperator, bool* newgroup finalizeUpdatedResult(pInfo->binfo.pCtx, pOperator->numOfOutput, pInfo->aggSup.pResultBuf, pUpdated, pInfo->binfo.rowCellInfoOffset); blockDataEnsureCapacity(pInfo->binfo.pRes, pInfo->binfo.capacity); + initGroupResInfo(&pInfo->groupResInfo, &pInfo->binfo.resultRowInfo); toSDatablock(&pInfo->groupResInfo, pInfo->aggSup.pResultBuf, pInfo->binfo.pRes, pInfo->binfo.capacity, pInfo->binfo.rowCellInfoOffset); diff --git a/source/libs/planner/src/planPhysiCreater.c b/source/libs/planner/src/planPhysiCreater.c index 9ef1c01cd1..d8a44e7156 100644 --- a/source/libs/planner/src/planPhysiCreater.c +++ b/source/libs/planner/src/planPhysiCreater.c @@ -719,6 +719,11 @@ static int32_t createStreamScanPhysiNodeByExchange(SPhysiPlanContext* pCxt, SExc if (NULL == pScan->pScanCols) { code = TSDB_CODE_OUT_OF_MEMORY; } + + if (TSDB_CODE_SUCCESS == code) { + code = sortScanCols(pScan->pScanCols); + } + if (TSDB_CODE_SUCCESS == code) { code = addDataBlockSlots(pCxt, pScan->pScanCols, pScan->node.pOutputDataBlockDesc); } diff --git a/source/libs/stream/src/tstream.c b/source/libs/stream/src/tstream.c index fb6c0f6c12..e2c5979a5a 100644 --- a/source/libs/stream/src/tstream.c +++ b/source/libs/stream/src/tstream.c @@ -38,7 +38,7 @@ static int32_t streamBuildDispatchMsg(SStreamTask* pTask, SArray* data, SRpcMsg* req.taskId = pTask->fixedEpDispatcher.taskId; } else if (pTask->dispatchType == TASK_DISPATCH__SHUFFLE) { - // TODO fix tbname issue + // TODO use general name rule of schemaless char ctbName[TSDB_TABLE_FNAME_LEN + 22]; // all groupId must be the same in an array SSDataBlock* pBlock = taosArrayGet(data, 0); diff --git a/source/libs/wal/src/walRead.c b/source/libs/wal/src/walRead.c index 5296a16703..2545eeab4b 100644 --- a/source/libs/wal/src/walRead.c +++ b/source/libs/wal/src/walRead.c @@ -30,6 +30,9 @@ SWalReadHandle *walOpenReadHandle(SWal *pWal) { pRead->curFileFirstVer = -1; pRead->capacity = 0; pRead->status = 0; + + taosThreadMutexInit(&pRead->mutex, NULL); + pRead->pHead = taosMemoryMalloc(sizeof(SWalHead)); if (pRead->pHead == NULL) { terrno = TSDB_CODE_WAL_OUT_OF_MEMORY; @@ -135,6 +138,22 @@ static int32_t walReadSeekVer(SWalReadHandle *pRead, int64_t ver) { return 0; } +int32_t walReadWithHandle_s(SWalReadHandle *pRead, int64_t ver, SWalReadHead **ppHead) { + taosThreadMutexLock(&pRead->mutex); + if (walReadWithHandle(pRead, ver) < 0) { + taosThreadMutexUnlock(&pRead->mutex); + return -1; + } + *ppHead = taosMemoryMalloc(sizeof(SWalReadHead) + pRead->pHead->head.len); + if (*ppHead == NULL) { + taosThreadMutexUnlock(&pRead->mutex); + return -1; + } + memcpy(*ppHead, &pRead->pHead->head, sizeof(SWalReadHead) + pRead->pHead->head.len); + taosThreadMutexUnlock(&pRead->mutex); + return 0; +} + int32_t walReadWithHandle(SWalReadHandle *pRead, int64_t ver) { int code; // TODO: check wal life @@ -145,7 +164,9 @@ int32_t walReadWithHandle(SWalReadHandle *pRead, int64_t ver) { } } - if (!taosValidFile(pRead->pReadLogTFile)) return -1; + if (!taosValidFile(pRead->pReadLogTFile)) { + return -1; + } code = taosReadFile(pRead->pReadLogTFile, pRead->pHead, sizeof(SWalHead)); if (code != sizeof(SWalHead)) { diff --git a/source/util/src/tjson.c b/source/util/src/tjson.c index 0efcf517a9..93a843fee8 100644 --- a/source/util/src/tjson.c +++ b/source/util/src/tjson.c @@ -121,7 +121,8 @@ int32_t tjsonAddItem(SJson* pJson, FToJson func, const void* pObj) { return tjsonAddItemToArray(pJson, pJobj); } -int32_t tjsonAddArray(SJson* pJson, const char* pName, FToJson func, const void* pArray, int32_t itemSize, int32_t num) { +int32_t tjsonAddArray(SJson* pJson, const char* pName, FToJson func, const void* pArray, int32_t itemSize, + int32_t num) { if (num > 0) { SJson* pJsonArray = tjsonAddArrayToObject(pJson, pName); if (NULL == pJsonArray) { @@ -168,7 +169,7 @@ int32_t tjsonGetBigIntValue(const SJson* pJson, const char* pName, int64_t* pVal } *pVal = strtol(p, NULL, 10); - return (errno == EINVAL || errno == ERANGE) ? TSDB_CODE_FAILED:TSDB_CODE_SUCCESS; + return TSDB_CODE_SUCCESS; } int32_t tjsonGetIntValue(const SJson* pJson, const char* pName, int32_t* pVal) { @@ -199,19 +200,19 @@ int32_t tjsonGetUBigIntValue(const SJson* pJson, const char* pName, uint64_t* pV } *pVal = strtoul(p, NULL, 10); - return (errno == ERANGE||errno == EINVAL) ? TSDB_CODE_FAILED:TSDB_CODE_SUCCESS; + return TSDB_CODE_SUCCESS; } int32_t tjsonGetUIntValue(const SJson* pJson, const char* pName, uint32_t* pVal) { uint64_t val = 0; - int32_t code = tjsonGetUBigIntValue(pJson, pName, &val); + int32_t code = tjsonGetUBigIntValue(pJson, pName, &val); *pVal = val; return code; } int32_t tjsonGetUTinyIntValue(const SJson* pJson, const char* pName, uint8_t* pVal) { uint64_t val = 0; - int32_t code = tjsonGetUBigIntValue(pJson, pName, &val); + int32_t code = tjsonGetUBigIntValue(pJson, pName, &val); *pVal = val; return code; } @@ -264,7 +265,7 @@ int32_t tjsonMakeObject(const SJson* pJson, const char* pName, FToObject func, v int32_t tjsonToArray(const SJson* pJson, const char* pName, FToObject func, void* pArray, int32_t itemSize) { const cJSON* jArray = tjsonGetObjectItem(pJson, pName); - int32_t size = (NULL == jArray ? 0 : tjsonGetArraySize(jArray)); + int32_t size = (NULL == jArray ? 0 : tjsonGetArraySize(jArray)); for (int32_t i = 0; i < size; ++i) { int32_t code = func(tjsonGetArrayItem(jArray, i), (char*)pArray + itemSize * i); if (TSDB_CODE_SUCCESS != code) { diff --git a/tests/script/tsim/tmq/basic1.sim b/tests/script/tsim/tmq/basic1.sim index fe6a7a0660..f84d70f711 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 2 sql show databases print $data00 $data01 $data02 if $rows != 2 then diff --git a/tests/test/c/tmqSim.c b/tests/test/c/tmqSim.c index 4d3108500e..38264331c1 100644 --- a/tests/test/c/tmqSim.c +++ b/tests/test/c/tmqSim.c @@ -226,7 +226,7 @@ void loop_consume(tmq_t* tmq) { int32_t totalRows = 0; int32_t skipLogNum = 0; while (running) { - tmq_message_t* tmqMsg = tmq_consumer_poll(tmq, 1); + tmq_message_t* tmqMsg = tmq_consumer_poll(tmq, 3000); if (tmqMsg) { totalMsgs++; From 236b8adad3d7e460b1dca075b057fb082e2ce5eb Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Thu, 31 Mar 2022 16:00:47 +0800 Subject: [PATCH 14/47] feature/qnode --- include/common/ttime.h | 1 + include/libs/qcom/query.h | 7 +- include/os/osTime.h | 8 + source/common/src/ttime.c | 29 ++- source/libs/planner/src/planLogicCreater.c | 2 +- source/libs/qcom/inc/queryInt.h | 52 ++-- source/libs/qcom/src/queryExplain.c | 290 ++++++++++++--------- source/libs/scheduler/inc/schedulerInt.h | 6 +- source/libs/scheduler/src/scheduler.c | 42 +-- 9 files changed, 263 insertions(+), 174 deletions(-) diff --git a/include/common/ttime.h b/include/common/ttime.h index 57af24e635..2209cc998f 100644 --- a/include/common/ttime.h +++ b/include/common/ttime.h @@ -62,6 +62,7 @@ int32_t taosParseTime(const char* timestr, int64_t* time, int32_t len, int32_t t void deltaToUtcInitOnce(); int64_t convertTimePrecision(int64_t time, int32_t fromPrecision, int32_t toPrecision); +int64_t convertTimeFromPrecisionToUnit(int64_t time, int32_t fromPrecision, char toUnit); void taosFormatUtcTime(char *buf, int32_t bufLen, int64_t time, int32_t precision); diff --git a/include/libs/qcom/query.h b/include/libs/qcom/query.h index dd2dccc02d..5908b0b875 100644 --- a/include/libs/qcom/query.h +++ b/include/libs/qcom/query.h @@ -174,9 +174,10 @@ bool tIsValidSchema(struct SSchema* pSchema, int32_t numOfCols, int32_ int32_t queryCreateTableMetaFromMsg(STableMetaRsp* msg, bool isSuperTable, STableMeta** pMeta); char *jobTaskStatusStr(int32_t status); -int32_t qAppendTaskExplainResRows(void **pRowCtx, void *plan, void *pExecTree, int32_t level); -int32_t qGetExplainRspFromRowCtx(void *ctx, SRetrieveTableRsp **pRsp); -void qFreeExplainRowCtx(void *ctx); +int32_t qInitExplainCtx(void **pCtx, SHashObj *groupHash, bool verbose); +int32_t qAppendTaskExplainResRows(void *pCtx, int32_t groupId, int32_t level); +int32_t qGetExplainRspFromCtx(void *ctx, SRetrieveTableRsp **pRsp); +void qFreeExplainCtx(void *ctx); SSchema createSchema(int8_t type, int32_t bytes, col_id_t colId, const char* name); diff --git a/include/os/osTime.h b/include/os/osTime.h index 9e426455dc..766fec0fbd 100644 --- a/include/os/osTime.h +++ b/include/os/osTime.h @@ -46,6 +46,14 @@ extern "C" { #define MILLISECOND_PER_DAY (MILLISECOND_PER_HOUR * 24) #define MILLISECOND_PER_WEEK (MILLISECOND_PER_DAY * 7) +#define NANOSECOND_PER_USEC (1000L) +#define NANOSECOND_PER_MSEC (1000000L) +#define NANOSECOND_PER_SEC (1000000000L) +#define NANOSECOND_PER_MINUTE (NANOSECOND_PER_SEC * 60) +#define NANOSECOND_PER_HOUR (NANOSECOND_PER_MINUTE * 60) +#define NANOSECOND_PER_DAY (NANOSECOND_PER_HOUR * 24) +#define NANOSECOND_PER_WEEK (NANOSECOND_PER_DAY * 7) + int32_t taosGetTimeOfDay(struct timeval *tv); //@return timestamp in second diff --git a/source/common/src/ttime.c b/source/common/src/ttime.c index 510a2809e7..23b19b55e7 100644 --- a/source/common/src/ttime.c +++ b/source/common/src/ttime.c @@ -370,6 +370,33 @@ int64_t convertTimePrecision(int64_t time, int32_t fromPrecision, int32_t toPrec return (int64_t)((double)time * factors[fromPrecision][toPrecision]); } +int64_t convertTimeFromPrecisionToUnit(int64_t time, int32_t fromPrecision, char toUnit) { + assert(fromPrecision == TSDB_TIME_PRECISION_MILLI || fromPrecision == TSDB_TIME_PRECISION_MICRO || + fromPrecision == TSDB_TIME_PRECISION_NANO); + static double factors[3] = {1000000., 1000., 1.}; + switch (toUnit) { + case 's': + return time * factors[fromPrecision] / NANOSECOND_PER_SEC; + case 'm': + return time * factors[fromPrecision] / NANOSECOND_PER_MINUTE; + case 'h': + return time * factors[fromPrecision] / NANOSECOND_PER_HOUR; + case 'd': + return time * factors[fromPrecision] / NANOSECOND_PER_DAY; + case 'w': + return time * factors[fromPrecision] / NANOSECOND_PER_WEEK; + case 'a': + return time * factors[fromPrecision] / NANOSECOND_PER_MSEC; + case 'u': + return time * factors[fromPrecision] / NANOSECOND_PER_USEC; + case 'b': + return time * factors[fromPrecision]; + default: { + return -1; + } + } +} + static int32_t getDuration(int64_t val, char unit, int64_t* result, int32_t timePrecision) { switch (unit) { case 's': @@ -688,4 +715,4 @@ void taosFormatUtcTime(char* buf, int32_t bufLen, int64_t t, int32_t precision) length += (int32_t)strftime(ts + length, 40 - length, "%z", ptm); tstrncpy(buf, ts, bufLen); -} \ No newline at end of file +} diff --git a/source/libs/planner/src/planLogicCreater.c b/source/libs/planner/src/planLogicCreater.c index 7f6d8826e6..f57f476d51 100644 --- a/source/libs/planner/src/planLogicCreater.c +++ b/source/libs/planner/src/planLogicCreater.c @@ -288,7 +288,7 @@ static int32_t createJoinLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect // set the output if (TSDB_CODE_SUCCESS == code) { pJoin->node.pTargets = nodesCloneList(pLeft->pTargets); - if (NULL == pJoin->pOnConditions) { + if (NULL == pJoin->node.pTargets) { code = TSDB_CODE_OUT_OF_MEMORY; } if (TSDB_CODE_SUCCESS == code) { diff --git a/source/libs/qcom/inc/queryInt.h b/source/libs/qcom/inc/queryInt.h index 510ba92a86..06d5b07dc7 100644 --- a/source/libs/qcom/inc/queryInt.h +++ b/source/libs/qcom/inc/queryInt.h @@ -23,25 +23,34 @@ extern "C" { #include "plannodes.h" //newline area -#define EXPLAIN_TAG_SCAN_FORMAT "Tag scan on %s columns=%d" -#define EXPLAIN_TBL_SCAN_FORMAT "Table scan on %s columns=%d" -#define EXPLAIN_SYSTBL_SCAN_FORMAT "System table scan on %s columns=%d" +#define EXPLAIN_TAG_SCAN_FORMAT "Tag Scan on %s columns=%d" +#define EXPLAIN_TBL_SCAN_FORMAT "Table Scan on %s columns=%d" +#define EXPLAIN_SYSTBL_SCAN_FORMAT "System Table Scan on %s columns=%d" #define EXPLAIN_PROJECTION_FORMAT "Projection columns=%d width=%d" #define EXPLAIN_JOIN_FORMAT "%s between %d tables width=%d" -#define EXPLAIN_AGG_FORMAT "Aggragate functions=%d groups=%d width=%d" -#define EXPLAIN_EXCHANGE_FORMAT "Exchange %d:1 width=%d" -#define EXPLAIN_SORT_FORMAT "Sort on %d columns width=%d" -#define EXPLAIN_INTERVAL_FORMAT "Interval on column %s functions=%d interval=%" PRId64 "%c offset=%" PRId64 "%c sliding=%" PRId64 "%c width=%d" +#define EXPLAIN_AGG_FORMAT "Aggragate functions=%d" +#define EXPLAIN_EXCHANGE_FORMAT "Data Exchange %d:1 width=%d" +#define EXPLAIN_SORT_FORMAT "Sort on %d Column(s) width=%d" +#define EXPLAIN_INTERVAL_FORMAT "Interval on Column %s functions=%d interval=%" PRId64 "%c offset=%" PRId64 "%c sliding=%" PRId64 "%c width=%d" #define EXPLAIN_SESSION_FORMAT "Session gap=%" PRId64 " functions=%d width=%d" #define EXPLAIN_ORDER_FORMAT "Order: %s" #define EXPLAIN_FILTER_FORMAT "Filter: " #define EXPLAIN_FILL_FORMAT "Fill: %s" #define EXPLAIN_ON_CONDITIONS_FORMAT "Join Cond: " -#define EXPLAIN_TIMERANGE_FORMAT "Time range: [%" PRId64 ", %" PRId64 "]" +#define EXPLAIN_TIMERANGE_FORMAT "Time Range: [%" PRId64 ", %" PRId64 "]" //append area -#define EXPLAIN_LOOPS_FORMAT "loops=%d" -#define EXPLAIN_REVERSE_FORMAT "reverse=%d" +#define EXPLAIN_GROUPS_FORMAT " groups=%d" +#define EXPLAIN_WIDTH_FORMAT " width=%d" +#define EXPLAIN_LOOPS_FORMAT " loops=%d" +#define EXPLAIN_REVERSE_FORMAT " reverse=%d" + +//TODO MOVE TO LIB +typedef struct SExplainGroup { + int32_t nodeNum; + SSubplan *plan; + void *execInfo; //TODO +} SExplainGroup; typedef struct SExplainResNode { @@ -56,22 +65,27 @@ typedef struct SQueryExplainRowInfo { char *buf; } SQueryExplainRowInfo; -typedef struct SExplainRowCtx { - int32_t totalSize; - SArray *rows; -} SExplainRowCtx; +typedef struct SExplainCtx { + int32_t totalSize; + bool verbose; + char *tbuf; + SArray *rows; + SHashObj *groupHash; +} SExplainCtx; #define EXPLAIN_ORDER_STRING(_order) ((TSDB_ORDER_ASC == _order) ? "Ascending" : "Descending") #define EXPLAIN_JOIN_STRING(_type) ((JOIN_TYPE_INNER == _type) ? "Inner join" : "Join") -#define EXPLAIN_ROW_NEW(level, ...) \ - do { \ - tlen = snprintf(tbuf + VARSTR_HEADER_SIZE, TSDB_EXPLAIN_RESULT_ROW_SIZE, "%*s", (level) * 2, ""); \ - tlen += snprintf(tbuf + VARSTR_HEADER_SIZE + tlen, TSDB_EXPLAIN_RESULT_ROW_SIZE - tlen, __VA_ARGS__); \ +#define INVERAL_TIME_FROM_PRECISION_TO_UNIT(_t, _u, _p) (((_u) == 'n' || (_u) == 'y') ? (_t) : (convertTimeFromPrecisionToUnit(_t, _p, _u))) + +#define EXPLAIN_ROW_NEW(level, ...) \ + do { \ + tlen = snprintf(tbuf + VARSTR_HEADER_SIZE, TSDB_EXPLAIN_RESULT_ROW_SIZE, "%*s%s", (level) * 2, "", (isVerboseLine ? "" : "-> ")); \ + tlen += snprintf(tbuf + VARSTR_HEADER_SIZE + tlen, TSDB_EXPLAIN_RESULT_ROW_SIZE - tlen, __VA_ARGS__); \ } while (0) #define EXPLAIN_ROW_APPEND(...) tlen += snprintf(tbuf + VARSTR_HEADER_SIZE + tlen, TSDB_EXPLAIN_RESULT_ROW_SIZE - tlen, __VA_ARGS__) -#define EXPLAIN_ROW_END() do { varDataSetLen(tbuf, tlen); tlen += VARSTR_HEADER_SIZE; } while (0) +#define EXPLAIN_ROW_END() do { varDataSetLen(tbuf, tlen); tlen += VARSTR_HEADER_SIZE; isVerboseLine = true; } while (0) #define QRY_ERR_RET(c) do { int32_t _code = c; if (_code != TSDB_CODE_SUCCESS) { terrno = _code; return _code; } } while (0) #define QRY_RET(c) do { int32_t _code = c; if (_code != TSDB_CODE_SUCCESS) { terrno = _code; } return _code; } while (0) diff --git a/source/libs/qcom/src/queryExplain.c b/source/libs/qcom/src/queryExplain.c index b2b061cee0..af092e842e 100644 --- a/source/libs/qcom/src/queryExplain.c +++ b/source/libs/qcom/src/queryExplain.c @@ -36,22 +36,62 @@ void qFreeExplainResTree(SExplainResNode *res) { taosMemoryFreeClear(res); } -void qFreeExplainRowCtx(void *ctx) { +void qFreeExplainCtx(void *ctx) { if (NULL == ctx) { return; } - SExplainRowCtx *pCtx = (SExplainRowCtx *)ctx; + SExplainCtx *pCtx = (SExplainCtx *)ctx; int32_t rowSize = taosArrayGetSize(pCtx->rows); for (int32_t i = 0; i < rowSize; ++i) { SQueryExplainRowInfo *row = taosArrayGet(pCtx->rows, i); taosMemoryFreeClear(row->buf); } + taosHashCleanup(pCtx->groupHash); taosArrayDestroy(pCtx->rows); taosMemoryFree(pCtx); } +int32_t qInitExplainCtx(void **pCtx, SHashObj *groupHash, bool verbose) { + int32_t code = 0; + SExplainCtx *ctx = taosMemoryCalloc(1, sizeof(SExplainCtx)); + if (NULL == ctx) { + qError("calloc SExplainCtx failed"); + QRY_ERR_JRET(TSDB_CODE_QRY_OUT_OF_MEMORY); + } + + SArray *rows = taosArrayInit(10, sizeof(SQueryExplainRowInfo)); + if (NULL == rows) { + qError("taosArrayInit SQueryExplainRowInfo failed"); + QRY_ERR_JRET(TSDB_CODE_QRY_OUT_OF_MEMORY); + } + + char *tbuf = taosMemoryMalloc(TSDB_EXPLAIN_RESULT_ROW_SIZE); + if (NULL == tbuf) { + qError("malloc size %d failed", TSDB_EXPLAIN_RESULT_ROW_SIZE); + QRY_ERR_JRET(TSDB_CODE_QRY_OUT_OF_MEMORY); + } + + ctx->verbose = verbose; + ctx->tbuf = tbuf; + ctx->rows = rows; + ctx->groupHash = groupHash; + + *pCtx = ctx; + + return TSDB_CODE_SUCCESS; + +_return: + + taosArrayDestroy(rows); + taosHashCleanup(groupHash); + taosMemoryFree(ctx); + + QRY_RET(code); +} + + char *qFillModeString(EFillMode mode) { switch (mode) { case FILL_MODE_NONE: @@ -187,11 +227,6 @@ _return: QRY_RET(code); } -int32_t qGenerateExplainResNodeTree(struct SSubplan *plan, void *pExecTree, SExplainResNode **pRes) { - void *pExecInfo = NULL; // TODO - QRY_RET(qGenerateExplainResNode(plan->pNode, pExecInfo, pRes)); -} - int32_t qExplainBufAppendExecInfo(void *pExecInfo, char *tbuf, int32_t *len) { int32_t tlen = *len; @@ -202,7 +237,7 @@ int32_t qExplainBufAppendExecInfo(void *pExecInfo, char *tbuf, int32_t *len) { return TSDB_CODE_SUCCESS; } -int32_t qExplainResAppendRow(SExplainRowCtx *ctx, char *tbuf, int32_t len, int32_t level) { +int32_t qExplainResAppendRow(SExplainCtx *ctx, char *tbuf, int32_t len, int32_t level) { SQueryExplainRowInfo row = {0}; row.buf = taosMemoryMalloc(len); if (NULL == row.buf) { @@ -225,8 +260,11 @@ int32_t qExplainResAppendRow(SExplainRowCtx *ctx, char *tbuf, int32_t len, int32 } -int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainRowCtx *ctx, char *tbuf, int32_t level) { +int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, int32_t level) { int32_t tlen = 0; + bool isVerboseLine = false; + char *tbuf = ctx->tbuf; + bool verbose = ctx->verbose; SPhysiNode* pNode = pResNode->pNode; if (NULL == pNode) { qError("pyhsical node in explain res node is NULL"); @@ -246,10 +284,12 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainRowCtx *ctx } EXPLAIN_ROW_END(); QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level)); - - EXPLAIN_ROW_NEW(level + 1, EXPLAIN_ORDER_FORMAT, EXPLAIN_ORDER_STRING(pTagScanNode->order)); - EXPLAIN_ROW_END(); - QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); + + if (verbose) { + EXPLAIN_ROW_NEW(level + 1, EXPLAIN_ORDER_FORMAT, EXPLAIN_ORDER_STRING(pTagScanNode->order)); + EXPLAIN_ROW_END(); + QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); + } break; } case QUERY_NODE_PHYSICAL_PLAN_TABLE_SEQ_SCAN: @@ -265,20 +305,22 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainRowCtx *ctx } EXPLAIN_ROW_END(); QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level)); - - EXPLAIN_ROW_NEW(level + 1, EXPLAIN_ORDER_FORMAT, EXPLAIN_ORDER_STRING(pTblScanNode->scan.order)); - EXPLAIN_ROW_END(); - QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); - - EXPLAIN_ROW_NEW(level + 1, EXPLAIN_TIMERANGE_FORMAT, pTblScanNode->scanRange.skey, pTblScanNode->scanRange.ekey); - EXPLAIN_ROW_END(); - QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); - if (pTblScanNode->scan.node.pConditions) { - EXPLAIN_ROW_NEW(level + 1, EXPLAIN_FILTER_FORMAT); - QRY_ERR_RET(nodesNodeToSQL(pTblScanNode->scan.node.pConditions, tbuf, TSDB_EXPLAIN_RESULT_ROW_SIZE, &tlen)); + if (verbose) { + EXPLAIN_ROW_NEW(level + 1, EXPLAIN_ORDER_FORMAT, EXPLAIN_ORDER_STRING(pTblScanNode->scan.order)); EXPLAIN_ROW_END(); QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); + + EXPLAIN_ROW_NEW(level + 1, EXPLAIN_TIMERANGE_FORMAT, pTblScanNode->scanRange.skey, pTblScanNode->scanRange.ekey); + EXPLAIN_ROW_END(); + QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); + + if (pTblScanNode->scan.node.pConditions) { + EXPLAIN_ROW_NEW(level + 1, EXPLAIN_FILTER_FORMAT); + QRY_ERR_RET(nodesNodeToSQL(pTblScanNode->scan.node.pConditions, tbuf, TSDB_EXPLAIN_RESULT_ROW_SIZE, &tlen)); + EXPLAIN_ROW_END(); + QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); + } } break; } @@ -294,10 +336,12 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainRowCtx *ctx } EXPLAIN_ROW_END(); QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level)); - - EXPLAIN_ROW_NEW(level + 1, EXPLAIN_ORDER_FORMAT, EXPLAIN_ORDER_STRING(pSTblScanNode->scan.order)); - EXPLAIN_ROW_END(); - QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); + + if (verbose) { + EXPLAIN_ROW_NEW(level + 1, EXPLAIN_ORDER_FORMAT, EXPLAIN_ORDER_STRING(pSTblScanNode->scan.order)); + EXPLAIN_ROW_END(); + QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); + } break; } case QUERY_NODE_PHYSICAL_PLAN_PROJECT:{ @@ -309,11 +353,13 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainRowCtx *ctx EXPLAIN_ROW_END(); QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level)); - if (pPrjNode->node.pConditions) { - EXPLAIN_ROW_NEW(level + 1, EXPLAIN_FILTER_FORMAT); - QRY_ERR_RET(nodesNodeToSQL(pPrjNode->node.pConditions, tbuf, TSDB_EXPLAIN_RESULT_ROW_SIZE, &tlen)); - EXPLAIN_ROW_END(); - QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); + if (verbose) { + if (pPrjNode->node.pConditions) { + EXPLAIN_ROW_NEW(level + 1, EXPLAIN_FILTER_FORMAT); + QRY_ERR_RET(nodesNodeToSQL(pPrjNode->node.pConditions, tbuf, TSDB_EXPLAIN_RESULT_ROW_SIZE, &tlen)); + EXPLAIN_ROW_END(); + QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); + } } break; } @@ -326,51 +372,70 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainRowCtx *ctx EXPLAIN_ROW_END(); QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level)); - if (pJoinNode->node.pConditions) { - EXPLAIN_ROW_NEW(level + 1, EXPLAIN_FILTER_FORMAT); - QRY_ERR_RET(nodesNodeToSQL(pJoinNode->node.pConditions, tbuf, TSDB_EXPLAIN_RESULT_ROW_SIZE, &tlen)); + if (verbose) { + if (pJoinNode->node.pConditions) { + EXPLAIN_ROW_NEW(level + 1, EXPLAIN_FILTER_FORMAT); + QRY_ERR_RET(nodesNodeToSQL(pJoinNode->node.pConditions, tbuf, TSDB_EXPLAIN_RESULT_ROW_SIZE, &tlen)); + EXPLAIN_ROW_END(); + QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); + } + + EXPLAIN_ROW_NEW(level + 1, EXPLAIN_ON_CONDITIONS_FORMAT); + QRY_ERR_RET(nodesNodeToSQL(pJoinNode->pOnConditions, tbuf, TSDB_EXPLAIN_RESULT_ROW_SIZE, &tlen)); EXPLAIN_ROW_END(); QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); } - - EXPLAIN_ROW_NEW(level + 1, EXPLAIN_ON_CONDITIONS_FORMAT); - QRY_ERR_RET(nodesNodeToSQL(pJoinNode->pOnConditions, tbuf, TSDB_EXPLAIN_RESULT_ROW_SIZE, &tlen)); - EXPLAIN_ROW_END(); - QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); break; } case QUERY_NODE_PHYSICAL_PLAN_AGG:{ SAggPhysiNode *pAggNode = (SAggPhysiNode *)pNode; - EXPLAIN_ROW_NEW(level, EXPLAIN_AGG_FORMAT, pAggNode->pAggFuncs->length, pAggNode->pGroupKeys->length, pAggNode->node.pOutputDataBlockDesc->outputRowSize); + EXPLAIN_ROW_NEW(level, EXPLAIN_AGG_FORMAT, pAggNode->pAggFuncs->length); + if (pAggNode->pGroupKeys) { + EXPLAIN_ROW_APPEND(EXPLAIN_GROUPS_FORMAT, pAggNode->pGroupKeys->length); + } + EXPLAIN_ROW_APPEND(EXPLAIN_WIDTH_FORMAT, pAggNode->node.pOutputDataBlockDesc->outputRowSize); + if (pResNode->pExecInfo) { QRY_ERR_RET(qExplainBufAppendExecInfo(pResNode->pExecInfo, tbuf, &tlen)); } EXPLAIN_ROW_END(); QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level)); - if (pAggNode->node.pConditions) { - EXPLAIN_ROW_NEW(level + 1, EXPLAIN_FILTER_FORMAT); - QRY_ERR_RET(nodesNodeToSQL(pAggNode->node.pConditions, tbuf, TSDB_EXPLAIN_RESULT_ROW_SIZE, &tlen)); - EXPLAIN_ROW_END(); - QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); + if (verbose) { + if (pAggNode->node.pConditions) { + EXPLAIN_ROW_NEW(level + 1, EXPLAIN_FILTER_FORMAT); + QRY_ERR_RET(nodesNodeToSQL(pAggNode->node.pConditions, tbuf, TSDB_EXPLAIN_RESULT_ROW_SIZE, &tlen)); + EXPLAIN_ROW_END(); + QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); + } } break; } case QUERY_NODE_PHYSICAL_PLAN_EXCHANGE:{ SExchangePhysiNode *pExchNode = (SExchangePhysiNode *)pNode; - EXPLAIN_ROW_NEW(level, EXPLAIN_EXCHANGE_FORMAT, pExchNode->pSrcEndPoints->length, pExchNode->node.pOutputDataBlockDesc->outputRowSize); + SExplainGroup *group = taosHashGet(ctx->groupHash, &pExchNode->srcGroupId, sizeof(pExchNode->srcGroupId)); + if (NULL == group) { + qError("exchange src group %d not in groupHash", pExchNode->srcGroupId); + QRY_ERR_RET(TSDB_CODE_QRY_APP_ERROR); + } + + EXPLAIN_ROW_NEW(level, EXPLAIN_EXCHANGE_FORMAT, group->nodeNum, pExchNode->node.pOutputDataBlockDesc->outputRowSize); if (pResNode->pExecInfo) { QRY_ERR_RET(qExplainBufAppendExecInfo(pResNode->pExecInfo, tbuf, &tlen)); } EXPLAIN_ROW_END(); QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level)); - if (pExchNode->node.pConditions) { - EXPLAIN_ROW_NEW(level + 1, EXPLAIN_FILTER_FORMAT); - QRY_ERR_RET(nodesNodeToSQL(pExchNode->node.pConditions, tbuf, TSDB_EXPLAIN_RESULT_ROW_SIZE, &tlen)); - EXPLAIN_ROW_END(); - QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); + if (verbose) { + if (pExchNode->node.pConditions) { + EXPLAIN_ROW_NEW(level + 1, EXPLAIN_FILTER_FORMAT); + QRY_ERR_RET(nodesNodeToSQL(pExchNode->node.pConditions, tbuf, TSDB_EXPLAIN_RESULT_ROW_SIZE, &tlen)); + EXPLAIN_ROW_END(); + QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); + } } + + QRY_ERR_RET(qAppendTaskExplainResRows(ctx, pExchNode->srcGroupId, level + 1)); break; } case QUERY_NODE_PHYSICAL_PLAN_SORT:{ @@ -382,35 +447,42 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainRowCtx *ctx EXPLAIN_ROW_END(); QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level)); - if (pSortNode->node.pConditions) { - EXPLAIN_ROW_NEW(level + 1, EXPLAIN_FILTER_FORMAT); - QRY_ERR_RET(nodesNodeToSQL(pSortNode->node.pConditions, tbuf, TSDB_EXPLAIN_RESULT_ROW_SIZE, &tlen)); - EXPLAIN_ROW_END(); - QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); + if (verbose) { + if (pSortNode->node.pConditions) { + EXPLAIN_ROW_NEW(level + 1, EXPLAIN_FILTER_FORMAT); + QRY_ERR_RET(nodesNodeToSQL(pSortNode->node.pConditions, tbuf, TSDB_EXPLAIN_RESULT_ROW_SIZE, &tlen)); + EXPLAIN_ROW_END(); + QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); + } } break; } case QUERY_NODE_PHYSICAL_PLAN_INTERVAL:{ SIntervalPhysiNode *pIntNode = (SIntervalPhysiNode *)pNode; EXPLAIN_ROW_NEW(level, EXPLAIN_INTERVAL_FORMAT, qGetNameFromColumnNode(pIntNode->pTspk), pIntNode->window.pFuncs->length, - pIntNode->interval, pIntNode->intervalUnit, pIntNode->offset, pIntNode->intervalUnit, pIntNode->sliding, pIntNode->slidingUnit, pIntNode->window.node.pOutputDataBlockDesc->outputRowSize); + INVERAL_TIME_FROM_PRECISION_TO_UNIT(pIntNode->interval, pIntNode->intervalUnit, pIntNode->precision), pIntNode->intervalUnit, + INVERAL_TIME_FROM_PRECISION_TO_UNIT(pIntNode->offset, pIntNode->intervalUnit, pIntNode->precision), pIntNode->intervalUnit, + INVERAL_TIME_FROM_PRECISION_TO_UNIT(pIntNode->sliding, pIntNode->slidingUnit, pIntNode->precision), pIntNode->slidingUnit, + pIntNode->window.node.pOutputDataBlockDesc->outputRowSize); if (pResNode->pExecInfo) { QRY_ERR_RET(qExplainBufAppendExecInfo(pResNode->pExecInfo, tbuf, &tlen)); } EXPLAIN_ROW_END(); QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level)); - if (pIntNode->pFill) { - EXPLAIN_ROW_NEW(level + 1, EXPLAIN_FILL_FORMAT, qFillModeString(pIntNode->pFill->mode)); - EXPLAIN_ROW_END(); - QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); - } + if (verbose) { + if (pIntNode->pFill) { + EXPLAIN_ROW_NEW(level + 1, EXPLAIN_FILL_FORMAT, qFillModeString(pIntNode->pFill->mode)); + EXPLAIN_ROW_END(); + QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); + } - if (pIntNode->window.node.pConditions) { - EXPLAIN_ROW_NEW(level + 1, EXPLAIN_FILTER_FORMAT); - QRY_ERR_RET(nodesNodeToSQL(pIntNode->window.node.pConditions, tbuf, TSDB_EXPLAIN_RESULT_ROW_SIZE, &tlen)); - EXPLAIN_ROW_END(); - QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); + if (pIntNode->window.node.pConditions) { + EXPLAIN_ROW_NEW(level + 1, EXPLAIN_FILTER_FORMAT); + QRY_ERR_RET(nodesNodeToSQL(pIntNode->window.node.pConditions, tbuf, TSDB_EXPLAIN_RESULT_ROW_SIZE, &tlen)); + EXPLAIN_ROW_END(); + QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); + } } break; } @@ -423,11 +495,13 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainRowCtx *ctx EXPLAIN_ROW_END(); QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level)); - if (pIntNode->window.node.pConditions) { - EXPLAIN_ROW_NEW(level + 1, EXPLAIN_FILTER_FORMAT); - QRY_ERR_RET(nodesNodeToSQL(pIntNode->window.node.pConditions, tbuf, TSDB_EXPLAIN_RESULT_ROW_SIZE, &tlen)); - EXPLAIN_ROW_END(); - QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); + if (verbose) { + if (pIntNode->window.node.pConditions) { + EXPLAIN_ROW_NEW(level + 1, EXPLAIN_FILTER_FORMAT); + QRY_ERR_RET(nodesNodeToSQL(pIntNode->window.node.pConditions, tbuf, TSDB_EXPLAIN_RESULT_ROW_SIZE, &tlen)); + EXPLAIN_ROW_END(); + QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); + } } break; } @@ -440,88 +514,48 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainRowCtx *ctx } -int32_t qExplainResNodeToRows(SExplainResNode *pResNode, SExplainRowCtx *ctx, char *tbuf, int32_t level) { +int32_t qExplainResNodeToRows(SExplainResNode *pResNode, SExplainCtx *ctx, int32_t level) { if (NULL == pResNode) { qError("explain res node is NULL"); QRY_ERR_RET(TSDB_CODE_QRY_APP_ERROR); } int32_t code = 0; - QRY_ERR_RET(qExplainResNodeToRowsImpl(pResNode, ctx, tbuf, level)); + QRY_ERR_RET(qExplainResNodeToRowsImpl(pResNode, ctx, level)); SNode* pNode = NULL; FOREACH(pNode, pResNode->pChildren) { - QRY_ERR_RET(qExplainResNodeToRows((SExplainResNode *)pNode, ctx, tbuf, level + 1)); + QRY_ERR_RET(qExplainResNodeToRows((SExplainResNode *)pNode, ctx, level + 1)); } return TSDB_CODE_SUCCESS; } -int32_t qGenerateExplainResRowsFromNode(SExplainResNode *pResNode, SExplainRowCtx *ctx, int32_t level) { - if (NULL == pResNode) { - qError("explain res node is NULL"); - QRY_RET(TSDB_CODE_QRY_APP_ERROR); - } - - int32_t code = 0; - char *tbuf = taosMemoryMalloc(TSDB_EXPLAIN_RESULT_ROW_SIZE); - if (NULL == tbuf) { - qError("malloc size %d failed", TSDB_EXPLAIN_RESULT_ROW_SIZE); - QRY_RET(TSDB_CODE_QRY_OUT_OF_MEMORY); - } - - QRY_ERR_JRET(qExplainResNodeToRows(pResNode, ctx, tbuf, level)); - -_return: - - taosMemoryFree(tbuf); - - QRY_RET(code); -} - -int32_t qAppendTaskExplainResRows(void **pRowCtx, void *plan, void *pExecTree, int32_t level) { +int32_t qAppendTaskExplainResRows(void *pCtx, int32_t groupId, int32_t level) { SExplainResNode *node = NULL; int32_t code = 0; - struct SSubplan *pPlan = (struct SSubplan *)plan; - SExplainRowCtx *ctx = (SExplainRowCtx *)*pRowCtx; - - QRY_ERR_RET(qGenerateExplainResNodeTree(pPlan, pExecTree, &node)); + SExplainCtx *ctx = (SExplainCtx *)pCtx; - if (NULL == *pRowCtx) { - *pRowCtx = taosMemoryCalloc(1, sizeof(SExplainRowCtx)); - if (NULL == *pRowCtx) { - qError("calloc SExplainRowCtx failed"); - QRY_ERR_JRET(TSDB_CODE_QRY_OUT_OF_MEMORY); - } - - ctx = (SExplainRowCtx *)*pRowCtx; - - SArray *rows = taosArrayInit(10, sizeof(SQueryExplainRowInfo)); - if (NULL == rows) { - qError("taosArrayInit SQueryExplainRowInfo failed"); - QRY_ERR_JRET(TSDB_CODE_QRY_OUT_OF_MEMORY); - } - - ctx->rows = rows; + SExplainGroup *group = taosHashGet(ctx->groupHash, &groupId, sizeof(groupId)); + if (NULL == group) { + qError("group %d not in groupHash", groupId); + QRY_ERR_RET(TSDB_CODE_QRY_APP_ERROR); } + + QRY_ERR_RET(qGenerateExplainResNode(group->plan->pNode, group->execInfo, &node)); - QRY_ERR_JRET(qGenerateExplainResRowsFromNode(node, ctx, level)); + QRY_ERR_JRET(qExplainResNodeToRows(node, ctx, level)); _return: qFreeExplainResTree(node); - - if (code) { - qFreeExplainRowCtx(*pRowCtx); - *pRowCtx = NULL; - } QRY_RET(code); } -int32_t qGetExplainRspFromRowCtx(void *ctx, SRetrieveTableRsp **pRsp) { - SExplainRowCtx *pCtx = (SExplainRowCtx *)ctx; +int32_t qGetExplainRspFromCtx(void *ctx, SRetrieveTableRsp **pRsp) { + SExplainCtx *pCtx = (SExplainCtx *)ctx; int32_t rowNum = taosArrayGetSize(pCtx->rows); if (rowNum <= 0) { qError("empty explain res rows"); diff --git a/source/libs/scheduler/inc/schedulerInt.h b/source/libs/scheduler/inc/schedulerInt.h index 1b2c7d54e2..f19e822974 100644 --- a/source/libs/scheduler/inc/schedulerInt.h +++ b/source/libs/scheduler/inc/schedulerInt.h @@ -38,10 +38,12 @@ enum { SCH_WRITE, }; -typedef struct SSchExplainGroup { +//TODO MOVE TO LIB +typedef struct SExplainGroup { int32_t nodeNum; SSubplan *plan; -} SSchExplainGroup; + void *execInfo; //TODO +} SExplainGroup; typedef struct SSchTrans { void *transInst; diff --git a/source/libs/scheduler/src/scheduler.c b/source/libs/scheduler/src/scheduler.c index 4a84536d00..940aaed7c1 100644 --- a/source/libs/scheduler/src/scheduler.c +++ b/source/libs/scheduler/src/scheduler.c @@ -478,7 +478,14 @@ _return: int32_t schValidateAndBuildJobExplain(SQueryPlan *pDag, SSchJob *pJob) { int32_t code = 0; + SNodeListNode *plans = NULL; + int32_t taskNum = 0; + SExplainGroup *pGroup = NULL; + void *pCtx = NULL; + int32_t rootGroupId = 0; + pJob->queryId = pDag->queryId; + pJob->subPlans = pDag->pSubplans; if (pDag->numOfSubplans <= 0) { SCH_JOB_ELOG("invalid subplan num:%d", pDag->numOfSubplans); @@ -497,12 +504,7 @@ int32_t schValidateAndBuildJobExplain(SQueryPlan *pDag, SSchJob *pJob) { SCH_ERR_RET(TSDB_CODE_QRY_OUT_OF_MEMORY); } - pJob->subPlans = pDag->pSubplans; - - SNodeListNode *plans = NULL; - int32_t taskNum = 0; - SSchExplainGroup *pGroup = NULL; - void *rowCtx = NULL; + SCH_ERR_JRET(qInitExplainCtx(&pCtx, groupHash, pDag->explainInfo.verbose)); for (int32_t i = 0; i < levelNum; ++i) { plans = (SNodeListNode *)nodesListGetNode(pDag->pSubplans, i); @@ -517,44 +519,44 @@ int32_t schValidateAndBuildJobExplain(SQueryPlan *pDag, SSchJob *pJob) { SCH_ERR_JRET(TSDB_CODE_QRY_INVALID_INPUT); } + SSubplan *plan = NULL; for (int32_t n = 0; n < taskNum; ++n) { - SSubplan *plan = (SSubplan *)nodesListGetNode(plans->pNodeList, n); + plan = (SSubplan *)nodesListGetNode(plans->pNodeList, n); pGroup = taosHashGet(groupHash, &plan->id.groupId, sizeof(plan->id.groupId)); if (pGroup) { ++pGroup->nodeNum; continue; } - SSchExplainGroup group = {.nodeNum = 1, .plan = plan}; + SExplainGroup group = {.nodeNum = 1, .plan = plan, .execInfo = NULL}; if (0 != taosHashPut(groupHash, &plan->id.groupId, sizeof(plan->id.groupId), &group, sizeof(group))) { SCH_JOB_ELOG("taosHashPut to explainGroupHash failed, taskIdx:%d", n); SCH_ERR_JRET(TSDB_CODE_QRY_OUT_OF_MEMORY); } } - void *pIter = taosHashIterate(groupHash, NULL); - while (pIter) { - pGroup = (SSchExplainGroup *)pIter; + if (0 == i) { + if (taskNum > 1) { + SCH_JOB_ELOG("invalid taskNum %d for level 0", taskNum); + SCH_ERR_JRET(TSDB_CODE_QRY_INVALID_INPUT); + } - SCH_ERR_JRET(qAppendTaskExplainResRows(&rowCtx, pGroup->plan, NULL, i)); - - pIter = taosHashIterate(groupHash, pIter); + rootGroupId = plan->id.groupId; } - taosHashClear(groupHash); - - SCH_JOB_DLOG("level initialized, taskNum:%d", taskNum); + SCH_JOB_DLOG("level %d group handled, taskNum:%d", i, taskNum); } + SCH_ERR_JRET(qAppendTaskExplainResRows(pCtx, rootGroupId, 0)); + SRetrieveTableRsp *pRsp = NULL; - SCH_ERR_JRET(qGetExplainRspFromRowCtx(rowCtx, &pRsp)); + SCH_ERR_JRET(qGetExplainRspFromCtx(pCtx, &pRsp)); pJob->resData = pRsp; _return: - taosHashCleanup(groupHash); - qFreeExplainRowCtx(rowCtx); + qFreeExplainCtx(pCtx); SCH_RET(code); } From 59862e454d55adc585ee2f7711dacc677a2d2c57 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Thu, 31 Mar 2022 04:01:07 -0400 Subject: [PATCH 15/47] TD-14429 bugfix --- source/client/src/clientImpl.c | 5 +++++ source/libs/parser/src/parTranslater.c | 9 +++++++-- source/util/src/tjson.c | 4 ++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index f0d5941141..8cd53f18b0 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -181,6 +181,11 @@ int32_t execLocalCmd(SRequestObj* pRequest, SQuery* pQuery) { } int32_t execDdlQuery(SRequestObj* pRequest, SQuery* pQuery) { + // drop table if exists not_exists_table + if (NULL == pQuery->pCmdMsg) { + return TSDB_CODE_SUCCESS; + } + SCmdMsgInfo* pMsgInfo = pQuery->pCmdMsg; pRequest->type = pMsgInfo->msgType; pRequest->body.requestMsg = (SDataBuf){.pData = pMsgInfo->pMsg, .len = pMsgInfo->msgLen, .handle = NULL}; diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 9468b9f16a..a8ef762a73 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -1217,6 +1217,9 @@ static int32_t translateDropTable(STranslateContext* pCxt, SDropTableStmt* pStmt SName tableName; int32_t code = getTableMetaImpl( pCxt, toName(pCxt->pParseCxt->acctId, pClause->dbName, pClause->tableName, &tableName), &pTableMeta); + if ((TSDB_CODE_TDB_INVALID_TABLE_ID == code || TSDB_CODE_VND_TB_NOT_EXIST == code) && pClause->ignoreNotExists) { + return TSDB_CODE_SUCCESS; + } if (TSDB_CODE_SUCCESS == code) { if (TSDB_SUPER_TABLE == pTableMeta->tableType) { code = doTranslateDropSuperTable(pCxt, &tableName, pClause->ignoreNotExists); @@ -2592,8 +2595,10 @@ static int32_t setQuery(STranslateContext* pCxt, SQuery* pQuery) { break; default: pQuery->directRpc = true; - TSWAP(pQuery->pCmdMsg, pCxt->pCmdMsg, SCmdMsgInfo*); - pQuery->msgType = pQuery->pCmdMsg->msgType; + if (NULL != pCxt->pCmdMsg) { + TSWAP(pQuery->pCmdMsg, pCxt->pCmdMsg, SCmdMsgInfo*); + pQuery->msgType = pQuery->pCmdMsg->msgType; + } break; } diff --git a/source/util/src/tjson.c b/source/util/src/tjson.c index 0efcf517a9..ea98611b9b 100644 --- a/source/util/src/tjson.c +++ b/source/util/src/tjson.c @@ -168,7 +168,7 @@ int32_t tjsonGetBigIntValue(const SJson* pJson, const char* pName, int64_t* pVal } *pVal = strtol(p, NULL, 10); - return (errno == EINVAL || errno == ERANGE) ? TSDB_CODE_FAILED:TSDB_CODE_SUCCESS; + return TSDB_CODE_SUCCESS; } int32_t tjsonGetIntValue(const SJson* pJson, const char* pName, int32_t* pVal) { @@ -199,7 +199,7 @@ int32_t tjsonGetUBigIntValue(const SJson* pJson, const char* pName, uint64_t* pV } *pVal = strtoul(p, NULL, 10); - return (errno == ERANGE||errno == EINVAL) ? TSDB_CODE_FAILED:TSDB_CODE_SUCCESS; + return TSDB_CODE_SUCCESS; } int32_t tjsonGetUIntValue(const SJson* pJson, const char* pName, uint32_t* pVal) { From b45f7cef2eb7129877f1e70ad2bdfe5275f6da20 Mon Sep 17 00:00:00 2001 From: Liu Jicong Date: Thu, 31 Mar 2022 16:04:23 +0800 Subject: [PATCH 16/47] fix --- source/dnode/vnode/src/tq/tq.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c index f34fa9e19c..82300f82cb 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,*/ @@ -305,7 +305,7 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) { /*pHead = pTopic->pReadhandle->pHead;*/ if (pHead->msgType == TDMT_VND_SUBMIT) { SSubmitReq* pCont = (SSubmitReq*)&pHead->body; - printf("from topic %s from consumer\n", pTopic->topicName, consumerId); + /*printf("from topic %s from consumer\n", pTopic->topicName, consumerId);*/ qTaskInfo_t task = pTopic->buffer.output[workerId].task; ASSERT(task); qSetStreamInput(task, pCont, STREAM_DATA_TYPE_SUBMIT_BLOCK); @@ -353,8 +353,9 @@ 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 +385,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; From ec97115b8350c14828587aeb5dc1a5498af122bb Mon Sep 17 00:00:00 2001 From: Liu Jicong Date: Thu, 31 Mar 2022 16:04:58 +0800 Subject: [PATCH 17/47] fix --- .clang-format | 1 + 1 file changed, 1 insertion(+) 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 From fa354b85e5bb5374bc304800d3dc91b9346e8fdc Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Thu, 31 Mar 2022 16:05:24 +0800 Subject: [PATCH 18/47] shm --- source/util/src/tprocess.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/source/util/src/tprocess.c b/source/util/src/tprocess.c index f18e7d5777..71f819dbc1 100644 --- a/source/util/src/tprocess.c +++ b/source/util/src/tprocess.c @@ -140,14 +140,16 @@ static void taosProcDestroySem(SProcQueue *pQueue) { pQueue->sem = NULL; } } +#endif static void taosProcCleanupQueue(SProcQueue *pQueue) { +#if 0 if (pQueue != NULL) { taosProcDestroyMutex(pQueue); taosProcDestroySem(pQueue); } -} #endif +} static int32_t taosProcQueuePush(SProcQueue *pQueue, const char *pHead, int16_t rawHeadLen, const char *pBody, int32_t rawBodyLen, ProcFuncType ftype) { @@ -317,7 +319,7 @@ SProcObj *taosProcInit(const SProcCfg *pCfg) { pProc->pChildQueue = taosProcInitQueue(pCfg->name, pCfg->isChild, (char *)pCfg->shm.ptr + cstart, csize); pProc->pParentQueue = taosProcInitQueue(pCfg->name, pCfg->isChild, (char *)pCfg->shm.ptr + pstart, psize); if (pProc->pChildQueue == NULL || pProc->pParentQueue == NULL) { - // taosProcCleanupQueue(pProc->pChildQueue); + taosProcCleanupQueue(pProc->pChildQueue); taosMemoryFree(pProc); return NULL; } @@ -370,7 +372,7 @@ static void taosProcThreadLoop(SProcObj *pProc) { freeBodyFp = pProc->parentFreeBodyFp; } - uDebug("proc:%s, start to get msg from queue:%p, isChild:%d", pProc->name, pQueue, pProc->isChild); + uDebug("proc:%s, start to get msg from queue:%p", pProc->name, pQueue); while (1) { int32_t numOfMsgs = taosProcQueuePop(pQueue, &pHead, &headLen, &pBody, &bodyLen, &ftype, mallocHeadFp, freeHeadFp, @@ -406,7 +408,7 @@ int32_t taosProcRun(SProcObj *pProc) { static void taosProcStop(SProcObj *pProc) { if (!taosCheckPthreadValid(pProc->thread)) return; - uDebug("proc:%s, start to join thread:%" PRId64 ", isChild:%d", pProc->name, pProc->thread, pProc->isChild); + uDebug("proc:%s, start to join thread:%" PRId64, pProc->name, pProc->thread); SProcQueue *pQueue; if (pProc->isChild) { pQueue = pProc->pChildQueue; @@ -421,9 +423,9 @@ void taosProcCleanup(SProcObj *pProc) { if (pProc != NULL) { uDebug("proc:%s, start to clean up", pProc->name); taosProcStop(pProc); + taosProcCleanupQueue(pProc->pChildQueue); + taosProcCleanupQueue(pProc->pParentQueue); uDebug("proc:%s, is cleaned up", pProc->name); - // taosProcCleanupQueue(pProc->pChildQueue); - // taosProcCleanupQueue(pProc->pParentQueue); taosMemoryFree(pProc); } } From be2ab1f4f82f3bbd2c051d8d8603ff1ac9f7257d Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Thu, 31 Mar 2022 16:16:24 +0800 Subject: [PATCH 19/47] shm --- source/util/src/tprocess.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source/util/src/tprocess.c b/source/util/src/tprocess.c index 71f819dbc1..1d41bd4a48 100644 --- a/source/util/src/tprocess.c +++ b/source/util/src/tprocess.c @@ -224,7 +224,6 @@ static int32_t taosProcQueuePop(SProcQueue *pQueue, void **ppHead, int16_t *pHea taosThreadMutexLock(&pQueue->mutex); if (pQueue->total - pQueue->avail <= 0) { taosThreadMutexUnlock(&pQueue->mutex); - tsem_post(&pQueue->sem); terrno = TSDB_CODE_OUT_OF_SHM_MEM; return 0; } @@ -378,7 +377,7 @@ static void taosProcThreadLoop(SProcObj *pProc) { int32_t numOfMsgs = taosProcQueuePop(pQueue, &pHead, &headLen, &pBody, &bodyLen, &ftype, mallocHeadFp, freeHeadFp, mallocBodyFp, freeBodyFp); if (numOfMsgs == 0) { - uInfo("proc:%s, get no msg from queue:%p and exit the proc thread", pProc->name, pQueue); + uDebug("proc:%s, get no msg from queue:%p and exit the proc thread", pProc->name, pQueue); break; } else if (numOfMsgs < 0) { uTrace("proc:%s, get no msg from queue:%p since %s", pProc->name, pQueue, terrstr()); From 2858a705a81cf64c5e67f820b02dbb74a2b89d29 Mon Sep 17 00:00:00 2001 From: cpwu Date: Thu, 31 Mar 2022 16:17:24 +0800 Subject: [PATCH 20/47] fix interval case --- tests/script/tsim/query/interval-offset.sim | 134 ++++++++++++-------- tests/script/tsim/query/interval.sim | 76 +++++------ 2 files changed, 116 insertions(+), 94 deletions(-) diff --git a/tests/script/tsim/query/interval-offset.sim b/tests/script/tsim/query/interval-offset.sim index 4c4ebc6670..ffb13979cd 100644 --- a/tests/script/tsim/query/interval-offset.sim +++ b/tests/script/tsim/query/interval-offset.sim @@ -7,7 +7,7 @@ sql connect print =============== create database sql create database d0 sql show databases -if $rows != 2 then +if $rows != 2 then return -1 endi @@ -17,7 +17,7 @@ print =============== create super table and child table sql create table stb (ts timestamp, tbcol int) tags (t1 int) sql show stables print $rows $data00 $data01 $data02 -if $rows != 1 then +if $rows != 1 then return -1 endi @@ -29,7 +29,7 @@ sql show tables print $rows $data00 $data10 $data20 if $rows != 4 then return -1 -endi +endi print =============== insert data into child table ct1 (s) sql insert into ct1 values ( '2022-01-01 01:01:01.000', 1 ) @@ -83,13 +83,13 @@ print ===> rows3: $data30 $data31 $data32 $data33 $data34 print ===> rows4: $data40 $data41 $data42 $data43 $data44 if $rows != 5 then return -1 -endi +endi if $data00 != 1 then return -1 -endi +endi if $data40 != 1 then return -1 -endi +endi sql select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(*) from ct1 interval(10s, 2s) sliding(10s) print ===> select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(*) from ct1 interval(10s, 2s) sliding(10s) @@ -101,13 +101,13 @@ print ===> rows3: $data30 $data31 $data32 $data33 $data34 print ===> rows4: $data40 $data41 $data42 $data43 $data44 if $rows != 5 then return -1 -endi +endi if $data00 != 1 then return -1 -endi +endi if $data40 != 1 then return -1 -endi +endi sql select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(*) from ct1 interval(10s, 2s) sliding(5s) print ===> select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(*) from ct1 interval(10s, 2s) sliding(5s) @@ -123,16 +123,16 @@ print ===> rows7: $data70 $data71 $data72 $data73 $data74 print ===> rows8: $data80 $data81 $data82 $data83 $data84 if $rows != 9 then return -1 -endi +endi if $data00 != 1 then return -1 -endi +endi if $data70 != 2 then return -1 -endi +endi if $data80 != 1 then return -1 -endi +endi sql select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(*) from ct2 interval(1d, 2h) print ===> select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(*) from ct2 interval(1d, 2h) @@ -144,10 +144,10 @@ print ===> rows3: $data30 $data31 $data32 $data33 $data34 print ===> rows4: $data40 $data41 $data42 $data43 $data44 if $rows != 4 then return -1 -endi +endi if $data00 != 1 then return -1 -endi +endi if $data10 != 2 then return -1 endi @@ -155,27 +155,54 @@ endi sql select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(*) from ct2 interval(1d, 2h) sliding(12h) print ===> select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(*) from ct2 interval(1d, 2h) sliding(12h) print ===> rows: $rows -print ===> rows0: $data00 $data01 $data02 $data03 $data04 $data05 -print ===> rows1: $data10 $data11 $data12 $data13 $data14 $data15 -print ===> rows2: $data20 $data21 $data22 $data23 $data24 $data25 -print ===> rows3: $data30 $data31 $data32 $data33 $data34 $data35 -print ===> rows4: $data40 $data41 $data42 $data43 $data44 $data45 -print ===> rows5: $data50 $data51 $data52 $data53 $data54 $data55 -print ===> rows6: $data60 $data61 $data62 $data63 $data64 $data65 -print ===> rows7: $data70 $data71 $data72 $data73 $data74 $data75 +print ===> rows0: $data00 $data01 $data02 $data03 $data04 $data05 +print ===> rows1: $data10 $data11 $data12 $data13 $data14 $data15 +print ===> rows2: $data20 $data21 $data22 $data23 $data24 $data25 +print ===> rows3: $data30 $data31 $data32 $data33 $data34 $data35 +print ===> rows4: $data40 $data41 $data42 $data43 $data44 $data45 +print ===> rows5: $data50 $data51 $data52 $data53 $data54 $data55 +print ===> rows6: $data60 $data61 $data62 $data63 $data64 $data65 +print ===> rows7: $data70 $data71 $data72 $data73 $data74 $data75 if $rows != 8 then return -1 -endi +endi if $data00 != 1 then return -1 -endi +endi if $data10 != 2 then return -1 -endi +endi if $data70 != 1 then return -1 endi - + +sql select _wstartts, _wendts, _wduration, _qstartts, _qendts, count(tbcol) from ct2 interval(1d, 2h) sliding(12h) +print ===> select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(*) from ct2 interval(1d, 2h) sliding(12h) +print ===> rows: $rows +print ===> rows0: $data00 $data01 $data02 $data03 $data04 $data05 +print ===> rows1: $data10 $data11 $data12 $data13 $data14 $data15 +print ===> rows2: $data20 $data21 $data22 $data23 $data24 $data25 +print ===> rows3: $data30 $data31 $data32 $data33 $data34 $data35 +print ===> rows4: $data40 $data41 $data42 $data43 $data44 $data45 +print ===> rows5: $data50 $data51 $data52 $data53 $data54 $data55 +print ===> rows6: $data60 $data61 $data62 $data63 $data64 $data65 +print ===> rows7: $data70 $data71 $data72 $data73 $data74 $data75 +if $rows != 8 then + return -1 +endi +if $data05 != 1 then + return -1 +endi +if $data15 != 2 then + return -1 +endi +if $data75 != 1 then + return -1 +endi +if $data02 != 86400000 then + return -1 +endi + sql select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(*) from ct3 interval(1n, 1w) print ===> select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(*) from ct3 interval(1n, 1w) print ===> rows: $rows @@ -184,15 +211,15 @@ print ===> rows1: $data10 $data11 $data12 $data13 $data14 print ===> rows2: $data20 $data21 $data22 $data23 $data24 print ===> rows3: $data30 $data31 $data32 $data33 $data34 print ===> rows4: $data40 $data41 $data42 $data43 $data44 -#if $rows != 5 then -# return -1 -#endi -#if $data00 != 1 then -# return -1 -#endi -#if $data40 != 1 then -# return -1 -#endi +# if $rows != 5 then +# return -1 +# endi +# f $data00 != 1 then +# return -1 +# endi +# if $data40 != 1 then +# return -1 +# endi sql select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(*) from ct3 interval(1n, 1w) sliding(2w) print ===> select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(*) from ct3 interval(1n, 1w) sliding(2w) @@ -204,13 +231,13 @@ print ===> rows3: $data30 $data31 $data32 $data33 $data34 print ===> rows4: $data40 $data41 $data42 $data43 $data44 #if $rows != 5 then # return -1 -#endi +#endi #if $data00 != 1 then # return -1 -#endi +#endi #if $data40 != 1 then # return -1 -#endi +#endi sql select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(*) from ct3 interval(1n, 1w) sliding(4w) print ===> select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(*) from ct3 interval(1n, 1w) sliding(4w) @@ -225,13 +252,13 @@ print ===> rows6: $data60 $data61 $data62 $data63 $data64 print ===> rows7: $data70 $data71 $data72 $data73 $data74 #if $rows != 8 then # return -1 -#endi +#endi #if $data00 != 2 then # return -1 -#endi +#endi #if $data70 != 1 then # return -1 -#endi +#endi sql select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(*) from ct4 interval(1y, 6n) print ===> select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(*) from ct4 interval(1y, 6n) @@ -243,13 +270,13 @@ print ===> rows3: $data30 $data31 $data32 $data33 $data34 print ===> rows4: $data40 $data41 $data42 $data43 $data44 #if $rows != 5 then # return -1 -#endi +#endi #if $data00 != 1 then # return -1 -#endi +#endi #if $data40 != 1 then # return -1 -#endi +#endi sql select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(*) from ct4 interval(1y, 6n) sliding(6n) print ===> select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(*) from ct4 interval(1y, 6n) sliding(6n) @@ -261,13 +288,13 @@ print ===> rows3: $data30 $data31 $data32 $data33 $data34 print ===> rows4: $data40 $data41 $data42 $data43 $data44 #if $rows != 5 then # return -1 -#endi +#endi #if $data00 != 1 then # return -1 -#endi +#endi #if $data40 != 1 then # return -1 -#endi +#endi sql select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(*) from ct4 interval(1y, 6n) sliding(12n) print ===> select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(*) from ct4 interval(1y, 6n) sliding(12n) @@ -282,13 +309,13 @@ print ===> rows6: $data60 $data61 $data62 $data63 $data64 print ===> rows7: $data70 $data71 $data72 $data73 $data74 #if $rows != 8 then # return -1 -#endi +#endi #if $data00 != 2 then # return -1 -#endi +#endi #if $data70 != 1 then # return -1 -#endi +#endi #================================================= print =============== stop and restart taosd @@ -322,9 +349,4 @@ endi #sql select count(*) from car where ts > '2019-05-14 00:00:00' interval(1y, 5d) - - - - - #system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/tsim/query/interval.sim b/tests/script/tsim/query/interval.sim index 6dd0a9537e..384008c887 100644 --- a/tests/script/tsim/query/interval.sim +++ b/tests/script/tsim/query/interval.sim @@ -29,18 +29,18 @@ $i = 0 while $i < $tbNum $tb = $tbPrefix . $i sql create table $tb using $mt tags( $i ) - + $x = 0 while $x < $rowNum $cc = $x * 60000 $ms = 1601481600000 + $cc - sql insert into $tb values ($ms , $x ) + sql insert into $tb values ($ms , $x ) $x = $x + 1 - endw - + endw + $i = $i + 1 -endw +endw print =============== step2 $i = 1 @@ -49,51 +49,51 @@ $tb = $tbPrefix . $i sql select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(tbcol) from $tb interval(1m) print ===> select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(tbcol) from $tb interval(1m) print ===> $rows $data01 $data05 -if $rows != $rowNum then +if $rows != $rowNum then return -1 endi -if $data00 != 1 then +if $data00 != 1 then return -1 endi -if $data04 != 1 then +if $data04 != 1 then return -1 endi -#print =============== step3 +print =============== step3 #$cc = 4 * 60000 #$ms = 1601481600000 + $cc #sql select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(tbcol) from $tb where ts <= $ms interval(1m) #print ===> select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(tbcol) from $tb where ts <= $ms interval(1m) #print ===> $rows $data01 $data05 -#if $rows != 5 then +#if $rows != 5 then # return -1 #endi -#if $data00 != 1 then +#if $data00 != 1 then # return -1 #endi -#if $data04 != 1 then +#if $data04 != 1 then # return -1 #endi -#print =============== step4 +print =============== step4 #$cc = 40 * 60000 #$ms = 1601481600000 + $cc #$cc = 1 * 60000 #$ms2 = 1601481600000 - $cc -#sql select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(tbcol) from $tb where ts <= $ms and ts > $ms2 interval(1m) -#print ===> select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(tbcol) from $tb where ts <= $ms and ts > $ms2 interval(1m) -#print ===> $rows $data01 $data05 -#if $rows != 20 then -# return -1 -#endi -#if $data00 != 1 then -# return -1 -#endi -#if $data04 != 1 then -# return -1 -#endi +sql select _wstartts, _wendts, _wduration, _qstartts, _qendts, count(tbcol) from $tb interval(1m) +print ===> select _wstartts, _wendts, _wduration, _qstartts, _qendts, count(tbcol) from $tb interval(1m) +print ===> $rows $data01 $data05 +if $rows != $rowNum then + return -1 +endi +if $data05 != 1 then + return -1 +endi +if $data02 != 60000 then + return -1 +endi #print =============== step5 #$cc = 40 * 60000 @@ -105,13 +105,13 @@ endi #sql select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(tbcol) from $tb where ts <= $ms and ts > $ms2 interval(1m) fill(value,0) #print ===> select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(tbcol) from $tb where ts <= $ms and ts > $ms2 interval(1m) fill(value,0) #print ===> $rows $data21 $data25 -#if $rows != 42 then +#if $rows != 42 then # return -1 #endi -#if $data20 != 1 then +#if $data20 != 1 then # return -1 #endi -#if $data24 != 1 then +#if $data24 != 1 then # return -1 #endi @@ -119,10 +119,10 @@ endi #sql select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(tbcol) from $mt interval(1m) #print ===> select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(tbcol) from $mt interval(1m) #print ===> $rows $data11 -#if $rows != 20 then +#if $rows != 20 then # return -1 #endi -#if $data11 != 10 then +#if $data11 != 10 then # return -1 #endi @@ -132,10 +132,10 @@ endi #sql select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(tbcol) from $mt where ts <= $ms interval(1m) #print ===> select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(tbcol) from $mt where ts <= $ms interval(1m) #print ===> $rows $data11 -#if $rows != 5 then +#if $rows != 5 then # return -1 #endi -#if $data11 != 10 then +#if $data11 != 10 then # return -1 #endi @@ -149,10 +149,10 @@ endi #sql select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(tbcol) from $mt where ts <= $ms1 and ts > $ms2 interval(1m) #print ===> select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(tbcol) from $mt where ts <= $ms1 and ts > $ms2 interval(1m) #print ===> $rows $data11 -#if $rows != 20 then +#if $rows != 20 then # return -1 #endi -#if $data11 != 10 then +#if $data11 != 10 then # return -1 #endi # @@ -166,18 +166,18 @@ endi #sql select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(tbcol) from $mt where ts <= $ms1 and ts > $ms2 interval(1m) fill(value, 0) #print ===> select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(tbcol) from $mt where ts <= $ms1 and ts > $ms2 interval(1m) fill(value, 0) #print ===> $rows $data11 -#if $rows != 42 then +#if $rows != 42 then # return -1 #endi -#if $data11 != 10 then +#if $data11 != 10 then # return -1 #endi print =============== clear #sql drop database $db #sql show databases -#if $rows != 0 then +#if $rows != 0 then # return -1 #endi -#system sh/exec.sh -n dnode1 -s stop -x SIGINT +#system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file From 68f2911ce2657345166b8a11326516e03ba6467e Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Thu, 31 Mar 2022 16:19:26 +0800 Subject: [PATCH 21/47] rename files --- source/dnode/mgmt/main/src/{dndInt.c => dndEnv.c} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename source/dnode/mgmt/main/src/{dndInt.c => dndEnv.c} (100%) diff --git a/source/dnode/mgmt/main/src/dndInt.c b/source/dnode/mgmt/main/src/dndEnv.c similarity index 100% rename from source/dnode/mgmt/main/src/dndInt.c rename to source/dnode/mgmt/main/src/dndEnv.c From bee82c6ff936da4c6b406f49e3d1d940ae029e96 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Thu, 31 Mar 2022 16:19:47 +0800 Subject: [PATCH 22/47] rename files --- source/dnode/mgmt/main/src/{dndObj.c => dndInt.c} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename source/dnode/mgmt/main/src/{dndObj.c => dndInt.c} (100%) diff --git a/source/dnode/mgmt/main/src/dndObj.c b/source/dnode/mgmt/main/src/dndInt.c similarity index 100% rename from source/dnode/mgmt/main/src/dndObj.c rename to source/dnode/mgmt/main/src/dndInt.c From bd7c046e45c2f5fbb9be914b4cd99851fead5d07 Mon Sep 17 00:00:00 2001 From: plum-lihui Date: Thu, 31 Mar 2022 16:36:24 +0800 Subject: [PATCH 23/47] [add cases] --- tests/script/jenkins/basic.txt | 1 + tests/script/tsim/db/alter_option.sim | 172 ++++++-------------------- tests/script/tsim/testCaseSuite.sim | 1 + 3 files changed, 43 insertions(+), 131 deletions(-) diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index 37233c288f..811c9941f7 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -5,6 +5,7 @@ ./test.sh -f tsim/user/basic1.sim # ---- db +./test.sh -f tsim/db/alter_option.sim ./test.sh -f tsim/db/basic1.sim ./test.sh -f tsim/db/basic2.sim ./test.sh -f tsim/db/basic3.sim diff --git a/tests/script/tsim/db/alter_option.sim b/tests/script/tsim/db/alter_option.sim index 5c2848883b..0fc7175cb1 100644 --- a/tests/script/tsim/db/alter_option.sim +++ b/tests/script/tsim/db/alter_option.sim @@ -59,22 +59,12 @@ endi print ============= create database #database_option: { # BLOCKS value [3~1000, default: 6] -# | CACHE value [default: 16M] # | CACHELAST value [0, 1, 2, 3] -# | COMP [0 | 1 | 2] -# | DAYS value [unit is minutes] # | FSYNC value [0 ~ 180000 ms] -# | MAXROWS value [default: 4096] -# | MINROWS value [default: 100] # | KEEP value [days, 365000] -# | PRECISION ['ms' | 'us' | 'ns'] # | QUORUM value [1 | 2] # | REPLICA value [1 | 3] -# | TTL value [unit is day, min=1] # | WAL value [1 | 2] -# | VGROUPS value [default: 2] -# | SINGLE_STABLE [0 | 1] -# | STREAM_MODE [0 | 1] sql create database db BLOCKS 7 CACHE 3 CACHELAST 3 COMP 0 DAYS 240 FSYNC 1000 MAXROWS 8000 MINROWS 10 KEEP 1000 PRECISION 'ns' QUORUM 1 REPLICA 3 TTL 7 WAL 2 VGROUPS 6 SINGLE_STABLE 1 STREAM_MODE 1 sql show databases @@ -187,22 +177,10 @@ sql_error alter database db quorum 4 sql_error alter database db quorum 5 #print ============== modify days -#sql alter database db days 480 -#sql show databases -#print days $data6_db -#if $data6_db != 480 then # days -# return -1 -#endi -#sql alter database db days 360 -#sql show databases -#print days $data6_db -#if $data6_db != 360 then # days -# return -1 -#endi - +sql_error alter database db days 480 +sql_error alter database db days 360 sql_error alter database db days 0 -#sql_error alter database db days 14400 # set over than keep - +sql_error alter database db days 14400 # set over than keep print ============== modify keep sql alter database db keep 2000 @@ -230,25 +208,14 @@ sql_error alter database db keep -1 #sql_error alter database db keep 365001 print ============== modify cache -#sql alter database db cache 12 -#sql show databases -#print cache $data8_db -#if $data8_db != 12 then -# return -1 -#endi -#sql alter database db cache 1 -#sql show databases -#print cache $data8_db -#if $data8_db != 6 then -# return -1 -#endi -# -#sql_error alter database db cache 60 -#sql_error alter database db cache 50 -#sql_error alter database db cache 20 -#sql_error alter database db cache 3 -#sql_error alter database db cache 129 -#sql_error alter database db cache 300 +sql_error alter database db cache 12 +sql_error alter database db cache 1 +sql_error alter database db cache 60 +sql_error alter database db cache 50 +sql_error alter database db cache 20 +sql_error alter database db cache 3 +sql_error alter database db cache 129 +sql_error alter database db cache 300 sql_error alter database db cache 0 sql_error alter database db cache -1 @@ -276,45 +243,18 @@ sql_error alter database db blocks 0 sql_error alter database db blocks -1 sql_error alter database db blocks 10001 -#print ============== modify minrows -#sql alter database db minrows 8 -#sql show databases -#print minrows $data10_db -#if $data10_db != 8 then -# return -1 -#endi -#sql alter database db minrows 200 -#sql show databases -#print minrows $data10_db -#if $data10_db != 200 then -# return -1 -#endi -# -#sql alter database db minrows 11 -#sql show databases -#print minrows $data10_db -#if $data10_db != 11 then -# return -1 -#endi -#sql_error alter database db minrows 8000 -#sql_error alter database db minrows 8001 +print ============== modify minrows +sql_error alter database db minrows 8 +sql_error alter database db minrows 200 +sql_error alter database db minrows 11 +sql_error alter database db minrows 8000 +sql_error alter database db minrows 8001 -#print ============== modify maxrows -#sql alter database db maxrows 1000 -#sql show databases -#print maxrows $data11_db -#if $data11_db != 1000 then -# return -1 -#endi -#sql alter database db maxrows 2000 -#sql show databases -#print maxrows $data11_db -#if $data11_db != 2000 then -# return -1 -#endi -# -#sql_error alter database db maxrows 11 # equal minrows -#sql_error alter database db maxrows 10 # little than minrows +print ============== modify maxrows +sql_error alter database db maxrows 1000 +sql_error alter database db maxrows 2000 +sql_error alter database db maxrows 11 # equal minrows +sql_error alter database db maxrows 10 # little than minrows print ============== step wal sql alter database db wal 1 @@ -330,7 +270,7 @@ if $data12_db != 2 then return -1 endi -sql_error alter database db wal 0 +#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 @@ -348,35 +288,20 @@ print fsync $data13_db if $data13_db != 500 then return -1 endi -sql_error alter database db fsync 0 +sql alter database db fsync 0 +sql show databases +print fsync $data13_db +if $data13_db != 0 then + return -1 +endi +sql_error alter database db fsync 180001 sql_error alter database db fsync -1 print ============== modify comp -sql alter database db comp 1 -sql show databases -print comp $data14_db -if $data14_db != 1 then - return -1 -endi -sql alter database db comp 2 -sql show databases -print comp $data14_db -if $data14_db != 2 then - return -1 -endi -sql alter database db comp 1 -sql show databases -print comp $data14_db -if $data14_db != 1 then - return -1 -endi -sql alter database db comp 0 -sql show databases -print comp $data14_db -if $data14_db != 0 then - return -1 -endi - +sql_error alter database db comp 1 +sql_error alter database db comp 2 +sql_error alter database db comp 1 +sql_error alter database db comp 0 sql_error alter database db comp 3 sql_error alter database db comp 4 sql_error alter database db comp 5 @@ -414,30 +339,15 @@ if $data15_db != 3 then return -1 endi -sql_error alter database db comp 4 -sql_error alter database db comp 10 -sql_error alter database db comp -1 +sql_error alter database db cachelast 4 +sql_error alter database db cachelast 10 +sql_error alter database db cachelast -1 print ============== modify precision -sql alter database db precision 'ms' -sql show databases -print precision $data16_db -if $data16_db != ms then - return -1 -endi -sql alter database db precision 'us' -sql show databases -print precision $data16_db -if $data16_db != us then - return -1 -endi -sql alter database db precision 'ns' -sql show databases -print precision $data16_db -if $data16_db != ns then - return -1 -endi - +sql_error alter database db precision 'ms' +sql_error alter database db precision 'us' +sql_error alter database db precision 'ns' +sql_error alter database db precision 'ys' sql_error alter database db prec 'xs' #system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/testCaseSuite.sim b/tests/script/tsim/testCaseSuite.sim index 0e17ed9141..4245529343 100644 --- a/tests/script/tsim/testCaseSuite.sim +++ b/tests/script/tsim/testCaseSuite.sim @@ -1,6 +1,7 @@ run tsim/user/basic1.sim +run tsim/db/alter_option.sim run tsim/db/basic1.sim run tsim/db/basic2.sim run tsim/db/basic3.sim From 781d31d39f71747043fca9c23702cdfc7a824af5 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Thu, 31 Mar 2022 16:41:27 +0800 Subject: [PATCH 24/47] adjust log --- source/dnode/mgmt/main/src/dndExec.c | 2 +- source/util/src/tconfig.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/source/dnode/mgmt/main/src/dndExec.c b/source/dnode/mgmt/main/src/dndExec.c index 2999a30d67..c5d5707a99 100644 --- a/source/dnode/mgmt/main/src/dndExec.c +++ b/source/dnode/mgmt/main/src/dndExec.c @@ -276,8 +276,8 @@ static int32_t dndRunInParentProcess(SDnode *pDnode) { } static int32_t dndRunInChildProcess(SDnode *pDnode) { - dInfo("dnode run in child process"); SMgmtWrapper *pWrapper = &pDnode->wrappers[pDnode->ntype]; + dInfo("%s run in child process", pWrapper->name); SMsgCb msgCb = dndCreateMsgcb(pWrapper); tmsgSetDefaultMsgCb(&msgCb); diff --git a/source/util/src/tconfig.c b/source/util/src/tconfig.c index 04061cbaf1..9101d3c7c8 100644 --- a/source/util/src/tconfig.c +++ b/source/util/src/tconfig.c @@ -590,12 +590,12 @@ void cfgDumpCfg(SConfig *pCfg, bool tsc, bool dump) { } int32_t cfgLoadFromEnvVar(SConfig *pConfig) { - uInfo("load from global env variables success"); + uInfo("load from global env variables not implemented yet"); return 0; } int32_t cfgLoadFromEnvFile(SConfig *pConfig, const char *filepath) { - uInfo("load from env file [%s] success", filepath); + uInfo("load from env file not implemented yet"); return 0; } @@ -649,11 +649,11 @@ int32_t cfgLoadFromCfgFile(SConfig *pConfig, const char *filepath) { taosCloseFile(&pFile); if (line != NULL) taosMemoryFreeClear(line); - uInfo("load from cfg file [%s] success", filepath); + uInfo("load from cfg file %s success", filepath); return 0; } int32_t cfgLoadFromApollUrl(SConfig *pConfig, const char *url) { - uInfo("load from apoll url [%s] success", url); + uInfo("load from apoll url not implemented yet"); return 0; } From d02850382c5d8704a742290ba0b447cfc4cdf1c7 Mon Sep 17 00:00:00 2001 From: Liu Jicong Date: Thu, 31 Mar 2022 16:45:16 +0800 Subject: [PATCH 25/47] fix serialize --- source/dnode/vnode/src/vnd/vnodeWrite.c | 2 +- source/libs/scheduler/src/scheduler.c | 286 ++++++++++++------------ 2 files changed, 149 insertions(+), 139 deletions(-) diff --git a/source/dnode/vnode/src/vnd/vnodeWrite.c b/source/dnode/vnode/src/vnd/vnodeWrite.c index 0a6ed6bbe9..38eed46c9d 100644 --- a/source/dnode/vnode/src/vnd/vnodeWrite.c +++ b/source/dnode/vnode/src/vnd/vnodeWrite.c @@ -165,7 +165,7 @@ int vnodeApplyWMsg(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) { // } break; case TDMT_VND_SUBMIT: - printf("vnode %d write data %ld\n", pVnode->vgId, ver); + /*printf("vnode %d write data %ld\n", pVnode->vgId, ver);*/ if (pVnode->config.streamMode == 0) { if (tsdbInsertData(pVnode->pTsdb, (SSubmitReq *)ptr, NULL) < 0) { // TODO: handle error diff --git a/source/libs/scheduler/src/scheduler.c b/source/libs/scheduler/src/scheduler.c index 5af13d97ca..61462f1dc3 100644 --- a/source/libs/scheduler/src/scheduler.c +++ b/source/libs/scheduler/src/scheduler.c @@ -75,10 +75,10 @@ void schFreeRpcCtx(SRpcCtx *pCtx) { SRpcCtxVal *ctxVal = (SRpcCtxVal *)pIter; (*ctxVal->freeFunc)(ctxVal->val); - + pIter = taosHashIterate(pCtx->args, pIter); } - + taosHashCleanup(pCtx->args); if (pCtx->brokenVal.freeFunc) { @@ -86,7 +86,7 @@ void schFreeRpcCtx(SRpcCtx *pCtx) { } } -void schFreeTask(SSchTask* pTask) { +void schFreeTask(SSchTask *pTask) { if (pTask->candidateAddrs) { taosArrayDestroy(pTask->candidateAddrs); } @@ -125,41 +125,47 @@ int32_t schValidateTaskReceivedMsgType(SSchJob *pJob, SSchTask *pTask, int32_t m case TDMT_SCH_LINK_BROKEN: return TSDB_CODE_SUCCESS; case TDMT_VND_QUERY_RSP: // query_rsp may be processed later than ready_rsp - if (lastMsgType != reqMsgType && -1 != lastMsgType && TDMT_VND_FETCH != lastMsgType) { - SCH_TASK_DLOG("rsp msg type mis-match, last sent msgType:%s, rspType:%s", TMSG_INFO(lastMsgType), TMSG_INFO(msgType)); + if (lastMsgType != reqMsgType && -1 != lastMsgType && TDMT_VND_FETCH != lastMsgType) { + SCH_TASK_DLOG("rsp msg type mis-match, last sent msgType:%s, rspType:%s", TMSG_INFO(lastMsgType), + TMSG_INFO(msgType)); } - + if (taskStatus != JOB_TASK_STATUS_EXECUTING && taskStatus != JOB_TASK_STATUS_PARTIAL_SUCCEED) { - SCH_TASK_DLOG("rsp msg conflicted with task status, status:%s, rspType:%s", jobTaskStatusStr(taskStatus), TMSG_INFO(msgType)); + SCH_TASK_DLOG("rsp msg conflicted with task status, status:%s, rspType:%s", jobTaskStatusStr(taskStatus), + TMSG_INFO(msgType)); } - + SCH_SET_TASK_LASTMSG_TYPE(pTask, -1); return TSDB_CODE_SUCCESS; case TDMT_VND_RES_READY_RSP: reqMsgType = TDMT_VND_QUERY; if (lastMsgType != reqMsgType && -1 != lastMsgType) { - SCH_TASK_ELOG("rsp msg type mis-match, last sent msgType:%s, rspType:%s", (lastMsgType > 0 ? TMSG_INFO(lastMsgType) : "null"), TMSG_INFO(msgType)); + SCH_TASK_ELOG("rsp msg type mis-match, last sent msgType:%s, rspType:%s", + (lastMsgType > 0 ? TMSG_INFO(lastMsgType) : "null"), TMSG_INFO(msgType)); SCH_ERR_RET(TSDB_CODE_SCH_STATUS_ERROR); } - + if (taskStatus != JOB_TASK_STATUS_EXECUTING && taskStatus != JOB_TASK_STATUS_PARTIAL_SUCCEED) { - SCH_TASK_ELOG("rsp msg conflicted with task status, status:%s, rspType:%s", jobTaskStatusStr(taskStatus), TMSG_INFO(msgType)); + SCH_TASK_ELOG("rsp msg conflicted with task status, status:%s, rspType:%s", jobTaskStatusStr(taskStatus), + TMSG_INFO(msgType)); SCH_ERR_RET(TSDB_CODE_SCH_STATUS_ERROR); } SCH_SET_TASK_LASTMSG_TYPE(pTask, -1); return TSDB_CODE_SUCCESS; case TDMT_VND_FETCH_RSP: - if (lastMsgType != reqMsgType && -1 != lastMsgType) { - SCH_TASK_ELOG("rsp msg type mis-match, last sent msgType:%s, rspType:%s", TMSG_INFO(lastMsgType), TMSG_INFO(msgType)); + if (lastMsgType != reqMsgType && -1 != lastMsgType) { + SCH_TASK_ELOG("rsp msg type mis-match, last sent msgType:%s, rspType:%s", TMSG_INFO(lastMsgType), + TMSG_INFO(msgType)); SCH_ERR_RET(TSDB_CODE_SCH_STATUS_ERROR); } - + if (taskStatus != JOB_TASK_STATUS_EXECUTING && taskStatus != JOB_TASK_STATUS_PARTIAL_SUCCEED) { - SCH_TASK_ELOG("rsp msg conflicted with task status, status:%s, rspType:%s", jobTaskStatusStr(taskStatus), TMSG_INFO(msgType)); + SCH_TASK_ELOG("rsp msg conflicted with task status, status:%s, rspType:%s", jobTaskStatusStr(taskStatus), + TMSG_INFO(msgType)); SCH_ERR_RET(TSDB_CODE_SCH_STATUS_ERROR); } - + SCH_SET_TASK_LASTMSG_TYPE(pTask, -1); return TSDB_CODE_SUCCESS; case TDMT_VND_CREATE_TABLE_RSP: @@ -171,12 +177,14 @@ int32_t schValidateTaskReceivedMsgType(SSchJob *pJob, SSchTask *pTask, int32_t m } if (lastMsgType != reqMsgType) { - SCH_TASK_ELOG("rsp msg type mis-match, last sent msgType:%s, rspType:%s", TMSG_INFO(lastMsgType), TMSG_INFO(msgType)); + SCH_TASK_ELOG("rsp msg type mis-match, last sent msgType:%s, rspType:%s", TMSG_INFO(lastMsgType), + TMSG_INFO(msgType)); SCH_ERR_RET(TSDB_CODE_SCH_STATUS_ERROR); } - + if (taskStatus != JOB_TASK_STATUS_EXECUTING && taskStatus != JOB_TASK_STATUS_PARTIAL_SUCCEED) { - SCH_TASK_ELOG("rsp msg conflicted with task status, status:%s, rspType:%s", jobTaskStatusStr(taskStatus), TMSG_INFO(msgType)); + SCH_TASK_ELOG("rsp msg conflicted with task status, status:%s, rspType:%s", jobTaskStatusStr(taskStatus), + TMSG_INFO(msgType)); SCH_ERR_RET(TSDB_CODE_SCH_STATUS_ERROR); } @@ -357,7 +365,7 @@ int32_t schRecordTaskSucceedNode(SSchJob *pJob, SSchTask *pTask) { int32_t schRecordTaskExecNode(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr, void *handle) { SSchNodeInfo nodeInfo = {.addr = *addr, .handle = handle}; - + if (NULL == taosArrayPush(pTask->execNodes, &nodeInfo)) { SCH_TASK_ELOG("taosArrayPush nodeInfo to execNodes list failed, errno:%d", errno); SCH_ERR_RET(TSDB_CODE_QRY_OUT_OF_MEMORY); @@ -587,7 +595,7 @@ int32_t schMoveTaskToFailList(SSchJob *pJob, SSchTask *pTask, bool *moved) { if (0 != code) { if (HASH_NODE_EXIST(code)) { *moved = true; - + SCH_TASK_WLOG("task already in failTask list, status:%s", SCH_GET_TASK_STATUS_STR(pTask)); SCH_ERR_RET(TSDB_CODE_SCH_STATUS_ERROR); } @@ -612,7 +620,7 @@ int32_t schMoveTaskToExecList(SSchJob *pJob, SSchTask *pTask, bool *moved) { if (0 != code) { if (HASH_NODE_EXIST(code)) { *moved = true; - + SCH_TASK_ELOG("task already in execTask list, status:%s", SCH_GET_TASK_STATUS_STR(pTask)); SCH_ERR_RET(TSDB_CODE_SCH_STATUS_ERROR); } @@ -631,7 +639,7 @@ int32_t schMoveTaskToExecList(SSchJob *pJob, SSchTask *pTask, bool *moved) { int32_t schTaskCheckSetRetry(SSchJob *pJob, SSchTask *pTask, int32_t errCode, bool *needRetry) { int8_t status = 0; ++pTask->tryTimes; - + if (schJobNeedToStop(pJob, &status)) { *needRetry = false; SCH_TASK_DLOG("task no more retry cause of job status, job status:%s", jobTaskStatusStr(status)); @@ -643,7 +651,7 @@ int32_t schTaskCheckSetRetry(SSchJob *pJob, SSchTask *pTask, int32_t errCode, bo SCH_TASK_DLOG("task no more retry since reach max try times, tryTimes:%d", pTask->tryTimes); return TSDB_CODE_SUCCESS; } - + if (!NEED_SCHEDULER_RETRY_ERROR(errCode)) { *needRetry = false; SCH_TASK_DLOG("task no more retry cause of errCode, errCode:%x - %s", errCode, tstrerror(errCode)); @@ -654,7 +662,8 @@ int32_t schTaskCheckSetRetry(SSchJob *pJob, SSchTask *pTask, int32_t errCode, bo if (SCH_IS_DATA_SRC_TASK(pTask)) { if (pTask->tryTimes >= SCH_TASK_NUM_OF_EPS(&pTask->plan->execNode)) { *needRetry = false; - SCH_TASK_DLOG("task no more retry since all ep tried, tryTimes:%d, epNum:%d", pTask->tryTimes, SCH_TASK_NUM_OF_EPS(&pTask->plan->execNode)); + SCH_TASK_DLOG("task no more retry since all ep tried, tryTimes:%d, epNum:%d", pTask->tryTimes, + SCH_TASK_NUM_OF_EPS(&pTask->plan->execNode)); return TSDB_CODE_SUCCESS; } } else { @@ -662,14 +671,15 @@ int32_t schTaskCheckSetRetry(SSchJob *pJob, SSchTask *pTask, int32_t errCode, bo if ((pTask->candidateIdx + 1) >= candidateNum) { *needRetry = false; - SCH_TASK_DLOG("task no more retry since all candiates tried, candidateIdx:%d, candidateNum:%d", pTask->candidateIdx, candidateNum); + SCH_TASK_DLOG("task no more retry since all candiates tried, candidateIdx:%d, candidateNum:%d", + pTask->candidateIdx, candidateNum); return TSDB_CODE_SUCCESS; } } *needRetry = true; SCH_TASK_DLOG("task need the %dth retry, errCode:%x - %s", pTask->tryTimes, errCode, tstrerror(errCode)); - + return TSDB_CODE_SUCCESS; } @@ -706,9 +716,8 @@ int32_t schUpdateHbConnection(SQueryNodeEpId *epId, SSchTrans *trans) { memcpy(&hb->trans, trans, sizeof(*trans)); SCH_UNLOCK(SCH_WRITE, &hb->lock); - qDebug("hb connection updated, sId:%" PRIx64 ", nodeId:%d, fqdn:%s, port:%d, instance:%p, handle:%p", - schMgmt.sId, epId->nodeId, epId->ep.fqdn, epId->ep.port, trans->transInst, - trans->transHandle); + qDebug("hb connection updated, sId:%" PRIx64 ", nodeId:%d, fqdn:%s, port:%d, instance:%p, handle:%p", schMgmt.sId, + epId->nodeId, epId->ep.fqdn, epId->ep.port, trans->transInst, trans->transHandle); return TSDB_CODE_SUCCESS; } @@ -730,15 +739,15 @@ void schUpdateJobErrCode(SSchJob *pJob, int32_t errCode) { if (NEED_CLIENT_HANDLE_ERROR(origCode)) { return; } - + if (NEED_CLIENT_HANDLE_ERROR(errCode)) { atomic_store_32(&pJob->errCode, errCode); goto _return; } return; - -_return: + +_return: SCH_JOB_DLOG("job errCode updated to %x - %s", errCode, tstrerror(errCode)); } @@ -825,7 +834,7 @@ int32_t schProcessOnTaskFailure(SSchJob *pJob, SSchTask *pTask, int32_t errCode) } SCH_SET_TASK_STATUS(pTask, JOB_TASK_STATUS_FAILED); - + if (SCH_IS_WAIT_ALL_JOB(pJob)) { SCH_LOCK(SCH_WRITE, &pTask->level->lock); pTask->level->taskFailed++; @@ -833,9 +842,9 @@ int32_t schProcessOnTaskFailure(SSchJob *pJob, SSchTask *pTask, int32_t errCode) SCH_UNLOCK(SCH_WRITE, &pTask->level->lock); schUpdateJobErrCode(pJob, errCode); - + if (taskDone < pTask->level->taskNum) { - SCH_TASK_DLOG("need to wait other tasks, doneNum:%d, allNum:%d", taskDone, pTask->level->taskNum); + SCH_TASK_DLOG("need to wait other tasks, doneNum:%d, allNum:%d", taskDone, pTask->level->taskNum); SCH_RET(errCode); } } @@ -867,7 +876,7 @@ int32_t schProcessOnTaskSuccess(SSchJob *pJob, SSchTask *pTask) { int32_t parentNum = pTask->parents ? (int32_t)taosArrayGetSize(pTask->parents) : 0; if (parentNum == 0) { - int32_t taskDone = 0; + int32_t taskDone = 0; if (SCH_IS_WAIT_ALL_JOB(pJob)) { SCH_LOCK(SCH_WRITE, &pTask->level->lock); pTask->level->taskSucceed++; @@ -965,7 +974,8 @@ int32_t schHandleResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t msgType, ch int8_t status = 0; if (schJobNeedToStop(pJob, &status)) { - SCH_TASK_ELOG("rsp not processed cause of job status, job status:%s, rspCode:0x%x", jobTaskStatusStr(status), rspCode); + SCH_TASK_ELOG("rsp not processed cause of job status, job status:%s, rspCode:0x%x", jobTaskStatusStr(status), + rspCode); SCH_RET(atomic_load_32(&pJob->errCode)); } @@ -985,11 +995,11 @@ int32_t schHandleResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t msgType, ch SCH_ERR_JRET(rsp->code); } } - + taosArrayDestroy(batchRsp.rspList); } - } - + } + SCH_ERR_JRET(rspCode); SCH_ERR_RET(schProcessOnTaskSuccess(pJob, pTask)); break; @@ -1011,21 +1021,21 @@ int32_t schHandleResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t msgType, ch break; } case TDMT_VND_QUERY_RSP: { - SQueryTableRsp rsp = {0}; - if (msg) { - tDeserializeSQueryTableRsp(msg, msgSize, &rsp); - SCH_ERR_JRET(rsp.code); - } - - SCH_ERR_JRET(rspCode); - - if (NULL == msg) { - SCH_ERR_JRET(TSDB_CODE_QRY_INVALID_INPUT); - } - - //SCH_ERR_JRET(schBuildAndSendMsg(pJob, pTask, NULL, TDMT_VND_RES_READY)); - - break; + SQueryTableRsp rsp = {0}; + if (msg) { + tDeserializeSQueryTableRsp(msg, msgSize, &rsp); + SCH_ERR_JRET(rsp.code); + } + + SCH_ERR_JRET(rspCode); + + if (NULL == msg) { + SCH_ERR_JRET(TSDB_CODE_QRY_INVALID_INPUT); + } + + // SCH_ERR_JRET(schBuildAndSendMsg(pJob, pTask, NULL, TDMT_VND_RES_READY)); + + break; } case TDMT_VND_RES_READY_RSP: { SResReadyRsp *rsp = (SResReadyRsp *)msg; @@ -1088,14 +1098,14 @@ _return: } int32_t schHandleCallback(void *param, const SDataBuf *pMsg, int32_t msgType, int32_t rspCode) { - int32_t code = 0; + int32_t code = 0; SSchTaskCallbackParam *pParam = (SSchTaskCallbackParam *)param; - SSchTask *pTask = NULL; + SSchTask *pTask = NULL; SSchJob *pJob = schAcquireJob(pParam->refId); if (NULL == pJob) { qWarn("QID:0x%" PRIx64 ",TID:0x%" PRIx64 "taosAcquireRef job failed, may be dropped, refId:%" PRIx64, - pParam->queryId, pParam->taskId, pParam->refId); + pParam->queryId, pParam->taskId, pParam->refId); SCH_ERR_JRET(TSDB_CODE_QRY_JOB_FREED); } @@ -1114,7 +1124,7 @@ int32_t schHandleCallback(void *param, const SDataBuf *pMsg, int32_t msgType, in pTask = *task; SCH_TASK_DLOG("rsp msg received, type:%s, handle:%p, code:%s", TMSG_INFO(msgType), pMsg->handle, tstrerror(rspCode)); - SCH_SET_TASK_HANDLE(pTask, pMsg->handle); + SCH_SET_TASK_HANDLE(pTask, pMsg->handle); SCH_ERR_JRET(schHandleResponseMsg(pJob, pTask, msgType, pMsg->pData, pMsg->len, rspCode)); _return: @@ -1173,7 +1183,8 @@ int32_t schHandleHbCallback(void *param, const SDataBuf *pMsg, int32_t code) { SCH_ERR_RET(schUpdateHbConnection(&rsp.epId, &trans)); int32_t taskNum = (int32_t)taosArrayGetSize(rsp.taskStatus); - qDebug("%d task status in hb rsp, nodeId:%d, fqdn:%s, port:%d", taskNum, rsp.epId.nodeId, rsp.epId.ep.fqdn, rsp.epId.ep.port); + qDebug("%d task status in hb rsp, nodeId:%d, fqdn:%s, port:%d", taskNum, rsp.epId.nodeId, rsp.epId.ep.fqdn, + rsp.epId.ep.port); for (int32_t i = 0; i < taskNum; ++i) { STaskStatus *taskStatus = taosArrayGet(rsp.taskStatus, i); @@ -1187,8 +1198,9 @@ int32_t schHandleHbCallback(void *param, const SDataBuf *pMsg, int32_t code) { } // TODO - - SCH_JOB_DLOG("TID:0x%" PRIx64 " task status in server: %s", taskStatus->taskId, jobTaskStatusStr(taskStatus->status)); + + SCH_JOB_DLOG("TID:0x%" PRIx64 " task status in server: %s", taskStatus->taskId, + jobTaskStatusStr(taskStatus->status)); schReleaseJob(taskStatus->refId); } @@ -1208,7 +1220,7 @@ int32_t schHandleLinkBrokenCallback(void *param, const SDataBuf *pMsg, int32_t c if (head->isHbParam) { SSchHbCallbackParam *hbParam = (SSchHbCallbackParam *)param; - SSchTrans trans = {.transInst = hbParam->transport, .transHandle = NULL}; + SSchTrans trans = {.transInst = hbParam->transport, .transHandle = NULL}; SCH_ERR_RET(schUpdateHbConnection(&hbParam->nodeEpId, &trans)); SCH_ERR_RET(schBuildAndSendHbMsg(&hbParam->nodeEpId)); @@ -1219,7 +1231,6 @@ int32_t schHandleLinkBrokenCallback(void *param, const SDataBuf *pMsg, int32_t c return TSDB_CODE_SUCCESS; } - int32_t schGetCallbackFp(int32_t msgType, __async_send_cb_fn_t *fp) { switch (msgType) { case TDMT_VND_CREATE_TABLE: @@ -1258,8 +1269,8 @@ void schFreeRpcCtxVal(const void *arg) { if (NULL == arg) { return; } - - SMsgSendInfo* pMsgSendInfo = (SMsgSendInfo *)arg; + + SMsgSendInfo *pMsgSendInfo = (SMsgSendInfo *)arg; taosMemoryFreeClear(pMsgSendInfo->param); taosMemoryFreeClear(pMsgSendInfo); } @@ -1301,11 +1312,10 @@ int32_t schMakeHbCallbackParam(SSchJob *pJob, SSchTask *pTask, void **pParam) { return TSDB_CODE_SUCCESS; } - int32_t schMakeBrokenLinkVal(SSchJob *pJob, SSchTask *pTask, SRpcBrokenlinkVal *brokenVal, bool isHb) { - int32_t code = 0; - SMsgSendInfo* pMsgSendInfo = NULL; - + int32_t code = 0; + SMsgSendInfo *pMsgSendInfo = NULL; + pMsgSendInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo)); if (NULL == pMsgSendInfo) { SCH_TASK_ELOG("calloc %d failed", (int32_t)sizeof(SMsgSendInfo)); @@ -1318,17 +1328,17 @@ int32_t schMakeBrokenLinkVal(SSchJob *pJob, SSchTask *pTask, SRpcBrokenlinkVal * SCH_ERR_JRET(schMakeTaskCallbackParam(pJob, pTask, &pMsgSendInfo->param)); } - int32_t msgType = TDMT_SCH_LINK_BROKEN; + int32_t msgType = TDMT_SCH_LINK_BROKEN; __async_send_cb_fn_t fp = NULL; SCH_ERR_JRET(schGetCallbackFp(msgType, &fp)); - + pMsgSendInfo->fp = fp; brokenVal->msgType = msgType; brokenVal->val = pMsgSendInfo; brokenVal->clone = schCloneSMsgSendInfo; brokenVal->freeFunc = schFreeRpcCtxVal; - + return TSDB_CODE_SUCCESS; _return: @@ -1340,16 +1350,16 @@ _return: } int32_t schMakeQueryRpcCtx(SSchJob *pJob, SSchTask *pTask, SRpcCtx *pCtx) { - int32_t code = 0; + int32_t code = 0; SSchTaskCallbackParam *param = NULL; - SMsgSendInfo* pMsgSendInfo = NULL; + SMsgSendInfo *pMsgSendInfo = NULL; pCtx->args = taosHashInit(1, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), false, HASH_ENTRY_LOCK); if (NULL == pCtx->args) { SCH_TASK_ELOG("taosHashInit %d RpcCtx failed", 1); SCH_ERR_RET(TSDB_CODE_QRY_OUT_OF_MEMORY); } - + pMsgSendInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo)); if (NULL == pMsgSendInfo) { SCH_TASK_ELOG("calloc %d failed", (int32_t)sizeof(SMsgSendInfo)); @@ -1362,7 +1372,7 @@ int32_t schMakeQueryRpcCtx(SSchJob *pJob, SSchTask *pTask, SRpcCtx *pCtx) { SCH_ERR_JRET(TSDB_CODE_QRY_OUT_OF_MEMORY); } - int32_t msgType = TDMT_VND_RES_READY_RSP; + int32_t msgType = TDMT_VND_RES_READY_RSP; __async_send_cb_fn_t fp = NULL; SCH_ERR_JRET(schGetCallbackFp(TDMT_VND_RES_READY, &fp)); @@ -1370,7 +1380,7 @@ int32_t schMakeQueryRpcCtx(SSchJob *pJob, SSchTask *pTask, SRpcCtx *pCtx) { param->refId = pJob->refId; param->taskId = SCH_TASK_ID(pTask); param->transport = pJob->transport; - + pMsgSendInfo->param = param; pMsgSendInfo->fp = fp; @@ -1394,11 +1404,11 @@ _return: } int32_t schMakeHbRpcCtx(SSchJob *pJob, SSchTask *pTask, SRpcCtx *pCtx) { - int32_t code = 0; + int32_t code = 0; SSchHbCallbackParam *param = NULL; - SMsgSendInfo* pMsgSendInfo = NULL; - SQueryNodeAddr *addr = taosArrayGet(pTask->candidateAddrs, pTask->candidateIdx); - SQueryNodeEpId epId = {0}; + SMsgSendInfo *pMsgSendInfo = NULL; + SQueryNodeAddr *addr = taosArrayGet(pTask->candidateAddrs, pTask->candidateIdx); + SQueryNodeEpId epId = {0}; epId.nodeId = addr->nodeId; memcpy(&epId.ep, SCH_GET_CUR_EP(addr), sizeof(SEp)); @@ -1408,7 +1418,7 @@ int32_t schMakeHbRpcCtx(SSchJob *pJob, SSchTask *pTask, SRpcCtx *pCtx) { SCH_TASK_ELOG("taosHashInit %d RpcCtx failed", 1); SCH_ERR_RET(TSDB_CODE_QRY_OUT_OF_MEMORY); } - + pMsgSendInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo)); if (NULL == pMsgSendInfo) { SCH_TASK_ELOG("calloc %d failed", (int32_t)sizeof(SMsgSendInfo)); @@ -1421,13 +1431,13 @@ int32_t schMakeHbRpcCtx(SSchJob *pJob, SSchTask *pTask, SRpcCtx *pCtx) { SCH_ERR_JRET(TSDB_CODE_QRY_OUT_OF_MEMORY); } - int32_t msgType = TDMT_VND_QUERY_HEARTBEAT_RSP; + int32_t msgType = TDMT_VND_QUERY_HEARTBEAT_RSP; __async_send_cb_fn_t fp = NULL; SCH_ERR_JRET(schGetCallbackFp(TDMT_VND_QUERY_HEARTBEAT, &fp)); param->nodeEpId = epId; param->transport = pJob->transport; - + pMsgSendInfo->param = param; pMsgSendInfo->fp = fp; @@ -1450,19 +1460,18 @@ _return: SCH_RET(code); } - int32_t schRegisterHbConnection(SSchJob *pJob, SSchTask *pTask, SQueryNodeEpId *epId, bool *exist) { - int32_t code = 0; + int32_t code = 0; SSchHbTrans hb = {0}; hb.trans.transInst = pJob->transport; - + SCH_ERR_RET(schMakeHbRpcCtx(pJob, pTask, &hb.rpcCtx)); code = taosHashPut(schMgmt.hbConnections, epId, sizeof(SQueryNodeEpId), &hb, sizeof(SSchHbTrans)); if (code) { schFreeRpcCtx(&hb.rpcCtx); - + if (HASH_NODE_EXIST(code)) { *exist = true; return TSDB_CODE_SUCCESS; @@ -1475,8 +1484,6 @@ int32_t schRegisterHbConnection(SSchJob *pJob, SSchTask *pTask, SQueryNodeEpId * return TSDB_CODE_SUCCESS; } - - int32_t schCloneCallbackParam(SSchCallbackParamHeader *pSrc, SSchCallbackParamHeader **pDst) { if (pSrc->isHbParam) { SSchHbCallbackParam *dst = taosMemoryMalloc(sizeof(SSchHbCallbackParam)); @@ -1496,16 +1503,16 @@ int32_t schCloneCallbackParam(SSchCallbackParamHeader *pSrc, SSchCallbackParamHe qError("malloc SSchTaskCallbackParam failed"); SCH_ERR_RET(TSDB_CODE_QRY_OUT_OF_MEMORY); } - + memcpy(dst, pSrc, sizeof(*dst)); *pDst = (SSchCallbackParamHeader *)dst; - + return TSDB_CODE_SUCCESS; } int32_t schCloneSMsgSendInfo(void *src, void **dst) { SMsgSendInfo *pSrc = src; - int32_t code = 0; + int32_t code = 0; SMsgSendInfo *pDst = taosMemoryMalloc(sizeof(*pSrc)); if (NULL == pDst) { qError("malloc SMsgSendInfo for rpcCtx failed, len:%d", (int32_t)sizeof(*pSrc)); @@ -1520,7 +1527,7 @@ int32_t schCloneSMsgSendInfo(void *src, void **dst) { *dst = pDst; return TSDB_CODE_SUCCESS; - + _return: taosMemoryFreeClear(pDst); @@ -1531,7 +1538,7 @@ int32_t schCloneHbRpcCtx(SRpcCtx *pSrc, SRpcCtx *pDst) { int32_t code = 0; memcpy(&pDst->brokenVal, &pSrc->brokenVal, sizeof(pSrc->brokenVal)); pDst->brokenVal.val = NULL; - + SCH_ERR_RET(schCloneSMsgSendInfo(pSrc->brokenVal.val, &pDst->brokenVal.val)); pDst->args = taosHashInit(1, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), false, HASH_ENTRY_LOCK); @@ -1541,16 +1548,16 @@ int32_t schCloneHbRpcCtx(SRpcCtx *pSrc, SRpcCtx *pDst) { } SRpcCtxVal dst = {0}; - void *pIter = taosHashIterate(pSrc->args, NULL); + void *pIter = taosHashIterate(pSrc->args, NULL); while (pIter) { SRpcCtxVal *pVal = (SRpcCtxVal *)pIter; - int32_t *msgType = taosHashGetKey(pIter, NULL); + int32_t *msgType = taosHashGetKey(pIter, NULL); dst = *pVal; dst.val = NULL; - + SCH_ERR_JRET(schCloneSMsgSendInfo(pVal->val, &dst.val)); - + if (taosHashPut(pDst->args, msgType, sizeof(*msgType), &dst, sizeof(dst))) { qError("taosHashPut msg %d to rpcCtx failed", *msgType); (*dst.freeFunc)(dst.val); @@ -1568,8 +1575,8 @@ _return: SCH_RET(code); } - -int32_t schAsyncSendMsg(SSchJob *pJob, SSchTask *pTask, void *transport, SEpSet* epSet, int32_t msgType, void *msg, uint32_t msgSize, bool persistHandle, SRpcCtx *ctx) { +int32_t schAsyncSendMsg(SSchJob *pJob, SSchTask *pTask, void *transport, SEpSet *epSet, int32_t msgType, void *msg, + uint32_t msgSize, bool persistHandle, SRpcCtx *ctx) { int32_t code = 0; SSchTrans *trans = (SSchTrans *)transport; @@ -1601,11 +1608,11 @@ int32_t schAsyncSendMsg(SSchJob *pJob, SSchTask *pTask, void *transport, SEpSet* pMsgSendInfo->msgType = msgType; pMsgSendInfo->fp = fp; - qDebug("start to send %s msg to node[%d,%s,%d], refId:%" PRIx64 "instance:%p, handle:%p", - TMSG_INFO(msgType), ntohl(((SMsgHead *)msg)->vgId), epSet->eps[epSet->inUse].fqdn, epSet->eps[epSet->inUse].port, - pJob->refId, trans->transInst, trans->transHandle); - - int64_t transporterId = 0; + qDebug("start to send %s msg to node[%d,%s,%d], refId:%" PRIx64 "instance:%p, handle:%p", TMSG_INFO(msgType), + ntohl(((SMsgHead *)msg)->vgId), epSet->eps[epSet->inUse].fqdn, epSet->eps[epSet->inUse].port, pJob->refId, + trans->transInst, trans->transHandle); + + int64_t transporterId = 0; code = asyncSendMsgToServerExt(trans->transInst, epSet, &transporterId, pMsgSendInfo, persistHandle, ctx); if (code) { SCH_ERR_JRET(code); @@ -1623,18 +1630,19 @@ _return: int32_t schBuildAndSendHbMsg(SQueryNodeEpId *nodeEpId) { SSchedulerHbReq req = {0}; - int32_t code = 0; - SRpcCtx rpcCtx = {0}; - SSchTrans trans = {0}; - int32_t msgType = TDMT_VND_QUERY_HEARTBEAT; + int32_t code = 0; + SRpcCtx rpcCtx = {0}; + SSchTrans trans = {0}; + int32_t msgType = TDMT_VND_QUERY_HEARTBEAT; - req.header.vgId = htonl(nodeEpId->nodeId); + req.header.vgId = nodeEpId->nodeId; req.sId = schMgmt.sId; memcpy(&req.epId, nodeEpId, sizeof(SQueryNodeEpId)); SSchHbTrans *hb = taosHashGet(schMgmt.hbConnections, nodeEpId, sizeof(SQueryNodeEpId)); if (NULL == hb) { - qError("taosHashGet hb connection failed, nodeId:%d, fqdn:%s, port:%d", nodeEpId->nodeId, nodeEpId->ep.fqdn, nodeEpId->ep.port); + qError("taosHashGet hb connection failed, nodeId:%d, fqdn:%s, port:%d", nodeEpId->nodeId, nodeEpId->ep.fqdn, + nodeEpId->ep.port); SCH_ERR_RET(code); } @@ -1642,9 +1650,9 @@ int32_t schBuildAndSendHbMsg(SQueryNodeEpId *nodeEpId) { code = schCloneHbRpcCtx(&hb->rpcCtx, &rpcCtx); memcpy(&trans, &hb->trans, sizeof(trans)); SCH_UNLOCK(SCH_WRITE, &hb->lock); - + SCH_ERR_RET(code); - + int32_t msgSize = tSerializeSSchedulerHbReq(NULL, 0, &req); if (msgSize < 0) { qError("tSerializeSSchedulerHbReq hbReq failed, size:%d", msgSize); @@ -1655,7 +1663,7 @@ int32_t schBuildAndSendHbMsg(SQueryNodeEpId *nodeEpId) { qError("calloc hb req %d failed", msgSize); SCH_ERR_JRET(TSDB_CODE_QRY_OUT_OF_MEMORY); } - + if (tSerializeSSchedulerHbReq(msg, msgSize, &req) < 0) { qError("tSerializeSSchedulerHbReq hbReq failed, size:%d", msgSize); SCH_ERR_JRET(TSDB_CODE_QRY_OUT_OF_MEMORY); @@ -1684,17 +1692,18 @@ int32_t schBuildAndSendHbMsg(SQueryNodeEpId *nodeEpId) { pMsgSendInfo->msgInfo.handle = trans.transHandle; pMsgSendInfo->msgType = msgType; pMsgSendInfo->fp = fp; - - int64_t transporterId = 0; - SEpSet epSet = {.inUse = 0, .numOfEps = 1}; + + int64_t transporterId = 0; + SEpSet epSet = {.inUse = 0, .numOfEps = 1}; memcpy(&epSet.eps[0], &nodeEpId->ep, sizeof(nodeEpId->ep)); - qDebug("start to send hb msg, instance:%p, handle:%p, fqdn:%s, port:%d", trans.transInst, trans.transHandle, nodeEpId->ep.fqdn, nodeEpId->ep.port); - + qDebug("start to send hb msg, instance:%p, handle:%p, fqdn:%s, port:%d", trans.transInst, trans.transHandle, + nodeEpId->ep.fqdn, nodeEpId->ep.port); + code = asyncSendMsgToServerExt(trans.transInst, &epSet, &transporterId, pMsgSendInfo, true, &rpcCtx); if (code) { - qError("fail to send hb msg, instance:%p, handle:%p, fqdn:%s, port:%d, error:%x - %s", - trans.transInst, trans.transHandle, nodeEpId->ep.fqdn, nodeEpId->ep.port, code, tstrerror(code)); + qError("fail to send hb msg, instance:%p, handle:%p, fqdn:%s, port:%d, error:%x - %s", trans.transInst, + trans.transHandle, nodeEpId->ep.fqdn, nodeEpId->ep.port, code, tstrerror(code)); SCH_ERR_JRET(code); } @@ -1712,12 +1721,12 @@ _return: int32_t schBuildAndSendMsg(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr, int32_t msgType) { uint32_t msgSize = 0; - void *msg = NULL; - int32_t code = 0; - bool isCandidateAddr = false; - bool persistHandle = false; - SRpcCtx rpcCtx = {0}; - + void *msg = NULL; + int32_t code = 0; + bool isCandidateAddr = false; + bool persistHandle = false; + SRpcCtx rpcCtx = {0}; + if (NULL == addr) { addr = taosArrayGet(pTask->candidateAddrs, pTask->candidateIdx); isCandidateAddr = true; @@ -1741,7 +1750,7 @@ int32_t schBuildAndSendMsg(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr, case TDMT_VND_QUERY: { SCH_ERR_RET(schMakeQueryRpcCtx(pJob, pTask, &rpcCtx)); - + uint32_t len = strlen(pJob->sql); msgSize = sizeof(SSubQueryMsg) + pTask->msgLen + len; msg = taosMemoryCalloc(1, msgSize); @@ -1822,7 +1831,7 @@ int32_t schBuildAndSendMsg(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr, } case TDMT_VND_QUERY_HEARTBEAT: { SCH_ERR_RET(schMakeHbRpcCtx(pJob, pTask, &rpcCtx)); - + SSchedulerHbReq req = {0}; req.sId = schMgmt.sId; req.header.vgId = addr->nodeId; @@ -1856,7 +1865,8 @@ int32_t schBuildAndSendMsg(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr, SCH_SET_TASK_LASTMSG_TYPE(pTask, msgType); SSchTrans trans = {.transInst = pJob->transport, .transHandle = SCH_GET_TASK_HANDLE(pTask)}; - SCH_ERR_JRET(schAsyncSendMsg(pJob, pTask, &trans, &epSet, msgType, msg, msgSize, persistHandle, (rpcCtx.args ? &rpcCtx : NULL))); + SCH_ERR_JRET(schAsyncSendMsg(pJob, pTask, &trans, &epSet, msgType, msg, msgSize, persistHandle, + (rpcCtx.args ? &rpcCtx : NULL))); if (msgType == TDMT_VND_QUERY) { SCH_ERR_RET(schRecordTaskExecNode(pJob, pTask, addr, trans.transHandle)); @@ -1902,7 +1912,7 @@ int32_t schLaunchTaskImpl(SSchJob *pJob, SSchTask *pTask) { if (schJobNeedToStop(pJob, &status)) { SCH_TASK_DLOG("no need to launch task cause of job status, job status:%s", jobTaskStatusStr(status)); - + SCH_RET(atomic_load_32(&pJob->errCode)); } @@ -1911,7 +1921,7 @@ int32_t schLaunchTaskImpl(SSchJob *pJob, SSchTask *pTask) { SCH_ERR_RET(schPushTaskToExecList(pJob, pTask)); SCH_SET_TASK_STATUS(pTask, JOB_TASK_STATUS_EXECUTING); } - + SSubplan *plan = pTask->plan; if (NULL == pTask->msg) { // TODO add more detailed reason for failure @@ -2071,7 +2081,7 @@ void schFreeJobImpl(void *job) { taosArrayDestroy(pJob->levels); taosArrayDestroy(pJob->nodeList); - + taosMemoryFreeClear(pJob->resData); taosMemoryFreeClear(pJob); @@ -2212,7 +2222,7 @@ int32_t schedulerExecJob(void *transport, SArray *nodeList, SQueryPlan *pDag, in pRes->code = atomic_load_32(&job->errCode); pRes->numOfRows = job->resNumOfRows; - + schReleaseJob(*pJob); return TSDB_CODE_SUCCESS; @@ -2400,7 +2410,7 @@ int32_t schedulerFetchRows(int64_t job, void **pData) { SCH_JOB_ELOG("job failed or dropping, status:%s", jobTaskStatusStr(status)); SCH_ERR_JRET(atomic_load_32(&pJob->errCode)); } - + if (pJob->resData && ((SRetrieveTableRsp *)pJob->resData)->completed) { SCH_ERR_JRET(schCheckAndUpdateJobStatus(pJob, JOB_TASK_STATUS_SUCCEED)); } From baa238eead7a88d564250b33a434248f0bb58c0c Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Thu, 31 Mar 2022 05:20:26 -0400 Subject: [PATCH 26/47] TD-14409 TD-14436 bugfix --- include/common/tmsg.h | 1 + include/util/taoserror.h | 2 + include/util/tdef.h | 2 +- source/common/src/tmsg.c | 2 + source/libs/parser/inc/sql.y | 1 + source/libs/parser/src/parAstCreater.c | 51 +- source/libs/parser/src/parTranslater.c | 1 + source/libs/parser/src/parUtil.c | 4 + source/libs/parser/src/sql.c | 2382 ++++++++++++------------ 9 files changed, 1232 insertions(+), 1214 deletions(-) diff --git a/include/common/tmsg.h b/include/common/tmsg.h index ca46657473..1123f5f020 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -524,6 +524,7 @@ typedef struct { int8_t walLevel; int8_t quorum; int8_t cacheLastRow; + int8_t replications; } SAlterDbReq; int32_t tSerializeSAlterDbReq(void* buf, int32_t bufLen, SAlterDbReq* pReq); diff --git a/include/util/taoserror.h b/include/util/taoserror.h index d49e83b012..42f4490051 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -478,6 +478,8 @@ int32_t* taosGetErrno(); #define TSDB_CODE_PAR_INVALID_ENDPOINT TAOS_DEF_ERROR_CODE(0, 0x2613) #define TSDB_CODE_PAR_EXPRIE_STATEMENT TAOS_DEF_ERROR_CODE(0, 0x2614) #define TSDB_CODE_PAR_INTERVAL_VALUE_TOO_SMALL TAOS_DEF_ERROR_CODE(0, 0x2615) +#define TSDB_CODE_PAR_DB_NOT_SPECIFIED TAOS_DEF_ERROR_CODE(0, 0x2616) +#define TSDB_CODE_PAR_INVALID_IDENTIFIER_NAME TAOS_DEF_ERROR_CODE(0, 0x2617) #ifdef __cplusplus } diff --git a/include/util/tdef.h b/include/util/tdef.h index 43981adea2..3a9e32c8c3 100644 --- a/include/util/tdef.h +++ b/include/util/tdef.h @@ -327,7 +327,7 @@ typedef enum ELogicConditionType { #define TSDB_MAX_FSYNC_PERIOD 180000 // millisecond #define TSDB_DEFAULT_FSYNC_PERIOD 3000 // three second -#define TSDB_MIN_WAL_LEVEL 0 +#define TSDB_MIN_WAL_LEVEL 1 #define TSDB_MAX_WAL_LEVEL 2 #define TSDB_DEFAULT_WAL_LEVEL 1 diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index c85184ffba..06dd2906be 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -1629,6 +1629,7 @@ int32_t tSerializeSAlterDbReq(void *buf, int32_t bufLen, SAlterDbReq *pReq) { if (tEncodeI8(&encoder, pReq->walLevel) < 0) return -1; if (tEncodeI8(&encoder, pReq->quorum) < 0) return -1; if (tEncodeI8(&encoder, pReq->cacheLastRow) < 0) return -1; + if (tEncodeI8(&encoder, pReq->replications) < 0) return -1; tEndEncode(&encoder); int32_t tlen = encoder.pos; @@ -1650,6 +1651,7 @@ int32_t tDeserializeSAlterDbReq(void *buf, int32_t bufLen, SAlterDbReq *pReq) { if (tDecodeI8(&decoder, &pReq->walLevel) < 0) return -1; if (tDecodeI8(&decoder, &pReq->quorum) < 0) return -1; if (tDecodeI8(&decoder, &pReq->cacheLastRow) < 0) return -1; + if (tDecodeI8(&decoder, &pReq->replications) < 0) return -1; tEndDecode(&decoder); tCoderClear(&decoder); diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index 60c3e29913..b8e5df8708 100644 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -159,6 +159,7 @@ alter_db_option(A) ::= KEEP NK_INTEGER(B). alter_db_option(A) ::= WAL NK_INTEGER(B). { A.type = DB_OPTION_WAL; A.val = B; } alter_db_option(A) ::= QUORUM NK_INTEGER(B). { A.type = DB_OPTION_QUORUM; A.val = B; } alter_db_option(A) ::= CACHELAST NK_INTEGER(B). { A.type = DB_OPTION_CACHELAST; A.val = B; } +alter_db_option(A) ::= REPLICA NK_INTEGER(B). { A.type = DB_OPTION_REPLICA; A.val = B; } /************************************************ create/drop table/stable ********************************************/ cmd ::= CREATE TABLE not_exists_opt(A) full_table_name(B) diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c index 7f3ba6d508..dd03a63759 100644 --- a/source/libs/parser/src/parAstCreater.c +++ b/source/libs/parser/src/parAstCreater.c @@ -180,9 +180,9 @@ static SDatabaseOptions* setDbQuorum(SAstCreateContext* pCxt, SDatabaseOptions* static SDatabaseOptions* setDbReplica(SAstCreateContext* pCxt, SDatabaseOptions* pOptions, const SToken* pVal) { int64_t val = strtol(pVal->z, NULL, 10); - if (val < TSDB_MIN_DB_REPLICA_OPTION || val > TSDB_MAX_DB_REPLICA_OPTION) { + if (!(val == TSDB_MIN_DB_REPLICA_OPTION || val == TSDB_MAX_DB_REPLICA_OPTION)) { snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, - "invalid db option replications: %"PRId64" valid range: [%d, %d]", val, TSDB_MIN_DB_REPLICA_OPTION, TSDB_MAX_DB_REPLICA_OPTION); + "invalid db option replications: %"PRId64", only 1, 3 allowed", val); pCxt->valid = false; return pOptions; } @@ -397,7 +397,9 @@ static bool checkUserName(SAstCreateContext* pCxt, SToken* pUserName) { pCxt->valid = false; } } - trimEscape(pUserName); + if (pCxt->valid) { + trimEscape(pUserName); + } return pCxt->valid; } @@ -472,45 +474,50 @@ static bool checkPort(SAstCreateContext* pCxt, const SToken* pPortToken, int32_t static bool checkDbName(SAstCreateContext* pCxt, SToken* pDbName, bool query) { if (NULL == pDbName) { - pCxt->valid = (query ? NULL != pCxt->pQueryCxt->db : true); - if (!pCxt->valid) { - snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, "db not specified"); + if (query && NULL == pCxt->pQueryCxt->db) { + generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_DB_NOT_SPECIFIED); + pCxt->valid = false; } } else { - pCxt->valid = pDbName->n < TSDB_DB_NAME_LEN ? true : false; + if (pDbName->n >= TSDB_DB_NAME_LEN) { + generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_IDENTIFIER_NAME, pDbName->z); + pCxt->valid = false; + } + } + if (pCxt->valid) { + trimEscape(pDbName); } - trimEscape(pDbName); return pCxt->valid; } static bool checkTableName(SAstCreateContext* pCxt, SToken* pTableName) { - if (NULL == pTableName) { - pCxt->valid = true; - } else { - pCxt->valid = pTableName->n < TSDB_TABLE_NAME_LEN ? true : false; + if (NULL != pTableName && pTableName->n >= TSDB_TABLE_NAME_LEN) { + generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_IDENTIFIER_NAME, pTableName->z); + pCxt->valid = false; + return false; } trimEscape(pTableName); - return pCxt->valid; + return true; } static bool checkColumnName(SAstCreateContext* pCxt, SToken* pColumnName) { - if (NULL == pColumnName) { - pCxt->valid = true; - } else { - pCxt->valid = pColumnName->n < TSDB_COL_NAME_LEN ? true : false; + if (NULL != pColumnName && pColumnName->n >= TSDB_COL_NAME_LEN) { + generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_IDENTIFIER_NAME, pColumnName->z); + pCxt->valid = false; + return false; } trimEscape(pColumnName); - return pCxt->valid; + return true; } static bool checkIndexName(SAstCreateContext* pCxt, SToken* pIndexName) { - if (NULL == pIndexName) { + if (NULL != pIndexName && pIndexName->n >= TSDB_INDEX_NAME_LEN) { + generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_IDENTIFIER_NAME, pIndexName->z); pCxt->valid = false; - } else { - pCxt->valid = pIndexName->n < TSDB_INDEX_NAME_LEN ? true : false; + return false; } trimEscape(pIndexName); - return pCxt->valid; + return true; } SNode* createRawExprNode(SAstCreateContext* pCxt, const SToken* pToken, SNode* pNode) { diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index a8ef762a73..0ea865882a 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -1048,6 +1048,7 @@ static void buildAlterDbReq(STranslateContext* pCxt, SAlterDatabaseStmt* pStmt, pReq->walLevel = pStmt->pOptions->walLevel; pReq->quorum = pStmt->pOptions->quorum; pReq->cacheLastRow = pStmt->pOptions->cachelast; + pReq->replications = pStmt->pOptions->replica; return; } diff --git a/source/libs/parser/src/parUtil.c b/source/libs/parser/src/parUtil.c index 80d04c5ee4..0b999322ce 100644 --- a/source/libs/parser/src/parUtil.c +++ b/source/libs/parser/src/parUtil.c @@ -61,6 +61,10 @@ static char* getSyntaxErrFormat(int32_t errCode) { return "This statement is no longer supported"; case TSDB_CODE_PAR_INTERVAL_VALUE_TOO_SMALL: return "This interval value is too small : %s"; + case TSDB_CODE_PAR_DB_NOT_SPECIFIED: + return "db not specified"; + case TSDB_CODE_PAR_INVALID_IDENTIFIER_NAME: + return "Invalid identifier name : %s"; case TSDB_CODE_OUT_OF_MEMORY: return "Out of memory"; default: diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index fc6a582da5..e94ef34783 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 445 -#define YYNRULE 357 +#define YYNSTATE 446 +#define YYNRULE 358 #define YYNTOKEN 179 -#define YY_MAX_SHIFT 444 -#define YY_MIN_SHIFTREDUCE 691 -#define YY_MAX_SHIFTREDUCE 1047 -#define YY_ERROR_ACTION 1048 -#define YY_ACCEPT_ACTION 1049 -#define YY_NO_ACTION 1050 -#define YY_MIN_REDUCE 1051 -#define YY_MAX_REDUCE 1407 +#define YY_MAX_SHIFT 445 +#define YY_MIN_SHIFTREDUCE 693 +#define YY_MAX_SHIFTREDUCE 1050 +#define YY_ERROR_ACTION 1051 +#define YY_ACCEPT_ACTION 1052 +#define YY_NO_ACTION 1053 +#define YY_MIN_REDUCE 1054 +#define YY_MAX_REDUCE 1411 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -209,144 +209,142 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (1352) +#define YY_ACTTAB_COUNT (1331) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 1264, 344, 24, 174, 363, 363, 258, 243, 1260, 1267, - /* 10 */ 1230, 1231, 31, 29, 27, 26, 25, 1277, 376, 376, + /* 0 */ 1268, 345, 24, 174, 364, 364, 258, 243, 1264, 1271, + /* 10 */ 1234, 1235, 31, 29, 27, 26, 25, 1281, 377, 377, /* 20 */ 9, 8, 95, 69, 69, 31, 29, 27, 26, 25, - /* 30 */ 293, 299, 344, 1386, 108, 62, 1063, 1293, 376, 1154, - /* 40 */ 1154, 348, 1145, 262, 360, 96, 120, 217, 1094, 251, - /* 50 */ 1384, 93, 1146, 95, 362, 375, 1221, 1223, 1251, 1154, - /* 60 */ 217, 167, 1332, 343, 112, 342, 1097, 46, 1386, 923, - /* 70 */ 65, 1278, 1279, 1282, 1325, 1194, 92, 953, 233, 1321, - /* 80 */ 1398, 120, 93, 1251, 1149, 1384, 109, 1121, 966, 1359, - /* 90 */ 953, 346, 116, 1332, 1333, 272, 1337, 429, 428, 427, - /* 100 */ 426, 425, 424, 423, 422, 421, 420, 419, 418, 417, - /* 110 */ 416, 415, 414, 413, 412, 305, 954, 300, 375, 1293, - /* 120 */ 304, 1132, 908, 303, 1049, 301, 360, 80, 302, 954, - /* 130 */ 79, 78, 77, 76, 75, 74, 73, 72, 71, 317, - /* 140 */ 126, 125, 23, 238, 948, 949, 950, 951, 952, 956, - /* 150 */ 957, 958, 315, 375, 334, 23, 238, 948, 949, 950, - /* 160 */ 951, 952, 956, 957, 958, 1277, 12, 284, 31, 29, - /* 170 */ 27, 26, 25, 255, 800, 399, 398, 397, 804, 396, - /* 180 */ 806, 807, 395, 809, 392, 1293, 815, 389, 817, 818, - /* 190 */ 386, 383, 360, 31, 29, 27, 26, 25, 231, 1201, - /* 200 */ 1386, 12, 362, 1074, 30, 28, 1251, 257, 1277, 256, - /* 210 */ 1222, 348, 240, 120, 888, 1264, 1386, 1384, 64, 1278, - /* 220 */ 1279, 1282, 1325, 1260, 1266, 923, 216, 1321, 1293, 1385, - /* 230 */ 886, 46, 121, 1384, 912, 347, 333, 376, 1386, 11, - /* 240 */ 247, 246, 263, 297, 1251, 362, 1218, 296, 1150, 1251, - /* 250 */ 901, 120, 121, 124, 1277, 1384, 121, 1073, 1154, 284, - /* 260 */ 1, 65, 1278, 1279, 1282, 1325, 894, 376, 298, 233, - /* 270 */ 1321, 115, 283, 264, 1293, 339, 335, 30, 28, 990, - /* 280 */ 248, 360, 910, 170, 441, 240, 6, 888, 1154, 326, - /* 290 */ 1352, 362, 30, 28, 1293, 1251, 887, 1264, 1251, 215, - /* 300 */ 240, 360, 888, 886, 1044, 1260, 1266, 66, 1278, 1279, - /* 310 */ 1282, 1325, 11, 1052, 1072, 1324, 1321, 1339, 886, 1014, - /* 320 */ 377, 913, 889, 319, 892, 893, 206, 11, 936, 337, - /* 330 */ 437, 436, 897, 1, 80, 1336, 169, 79, 78, 77, - /* 340 */ 76, 75, 74, 73, 72, 71, 121, 1130, 1, 1051, - /* 350 */ 330, 1012, 1013, 1015, 1016, 1251, 1043, 441, 902, 1071, - /* 360 */ 905, 893, 376, 320, 1070, 1277, 376, 1151, 989, 887, - /* 370 */ 1271, 373, 441, 89, 88, 87, 86, 85, 84, 83, - /* 380 */ 82, 81, 1269, 1154, 887, 1293, 107, 1154, 1277, 338, - /* 390 */ 1386, 1069, 347, 411, 1157, 889, 985, 892, 893, 206, - /* 400 */ 1251, 936, 362, 120, 351, 1251, 1251, 1384, 1293, 121, - /* 410 */ 889, 1277, 892, 893, 206, 360, 936, 727, 65, 1278, - /* 420 */ 1279, 1282, 1325, 155, 1201, 362, 233, 1321, 115, 1251, - /* 430 */ 230, 1293, 1251, 291, 344, 1199, 1339, 728, 360, 727, - /* 440 */ 1068, 65, 1278, 1279, 1282, 1325, 55, 1353, 362, 233, - /* 450 */ 1321, 1398, 1251, 355, 1335, 95, 955, 729, 1067, 1339, - /* 460 */ 1382, 30, 28, 1147, 65, 1278, 1279, 1282, 1325, 240, - /* 470 */ 1277, 888, 233, 1321, 1398, 1131, 911, 1334, 30, 28, - /* 480 */ 361, 1251, 21, 1343, 93, 411, 240, 886, 888, 909, - /* 490 */ 1293, 959, 30, 28, 117, 1332, 1333, 360, 1337, 1251, - /* 500 */ 240, 1066, 888, 194, 886, 244, 1184, 362, 1065, 376, - /* 510 */ 1062, 1251, 141, 107, 374, 139, 348, 7, 886, 988, - /* 520 */ 1061, 1156, 402, 207, 1278, 1279, 1282, 322, 224, 1201, - /* 530 */ 1154, 1064, 408, 1060, 7, 245, 407, 30, 28, 101, - /* 540 */ 1199, 441, 1251, 1386, 1201, 240, 356, 888, 7, 1251, - /* 550 */ 297, 1251, 61, 887, 296, 1200, 120, 409, 441, 997, - /* 560 */ 1384, 1251, 57, 886, 225, 910, 223, 222, 1277, 295, - /* 570 */ 887, 350, 441, 1143, 1251, 298, 406, 405, 404, 889, - /* 580 */ 403, 892, 893, 206, 887, 936, 1139, 376, 1293, 1344, - /* 590 */ 985, 1277, 188, 1, 359, 360, 889, 1141, 892, 893, - /* 600 */ 206, 143, 936, 121, 142, 362, 9, 8, 1154, 1251, - /* 610 */ 889, 1293, 892, 893, 206, 376, 936, 441, 360, 250, - /* 620 */ 254, 66, 1278, 1279, 1282, 1325, 1137, 107, 362, 887, - /* 630 */ 1322, 1201, 1251, 199, 1059, 1156, 1154, 252, 201, 27, - /* 640 */ 26, 25, 1199, 1277, 66, 1278, 1279, 1282, 1325, 1277, - /* 650 */ 200, 344, 358, 1321, 1277, 889, 896, 892, 893, 206, - /* 660 */ 127, 936, 935, 1293, 937, 938, 939, 940, 941, 1293, - /* 670 */ 360, 1011, 95, 1058, 1293, 1251, 360, 1057, 1056, 945, - /* 680 */ 362, 360, 1055, 42, 1251, 145, 362, 1054, 144, 147, - /* 690 */ 1251, 362, 146, 239, 1122, 1251, 110, 1278, 1279, 1282, - /* 700 */ 1277, 93, 211, 1278, 1279, 1282, 1277, 110, 1278, 1279, - /* 710 */ 1282, 118, 1332, 1333, 1251, 1337, 253, 352, 1251, 1251, - /* 720 */ 1293, 67, 899, 1251, 107, 171, 1293, 360, 1251, 1090, - /* 730 */ 1277, 401, 1156, 360, 349, 1399, 888, 362, 44, 43, - /* 740 */ 261, 1251, 122, 362, 327, 331, 1400, 1251, 1046, 1047, - /* 750 */ 1293, 306, 886, 211, 1278, 1279, 1282, 360, 1085, 210, - /* 760 */ 1278, 1279, 1282, 908, 1195, 160, 960, 362, 1277, 121, - /* 770 */ 265, 1251, 1083, 277, 237, 895, 164, 158, 32, 444, - /* 780 */ 308, 290, 278, 211, 1278, 1279, 1282, 20, 1293, 1355, - /* 790 */ 345, 340, 1294, 191, 311, 360, 91, 31, 29, 27, - /* 800 */ 26, 25, 433, 22, 190, 362, 441, 920, 353, 1251, - /* 810 */ 173, 1277, 241, 31, 29, 27, 26, 25, 887, 32, - /* 820 */ 872, 211, 1278, 1279, 1282, 179, 2, 63, 368, 881, - /* 830 */ 186, 1293, 32, 185, 908, 192, 1220, 177, 360, 793, - /* 840 */ 98, 898, 1277, 123, 889, 99, 892, 893, 362, 266, - /* 850 */ 276, 101, 1251, 271, 270, 269, 268, 267, 788, 273, - /* 860 */ 274, 372, 1293, 821, 209, 1278, 1279, 1282, 825, 360, - /* 870 */ 42, 275, 831, 1277, 279, 381, 916, 280, 325, 362, - /* 880 */ 99, 151, 1277, 1251, 100, 128, 31, 29, 27, 26, - /* 890 */ 25, 830, 281, 1293, 102, 212, 1278, 1279, 1282, 915, - /* 900 */ 360, 282, 1293, 101, 1277, 131, 99, 45, 285, 360, - /* 910 */ 362, 134, 914, 1277, 1251, 294, 292, 229, 1144, 362, - /* 920 */ 138, 1140, 90, 1251, 1293, 140, 204, 1278, 1279, 1282, - /* 930 */ 321, 360, 103, 1293, 1129, 213, 1278, 1279, 1282, 150, - /* 940 */ 360, 362, 104, 1277, 1142, 1251, 324, 1138, 105, 106, - /* 950 */ 362, 1277, 153, 913, 1251, 332, 366, 205, 1278, 1279, - /* 960 */ 1282, 1356, 323, 1293, 1366, 156, 214, 1278, 1279, 1282, - /* 970 */ 360, 1293, 329, 893, 1277, 1365, 5, 305, 360, 300, - /* 980 */ 362, 159, 304, 341, 1251, 303, 232, 301, 362, 336, - /* 990 */ 302, 408, 1251, 328, 1293, 407, 1290, 1278, 1279, 1282, - /* 1000 */ 163, 360, 4, 985, 1289, 1278, 1279, 1282, 912, 113, - /* 1010 */ 1346, 362, 165, 1277, 94, 1251, 409, 1340, 33, 166, - /* 1020 */ 234, 1277, 357, 354, 17, 1307, 1229, 1288, 1278, 1279, - /* 1030 */ 1282, 1401, 172, 1293, 364, 406, 405, 404, 1383, 403, - /* 1040 */ 360, 1293, 365, 242, 1277, 1228, 369, 370, 360, 371, - /* 1050 */ 362, 181, 1277, 183, 1251, 310, 193, 1155, 362, 54, - /* 1060 */ 56, 195, 1251, 189, 1293, 379, 220, 1278, 1279, 1282, - /* 1070 */ 318, 360, 1293, 440, 219, 1278, 1279, 1282, 202, 360, - /* 1080 */ 203, 362, 197, 1277, 149, 1251, 198, 313, 1245, 362, - /* 1090 */ 884, 39, 307, 1251, 883, 148, 1239, 221, 1278, 1279, - /* 1100 */ 1282, 1238, 259, 1293, 260, 218, 1278, 1279, 1282, 1237, - /* 1110 */ 360, 1236, 855, 1213, 1212, 97, 1211, 1210, 41, 136, - /* 1120 */ 362, 40, 114, 1209, 1251, 1208, 1207, 1206, 289, 857, - /* 1130 */ 135, 1205, 1204, 1203, 1202, 1096, 208, 1278, 1279, 1282, - /* 1140 */ 1235, 1226, 130, 1133, 1095, 740, 1093, 288, 286, 1082, - /* 1150 */ 1081, 287, 1078, 47, 1135, 70, 133, 137, 838, 837, - /* 1160 */ 836, 1134, 768, 1091, 226, 1086, 767, 766, 765, 227, - /* 1170 */ 1084, 1077, 1076, 228, 764, 763, 68, 314, 309, 316, - /* 1180 */ 1234, 1233, 36, 312, 1225, 154, 48, 3, 14, 32, - /* 1190 */ 111, 152, 15, 37, 34, 10, 51, 8, 946, 367, - /* 1200 */ 162, 184, 832, 132, 1224, 1050, 1050, 129, 1050, 1050, - /* 1210 */ 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1032, 1050, 1050, - /* 1220 */ 1031, 235, 157, 1036, 1035, 236, 1050, 1010, 161, 1050, - /* 1230 */ 903, 1004, 49, 182, 1050, 1003, 50, 1050, 982, 1269, - /* 1240 */ 1050, 829, 981, 1050, 1050, 1037, 1050, 1050, 19, 1050, - /* 1250 */ 1050, 1050, 1050, 1050, 168, 1050, 35, 119, 921, 16, - /* 1260 */ 176, 13, 18, 380, 249, 1008, 178, 180, 175, 52, - /* 1270 */ 53, 384, 387, 1050, 1050, 57, 1092, 390, 1050, 1050, - /* 1280 */ 1268, 393, 799, 1050, 1050, 187, 38, 1050, 827, 760, - /* 1290 */ 738, 822, 382, 752, 438, 1050, 1050, 819, 816, 385, - /* 1300 */ 378, 810, 833, 828, 388, 391, 759, 758, 757, 808, - /* 1310 */ 410, 756, 1080, 1079, 394, 430, 755, 814, 1075, 754, - /* 1320 */ 753, 751, 439, 442, 750, 749, 435, 58, 748, 59, - /* 1330 */ 60, 747, 746, 890, 432, 443, 745, 744, 743, 431, - /* 1340 */ 400, 196, 434, 813, 1050, 1050, 1050, 1050, 1050, 812, - /* 1350 */ 1050, 811, + /* 30 */ 293, 299, 345, 1390, 108, 62, 1066, 1297, 377, 1158, + /* 40 */ 1158, 349, 1149, 262, 361, 96, 120, 217, 1097, 251, + /* 50 */ 1388, 93, 1150, 95, 363, 376, 1225, 1227, 1255, 1158, + /* 60 */ 217, 167, 1336, 344, 112, 343, 1100, 46, 1390, 926, + /* 70 */ 65, 1282, 1283, 1286, 1329, 1198, 92, 956, 233, 1325, + /* 80 */ 1402, 120, 93, 1255, 1153, 1388, 109, 1124, 969, 1363, + /* 90 */ 956, 347, 116, 1336, 1337, 272, 1341, 430, 429, 428, + /* 100 */ 427, 426, 425, 424, 423, 422, 421, 420, 419, 418, + /* 110 */ 417, 416, 415, 414, 413, 306, 957, 301, 376, 730, + /* 120 */ 305, 729, 911, 304, 1052, 302, 300, 81, 303, 957, + /* 130 */ 80, 79, 78, 77, 76, 75, 74, 73, 72, 731, + /* 140 */ 126, 125, 23, 238, 951, 952, 953, 954, 955, 959, + /* 150 */ 960, 961, 27, 26, 25, 23, 238, 951, 952, 953, + /* 160 */ 954, 955, 959, 960, 961, 1281, 12, 284, 31, 29, + /* 170 */ 27, 26, 25, 255, 803, 400, 399, 398, 807, 397, + /* 180 */ 809, 810, 396, 812, 393, 1297, 818, 390, 820, 821, + /* 190 */ 387, 384, 361, 31, 29, 27, 26, 25, 231, 1205, + /* 200 */ 1390, 352, 363, 1077, 30, 28, 1255, 257, 1281, 256, + /* 210 */ 1226, 349, 240, 120, 891, 1268, 1390, 1388, 64, 1282, + /* 220 */ 1283, 1286, 1329, 1264, 1270, 926, 216, 1325, 1297, 1389, + /* 230 */ 889, 46, 121, 1388, 376, 348, 334, 377, 1390, 11, + /* 240 */ 247, 246, 263, 297, 1255, 363, 1222, 296, 1154, 1255, + /* 250 */ 904, 120, 121, 124, 1281, 1388, 121, 1076, 1158, 913, + /* 260 */ 1, 65, 1282, 1283, 1286, 1329, 897, 377, 298, 233, + /* 270 */ 1325, 115, 283, 264, 1297, 340, 336, 30, 28, 993, + /* 280 */ 248, 361, 12, 170, 442, 240, 6, 891, 1158, 327, + /* 290 */ 1356, 363, 30, 28, 1297, 1255, 890, 1268, 1255, 215, + /* 300 */ 240, 361, 891, 889, 1047, 1264, 1270, 66, 1282, 1283, + /* 310 */ 1286, 1329, 11, 1055, 1075, 1328, 1325, 339, 889, 1017, + /* 320 */ 378, 915, 892, 320, 895, 896, 206, 11, 939, 335, + /* 330 */ 1074, 121, 900, 1, 81, 438, 437, 80, 79, 78, + /* 340 */ 77, 76, 75, 74, 73, 72, 121, 1136, 1, 1054, + /* 350 */ 331, 1015, 1016, 1018, 1019, 1255, 1046, 442, 905, 1297, + /* 360 */ 908, 896, 377, 321, 1073, 1281, 361, 1155, 351, 890, + /* 370 */ 914, 1255, 442, 90, 89, 88, 87, 86, 85, 84, + /* 380 */ 83, 82, 1343, 1158, 890, 1297, 1343, 1134, 1281, 412, + /* 390 */ 1390, 1072, 348, 284, 338, 892, 988, 895, 896, 206, + /* 400 */ 1340, 939, 363, 120, 1339, 1255, 1255, 1388, 1297, 912, + /* 410 */ 892, 1281, 895, 896, 206, 361, 939, 1071, 65, 1282, + /* 420 */ 1283, 1286, 1329, 169, 1205, 363, 233, 1325, 115, 1255, + /* 430 */ 230, 1297, 1255, 412, 345, 1203, 1343, 729, 361, 992, + /* 440 */ 1070, 65, 1282, 1283, 1286, 1329, 55, 1357, 363, 233, + /* 450 */ 1325, 1402, 1255, 291, 1338, 95, 958, 916, 1255, 356, + /* 460 */ 1386, 30, 28, 1151, 65, 1282, 1283, 1286, 1329, 240, + /* 470 */ 1281, 891, 233, 1325, 1402, 1135, 318, 107, 30, 28, + /* 480 */ 362, 1255, 21, 1347, 93, 1161, 240, 889, 891, 316, + /* 490 */ 1297, 962, 30, 28, 117, 1336, 1337, 361, 1341, 403, + /* 500 */ 240, 1069, 891, 194, 889, 244, 1188, 363, 1068, 377, + /* 510 */ 1065, 1255, 141, 107, 374, 139, 349, 7, 889, 143, + /* 520 */ 1064, 1160, 142, 207, 1282, 1283, 1286, 323, 224, 1205, + /* 530 */ 1158, 1067, 409, 1063, 7, 245, 408, 30, 28, 101, + /* 540 */ 1203, 442, 1255, 1390, 1205, 240, 1125, 891, 7, 1255, + /* 550 */ 297, 1255, 357, 890, 296, 1204, 120, 410, 442, 155, + /* 560 */ 1388, 1255, 1147, 889, 225, 1000, 223, 222, 1281, 295, + /* 570 */ 890, 913, 442, 1143, 1255, 298, 407, 406, 405, 892, + /* 580 */ 404, 895, 896, 206, 890, 939, 145, 377, 1297, 144, + /* 590 */ 991, 1281, 375, 1, 353, 361, 892, 1145, 895, 896, + /* 600 */ 206, 147, 939, 121, 146, 363, 1348, 988, 1158, 1255, + /* 610 */ 892, 1297, 895, 896, 206, 377, 939, 442, 361, 250, + /* 620 */ 188, 66, 1282, 1283, 1286, 1329, 1141, 107, 363, 890, + /* 630 */ 1326, 1205, 1255, 199, 1062, 1160, 1158, 252, 201, 9, + /* 640 */ 8, 1061, 1203, 1281, 66, 1282, 1283, 1286, 1329, 1281, + /* 650 */ 200, 345, 359, 1325, 1281, 892, 402, 895, 896, 206, + /* 660 */ 127, 939, 938, 1297, 940, 941, 942, 943, 944, 1297, + /* 670 */ 361, 1014, 95, 377, 1297, 1255, 361, 1060, 254, 899, + /* 680 */ 363, 361, 1255, 42, 1255, 354, 363, 1059, 1058, 171, + /* 690 */ 1255, 363, 1093, 239, 1158, 1255, 110, 1282, 1283, 1286, + /* 700 */ 1281, 93, 211, 1282, 1283, 1286, 1281, 110, 1282, 1283, + /* 710 */ 1286, 118, 1336, 1337, 307, 1341, 253, 1057, 1255, 160, + /* 720 */ 1297, 67, 1049, 1050, 107, 360, 1297, 361, 1255, 1255, + /* 730 */ 1281, 158, 1160, 361, 350, 1403, 891, 363, 44, 43, + /* 740 */ 261, 1255, 122, 363, 328, 902, 1404, 1255, 332, 1199, + /* 750 */ 1297, 164, 889, 211, 1282, 1283, 1286, 361, 1255, 210, + /* 760 */ 1282, 1283, 1286, 911, 963, 923, 1275, 363, 1281, 121, + /* 770 */ 265, 1255, 1088, 277, 237, 898, 32, 32, 1273, 445, + /* 780 */ 875, 290, 278, 211, 1282, 1283, 1286, 20, 1297, 1359, + /* 790 */ 1298, 341, 32, 191, 309, 361, 91, 31, 29, 27, + /* 800 */ 26, 25, 434, 22, 190, 363, 442, 1086, 179, 1255, + /* 810 */ 948, 1281, 241, 31, 29, 27, 26, 25, 890, 346, + /* 820 */ 177, 211, 1282, 1283, 1286, 369, 61, 63, 185, 312, + /* 830 */ 186, 1297, 173, 796, 2, 884, 57, 98, 361, 791, + /* 840 */ 99, 901, 1281, 192, 892, 101, 895, 896, 363, 911, + /* 850 */ 276, 42, 1255, 271, 270, 269, 268, 267, 824, 1224, + /* 860 */ 123, 373, 1297, 828, 209, 1282, 1283, 1286, 834, 361, + /* 870 */ 382, 266, 833, 1281, 273, 99, 275, 279, 326, 363, + /* 880 */ 100, 151, 1281, 1255, 101, 919, 31, 29, 27, 26, + /* 890 */ 25, 102, 274, 1297, 280, 212, 1282, 1283, 1286, 128, + /* 900 */ 361, 918, 1297, 99, 1281, 282, 281, 131, 45, 361, + /* 910 */ 363, 285, 917, 1281, 1255, 134, 292, 294, 1148, 363, + /* 920 */ 229, 138, 1144, 1255, 1297, 150, 204, 1282, 1283, 1286, + /* 930 */ 140, 361, 103, 1297, 1133, 213, 1282, 1283, 1286, 71, + /* 940 */ 361, 363, 104, 1281, 1146, 1255, 1142, 325, 105, 106, + /* 950 */ 363, 1281, 153, 322, 1255, 916, 367, 205, 1282, 1283, + /* 960 */ 1286, 324, 333, 1297, 1370, 896, 214, 1282, 1283, 1286, + /* 970 */ 361, 1297, 156, 330, 1281, 1360, 232, 1369, 361, 159, + /* 980 */ 363, 5, 342, 1350, 1255, 337, 94, 329, 363, 4, + /* 990 */ 163, 409, 1255, 113, 1297, 408, 1294, 1282, 1283, 1286, + /* 1000 */ 988, 361, 915, 33, 1293, 1282, 1283, 1286, 1344, 166, + /* 1010 */ 234, 363, 165, 1281, 358, 1255, 410, 355, 17, 365, + /* 1020 */ 1311, 1281, 1233, 370, 181, 1405, 1232, 1292, 1282, 1283, + /* 1030 */ 1286, 366, 242, 1297, 371, 407, 406, 405, 1387, 404, + /* 1040 */ 361, 1297, 183, 172, 1281, 372, 193, 54, 361, 1159, + /* 1050 */ 363, 56, 1281, 189, 1255, 311, 380, 195, 363, 441, + /* 1060 */ 202, 197, 1255, 203, 1297, 39, 220, 1282, 1283, 1286, + /* 1070 */ 319, 361, 1297, 198, 219, 1282, 1283, 1286, 1249, 361, + /* 1080 */ 887, 363, 886, 1281, 149, 1255, 259, 314, 1243, 363, + /* 1090 */ 1242, 260, 308, 1255, 1241, 148, 1240, 221, 1282, 1283, + /* 1100 */ 1286, 858, 1217, 1297, 1216, 218, 1282, 1283, 1286, 97, + /* 1110 */ 361, 1215, 1214, 1213, 1212, 1211, 1210, 860, 41, 136, + /* 1120 */ 363, 40, 114, 1209, 1255, 1208, 1207, 1206, 289, 1099, + /* 1130 */ 135, 1239, 1230, 1137, 130, 742, 208, 1282, 1283, 1286, + /* 1140 */ 1098, 1096, 287, 286, 288, 1085, 1084, 306, 1081, 301, + /* 1150 */ 1139, 70, 305, 47, 137, 304, 133, 302, 300, 841, + /* 1160 */ 303, 839, 840, 1138, 1094, 226, 771, 1089, 770, 227, + /* 1170 */ 1087, 228, 769, 768, 767, 766, 765, 1080, 315, 1079, + /* 1180 */ 317, 310, 313, 1238, 1237, 68, 36, 1229, 48, 154, + /* 1190 */ 3, 32, 14, 15, 152, 34, 10, 51, 37, 162, + /* 1200 */ 19, 8, 1273, 132, 368, 949, 1228, 129, 1053, 184, + /* 1210 */ 1053, 835, 1035, 1034, 235, 1053, 1039, 1053, 1038, 236, + /* 1220 */ 1053, 157, 1013, 111, 906, 161, 1053, 1053, 1007, 49, + /* 1230 */ 1053, 1006, 1053, 1053, 50, 35, 1053, 985, 984, 1053, + /* 1240 */ 168, 1040, 1053, 182, 1053, 381, 249, 1053, 1053, 1053, + /* 1250 */ 832, 119, 385, 13, 16, 924, 18, 388, 176, 1011, + /* 1260 */ 178, 391, 175, 180, 52, 53, 802, 394, 1095, 57, + /* 1270 */ 1053, 38, 1053, 825, 1272, 830, 444, 836, 187, 822, + /* 1280 */ 379, 383, 762, 386, 831, 754, 819, 1083, 389, 761, + /* 1290 */ 760, 813, 392, 759, 811, 740, 758, 757, 395, 817, + /* 1300 */ 756, 411, 755, 753, 752, 751, 58, 431, 750, 59, + /* 1310 */ 60, 1082, 749, 748, 747, 433, 746, 745, 401, 432, + /* 1320 */ 816, 1078, 435, 436, 439, 440, 815, 893, 196, 814, + /* 1330 */ 443, }; static const YYCODETYPE yy_lookahead[] = { /* 0 */ 223, 188, 240, 241, 219, 219, 228, 222, 231, 232, @@ -360,131 +358,131 @@ static const YYCODETYPE yy_lookahead[] = { /* 80 */ 245, 268, 238, 223, 207, 272, 191, 192, 69, 254, /* 90 */ 77, 247, 248, 249, 250, 63, 252, 49, 50, 51, /* 100 */ 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, - /* 110 */ 62, 63, 64, 65, 66, 49, 116, 51, 20, 202, - /* 120 */ 54, 0, 20, 57, 179, 59, 209, 21, 62, 116, - /* 130 */ 24, 25, 26, 27, 28, 29, 30, 31, 32, 21, + /* 110 */ 62, 63, 64, 65, 66, 49, 116, 51, 20, 20, + /* 120 */ 54, 22, 20, 57, 179, 59, 60, 21, 62, 116, + /* 130 */ 24, 25, 26, 27, 28, 29, 30, 31, 32, 40, /* 140 */ 108, 109, 142, 143, 144, 145, 146, 147, 148, 149, - /* 150 */ 150, 151, 34, 20, 237, 142, 143, 144, 145, 146, + /* 150 */ 150, 151, 14, 15, 16, 142, 143, 144, 145, 146, /* 160 */ 147, 148, 149, 150, 151, 182, 68, 46, 12, 13, /* 170 */ 14, 15, 16, 228, 83, 84, 85, 86, 87, 88, /* 180 */ 89, 90, 91, 92, 93, 202, 95, 96, 97, 98, /* 190 */ 99, 100, 209, 12, 13, 14, 15, 16, 206, 202, - /* 200 */ 255, 68, 219, 182, 12, 13, 223, 129, 182, 131, + /* 200 */ 255, 3, 219, 182, 12, 13, 223, 129, 182, 131, /* 210 */ 213, 228, 20, 268, 22, 223, 255, 272, 235, 236, /* 220 */ 237, 238, 239, 231, 232, 69, 243, 244, 202, 268, /* 230 */ 38, 190, 154, 272, 20, 209, 120, 188, 255, 47, /* 240 */ 12, 13, 193, 57, 223, 219, 209, 61, 207, 223, - /* 250 */ 22, 268, 154, 216, 182, 272, 154, 182, 209, 46, + /* 250 */ 22, 268, 154, 216, 182, 272, 154, 182, 209, 20, /* 260 */ 68, 235, 236, 237, 238, 239, 38, 188, 82, 243, /* 270 */ 244, 245, 193, 188, 202, 159, 160, 12, 13, 14, - /* 280 */ 206, 209, 20, 257, 92, 20, 43, 22, 209, 263, + /* 280 */ 206, 209, 68, 257, 92, 20, 43, 22, 209, 263, /* 290 */ 264, 219, 12, 13, 202, 223, 104, 223, 223, 214, /* 300 */ 20, 209, 22, 38, 123, 231, 232, 235, 236, 237, - /* 310 */ 238, 239, 47, 0, 182, 243, 244, 233, 38, 132, + /* 310 */ 238, 239, 47, 0, 182, 243, 244, 20, 38, 132, /* 320 */ 92, 20, 130, 188, 132, 133, 134, 47, 136, 237, - /* 330 */ 185, 186, 104, 68, 21, 251, 122, 24, 25, 26, + /* 330 */ 182, 154, 104, 68, 21, 185, 186, 24, 25, 26, /* 340 */ 27, 28, 29, 30, 31, 32, 154, 0, 68, 0, - /* 350 */ 163, 164, 165, 166, 167, 223, 175, 92, 130, 182, - /* 360 */ 132, 133, 188, 228, 182, 182, 188, 193, 4, 104, - /* 370 */ 68, 193, 92, 24, 25, 26, 27, 28, 29, 30, - /* 380 */ 31, 32, 80, 209, 104, 202, 202, 209, 182, 20, - /* 390 */ 255, 182, 209, 46, 210, 130, 153, 132, 133, 134, - /* 400 */ 223, 136, 219, 268, 3, 223, 223, 272, 202, 154, - /* 410 */ 130, 182, 132, 133, 134, 209, 136, 22, 235, 236, + /* 350 */ 163, 164, 165, 166, 167, 223, 175, 92, 130, 202, + /* 360 */ 132, 133, 188, 228, 182, 182, 209, 193, 170, 104, + /* 370 */ 20, 223, 92, 24, 25, 26, 27, 28, 29, 30, + /* 380 */ 31, 32, 233, 209, 104, 202, 233, 0, 182, 46, + /* 390 */ 255, 182, 209, 46, 237, 130, 153, 132, 133, 134, + /* 400 */ 251, 136, 219, 268, 251, 223, 223, 272, 202, 20, + /* 410 */ 130, 182, 132, 133, 134, 209, 136, 182, 235, 236, /* 420 */ 237, 238, 239, 122, 202, 219, 243, 244, 245, 223, - /* 430 */ 208, 202, 223, 38, 188, 213, 233, 20, 209, 22, + /* 430 */ 208, 202, 223, 46, 188, 213, 233, 22, 209, 4, /* 440 */ 182, 235, 236, 237, 238, 239, 187, 264, 219, 243, - /* 450 */ 244, 245, 223, 81, 251, 209, 116, 40, 182, 233, + /* 450 */ 244, 245, 223, 38, 251, 209, 116, 20, 223, 81, /* 460 */ 254, 12, 13, 204, 235, 236, 237, 238, 239, 20, - /* 470 */ 182, 22, 243, 244, 245, 0, 20, 251, 12, 13, - /* 480 */ 14, 223, 142, 254, 238, 46, 20, 38, 22, 20, - /* 490 */ 202, 151, 12, 13, 248, 249, 250, 209, 252, 223, + /* 470 */ 182, 22, 243, 244, 245, 0, 21, 202, 12, 13, + /* 480 */ 14, 223, 142, 254, 238, 210, 20, 38, 22, 34, + /* 490 */ 202, 151, 12, 13, 248, 249, 250, 209, 252, 79, /* 500 */ 20, 182, 22, 195, 38, 194, 198, 219, 182, 188, - /* 510 */ 182, 223, 72, 202, 193, 75, 228, 68, 38, 155, - /* 520 */ 182, 210, 79, 235, 236, 237, 238, 69, 35, 202, + /* 510 */ 182, 223, 72, 202, 193, 75, 228, 68, 38, 72, + /* 520 */ 182, 210, 75, 235, 236, 237, 238, 69, 35, 202, /* 530 */ 209, 183, 57, 182, 68, 208, 61, 12, 13, 81, - /* 540 */ 213, 92, 223, 255, 202, 20, 174, 22, 68, 223, - /* 550 */ 57, 223, 68, 104, 61, 213, 268, 82, 92, 14, - /* 560 */ 272, 223, 78, 38, 71, 20, 73, 74, 182, 76, - /* 570 */ 104, 170, 92, 203, 223, 82, 101, 102, 103, 130, - /* 580 */ 105, 132, 133, 134, 104, 136, 203, 188, 202, 152, - /* 590 */ 153, 182, 193, 68, 47, 209, 130, 203, 132, 133, - /* 600 */ 134, 72, 136, 154, 75, 219, 1, 2, 209, 223, + /* 540 */ 213, 92, 223, 255, 202, 20, 192, 22, 68, 223, + /* 550 */ 57, 223, 174, 104, 61, 213, 268, 82, 92, 122, + /* 560 */ 272, 223, 203, 38, 71, 14, 73, 74, 182, 76, + /* 570 */ 104, 20, 92, 203, 223, 82, 101, 102, 103, 130, + /* 580 */ 105, 132, 133, 134, 104, 136, 72, 188, 202, 75, + /* 590 */ 155, 182, 193, 68, 81, 209, 130, 203, 132, 133, + /* 600 */ 134, 72, 136, 154, 75, 219, 152, 153, 209, 223, /* 610 */ 130, 202, 132, 133, 134, 188, 136, 92, 209, 194, /* 620 */ 193, 235, 236, 237, 238, 239, 203, 202, 219, 104, - /* 630 */ 244, 202, 223, 18, 182, 210, 209, 208, 23, 14, - /* 640 */ 15, 16, 213, 182, 235, 236, 237, 238, 239, 182, - /* 650 */ 35, 188, 243, 244, 182, 130, 38, 132, 133, 134, + /* 630 */ 244, 202, 223, 18, 182, 210, 209, 208, 23, 1, + /* 640 */ 2, 182, 213, 182, 235, 236, 237, 238, 239, 182, + /* 650 */ 35, 188, 243, 244, 182, 130, 203, 132, 133, 134, /* 660 */ 45, 136, 135, 202, 137, 138, 139, 140, 141, 202, - /* 670 */ 209, 69, 209, 182, 202, 223, 209, 182, 182, 132, - /* 680 */ 219, 209, 182, 81, 223, 72, 219, 182, 75, 72, - /* 690 */ 223, 219, 75, 226, 192, 223, 235, 236, 237, 238, + /* 670 */ 209, 69, 209, 188, 202, 223, 209, 182, 193, 38, + /* 680 */ 219, 209, 223, 81, 223, 172, 219, 182, 182, 275, + /* 690 */ 223, 219, 0, 226, 209, 223, 235, 236, 237, 238, /* 700 */ 182, 238, 235, 236, 237, 238, 182, 235, 236, 237, - /* 710 */ 238, 248, 249, 250, 223, 252, 194, 81, 223, 223, - /* 720 */ 202, 106, 104, 223, 202, 275, 202, 209, 223, 0, - /* 730 */ 182, 203, 210, 209, 273, 274, 22, 219, 123, 124, - /* 740 */ 125, 223, 127, 219, 226, 266, 274, 223, 177, 178, - /* 750 */ 202, 22, 38, 235, 236, 237, 238, 209, 0, 235, - /* 760 */ 236, 237, 238, 20, 212, 69, 69, 219, 182, 154, - /* 770 */ 27, 223, 0, 30, 226, 38, 260, 81, 81, 19, - /* 780 */ 22, 185, 39, 235, 236, 237, 238, 2, 202, 234, - /* 790 */ 253, 267, 202, 33, 22, 209, 36, 12, 13, 14, - /* 800 */ 15, 16, 42, 2, 44, 219, 92, 69, 172, 223, - /* 810 */ 269, 182, 226, 12, 13, 14, 15, 16, 104, 81, - /* 820 */ 69, 235, 236, 237, 238, 69, 256, 67, 69, 128, - /* 830 */ 70, 202, 81, 69, 20, 229, 188, 81, 209, 69, - /* 840 */ 81, 104, 182, 115, 130, 81, 132, 133, 219, 217, - /* 850 */ 107, 81, 223, 110, 111, 112, 113, 114, 69, 215, - /* 860 */ 116, 101, 202, 69, 235, 236, 237, 238, 69, 209, - /* 870 */ 81, 215, 69, 182, 188, 81, 20, 227, 118, 219, - /* 880 */ 81, 121, 182, 223, 81, 190, 12, 13, 14, 15, - /* 890 */ 16, 69, 209, 202, 69, 235, 236, 237, 238, 20, - /* 900 */ 209, 220, 202, 81, 182, 190, 81, 190, 188, 209, - /* 910 */ 219, 190, 20, 182, 223, 202, 184, 184, 202, 219, - /* 920 */ 202, 202, 188, 223, 202, 202, 235, 236, 237, 238, - /* 930 */ 227, 209, 202, 202, 0, 235, 236, 237, 238, 187, - /* 940 */ 209, 219, 202, 182, 202, 223, 220, 202, 202, 202, - /* 950 */ 219, 182, 187, 20, 223, 162, 161, 235, 236, 237, - /* 960 */ 238, 234, 209, 202, 265, 224, 235, 236, 237, 238, - /* 970 */ 209, 202, 223, 133, 182, 265, 169, 49, 209, 51, - /* 980 */ 219, 224, 54, 168, 223, 57, 223, 59, 219, 223, - /* 990 */ 62, 57, 223, 157, 202, 61, 235, 236, 237, 238, - /* 1000 */ 261, 209, 156, 153, 235, 236, 237, 238, 20, 259, - /* 1010 */ 262, 219, 258, 182, 209, 223, 82, 233, 115, 246, - /* 1020 */ 176, 182, 173, 171, 68, 242, 224, 235, 236, 237, - /* 1030 */ 238, 276, 270, 202, 223, 101, 102, 103, 271, 105, - /* 1040 */ 209, 202, 223, 223, 182, 224, 119, 221, 209, 220, - /* 1050 */ 219, 209, 182, 187, 223, 4, 198, 209, 219, 187, - /* 1060 */ 68, 188, 223, 187, 202, 205, 235, 236, 237, 238, - /* 1070 */ 19, 209, 202, 184, 235, 236, 237, 238, 196, 209, - /* 1080 */ 196, 219, 189, 182, 33, 223, 180, 36, 0, 219, - /* 1090 */ 104, 230, 41, 223, 130, 44, 0, 235, 236, 237, - /* 1100 */ 238, 0, 50, 202, 126, 235, 236, 237, 238, 0, - /* 1110 */ 209, 0, 80, 0, 0, 115, 0, 0, 67, 33, - /* 1120 */ 219, 70, 36, 0, 223, 0, 0, 0, 42, 22, - /* 1130 */ 44, 0, 0, 0, 0, 0, 235, 236, 237, 238, - /* 1140 */ 0, 0, 43, 0, 0, 48, 0, 43, 38, 0, - /* 1150 */ 0, 36, 0, 67, 0, 77, 70, 75, 38, 38, - /* 1160 */ 22, 0, 38, 0, 22, 0, 38, 38, 38, 22, - /* 1170 */ 0, 0, 0, 22, 38, 38, 20, 22, 39, 22, - /* 1180 */ 0, 0, 122, 38, 0, 117, 68, 81, 158, 81, - /* 1190 */ 68, 43, 158, 81, 152, 158, 4, 2, 132, 120, - /* 1200 */ 81, 117, 104, 117, 0, 277, 277, 121, 277, 277, - /* 1210 */ 277, 277, 277, 277, 277, 277, 277, 38, 277, 277, - /* 1220 */ 38, 38, 69, 38, 38, 38, 277, 69, 68, 277, - /* 1230 */ 22, 69, 68, 43, 277, 69, 68, 277, 69, 80, - /* 1240 */ 277, 38, 69, 277, 277, 69, 277, 277, 81, 277, - /* 1250 */ 277, 277, 277, 277, 80, 277, 81, 80, 69, 81, - /* 1260 */ 69, 68, 68, 38, 38, 69, 68, 68, 80, 68, - /* 1270 */ 68, 38, 38, 277, 277, 78, 0, 38, 277, 277, - /* 1280 */ 80, 38, 22, 277, 277, 80, 68, 277, 22, 22, - /* 1290 */ 48, 69, 68, 22, 22, 277, 277, 69, 69, 68, - /* 1300 */ 79, 69, 38, 38, 68, 68, 38, 38, 38, 69, - /* 1310 */ 47, 38, 0, 0, 68, 38, 38, 94, 0, 38, - /* 1320 */ 38, 38, 21, 21, 38, 38, 37, 68, 38, 68, - /* 1330 */ 68, 38, 38, 22, 43, 20, 38, 38, 38, 36, - /* 1340 */ 82, 22, 38, 94, 277, 277, 277, 277, 277, 94, - /* 1350 */ 277, 94, 277, 277, 277, 277, 277, 277, 277, 277, + /* 710 */ 238, 248, 249, 250, 22, 252, 194, 182, 223, 69, + /* 720 */ 202, 106, 177, 178, 202, 47, 202, 209, 223, 223, + /* 730 */ 182, 81, 210, 209, 273, 274, 22, 219, 123, 124, + /* 740 */ 125, 223, 127, 219, 226, 104, 274, 223, 266, 212, + /* 750 */ 202, 260, 38, 235, 236, 237, 238, 209, 223, 235, + /* 760 */ 236, 237, 238, 20, 69, 69, 68, 219, 182, 154, + /* 770 */ 27, 223, 0, 30, 226, 38, 81, 81, 80, 19, + /* 780 */ 69, 185, 39, 235, 236, 237, 238, 2, 202, 234, + /* 790 */ 202, 267, 81, 33, 22, 209, 36, 12, 13, 14, + /* 800 */ 15, 16, 42, 2, 44, 219, 92, 0, 69, 223, + /* 810 */ 132, 182, 226, 12, 13, 14, 15, 16, 104, 253, + /* 820 */ 81, 235, 236, 237, 238, 69, 68, 67, 69, 22, + /* 830 */ 70, 202, 269, 69, 256, 128, 78, 81, 209, 69, + /* 840 */ 81, 104, 182, 229, 130, 81, 132, 133, 219, 20, + /* 850 */ 107, 81, 223, 110, 111, 112, 113, 114, 69, 188, + /* 860 */ 115, 101, 202, 69, 235, 236, 237, 238, 69, 209, + /* 870 */ 81, 217, 69, 182, 215, 81, 215, 188, 118, 219, + /* 880 */ 81, 121, 182, 223, 81, 20, 12, 13, 14, 15, + /* 890 */ 16, 69, 116, 202, 227, 235, 236, 237, 238, 190, + /* 900 */ 209, 20, 202, 81, 182, 220, 209, 190, 190, 209, + /* 910 */ 219, 188, 20, 182, 223, 190, 184, 202, 202, 219, + /* 920 */ 184, 202, 202, 223, 202, 187, 235, 236, 237, 238, + /* 930 */ 202, 209, 202, 202, 0, 235, 236, 237, 238, 188, + /* 940 */ 209, 219, 202, 182, 202, 223, 202, 220, 202, 202, + /* 950 */ 219, 182, 187, 227, 223, 20, 161, 235, 236, 237, + /* 960 */ 238, 209, 162, 202, 265, 133, 235, 236, 237, 238, + /* 970 */ 209, 202, 224, 223, 182, 234, 223, 265, 209, 224, + /* 980 */ 219, 169, 168, 262, 223, 223, 209, 157, 219, 156, + /* 990 */ 261, 57, 223, 259, 202, 61, 235, 236, 237, 238, + /* 1000 */ 153, 209, 20, 115, 235, 236, 237, 238, 233, 246, + /* 1010 */ 176, 219, 258, 182, 173, 223, 82, 171, 68, 223, + /* 1020 */ 242, 182, 224, 119, 209, 276, 224, 235, 236, 237, + /* 1030 */ 238, 223, 223, 202, 221, 101, 102, 103, 271, 105, + /* 1040 */ 209, 202, 187, 270, 182, 220, 198, 187, 209, 209, + /* 1050 */ 219, 68, 182, 187, 223, 4, 205, 188, 219, 184, + /* 1060 */ 196, 189, 223, 196, 202, 230, 235, 236, 237, 238, + /* 1070 */ 19, 209, 202, 180, 235, 236, 237, 238, 0, 209, + /* 1080 */ 104, 219, 130, 182, 33, 223, 50, 36, 0, 219, + /* 1090 */ 0, 126, 41, 223, 0, 44, 0, 235, 236, 237, + /* 1100 */ 238, 80, 0, 202, 0, 235, 236, 237, 238, 115, + /* 1110 */ 209, 0, 0, 0, 0, 0, 0, 22, 67, 33, + /* 1120 */ 219, 70, 36, 0, 223, 0, 0, 0, 42, 0, + /* 1130 */ 44, 0, 0, 0, 43, 48, 235, 236, 237, 238, + /* 1140 */ 0, 0, 36, 38, 43, 0, 0, 49, 0, 51, + /* 1150 */ 0, 77, 54, 67, 75, 57, 70, 59, 60, 38, + /* 1160 */ 62, 22, 38, 0, 0, 22, 38, 0, 38, 22, + /* 1170 */ 0, 22, 38, 38, 38, 38, 38, 0, 22, 0, + /* 1180 */ 22, 39, 38, 0, 0, 20, 122, 0, 68, 117, + /* 1190 */ 81, 81, 158, 158, 43, 152, 158, 4, 81, 81, + /* 1200 */ 81, 2, 80, 117, 120, 132, 0, 121, 277, 117, + /* 1210 */ 277, 104, 38, 38, 38, 277, 38, 277, 38, 38, + /* 1220 */ 277, 69, 69, 68, 22, 68, 277, 277, 69, 68, + /* 1230 */ 277, 69, 277, 277, 68, 81, 277, 69, 69, 277, + /* 1240 */ 80, 69, 277, 43, 277, 38, 38, 277, 277, 277, + /* 1250 */ 38, 80, 38, 68, 81, 69, 68, 38, 69, 69, + /* 1260 */ 68, 38, 80, 68, 68, 68, 22, 38, 0, 78, + /* 1270 */ 277, 68, 277, 69, 80, 22, 20, 38, 80, 69, + /* 1280 */ 79, 68, 22, 68, 38, 22, 69, 0, 68, 38, + /* 1290 */ 38, 69, 68, 38, 69, 48, 38, 38, 68, 94, + /* 1300 */ 38, 47, 38, 38, 38, 38, 68, 38, 38, 68, + /* 1310 */ 68, 0, 38, 38, 38, 43, 38, 38, 82, 36, + /* 1320 */ 94, 0, 38, 37, 22, 21, 94, 22, 22, 94, + /* 1330 */ 21, 277, 277, 277, 277, 277, 277, 277, 277, 277, + /* 1340 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, + /* 1350 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, /* 1360 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, /* 1370 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, /* 1380 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, @@ -500,131 +498,128 @@ static const YYCODETYPE yy_lookahead[] = { /* 1480 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, /* 1490 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, /* 1500 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, - /* 1510 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, - /* 1520 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, - /* 1530 */ 277, }; -#define YY_SHIFT_COUNT (444) +#define YY_SHIFT_COUNT (445) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (1319) +#define YY_SHIFT_MAX (1321) static const unsigned short int yy_shift_ofst[] = { /* 0 */ 615, 192, 265, 280, 280, 280, 280, 449, 280, 280, /* 10 */ 480, 525, 98, 466, 480, 480, 480, 480, 480, 480, /* 20 */ 480, 480, 480, 480, 480, 480, 480, 480, 480, 480, - /* 30 */ 480, 480, 480, 133, 133, 133, 102, 228, 228, 78, - /* 40 */ 35, 35, 228, 35, 35, 35, 35, 213, 262, 369, - /* 50 */ 369, 255, 456, 262, 35, 35, 262, 35, 262, 456, - /* 60 */ 262, 262, 35, 439, 0, 13, 13, 743, 106, 493, - /* 70 */ 714, 714, 714, 714, 714, 714, 714, 714, 714, 714, + /* 30 */ 480, 480, 480, 214, 214, 214, 102, 228, 228, 78, + /* 40 */ 35, 35, 228, 35, 35, 35, 35, 121, 239, 297, + /* 50 */ 297, 177, 350, 239, 35, 35, 239, 35, 239, 350, + /* 60 */ 239, 239, 35, 343, 0, 13, 13, 743, 106, 493, + /* 70 */ 714, 1098, 714, 714, 714, 714, 714, 714, 714, 714, /* 80 */ 714, 714, 714, 714, 714, 714, 714, 714, 714, 714, - /* 90 */ 928, 417, 121, 214, 214, 214, 347, 469, 456, 262, - /* 100 */ 262, 262, 443, 91, 91, 91, 91, 91, 313, 66, - /* 110 */ 181, 187, 186, 116, 395, 301, 437, 243, 437, 545, - /* 120 */ 401, 364, 701, 814, 728, 744, 744, 814, 856, 213, - /* 130 */ 469, 879, 213, 213, 814, 213, 892, 262, 262, 262, - /* 140 */ 262, 262, 262, 262, 262, 262, 262, 262, 814, 892, - /* 150 */ 856, 439, 469, 879, 439, 933, 793, 795, 840, 793, - /* 160 */ 795, 840, 840, 807, 815, 836, 846, 850, 469, 988, - /* 170 */ 903, 844, 849, 852, 956, 262, 795, 840, 840, 795, - /* 180 */ 840, 927, 469, 879, 439, 443, 439, 469, 992, 814, - /* 190 */ 439, 892, 1352, 1352, 1352, 1352, 1352, 48, 349, 760, + /* 90 */ 714, 99, 347, 301, 301, 301, 387, 389, 350, 239, + /* 100 */ 239, 239, 420, 91, 91, 91, 91, 91, 313, 66, + /* 110 */ 181, 187, 186, 116, 415, 437, 454, 243, 454, 551, + /* 120 */ 198, 435, 707, 829, 745, 776, 776, 829, 865, 121, + /* 130 */ 389, 881, 121, 121, 829, 121, 892, 239, 239, 239, + /* 140 */ 239, 239, 239, 239, 239, 239, 239, 239, 829, 892, + /* 150 */ 865, 343, 389, 881, 343, 935, 800, 795, 832, 800, + /* 160 */ 795, 832, 832, 812, 814, 830, 833, 847, 389, 982, + /* 170 */ 888, 834, 841, 846, 950, 239, 795, 832, 832, 795, + /* 180 */ 832, 904, 389, 881, 343, 420, 343, 389, 983, 829, + /* 190 */ 343, 892, 1331, 1331, 1331, 1331, 1331, 48, 349, 760, /* 200 */ 1086, 1051, 475, 934, 785, 801, 527, 156, 874, 874, - /* 210 */ 874, 874, 874, 874, 874, 32, 19, 340, 625, 625, - /* 220 */ 625, 625, 440, 529, 613, 617, 729, 758, 772, 118, - /* 230 */ 458, 602, 696, 605, 571, 636, 372, 697, 547, 738, - /* 240 */ 302, 751, 756, 759, 764, 770, 618, 737, 789, 794, - /* 250 */ 799, 803, 822, 825, 484, 1088, 986, 964, 1096, 1101, - /* 260 */ 1052, 978, 1109, 1111, 1032, 1113, 1114, 1000, 1116, 1117, - /* 270 */ 1123, 1125, 1126, 1127, 1107, 1131, 1132, 1133, 1134, 1135, - /* 280 */ 1140, 1141, 1099, 1143, 1097, 1144, 1146, 1110, 1115, 1104, - /* 290 */ 1149, 1150, 1152, 1154, 1078, 1082, 1120, 1121, 1138, 1161, - /* 300 */ 1124, 1128, 1129, 1130, 1136, 1137, 1163, 1142, 1165, 1147, - /* 310 */ 1139, 1170, 1151, 1145, 1171, 1155, 1172, 1157, 1156, 1180, - /* 320 */ 1181, 1060, 1184, 1118, 1148, 1068, 1106, 1108, 1030, 1153, - /* 330 */ 1112, 1158, 1122, 1160, 1162, 1164, 1166, 1119, 1159, 1168, - /* 340 */ 1167, 1034, 1169, 1173, 1174, 1042, 1175, 1177, 1176, 1178, - /* 350 */ 1037, 1192, 1179, 1182, 1183, 1185, 1186, 1187, 1195, 1066, - /* 360 */ 1188, 1189, 1193, 1194, 1191, 1196, 1198, 1199, 1079, 1201, - /* 370 */ 1204, 1190, 1084, 1202, 1197, 1200, 1205, 1208, 1218, 1221, - /* 380 */ 1222, 1225, 1226, 1224, 1228, 1233, 1231, 1229, 1234, 1236, - /* 390 */ 1232, 1239, 1237, 1240, 1243, 1246, 1223, 1249, 1255, 1257, - /* 400 */ 1260, 1258, 1259, 1264, 1098, 1261, 1262, 1203, 1265, 1266, - /* 410 */ 1242, 1263, 1267, 1268, 1269, 1270, 1273, 1278, 1281, 1282, - /* 420 */ 1271, 1283, 1286, 1287, 1290, 1293, 1294, 1298, 1299, 1300, - /* 430 */ 1276, 1277, 1303, 1291, 1312, 1304, 1289, 1313, 1318, 1272, - /* 440 */ 1301, 1311, 1319, 1302, 1315, + /* 210 */ 874, 874, 874, 874, 874, 32, 19, 340, 138, 138, + /* 220 */ 138, 138, 440, 447, 514, 529, 692, 772, 807, 455, + /* 230 */ 458, 602, 650, 638, 545, 513, 378, 695, 678, 696, + /* 240 */ 698, 711, 739, 756, 759, 764, 641, 737, 770, 789, + /* 250 */ 794, 799, 803, 822, 758, 1078, 976, 952, 1088, 1090, + /* 260 */ 1036, 965, 1094, 1096, 1021, 1102, 1104, 994, 1111, 1112, + /* 270 */ 1113, 1114, 1115, 1116, 1095, 1123, 1125, 1126, 1127, 1129, + /* 280 */ 1131, 1132, 1091, 1133, 1087, 1140, 1141, 1105, 1106, 1101, + /* 290 */ 1145, 1146, 1148, 1150, 1074, 1079, 1121, 1124, 1139, 1163, + /* 300 */ 1128, 1130, 1134, 1135, 1136, 1137, 1138, 1164, 1143, 1167, + /* 310 */ 1147, 1142, 1170, 1149, 1144, 1177, 1156, 1179, 1158, 1165, + /* 320 */ 1183, 1184, 1064, 1187, 1120, 1151, 1072, 1109, 1110, 1034, + /* 330 */ 1152, 1117, 1153, 1155, 1157, 1159, 1161, 1162, 1118, 1122, + /* 340 */ 1166, 1119, 1035, 1168, 1169, 1160, 1043, 1154, 1171, 1172, + /* 350 */ 1173, 1038, 1193, 1174, 1175, 1176, 1178, 1180, 1181, 1199, + /* 360 */ 1073, 1182, 1186, 1185, 1188, 1189, 1190, 1192, 1195, 1084, + /* 370 */ 1196, 1206, 1200, 1092, 1197, 1191, 1194, 1198, 1202, 1203, + /* 380 */ 1201, 1204, 1207, 1208, 1213, 1210, 1214, 1215, 1217, 1219, + /* 390 */ 1220, 1222, 1223, 1224, 1225, 1229, 1230, 1205, 1226, 1232, + /* 400 */ 1235, 1244, 1236, 1238, 1239, 1107, 1241, 1242, 1212, 1246, + /* 410 */ 1253, 1247, 1254, 1260, 1251, 1252, 1255, 1258, 1259, 1262, + /* 420 */ 1264, 1263, 1265, 1266, 1267, 1270, 1274, 1275, 1276, 1278, + /* 430 */ 1279, 1268, 1269, 1283, 1272, 1287, 1284, 1286, 1311, 1321, + /* 440 */ 1302, 1304, 1305, 1306, 1309, 1256, }; #define YY_REDUCE_COUNT (196) #define YY_REDUCE_MIN (-238) -#define YY_REDUCE_MAX (906) +#define YY_REDUCE_MAX (901) static const short yy_reduce_ofst[] = { /* 0 */ -55, -17, 26, 183, -165, 206, 229, 288, 72, 409, /* 10 */ 461, 386, -187, 467, 518, 524, 472, 548, 586, 629, /* 20 */ 660, 691, 700, 722, 731, 761, 769, 792, 831, 839, /* 30 */ 862, 870, 901, -156, 246, 463, 135, -8, 74, -222, - /* 40 */ -170, -169, -223, -150, 49, 79, 174, -123, 222, -83, - /* 50 */ 92, -39, -215, 311, 178, 321, 327, 399, 425, -162, - /* 60 */ 429, 522, 427, -152, -238, -238, -238, 85, -147, -137, - /* 70 */ -140, 21, 75, 132, 177, 182, 209, 258, 276, 319, - /* 80 */ 326, 328, 338, 351, 452, 491, 495, 496, 500, 505, - /* 90 */ -105, 145, 41, 84, 203, 226, 259, 37, -214, 184, - /* 100 */ -3, 342, 308, 370, 383, 394, 423, 528, 348, 502, - /* 110 */ 450, 479, 552, 516, 596, 555, 537, 537, 537, 590, - /* 120 */ 541, 570, 606, 648, 632, 644, 656, 686, 650, 695, - /* 130 */ 683, 681, 715, 717, 720, 721, 732, 713, 716, 718, - /* 140 */ 719, 723, 730, 740, 742, 745, 746, 747, 734, 733, - /* 150 */ 703, 752, 753, 726, 765, 727, 699, 741, 749, 710, - /* 160 */ 757, 763, 766, 748, 739, 750, 754, 537, 805, 784, - /* 170 */ 773, 755, 767, 762, 783, 590, 802, 811, 819, 821, - /* 180 */ 820, 826, 842, 829, 866, 858, 872, 848, 860, 873, - /* 190 */ 876, 889, 861, 882, 884, 893, 906, + /* 40 */ -170, -169, -223, -150, 49, 79, 174, -123, 222, 92, + /* 50 */ 157, -39, -215, 311, 321, 399, 327, 427, 425, -162, + /* 60 */ 429, 522, 485, -152, -238, -238, -238, 85, -147, -137, + /* 70 */ -140, -105, 21, 75, 132, 148, 182, 209, 235, 258, + /* 80 */ 319, 326, 328, 338, 351, 452, 459, 495, 505, 506, + /* 90 */ 535, 150, 41, 149, 153, 203, 259, 37, -214, 275, + /* 100 */ -3, 342, 308, 359, 370, 394, 423, 453, 348, 354, + /* 110 */ 414, 482, 537, 491, 596, 555, 566, 566, 566, 588, + /* 120 */ 563, 578, 614, 671, 654, 659, 661, 689, 667, 709, + /* 130 */ 697, 685, 717, 718, 723, 725, 732, 715, 716, 719, + /* 140 */ 720, 728, 730, 740, 742, 744, 746, 747, 751, 736, + /* 150 */ 726, 738, 752, 727, 765, 741, 699, 748, 750, 712, + /* 160 */ 755, 753, 762, 721, 729, 734, 754, 566, 777, 775, + /* 170 */ 763, 749, 767, 773, 778, 588, 798, 796, 808, 802, + /* 180 */ 809, 813, 815, 825, 855, 848, 860, 840, 851, 869, + /* 190 */ 866, 875, 835, 864, 867, 872, 893, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, - /* 10 */ 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, - /* 20 */ 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, - /* 30 */ 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, - /* 40 */ 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1101, 1048, 1048, - /* 50 */ 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, - /* 60 */ 1048, 1048, 1048, 1099, 1048, 1327, 1048, 1214, 1048, 1048, - /* 70 */ 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, - /* 80 */ 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, - /* 90 */ 1048, 1048, 1101, 1338, 1338, 1338, 1099, 1048, 1048, 1048, - /* 100 */ 1048, 1048, 1183, 1048, 1048, 1048, 1048, 1048, 1048, 1048, - /* 110 */ 1402, 1048, 1136, 1362, 1048, 1354, 1330, 1344, 1331, 1048, - /* 120 */ 1387, 1347, 1240, 1048, 1219, 1216, 1216, 1048, 1048, 1101, - /* 130 */ 1048, 1048, 1101, 1101, 1048, 1101, 1048, 1048, 1048, 1048, - /* 140 */ 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, - /* 150 */ 1048, 1099, 1048, 1048, 1099, 1048, 1369, 1367, 1048, 1369, - /* 160 */ 1367, 1048, 1048, 1381, 1377, 1360, 1358, 1344, 1048, 1048, - /* 170 */ 1048, 1405, 1393, 1389, 1048, 1048, 1367, 1048, 1048, 1367, - /* 180 */ 1048, 1227, 1048, 1048, 1099, 1048, 1099, 1048, 1152, 1048, - /* 190 */ 1099, 1048, 1242, 1186, 1186, 1102, 1053, 1048, 1048, 1048, - /* 200 */ 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1292, 1380, - /* 210 */ 1379, 1291, 1304, 1303, 1302, 1048, 1048, 1048, 1286, 1287, - /* 220 */ 1285, 1284, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, - /* 230 */ 1048, 1048, 1048, 1328, 1048, 1390, 1394, 1048, 1048, 1048, - /* 240 */ 1270, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, - /* 250 */ 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, - /* 260 */ 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, - /* 270 */ 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, - /* 280 */ 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, - /* 290 */ 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, - /* 300 */ 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, - /* 310 */ 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, - /* 320 */ 1048, 1048, 1048, 1048, 1048, 1048, 1351, 1361, 1048, 1048, - /* 330 */ 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1270, 1048, - /* 340 */ 1378, 1048, 1337, 1333, 1048, 1048, 1329, 1048, 1048, 1388, - /* 350 */ 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1323, 1048, - /* 360 */ 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, - /* 370 */ 1048, 1048, 1048, 1048, 1048, 1269, 1048, 1048, 1048, 1048, - /* 380 */ 1048, 1048, 1048, 1180, 1048, 1048, 1048, 1048, 1048, 1048, - /* 390 */ 1048, 1048, 1048, 1048, 1048, 1048, 1165, 1163, 1162, 1161, - /* 400 */ 1048, 1158, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, - /* 410 */ 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, - /* 420 */ 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, - /* 430 */ 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, - /* 440 */ 1048, 1048, 1048, 1048, 1048, + /* 0 */ 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, + /* 10 */ 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, + /* 20 */ 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, + /* 30 */ 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, + /* 40 */ 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1104, 1051, 1051, + /* 50 */ 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, + /* 60 */ 1051, 1051, 1051, 1102, 1051, 1331, 1051, 1218, 1051, 1051, + /* 70 */ 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, + /* 80 */ 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, + /* 90 */ 1051, 1051, 1104, 1342, 1342, 1342, 1102, 1051, 1051, 1051, + /* 100 */ 1051, 1051, 1187, 1051, 1051, 1051, 1051, 1051, 1051, 1051, + /* 110 */ 1406, 1051, 1140, 1366, 1051, 1358, 1334, 1348, 1335, 1051, + /* 120 */ 1391, 1351, 1244, 1051, 1223, 1220, 1220, 1051, 1051, 1104, + /* 130 */ 1051, 1051, 1104, 1104, 1051, 1104, 1051, 1051, 1051, 1051, + /* 140 */ 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, + /* 150 */ 1051, 1102, 1051, 1051, 1102, 1051, 1373, 1371, 1051, 1373, + /* 160 */ 1371, 1051, 1051, 1385, 1381, 1364, 1362, 1348, 1051, 1051, + /* 170 */ 1051, 1409, 1397, 1393, 1051, 1051, 1371, 1051, 1051, 1371, + /* 180 */ 1051, 1231, 1051, 1051, 1102, 1051, 1102, 1051, 1156, 1051, + /* 190 */ 1102, 1051, 1246, 1190, 1190, 1105, 1056, 1051, 1051, 1051, + /* 200 */ 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1296, 1384, + /* 210 */ 1383, 1295, 1308, 1307, 1306, 1051, 1051, 1051, 1290, 1291, + /* 220 */ 1289, 1288, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, + /* 230 */ 1051, 1051, 1051, 1332, 1051, 1394, 1398, 1051, 1051, 1051, + /* 240 */ 1274, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, + /* 250 */ 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, + /* 260 */ 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, + /* 270 */ 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, + /* 280 */ 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, + /* 290 */ 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, + /* 300 */ 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, + /* 310 */ 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, + /* 320 */ 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1355, 1365, 1051, + /* 330 */ 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1274, + /* 340 */ 1051, 1382, 1051, 1341, 1337, 1051, 1051, 1333, 1051, 1051, + /* 350 */ 1392, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1327, + /* 360 */ 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, + /* 370 */ 1051, 1051, 1051, 1051, 1051, 1051, 1273, 1051, 1051, 1051, + /* 380 */ 1051, 1051, 1051, 1051, 1184, 1051, 1051, 1051, 1051, 1051, + /* 390 */ 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1169, 1167, 1166, + /* 400 */ 1165, 1051, 1162, 1051, 1051, 1051, 1051, 1051, 1051, 1051, + /* 410 */ 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, + /* 420 */ 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, + /* 430 */ 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, + /* 440 */ 1051, 1051, 1051, 1051, 1051, 1051, }; /********** End of lemon-generated parsing tables *****************************/ @@ -1093,285 +1088,286 @@ static const char *const yyRuleName[] = { /* 75 */ "alter_db_option ::= WAL NK_INTEGER", /* 76 */ "alter_db_option ::= QUORUM NK_INTEGER", /* 77 */ "alter_db_option ::= CACHELAST NK_INTEGER", - /* 78 */ "cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options", - /* 79 */ "cmd ::= CREATE TABLE multi_create_clause", - /* 80 */ "cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options", - /* 81 */ "cmd ::= DROP TABLE multi_drop_clause", - /* 82 */ "cmd ::= DROP STABLE exists_opt full_table_name", - /* 83 */ "cmd ::= ALTER TABLE alter_table_clause", - /* 84 */ "cmd ::= ALTER STABLE alter_table_clause", - /* 85 */ "alter_table_clause ::= full_table_name alter_table_options", - /* 86 */ "alter_table_clause ::= full_table_name ADD COLUMN column_name type_name", - /* 87 */ "alter_table_clause ::= full_table_name DROP COLUMN column_name", - /* 88 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name", - /* 89 */ "alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name", - /* 90 */ "alter_table_clause ::= full_table_name ADD TAG column_name type_name", - /* 91 */ "alter_table_clause ::= full_table_name DROP TAG column_name", - /* 92 */ "alter_table_clause ::= full_table_name MODIFY TAG column_name type_name", - /* 93 */ "alter_table_clause ::= full_table_name RENAME TAG column_name column_name", - /* 94 */ "alter_table_clause ::= full_table_name SET TAG column_name NK_EQ literal", - /* 95 */ "multi_create_clause ::= create_subtable_clause", - /* 96 */ "multi_create_clause ::= multi_create_clause create_subtable_clause", - /* 97 */ "create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP", - /* 98 */ "multi_drop_clause ::= drop_table_clause", - /* 99 */ "multi_drop_clause ::= multi_drop_clause drop_table_clause", - /* 100 */ "drop_table_clause ::= exists_opt full_table_name", - /* 101 */ "specific_tags_opt ::=", - /* 102 */ "specific_tags_opt ::= NK_LP col_name_list NK_RP", - /* 103 */ "full_table_name ::= table_name", - /* 104 */ "full_table_name ::= db_name NK_DOT table_name", - /* 105 */ "column_def_list ::= column_def", - /* 106 */ "column_def_list ::= column_def_list NK_COMMA column_def", - /* 107 */ "column_def ::= column_name type_name", - /* 108 */ "column_def ::= column_name type_name COMMENT NK_STRING", - /* 109 */ "type_name ::= BOOL", - /* 110 */ "type_name ::= TINYINT", - /* 111 */ "type_name ::= SMALLINT", - /* 112 */ "type_name ::= INT", - /* 113 */ "type_name ::= INTEGER", - /* 114 */ "type_name ::= BIGINT", - /* 115 */ "type_name ::= FLOAT", - /* 116 */ "type_name ::= DOUBLE", - /* 117 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP", - /* 118 */ "type_name ::= TIMESTAMP", - /* 119 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP", - /* 120 */ "type_name ::= TINYINT UNSIGNED", - /* 121 */ "type_name ::= SMALLINT UNSIGNED", - /* 122 */ "type_name ::= INT UNSIGNED", - /* 123 */ "type_name ::= BIGINT UNSIGNED", - /* 124 */ "type_name ::= JSON", - /* 125 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP", - /* 126 */ "type_name ::= MEDIUMBLOB", - /* 127 */ "type_name ::= BLOB", - /* 128 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP", - /* 129 */ "type_name ::= DECIMAL", - /* 130 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP", - /* 131 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", - /* 132 */ "tags_def_opt ::=", - /* 133 */ "tags_def_opt ::= tags_def", - /* 134 */ "tags_def ::= TAGS NK_LP column_def_list NK_RP", - /* 135 */ "table_options ::=", - /* 136 */ "table_options ::= table_options COMMENT NK_STRING", - /* 137 */ "table_options ::= table_options KEEP NK_INTEGER", - /* 138 */ "table_options ::= table_options TTL NK_INTEGER", - /* 139 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP", - /* 140 */ "table_options ::= table_options ROLLUP NK_LP func_name_list NK_RP", - /* 141 */ "table_options ::= table_options FILE_FACTOR NK_FLOAT", - /* 142 */ "table_options ::= table_options DELAY NK_INTEGER", - /* 143 */ "alter_table_options ::= alter_table_option", - /* 144 */ "alter_table_options ::= alter_table_options alter_table_option", - /* 145 */ "alter_table_option ::= COMMENT NK_STRING", - /* 146 */ "alter_table_option ::= KEEP NK_INTEGER", - /* 147 */ "alter_table_option ::= TTL NK_INTEGER", - /* 148 */ "col_name_list ::= col_name", - /* 149 */ "col_name_list ::= col_name_list NK_COMMA col_name", - /* 150 */ "col_name ::= column_name", - /* 151 */ "cmd ::= SHOW DNODES", - /* 152 */ "cmd ::= SHOW USERS", - /* 153 */ "cmd ::= SHOW DATABASES", - /* 154 */ "cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt", - /* 155 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt", - /* 156 */ "cmd ::= SHOW db_name_cond_opt VGROUPS", - /* 157 */ "cmd ::= SHOW MNODES", - /* 158 */ "cmd ::= SHOW MODULES", - /* 159 */ "cmd ::= SHOW QNODES", - /* 160 */ "cmd ::= SHOW FUNCTIONS", - /* 161 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt", - /* 162 */ "cmd ::= SHOW STREAMS", - /* 163 */ "db_name_cond_opt ::=", - /* 164 */ "db_name_cond_opt ::= db_name NK_DOT", - /* 165 */ "like_pattern_opt ::=", - /* 166 */ "like_pattern_opt ::= LIKE NK_STRING", - /* 167 */ "table_name_cond ::= table_name", - /* 168 */ "from_db_opt ::=", - /* 169 */ "from_db_opt ::= FROM db_name", - /* 170 */ "func_name_list ::= func_name", - /* 171 */ "func_name_list ::= func_name_list NK_COMMA col_name", - /* 172 */ "func_name ::= function_name", - /* 173 */ "cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options", - /* 174 */ "cmd ::= CREATE FULLTEXT INDEX not_exists_opt index_name ON table_name NK_LP col_name_list NK_RP", - /* 175 */ "cmd ::= DROP INDEX exists_opt index_name ON table_name", - /* 176 */ "index_options ::=", - /* 177 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt", - /* 178 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt", - /* 179 */ "func_list ::= func", - /* 180 */ "func_list ::= func_list NK_COMMA func", - /* 181 */ "func ::= function_name NK_LP expression_list NK_RP", - /* 182 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression", - /* 183 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS db_name", - /* 184 */ "cmd ::= DROP TOPIC exists_opt topic_name", - /* 185 */ "cmd ::= DESC full_table_name", - /* 186 */ "cmd ::= DESCRIBE full_table_name", - /* 187 */ "cmd ::= RESET QUERY CACHE", - /* 188 */ "cmd ::= EXPLAIN analyze_opt explain_options query_expression", - /* 189 */ "analyze_opt ::=", - /* 190 */ "analyze_opt ::= ANALYZE", - /* 191 */ "explain_options ::=", - /* 192 */ "explain_options ::= explain_options VERBOSE NK_BOOL", - /* 193 */ "explain_options ::= explain_options RATIO NK_FLOAT", - /* 194 */ "cmd ::= query_expression", - /* 195 */ "literal ::= NK_INTEGER", - /* 196 */ "literal ::= NK_FLOAT", - /* 197 */ "literal ::= NK_STRING", - /* 198 */ "literal ::= NK_BOOL", - /* 199 */ "literal ::= TIMESTAMP NK_STRING", - /* 200 */ "literal ::= duration_literal", - /* 201 */ "literal ::= NULL", - /* 202 */ "duration_literal ::= NK_VARIABLE", - /* 203 */ "signed ::= NK_INTEGER", - /* 204 */ "signed ::= NK_PLUS NK_INTEGER", - /* 205 */ "signed ::= NK_MINUS NK_INTEGER", - /* 206 */ "signed ::= NK_FLOAT", - /* 207 */ "signed ::= NK_PLUS NK_FLOAT", - /* 208 */ "signed ::= NK_MINUS NK_FLOAT", - /* 209 */ "signed_literal ::= signed", - /* 210 */ "signed_literal ::= NK_STRING", - /* 211 */ "signed_literal ::= NK_BOOL", - /* 212 */ "signed_literal ::= TIMESTAMP NK_STRING", - /* 213 */ "signed_literal ::= duration_literal", - /* 214 */ "signed_literal ::= NULL", - /* 215 */ "literal_list ::= signed_literal", - /* 216 */ "literal_list ::= literal_list NK_COMMA signed_literal", - /* 217 */ "db_name ::= NK_ID", - /* 218 */ "table_name ::= NK_ID", - /* 219 */ "column_name ::= NK_ID", - /* 220 */ "function_name ::= NK_ID", - /* 221 */ "table_alias ::= NK_ID", - /* 222 */ "column_alias ::= NK_ID", - /* 223 */ "user_name ::= NK_ID", - /* 224 */ "index_name ::= NK_ID", - /* 225 */ "topic_name ::= NK_ID", - /* 226 */ "expression ::= literal", - /* 227 */ "expression ::= pseudo_column", - /* 228 */ "expression ::= column_reference", - /* 229 */ "expression ::= function_name NK_LP expression_list NK_RP", - /* 230 */ "expression ::= function_name NK_LP NK_STAR NK_RP", - /* 231 */ "expression ::= subquery", - /* 232 */ "expression ::= NK_LP expression NK_RP", - /* 233 */ "expression ::= NK_PLUS expression", - /* 234 */ "expression ::= NK_MINUS expression", - /* 235 */ "expression ::= expression NK_PLUS expression", - /* 236 */ "expression ::= expression NK_MINUS expression", - /* 237 */ "expression ::= expression NK_STAR expression", - /* 238 */ "expression ::= expression NK_SLASH expression", - /* 239 */ "expression ::= expression NK_REM expression", - /* 240 */ "expression_list ::= expression", - /* 241 */ "expression_list ::= expression_list NK_COMMA expression", - /* 242 */ "column_reference ::= column_name", - /* 243 */ "column_reference ::= table_name NK_DOT column_name", - /* 244 */ "pseudo_column ::= NK_UNDERLINE ROWTS", - /* 245 */ "pseudo_column ::= TBNAME", - /* 246 */ "pseudo_column ::= NK_UNDERLINE QSTARTTS", - /* 247 */ "pseudo_column ::= NK_UNDERLINE QENDTS", - /* 248 */ "pseudo_column ::= NK_UNDERLINE WSTARTTS", - /* 249 */ "pseudo_column ::= NK_UNDERLINE WENDTS", - /* 250 */ "pseudo_column ::= NK_UNDERLINE WDURATION", - /* 251 */ "predicate ::= expression compare_op expression", - /* 252 */ "predicate ::= expression BETWEEN expression AND expression", - /* 253 */ "predicate ::= expression NOT BETWEEN expression AND expression", - /* 254 */ "predicate ::= expression IS NULL", - /* 255 */ "predicate ::= expression IS NOT NULL", - /* 256 */ "predicate ::= expression in_op in_predicate_value", - /* 257 */ "compare_op ::= NK_LT", - /* 258 */ "compare_op ::= NK_GT", - /* 259 */ "compare_op ::= NK_LE", - /* 260 */ "compare_op ::= NK_GE", - /* 261 */ "compare_op ::= NK_NE", - /* 262 */ "compare_op ::= NK_EQ", - /* 263 */ "compare_op ::= LIKE", - /* 264 */ "compare_op ::= NOT LIKE", - /* 265 */ "compare_op ::= MATCH", - /* 266 */ "compare_op ::= NMATCH", - /* 267 */ "in_op ::= IN", - /* 268 */ "in_op ::= NOT IN", - /* 269 */ "in_predicate_value ::= NK_LP expression_list NK_RP", - /* 270 */ "boolean_value_expression ::= boolean_primary", - /* 271 */ "boolean_value_expression ::= NOT boolean_primary", - /* 272 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", - /* 273 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", - /* 274 */ "boolean_primary ::= predicate", - /* 275 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", - /* 276 */ "common_expression ::= expression", - /* 277 */ "common_expression ::= boolean_value_expression", - /* 278 */ "from_clause ::= FROM table_reference_list", - /* 279 */ "table_reference_list ::= table_reference", - /* 280 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", - /* 281 */ "table_reference ::= table_primary", - /* 282 */ "table_reference ::= joined_table", - /* 283 */ "table_primary ::= table_name alias_opt", - /* 284 */ "table_primary ::= db_name NK_DOT table_name alias_opt", - /* 285 */ "table_primary ::= subquery alias_opt", - /* 286 */ "table_primary ::= parenthesized_joined_table", - /* 287 */ "alias_opt ::=", - /* 288 */ "alias_opt ::= table_alias", - /* 289 */ "alias_opt ::= AS table_alias", - /* 290 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", - /* 291 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", - /* 292 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", - /* 293 */ "join_type ::=", - /* 294 */ "join_type ::= INNER", - /* 295 */ "query_specification ::= SELECT set_quantifier_opt select_list from_clause where_clause_opt partition_by_clause_opt twindow_clause_opt group_by_clause_opt having_clause_opt", - /* 296 */ "set_quantifier_opt ::=", - /* 297 */ "set_quantifier_opt ::= DISTINCT", - /* 298 */ "set_quantifier_opt ::= ALL", - /* 299 */ "select_list ::= NK_STAR", - /* 300 */ "select_list ::= select_sublist", - /* 301 */ "select_sublist ::= select_item", - /* 302 */ "select_sublist ::= select_sublist NK_COMMA select_item", - /* 303 */ "select_item ::= common_expression", - /* 304 */ "select_item ::= common_expression column_alias", - /* 305 */ "select_item ::= common_expression AS column_alias", - /* 306 */ "select_item ::= table_name NK_DOT NK_STAR", - /* 307 */ "where_clause_opt ::=", - /* 308 */ "where_clause_opt ::= WHERE search_condition", - /* 309 */ "partition_by_clause_opt ::=", - /* 310 */ "partition_by_clause_opt ::= PARTITION BY expression_list", - /* 311 */ "twindow_clause_opt ::=", - /* 312 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", - /* 313 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP", - /* 314 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", - /* 315 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", - /* 316 */ "sliding_opt ::=", - /* 317 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", - /* 318 */ "fill_opt ::=", - /* 319 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", - /* 320 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", - /* 321 */ "fill_mode ::= NONE", - /* 322 */ "fill_mode ::= PREV", - /* 323 */ "fill_mode ::= NULL", - /* 324 */ "fill_mode ::= LINEAR", - /* 325 */ "fill_mode ::= NEXT", - /* 326 */ "group_by_clause_opt ::=", - /* 327 */ "group_by_clause_opt ::= GROUP BY group_by_list", - /* 328 */ "group_by_list ::= expression", - /* 329 */ "group_by_list ::= group_by_list NK_COMMA expression", - /* 330 */ "having_clause_opt ::=", - /* 331 */ "having_clause_opt ::= HAVING search_condition", - /* 332 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt", - /* 333 */ "query_expression_body ::= query_primary", - /* 334 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body", - /* 335 */ "query_primary ::= query_specification", - /* 336 */ "order_by_clause_opt ::=", - /* 337 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", - /* 338 */ "slimit_clause_opt ::=", - /* 339 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", - /* 340 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", - /* 341 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 342 */ "limit_clause_opt ::=", - /* 343 */ "limit_clause_opt ::= LIMIT NK_INTEGER", - /* 344 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", - /* 345 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 346 */ "subquery ::= NK_LP query_expression NK_RP", - /* 347 */ "search_condition ::= common_expression", - /* 348 */ "sort_specification_list ::= sort_specification", - /* 349 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", - /* 350 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt", - /* 351 */ "ordering_specification_opt ::=", - /* 352 */ "ordering_specification_opt ::= ASC", - /* 353 */ "ordering_specification_opt ::= DESC", - /* 354 */ "null_ordering_opt ::=", - /* 355 */ "null_ordering_opt ::= NULLS FIRST", - /* 356 */ "null_ordering_opt ::= NULLS LAST", + /* 78 */ "alter_db_option ::= REPLICA NK_INTEGER", + /* 79 */ "cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options", + /* 80 */ "cmd ::= CREATE TABLE multi_create_clause", + /* 81 */ "cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options", + /* 82 */ "cmd ::= DROP TABLE multi_drop_clause", + /* 83 */ "cmd ::= DROP STABLE exists_opt full_table_name", + /* 84 */ "cmd ::= ALTER TABLE alter_table_clause", + /* 85 */ "cmd ::= ALTER STABLE alter_table_clause", + /* 86 */ "alter_table_clause ::= full_table_name alter_table_options", + /* 87 */ "alter_table_clause ::= full_table_name ADD COLUMN column_name type_name", + /* 88 */ "alter_table_clause ::= full_table_name DROP COLUMN column_name", + /* 89 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name", + /* 90 */ "alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name", + /* 91 */ "alter_table_clause ::= full_table_name ADD TAG column_name type_name", + /* 92 */ "alter_table_clause ::= full_table_name DROP TAG column_name", + /* 93 */ "alter_table_clause ::= full_table_name MODIFY TAG column_name type_name", + /* 94 */ "alter_table_clause ::= full_table_name RENAME TAG column_name column_name", + /* 95 */ "alter_table_clause ::= full_table_name SET TAG column_name NK_EQ literal", + /* 96 */ "multi_create_clause ::= create_subtable_clause", + /* 97 */ "multi_create_clause ::= multi_create_clause create_subtable_clause", + /* 98 */ "create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP", + /* 99 */ "multi_drop_clause ::= drop_table_clause", + /* 100 */ "multi_drop_clause ::= multi_drop_clause drop_table_clause", + /* 101 */ "drop_table_clause ::= exists_opt full_table_name", + /* 102 */ "specific_tags_opt ::=", + /* 103 */ "specific_tags_opt ::= NK_LP col_name_list NK_RP", + /* 104 */ "full_table_name ::= table_name", + /* 105 */ "full_table_name ::= db_name NK_DOT table_name", + /* 106 */ "column_def_list ::= column_def", + /* 107 */ "column_def_list ::= column_def_list NK_COMMA column_def", + /* 108 */ "column_def ::= column_name type_name", + /* 109 */ "column_def ::= column_name type_name COMMENT NK_STRING", + /* 110 */ "type_name ::= BOOL", + /* 111 */ "type_name ::= TINYINT", + /* 112 */ "type_name ::= SMALLINT", + /* 113 */ "type_name ::= INT", + /* 114 */ "type_name ::= INTEGER", + /* 115 */ "type_name ::= BIGINT", + /* 116 */ "type_name ::= FLOAT", + /* 117 */ "type_name ::= DOUBLE", + /* 118 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP", + /* 119 */ "type_name ::= TIMESTAMP", + /* 120 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP", + /* 121 */ "type_name ::= TINYINT UNSIGNED", + /* 122 */ "type_name ::= SMALLINT UNSIGNED", + /* 123 */ "type_name ::= INT UNSIGNED", + /* 124 */ "type_name ::= BIGINT UNSIGNED", + /* 125 */ "type_name ::= JSON", + /* 126 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP", + /* 127 */ "type_name ::= MEDIUMBLOB", + /* 128 */ "type_name ::= BLOB", + /* 129 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP", + /* 130 */ "type_name ::= DECIMAL", + /* 131 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP", + /* 132 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", + /* 133 */ "tags_def_opt ::=", + /* 134 */ "tags_def_opt ::= tags_def", + /* 135 */ "tags_def ::= TAGS NK_LP column_def_list NK_RP", + /* 136 */ "table_options ::=", + /* 137 */ "table_options ::= table_options COMMENT NK_STRING", + /* 138 */ "table_options ::= table_options KEEP NK_INTEGER", + /* 139 */ "table_options ::= table_options TTL NK_INTEGER", + /* 140 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP", + /* 141 */ "table_options ::= table_options ROLLUP NK_LP func_name_list NK_RP", + /* 142 */ "table_options ::= table_options FILE_FACTOR NK_FLOAT", + /* 143 */ "table_options ::= table_options DELAY NK_INTEGER", + /* 144 */ "alter_table_options ::= alter_table_option", + /* 145 */ "alter_table_options ::= alter_table_options alter_table_option", + /* 146 */ "alter_table_option ::= COMMENT NK_STRING", + /* 147 */ "alter_table_option ::= KEEP NK_INTEGER", + /* 148 */ "alter_table_option ::= TTL NK_INTEGER", + /* 149 */ "col_name_list ::= col_name", + /* 150 */ "col_name_list ::= col_name_list NK_COMMA col_name", + /* 151 */ "col_name ::= column_name", + /* 152 */ "cmd ::= SHOW DNODES", + /* 153 */ "cmd ::= SHOW USERS", + /* 154 */ "cmd ::= SHOW DATABASES", + /* 155 */ "cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt", + /* 156 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt", + /* 157 */ "cmd ::= SHOW db_name_cond_opt VGROUPS", + /* 158 */ "cmd ::= SHOW MNODES", + /* 159 */ "cmd ::= SHOW MODULES", + /* 160 */ "cmd ::= SHOW QNODES", + /* 161 */ "cmd ::= SHOW FUNCTIONS", + /* 162 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt", + /* 163 */ "cmd ::= SHOW STREAMS", + /* 164 */ "db_name_cond_opt ::=", + /* 165 */ "db_name_cond_opt ::= db_name NK_DOT", + /* 166 */ "like_pattern_opt ::=", + /* 167 */ "like_pattern_opt ::= LIKE NK_STRING", + /* 168 */ "table_name_cond ::= table_name", + /* 169 */ "from_db_opt ::=", + /* 170 */ "from_db_opt ::= FROM db_name", + /* 171 */ "func_name_list ::= func_name", + /* 172 */ "func_name_list ::= func_name_list NK_COMMA col_name", + /* 173 */ "func_name ::= function_name", + /* 174 */ "cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options", + /* 175 */ "cmd ::= CREATE FULLTEXT INDEX not_exists_opt index_name ON table_name NK_LP col_name_list NK_RP", + /* 176 */ "cmd ::= DROP INDEX exists_opt index_name ON table_name", + /* 177 */ "index_options ::=", + /* 178 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt", + /* 179 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt", + /* 180 */ "func_list ::= func", + /* 181 */ "func_list ::= func_list NK_COMMA func", + /* 182 */ "func ::= function_name NK_LP expression_list NK_RP", + /* 183 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression", + /* 184 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS db_name", + /* 185 */ "cmd ::= DROP TOPIC exists_opt topic_name", + /* 186 */ "cmd ::= DESC full_table_name", + /* 187 */ "cmd ::= DESCRIBE full_table_name", + /* 188 */ "cmd ::= RESET QUERY CACHE", + /* 189 */ "cmd ::= EXPLAIN analyze_opt explain_options query_expression", + /* 190 */ "analyze_opt ::=", + /* 191 */ "analyze_opt ::= ANALYZE", + /* 192 */ "explain_options ::=", + /* 193 */ "explain_options ::= explain_options VERBOSE NK_BOOL", + /* 194 */ "explain_options ::= explain_options RATIO NK_FLOAT", + /* 195 */ "cmd ::= query_expression", + /* 196 */ "literal ::= NK_INTEGER", + /* 197 */ "literal ::= NK_FLOAT", + /* 198 */ "literal ::= NK_STRING", + /* 199 */ "literal ::= NK_BOOL", + /* 200 */ "literal ::= TIMESTAMP NK_STRING", + /* 201 */ "literal ::= duration_literal", + /* 202 */ "literal ::= NULL", + /* 203 */ "duration_literal ::= NK_VARIABLE", + /* 204 */ "signed ::= NK_INTEGER", + /* 205 */ "signed ::= NK_PLUS NK_INTEGER", + /* 206 */ "signed ::= NK_MINUS NK_INTEGER", + /* 207 */ "signed ::= NK_FLOAT", + /* 208 */ "signed ::= NK_PLUS NK_FLOAT", + /* 209 */ "signed ::= NK_MINUS NK_FLOAT", + /* 210 */ "signed_literal ::= signed", + /* 211 */ "signed_literal ::= NK_STRING", + /* 212 */ "signed_literal ::= NK_BOOL", + /* 213 */ "signed_literal ::= TIMESTAMP NK_STRING", + /* 214 */ "signed_literal ::= duration_literal", + /* 215 */ "signed_literal ::= NULL", + /* 216 */ "literal_list ::= signed_literal", + /* 217 */ "literal_list ::= literal_list NK_COMMA signed_literal", + /* 218 */ "db_name ::= NK_ID", + /* 219 */ "table_name ::= NK_ID", + /* 220 */ "column_name ::= NK_ID", + /* 221 */ "function_name ::= NK_ID", + /* 222 */ "table_alias ::= NK_ID", + /* 223 */ "column_alias ::= NK_ID", + /* 224 */ "user_name ::= NK_ID", + /* 225 */ "index_name ::= NK_ID", + /* 226 */ "topic_name ::= NK_ID", + /* 227 */ "expression ::= literal", + /* 228 */ "expression ::= pseudo_column", + /* 229 */ "expression ::= column_reference", + /* 230 */ "expression ::= function_name NK_LP expression_list NK_RP", + /* 231 */ "expression ::= function_name NK_LP NK_STAR NK_RP", + /* 232 */ "expression ::= subquery", + /* 233 */ "expression ::= NK_LP expression NK_RP", + /* 234 */ "expression ::= NK_PLUS expression", + /* 235 */ "expression ::= NK_MINUS expression", + /* 236 */ "expression ::= expression NK_PLUS expression", + /* 237 */ "expression ::= expression NK_MINUS expression", + /* 238 */ "expression ::= expression NK_STAR expression", + /* 239 */ "expression ::= expression NK_SLASH expression", + /* 240 */ "expression ::= expression NK_REM expression", + /* 241 */ "expression_list ::= expression", + /* 242 */ "expression_list ::= expression_list NK_COMMA expression", + /* 243 */ "column_reference ::= column_name", + /* 244 */ "column_reference ::= table_name NK_DOT column_name", + /* 245 */ "pseudo_column ::= NK_UNDERLINE ROWTS", + /* 246 */ "pseudo_column ::= TBNAME", + /* 247 */ "pseudo_column ::= NK_UNDERLINE QSTARTTS", + /* 248 */ "pseudo_column ::= NK_UNDERLINE QENDTS", + /* 249 */ "pseudo_column ::= NK_UNDERLINE WSTARTTS", + /* 250 */ "pseudo_column ::= NK_UNDERLINE WENDTS", + /* 251 */ "pseudo_column ::= NK_UNDERLINE WDURATION", + /* 252 */ "predicate ::= expression compare_op expression", + /* 253 */ "predicate ::= expression BETWEEN expression AND expression", + /* 254 */ "predicate ::= expression NOT BETWEEN expression AND expression", + /* 255 */ "predicate ::= expression IS NULL", + /* 256 */ "predicate ::= expression IS NOT NULL", + /* 257 */ "predicate ::= expression in_op in_predicate_value", + /* 258 */ "compare_op ::= NK_LT", + /* 259 */ "compare_op ::= NK_GT", + /* 260 */ "compare_op ::= NK_LE", + /* 261 */ "compare_op ::= NK_GE", + /* 262 */ "compare_op ::= NK_NE", + /* 263 */ "compare_op ::= NK_EQ", + /* 264 */ "compare_op ::= LIKE", + /* 265 */ "compare_op ::= NOT LIKE", + /* 266 */ "compare_op ::= MATCH", + /* 267 */ "compare_op ::= NMATCH", + /* 268 */ "in_op ::= IN", + /* 269 */ "in_op ::= NOT IN", + /* 270 */ "in_predicate_value ::= NK_LP expression_list NK_RP", + /* 271 */ "boolean_value_expression ::= boolean_primary", + /* 272 */ "boolean_value_expression ::= NOT boolean_primary", + /* 273 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", + /* 274 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", + /* 275 */ "boolean_primary ::= predicate", + /* 276 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", + /* 277 */ "common_expression ::= expression", + /* 278 */ "common_expression ::= boolean_value_expression", + /* 279 */ "from_clause ::= FROM table_reference_list", + /* 280 */ "table_reference_list ::= table_reference", + /* 281 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", + /* 282 */ "table_reference ::= table_primary", + /* 283 */ "table_reference ::= joined_table", + /* 284 */ "table_primary ::= table_name alias_opt", + /* 285 */ "table_primary ::= db_name NK_DOT table_name alias_opt", + /* 286 */ "table_primary ::= subquery alias_opt", + /* 287 */ "table_primary ::= parenthesized_joined_table", + /* 288 */ "alias_opt ::=", + /* 289 */ "alias_opt ::= table_alias", + /* 290 */ "alias_opt ::= AS table_alias", + /* 291 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", + /* 292 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", + /* 293 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", + /* 294 */ "join_type ::=", + /* 295 */ "join_type ::= INNER", + /* 296 */ "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", + /* 297 */ "set_quantifier_opt ::=", + /* 298 */ "set_quantifier_opt ::= DISTINCT", + /* 299 */ "set_quantifier_opt ::= ALL", + /* 300 */ "select_list ::= NK_STAR", + /* 301 */ "select_list ::= select_sublist", + /* 302 */ "select_sublist ::= select_item", + /* 303 */ "select_sublist ::= select_sublist NK_COMMA select_item", + /* 304 */ "select_item ::= common_expression", + /* 305 */ "select_item ::= common_expression column_alias", + /* 306 */ "select_item ::= common_expression AS column_alias", + /* 307 */ "select_item ::= table_name NK_DOT NK_STAR", + /* 308 */ "where_clause_opt ::=", + /* 309 */ "where_clause_opt ::= WHERE search_condition", + /* 310 */ "partition_by_clause_opt ::=", + /* 311 */ "partition_by_clause_opt ::= PARTITION BY expression_list", + /* 312 */ "twindow_clause_opt ::=", + /* 313 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", + /* 314 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP", + /* 315 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", + /* 316 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", + /* 317 */ "sliding_opt ::=", + /* 318 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", + /* 319 */ "fill_opt ::=", + /* 320 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", + /* 321 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", + /* 322 */ "fill_mode ::= NONE", + /* 323 */ "fill_mode ::= PREV", + /* 324 */ "fill_mode ::= NULL", + /* 325 */ "fill_mode ::= LINEAR", + /* 326 */ "fill_mode ::= NEXT", + /* 327 */ "group_by_clause_opt ::=", + /* 328 */ "group_by_clause_opt ::= GROUP BY group_by_list", + /* 329 */ "group_by_list ::= expression", + /* 330 */ "group_by_list ::= group_by_list NK_COMMA expression", + /* 331 */ "having_clause_opt ::=", + /* 332 */ "having_clause_opt ::= HAVING search_condition", + /* 333 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt", + /* 334 */ "query_expression_body ::= query_primary", + /* 335 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body", + /* 336 */ "query_primary ::= query_specification", + /* 337 */ "order_by_clause_opt ::=", + /* 338 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", + /* 339 */ "slimit_clause_opt ::=", + /* 340 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", + /* 341 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", + /* 342 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 343 */ "limit_clause_opt ::=", + /* 344 */ "limit_clause_opt ::= LIMIT NK_INTEGER", + /* 345 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", + /* 346 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 347 */ "subquery ::= NK_LP query_expression NK_RP", + /* 348 */ "search_condition ::= common_expression", + /* 349 */ "sort_specification_list ::= sort_specification", + /* 350 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", + /* 351 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt", + /* 352 */ "ordering_specification_opt ::=", + /* 353 */ "ordering_specification_opt ::= ASC", + /* 354 */ "ordering_specification_opt ::= DESC", + /* 355 */ "null_ordering_opt ::=", + /* 356 */ "null_ordering_opt ::= NULLS FIRST", + /* 357 */ "null_ordering_opt ::= NULLS LAST", }; #endif /* NDEBUG */ @@ -2016,285 +2012,286 @@ static const struct { { 192, -2 }, /* (75) alter_db_option ::= WAL NK_INTEGER */ { 192, -2 }, /* (76) alter_db_option ::= QUORUM NK_INTEGER */ { 192, -2 }, /* (77) alter_db_option ::= CACHELAST NK_INTEGER */ - { 179, -9 }, /* (78) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ - { 179, -3 }, /* (79) cmd ::= CREATE TABLE multi_create_clause */ - { 179, -9 }, /* (80) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ - { 179, -3 }, /* (81) cmd ::= DROP TABLE multi_drop_clause */ - { 179, -4 }, /* (82) cmd ::= DROP STABLE exists_opt full_table_name */ - { 179, -3 }, /* (83) cmd ::= ALTER TABLE alter_table_clause */ - { 179, -3 }, /* (84) cmd ::= ALTER STABLE alter_table_clause */ - { 200, -2 }, /* (85) alter_table_clause ::= full_table_name alter_table_options */ - { 200, -5 }, /* (86) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ - { 200, -4 }, /* (87) alter_table_clause ::= full_table_name DROP COLUMN column_name */ - { 200, -5 }, /* (88) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ - { 200, -5 }, /* (89) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ - { 200, -5 }, /* (90) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ - { 200, -4 }, /* (91) alter_table_clause ::= full_table_name DROP TAG column_name */ - { 200, -5 }, /* (92) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ - { 200, -5 }, /* (93) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ - { 200, -6 }, /* (94) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ literal */ - { 197, -1 }, /* (95) multi_create_clause ::= create_subtable_clause */ - { 197, -2 }, /* (96) multi_create_clause ::= multi_create_clause create_subtable_clause */ - { 204, -9 }, /* (97) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP */ - { 199, -1 }, /* (98) multi_drop_clause ::= drop_table_clause */ - { 199, -2 }, /* (99) multi_drop_clause ::= multi_drop_clause drop_table_clause */ - { 207, -2 }, /* (100) drop_table_clause ::= exists_opt full_table_name */ - { 205, 0 }, /* (101) specific_tags_opt ::= */ - { 205, -3 }, /* (102) specific_tags_opt ::= NK_LP col_name_list NK_RP */ - { 193, -1 }, /* (103) full_table_name ::= table_name */ - { 193, -3 }, /* (104) full_table_name ::= db_name NK_DOT table_name */ - { 194, -1 }, /* (105) column_def_list ::= column_def */ - { 194, -3 }, /* (106) column_def_list ::= column_def_list NK_COMMA column_def */ - { 210, -2 }, /* (107) column_def ::= column_name type_name */ - { 210, -4 }, /* (108) column_def ::= column_name type_name COMMENT NK_STRING */ - { 203, -1 }, /* (109) type_name ::= BOOL */ - { 203, -1 }, /* (110) type_name ::= TINYINT */ - { 203, -1 }, /* (111) type_name ::= SMALLINT */ - { 203, -1 }, /* (112) type_name ::= INT */ - { 203, -1 }, /* (113) type_name ::= INTEGER */ - { 203, -1 }, /* (114) type_name ::= BIGINT */ - { 203, -1 }, /* (115) type_name ::= FLOAT */ - { 203, -1 }, /* (116) type_name ::= DOUBLE */ - { 203, -4 }, /* (117) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ - { 203, -1 }, /* (118) type_name ::= TIMESTAMP */ - { 203, -4 }, /* (119) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ - { 203, -2 }, /* (120) type_name ::= TINYINT UNSIGNED */ - { 203, -2 }, /* (121) type_name ::= SMALLINT UNSIGNED */ - { 203, -2 }, /* (122) type_name ::= INT UNSIGNED */ - { 203, -2 }, /* (123) type_name ::= BIGINT UNSIGNED */ - { 203, -1 }, /* (124) type_name ::= JSON */ - { 203, -4 }, /* (125) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ - { 203, -1 }, /* (126) type_name ::= MEDIUMBLOB */ - { 203, -1 }, /* (127) type_name ::= BLOB */ - { 203, -4 }, /* (128) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ - { 203, -1 }, /* (129) type_name ::= DECIMAL */ - { 203, -4 }, /* (130) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ - { 203, -6 }, /* (131) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - { 195, 0 }, /* (132) tags_def_opt ::= */ - { 195, -1 }, /* (133) tags_def_opt ::= tags_def */ - { 198, -4 }, /* (134) tags_def ::= TAGS NK_LP column_def_list NK_RP */ - { 196, 0 }, /* (135) table_options ::= */ - { 196, -3 }, /* (136) table_options ::= table_options COMMENT NK_STRING */ - { 196, -3 }, /* (137) table_options ::= table_options KEEP NK_INTEGER */ - { 196, -3 }, /* (138) table_options ::= table_options TTL NK_INTEGER */ - { 196, -5 }, /* (139) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ - { 196, -5 }, /* (140) table_options ::= table_options ROLLUP NK_LP func_name_list NK_RP */ - { 196, -3 }, /* (141) table_options ::= table_options FILE_FACTOR NK_FLOAT */ - { 196, -3 }, /* (142) table_options ::= table_options DELAY NK_INTEGER */ - { 201, -1 }, /* (143) alter_table_options ::= alter_table_option */ - { 201, -2 }, /* (144) alter_table_options ::= alter_table_options alter_table_option */ - { 212, -2 }, /* (145) alter_table_option ::= COMMENT NK_STRING */ - { 212, -2 }, /* (146) alter_table_option ::= KEEP NK_INTEGER */ - { 212, -2 }, /* (147) alter_table_option ::= TTL NK_INTEGER */ - { 208, -1 }, /* (148) col_name_list ::= col_name */ - { 208, -3 }, /* (149) col_name_list ::= col_name_list NK_COMMA col_name */ - { 213, -1 }, /* (150) col_name ::= column_name */ - { 179, -2 }, /* (151) cmd ::= SHOW DNODES */ - { 179, -2 }, /* (152) cmd ::= SHOW USERS */ - { 179, -2 }, /* (153) cmd ::= SHOW DATABASES */ - { 179, -4 }, /* (154) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ - { 179, -4 }, /* (155) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ - { 179, -3 }, /* (156) cmd ::= SHOW db_name_cond_opt VGROUPS */ - { 179, -2 }, /* (157) cmd ::= SHOW MNODES */ - { 179, -2 }, /* (158) cmd ::= SHOW MODULES */ - { 179, -2 }, /* (159) cmd ::= SHOW QNODES */ - { 179, -2 }, /* (160) cmd ::= SHOW FUNCTIONS */ - { 179, -5 }, /* (161) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ - { 179, -2 }, /* (162) cmd ::= SHOW STREAMS */ - { 214, 0 }, /* (163) db_name_cond_opt ::= */ - { 214, -2 }, /* (164) db_name_cond_opt ::= db_name NK_DOT */ - { 215, 0 }, /* (165) like_pattern_opt ::= */ - { 215, -2 }, /* (166) like_pattern_opt ::= LIKE NK_STRING */ - { 216, -1 }, /* (167) table_name_cond ::= table_name */ - { 217, 0 }, /* (168) from_db_opt ::= */ - { 217, -2 }, /* (169) from_db_opt ::= FROM db_name */ - { 211, -1 }, /* (170) func_name_list ::= func_name */ - { 211, -3 }, /* (171) func_name_list ::= func_name_list NK_COMMA col_name */ - { 218, -1 }, /* (172) func_name ::= function_name */ - { 179, -8 }, /* (173) cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ - { 179, -10 }, /* (174) cmd ::= CREATE FULLTEXT INDEX not_exists_opt index_name ON table_name NK_LP col_name_list NK_RP */ - { 179, -6 }, /* (175) cmd ::= DROP INDEX exists_opt index_name ON table_name */ - { 221, 0 }, /* (176) index_options ::= */ - { 221, -9 }, /* (177) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt */ - { 221, -11 }, /* (178) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt */ - { 222, -1 }, /* (179) func_list ::= func */ - { 222, -3 }, /* (180) func_list ::= func_list NK_COMMA func */ - { 225, -4 }, /* (181) func ::= function_name NK_LP expression_list NK_RP */ - { 179, -6 }, /* (182) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ - { 179, -6 }, /* (183) cmd ::= CREATE TOPIC not_exists_opt topic_name AS db_name */ - { 179, -4 }, /* (184) cmd ::= DROP TOPIC exists_opt topic_name */ - { 179, -2 }, /* (185) cmd ::= DESC full_table_name */ - { 179, -2 }, /* (186) cmd ::= DESCRIBE full_table_name */ - { 179, -3 }, /* (187) cmd ::= RESET QUERY CACHE */ - { 179, -4 }, /* (188) cmd ::= EXPLAIN analyze_opt explain_options query_expression */ - { 229, 0 }, /* (189) analyze_opt ::= */ - { 229, -1 }, /* (190) analyze_opt ::= ANALYZE */ - { 230, 0 }, /* (191) explain_options ::= */ - { 230, -3 }, /* (192) explain_options ::= explain_options VERBOSE NK_BOOL */ - { 230, -3 }, /* (193) explain_options ::= explain_options RATIO NK_FLOAT */ - { 179, -1 }, /* (194) cmd ::= query_expression */ - { 182, -1 }, /* (195) literal ::= NK_INTEGER */ - { 182, -1 }, /* (196) literal ::= NK_FLOAT */ - { 182, -1 }, /* (197) literal ::= NK_STRING */ - { 182, -1 }, /* (198) literal ::= NK_BOOL */ - { 182, -2 }, /* (199) literal ::= TIMESTAMP NK_STRING */ - { 182, -1 }, /* (200) literal ::= duration_literal */ - { 182, -1 }, /* (201) literal ::= NULL */ - { 223, -1 }, /* (202) duration_literal ::= NK_VARIABLE */ - { 231, -1 }, /* (203) signed ::= NK_INTEGER */ - { 231, -2 }, /* (204) signed ::= NK_PLUS NK_INTEGER */ - { 231, -2 }, /* (205) signed ::= NK_MINUS NK_INTEGER */ - { 231, -1 }, /* (206) signed ::= NK_FLOAT */ - { 231, -2 }, /* (207) signed ::= NK_PLUS NK_FLOAT */ - { 231, -2 }, /* (208) signed ::= NK_MINUS NK_FLOAT */ - { 232, -1 }, /* (209) signed_literal ::= signed */ - { 232, -1 }, /* (210) signed_literal ::= NK_STRING */ - { 232, -1 }, /* (211) signed_literal ::= NK_BOOL */ - { 232, -2 }, /* (212) signed_literal ::= TIMESTAMP NK_STRING */ - { 232, -1 }, /* (213) signed_literal ::= duration_literal */ - { 232, -1 }, /* (214) signed_literal ::= NULL */ - { 206, -1 }, /* (215) literal_list ::= signed_literal */ - { 206, -3 }, /* (216) literal_list ::= literal_list NK_COMMA signed_literal */ - { 188, -1 }, /* (217) db_name ::= NK_ID */ - { 209, -1 }, /* (218) table_name ::= NK_ID */ - { 202, -1 }, /* (219) column_name ::= NK_ID */ - { 219, -1 }, /* (220) function_name ::= NK_ID */ - { 233, -1 }, /* (221) table_alias ::= NK_ID */ - { 234, -1 }, /* (222) column_alias ::= NK_ID */ - { 184, -1 }, /* (223) user_name ::= NK_ID */ - { 220, -1 }, /* (224) index_name ::= NK_ID */ - { 227, -1 }, /* (225) topic_name ::= NK_ID */ - { 235, -1 }, /* (226) expression ::= literal */ - { 235, -1 }, /* (227) expression ::= pseudo_column */ - { 235, -1 }, /* (228) expression ::= column_reference */ - { 235, -4 }, /* (229) expression ::= function_name NK_LP expression_list NK_RP */ - { 235, -4 }, /* (230) expression ::= function_name NK_LP NK_STAR NK_RP */ - { 235, -1 }, /* (231) expression ::= subquery */ - { 235, -3 }, /* (232) expression ::= NK_LP expression NK_RP */ - { 235, -2 }, /* (233) expression ::= NK_PLUS expression */ - { 235, -2 }, /* (234) expression ::= NK_MINUS expression */ - { 235, -3 }, /* (235) expression ::= expression NK_PLUS expression */ - { 235, -3 }, /* (236) expression ::= expression NK_MINUS expression */ - { 235, -3 }, /* (237) expression ::= expression NK_STAR expression */ - { 235, -3 }, /* (238) expression ::= expression NK_SLASH expression */ - { 235, -3 }, /* (239) expression ::= expression NK_REM expression */ - { 226, -1 }, /* (240) expression_list ::= expression */ - { 226, -3 }, /* (241) expression_list ::= expression_list NK_COMMA expression */ - { 237, -1 }, /* (242) column_reference ::= column_name */ - { 237, -3 }, /* (243) column_reference ::= table_name NK_DOT column_name */ - { 236, -2 }, /* (244) pseudo_column ::= NK_UNDERLINE ROWTS */ - { 236, -1 }, /* (245) pseudo_column ::= TBNAME */ - { 236, -2 }, /* (246) pseudo_column ::= NK_UNDERLINE QSTARTTS */ - { 236, -2 }, /* (247) pseudo_column ::= NK_UNDERLINE QENDTS */ - { 236, -2 }, /* (248) pseudo_column ::= NK_UNDERLINE WSTARTTS */ - { 236, -2 }, /* (249) pseudo_column ::= NK_UNDERLINE WENDTS */ - { 236, -2 }, /* (250) pseudo_column ::= NK_UNDERLINE WDURATION */ - { 239, -3 }, /* (251) predicate ::= expression compare_op expression */ - { 239, -5 }, /* (252) predicate ::= expression BETWEEN expression AND expression */ - { 239, -6 }, /* (253) predicate ::= expression NOT BETWEEN expression AND expression */ - { 239, -3 }, /* (254) predicate ::= expression IS NULL */ - { 239, -4 }, /* (255) predicate ::= expression IS NOT NULL */ - { 239, -3 }, /* (256) predicate ::= expression in_op in_predicate_value */ - { 240, -1 }, /* (257) compare_op ::= NK_LT */ - { 240, -1 }, /* (258) compare_op ::= NK_GT */ - { 240, -1 }, /* (259) compare_op ::= NK_LE */ - { 240, -1 }, /* (260) compare_op ::= NK_GE */ - { 240, -1 }, /* (261) compare_op ::= NK_NE */ - { 240, -1 }, /* (262) compare_op ::= NK_EQ */ - { 240, -1 }, /* (263) compare_op ::= LIKE */ - { 240, -2 }, /* (264) compare_op ::= NOT LIKE */ - { 240, -1 }, /* (265) compare_op ::= MATCH */ - { 240, -1 }, /* (266) compare_op ::= NMATCH */ - { 241, -1 }, /* (267) in_op ::= IN */ - { 241, -2 }, /* (268) in_op ::= NOT IN */ - { 242, -3 }, /* (269) in_predicate_value ::= NK_LP expression_list NK_RP */ - { 243, -1 }, /* (270) boolean_value_expression ::= boolean_primary */ - { 243, -2 }, /* (271) boolean_value_expression ::= NOT boolean_primary */ - { 243, -3 }, /* (272) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - { 243, -3 }, /* (273) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - { 244, -1 }, /* (274) boolean_primary ::= predicate */ - { 244, -3 }, /* (275) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - { 245, -1 }, /* (276) common_expression ::= expression */ - { 245, -1 }, /* (277) common_expression ::= boolean_value_expression */ - { 246, -2 }, /* (278) from_clause ::= FROM table_reference_list */ - { 247, -1 }, /* (279) table_reference_list ::= table_reference */ - { 247, -3 }, /* (280) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - { 248, -1 }, /* (281) table_reference ::= table_primary */ - { 248, -1 }, /* (282) table_reference ::= joined_table */ - { 249, -2 }, /* (283) table_primary ::= table_name alias_opt */ - { 249, -4 }, /* (284) table_primary ::= db_name NK_DOT table_name alias_opt */ - { 249, -2 }, /* (285) table_primary ::= subquery alias_opt */ - { 249, -1 }, /* (286) table_primary ::= parenthesized_joined_table */ - { 251, 0 }, /* (287) alias_opt ::= */ - { 251, -1 }, /* (288) alias_opt ::= table_alias */ - { 251, -2 }, /* (289) alias_opt ::= AS table_alias */ - { 252, -3 }, /* (290) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - { 252, -3 }, /* (291) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - { 250, -6 }, /* (292) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ - { 253, 0 }, /* (293) join_type ::= */ - { 253, -1 }, /* (294) join_type ::= INNER */ - { 255, -9 }, /* (295) query_specification ::= SELECT set_quantifier_opt select_list from_clause where_clause_opt partition_by_clause_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ - { 256, 0 }, /* (296) set_quantifier_opt ::= */ - { 256, -1 }, /* (297) set_quantifier_opt ::= DISTINCT */ - { 256, -1 }, /* (298) set_quantifier_opt ::= ALL */ - { 257, -1 }, /* (299) select_list ::= NK_STAR */ - { 257, -1 }, /* (300) select_list ::= select_sublist */ - { 263, -1 }, /* (301) select_sublist ::= select_item */ - { 263, -3 }, /* (302) select_sublist ::= select_sublist NK_COMMA select_item */ - { 264, -1 }, /* (303) select_item ::= common_expression */ - { 264, -2 }, /* (304) select_item ::= common_expression column_alias */ - { 264, -3 }, /* (305) select_item ::= common_expression AS column_alias */ - { 264, -3 }, /* (306) select_item ::= table_name NK_DOT NK_STAR */ - { 258, 0 }, /* (307) where_clause_opt ::= */ - { 258, -2 }, /* (308) where_clause_opt ::= WHERE search_condition */ - { 259, 0 }, /* (309) partition_by_clause_opt ::= */ - { 259, -3 }, /* (310) partition_by_clause_opt ::= PARTITION BY expression_list */ - { 260, 0 }, /* (311) twindow_clause_opt ::= */ - { 260, -6 }, /* (312) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ - { 260, -4 }, /* (313) twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP */ - { 260, -6 }, /* (314) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ - { 260, -8 }, /* (315) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ - { 224, 0 }, /* (316) sliding_opt ::= */ - { 224, -4 }, /* (317) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ - { 265, 0 }, /* (318) fill_opt ::= */ - { 265, -4 }, /* (319) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - { 265, -6 }, /* (320) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ - { 266, -1 }, /* (321) fill_mode ::= NONE */ - { 266, -1 }, /* (322) fill_mode ::= PREV */ - { 266, -1 }, /* (323) fill_mode ::= NULL */ - { 266, -1 }, /* (324) fill_mode ::= LINEAR */ - { 266, -1 }, /* (325) fill_mode ::= NEXT */ - { 261, 0 }, /* (326) group_by_clause_opt ::= */ - { 261, -3 }, /* (327) group_by_clause_opt ::= GROUP BY group_by_list */ - { 267, -1 }, /* (328) group_by_list ::= expression */ - { 267, -3 }, /* (329) group_by_list ::= group_by_list NK_COMMA expression */ - { 262, 0 }, /* (330) having_clause_opt ::= */ - { 262, -2 }, /* (331) having_clause_opt ::= HAVING search_condition */ - { 228, -4 }, /* (332) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ - { 268, -1 }, /* (333) query_expression_body ::= query_primary */ - { 268, -4 }, /* (334) query_expression_body ::= query_expression_body UNION ALL query_expression_body */ - { 272, -1 }, /* (335) query_primary ::= query_specification */ - { 269, 0 }, /* (336) order_by_clause_opt ::= */ - { 269, -3 }, /* (337) order_by_clause_opt ::= ORDER BY sort_specification_list */ - { 270, 0 }, /* (338) slimit_clause_opt ::= */ - { 270, -2 }, /* (339) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - { 270, -4 }, /* (340) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - { 270, -4 }, /* (341) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - { 271, 0 }, /* (342) limit_clause_opt ::= */ - { 271, -2 }, /* (343) limit_clause_opt ::= LIMIT NK_INTEGER */ - { 271, -4 }, /* (344) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - { 271, -4 }, /* (345) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - { 238, -3 }, /* (346) subquery ::= NK_LP query_expression NK_RP */ - { 254, -1 }, /* (347) search_condition ::= common_expression */ - { 273, -1 }, /* (348) sort_specification_list ::= sort_specification */ - { 273, -3 }, /* (349) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - { 274, -3 }, /* (350) sort_specification ::= expression ordering_specification_opt null_ordering_opt */ - { 275, 0 }, /* (351) ordering_specification_opt ::= */ - { 275, -1 }, /* (352) ordering_specification_opt ::= ASC */ - { 275, -1 }, /* (353) ordering_specification_opt ::= DESC */ - { 276, 0 }, /* (354) null_ordering_opt ::= */ - { 276, -2 }, /* (355) null_ordering_opt ::= NULLS FIRST */ - { 276, -2 }, /* (356) null_ordering_opt ::= NULLS LAST */ + { 192, -2 }, /* (78) alter_db_option ::= REPLICA NK_INTEGER */ + { 179, -9 }, /* (79) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ + { 179, -3 }, /* (80) cmd ::= CREATE TABLE multi_create_clause */ + { 179, -9 }, /* (81) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ + { 179, -3 }, /* (82) cmd ::= DROP TABLE multi_drop_clause */ + { 179, -4 }, /* (83) cmd ::= DROP STABLE exists_opt full_table_name */ + { 179, -3 }, /* (84) cmd ::= ALTER TABLE alter_table_clause */ + { 179, -3 }, /* (85) cmd ::= ALTER STABLE alter_table_clause */ + { 200, -2 }, /* (86) alter_table_clause ::= full_table_name alter_table_options */ + { 200, -5 }, /* (87) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ + { 200, -4 }, /* (88) alter_table_clause ::= full_table_name DROP COLUMN column_name */ + { 200, -5 }, /* (89) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ + { 200, -5 }, /* (90) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ + { 200, -5 }, /* (91) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ + { 200, -4 }, /* (92) alter_table_clause ::= full_table_name DROP TAG column_name */ + { 200, -5 }, /* (93) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ + { 200, -5 }, /* (94) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ + { 200, -6 }, /* (95) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ literal */ + { 197, -1 }, /* (96) multi_create_clause ::= create_subtable_clause */ + { 197, -2 }, /* (97) multi_create_clause ::= multi_create_clause create_subtable_clause */ + { 204, -9 }, /* (98) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP */ + { 199, -1 }, /* (99) multi_drop_clause ::= drop_table_clause */ + { 199, -2 }, /* (100) multi_drop_clause ::= multi_drop_clause drop_table_clause */ + { 207, -2 }, /* (101) drop_table_clause ::= exists_opt full_table_name */ + { 205, 0 }, /* (102) specific_tags_opt ::= */ + { 205, -3 }, /* (103) specific_tags_opt ::= NK_LP col_name_list NK_RP */ + { 193, -1 }, /* (104) full_table_name ::= table_name */ + { 193, -3 }, /* (105) full_table_name ::= db_name NK_DOT table_name */ + { 194, -1 }, /* (106) column_def_list ::= column_def */ + { 194, -3 }, /* (107) column_def_list ::= column_def_list NK_COMMA column_def */ + { 210, -2 }, /* (108) column_def ::= column_name type_name */ + { 210, -4 }, /* (109) column_def ::= column_name type_name COMMENT NK_STRING */ + { 203, -1 }, /* (110) type_name ::= BOOL */ + { 203, -1 }, /* (111) type_name ::= TINYINT */ + { 203, -1 }, /* (112) type_name ::= SMALLINT */ + { 203, -1 }, /* (113) type_name ::= INT */ + { 203, -1 }, /* (114) type_name ::= INTEGER */ + { 203, -1 }, /* (115) type_name ::= BIGINT */ + { 203, -1 }, /* (116) type_name ::= FLOAT */ + { 203, -1 }, /* (117) type_name ::= DOUBLE */ + { 203, -4 }, /* (118) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ + { 203, -1 }, /* (119) type_name ::= TIMESTAMP */ + { 203, -4 }, /* (120) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ + { 203, -2 }, /* (121) type_name ::= TINYINT UNSIGNED */ + { 203, -2 }, /* (122) type_name ::= SMALLINT UNSIGNED */ + { 203, -2 }, /* (123) type_name ::= INT UNSIGNED */ + { 203, -2 }, /* (124) type_name ::= BIGINT UNSIGNED */ + { 203, -1 }, /* (125) type_name ::= JSON */ + { 203, -4 }, /* (126) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ + { 203, -1 }, /* (127) type_name ::= MEDIUMBLOB */ + { 203, -1 }, /* (128) type_name ::= BLOB */ + { 203, -4 }, /* (129) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ + { 203, -1 }, /* (130) type_name ::= DECIMAL */ + { 203, -4 }, /* (131) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ + { 203, -6 }, /* (132) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + { 195, 0 }, /* (133) tags_def_opt ::= */ + { 195, -1 }, /* (134) tags_def_opt ::= tags_def */ + { 198, -4 }, /* (135) tags_def ::= TAGS NK_LP column_def_list NK_RP */ + { 196, 0 }, /* (136) table_options ::= */ + { 196, -3 }, /* (137) table_options ::= table_options COMMENT NK_STRING */ + { 196, -3 }, /* (138) table_options ::= table_options KEEP NK_INTEGER */ + { 196, -3 }, /* (139) table_options ::= table_options TTL NK_INTEGER */ + { 196, -5 }, /* (140) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ + { 196, -5 }, /* (141) table_options ::= table_options ROLLUP NK_LP func_name_list NK_RP */ + { 196, -3 }, /* (142) table_options ::= table_options FILE_FACTOR NK_FLOAT */ + { 196, -3 }, /* (143) table_options ::= table_options DELAY NK_INTEGER */ + { 201, -1 }, /* (144) alter_table_options ::= alter_table_option */ + { 201, -2 }, /* (145) alter_table_options ::= alter_table_options alter_table_option */ + { 212, -2 }, /* (146) alter_table_option ::= COMMENT NK_STRING */ + { 212, -2 }, /* (147) alter_table_option ::= KEEP NK_INTEGER */ + { 212, -2 }, /* (148) alter_table_option ::= TTL NK_INTEGER */ + { 208, -1 }, /* (149) col_name_list ::= col_name */ + { 208, -3 }, /* (150) col_name_list ::= col_name_list NK_COMMA col_name */ + { 213, -1 }, /* (151) col_name ::= column_name */ + { 179, -2 }, /* (152) cmd ::= SHOW DNODES */ + { 179, -2 }, /* (153) cmd ::= SHOW USERS */ + { 179, -2 }, /* (154) cmd ::= SHOW DATABASES */ + { 179, -4 }, /* (155) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ + { 179, -4 }, /* (156) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ + { 179, -3 }, /* (157) cmd ::= SHOW db_name_cond_opt VGROUPS */ + { 179, -2 }, /* (158) cmd ::= SHOW MNODES */ + { 179, -2 }, /* (159) cmd ::= SHOW MODULES */ + { 179, -2 }, /* (160) cmd ::= SHOW QNODES */ + { 179, -2 }, /* (161) cmd ::= SHOW FUNCTIONS */ + { 179, -5 }, /* (162) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ + { 179, -2 }, /* (163) cmd ::= SHOW STREAMS */ + { 214, 0 }, /* (164) db_name_cond_opt ::= */ + { 214, -2 }, /* (165) db_name_cond_opt ::= db_name NK_DOT */ + { 215, 0 }, /* (166) like_pattern_opt ::= */ + { 215, -2 }, /* (167) like_pattern_opt ::= LIKE NK_STRING */ + { 216, -1 }, /* (168) table_name_cond ::= table_name */ + { 217, 0 }, /* (169) from_db_opt ::= */ + { 217, -2 }, /* (170) from_db_opt ::= FROM db_name */ + { 211, -1 }, /* (171) func_name_list ::= func_name */ + { 211, -3 }, /* (172) func_name_list ::= func_name_list NK_COMMA col_name */ + { 218, -1 }, /* (173) func_name ::= function_name */ + { 179, -8 }, /* (174) cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ + { 179, -10 }, /* (175) cmd ::= CREATE FULLTEXT INDEX not_exists_opt index_name ON table_name NK_LP col_name_list NK_RP */ + { 179, -6 }, /* (176) cmd ::= DROP INDEX exists_opt index_name ON table_name */ + { 221, 0 }, /* (177) index_options ::= */ + { 221, -9 }, /* (178) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt */ + { 221, -11 }, /* (179) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt */ + { 222, -1 }, /* (180) func_list ::= func */ + { 222, -3 }, /* (181) func_list ::= func_list NK_COMMA func */ + { 225, -4 }, /* (182) func ::= function_name NK_LP expression_list NK_RP */ + { 179, -6 }, /* (183) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ + { 179, -6 }, /* (184) cmd ::= CREATE TOPIC not_exists_opt topic_name AS db_name */ + { 179, -4 }, /* (185) cmd ::= DROP TOPIC exists_opt topic_name */ + { 179, -2 }, /* (186) cmd ::= DESC full_table_name */ + { 179, -2 }, /* (187) cmd ::= DESCRIBE full_table_name */ + { 179, -3 }, /* (188) cmd ::= RESET QUERY CACHE */ + { 179, -4 }, /* (189) cmd ::= EXPLAIN analyze_opt explain_options query_expression */ + { 229, 0 }, /* (190) analyze_opt ::= */ + { 229, -1 }, /* (191) analyze_opt ::= ANALYZE */ + { 230, 0 }, /* (192) explain_options ::= */ + { 230, -3 }, /* (193) explain_options ::= explain_options VERBOSE NK_BOOL */ + { 230, -3 }, /* (194) explain_options ::= explain_options RATIO NK_FLOAT */ + { 179, -1 }, /* (195) cmd ::= query_expression */ + { 182, -1 }, /* (196) literal ::= NK_INTEGER */ + { 182, -1 }, /* (197) literal ::= NK_FLOAT */ + { 182, -1 }, /* (198) literal ::= NK_STRING */ + { 182, -1 }, /* (199) literal ::= NK_BOOL */ + { 182, -2 }, /* (200) literal ::= TIMESTAMP NK_STRING */ + { 182, -1 }, /* (201) literal ::= duration_literal */ + { 182, -1 }, /* (202) literal ::= NULL */ + { 223, -1 }, /* (203) duration_literal ::= NK_VARIABLE */ + { 231, -1 }, /* (204) signed ::= NK_INTEGER */ + { 231, -2 }, /* (205) signed ::= NK_PLUS NK_INTEGER */ + { 231, -2 }, /* (206) signed ::= NK_MINUS NK_INTEGER */ + { 231, -1 }, /* (207) signed ::= NK_FLOAT */ + { 231, -2 }, /* (208) signed ::= NK_PLUS NK_FLOAT */ + { 231, -2 }, /* (209) signed ::= NK_MINUS NK_FLOAT */ + { 232, -1 }, /* (210) signed_literal ::= signed */ + { 232, -1 }, /* (211) signed_literal ::= NK_STRING */ + { 232, -1 }, /* (212) signed_literal ::= NK_BOOL */ + { 232, -2 }, /* (213) signed_literal ::= TIMESTAMP NK_STRING */ + { 232, -1 }, /* (214) signed_literal ::= duration_literal */ + { 232, -1 }, /* (215) signed_literal ::= NULL */ + { 206, -1 }, /* (216) literal_list ::= signed_literal */ + { 206, -3 }, /* (217) literal_list ::= literal_list NK_COMMA signed_literal */ + { 188, -1 }, /* (218) db_name ::= NK_ID */ + { 209, -1 }, /* (219) table_name ::= NK_ID */ + { 202, -1 }, /* (220) column_name ::= NK_ID */ + { 219, -1 }, /* (221) function_name ::= NK_ID */ + { 233, -1 }, /* (222) table_alias ::= NK_ID */ + { 234, -1 }, /* (223) column_alias ::= NK_ID */ + { 184, -1 }, /* (224) user_name ::= NK_ID */ + { 220, -1 }, /* (225) index_name ::= NK_ID */ + { 227, -1 }, /* (226) topic_name ::= NK_ID */ + { 235, -1 }, /* (227) expression ::= literal */ + { 235, -1 }, /* (228) expression ::= pseudo_column */ + { 235, -1 }, /* (229) expression ::= column_reference */ + { 235, -4 }, /* (230) expression ::= function_name NK_LP expression_list NK_RP */ + { 235, -4 }, /* (231) expression ::= function_name NK_LP NK_STAR NK_RP */ + { 235, -1 }, /* (232) expression ::= subquery */ + { 235, -3 }, /* (233) expression ::= NK_LP expression NK_RP */ + { 235, -2 }, /* (234) expression ::= NK_PLUS expression */ + { 235, -2 }, /* (235) expression ::= NK_MINUS expression */ + { 235, -3 }, /* (236) expression ::= expression NK_PLUS expression */ + { 235, -3 }, /* (237) expression ::= expression NK_MINUS expression */ + { 235, -3 }, /* (238) expression ::= expression NK_STAR expression */ + { 235, -3 }, /* (239) expression ::= expression NK_SLASH expression */ + { 235, -3 }, /* (240) expression ::= expression NK_REM expression */ + { 226, -1 }, /* (241) expression_list ::= expression */ + { 226, -3 }, /* (242) expression_list ::= expression_list NK_COMMA expression */ + { 237, -1 }, /* (243) column_reference ::= column_name */ + { 237, -3 }, /* (244) column_reference ::= table_name NK_DOT column_name */ + { 236, -2 }, /* (245) pseudo_column ::= NK_UNDERLINE ROWTS */ + { 236, -1 }, /* (246) pseudo_column ::= TBNAME */ + { 236, -2 }, /* (247) pseudo_column ::= NK_UNDERLINE QSTARTTS */ + { 236, -2 }, /* (248) pseudo_column ::= NK_UNDERLINE QENDTS */ + { 236, -2 }, /* (249) pseudo_column ::= NK_UNDERLINE WSTARTTS */ + { 236, -2 }, /* (250) pseudo_column ::= NK_UNDERLINE WENDTS */ + { 236, -2 }, /* (251) pseudo_column ::= NK_UNDERLINE WDURATION */ + { 239, -3 }, /* (252) predicate ::= expression compare_op expression */ + { 239, -5 }, /* (253) predicate ::= expression BETWEEN expression AND expression */ + { 239, -6 }, /* (254) predicate ::= expression NOT BETWEEN expression AND expression */ + { 239, -3 }, /* (255) predicate ::= expression IS NULL */ + { 239, -4 }, /* (256) predicate ::= expression IS NOT NULL */ + { 239, -3 }, /* (257) predicate ::= expression in_op in_predicate_value */ + { 240, -1 }, /* (258) compare_op ::= NK_LT */ + { 240, -1 }, /* (259) compare_op ::= NK_GT */ + { 240, -1 }, /* (260) compare_op ::= NK_LE */ + { 240, -1 }, /* (261) compare_op ::= NK_GE */ + { 240, -1 }, /* (262) compare_op ::= NK_NE */ + { 240, -1 }, /* (263) compare_op ::= NK_EQ */ + { 240, -1 }, /* (264) compare_op ::= LIKE */ + { 240, -2 }, /* (265) compare_op ::= NOT LIKE */ + { 240, -1 }, /* (266) compare_op ::= MATCH */ + { 240, -1 }, /* (267) compare_op ::= NMATCH */ + { 241, -1 }, /* (268) in_op ::= IN */ + { 241, -2 }, /* (269) in_op ::= NOT IN */ + { 242, -3 }, /* (270) in_predicate_value ::= NK_LP expression_list NK_RP */ + { 243, -1 }, /* (271) boolean_value_expression ::= boolean_primary */ + { 243, -2 }, /* (272) boolean_value_expression ::= NOT boolean_primary */ + { 243, -3 }, /* (273) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + { 243, -3 }, /* (274) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + { 244, -1 }, /* (275) boolean_primary ::= predicate */ + { 244, -3 }, /* (276) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + { 245, -1 }, /* (277) common_expression ::= expression */ + { 245, -1 }, /* (278) common_expression ::= boolean_value_expression */ + { 246, -2 }, /* (279) from_clause ::= FROM table_reference_list */ + { 247, -1 }, /* (280) table_reference_list ::= table_reference */ + { 247, -3 }, /* (281) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + { 248, -1 }, /* (282) table_reference ::= table_primary */ + { 248, -1 }, /* (283) table_reference ::= joined_table */ + { 249, -2 }, /* (284) table_primary ::= table_name alias_opt */ + { 249, -4 }, /* (285) table_primary ::= db_name NK_DOT table_name alias_opt */ + { 249, -2 }, /* (286) table_primary ::= subquery alias_opt */ + { 249, -1 }, /* (287) table_primary ::= parenthesized_joined_table */ + { 251, 0 }, /* (288) alias_opt ::= */ + { 251, -1 }, /* (289) alias_opt ::= table_alias */ + { 251, -2 }, /* (290) alias_opt ::= AS table_alias */ + { 252, -3 }, /* (291) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + { 252, -3 }, /* (292) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + { 250, -6 }, /* (293) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ + { 253, 0 }, /* (294) join_type ::= */ + { 253, -1 }, /* (295) join_type ::= INNER */ + { 255, -9 }, /* (296) query_specification ::= SELECT set_quantifier_opt select_list from_clause where_clause_opt partition_by_clause_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ + { 256, 0 }, /* (297) set_quantifier_opt ::= */ + { 256, -1 }, /* (298) set_quantifier_opt ::= DISTINCT */ + { 256, -1 }, /* (299) set_quantifier_opt ::= ALL */ + { 257, -1 }, /* (300) select_list ::= NK_STAR */ + { 257, -1 }, /* (301) select_list ::= select_sublist */ + { 263, -1 }, /* (302) select_sublist ::= select_item */ + { 263, -3 }, /* (303) select_sublist ::= select_sublist NK_COMMA select_item */ + { 264, -1 }, /* (304) select_item ::= common_expression */ + { 264, -2 }, /* (305) select_item ::= common_expression column_alias */ + { 264, -3 }, /* (306) select_item ::= common_expression AS column_alias */ + { 264, -3 }, /* (307) select_item ::= table_name NK_DOT NK_STAR */ + { 258, 0 }, /* (308) where_clause_opt ::= */ + { 258, -2 }, /* (309) where_clause_opt ::= WHERE search_condition */ + { 259, 0 }, /* (310) partition_by_clause_opt ::= */ + { 259, -3 }, /* (311) partition_by_clause_opt ::= PARTITION BY expression_list */ + { 260, 0 }, /* (312) twindow_clause_opt ::= */ + { 260, -6 }, /* (313) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ + { 260, -4 }, /* (314) twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP */ + { 260, -6 }, /* (315) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ + { 260, -8 }, /* (316) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ + { 224, 0 }, /* (317) sliding_opt ::= */ + { 224, -4 }, /* (318) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ + { 265, 0 }, /* (319) fill_opt ::= */ + { 265, -4 }, /* (320) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + { 265, -6 }, /* (321) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ + { 266, -1 }, /* (322) fill_mode ::= NONE */ + { 266, -1 }, /* (323) fill_mode ::= PREV */ + { 266, -1 }, /* (324) fill_mode ::= NULL */ + { 266, -1 }, /* (325) fill_mode ::= LINEAR */ + { 266, -1 }, /* (326) fill_mode ::= NEXT */ + { 261, 0 }, /* (327) group_by_clause_opt ::= */ + { 261, -3 }, /* (328) group_by_clause_opt ::= GROUP BY group_by_list */ + { 267, -1 }, /* (329) group_by_list ::= expression */ + { 267, -3 }, /* (330) group_by_list ::= group_by_list NK_COMMA expression */ + { 262, 0 }, /* (331) having_clause_opt ::= */ + { 262, -2 }, /* (332) having_clause_opt ::= HAVING search_condition */ + { 228, -4 }, /* (333) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ + { 268, -1 }, /* (334) query_expression_body ::= query_primary */ + { 268, -4 }, /* (335) query_expression_body ::= query_expression_body UNION ALL query_expression_body */ + { 272, -1 }, /* (336) query_primary ::= query_specification */ + { 269, 0 }, /* (337) order_by_clause_opt ::= */ + { 269, -3 }, /* (338) order_by_clause_opt ::= ORDER BY sort_specification_list */ + { 270, 0 }, /* (339) slimit_clause_opt ::= */ + { 270, -2 }, /* (340) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + { 270, -4 }, /* (341) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + { 270, -4 }, /* (342) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 271, 0 }, /* (343) limit_clause_opt ::= */ + { 271, -2 }, /* (344) limit_clause_opt ::= LIMIT NK_INTEGER */ + { 271, -4 }, /* (345) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + { 271, -4 }, /* (346) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 238, -3 }, /* (347) subquery ::= NK_LP query_expression NK_RP */ + { 254, -1 }, /* (348) search_condition ::= common_expression */ + { 273, -1 }, /* (349) sort_specification_list ::= sort_specification */ + { 273, -3 }, /* (350) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + { 274, -3 }, /* (351) sort_specification ::= expression ordering_specification_opt null_ordering_opt */ + { 275, 0 }, /* (352) ordering_specification_opt ::= */ + { 275, -1 }, /* (353) ordering_specification_opt ::= ASC */ + { 275, -1 }, /* (354) ordering_specification_opt ::= DESC */ + { 276, 0 }, /* (355) null_ordering_opt ::= */ + { 276, -2 }, /* (356) null_ordering_opt ::= NULLS FIRST */ + { 276, -2 }, /* (357) null_ordering_opt ::= NULLS LAST */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -2469,15 +2466,15 @@ 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 217: /* db_name ::= NK_ID */ yytestcase(yyruleno==217); - case 218: /* table_name ::= NK_ID */ yytestcase(yyruleno==218); - case 219: /* column_name ::= NK_ID */ yytestcase(yyruleno==219); - case 220: /* function_name ::= NK_ID */ yytestcase(yyruleno==220); - case 221: /* table_alias ::= NK_ID */ yytestcase(yyruleno==221); - case 222: /* column_alias ::= NK_ID */ yytestcase(yyruleno==222); - case 223: /* user_name ::= NK_ID */ yytestcase(yyruleno==223); - case 224: /* index_name ::= NK_ID */ yytestcase(yyruleno==224); - case 225: /* topic_name ::= NK_ID */ yytestcase(yyruleno==225); + case 218: /* db_name ::= NK_ID */ yytestcase(yyruleno==218); + case 219: /* table_name ::= NK_ID */ yytestcase(yyruleno==219); + case 220: /* column_name ::= NK_ID */ yytestcase(yyruleno==220); + case 221: /* function_name ::= NK_ID */ yytestcase(yyruleno==221); + case 222: /* table_alias ::= NK_ID */ yytestcase(yyruleno==222); + case 223: /* column_alias ::= NK_ID */ yytestcase(yyruleno==223); + case 224: /* user_name ::= NK_ID */ yytestcase(yyruleno==224); + case 225: /* index_name ::= NK_ID */ yytestcase(yyruleno==225); + case 226: /* topic_name ::= NK_ID */ yytestcase(yyruleno==226); { yylhsminor.yy95 = yymsp[0].minor.yy0; } yymsp[0].minor.yy95 = yylhsminor.yy95; break; @@ -2510,8 +2507,8 @@ static YYACTIONTYPE yy_reduce( break; case 48: /* not_exists_opt ::= */ case 50: /* exists_opt ::= */ yytestcase(yyruleno==50); - case 189: /* analyze_opt ::= */ yytestcase(yyruleno==189); - case 296: /* set_quantifier_opt ::= */ yytestcase(yyruleno==296); + case 190: /* analyze_opt ::= */ yytestcase(yyruleno==190); + case 297: /* set_quantifier_opt ::= */ yytestcase(yyruleno==297); { yymsp[1].minor.yy151 = false; } break; case 49: /* exists_opt ::= IF EXISTS */ @@ -2618,429 +2615,432 @@ static YYACTIONTYPE yy_reduce( case 77: /* alter_db_option ::= CACHELAST NK_INTEGER */ { yymsp[-1].minor.yy145.type = DB_OPTION_CACHELAST; yymsp[-1].minor.yy145.val = yymsp[0].minor.yy0; } break; - case 78: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ - case 80: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==80); + case 78: /* alter_db_option ::= REPLICA NK_INTEGER */ +{ yymsp[-1].minor.yy145.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy145.val = yymsp[0].minor.yy0; } + break; + case 79: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ + case 81: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==81); { pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy151, yymsp[-5].minor.yy46, yymsp[-3].minor.yy194, yymsp[-1].minor.yy194, yymsp[0].minor.yy46); } break; - case 79: /* cmd ::= CREATE TABLE multi_create_clause */ + case 80: /* cmd ::= CREATE TABLE multi_create_clause */ { pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy194); } break; - case 81: /* cmd ::= DROP TABLE multi_drop_clause */ + case 82: /* cmd ::= DROP TABLE multi_drop_clause */ { pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy194); } break; - case 82: /* cmd ::= DROP STABLE exists_opt full_table_name */ + case 83: /* cmd ::= DROP STABLE exists_opt full_table_name */ { pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy151, yymsp[0].minor.yy46); } break; - case 83: /* cmd ::= ALTER TABLE alter_table_clause */ - case 84: /* cmd ::= ALTER STABLE alter_table_clause */ yytestcase(yyruleno==84); - case 194: /* cmd ::= query_expression */ yytestcase(yyruleno==194); + case 84: /* cmd ::= ALTER TABLE alter_table_clause */ + case 85: /* cmd ::= ALTER STABLE alter_table_clause */ yytestcase(yyruleno==85); + case 195: /* cmd ::= query_expression */ yytestcase(yyruleno==195); { pCxt->pRootNode = yymsp[0].minor.yy46; } break; - case 85: /* alter_table_clause ::= full_table_name alter_table_options */ + case 86: /* alter_table_clause ::= full_table_name alter_table_options */ { yylhsminor.yy46 = createAlterTableOption(pCxt, yymsp[-1].minor.yy46, yymsp[0].minor.yy46); } yymsp[-1].minor.yy46 = yylhsminor.yy46; break; - case 86: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ + case 87: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ { yylhsminor.yy46 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy46, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy95, yymsp[0].minor.yy400); } yymsp[-4].minor.yy46 = yylhsminor.yy46; break; - case 87: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ + case 88: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ { yylhsminor.yy46 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy46, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy95); } yymsp[-3].minor.yy46 = yylhsminor.yy46; break; - case 88: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ + case 89: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ { yylhsminor.yy46 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy46, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy95, yymsp[0].minor.yy400); } yymsp[-4].minor.yy46 = yylhsminor.yy46; break; - case 89: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ + case 90: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ { yylhsminor.yy46 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy46, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy95, &yymsp[0].minor.yy95); } yymsp[-4].minor.yy46 = yylhsminor.yy46; break; - case 90: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ + case 91: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ { yylhsminor.yy46 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy46, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy95, yymsp[0].minor.yy400); } yymsp[-4].minor.yy46 = yylhsminor.yy46; break; - case 91: /* alter_table_clause ::= full_table_name DROP TAG column_name */ + case 92: /* alter_table_clause ::= full_table_name DROP TAG column_name */ { yylhsminor.yy46 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy46, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy95); } yymsp[-3].minor.yy46 = yylhsminor.yy46; break; - case 92: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ + case 93: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ { yylhsminor.yy46 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy46, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy95, yymsp[0].minor.yy400); } yymsp[-4].minor.yy46 = yylhsminor.yy46; break; - case 93: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ + case 94: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ { yylhsminor.yy46 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy46, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy95, &yymsp[0].minor.yy95); } yymsp[-4].minor.yy46 = yylhsminor.yy46; break; - case 94: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ literal */ + case 95: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ literal */ { yylhsminor.yy46 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy46, &yymsp[-2].minor.yy95, yymsp[0].minor.yy46); } yymsp[-5].minor.yy46 = yylhsminor.yy46; break; - case 95: /* multi_create_clause ::= create_subtable_clause */ - case 98: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==98); - case 105: /* column_def_list ::= column_def */ yytestcase(yyruleno==105); - case 148: /* col_name_list ::= col_name */ yytestcase(yyruleno==148); - case 170: /* func_name_list ::= func_name */ yytestcase(yyruleno==170); - case 179: /* func_list ::= func */ yytestcase(yyruleno==179); - case 215: /* literal_list ::= signed_literal */ yytestcase(yyruleno==215); - case 301: /* select_sublist ::= select_item */ yytestcase(yyruleno==301); - case 348: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==348); + case 96: /* multi_create_clause ::= create_subtable_clause */ + case 99: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==99); + case 106: /* column_def_list ::= column_def */ yytestcase(yyruleno==106); + case 149: /* col_name_list ::= col_name */ yytestcase(yyruleno==149); + case 171: /* func_name_list ::= func_name */ yytestcase(yyruleno==171); + case 180: /* func_list ::= func */ yytestcase(yyruleno==180); + case 216: /* literal_list ::= signed_literal */ yytestcase(yyruleno==216); + case 302: /* select_sublist ::= select_item */ yytestcase(yyruleno==302); + case 349: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==349); { yylhsminor.yy194 = createNodeList(pCxt, yymsp[0].minor.yy46); } yymsp[0].minor.yy194 = yylhsminor.yy194; break; - case 96: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ - case 99: /* multi_drop_clause ::= multi_drop_clause drop_table_clause */ yytestcase(yyruleno==99); + case 97: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ + case 100: /* multi_drop_clause ::= multi_drop_clause drop_table_clause */ yytestcase(yyruleno==100); { yylhsminor.yy194 = addNodeToList(pCxt, yymsp[-1].minor.yy194, yymsp[0].minor.yy46); } yymsp[-1].minor.yy194 = yylhsminor.yy194; break; - case 97: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP */ + case 98: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP */ { yylhsminor.yy46 = createCreateSubTableClause(pCxt, yymsp[-8].minor.yy151, yymsp[-7].minor.yy46, yymsp[-5].minor.yy46, yymsp[-4].minor.yy194, yymsp[-1].minor.yy194); } yymsp[-8].minor.yy46 = yylhsminor.yy46; break; - case 100: /* drop_table_clause ::= exists_opt full_table_name */ + case 101: /* drop_table_clause ::= exists_opt full_table_name */ { yylhsminor.yy46 = createDropTableClause(pCxt, yymsp[-1].minor.yy151, yymsp[0].minor.yy46); } yymsp[-1].minor.yy46 = yylhsminor.yy46; break; - case 101: /* specific_tags_opt ::= */ - case 132: /* tags_def_opt ::= */ yytestcase(yyruleno==132); - case 309: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==309); - case 326: /* group_by_clause_opt ::= */ yytestcase(yyruleno==326); - case 336: /* order_by_clause_opt ::= */ yytestcase(yyruleno==336); + case 102: /* specific_tags_opt ::= */ + case 133: /* tags_def_opt ::= */ yytestcase(yyruleno==133); + case 310: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==310); + case 327: /* group_by_clause_opt ::= */ yytestcase(yyruleno==327); + case 337: /* order_by_clause_opt ::= */ yytestcase(yyruleno==337); { yymsp[1].minor.yy194 = NULL; } break; - case 102: /* specific_tags_opt ::= NK_LP col_name_list NK_RP */ + case 103: /* specific_tags_opt ::= NK_LP col_name_list NK_RP */ { yymsp[-2].minor.yy194 = yymsp[-1].minor.yy194; } break; - case 103: /* full_table_name ::= table_name */ + case 104: /* full_table_name ::= table_name */ { yylhsminor.yy46 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy95, NULL); } yymsp[0].minor.yy46 = yylhsminor.yy46; break; - case 104: /* full_table_name ::= db_name NK_DOT table_name */ + case 105: /* full_table_name ::= db_name NK_DOT table_name */ { yylhsminor.yy46 = createRealTableNode(pCxt, &yymsp[-2].minor.yy95, &yymsp[0].minor.yy95, NULL); } yymsp[-2].minor.yy46 = yylhsminor.yy46; break; - case 106: /* column_def_list ::= column_def_list NK_COMMA column_def */ - case 149: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==149); - case 171: /* func_name_list ::= func_name_list NK_COMMA col_name */ yytestcase(yyruleno==171); - case 180: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==180); - case 216: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==216); - case 302: /* select_sublist ::= select_sublist NK_COMMA select_item */ yytestcase(yyruleno==302); - case 349: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==349); + case 107: /* column_def_list ::= column_def_list NK_COMMA column_def */ + case 150: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==150); + case 172: /* func_name_list ::= func_name_list NK_COMMA col_name */ yytestcase(yyruleno==172); + case 181: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==181); + case 217: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==217); + case 303: /* select_sublist ::= select_sublist NK_COMMA select_item */ yytestcase(yyruleno==303); + case 350: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==350); { yylhsminor.yy194 = addNodeToList(pCxt, yymsp[-2].minor.yy194, yymsp[0].minor.yy46); } yymsp[-2].minor.yy194 = yylhsminor.yy194; break; - case 107: /* column_def ::= column_name type_name */ + case 108: /* column_def ::= column_name type_name */ { yylhsminor.yy46 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy95, yymsp[0].minor.yy400, NULL); } yymsp[-1].minor.yy46 = yylhsminor.yy46; break; - case 108: /* column_def ::= column_name type_name COMMENT NK_STRING */ + case 109: /* column_def ::= column_name type_name COMMENT NK_STRING */ { yylhsminor.yy46 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy95, yymsp[-2].minor.yy400, &yymsp[0].minor.yy0); } yymsp[-3].minor.yy46 = yylhsminor.yy46; break; - case 109: /* type_name ::= BOOL */ + case 110: /* type_name ::= BOOL */ { yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_BOOL); } break; - case 110: /* type_name ::= TINYINT */ + case 111: /* type_name ::= TINYINT */ { yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_TINYINT); } break; - case 111: /* type_name ::= SMALLINT */ + case 112: /* type_name ::= SMALLINT */ { yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_SMALLINT); } break; - case 112: /* type_name ::= INT */ - case 113: /* type_name ::= INTEGER */ yytestcase(yyruleno==113); + case 113: /* type_name ::= INT */ + case 114: /* type_name ::= INTEGER */ yytestcase(yyruleno==114); { yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_INT); } break; - case 114: /* type_name ::= BIGINT */ + case 115: /* type_name ::= BIGINT */ { yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_BIGINT); } break; - case 115: /* type_name ::= FLOAT */ + case 116: /* type_name ::= FLOAT */ { yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_FLOAT); } break; - case 116: /* type_name ::= DOUBLE */ + case 117: /* type_name ::= DOUBLE */ { yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_DOUBLE); } break; - case 117: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ + case 118: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ { yymsp[-3].minor.yy400 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } break; - case 118: /* type_name ::= TIMESTAMP */ + case 119: /* type_name ::= TIMESTAMP */ { yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } break; - case 119: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ + case 120: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ { yymsp[-3].minor.yy400 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } break; - case 120: /* type_name ::= TINYINT UNSIGNED */ + case 121: /* type_name ::= TINYINT UNSIGNED */ { yymsp[-1].minor.yy400 = createDataType(TSDB_DATA_TYPE_UTINYINT); } break; - case 121: /* type_name ::= SMALLINT UNSIGNED */ + case 122: /* type_name ::= SMALLINT UNSIGNED */ { yymsp[-1].minor.yy400 = createDataType(TSDB_DATA_TYPE_USMALLINT); } break; - case 122: /* type_name ::= INT UNSIGNED */ + case 123: /* type_name ::= INT UNSIGNED */ { yymsp[-1].minor.yy400 = createDataType(TSDB_DATA_TYPE_UINT); } break; - case 123: /* type_name ::= BIGINT UNSIGNED */ + case 124: /* type_name ::= BIGINT UNSIGNED */ { yymsp[-1].minor.yy400 = createDataType(TSDB_DATA_TYPE_UBIGINT); } break; - case 124: /* type_name ::= JSON */ + case 125: /* type_name ::= JSON */ { yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_JSON); } break; - case 125: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ + case 126: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ { yymsp[-3].minor.yy400 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } break; - case 126: /* type_name ::= MEDIUMBLOB */ + case 127: /* type_name ::= MEDIUMBLOB */ { yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } break; - case 127: /* type_name ::= BLOB */ + case 128: /* type_name ::= BLOB */ { yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_BLOB); } break; - case 128: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ + case 129: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ { yymsp[-3].minor.yy400 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } break; - case 129: /* type_name ::= DECIMAL */ + case 130: /* type_name ::= DECIMAL */ { yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; - case 130: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ + case 131: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ { yymsp[-3].minor.yy400 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; - case 131: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + case 132: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ { yymsp[-5].minor.yy400 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; - case 133: /* tags_def_opt ::= tags_def */ - case 300: /* select_list ::= select_sublist */ yytestcase(yyruleno==300); + case 134: /* tags_def_opt ::= tags_def */ + case 301: /* select_list ::= select_sublist */ yytestcase(yyruleno==301); { yylhsminor.yy194 = yymsp[0].minor.yy194; } yymsp[0].minor.yy194 = yylhsminor.yy194; break; - case 134: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */ + case 135: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */ { yymsp[-3].minor.yy194 = yymsp[-1].minor.yy194; } break; - case 135: /* table_options ::= */ + case 136: /* table_options ::= */ { yymsp[1].minor.yy46 = createDefaultTableOptions(pCxt); } break; - case 136: /* table_options ::= table_options COMMENT NK_STRING */ + case 137: /* table_options ::= table_options COMMENT NK_STRING */ { yylhsminor.yy46 = setTableOption(pCxt, yymsp[-2].minor.yy46, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } yymsp[-2].minor.yy46 = yylhsminor.yy46; break; - case 137: /* table_options ::= table_options KEEP NK_INTEGER */ + case 138: /* table_options ::= table_options KEEP NK_INTEGER */ { yylhsminor.yy46 = setTableOption(pCxt, yymsp[-2].minor.yy46, TABLE_OPTION_KEEP, &yymsp[0].minor.yy0); } yymsp[-2].minor.yy46 = yylhsminor.yy46; break; - case 138: /* table_options ::= table_options TTL NK_INTEGER */ + case 139: /* table_options ::= table_options TTL NK_INTEGER */ { yylhsminor.yy46 = setTableOption(pCxt, yymsp[-2].minor.yy46, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } yymsp[-2].minor.yy46 = yylhsminor.yy46; break; - case 139: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ + case 140: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ { yylhsminor.yy46 = setTableSmaOption(pCxt, yymsp[-4].minor.yy46, yymsp[-1].minor.yy194); } yymsp[-4].minor.yy46 = yylhsminor.yy46; break; - case 140: /* table_options ::= table_options ROLLUP NK_LP func_name_list NK_RP */ + case 141: /* table_options ::= table_options ROLLUP NK_LP func_name_list NK_RP */ { yylhsminor.yy46 = setTableRollupOption(pCxt, yymsp[-4].minor.yy46, yymsp[-1].minor.yy194); } yymsp[-4].minor.yy46 = yylhsminor.yy46; break; - case 141: /* table_options ::= table_options FILE_FACTOR NK_FLOAT */ + case 142: /* table_options ::= table_options FILE_FACTOR NK_FLOAT */ { yylhsminor.yy46 = setTableOption(pCxt, yymsp[-2].minor.yy46, TABLE_OPTION_FILE_FACTOR, &yymsp[0].minor.yy0); } yymsp[-2].minor.yy46 = yylhsminor.yy46; break; - case 142: /* table_options ::= table_options DELAY NK_INTEGER */ + case 143: /* table_options ::= table_options DELAY NK_INTEGER */ { yylhsminor.yy46 = setTableOption(pCxt, yymsp[-2].minor.yy46, TABLE_OPTION_DELAY, &yymsp[0].minor.yy0); } yymsp[-2].minor.yy46 = yylhsminor.yy46; break; - case 143: /* alter_table_options ::= alter_table_option */ + case 144: /* alter_table_options ::= alter_table_option */ { yylhsminor.yy46 = createDefaultAlterTableOptions(pCxt); yylhsminor.yy46 = setTableOption(pCxt, yylhsminor.yy46, yymsp[0].minor.yy145.type, &yymsp[0].minor.yy145.val); } yymsp[0].minor.yy46 = yylhsminor.yy46; break; - case 144: /* alter_table_options ::= alter_table_options alter_table_option */ + case 145: /* alter_table_options ::= alter_table_options alter_table_option */ { yylhsminor.yy46 = setTableOption(pCxt, yymsp[-1].minor.yy46, yymsp[0].minor.yy145.type, &yymsp[0].minor.yy145.val); } yymsp[-1].minor.yy46 = yylhsminor.yy46; break; - case 145: /* alter_table_option ::= COMMENT NK_STRING */ + case 146: /* alter_table_option ::= COMMENT NK_STRING */ { yymsp[-1].minor.yy145.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy145.val = yymsp[0].minor.yy0; } break; - case 146: /* alter_table_option ::= KEEP NK_INTEGER */ + case 147: /* alter_table_option ::= KEEP NK_INTEGER */ { yymsp[-1].minor.yy145.type = TABLE_OPTION_KEEP; yymsp[-1].minor.yy145.val = yymsp[0].minor.yy0; } break; - case 147: /* alter_table_option ::= TTL NK_INTEGER */ + case 148: /* alter_table_option ::= TTL NK_INTEGER */ { yymsp[-1].minor.yy145.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy145.val = yymsp[0].minor.yy0; } break; - case 150: /* col_name ::= column_name */ + case 151: /* col_name ::= column_name */ { yylhsminor.yy46 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy95); } yymsp[0].minor.yy46 = yylhsminor.yy46; break; - case 151: /* cmd ::= SHOW DNODES */ + case 152: /* cmd ::= SHOW DNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT, NULL, NULL); } break; - case 152: /* cmd ::= SHOW USERS */ + case 153: /* cmd ::= SHOW USERS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USERS_STMT, NULL, NULL); } break; - case 153: /* cmd ::= SHOW DATABASES */ + case 154: /* cmd ::= SHOW DATABASES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT, NULL, NULL); } break; - case 154: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ + case 155: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy46, yymsp[0].minor.yy46); } break; - case 155: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ + case 156: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy46, yymsp[0].minor.yy46); } break; - case 156: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ + case 157: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy46, NULL); } break; - case 157: /* cmd ::= SHOW MNODES */ + case 158: /* cmd ::= SHOW MNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT, NULL, NULL); } break; - case 158: /* cmd ::= SHOW MODULES */ + case 159: /* cmd ::= SHOW MODULES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MODULES_STMT, NULL, NULL); } break; - case 159: /* cmd ::= SHOW QNODES */ + case 160: /* cmd ::= SHOW QNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QNODES_STMT, NULL, NULL); } break; - case 160: /* cmd ::= SHOW FUNCTIONS */ + case 161: /* cmd ::= SHOW FUNCTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT, NULL, NULL); } break; - case 161: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ + case 162: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[-1].minor.yy46, yymsp[0].minor.yy46); } break; - case 162: /* cmd ::= SHOW STREAMS */ + case 163: /* cmd ::= SHOW STREAMS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT, NULL, NULL); } break; - case 163: /* db_name_cond_opt ::= */ - case 168: /* from_db_opt ::= */ yytestcase(yyruleno==168); + case 164: /* db_name_cond_opt ::= */ + case 169: /* from_db_opt ::= */ yytestcase(yyruleno==169); { yymsp[1].minor.yy46 = createDefaultDatabaseCondValue(pCxt); } break; - case 164: /* db_name_cond_opt ::= db_name NK_DOT */ + case 165: /* db_name_cond_opt ::= db_name NK_DOT */ { yylhsminor.yy46 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy95); } yymsp[-1].minor.yy46 = yylhsminor.yy46; break; - case 165: /* like_pattern_opt ::= */ - case 176: /* index_options ::= */ yytestcase(yyruleno==176); - case 307: /* where_clause_opt ::= */ yytestcase(yyruleno==307); - case 311: /* twindow_clause_opt ::= */ yytestcase(yyruleno==311); - case 316: /* sliding_opt ::= */ yytestcase(yyruleno==316); - case 318: /* fill_opt ::= */ yytestcase(yyruleno==318); - case 330: /* having_clause_opt ::= */ yytestcase(yyruleno==330); - case 338: /* slimit_clause_opt ::= */ yytestcase(yyruleno==338); - case 342: /* limit_clause_opt ::= */ yytestcase(yyruleno==342); + case 166: /* like_pattern_opt ::= */ + case 177: /* index_options ::= */ yytestcase(yyruleno==177); + case 308: /* where_clause_opt ::= */ yytestcase(yyruleno==308); + case 312: /* twindow_clause_opt ::= */ yytestcase(yyruleno==312); + case 317: /* sliding_opt ::= */ yytestcase(yyruleno==317); + case 319: /* fill_opt ::= */ yytestcase(yyruleno==319); + case 331: /* having_clause_opt ::= */ yytestcase(yyruleno==331); + case 339: /* slimit_clause_opt ::= */ yytestcase(yyruleno==339); + case 343: /* limit_clause_opt ::= */ yytestcase(yyruleno==343); { yymsp[1].minor.yy46 = NULL; } break; - case 166: /* like_pattern_opt ::= LIKE NK_STRING */ + case 167: /* like_pattern_opt ::= LIKE NK_STRING */ { yymsp[-1].minor.yy46 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } break; - case 167: /* table_name_cond ::= table_name */ + case 168: /* table_name_cond ::= table_name */ { yylhsminor.yy46 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy95); } yymsp[0].minor.yy46 = yylhsminor.yy46; break; - case 169: /* from_db_opt ::= FROM db_name */ + case 170: /* from_db_opt ::= FROM db_name */ { yymsp[-1].minor.yy46 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy95); } break; - case 172: /* func_name ::= function_name */ + case 173: /* func_name ::= function_name */ { yylhsminor.yy46 = createFunctionNode(pCxt, &yymsp[0].minor.yy95, NULL); } yymsp[0].minor.yy46 = yylhsminor.yy46; break; - case 173: /* cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ + case 174: /* cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ { pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy151, &yymsp[-3].minor.yy95, &yymsp[-1].minor.yy95, NULL, yymsp[0].minor.yy46); } break; - case 174: /* cmd ::= CREATE FULLTEXT INDEX not_exists_opt index_name ON table_name NK_LP col_name_list NK_RP */ + case 175: /* 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.yy151, &yymsp[-5].minor.yy95, &yymsp[-3].minor.yy95, yymsp[-1].minor.yy194, NULL); } break; - case 175: /* cmd ::= DROP INDEX exists_opt index_name ON table_name */ + case 176: /* cmd ::= DROP INDEX exists_opt index_name ON table_name */ { pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-3].minor.yy151, &yymsp[-2].minor.yy95, &yymsp[0].minor.yy95); } break; - case 177: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt */ + case 178: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt */ { yymsp[-8].minor.yy46 = createIndexOption(pCxt, yymsp[-6].minor.yy194, releaseRawExprNode(pCxt, yymsp[-2].minor.yy46), NULL, yymsp[0].minor.yy46); } break; - case 178: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt */ + case 179: /* 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.yy46 = createIndexOption(pCxt, yymsp[-8].minor.yy194, releaseRawExprNode(pCxt, yymsp[-4].minor.yy46), releaseRawExprNode(pCxt, yymsp[-2].minor.yy46), yymsp[0].minor.yy46); } break; - case 181: /* func ::= function_name NK_LP expression_list NK_RP */ + case 182: /* func ::= function_name NK_LP expression_list NK_RP */ { yylhsminor.yy46 = createFunctionNode(pCxt, &yymsp[-3].minor.yy95, yymsp[-1].minor.yy194); } yymsp[-3].minor.yy46 = yylhsminor.yy46; break; - case 182: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ + case 183: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ { pCxt->pRootNode = createCreateTopicStmt(pCxt, yymsp[-3].minor.yy151, &yymsp[-2].minor.yy95, yymsp[0].minor.yy46, NULL); } break; - case 183: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS db_name */ + case 184: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS db_name */ { pCxt->pRootNode = createCreateTopicStmt(pCxt, yymsp[-3].minor.yy151, &yymsp[-2].minor.yy95, NULL, &yymsp[0].minor.yy95); } break; - case 184: /* cmd ::= DROP TOPIC exists_opt topic_name */ + case 185: /* cmd ::= DROP TOPIC exists_opt topic_name */ { pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy151, &yymsp[0].minor.yy95); } break; - case 185: /* cmd ::= DESC full_table_name */ - case 186: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==186); + case 186: /* cmd ::= DESC full_table_name */ + case 187: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==187); { pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy46); } break; - case 187: /* cmd ::= RESET QUERY CACHE */ + case 188: /* cmd ::= RESET QUERY CACHE */ { pCxt->pRootNode = createResetQueryCacheStmt(pCxt); } break; - case 188: /* cmd ::= EXPLAIN analyze_opt explain_options query_expression */ + case 189: /* cmd ::= EXPLAIN analyze_opt explain_options query_expression */ { pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy151, yymsp[-1].minor.yy46, yymsp[0].minor.yy46); } break; - case 190: /* analyze_opt ::= ANALYZE */ - case 297: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==297); + case 191: /* analyze_opt ::= ANALYZE */ + case 298: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==298); { yymsp[0].minor.yy151 = true; } break; - case 191: /* explain_options ::= */ + case 192: /* explain_options ::= */ { yymsp[1].minor.yy46 = createDefaultExplainOptions(pCxt); } break; - case 192: /* explain_options ::= explain_options VERBOSE NK_BOOL */ + case 193: /* explain_options ::= explain_options VERBOSE NK_BOOL */ { yylhsminor.yy46 = setExplainVerbose(pCxt, yymsp[-2].minor.yy46, &yymsp[0].minor.yy0); } yymsp[-2].minor.yy46 = yylhsminor.yy46; break; - case 193: /* explain_options ::= explain_options RATIO NK_FLOAT */ + case 194: /* explain_options ::= explain_options RATIO NK_FLOAT */ { yylhsminor.yy46 = setExplainRatio(pCxt, yymsp[-2].minor.yy46, &yymsp[0].minor.yy0); } yymsp[-2].minor.yy46 = yylhsminor.yy46; break; - case 195: /* literal ::= NK_INTEGER */ + case 196: /* literal ::= NK_INTEGER */ { yylhsminor.yy46 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } yymsp[0].minor.yy46 = yylhsminor.yy46; break; - case 196: /* literal ::= NK_FLOAT */ + case 197: /* literal ::= NK_FLOAT */ { yylhsminor.yy46 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } yymsp[0].minor.yy46 = yylhsminor.yy46; break; - case 197: /* literal ::= NK_STRING */ + case 198: /* literal ::= NK_STRING */ { yylhsminor.yy46 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } yymsp[0].minor.yy46 = yylhsminor.yy46; break; - case 198: /* literal ::= NK_BOOL */ + case 199: /* literal ::= NK_BOOL */ { yylhsminor.yy46 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } yymsp[0].minor.yy46 = yylhsminor.yy46; break; - case 199: /* literal ::= TIMESTAMP NK_STRING */ + case 200: /* literal ::= TIMESTAMP NK_STRING */ { yylhsminor.yy46 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } yymsp[-1].minor.yy46 = yylhsminor.yy46; break; - case 200: /* literal ::= duration_literal */ - case 209: /* signed_literal ::= signed */ yytestcase(yyruleno==209); - case 226: /* expression ::= literal */ yytestcase(yyruleno==226); - case 227: /* expression ::= pseudo_column */ yytestcase(yyruleno==227); - case 228: /* expression ::= column_reference */ yytestcase(yyruleno==228); - case 231: /* expression ::= subquery */ yytestcase(yyruleno==231); - case 270: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==270); - case 274: /* boolean_primary ::= predicate */ yytestcase(yyruleno==274); - case 276: /* common_expression ::= expression */ yytestcase(yyruleno==276); - case 277: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==277); - case 279: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==279); - case 281: /* table_reference ::= table_primary */ yytestcase(yyruleno==281); - case 282: /* table_reference ::= joined_table */ yytestcase(yyruleno==282); - case 286: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==286); - case 333: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==333); - case 335: /* query_primary ::= query_specification */ yytestcase(yyruleno==335); + case 201: /* literal ::= duration_literal */ + case 210: /* signed_literal ::= signed */ yytestcase(yyruleno==210); + case 227: /* expression ::= literal */ yytestcase(yyruleno==227); + case 228: /* expression ::= pseudo_column */ yytestcase(yyruleno==228); + case 229: /* expression ::= column_reference */ yytestcase(yyruleno==229); + case 232: /* expression ::= subquery */ yytestcase(yyruleno==232); + case 271: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==271); + case 275: /* boolean_primary ::= predicate */ yytestcase(yyruleno==275); + case 277: /* common_expression ::= expression */ yytestcase(yyruleno==277); + case 278: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==278); + case 280: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==280); + case 282: /* table_reference ::= table_primary */ yytestcase(yyruleno==282); + case 283: /* table_reference ::= joined_table */ yytestcase(yyruleno==283); + case 287: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==287); + case 334: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==334); + case 336: /* query_primary ::= query_specification */ yytestcase(yyruleno==336); { yylhsminor.yy46 = yymsp[0].minor.yy46; } yymsp[0].minor.yy46 = yylhsminor.yy46; break; - case 201: /* literal ::= NULL */ + case 202: /* literal ::= NULL */ { yylhsminor.yy46 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, NULL)); } yymsp[0].minor.yy46 = yylhsminor.yy46; break; - case 202: /* duration_literal ::= NK_VARIABLE */ + case 203: /* duration_literal ::= NK_VARIABLE */ { yylhsminor.yy46 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } yymsp[0].minor.yy46 = yylhsminor.yy46; break; - case 203: /* signed ::= NK_INTEGER */ + case 204: /* signed ::= NK_INTEGER */ { yylhsminor.yy46 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } yymsp[0].minor.yy46 = yylhsminor.yy46; break; - case 204: /* signed ::= NK_PLUS NK_INTEGER */ + case 205: /* signed ::= NK_PLUS NK_INTEGER */ { yymsp[-1].minor.yy46 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } break; - case 205: /* signed ::= NK_MINUS NK_INTEGER */ + case 206: /* 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; @@ -3048,14 +3048,14 @@ static YYACTIONTYPE yy_reduce( } yymsp[-1].minor.yy46 = yylhsminor.yy46; break; - case 206: /* signed ::= NK_FLOAT */ + case 207: /* signed ::= NK_FLOAT */ { yylhsminor.yy46 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } yymsp[0].minor.yy46 = yylhsminor.yy46; break; - case 207: /* signed ::= NK_PLUS NK_FLOAT */ + case 208: /* signed ::= NK_PLUS NK_FLOAT */ { yymsp[-1].minor.yy46 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } break; - case 208: /* signed ::= NK_MINUS NK_FLOAT */ + case 209: /* 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; @@ -3063,53 +3063,53 @@ static YYACTIONTYPE yy_reduce( } yymsp[-1].minor.yy46 = yylhsminor.yy46; break; - case 210: /* signed_literal ::= NK_STRING */ + case 211: /* signed_literal ::= NK_STRING */ { yylhsminor.yy46 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } yymsp[0].minor.yy46 = yylhsminor.yy46; break; - case 211: /* signed_literal ::= NK_BOOL */ + case 212: /* signed_literal ::= NK_BOOL */ { yylhsminor.yy46 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } yymsp[0].minor.yy46 = yylhsminor.yy46; break; - case 212: /* signed_literal ::= TIMESTAMP NK_STRING */ + case 213: /* signed_literal ::= TIMESTAMP NK_STRING */ { yymsp[-1].minor.yy46 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } break; - case 213: /* signed_literal ::= duration_literal */ - case 347: /* search_condition ::= common_expression */ yytestcase(yyruleno==347); + case 214: /* signed_literal ::= duration_literal */ + case 348: /* search_condition ::= common_expression */ yytestcase(yyruleno==348); { yylhsminor.yy46 = releaseRawExprNode(pCxt, yymsp[0].minor.yy46); } yymsp[0].minor.yy46 = yylhsminor.yy46; break; - case 214: /* signed_literal ::= NULL */ + case 215: /* signed_literal ::= NULL */ { yymsp[0].minor.yy46 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, NULL); } break; - case 229: /* expression ::= function_name NK_LP expression_list NK_RP */ + case 230: /* expression ::= function_name NK_LP expression_list NK_RP */ { yylhsminor.yy46 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy95, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy95, yymsp[-1].minor.yy194)); } yymsp[-3].minor.yy46 = yylhsminor.yy46; break; - case 230: /* expression ::= function_name NK_LP NK_STAR NK_RP */ + case 231: /* expression ::= function_name NK_LP NK_STAR NK_RP */ { yylhsminor.yy46 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy95, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy95, createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy0)))); } yymsp[-3].minor.yy46 = yylhsminor.yy46; break; - case 232: /* expression ::= NK_LP expression NK_RP */ - case 275: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==275); + case 233: /* expression ::= NK_LP expression NK_RP */ + case 276: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==276); { yylhsminor.yy46 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy46)); } yymsp[-2].minor.yy46 = yylhsminor.yy46; break; - case 233: /* expression ::= NK_PLUS expression */ + case 234: /* expression ::= NK_PLUS expression */ { SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy46); yylhsminor.yy46 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy46)); } yymsp[-1].minor.yy46 = yylhsminor.yy46; break; - case 234: /* expression ::= NK_MINUS expression */ + case 235: /* expression ::= NK_MINUS expression */ { SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy46); yylhsminor.yy46 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[0].minor.yy46), NULL)); } yymsp[-1].minor.yy46 = yylhsminor.yy46; break; - case 235: /* expression ::= expression NK_PLUS expression */ + case 236: /* expression ::= expression NK_PLUS expression */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy46); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy46); @@ -3117,7 +3117,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy46 = yylhsminor.yy46; break; - case 236: /* expression ::= expression NK_MINUS expression */ + case 237: /* expression ::= expression NK_MINUS expression */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy46); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy46); @@ -3125,7 +3125,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy46 = yylhsminor.yy46; break; - case 237: /* expression ::= expression NK_STAR expression */ + case 238: /* expression ::= expression NK_STAR expression */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy46); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy46); @@ -3133,7 +3133,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy46 = yylhsminor.yy46; break; - case 238: /* expression ::= expression NK_SLASH expression */ + case 239: /* expression ::= expression NK_SLASH expression */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy46); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy46); @@ -3141,7 +3141,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy46 = yylhsminor.yy46; break; - case 239: /* expression ::= expression NK_REM expression */ + case 240: /* expression ::= expression NK_REM expression */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy46); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy46); @@ -3149,28 +3149,28 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy46 = yylhsminor.yy46; break; - case 240: /* expression_list ::= expression */ + case 241: /* expression_list ::= expression */ { yylhsminor.yy194 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy46)); } yymsp[0].minor.yy194 = yylhsminor.yy194; break; - case 241: /* expression_list ::= expression_list NK_COMMA expression */ + case 242: /* expression_list ::= expression_list NK_COMMA expression */ { yylhsminor.yy194 = addNodeToList(pCxt, yymsp[-2].minor.yy194, releaseRawExprNode(pCxt, yymsp[0].minor.yy46)); } yymsp[-2].minor.yy194 = yylhsminor.yy194; break; - case 242: /* column_reference ::= column_name */ + case 243: /* column_reference ::= column_name */ { yylhsminor.yy46 = createRawExprNode(pCxt, &yymsp[0].minor.yy95, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy95)); } yymsp[0].minor.yy46 = yylhsminor.yy46; break; - case 243: /* column_reference ::= table_name NK_DOT column_name */ + case 244: /* column_reference ::= table_name NK_DOT column_name */ { yylhsminor.yy46 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy95, &yymsp[0].minor.yy95, createColumnNode(pCxt, &yymsp[-2].minor.yy95, &yymsp[0].minor.yy95)); } yymsp[-2].minor.yy46 = yylhsminor.yy46; break; - case 244: /* pseudo_column ::= NK_UNDERLINE ROWTS */ - case 246: /* pseudo_column ::= NK_UNDERLINE QSTARTTS */ yytestcase(yyruleno==246); - case 247: /* pseudo_column ::= NK_UNDERLINE QENDTS */ yytestcase(yyruleno==247); - case 248: /* pseudo_column ::= NK_UNDERLINE WSTARTTS */ yytestcase(yyruleno==248); - case 249: /* pseudo_column ::= NK_UNDERLINE WENDTS */ yytestcase(yyruleno==249); - case 250: /* pseudo_column ::= NK_UNDERLINE WDURATION */ yytestcase(yyruleno==250); + case 245: /* pseudo_column ::= NK_UNDERLINE ROWTS */ + case 247: /* pseudo_column ::= NK_UNDERLINE QSTARTTS */ yytestcase(yyruleno==247); + case 248: /* pseudo_column ::= NK_UNDERLINE QENDTS */ yytestcase(yyruleno==248); + case 249: /* pseudo_column ::= NK_UNDERLINE WSTARTTS */ yytestcase(yyruleno==249); + case 250: /* pseudo_column ::= NK_UNDERLINE WENDTS */ yytestcase(yyruleno==250); + case 251: /* pseudo_column ::= NK_UNDERLINE WDURATION */ yytestcase(yyruleno==251); { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; @@ -3178,12 +3178,12 @@ static YYACTIONTYPE yy_reduce( } yymsp[-1].minor.yy46 = yylhsminor.yy46; break; - case 245: /* pseudo_column ::= TBNAME */ + case 246: /* pseudo_column ::= TBNAME */ { yylhsminor.yy46 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } yymsp[0].minor.yy46 = yylhsminor.yy46; break; - case 251: /* predicate ::= expression compare_op expression */ - case 256: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==256); + case 252: /* predicate ::= expression compare_op expression */ + case 257: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==257); { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy46); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy46); @@ -3191,7 +3191,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy46 = yylhsminor.yy46; break; - case 252: /* predicate ::= expression BETWEEN expression AND expression */ + case 253: /* predicate ::= expression BETWEEN expression AND expression */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy46); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy46); @@ -3199,7 +3199,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-4].minor.yy46 = yylhsminor.yy46; break; - case 253: /* predicate ::= expression NOT BETWEEN expression AND expression */ + case 254: /* predicate ::= expression NOT BETWEEN expression AND expression */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy46); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy46); @@ -3207,68 +3207,68 @@ static YYACTIONTYPE yy_reduce( } yymsp[-5].minor.yy46 = yylhsminor.yy46; break; - case 254: /* predicate ::= expression IS NULL */ + case 255: /* predicate ::= expression IS NULL */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy46); yylhsminor.yy46 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy46), NULL)); } yymsp[-2].minor.yy46 = yylhsminor.yy46; break; - case 255: /* predicate ::= expression IS NOT NULL */ + case 256: /* predicate ::= expression IS NOT NULL */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy46); yylhsminor.yy46 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy46), NULL)); } yymsp[-3].minor.yy46 = yylhsminor.yy46; break; - case 257: /* compare_op ::= NK_LT */ + case 258: /* compare_op ::= NK_LT */ { yymsp[0].minor.yy292 = OP_TYPE_LOWER_THAN; } break; - case 258: /* compare_op ::= NK_GT */ + case 259: /* compare_op ::= NK_GT */ { yymsp[0].minor.yy292 = OP_TYPE_GREATER_THAN; } break; - case 259: /* compare_op ::= NK_LE */ + case 260: /* compare_op ::= NK_LE */ { yymsp[0].minor.yy292 = OP_TYPE_LOWER_EQUAL; } break; - case 260: /* compare_op ::= NK_GE */ + case 261: /* compare_op ::= NK_GE */ { yymsp[0].minor.yy292 = OP_TYPE_GREATER_EQUAL; } break; - case 261: /* compare_op ::= NK_NE */ + case 262: /* compare_op ::= NK_NE */ { yymsp[0].minor.yy292 = OP_TYPE_NOT_EQUAL; } break; - case 262: /* compare_op ::= NK_EQ */ + case 263: /* compare_op ::= NK_EQ */ { yymsp[0].minor.yy292 = OP_TYPE_EQUAL; } break; - case 263: /* compare_op ::= LIKE */ + case 264: /* compare_op ::= LIKE */ { yymsp[0].minor.yy292 = OP_TYPE_LIKE; } break; - case 264: /* compare_op ::= NOT LIKE */ + case 265: /* compare_op ::= NOT LIKE */ { yymsp[-1].minor.yy292 = OP_TYPE_NOT_LIKE; } break; - case 265: /* compare_op ::= MATCH */ + case 266: /* compare_op ::= MATCH */ { yymsp[0].minor.yy292 = OP_TYPE_MATCH; } break; - case 266: /* compare_op ::= NMATCH */ + case 267: /* compare_op ::= NMATCH */ { yymsp[0].minor.yy292 = OP_TYPE_NMATCH; } break; - case 267: /* in_op ::= IN */ + case 268: /* in_op ::= IN */ { yymsp[0].minor.yy292 = OP_TYPE_IN; } break; - case 268: /* in_op ::= NOT IN */ + case 269: /* in_op ::= NOT IN */ { yymsp[-1].minor.yy292 = OP_TYPE_NOT_IN; } break; - case 269: /* in_predicate_value ::= NK_LP expression_list NK_RP */ + case 270: /* in_predicate_value ::= NK_LP expression_list NK_RP */ { yylhsminor.yy46 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy194)); } yymsp[-2].minor.yy46 = yylhsminor.yy46; break; - case 271: /* boolean_value_expression ::= NOT boolean_primary */ + case 272: /* boolean_value_expression ::= NOT boolean_primary */ { SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy46); yylhsminor.yy46 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy46), NULL)); } yymsp[-1].minor.yy46 = yylhsminor.yy46; break; - case 272: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + case 273: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy46); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy46); @@ -3276,7 +3276,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy46 = yylhsminor.yy46; break; - case 273: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + case 274: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy46); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy46); @@ -3284,52 +3284,52 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy46 = yylhsminor.yy46; break; - case 278: /* from_clause ::= FROM table_reference_list */ - case 308: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==308); - case 331: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==331); + case 279: /* from_clause ::= FROM table_reference_list */ + case 309: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==309); + case 332: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==332); { yymsp[-1].minor.yy46 = yymsp[0].minor.yy46; } break; - case 280: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ + case 281: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ { yylhsminor.yy46 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy46, yymsp[0].minor.yy46, NULL); } yymsp[-2].minor.yy46 = yylhsminor.yy46; break; - case 283: /* table_primary ::= table_name alias_opt */ + case 284: /* table_primary ::= table_name alias_opt */ { yylhsminor.yy46 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy95, &yymsp[0].minor.yy95); } yymsp[-1].minor.yy46 = yylhsminor.yy46; break; - case 284: /* table_primary ::= db_name NK_DOT table_name alias_opt */ + case 285: /* table_primary ::= db_name NK_DOT table_name alias_opt */ { yylhsminor.yy46 = createRealTableNode(pCxt, &yymsp[-3].minor.yy95, &yymsp[-1].minor.yy95, &yymsp[0].minor.yy95); } yymsp[-3].minor.yy46 = yylhsminor.yy46; break; - case 285: /* table_primary ::= subquery alias_opt */ + case 286: /* table_primary ::= subquery alias_opt */ { yylhsminor.yy46 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy46), &yymsp[0].minor.yy95); } yymsp[-1].minor.yy46 = yylhsminor.yy46; break; - case 287: /* alias_opt ::= */ + case 288: /* alias_opt ::= */ { yymsp[1].minor.yy95 = nil_token; } break; - case 288: /* alias_opt ::= table_alias */ + case 289: /* alias_opt ::= table_alias */ { yylhsminor.yy95 = yymsp[0].minor.yy95; } yymsp[0].minor.yy95 = yylhsminor.yy95; break; - case 289: /* alias_opt ::= AS table_alias */ + case 290: /* alias_opt ::= AS table_alias */ { yymsp[-1].minor.yy95 = yymsp[0].minor.yy95; } break; - case 290: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - case 291: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==291); + case 291: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + case 292: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==292); { yymsp[-2].minor.yy46 = yymsp[-1].minor.yy46; } break; - case 292: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ + case 293: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ { yylhsminor.yy46 = createJoinTableNode(pCxt, yymsp[-4].minor.yy10, yymsp[-5].minor.yy46, yymsp[-2].minor.yy46, yymsp[0].minor.yy46); } yymsp[-5].minor.yy46 = yylhsminor.yy46; break; - case 293: /* join_type ::= */ + case 294: /* join_type ::= */ { yymsp[1].minor.yy10 = JOIN_TYPE_INNER; } break; - case 294: /* join_type ::= INNER */ + case 295: /* join_type ::= INNER */ { yymsp[0].minor.yy10 = JOIN_TYPE_INNER; } break; - case 295: /* query_specification ::= SELECT set_quantifier_opt select_list from_clause where_clause_opt partition_by_clause_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ + case 296: /* 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.yy46 = createSelectStmt(pCxt, yymsp[-7].minor.yy151, yymsp[-6].minor.yy194, yymsp[-5].minor.yy46); yymsp[-8].minor.yy46 = addWhereClause(pCxt, yymsp[-8].minor.yy46, yymsp[-4].minor.yy46); @@ -3339,81 +3339,81 @@ static YYACTIONTYPE yy_reduce( yymsp[-8].minor.yy46 = addHavingClause(pCxt, yymsp[-8].minor.yy46, yymsp[0].minor.yy46); } break; - case 298: /* set_quantifier_opt ::= ALL */ + case 299: /* set_quantifier_opt ::= ALL */ { yymsp[0].minor.yy151 = false; } break; - case 299: /* select_list ::= NK_STAR */ + case 300: /* select_list ::= NK_STAR */ { yymsp[0].minor.yy194 = NULL; } break; - case 303: /* select_item ::= common_expression */ + case 304: /* select_item ::= common_expression */ { SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy46); yylhsminor.yy46 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy46), &t); } yymsp[0].minor.yy46 = yylhsminor.yy46; break; - case 304: /* select_item ::= common_expression column_alias */ + case 305: /* select_item ::= common_expression column_alias */ { yylhsminor.yy46 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy46), &yymsp[0].minor.yy95); } yymsp[-1].minor.yy46 = yylhsminor.yy46; break; - case 305: /* select_item ::= common_expression AS column_alias */ + case 306: /* select_item ::= common_expression AS column_alias */ { yylhsminor.yy46 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy46), &yymsp[0].minor.yy95); } yymsp[-2].minor.yy46 = yylhsminor.yy46; break; - case 306: /* select_item ::= table_name NK_DOT NK_STAR */ + case 307: /* select_item ::= table_name NK_DOT NK_STAR */ { yylhsminor.yy46 = createColumnNode(pCxt, &yymsp[-2].minor.yy95, &yymsp[0].minor.yy0); } yymsp[-2].minor.yy46 = yylhsminor.yy46; break; - case 310: /* partition_by_clause_opt ::= PARTITION BY expression_list */ - case 327: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==327); - case 337: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==337); + case 311: /* partition_by_clause_opt ::= PARTITION BY expression_list */ + case 328: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==328); + case 338: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==338); { yymsp[-2].minor.yy194 = yymsp[0].minor.yy194; } break; - case 312: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ + case 313: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ { yymsp[-5].minor.yy46 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy46), releaseRawExprNode(pCxt, yymsp[-1].minor.yy46)); } break; - case 313: /* twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP */ + case 314: /* twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP */ { yymsp[-3].minor.yy46 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy46)); } break; - case 314: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ + case 315: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ { yymsp[-5].minor.yy46 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy46), NULL, yymsp[-1].minor.yy46, yymsp[0].minor.yy46); } break; - case 315: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ + case 316: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ { yymsp[-7].minor.yy46 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy46), releaseRawExprNode(pCxt, yymsp[-3].minor.yy46), yymsp[-1].minor.yy46, yymsp[0].minor.yy46); } break; - case 317: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ + case 318: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ { yymsp[-3].minor.yy46 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy46); } break; - case 319: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ + case 320: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ { yymsp[-3].minor.yy46 = createFillNode(pCxt, yymsp[-1].minor.yy6, NULL); } break; - case 320: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ + case 321: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ { yymsp[-5].minor.yy46 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy194)); } break; - case 321: /* fill_mode ::= NONE */ + case 322: /* fill_mode ::= NONE */ { yymsp[0].minor.yy6 = FILL_MODE_NONE; } break; - case 322: /* fill_mode ::= PREV */ + case 323: /* fill_mode ::= PREV */ { yymsp[0].minor.yy6 = FILL_MODE_PREV; } break; - case 323: /* fill_mode ::= NULL */ + case 324: /* fill_mode ::= NULL */ { yymsp[0].minor.yy6 = FILL_MODE_NULL; } break; - case 324: /* fill_mode ::= LINEAR */ + case 325: /* fill_mode ::= LINEAR */ { yymsp[0].minor.yy6 = FILL_MODE_LINEAR; } break; - case 325: /* fill_mode ::= NEXT */ + case 326: /* fill_mode ::= NEXT */ { yymsp[0].minor.yy6 = FILL_MODE_NEXT; } break; - case 328: /* group_by_list ::= expression */ + case 329: /* group_by_list ::= expression */ { yylhsminor.yy194 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy46))); } yymsp[0].minor.yy194 = yylhsminor.yy194; break; - case 329: /* group_by_list ::= group_by_list NK_COMMA expression */ + case 330: /* group_by_list ::= group_by_list NK_COMMA expression */ { yylhsminor.yy194 = addNodeToList(pCxt, yymsp[-2].minor.yy194, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy46))); } yymsp[-2].minor.yy194 = yylhsminor.yy194; break; - case 332: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ + case 333: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ { yylhsminor.yy46 = addOrderByClause(pCxt, yymsp[-3].minor.yy46, yymsp[-2].minor.yy194); yylhsminor.yy46 = addSlimitClause(pCxt, yylhsminor.yy46, yymsp[-1].minor.yy46); @@ -3421,46 +3421,46 @@ static YYACTIONTYPE yy_reduce( } yymsp[-3].minor.yy46 = yylhsminor.yy46; break; - case 334: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */ + case 335: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */ { yylhsminor.yy46 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy46, yymsp[0].minor.yy46); } yymsp[-3].minor.yy46 = yylhsminor.yy46; break; - case 339: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ - case 343: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==343); + case 340: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ + case 344: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==344); { yymsp[-1].minor.yy46 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } break; - case 340: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - case 344: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==344); + case 341: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + case 345: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==345); { yymsp[-3].minor.yy46 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } break; - case 341: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - case 345: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==345); + case 342: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + case 346: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==346); { yymsp[-3].minor.yy46 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } break; - case 346: /* subquery ::= NK_LP query_expression NK_RP */ + case 347: /* subquery ::= NK_LP query_expression NK_RP */ { yylhsminor.yy46 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy46); } yymsp[-2].minor.yy46 = yylhsminor.yy46; break; - case 350: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */ + case 351: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */ { yylhsminor.yy46 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy46), yymsp[-1].minor.yy456, yymsp[0].minor.yy273); } yymsp[-2].minor.yy46 = yylhsminor.yy46; break; - case 351: /* ordering_specification_opt ::= */ + case 352: /* ordering_specification_opt ::= */ { yymsp[1].minor.yy456 = ORDER_ASC; } break; - case 352: /* ordering_specification_opt ::= ASC */ + case 353: /* ordering_specification_opt ::= ASC */ { yymsp[0].minor.yy456 = ORDER_ASC; } break; - case 353: /* ordering_specification_opt ::= DESC */ + case 354: /* ordering_specification_opt ::= DESC */ { yymsp[0].minor.yy456 = ORDER_DESC; } break; - case 354: /* null_ordering_opt ::= */ + case 355: /* null_ordering_opt ::= */ { yymsp[1].minor.yy273 = NULL_ORDER_DEFAULT; } break; - case 355: /* null_ordering_opt ::= NULLS FIRST */ + case 356: /* null_ordering_opt ::= NULLS FIRST */ { yymsp[-1].minor.yy273 = NULL_ORDER_FIRST; } break; - case 356: /* null_ordering_opt ::= NULLS LAST */ + case 357: /* null_ordering_opt ::= NULLS LAST */ { yymsp[-1].minor.yy273 = NULL_ORDER_LAST; } break; default: From 651fb094076777aa87e127bdd48916246ba79065 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Thu, 31 Mar 2022 17:27:04 +0800 Subject: [PATCH 27/47] handle sigchild --- source/dnode/mgmt/main/exe/dndMain.c | 9 +-------- source/dnode/mgmt/main/src/dndExec.c | 10 +++++----- source/os/src/osProc.c | 3 +++ 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/source/dnode/mgmt/main/exe/dndMain.c b/source/dnode/mgmt/main/exe/dndMain.c index 61b480990d..0d2ddbfbbc 100644 --- a/source/dnode/mgmt/main/exe/dndMain.c +++ b/source/dnode/mgmt/main/exe/dndMain.c @@ -37,13 +37,6 @@ static void dndStopDnode(int signum, void *info, void *ctx) { } } -static void dndHandleChild(int signum, void *info, void *ctx) { - dInfo("sigchild received"); - if (global.pDnode != NULL) { - dndHandleEvent(global.pDnode, DND_EVENT_CHILD); - } -} - static void dndSetSignalHandle() { taosSetSignal(SIGTERM, dndStopDnode); taosSetSignal(SIGHUP, dndStopDnode); @@ -53,7 +46,7 @@ static void dndSetSignalHandle() { if (!tsMultiProcess) { } else if (global.ntype == DNODE || global.ntype == NODE_MAX) { - taosSetSignal(SIGCHLD, dndHandleChild); + taosIgnSignal(SIGCHLD); } else { taosKillChildOnParentStopped(); } diff --git a/source/dnode/mgmt/main/src/dndExec.c b/source/dnode/mgmt/main/src/dndExec.c index c5d5707a99..76614b2916 100644 --- a/source/dnode/mgmt/main/src/dndExec.c +++ b/source/dnode/mgmt/main/src/dndExec.c @@ -128,7 +128,7 @@ static int32_t dndNewProc(SMgmtWrapper *pWrapper, ENodeType n) { } pWrapper->procId = pid; - dInfo("node:%s, run in new process, pid:%d", pWrapper->name, pid); + dInfo("node:%s, continue running in new process:%d", pWrapper->name, pid); return 0; } @@ -263,13 +263,13 @@ static int32_t dndRunInParentProcess(SDnode *pDnode) { if (!pWrapper->required) continue; if (pDnode->ntype == NODE_MAX) continue; - if (pWrapper->procId != 0 && !taosProcExists(pWrapper->procId)) { - dInfo("node:%s, process not exist, pid:%d", pWrapper->name, pWrapper->procId); + if (pWrapper->procId <= 0 || !taosProcExists(pWrapper->procId)) { + dInfo("node:%s, process:%d does not exist or is killed and needs to be restarted", pWrapper->name, pWrapper->procId); dndNewProc(pWrapper, n); } - - taosMsleep(100); } + + taosMsleep(100); } return 0; diff --git a/source/os/src/osProc.c b/source/os/src/osProc.c index 00ed650cbb..2d2174a4c8 100644 --- a/source/os/src/osProc.c +++ b/source/os/src/osProc.c @@ -23,6 +23,9 @@ int32_t taosNewProc(char **args) { int32_t pid = fork(); if (pid == 0) { args[0] = tsProcPath; + close(STDIN_FILENO); + close(STDOUT_FILENO); + close(STDERR_FILENO); return execvp(tsProcPath, args); } else { return pid; From 5bdf541c43fcde6d432c0cd46c6f940f2dc76a11 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Thu, 31 Mar 2022 05:33:24 -0400 Subject: [PATCH 28/47] TD-14401 bugfix --- include/util/tdef.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/util/tdef.h b/include/util/tdef.h index 3a9e32c8c3..fb1075d74f 100644 --- a/include/util/tdef.h +++ b/include/util/tdef.h @@ -303,9 +303,9 @@ typedef enum ELogicConditionType { #define TSDB_MAX_TOTAL_BLOCKS 10000 #define TSDB_DEFAULT_TOTAL_BLOCKS 6 -#define TSDB_MIN_DAYS_PER_FILE 1 -#define TSDB_MAX_DAYS_PER_FILE 3650 -#define TSDB_DEFAULT_DAYS_PER_FILE 10 +#define TSDB_MIN_DAYS_PER_FILE (1 * 1440) // unit minute +#define TSDB_MAX_DAYS_PER_FILE (3650 * 1440) +#define TSDB_DEFAULT_DAYS_PER_FILE (10 * 1440) #define TSDB_MIN_KEEP 1 // data in db to be reserved. #define TSDB_MAX_KEEP 365000 // data in db to be reserved. From b56ea026cb18ece0afdad9fc15ea54ed70076041 Mon Sep 17 00:00:00 2001 From: Liu Jicong Date: Thu, 31 Mar 2022 17:36:21 +0800 Subject: [PATCH 29/47] fix --- source/dnode/vnode/src/tsdb/tsdbReadImpl.c | 40 +++++++++------------- 1 file changed, 17 insertions(+), 23 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbReadImpl.c b/source/dnode/vnode/src/tsdb/tsdbReadImpl.c index 304b3286fe..ac7c0ada90 100644 --- a/source/dnode/vnode/src/tsdb/tsdbReadImpl.c +++ b/source/dnode/vnode/src/tsdb/tsdbReadImpl.c @@ -99,7 +99,7 @@ int tsdbSetAndOpenReadFSet(SReadH *pReadh, SDFileSet *pSet) { void tsdbCloseAndUnsetFSet(SReadH *pReadh) { tsdbResetReadFile(pReadh); } int tsdbLoadBlockIdx(SReadH *pReadh) { - SDFile * pHeadf = TSDB_READ_HEAD_FILE(pReadh); + SDFile *pHeadf = TSDB_READ_HEAD_FILE(pReadh); SBlockIdx blkIdx; ASSERT(taosArrayGetSize(pReadh->aBlkIdx) == 0); @@ -181,20 +181,13 @@ int tsdbSetReadTable(SReadH *pReadh, STable *pTable) { } SBlockIdx *pBlkIdx = taosArrayGet(pReadh->aBlkIdx, pReadh->cidx); - if (pBlkIdx->tid == TABLE_TID(pTable)) { - if (pBlkIdx->uid == TABLE_UID(pTable)) { - pReadh->pBlkIdx = pBlkIdx; - } else { - pReadh->pBlkIdx = NULL; - } - pReadh->cidx++; - break; - } else if (pBlkIdx->tid > TABLE_TID(pTable)) { - pReadh->pBlkIdx = NULL; + if (pBlkIdx->uid == TABLE_UID(pTable)) { + pReadh->pBlkIdx = pBlkIdx; break; } else { - pReadh->cidx++; + pReadh->pBlkIdx = NULL; } + pReadh->cidx++; } } else { pReadh->pBlkIdx = NULL; @@ -206,7 +199,7 @@ int tsdbSetReadTable(SReadH *pReadh, STable *pTable) { int tsdbLoadBlockInfo(SReadH *pReadh, void *pTarget) { ASSERT(pReadh->pBlkIdx != NULL); - SDFile * pHeadf = TSDB_READ_HEAD_FILE(pReadh); + SDFile *pHeadf = TSDB_READ_HEAD_FILE(pReadh); SBlockIdx *pBlkIdx = pReadh->pBlkIdx; if (tsdbSeekDFile(pHeadf, pBlkIdx->offset, SEEK_SET) < 0) { @@ -276,7 +269,8 @@ int tsdbLoadBlockData(SReadH *pReadh, SBlock *pBlock, SBlockInfo *pBlkInfo) { return 0; } -int tsdbLoadBlockDataCols(SReadH *pReadh, SBlock *pBlock, SBlockInfo *pBlkInfo, const int16_t *colIds, int numOfColsIds) { +int tsdbLoadBlockDataCols(SReadH *pReadh, SBlock *pBlock, SBlockInfo *pBlkInfo, const int16_t *colIds, + int numOfColsIds) { ASSERT(pBlock->numOfSubBlocks > 0); int8_t update = pReadh->pRepo->config.update; @@ -539,9 +533,9 @@ static int tsdbLoadBlockDataImpl(SReadH *pReadh, SBlock *pBlock, SDataCols *pDat pDataCols->numOfRows = pBlock->numOfRows; // Recover the data - int ccol = 0; // loop iter for SBlockCol object - int dcol = 0; // loop iter for SDataCols object - int nBitmaps = (int)TD_BITMAP_BYTES(pBlock->numOfRows); + int ccol = 0; // loop iter for SBlockCol object + int dcol = 0; // loop iter for SDataCols object + int nBitmaps = (int)TD_BITMAP_BYTES(pBlock->numOfRows); SBlockCol *pBlockCol = NULL; while (dcol < pDataCols->numOfCols) { SDataCol *pDataCol = &(pDataCols->cols[dcol]); @@ -586,8 +580,8 @@ static int tsdbLoadBlockDataImpl(SReadH *pReadh, SBlock *pBlock, SDataCols *pDat } if (tsdbCheckAndDecodeColumnData(pDataCol, POINTER_SHIFT(pBlockData, tsize + toffset), tlen, pBlock->algorithm, - pBlock->numOfRows, tBitmaps, tLenBitmap, pDataCols->maxPoints, TSDB_READ_COMP_BUF(pReadh), - (int)taosTSizeof(TSDB_READ_COMP_BUF(pReadh))) < 0) { + pBlock->numOfRows, tBitmaps, tLenBitmap, pDataCols->maxPoints, + TSDB_READ_COMP_BUF(pReadh), (int)taosTSizeof(TSDB_READ_COMP_BUF(pReadh))) < 0) { tsdbError("vgId:%d file %s is broken at column %d block offset %" PRId64 " column offset %u", TSDB_READ_REPO_ID(pReadh), TSDB_FILE_FULL_NAME(pDFile), tcolId, (int64_t)pBlock->offset, toffset); return -1; @@ -662,7 +656,7 @@ static int tsdbLoadBlockDataColsImpl(SReadH *pReadh, SBlock *pBlock, SDataCols * ASSERT(pBlock->numOfSubBlocks == 0 || pBlock->numOfSubBlocks == 1); ASSERT(colIds[0] == PRIMARYKEY_TIMESTAMP_COL_ID); - SDFile * pDFile = (pBlock->last) ? TSDB_READ_LAST_FILE(pReadh) : TSDB_READ_DATA_FILE(pReadh); + SDFile *pDFile = (pBlock->last) ? TSDB_READ_LAST_FILE(pReadh) : TSDB_READ_DATA_FILE(pReadh); SBlockCol blockCol = {0}; tdResetDataCols(pDataCols); @@ -676,7 +670,7 @@ static int tsdbLoadBlockDataColsImpl(SReadH *pReadh, SBlock *pBlock, SDataCols * int ccol = 0; for (int i = 0; i < numOfColIds; i++) { int16_t colId = colIds[i]; - SDataCol * pDataCol = NULL; + SDataCol *pDataCol = NULL; SBlockCol *pBlockCol = NULL; while (true) { @@ -740,7 +734,7 @@ static int tsdbLoadBlockDataColsImpl(SReadH *pReadh, SBlock *pBlock, SDataCols * static int tsdbLoadColData(SReadH *pReadh, SDFile *pDFile, SBlock *pBlock, SBlockCol *pBlockCol, SDataCol *pDataCol) { ASSERT(pDataCol->colId == pBlockCol->colId); - STsdb * pRepo = TSDB_READ_REPO(pReadh); + STsdb *pRepo = TSDB_READ_REPO(pReadh); STsdbCfg *pCfg = REPO_CFG(pRepo); int nBitmaps = (int)TD_BITMAP_BYTES(pBlock->numOfRows); @@ -757,7 +751,7 @@ static int tsdbLoadColData(SReadH *pReadh, SDFile *pDFile, SBlock *pBlock, SBloc } } - int tsize = pDataCol->bytes * pBlock->numOfRows + tLenBitmap + COMP_OVERFLOW_BYTES; + int tsize = pDataCol->bytes * pBlock->numOfRows + tLenBitmap + COMP_OVERFLOW_BYTES; if (tsdbMakeRoom((void **)(&TSDB_READ_BUF(pReadh)), pBlockCol->len) < 0) return -1; if (tsdbMakeRoom((void **)(&TSDB_READ_COMP_BUF(pReadh)), tsize) < 0) return -1; From d89ab513758f652c776b886a390a86cce21db343 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Thu, 31 Mar 2022 17:38:47 +0800 Subject: [PATCH 30/47] minor changes --- source/dnode/mgmt/main/src/dndExec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/dnode/mgmt/main/src/dndExec.c b/source/dnode/mgmt/main/src/dndExec.c index 76614b2916..fdc6125fb0 100644 --- a/source/dnode/mgmt/main/src/dndExec.c +++ b/source/dnode/mgmt/main/src/dndExec.c @@ -264,7 +264,7 @@ static int32_t dndRunInParentProcess(SDnode *pDnode) { if (pDnode->ntype == NODE_MAX) continue; if (pWrapper->procId <= 0 || !taosProcExists(pWrapper->procId)) { - dInfo("node:%s, process:%d does not exist or is killed and needs to be restarted", pWrapper->name, pWrapper->procId); + dInfo("node:%s, process:%d is killed and needs to be restarted", pWrapper->name, pWrapper->procId); dndNewProc(pWrapper, n); } } From 0608824186c025e294ee0aa3384ddbc4f66c44c8 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Thu, 31 Mar 2022 18:02:58 +0800 Subject: [PATCH 31/47] feature/qnode --- include/common/ttime.h | 1 + include/libs/command/command.h | 5 + include/libs/nodes/plannodes.h | 2 +- include/libs/qcom/query.h | 10 +- source/common/src/ttime.c | 12 ++ source/libs/command/inc/commandInt.h | 95 +++++++++++++++ .../queryExplain.c => command/src/explain.c} | 112 ++++++++++++++++-- source/libs/qcom/inc/queryInt.h | 71 ----------- source/libs/scheduler/CMakeLists.txt | 2 +- source/libs/scheduler/inc/schedulerInt.h | 7 -- source/libs/scheduler/src/scheduler.c | 95 +-------------- 11 files changed, 227 insertions(+), 185 deletions(-) create mode 100644 source/libs/command/inc/commandInt.h rename source/libs/{qcom/src/queryExplain.c => command/src/explain.c} (85%) diff --git a/include/common/ttime.h b/include/common/ttime.h index 2209cc998f..306f54bedb 100644 --- a/include/common/ttime.h +++ b/include/common/ttime.h @@ -60,6 +60,7 @@ int32_t parseNatualDuration(const char* token, int32_t tokenLen, int64_t* durati int32_t taosParseTime(const char* timestr, int64_t* time, int32_t len, int32_t timePrec, int8_t dayligth); void deltaToUtcInitOnce(); +char getPrecisionUnit(int32_t precision); int64_t convertTimePrecision(int64_t time, int32_t fromPrecision, int32_t toPrecision); int64_t convertTimeFromPrecisionToUnit(int64_t time, int32_t fromPrecision, char toUnit); diff --git a/include/libs/command/command.h b/include/libs/command/command.h index 699c2f9792..7e58d39692 100644 --- a/include/libs/command/command.h +++ b/include/libs/command/command.h @@ -15,5 +15,10 @@ #include "cmdnodes.h" #include "tmsg.h" +#include "plannodes.h" int32_t qExecCommand(SNode* pStmt, SRetrieveTableRsp** pRsp); + +int32_t qExecStaticExplain(SQueryPlan *pDag, SRetrieveTableRsp **pRsp); + + diff --git a/include/libs/nodes/plannodes.h b/include/libs/nodes/plannodes.h index f41e049196..37163f60dd 100644 --- a/include/libs/nodes/plannodes.h +++ b/include/libs/nodes/plannodes.h @@ -253,7 +253,7 @@ typedef struct SIntervalPhysiNode { int64_t sliding; int8_t intervalUnit; int8_t slidingUnit; - uint8_t precision; + uint8_t precision; SFillNode* pFill; } SIntervalPhysiNode; diff --git a/include/libs/qcom/query.h b/include/libs/qcom/query.h index 5908b0b875..bb550e75e8 100644 --- a/include/libs/qcom/query.h +++ b/include/libs/qcom/query.h @@ -174,11 +174,6 @@ bool tIsValidSchema(struct SSchema* pSchema, int32_t numOfCols, int32_ int32_t queryCreateTableMetaFromMsg(STableMetaRsp* msg, bool isSuperTable, STableMeta** pMeta); char *jobTaskStatusStr(int32_t status); -int32_t qInitExplainCtx(void **pCtx, SHashObj *groupHash, bool verbose); -int32_t qAppendTaskExplainResRows(void *pCtx, int32_t groupId, int32_t level); -int32_t qGetExplainRspFromCtx(void *ctx, SRetrieveTableRsp **pRsp); -void qFreeExplainCtx(void *ctx); - SSchema createSchema(int8_t type, int32_t bytes, col_id_t colId, const char* name); extern int32_t (*queryBuildMsg[TDMT_MAX])(void* input, char** msg, int32_t msgSize, int32_t* msgLen); @@ -241,6 +236,11 @@ extern int32_t (*queryProcessMsgRsp[TDMT_MAX])(void* output, char* msg, int32_t } \ } while (0) +#define QRY_ERR_RET(c) do { int32_t _code = c; if (_code != TSDB_CODE_SUCCESS) { terrno = _code; return _code; } } while (0) +#define QRY_RET(c) do { int32_t _code = c; if (_code != TSDB_CODE_SUCCESS) { terrno = _code; } return _code; } while (0) +#define QRY_ERR_JRET(c) do { code = c; if (code != TSDB_CODE_SUCCESS) { terrno = code; goto _return; } } while (0) + + #ifdef __cplusplus } #endif diff --git a/source/common/src/ttime.c b/source/common/src/ttime.c index 23b19b55e7..a65352f2b9 100644 --- a/source/common/src/ttime.c +++ b/source/common/src/ttime.c @@ -361,6 +361,18 @@ int32_t parseLocaltimeDst(char* timestr, int64_t* time, int32_t timePrec) { return 0; } +char getPrecisionUnit(int32_t precision) { + static char units[3] = {TIME_UNIT_MILLISECOND, TIME_UNIT_MICROSECOND, TIME_UNIT_NANOSECOND}; + switch (precision) { + case TSDB_TIME_PRECISION_MILLI: + case TSDB_TIME_PRECISION_MICRO: + case TSDB_TIME_PRECISION_NANO: + return units[precision]; + default: + return 0; + } +} + int64_t convertTimePrecision(int64_t time, int32_t fromPrecision, int32_t toPrecision) { assert(fromPrecision == TSDB_TIME_PRECISION_MILLI || fromPrecision == TSDB_TIME_PRECISION_MICRO || fromPrecision == TSDB_TIME_PRECISION_NANO); diff --git a/source/libs/command/inc/commandInt.h b/source/libs/command/inc/commandInt.h new file mode 100644 index 0000000000..5915aa7f36 --- /dev/null +++ b/source/libs/command/inc/commandInt.h @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#ifndef _TD_QUERY_INT_H_ +#define _TD_QUERY_INT_H_ + +#ifdef __cplusplus +extern "C" { +#endif +#include "nodes.h" +#include "plannodes.h" +#include "ttime.h" + +#define EXPLAIN_MAX_GROUP_NUM 100 + +//newline area +#define EXPLAIN_TAG_SCAN_FORMAT "Tag Scan on %s columns=%d" +#define EXPLAIN_TBL_SCAN_FORMAT "Table Scan on %s columns=%d" +#define EXPLAIN_SYSTBL_SCAN_FORMAT "System Table Scan on %s columns=%d" +#define EXPLAIN_PROJECTION_FORMAT "Projection columns=%d width=%d" +#define EXPLAIN_JOIN_FORMAT "%s between %d tables width=%d" +#define EXPLAIN_AGG_FORMAT "Aggragate functions=%d" +#define EXPLAIN_EXCHANGE_FORMAT "Data Exchange %d:1 width=%d" +#define EXPLAIN_SORT_FORMAT "Sort on %d Column(s) width=%d" +#define EXPLAIN_INTERVAL_FORMAT "Interval on Column %s functions=%d interval=%" PRId64 "%c offset=%" PRId64 "%c sliding=%" PRId64 "%c width=%d" +#define EXPLAIN_SESSION_FORMAT "Session gap=%" PRId64 " functions=%d width=%d" +#define EXPLAIN_ORDER_FORMAT "Order: %s" +#define EXPLAIN_FILTER_FORMAT "Filter: " +#define EXPLAIN_FILL_FORMAT "Fill: %s" +#define EXPLAIN_ON_CONDITIONS_FORMAT "Join Cond: " +#define EXPLAIN_TIMERANGE_FORMAT "Time Range: [%" PRId64 ", %" PRId64 "]" + +//append area +#define EXPLAIN_GROUPS_FORMAT " groups=%d" +#define EXPLAIN_WIDTH_FORMAT " width=%d" +#define EXPLAIN_LOOPS_FORMAT " loops=%d" +#define EXPLAIN_REVERSE_FORMAT " reverse=%d" + +typedef struct SExplainGroup { + int32_t nodeNum; + SSubplan *plan; + void *execInfo; //TODO +} SExplainGroup; + +typedef struct SExplainResNode { + SNodeList* pChildren; + SPhysiNode* pNode; + void* pExecInfo; +} SExplainResNode; + +typedef struct SQueryExplainRowInfo { + int32_t level; + int32_t len; + char *buf; +} SQueryExplainRowInfo; + +typedef struct SExplainCtx { + int32_t totalSize; + bool verbose; + char *tbuf; + SArray *rows; + SHashObj *groupHash; +} SExplainCtx; + +#define EXPLAIN_ORDER_STRING(_order) ((TSDB_ORDER_ASC == _order) ? "Ascending" : "Descending") +#define EXPLAIN_JOIN_STRING(_type) ((JOIN_TYPE_INNER == _type) ? "Inner join" : "Join") + +#define INVERAL_TIME_FROM_PRECISION_TO_UNIT(_t, _u, _p) (((_u) == 'n' || (_u) == 'y') ? (_t) : (convertTimeFromPrecisionToUnit(_t, _p, _u))) + +#define EXPLAIN_ROW_NEW(level, ...) \ + do { \ + tlen = snprintf(tbuf + VARSTR_HEADER_SIZE, TSDB_EXPLAIN_RESULT_ROW_SIZE, "%*s%s", (level) * 2, "", (isVerboseLine ? "" : "-> ")); \ + tlen += snprintf(tbuf + VARSTR_HEADER_SIZE + tlen, TSDB_EXPLAIN_RESULT_ROW_SIZE - tlen, __VA_ARGS__); \ + } while (0) + +#define EXPLAIN_ROW_APPEND(...) tlen += snprintf(tbuf + VARSTR_HEADER_SIZE + tlen, TSDB_EXPLAIN_RESULT_ROW_SIZE - tlen, __VA_ARGS__) +#define EXPLAIN_ROW_END() do { varDataSetLen(tbuf, tlen); tlen += VARSTR_HEADER_SIZE; isVerboseLine = true; } while (0) + +#ifdef __cplusplus +} +#endif + +#endif /*_TD_QUERY_INT_H_*/ diff --git a/source/libs/qcom/src/queryExplain.c b/source/libs/command/src/explain.c similarity index 85% rename from source/libs/qcom/src/queryExplain.c rename to source/libs/command/src/explain.c index af092e842e..5fa12f5ebe 100644 --- a/source/libs/qcom/src/queryExplain.c +++ b/source/libs/command/src/explain.c @@ -13,11 +13,12 @@ * along with this program. If not, see . */ -#include "queryInt.h" #include "query.h" #include "plannodes.h" +#include "commandInt.h" int32_t qGenerateExplainResNode(SPhysiNode *pNode, void *pExecInfo, SExplainResNode **pRes); +int32_t qAppendTaskExplainResRows(void *pCtx, int32_t groupId, int32_t level); void qFreeExplainResTree(SExplainResNode *res) { @@ -265,6 +266,7 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i bool isVerboseLine = false; char *tbuf = ctx->tbuf; bool verbose = ctx->verbose; + int32_t filterLen = 0; SPhysiNode* pNode = pResNode->pNode; if (NULL == pNode) { qError("pyhsical node in explain res node is NULL"); @@ -317,7 +319,8 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i if (pTblScanNode->scan.node.pConditions) { EXPLAIN_ROW_NEW(level + 1, EXPLAIN_FILTER_FORMAT); - QRY_ERR_RET(nodesNodeToSQL(pTblScanNode->scan.node.pConditions, tbuf, TSDB_EXPLAIN_RESULT_ROW_SIZE, &tlen)); + QRY_ERR_RET(nodesNodeToSQL(pTblScanNode->scan.node.pConditions, tbuf + tlen, TSDB_EXPLAIN_RESULT_ROW_SIZE - tlen, &filterLen)); + tlen += filterLen; EXPLAIN_ROW_END(); QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); } @@ -356,7 +359,8 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i if (verbose) { if (pPrjNode->node.pConditions) { EXPLAIN_ROW_NEW(level + 1, EXPLAIN_FILTER_FORMAT); - QRY_ERR_RET(nodesNodeToSQL(pPrjNode->node.pConditions, tbuf, TSDB_EXPLAIN_RESULT_ROW_SIZE, &tlen)); + QRY_ERR_RET(nodesNodeToSQL(pPrjNode->node.pConditions, tbuf + tlen, TSDB_EXPLAIN_RESULT_ROW_SIZE - tlen, &filterLen)); + tlen += filterLen; EXPLAIN_ROW_END(); QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); } @@ -375,13 +379,15 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i if (verbose) { if (pJoinNode->node.pConditions) { EXPLAIN_ROW_NEW(level + 1, EXPLAIN_FILTER_FORMAT); - QRY_ERR_RET(nodesNodeToSQL(pJoinNode->node.pConditions, tbuf, TSDB_EXPLAIN_RESULT_ROW_SIZE, &tlen)); + QRY_ERR_RET(nodesNodeToSQL(pJoinNode->node.pConditions, tbuf + tlen, TSDB_EXPLAIN_RESULT_ROW_SIZE - tlen, &filterLen)); + tlen += filterLen; EXPLAIN_ROW_END(); QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); } EXPLAIN_ROW_NEW(level + 1, EXPLAIN_ON_CONDITIONS_FORMAT); - QRY_ERR_RET(nodesNodeToSQL(pJoinNode->pOnConditions, tbuf, TSDB_EXPLAIN_RESULT_ROW_SIZE, &tlen)); + QRY_ERR_RET(nodesNodeToSQL(pJoinNode->pOnConditions, tbuf + tlen, TSDB_EXPLAIN_RESULT_ROW_SIZE - tlen, &filterLen)); + tlen += filterLen; EXPLAIN_ROW_END(); QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); } @@ -404,7 +410,8 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i if (verbose) { if (pAggNode->node.pConditions) { EXPLAIN_ROW_NEW(level + 1, EXPLAIN_FILTER_FORMAT); - QRY_ERR_RET(nodesNodeToSQL(pAggNode->node.pConditions, tbuf, TSDB_EXPLAIN_RESULT_ROW_SIZE, &tlen)); + QRY_ERR_RET(nodesNodeToSQL(pAggNode->node.pConditions, tbuf + tlen, TSDB_EXPLAIN_RESULT_ROW_SIZE - tlen, &filterLen)); + tlen += filterLen; EXPLAIN_ROW_END(); QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); } @@ -429,7 +436,8 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i if (verbose) { if (pExchNode->node.pConditions) { EXPLAIN_ROW_NEW(level + 1, EXPLAIN_FILTER_FORMAT); - QRY_ERR_RET(nodesNodeToSQL(pExchNode->node.pConditions, tbuf, TSDB_EXPLAIN_RESULT_ROW_SIZE, &tlen)); + QRY_ERR_RET(nodesNodeToSQL(pExchNode->node.pConditions, tbuf + tlen, TSDB_EXPLAIN_RESULT_ROW_SIZE - tlen, &filterLen)); + tlen += filterLen; EXPLAIN_ROW_END(); QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); } @@ -450,7 +458,8 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i if (verbose) { if (pSortNode->node.pConditions) { EXPLAIN_ROW_NEW(level + 1, EXPLAIN_FILTER_FORMAT); - QRY_ERR_RET(nodesNodeToSQL(pSortNode->node.pConditions, tbuf, TSDB_EXPLAIN_RESULT_ROW_SIZE, &tlen)); + QRY_ERR_RET(nodesNodeToSQL(pSortNode->node.pConditions, tbuf + tlen, TSDB_EXPLAIN_RESULT_ROW_SIZE - tlen, &filterLen)); + tlen += filterLen; EXPLAIN_ROW_END(); QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); } @@ -461,7 +470,7 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i SIntervalPhysiNode *pIntNode = (SIntervalPhysiNode *)pNode; EXPLAIN_ROW_NEW(level, EXPLAIN_INTERVAL_FORMAT, qGetNameFromColumnNode(pIntNode->pTspk), pIntNode->window.pFuncs->length, INVERAL_TIME_FROM_PRECISION_TO_UNIT(pIntNode->interval, pIntNode->intervalUnit, pIntNode->precision), pIntNode->intervalUnit, - INVERAL_TIME_FROM_PRECISION_TO_UNIT(pIntNode->offset, pIntNode->intervalUnit, pIntNode->precision), pIntNode->intervalUnit, + pIntNode->offset, getPrecisionUnit(pIntNode->precision), INVERAL_TIME_FROM_PRECISION_TO_UNIT(pIntNode->sliding, pIntNode->slidingUnit, pIntNode->precision), pIntNode->slidingUnit, pIntNode->window.node.pOutputDataBlockDesc->outputRowSize); if (pResNode->pExecInfo) { @@ -479,7 +488,8 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i if (pIntNode->window.node.pConditions) { EXPLAIN_ROW_NEW(level + 1, EXPLAIN_FILTER_FORMAT); - QRY_ERR_RET(nodesNodeToSQL(pIntNode->window.node.pConditions, tbuf, TSDB_EXPLAIN_RESULT_ROW_SIZE, &tlen)); + QRY_ERR_RET(nodesNodeToSQL(pIntNode->window.node.pConditions, tbuf + tlen, TSDB_EXPLAIN_RESULT_ROW_SIZE - tlen, &filterLen)); + tlen += filterLen; EXPLAIN_ROW_END(); QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); } @@ -498,7 +508,8 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i if (verbose) { if (pIntNode->window.node.pConditions) { EXPLAIN_ROW_NEW(level + 1, EXPLAIN_FILTER_FORMAT); - QRY_ERR_RET(nodesNodeToSQL(pIntNode->window.node.pConditions, tbuf, TSDB_EXPLAIN_RESULT_ROW_SIZE, &tlen)); + QRY_ERR_RET(nodesNodeToSQL(pIntNode->window.node.pConditions, tbuf + tlen, TSDB_EXPLAIN_RESULT_ROW_SIZE - tlen, &filterLen)); + tlen += filterLen; EXPLAIN_ROW_END(); QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); } @@ -595,5 +606,84 @@ int32_t qGetExplainRspFromCtx(void *ctx, SRetrieveTableRsp **pRsp) { return TSDB_CODE_SUCCESS; } +int32_t qExecStaticExplain(SQueryPlan *pDag, SRetrieveTableRsp **pRsp) { + int32_t code = 0; + SNodeListNode *plans = NULL; + int32_t taskNum = 0; + SExplainGroup *pGroup = NULL; + void *pCtx = NULL; + int32_t rootGroupId = 0; + + if (pDag->numOfSubplans <= 0) { + qError("invalid subplan num:%d", pDag->numOfSubplans); + QRY_ERR_RET(TSDB_CODE_QRY_INVALID_INPUT); + } + + int32_t levelNum = (int32_t)LIST_LENGTH(pDag->pSubplans); + if (levelNum <= 0) { + qError("invalid level num:%d", levelNum); + QRY_ERR_RET(TSDB_CODE_QRY_INVALID_INPUT); + } + + SHashObj *groupHash = taosHashInit(EXPLAIN_MAX_GROUP_NUM, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), false, HASH_NO_LOCK); + if (NULL == groupHash) { + qError("groupHash %d failed", EXPLAIN_MAX_GROUP_NUM); + QRY_ERR_RET(TSDB_CODE_QRY_OUT_OF_MEMORY); + } + + QRY_ERR_JRET(qInitExplainCtx(&pCtx, groupHash, pDag->explainInfo.verbose)); + + for (int32_t i = 0; i < levelNum; ++i) { + plans = (SNodeListNode *)nodesListGetNode(pDag->pSubplans, i); + if (NULL == plans) { + qError("empty level plan, level:%d", i); + QRY_ERR_JRET(TSDB_CODE_QRY_INVALID_INPUT); + } + + taskNum = (int32_t)LIST_LENGTH(plans->pNodeList); + if (taskNum <= 0) { + qError("invalid level plan number:%d, level:%d", taskNum, i); + QRY_ERR_JRET(TSDB_CODE_QRY_INVALID_INPUT); + } + + SSubplan *plan = NULL; + for (int32_t n = 0; n < taskNum; ++n) { + plan = (SSubplan *)nodesListGetNode(plans->pNodeList, n); + pGroup = taosHashGet(groupHash, &plan->id.groupId, sizeof(plan->id.groupId)); + if (pGroup) { + ++pGroup->nodeNum; + continue; + } + + SExplainGroup group = {.nodeNum = 1, .plan = plan, .execInfo = NULL}; + if (0 != taosHashPut(groupHash, &plan->id.groupId, sizeof(plan->id.groupId), &group, sizeof(group))) { + qError("taosHashPut to explainGroupHash failed, taskIdx:%d", n); + QRY_ERR_JRET(TSDB_CODE_QRY_OUT_OF_MEMORY); + } + } + + if (0 == i) { + if (taskNum > 1) { + qError("invalid taskNum %d for level 0", taskNum); + QRY_ERR_JRET(TSDB_CODE_QRY_INVALID_INPUT); + } + + rootGroupId = plan->id.groupId; + } + + qDebug("level %d group handled, taskNum:%d", i, taskNum); + } + + QRY_ERR_JRET(qAppendTaskExplainResRows(pCtx, rootGroupId, 0)); + + QRY_ERR_JRET(qGetExplainRspFromCtx(pCtx, pRsp)); + +_return: + + qFreeExplainCtx(pCtx); + + QRY_RET(code); +} + diff --git a/source/libs/qcom/inc/queryInt.h b/source/libs/qcom/inc/queryInt.h index 06d5b07dc7..f120bf26ce 100644 --- a/source/libs/qcom/inc/queryInt.h +++ b/source/libs/qcom/inc/queryInt.h @@ -19,77 +19,6 @@ #ifdef __cplusplus extern "C" { #endif -#include "nodes.h" -#include "plannodes.h" - -//newline area -#define EXPLAIN_TAG_SCAN_FORMAT "Tag Scan on %s columns=%d" -#define EXPLAIN_TBL_SCAN_FORMAT "Table Scan on %s columns=%d" -#define EXPLAIN_SYSTBL_SCAN_FORMAT "System Table Scan on %s columns=%d" -#define EXPLAIN_PROJECTION_FORMAT "Projection columns=%d width=%d" -#define EXPLAIN_JOIN_FORMAT "%s between %d tables width=%d" -#define EXPLAIN_AGG_FORMAT "Aggragate functions=%d" -#define EXPLAIN_EXCHANGE_FORMAT "Data Exchange %d:1 width=%d" -#define EXPLAIN_SORT_FORMAT "Sort on %d Column(s) width=%d" -#define EXPLAIN_INTERVAL_FORMAT "Interval on Column %s functions=%d interval=%" PRId64 "%c offset=%" PRId64 "%c sliding=%" PRId64 "%c width=%d" -#define EXPLAIN_SESSION_FORMAT "Session gap=%" PRId64 " functions=%d width=%d" -#define EXPLAIN_ORDER_FORMAT "Order: %s" -#define EXPLAIN_FILTER_FORMAT "Filter: " -#define EXPLAIN_FILL_FORMAT "Fill: %s" -#define EXPLAIN_ON_CONDITIONS_FORMAT "Join Cond: " -#define EXPLAIN_TIMERANGE_FORMAT "Time Range: [%" PRId64 ", %" PRId64 "]" - -//append area -#define EXPLAIN_GROUPS_FORMAT " groups=%d" -#define EXPLAIN_WIDTH_FORMAT " width=%d" -#define EXPLAIN_LOOPS_FORMAT " loops=%d" -#define EXPLAIN_REVERSE_FORMAT " reverse=%d" - -//TODO MOVE TO LIB -typedef struct SExplainGroup { - int32_t nodeNum; - SSubplan *plan; - void *execInfo; //TODO -} SExplainGroup; - - -typedef struct SExplainResNode { - SNodeList* pChildren; - SPhysiNode* pNode; - void* pExecInfo; -} SExplainResNode; - -typedef struct SQueryExplainRowInfo { - int32_t level; - int32_t len; - char *buf; -} SQueryExplainRowInfo; - -typedef struct SExplainCtx { - int32_t totalSize; - bool verbose; - char *tbuf; - SArray *rows; - SHashObj *groupHash; -} SExplainCtx; - -#define EXPLAIN_ORDER_STRING(_order) ((TSDB_ORDER_ASC == _order) ? "Ascending" : "Descending") -#define EXPLAIN_JOIN_STRING(_type) ((JOIN_TYPE_INNER == _type) ? "Inner join" : "Join") - -#define INVERAL_TIME_FROM_PRECISION_TO_UNIT(_t, _u, _p) (((_u) == 'n' || (_u) == 'y') ? (_t) : (convertTimeFromPrecisionToUnit(_t, _p, _u))) - -#define EXPLAIN_ROW_NEW(level, ...) \ - do { \ - tlen = snprintf(tbuf + VARSTR_HEADER_SIZE, TSDB_EXPLAIN_RESULT_ROW_SIZE, "%*s%s", (level) * 2, "", (isVerboseLine ? "" : "-> ")); \ - tlen += snprintf(tbuf + VARSTR_HEADER_SIZE + tlen, TSDB_EXPLAIN_RESULT_ROW_SIZE - tlen, __VA_ARGS__); \ - } while (0) - -#define EXPLAIN_ROW_APPEND(...) tlen += snprintf(tbuf + VARSTR_HEADER_SIZE + tlen, TSDB_EXPLAIN_RESULT_ROW_SIZE - tlen, __VA_ARGS__) -#define EXPLAIN_ROW_END() do { varDataSetLen(tbuf, tlen); tlen += VARSTR_HEADER_SIZE; isVerboseLine = true; } while (0) - -#define QRY_ERR_RET(c) do { int32_t _code = c; if (_code != TSDB_CODE_SUCCESS) { terrno = _code; return _code; } } while (0) -#define QRY_RET(c) do { int32_t _code = c; if (_code != TSDB_CODE_SUCCESS) { terrno = _code; } return _code; } while (0) -#define QRY_ERR_JRET(c) do { code = c; if (code != TSDB_CODE_SUCCESS) { terrno = code; goto _return; } } while (0) #ifdef __cplusplus diff --git a/source/libs/scheduler/CMakeLists.txt b/source/libs/scheduler/CMakeLists.txt index a4a299317c..1a62c7d89d 100644 --- a/source/libs/scheduler/CMakeLists.txt +++ b/source/libs/scheduler/CMakeLists.txt @@ -9,7 +9,7 @@ target_include_directories( target_link_libraries( scheduler - PUBLIC os util nodes planner qcom common catalog transport + PUBLIC os util nodes planner qcom common catalog transport command ) if(${BUILD_TEST}) diff --git a/source/libs/scheduler/inc/schedulerInt.h b/source/libs/scheduler/inc/schedulerInt.h index f19e822974..22bd039219 100644 --- a/source/libs/scheduler/inc/schedulerInt.h +++ b/source/libs/scheduler/inc/schedulerInt.h @@ -38,13 +38,6 @@ enum { SCH_WRITE, }; -//TODO MOVE TO LIB -typedef struct SExplainGroup { - int32_t nodeNum; - SSubplan *plan; - void *execInfo; //TODO -} SExplainGroup; - typedef struct SSchTrans { void *transInst; void *transHandle; diff --git a/source/libs/scheduler/src/scheduler.c b/source/libs/scheduler/src/scheduler.c index 940aaed7c1..7c24a25f65 100644 --- a/source/libs/scheduler/src/scheduler.c +++ b/source/libs/scheduler/src/scheduler.c @@ -19,6 +19,7 @@ #include "tmsg.h" #include "tref.h" #include "trpc.h" +#include "command.h" SSchedulerMgmt schMgmt = {0}; @@ -476,92 +477,6 @@ _return: SCH_RET(code); } -int32_t schValidateAndBuildJobExplain(SQueryPlan *pDag, SSchJob *pJob) { - int32_t code = 0; - SNodeListNode *plans = NULL; - int32_t taskNum = 0; - SExplainGroup *pGroup = NULL; - void *pCtx = NULL; - int32_t rootGroupId = 0; - - pJob->queryId = pDag->queryId; - pJob->subPlans = pDag->pSubplans; - - if (pDag->numOfSubplans <= 0) { - SCH_JOB_ELOG("invalid subplan num:%d", pDag->numOfSubplans); - SCH_ERR_RET(TSDB_CODE_QRY_INVALID_INPUT); - } - - int32_t levelNum = (int32_t)LIST_LENGTH(pDag->pSubplans); - if (levelNum <= 0) { - SCH_JOB_ELOG("invalid level num:%d", levelNum); - SCH_ERR_RET(TSDB_CODE_QRY_INVALID_INPUT); - } - - SHashObj *groupHash = taosHashInit(SCHEDULE_DEFAULT_MAX_TASK_NUM, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), false, HASH_NO_LOCK); - if (NULL == groupHash) { - SCH_JOB_ELOG("groupHash %d failed", SCHEDULE_DEFAULT_MAX_TASK_NUM); - SCH_ERR_RET(TSDB_CODE_QRY_OUT_OF_MEMORY); - } - - SCH_ERR_JRET(qInitExplainCtx(&pCtx, groupHash, pDag->explainInfo.verbose)); - - for (int32_t i = 0; i < levelNum; ++i) { - plans = (SNodeListNode *)nodesListGetNode(pDag->pSubplans, i); - if (NULL == plans) { - SCH_JOB_ELOG("empty level plan, level:%d", i); - SCH_ERR_JRET(TSDB_CODE_QRY_INVALID_INPUT); - } - - taskNum = (int32_t)LIST_LENGTH(plans->pNodeList); - if (taskNum <= 0) { - SCH_JOB_ELOG("invalid level plan number:%d, level:%d", taskNum, i); - SCH_ERR_JRET(TSDB_CODE_QRY_INVALID_INPUT); - } - - SSubplan *plan = NULL; - for (int32_t n = 0; n < taskNum; ++n) { - plan = (SSubplan *)nodesListGetNode(plans->pNodeList, n); - pGroup = taosHashGet(groupHash, &plan->id.groupId, sizeof(plan->id.groupId)); - if (pGroup) { - ++pGroup->nodeNum; - continue; - } - - SExplainGroup group = {.nodeNum = 1, .plan = plan, .execInfo = NULL}; - if (0 != taosHashPut(groupHash, &plan->id.groupId, sizeof(plan->id.groupId), &group, sizeof(group))) { - SCH_JOB_ELOG("taosHashPut to explainGroupHash failed, taskIdx:%d", n); - SCH_ERR_JRET(TSDB_CODE_QRY_OUT_OF_MEMORY); - } - } - - if (0 == i) { - if (taskNum > 1) { - SCH_JOB_ELOG("invalid taskNum %d for level 0", taskNum); - SCH_ERR_JRET(TSDB_CODE_QRY_INVALID_INPUT); - } - - rootGroupId = plan->id.groupId; - } - - SCH_JOB_DLOG("level %d group handled, taskNum:%d", i, taskNum); - } - - SCH_ERR_JRET(qAppendTaskExplainResRows(pCtx, rootGroupId, 0)); - - SRetrieveTableRsp *pRsp = NULL; - SCH_ERR_JRET(qGetExplainRspFromCtx(pCtx, &pRsp)); - - pJob->resData = pRsp; - -_return: - - qFreeExplainCtx(pCtx); - - SCH_RET(code); -} - - int32_t schSetTaskCandidateAddrs(SSchJob *pJob, SSchTask *pTask) { if (NULL != pTask->candidateAddrs) { return TSDB_CODE_SUCCESS; @@ -2250,7 +2165,7 @@ _return: SCH_RET(code); } -int32_t schStaticExplain(void *transport, SArray *pNodeList, SQueryPlan *pDag, int64_t *job, const char *sql, +int32_t schExecStaticExplain(void *transport, SArray *pNodeList, SQueryPlan *pDag, int64_t *job, const char *sql, bool syncSchedule) { qDebug("QID:0x%" PRIx64 " job started", pDag->queryId); @@ -2264,8 +2179,10 @@ int32_t schStaticExplain(void *transport, SArray *pNodeList, SQueryPlan *pDag, i pJob->sql = sql; pJob->attr.queryJob = true; pJob->attr.explainMode = pDag->explainInfo.mode; + pJob->queryId = pDag->queryId; + pJob->subPlans = pDag->pSubplans; - SCH_ERR_JRET(schValidateAndBuildJobExplain(pDag, pJob)); + SCH_ERR_JRET(qExecStaticExplain(pDag, (SRetrieveTableRsp **)&pJob->resData)); int64_t refId = taosAddRef(schMgmt.jobRef, pJob); if (refId < 0) { @@ -2345,7 +2262,7 @@ int32_t schedulerExecJob(void *transport, SArray *nodeList, SQueryPlan *pDag, in } if (EXPLAIN_MODE_STATIC == pDag->explainInfo.mode) { - SCH_ERR_RET(schStaticExplain(transport, nodeList, pDag, pJob, sql, true)); + SCH_ERR_RET(schExecStaticExplain(transport, nodeList, pDag, pJob, sql, true)); } else { SCH_ERR_RET(schExecJobImpl(transport, nodeList, pDag, pJob, sql, true)); } From 6256e6f288cdeb56b6a3de8087739633dd2390cf Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Thu, 31 Mar 2022 18:05:13 +0800 Subject: [PATCH 32/47] add fuzzy search --- source/libs/index/inc/indexFstRegex.h | 3 --- source/libs/index/inc/indexFstSparse.h | 6 ++--- source/libs/index/src/indexFstSparse.c | 37 ++++++++++++-------------- 3 files changed, 20 insertions(+), 26 deletions(-) diff --git a/source/libs/index/inc/indexFstRegex.h b/source/libs/index/inc/indexFstRegex.h index a80e768feb..8fb5455336 100644 --- a/source/libs/index/inc/indexFstRegex.h +++ b/source/libs/index/inc/indexFstRegex.h @@ -67,9 +67,6 @@ uint32_t regexAutomStart(FstRegex *regex); bool regexAutomIsMatch(FstRegex *regex, uint32_t state); bool regexAutomCanMatch(FstRegex *regex, uint32_t state, bool null); bool regexAutomAccept(FstRegex *regex, uint32_t state, uint8_t byte, uint32_t *result); -// void regexSetup(FstRegex *regex, uint32_t size, const char *str); - -// uint32_t regexStart() #ifdef __cplusplus } diff --git a/source/libs/index/inc/indexFstSparse.h b/source/libs/index/inc/indexFstSparse.h index 69b33c82d9..665fb2ba5c 100644 --- a/source/libs/index/inc/indexFstSparse.h +++ b/source/libs/index/inc/indexFstSparse.h @@ -23,9 +23,9 @@ extern "C" { #endif typedef struct FstSparseSet { - SArray *dense; - SArray *sparse; - int32_t size; + uint32_t *dense; + uint32_t *sparse; + int32_t size; } FstSparseSet; FstSparseSet *sparSetCreate(int32_t sz); diff --git a/source/libs/index/src/indexFstSparse.c b/source/libs/index/src/indexFstSparse.c index 9d228e71ff..e8ab3be2fe 100644 --- a/source/libs/index/src/indexFstSparse.c +++ b/source/libs/index/src/indexFstSparse.c @@ -21,47 +21,44 @@ FstSparseSet *sparSetCreate(int32_t sz) { return NULL; } - ss->dense = taosArrayInit(sz, sizeof(uint32_t)); - ss->sparse = taosArrayInit(sz, sizeof(uint32_t)); - ss->size = sz; + ss->dense = (uint32_t *)taosMemoryCalloc(sz, sizeof(uint32_t)); + ss->sparse = (uint32_t *)taosMemoryCalloc(sz, sizeof(uint32_t)); + ss->size = 0; return ss; } void sparSetDestroy(FstSparseSet *ss) { if (ss == NULL) { return; } - taosArrayDestroy(ss->dense); - taosArrayDestroy(ss->sparse); + taosMemoryFree(ss->dense); + taosMemoryFree(ss->sparse); taosMemoryFree(ss); } -uint32_t sparSetLen(FstSparseSet *ss) { return ss == NULL ? 0 : ss->size; } +uint32_t sparSetLen(FstSparseSet *ss) { + // Get occupied size + return ss == NULL ? 0 : ss->size; +} uint32_t sparSetAdd(FstSparseSet *ss, uint32_t ip) { if (ss == NULL) { return 0; } uint32_t i = ss->size; - taosArraySet(ss->dense, i, &ip); - taosArraySet(ss->sparse, ip, &i); + ss->dense[i] = ip; + ss->sparse[ip] = i; ss->size += 1; return i; } uint32_t sparSetGet(FstSparseSet *ss, uint32_t i) { - if (i >= taosArrayGetSize(ss->dense)) { - return 0; - } - uint32_t *v = taosArrayGet(ss->dense, i); - return *v; + // check later + return ss->dense[i]; } bool sparSetContains(FstSparseSet *ss, uint32_t ip) { - if (ip >= taosArrayGetSize(ss->sparse)) { + uint32_t i = ss->sparse[ip]; + if (i < ss->size && ss->dense[i] == ip) { + return true; + } else { return false; } - uint32_t i = *(uint32_t *)taosArrayGet(ss->sparse, ip); - if (i >= taosArrayGetSize(ss->dense)) { - return false; - } - uint32_t v = *(uint32_t *)taosArrayGet(ss->dense, i); - return v == ip; } void sparSetClear(FstSparseSet *ss) { if (ss == NULL) { From e21ba1637ecca0e1ee95849ecb070367afc8373a Mon Sep 17 00:00:00 2001 From: Liu Jicong Date: Thu, 31 Mar 2022 18:39:11 +0800 Subject: [PATCH 33/47] revert uid --- source/dnode/vnode/src/inc/tsdbCommit.h | 2 +- source/dnode/vnode/src/inc/tsdbDef.h | 2 +- source/dnode/vnode/src/meta/metaTbUid.c | 2 +- source/dnode/vnode/src/tq/tqRead.c | 1 + source/dnode/vnode/src/tsdb/tsdbCommit.c | 2 +- source/dnode/vnode/src/tsdb/tsdbRead.c | 2 +- source/dnode/vnode/src/tsdb/tsdbReadImpl.c | 40 +++++++++++++--------- 7 files changed, 29 insertions(+), 22 deletions(-) diff --git a/source/dnode/vnode/src/inc/tsdbCommit.h b/source/dnode/vnode/src/inc/tsdbCommit.h index 699aeaa133..2c6dd75e03 100644 --- a/source/dnode/vnode/src/inc/tsdbCommit.h +++ b/source/dnode/vnode/src/inc/tsdbCommit.h @@ -74,4 +74,4 @@ int tsdbApplyRtn(STsdbRepo *pRepo); } #endif -#endif /* _TD_TSDB_COMMIT_H_ */ \ No newline at end of file +#endif /* _TD_TSDB_COMMIT_H_ */ diff --git a/source/dnode/vnode/src/inc/tsdbDef.h b/source/dnode/vnode/src/inc/tsdbDef.h index 02aba95517..3e42cb627a 100644 --- a/source/dnode/vnode/src/inc/tsdbDef.h +++ b/source/dnode/vnode/src/inc/tsdbDef.h @@ -79,4 +79,4 @@ static FORCE_INLINE STSchema *tsdbGetTableSchemaImpl(STable *pTable, bool lock, } #endif -#endif /*_TD_TSDB_DEF_H_*/ \ No newline at end of file +#endif /*_TD_TSDB_DEF_H_*/ diff --git a/source/dnode/vnode/src/meta/metaTbUid.c b/source/dnode/vnode/src/meta/metaTbUid.c index b488630024..1f57d1396a 100644 --- a/source/dnode/vnode/src/meta/metaTbUid.c +++ b/source/dnode/vnode/src/meta/metaTbUid.c @@ -27,5 +27,5 @@ void metaCloseUidGnrt(SMeta *pMeta) { /* TODO */ tb_uid_t metaGenerateUid(SMeta *pMeta) { // Generate a new table UID - return tGenIdPI64(); + return tGenIdPI32(); } diff --git a/source/dnode/vnode/src/tq/tqRead.c b/source/dnode/vnode/src/tq/tqRead.c index 344b4fa655..61538055f2 100644 --- a/source/dnode/vnode/src/tq/tqRead.c +++ b/source/dnode/vnode/src/tq/tqRead.c @@ -168,6 +168,7 @@ SArray* tqRetrieveDataBlock(STqReadHandle* pHandle) { break; } if (colDataAppend(pColData, curRow, sVal.val, false) < 0) { + /*if (colDataAppend(pColData, curRow, sVal.val, sVal.valType == TD_VTYPE_NULL) < 0) {*/ taosArrayDestroyEx(pArray, (void (*)(void*))tDeleteSSDataBlock); return NULL; } diff --git a/source/dnode/vnode/src/tsdb/tsdbCommit.c b/source/dnode/vnode/src/tsdb/tsdbCommit.c index 3e0b03f331..d5e9b55a71 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCommit.c +++ b/source/dnode/vnode/src/tsdb/tsdbCommit.c @@ -1394,7 +1394,7 @@ int tsdbWriteBlockImpl(STsdb *pRepo, STable *pTable, SDFile *pDFile, SDFile *pDF tsdbDebug("vgId:%d uid:%" PRId64 " a block of data is written to file %s, offset %" PRId64 " numOfRows %d len %d numOfCols %" PRId16 " keyFirst %" PRId64 " keyLast %" PRId64, - REPO_ID(pRepo), TABLE_TID(pTable), TSDB_FILE_FULL_NAME(pDFile), offset, rowsToWrite, pBlock->len, + REPO_ID(pRepo), TABLE_UID(pTable), TSDB_FILE_FULL_NAME(pDFile), offset, rowsToWrite, pBlock->len, pBlock->numOfCols, pBlock->keyFirst, pBlock->keyLast); return 0; diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c index bac5255d17..cae6d5ec1a 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead.c @@ -4068,4 +4068,4 @@ void getTableListfromSkipList(tExprNode *pExpr, SSkipList *pSkipList, SArray *re //apply the hierarchical filter expression to every node in skiplist to find the qualified nodes applyFilterToSkipListNode(pSkipList, pExpr, result, param); } -#endif \ No newline at end of file +#endif diff --git a/source/dnode/vnode/src/tsdb/tsdbReadImpl.c b/source/dnode/vnode/src/tsdb/tsdbReadImpl.c index ac7c0ada90..304b3286fe 100644 --- a/source/dnode/vnode/src/tsdb/tsdbReadImpl.c +++ b/source/dnode/vnode/src/tsdb/tsdbReadImpl.c @@ -99,7 +99,7 @@ int tsdbSetAndOpenReadFSet(SReadH *pReadh, SDFileSet *pSet) { void tsdbCloseAndUnsetFSet(SReadH *pReadh) { tsdbResetReadFile(pReadh); } int tsdbLoadBlockIdx(SReadH *pReadh) { - SDFile *pHeadf = TSDB_READ_HEAD_FILE(pReadh); + SDFile * pHeadf = TSDB_READ_HEAD_FILE(pReadh); SBlockIdx blkIdx; ASSERT(taosArrayGetSize(pReadh->aBlkIdx) == 0); @@ -181,13 +181,20 @@ int tsdbSetReadTable(SReadH *pReadh, STable *pTable) { } SBlockIdx *pBlkIdx = taosArrayGet(pReadh->aBlkIdx, pReadh->cidx); - if (pBlkIdx->uid == TABLE_UID(pTable)) { - pReadh->pBlkIdx = pBlkIdx; + if (pBlkIdx->tid == TABLE_TID(pTable)) { + if (pBlkIdx->uid == TABLE_UID(pTable)) { + pReadh->pBlkIdx = pBlkIdx; + } else { + pReadh->pBlkIdx = NULL; + } + pReadh->cidx++; + break; + } else if (pBlkIdx->tid > TABLE_TID(pTable)) { + pReadh->pBlkIdx = NULL; break; } else { - pReadh->pBlkIdx = NULL; + pReadh->cidx++; } - pReadh->cidx++; } } else { pReadh->pBlkIdx = NULL; @@ -199,7 +206,7 @@ int tsdbSetReadTable(SReadH *pReadh, STable *pTable) { int tsdbLoadBlockInfo(SReadH *pReadh, void *pTarget) { ASSERT(pReadh->pBlkIdx != NULL); - SDFile *pHeadf = TSDB_READ_HEAD_FILE(pReadh); + SDFile * pHeadf = TSDB_READ_HEAD_FILE(pReadh); SBlockIdx *pBlkIdx = pReadh->pBlkIdx; if (tsdbSeekDFile(pHeadf, pBlkIdx->offset, SEEK_SET) < 0) { @@ -269,8 +276,7 @@ int tsdbLoadBlockData(SReadH *pReadh, SBlock *pBlock, SBlockInfo *pBlkInfo) { return 0; } -int tsdbLoadBlockDataCols(SReadH *pReadh, SBlock *pBlock, SBlockInfo *pBlkInfo, const int16_t *colIds, - int numOfColsIds) { +int tsdbLoadBlockDataCols(SReadH *pReadh, SBlock *pBlock, SBlockInfo *pBlkInfo, const int16_t *colIds, int numOfColsIds) { ASSERT(pBlock->numOfSubBlocks > 0); int8_t update = pReadh->pRepo->config.update; @@ -533,9 +539,9 @@ static int tsdbLoadBlockDataImpl(SReadH *pReadh, SBlock *pBlock, SDataCols *pDat pDataCols->numOfRows = pBlock->numOfRows; // Recover the data - int ccol = 0; // loop iter for SBlockCol object - int dcol = 0; // loop iter for SDataCols object - int nBitmaps = (int)TD_BITMAP_BYTES(pBlock->numOfRows); + int ccol = 0; // loop iter for SBlockCol object + int dcol = 0; // loop iter for SDataCols object + int nBitmaps = (int)TD_BITMAP_BYTES(pBlock->numOfRows); SBlockCol *pBlockCol = NULL; while (dcol < pDataCols->numOfCols) { SDataCol *pDataCol = &(pDataCols->cols[dcol]); @@ -580,8 +586,8 @@ static int tsdbLoadBlockDataImpl(SReadH *pReadh, SBlock *pBlock, SDataCols *pDat } if (tsdbCheckAndDecodeColumnData(pDataCol, POINTER_SHIFT(pBlockData, tsize + toffset), tlen, pBlock->algorithm, - pBlock->numOfRows, tBitmaps, tLenBitmap, pDataCols->maxPoints, - TSDB_READ_COMP_BUF(pReadh), (int)taosTSizeof(TSDB_READ_COMP_BUF(pReadh))) < 0) { + pBlock->numOfRows, tBitmaps, tLenBitmap, pDataCols->maxPoints, TSDB_READ_COMP_BUF(pReadh), + (int)taosTSizeof(TSDB_READ_COMP_BUF(pReadh))) < 0) { tsdbError("vgId:%d file %s is broken at column %d block offset %" PRId64 " column offset %u", TSDB_READ_REPO_ID(pReadh), TSDB_FILE_FULL_NAME(pDFile), tcolId, (int64_t)pBlock->offset, toffset); return -1; @@ -656,7 +662,7 @@ static int tsdbLoadBlockDataColsImpl(SReadH *pReadh, SBlock *pBlock, SDataCols * ASSERT(pBlock->numOfSubBlocks == 0 || pBlock->numOfSubBlocks == 1); ASSERT(colIds[0] == PRIMARYKEY_TIMESTAMP_COL_ID); - SDFile *pDFile = (pBlock->last) ? TSDB_READ_LAST_FILE(pReadh) : TSDB_READ_DATA_FILE(pReadh); + SDFile * pDFile = (pBlock->last) ? TSDB_READ_LAST_FILE(pReadh) : TSDB_READ_DATA_FILE(pReadh); SBlockCol blockCol = {0}; tdResetDataCols(pDataCols); @@ -670,7 +676,7 @@ static int tsdbLoadBlockDataColsImpl(SReadH *pReadh, SBlock *pBlock, SDataCols * int ccol = 0; for (int i = 0; i < numOfColIds; i++) { int16_t colId = colIds[i]; - SDataCol *pDataCol = NULL; + SDataCol * pDataCol = NULL; SBlockCol *pBlockCol = NULL; while (true) { @@ -734,7 +740,7 @@ static int tsdbLoadBlockDataColsImpl(SReadH *pReadh, SBlock *pBlock, SDataCols * static int tsdbLoadColData(SReadH *pReadh, SDFile *pDFile, SBlock *pBlock, SBlockCol *pBlockCol, SDataCol *pDataCol) { ASSERT(pDataCol->colId == pBlockCol->colId); - STsdb *pRepo = TSDB_READ_REPO(pReadh); + STsdb * pRepo = TSDB_READ_REPO(pReadh); STsdbCfg *pCfg = REPO_CFG(pRepo); int nBitmaps = (int)TD_BITMAP_BYTES(pBlock->numOfRows); @@ -751,7 +757,7 @@ static int tsdbLoadColData(SReadH *pReadh, SDFile *pDFile, SBlock *pBlock, SBloc } } - int tsize = pDataCol->bytes * pBlock->numOfRows + tLenBitmap + COMP_OVERFLOW_BYTES; + int tsize = pDataCol->bytes * pBlock->numOfRows + tLenBitmap + COMP_OVERFLOW_BYTES; if (tsdbMakeRoom((void **)(&TSDB_READ_BUF(pReadh)), pBlockCol->len) < 0) return -1; if (tsdbMakeRoom((void **)(&TSDB_READ_COMP_BUF(pReadh)), tsize) < 0) return -1; From 6c853aebab8f80eb3c2092ba2cf5e1c426ba34fa Mon Sep 17 00:00:00 2001 From: Liu Jicong Date: Thu, 31 Mar 2022 18:50:50 +0800 Subject: [PATCH 34/47] use single vgroup test --- tests/script/tsim/tmq/basic1.sim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/script/tsim/tmq/basic1.sim b/tests/script/tsim/tmq/basic1.sim index 26a5abbfcf..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 2 +sql create database $dbNamme vgroups 1 sql show databases print $data00 $data01 $data02 if $rows != 2 then From 689fb267089cfe1b32a90583981ffbdc07579a00 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Thu, 31 Mar 2022 07:38:17 -0400 Subject: [PATCH 35/47] db or table option keep implement --- include/libs/nodes/cmdnodes.h | 8 +- include/util/tdef.h | 6 +- source/dnode/mnode/impl/src/mndDb.c | 4 +- source/dnode/mnode/impl/src/mndInfoSchema.c | 2 +- source/libs/parser/inc/parAst.h | 5 + source/libs/parser/inc/sql.y | 21 +- source/libs/parser/src/parAstCreater.c | 98 +- source/libs/parser/src/parTranslater.c | 12 +- source/libs/parser/src/sql.c | 3734 ++++++++++--------- tests/script/tsim/db/alter_option.sim | 8 +- 10 files changed, 1982 insertions(+), 1916 deletions(-) diff --git a/include/libs/nodes/cmdnodes.h b/include/libs/nodes/cmdnodes.h index 1c812d40ca..b7131716f3 100644 --- a/include/libs/nodes/cmdnodes.h +++ b/include/libs/nodes/cmdnodes.h @@ -38,7 +38,9 @@ typedef struct SDatabaseOptions { int32_t fsyncPeriod; int32_t maxRowsPerBlock; int32_t minRowsPerBlock; - int32_t keep; + int32_t keep0; + int32_t keep1; + int32_t keep2; int32_t precision; int32_t quorum; int32_t replica; @@ -76,7 +78,9 @@ typedef struct SAlterDatabaseStmt { typedef struct STableOptions { ENodeType type; - int32_t keep; + int32_t keep0; + int32_t keep1; + int32_t keep2; int32_t ttl; char comments[TSDB_STB_COMMENT_LEN]; SNodeList* pSma; diff --git a/include/util/tdef.h b/include/util/tdef.h index fb1075d74f..c5b557a2b5 100644 --- a/include/util/tdef.h +++ b/include/util/tdef.h @@ -307,9 +307,9 @@ typedef enum ELogicConditionType { #define TSDB_MAX_DAYS_PER_FILE (3650 * 1440) #define TSDB_DEFAULT_DAYS_PER_FILE (10 * 1440) -#define TSDB_MIN_KEEP 1 // data in db to be reserved. -#define TSDB_MAX_KEEP 365000 // data in db to be reserved. -#define TSDB_DEFAULT_KEEP 3650 // ten years +#define TSDB_MIN_KEEP (1 * 1440) // data in db to be reserved. unit minute +#define TSDB_MAX_KEEP (365000 * 1440) // data in db to be reserved. +#define TSDB_DEFAULT_KEEP (3650 * 1440) // ten years #define TSDB_MIN_MIN_ROW_FBLOCK 10 #define TSDB_MAX_MIN_ROW_FBLOCK 1000 diff --git a/source/dnode/mnode/impl/src/mndDb.c b/source/dnode/mnode/impl/src/mndDb.c index bd66bdeae9..462f0eb85a 100644 --- a/source/dnode/mnode/impl/src/mndDb.c +++ b/source/dnode/mnode/impl/src/mndDb.c @@ -1309,7 +1309,7 @@ static int32_t mndGetDbMeta(SNodeMsg *pReq, SShowObj *pShow, STableMetaRsp *pMet cols++; pShow->bytes[cols] = 2; - pSchema[cols].type = TSDB_DATA_TYPE_SMALLINT; + pSchema[cols].type = TSDB_DATA_TYPE_INT; strcpy(pSchema[cols].name, "days"); pSchema[cols].bytes = pShow->bytes[cols]; cols++; @@ -1444,7 +1444,7 @@ static void dumpDbInfoToPayload(char *data, SDbObj *pDb, SShowObj *pShow, int32_ cols++; pWrite = getDataPosition(data, pShow, cols, rows, rowCapacity); - *(int16_t *)pWrite = pDb->cfg.daysPerFile; + *(int32_t *)pWrite = pDb->cfg.daysPerFile; cols++; pWrite = getDataPosition(data, pShow, cols, rows, rowCapacity); diff --git a/source/dnode/mnode/impl/src/mndInfoSchema.c b/source/dnode/mnode/impl/src/mndInfoSchema.c index ce08dfaaa3..fbea1b04e5 100644 --- a/source/dnode/mnode/impl/src/mndInfoSchema.c +++ b/source/dnode/mnode/impl/src/mndInfoSchema.c @@ -53,7 +53,7 @@ static const SInfosTableSchema userDBSchema[] = { {.name = "ntables", .bytes = 8, .type = TSDB_DATA_TYPE_BIGINT}, {.name = "replica", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT}, {.name = "quorum", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT}, - {.name = "days", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT}, + {.name = "days", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, {.name = "keep", .bytes = 24 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY}, {.name = "cache", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, {.name = "blocks", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, diff --git a/source/libs/parser/inc/parAst.h b/source/libs/parser/inc/parAst.h index 9ad089f38e..f8880eac72 100644 --- a/source/libs/parser/inc/parAst.h +++ b/source/libs/parser/inc/parAst.h @@ -71,6 +71,7 @@ typedef enum ETableOptionType { typedef struct SAlterOption { int32_t type; SToken val; + SNodeList* pKeep; } SAlterOption; extern SToken nil_token; @@ -121,6 +122,8 @@ SNode* createSetOperator(SAstCreateContext* pCxt, ESetOperatorType type, SNode* SNode* createDefaultDatabaseOptions(SAstCreateContext* pCxt); SNode* createDefaultAlterDatabaseOptions(SAstCreateContext* pCxt); SNode* setDatabaseOption(SAstCreateContext* pCxt, SNode* pOptions, EDatabaseOptionType type, const SToken* pVal); +SNode* setDatabaseKeepOption(SAstCreateContext* pCxt, SNode* pOptions, SNodeList* pKeep); +SNode* setDatabaseAlterOption(SAstCreateContext* pCxt, SNode* pOptions, SAlterOption* pAlterOption); SNode* createCreateDatabaseStmt(SAstCreateContext* pCxt, bool ignoreExists, SToken* pDbName, SNode* pOptions); SNode* createDropDatabaseStmt(SAstCreateContext* pCxt, bool ignoreNotExists, SToken* pDbName); SNode* createAlterDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName, SNode* pOptions); @@ -129,6 +132,8 @@ SNode* createDefaultAlterTableOptions(SAstCreateContext* pCxt); SNode* setTableOption(SAstCreateContext* pCxt, SNode* pOptions, ETableOptionType type, const SToken* pVal); SNode* setTableSmaOption(SAstCreateContext* pCxt, SNode* pOptions, SNodeList* pSma); SNode* setTableRollupOption(SAstCreateContext* pCxt, SNode* pOptions, SNodeList* pFuncs); +SNode* setTableKeepOption(SAstCreateContext* pCxt, SNode* pOptions, SNodeList* pKeep); +SNode* setTableAlterOption(SAstCreateContext* pCxt, SNode* pOptions, SAlterOption* pAlterOption); SNode* createColumnDefNode(SAstCreateContext* pCxt, const SToken* pColName, SDataType dataType, const SToken* pComment); SDataType createDataType(uint8_t type); SDataType createVarLenDataType(uint8_t type, const SToken* pLen); diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index b8e5df8708..e2b96b4a50 100644 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -137,7 +137,7 @@ db_options(A) ::= db_options(B) DAYS NK_INTEGER(C). db_options(A) ::= db_options(B) FSYNC NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_FSYNC, &C); } db_options(A) ::= db_options(B) MAXROWS NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_MAXROWS, &C); } db_options(A) ::= db_options(B) MINROWS NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_MINROWS, &C); } -db_options(A) ::= db_options(B) KEEP NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_KEEP, &C); } +db_options(A) ::= db_options(B) KEEP integer_list(C). { A = setDatabaseKeepOption(pCxt, B, C); } db_options(A) ::= db_options(B) PRECISION NK_STRING(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_PRECISION, &C); } db_options(A) ::= db_options(B) QUORUM NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_QUORUM, &C); } db_options(A) ::= db_options(B) REPLICA NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_REPLICA, &C); } @@ -148,19 +148,24 @@ db_options(A) ::= db_options(B) SINGLE_STABLE NK_INTEGER(C). db_options(A) ::= db_options(B) STREAM_MODE NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_STREAM_MODE, &C); } db_options(A) ::= db_options(B) RETENTIONS NK_STRING(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_RETENTIONS, &C); } -alter_db_options(A) ::= alter_db_option(B). { A = createDefaultAlterDatabaseOptions(pCxt); A = setDatabaseOption(pCxt, A, B.type, &B.val); } -alter_db_options(A) ::= alter_db_options(B) alter_db_option(C). { A = setDatabaseOption(pCxt, B, C.type, &C.val); } +alter_db_options(A) ::= alter_db_option(B). { A = createDefaultAlterDatabaseOptions(pCxt); A = setDatabaseAlterOption(pCxt, A, &B); } +alter_db_options(A) ::= alter_db_options(B) alter_db_option(C). { A = setDatabaseAlterOption(pCxt, B, &C); } %type alter_db_option { SAlterOption } %destructor alter_db_option { } alter_db_option(A) ::= BLOCKS NK_INTEGER(B). { A.type = DB_OPTION_BLOCKS; A.val = B; } alter_db_option(A) ::= FSYNC NK_INTEGER(B). { A.type = DB_OPTION_FSYNC; A.val = B; } -alter_db_option(A) ::= KEEP NK_INTEGER(B). { A.type = DB_OPTION_KEEP; A.val = B; } +alter_db_option(A) ::= KEEP integer_list(B). { A.type = DB_OPTION_KEEP; A.pKeep = B; } alter_db_option(A) ::= WAL NK_INTEGER(B). { A.type = DB_OPTION_WAL; A.val = B; } alter_db_option(A) ::= QUORUM NK_INTEGER(B). { A.type = DB_OPTION_QUORUM; A.val = B; } alter_db_option(A) ::= CACHELAST NK_INTEGER(B). { A.type = DB_OPTION_CACHELAST; A.val = B; } alter_db_option(A) ::= REPLICA NK_INTEGER(B). { A.type = DB_OPTION_REPLICA; A.val = B; } +%type integer_list { SNodeList* } +%destructor integer_list { nodesDestroyList($$); } +integer_list(A) ::= NK_INTEGER(B). { A = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &B)); } +integer_list(A) ::= integer_list(B) NK_COMMA NK_INTEGER(C). { A = addNodeToList(pCxt, B, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &C)); } + /************************************************ create/drop table/stable ********************************************/ cmd ::= CREATE TABLE not_exists_opt(A) full_table_name(B) NK_LP column_def_list(C) NK_RP tags_def_opt(D) table_options(E). { pCxt->pRootNode = createCreateTableStmt(pCxt, A, B, C, D, E); } @@ -260,20 +265,20 @@ tags_def(A) ::= TAGS NK_LP column_def_list(B) NK_RP. table_options(A) ::= . { A = createDefaultTableOptions(pCxt); } table_options(A) ::= table_options(B) COMMENT NK_STRING(C). { A = setTableOption(pCxt, B, TABLE_OPTION_COMMENT, &C); } -table_options(A) ::= table_options(B) KEEP NK_INTEGER(C). { A = setTableOption(pCxt, B, TABLE_OPTION_KEEP, &C); } +table_options(A) ::= table_options(B) KEEP integer_list(C). { A = setTableKeepOption(pCxt, B, C); } table_options(A) ::= table_options(B) TTL NK_INTEGER(C). { A = setTableOption(pCxt, B, TABLE_OPTION_TTL, &C); } table_options(A) ::= table_options(B) SMA NK_LP col_name_list(C) NK_RP. { A = setTableSmaOption(pCxt, B, C); } table_options(A) ::= table_options(B) ROLLUP NK_LP func_name_list(C) NK_RP. { A = setTableRollupOption(pCxt, B, C); } table_options(A) ::= table_options(B) FILE_FACTOR NK_FLOAT(C). { A = setTableOption(pCxt, B, TABLE_OPTION_FILE_FACTOR, &C); } table_options(A) ::= table_options(B) DELAY NK_INTEGER(C). { A = setTableOption(pCxt, B, TABLE_OPTION_DELAY, &C); } -alter_table_options(A) ::= alter_table_option(B). { A = createDefaultAlterTableOptions(pCxt); A = setTableOption(pCxt, A, B.type, &B.val); } -alter_table_options(A) ::= alter_table_options(B) alter_table_option(C). { A = setTableOption(pCxt, B, C.type, &C.val); } +alter_table_options(A) ::= alter_table_option(B). { A = createDefaultAlterTableOptions(pCxt); A = setTableAlterOption(pCxt, A, &B); } +alter_table_options(A) ::= alter_table_options(B) alter_table_option(C). { A = setTableAlterOption(pCxt, B, &C); } %type alter_table_option { SAlterOption } %destructor alter_table_option { } alter_table_option(A) ::= COMMENT NK_STRING(B). { A.type = TABLE_OPTION_COMMENT; A.val = B; } -alter_table_option(A) ::= KEEP NK_INTEGER(B). { A.type = TABLE_OPTION_KEEP; A.val = B; } +alter_table_option(A) ::= KEEP integer_list(B). { A.type = TABLE_OPTION_KEEP; A.pKeep = B; } alter_table_option(A) ::= TTL NK_INTEGER(B). { A.type = TABLE_OPTION_TTL; A.val = B; } %type col_name_list { SNodeList* } diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c index dd03a63759..0ebda70bbe 100644 --- a/source/libs/parser/src/parAstCreater.c +++ b/source/libs/parser/src/parAstCreater.c @@ -138,18 +138,6 @@ static SDatabaseOptions* setDbMinRows(SAstCreateContext* pCxt, SDatabaseOptions* return pOptions; } -static SDatabaseOptions* setDbKeep(SAstCreateContext* pCxt, SDatabaseOptions* pOptions, const SToken* pVal) { - int64_t val = strtol(pVal->z, NULL, 10); - if (val < TSDB_MIN_KEEP || val > TSDB_MAX_KEEP) { - snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, - "invalid db option keep: %"PRId64" valid range: [%d, %d]", val, TSDB_MIN_KEEP, TSDB_MAX_KEEP); - pCxt->valid = false; - return pOptions; - } - pOptions->keep = val; - return pOptions; -} - static SDatabaseOptions* setDbPrecision(SAstCreateContext* pCxt, SDatabaseOptions* pOptions, const SToken* pVal) { char val[10] = {0}; trimString(pVal->z, pVal->n, val, sizeof(val)); @@ -291,7 +279,6 @@ static void initSetDatabaseOptionFp() { setDbOptionFuncs[DB_OPTION_FSYNC] = setDbFsync; setDbOptionFuncs[DB_OPTION_MAXROWS] = setDbMaxRows; setDbOptionFuncs[DB_OPTION_MINROWS] = setDbMinRows; - setDbOptionFuncs[DB_OPTION_KEEP] = setDbKeep; setDbOptionFuncs[DB_OPTION_PRECISION] = setDbPrecision; setDbOptionFuncs[DB_OPTION_QUORUM] = setDbQuorum; setDbOptionFuncs[DB_OPTION_REPLICA] = setDbReplica; @@ -303,18 +290,6 @@ static void initSetDatabaseOptionFp() { setDbOptionFuncs[DB_OPTION_RETENTIONS] = setDbRetentions; } -static STableOptions* setTableKeep(SAstCreateContext* pCxt, STableOptions* pOptions, const SToken* pVal) { - int64_t val = strtol(pVal->z, NULL, 10); - if (val < TSDB_MIN_KEEP || val > TSDB_MAX_KEEP) { - snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, - "invalid table option keep: %"PRId64" valid range: [%d, %d]", val, TSDB_MIN_KEEP, TSDB_MAX_KEEP); - pCxt->valid = false; - return pOptions; - } - pOptions->keep = val; - return pOptions; -} - static STableOptions* setTableTtl(SAstCreateContext* pCxt, STableOptions* pOptions, const SToken* pVal) { int64_t val = strtol(pVal->z, NULL, 10); if (val < TSDB_MIN_DB_TTL_OPTION) { @@ -363,7 +338,6 @@ static STableOptions* setTableDelay(SAstCreateContext* pCxt, STableOptions* pOpt } static void initSetTableOptionFp() { - setTableOptionFuncs[TABLE_OPTION_KEEP] = setTableKeep; setTableOptionFuncs[TABLE_OPTION_TTL] = setTableTtl; setTableOptionFuncs[TABLE_OPTION_COMMENT] = setTableComment; setTableOptionFuncs[TABLE_OPTION_FILE_FACTOR] = setTableFileFactor; @@ -892,7 +866,9 @@ SNode* createDefaultDatabaseOptions(SAstCreateContext* pCxt) { pOptions->fsyncPeriod = TSDB_DEFAULT_FSYNC_PERIOD; pOptions->maxRowsPerBlock = TSDB_DEFAULT_MAX_ROW_FBLOCK; pOptions->minRowsPerBlock = TSDB_DEFAULT_MIN_ROW_FBLOCK; - pOptions->keep = TSDB_DEFAULT_KEEP; + pOptions->keep0 = TSDB_DEFAULT_KEEP; + pOptions->keep1 = TSDB_DEFAULT_KEEP; + pOptions->keep2 = TSDB_DEFAULT_KEEP; pOptions->precision = TSDB_TIME_PRECISION_MILLI; pOptions->quorum = TSDB_DEFAULT_DB_QUORUM_OPTION; pOptions->replica = TSDB_DEFAULT_DB_REPLICA_OPTION; @@ -915,7 +891,9 @@ SNode* createDefaultAlterDatabaseOptions(SAstCreateContext* pCxt) { pOptions->fsyncPeriod = -1; pOptions->maxRowsPerBlock = -1; pOptions->minRowsPerBlock = -1; - pOptions->keep = -1; + pOptions->keep0 = -1; + pOptions->keep1 = -1; + pOptions->keep2= -1; pOptions->precision = -1; pOptions->quorum = -1; pOptions->replica = -1; @@ -931,6 +909,48 @@ SNode* setDatabaseOption(SAstCreateContext* pCxt, SNode* pOptions, EDatabaseOpti return (SNode*)setDbOptionFuncs[type](pCxt, (SDatabaseOptions*)pOptions, pVal); } +static bool checkAndSetKeepOption(SAstCreateContext* pCxt, SNodeList* pKeep, int32_t* pKeep0, int32_t* pKeep1, int32_t* pKeep2) { + int32_t numOfKeep = LIST_LENGTH(pKeep); + if (numOfKeep > 3 || numOfKeep < 1) { + snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, "invalid number of keep options"); + return false; + } + + int32_t daysToKeep0 = strtol(((SValueNode*)nodesListGetNode(pKeep, 0))->literal, NULL, 10); + int32_t daysToKeep1 = numOfKeep > 1 ? strtol(((SValueNode*)nodesListGetNode(pKeep, 1))->literal, NULL, 10) : daysToKeep0; + int32_t daysToKeep2 = numOfKeep > 2 ? strtol(((SValueNode*)nodesListGetNode(pKeep, 2))->literal, NULL, 10) : daysToKeep1; + if (daysToKeep0 < TSDB_MIN_KEEP || daysToKeep1 < TSDB_MIN_KEEP || daysToKeep2 < TSDB_MIN_KEEP || + daysToKeep0 > TSDB_MAX_KEEP || daysToKeep1 > TSDB_MAX_KEEP || daysToKeep2 > TSDB_MAX_KEEP) { + snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, + "invalid option keep: %"PRId64", %"PRId64", %"PRId64" valid range: [%d, %d]", daysToKeep0, daysToKeep1, daysToKeep2, TSDB_MIN_KEEP, TSDB_MAX_KEEP); + return false; + } + + if (!((daysToKeep0 <= daysToKeep1) && (daysToKeep1 <= daysToKeep2))) { + snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, "invalid keep value, should be keep0 <= keep1 <= keep2"); + return false; + } + + *pKeep0 = daysToKeep0; + *pKeep1 = daysToKeep1; + *pKeep2 = daysToKeep2; + return true; +} + +SNode* setDatabaseKeepOption(SAstCreateContext* pCxt, SNode* pOptions, SNodeList* pKeep) { + SDatabaseOptions* pOp = (SDatabaseOptions*)pOptions; + pCxt->valid = checkAndSetKeepOption(pCxt, pKeep, &pOp->keep0, &pOp->keep1, &pOp->keep2); + return pOptions; +} + +SNode* setDatabaseAlterOption(SAstCreateContext* pCxt, SNode* pOptions, SAlterOption* pAlterOption) { + if (DB_OPTION_KEEP == pAlterOption->type) { + return setDatabaseKeepOption(pCxt, pOptions, pAlterOption->pKeep); + } else { + return setDatabaseOption(pCxt, pOptions, pAlterOption->type, &pAlterOption->val); + } +} + SNode* createCreateDatabaseStmt(SAstCreateContext* pCxt, bool ignoreExists, SToken* pDbName, SNode* pOptions) { if (!checkDbName(pCxt, pDbName, false)) { return NULL; @@ -968,7 +988,9 @@ SNode* createAlterDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName, SNode* SNode* createDefaultTableOptions(SAstCreateContext* pCxt) { STableOptions* pOptions = nodesMakeNode(QUERY_NODE_TABLE_OPTIONS); CHECK_OUT_OF_MEM(pOptions); - pOptions->keep = TSDB_DEFAULT_KEEP; + pOptions->keep0 = TSDB_DEFAULT_KEEP; + pOptions->keep1 = TSDB_DEFAULT_KEEP; + pOptions->keep2 = TSDB_DEFAULT_KEEP; pOptions->ttl = TSDB_DEFAULT_DB_TTL_OPTION; pOptions->filesFactor = TSDB_DEFAULT_DB_FILE_FACTOR; pOptions->delay = TSDB_DEFAULT_DB_DELAY; @@ -978,7 +1000,9 @@ SNode* createDefaultTableOptions(SAstCreateContext* pCxt) { SNode* createDefaultAlterTableOptions(SAstCreateContext* pCxt) { STableOptions* pOptions = nodesMakeNode(QUERY_NODE_TABLE_OPTIONS); CHECK_OUT_OF_MEM(pOptions); - pOptions->keep = -1; + pOptions->keep0 = -1; + pOptions->keep1 = -1; + pOptions->keep2 = -1; pOptions->ttl = -1; pOptions->filesFactor = -1; pOptions->delay = -1; @@ -1004,6 +1028,20 @@ SNode* setTableRollupOption(SAstCreateContext* pCxt, SNode* pOptions, SNodeList* return pOptions; } +SNode* setTableKeepOption(SAstCreateContext* pCxt, SNode* pOptions, SNodeList* pKeep) { + STableOptions* pOp = (STableOptions*)pOptions; + pCxt->valid = checkAndSetKeepOption(pCxt, pKeep, &pOp->keep0, &pOp->keep1, &pOp->keep2); + return pOptions; +} + +SNode* setTableAlterOption(SAstCreateContext* pCxt, SNode* pOptions, SAlterOption* pAlterOption) { + if (TABLE_OPTION_KEEP == pAlterOption->type) { + return setTableKeepOption(pCxt, pOptions, pAlterOption->pKeep); + } else { + return setTableOption(pCxt, pOptions, pAlterOption->type, &pAlterOption->val); + } +} + SNode* createColumnDefNode(SAstCreateContext* pCxt, const SToken* pColName, SDataType dataType, const SToken* pComment) { SColumnDefNode* pCol = (SColumnDefNode*)nodesMakeNode(QUERY_NODE_COLUMN_DEF); CHECK_OUT_OF_MEM(pCol); diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 0ea865882a..2a5fa5fdfe 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -956,9 +956,9 @@ static int32_t buildCreateDbReq(STranslateContext* pCxt, SCreateDatabaseStmt* pS pReq->cacheBlockSize = pStmt->pOptions->cacheBlockSize; pReq->totalBlocks = pStmt->pOptions->numOfBlocks; pReq->daysPerFile = pStmt->pOptions->daysPerFile; - pReq->daysToKeep0 = pStmt->pOptions->keep; - pReq->daysToKeep1 = -1; - pReq->daysToKeep2 = -1; + pReq->daysToKeep0 = pStmt->pOptions->keep0; + pReq->daysToKeep1 = pStmt->pOptions->keep1; + pReq->daysToKeep2 = pStmt->pOptions->keep2; pReq->minRows = pStmt->pOptions->minRowsPerBlock; pReq->maxRows = pStmt->pOptions->maxRowsPerBlock; pReq->commitTime = -1; @@ -1041,9 +1041,9 @@ static void buildAlterDbReq(STranslateContext* pCxt, SAlterDatabaseStmt* pStmt, tNameSetDbName(&name, pCxt->pParseCxt->acctId, pStmt->dbName, strlen(pStmt->dbName)); tNameGetFullDbName(&name, pReq->db); pReq->totalBlocks = pStmt->pOptions->numOfBlocks; - pReq->daysToKeep0 = pStmt->pOptions->keep; - pReq->daysToKeep1 = -1; - pReq->daysToKeep2 = -1; + pReq->daysToKeep0 = pStmt->pOptions->keep0; + pReq->daysToKeep1 = pStmt->pOptions->keep1; + pReq->daysToKeep2 = pStmt->pOptions->keep2; pReq->fsyncPeriod = pStmt->pOptions->fsyncPeriod; pReq->walLevel = pStmt->pOptions->walLevel; pReq->quorum = pStmt->pOptions->quorum; diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index e94ef34783..1252943f6e 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 277 +#define YYNOCODE 278 #define YYACTIONTYPE unsigned short int #define ParseTOKENTYPE SToken typedef union { int yyinit; ParseTOKENTYPE yy0; - EFillMode yy6; - EJoinType yy10; - SNode* yy46; - SToken yy95; - SAlterOption yy145; - bool yy151; - SNodeList* yy194; - int32_t yy202; - ENullOrder yy273; - EOperatorType yy292; - SDataType yy400; - EOrder yy456; + SNode* yy24; + EOperatorType yy36; + ENullOrder yy45; + int32_t yy104; + SDataType yy212; + bool yy265; + EJoinType yy320; + SToken yy337; + EOrder yy346; + SNodeList* yy504; + 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 446 -#define YYNRULE 358 +#define YYNSTATE 451 +#define YYNRULE 360 #define YYNTOKEN 179 -#define YY_MAX_SHIFT 445 -#define YY_MIN_SHIFTREDUCE 693 -#define YY_MAX_SHIFTREDUCE 1050 -#define YY_ERROR_ACTION 1051 -#define YY_ACCEPT_ACTION 1052 -#define YY_NO_ACTION 1053 -#define YY_MIN_REDUCE 1054 -#define YY_MAX_REDUCE 1411 +#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 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -209,417 +209,417 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (1331) +#define YY_ACTTAB_COUNT (1316) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 1268, 345, 24, 174, 364, 364, 258, 243, 1264, 1271, - /* 10 */ 1234, 1235, 31, 29, 27, 26, 25, 1281, 377, 377, - /* 20 */ 9, 8, 95, 69, 69, 31, 29, 27, 26, 25, - /* 30 */ 293, 299, 345, 1390, 108, 62, 1066, 1297, 377, 1158, - /* 40 */ 1158, 349, 1149, 262, 361, 96, 120, 217, 1097, 251, - /* 50 */ 1388, 93, 1150, 95, 363, 376, 1225, 1227, 1255, 1158, - /* 60 */ 217, 167, 1336, 344, 112, 343, 1100, 46, 1390, 926, - /* 70 */ 65, 1282, 1283, 1286, 1329, 1198, 92, 956, 233, 1325, - /* 80 */ 1402, 120, 93, 1255, 1153, 1388, 109, 1124, 969, 1363, - /* 90 */ 956, 347, 116, 1336, 1337, 272, 1341, 430, 429, 428, - /* 100 */ 427, 426, 425, 424, 423, 422, 421, 420, 419, 418, - /* 110 */ 417, 416, 415, 414, 413, 306, 957, 301, 376, 730, - /* 120 */ 305, 729, 911, 304, 1052, 302, 300, 81, 303, 957, - /* 130 */ 80, 79, 78, 77, 76, 75, 74, 73, 72, 731, - /* 140 */ 126, 125, 23, 238, 951, 952, 953, 954, 955, 959, - /* 150 */ 960, 961, 27, 26, 25, 23, 238, 951, 952, 953, - /* 160 */ 954, 955, 959, 960, 961, 1281, 12, 284, 31, 29, - /* 170 */ 27, 26, 25, 255, 803, 400, 399, 398, 807, 397, - /* 180 */ 809, 810, 396, 812, 393, 1297, 818, 390, 820, 821, - /* 190 */ 387, 384, 361, 31, 29, 27, 26, 25, 231, 1205, - /* 200 */ 1390, 352, 363, 1077, 30, 28, 1255, 257, 1281, 256, - /* 210 */ 1226, 349, 240, 120, 891, 1268, 1390, 1388, 64, 1282, - /* 220 */ 1283, 1286, 1329, 1264, 1270, 926, 216, 1325, 1297, 1389, - /* 230 */ 889, 46, 121, 1388, 376, 348, 334, 377, 1390, 11, - /* 240 */ 247, 246, 263, 297, 1255, 363, 1222, 296, 1154, 1255, - /* 250 */ 904, 120, 121, 124, 1281, 1388, 121, 1076, 1158, 913, - /* 260 */ 1, 65, 1282, 1283, 1286, 1329, 897, 377, 298, 233, - /* 270 */ 1325, 115, 283, 264, 1297, 340, 336, 30, 28, 993, - /* 280 */ 248, 361, 12, 170, 442, 240, 6, 891, 1158, 327, - /* 290 */ 1356, 363, 30, 28, 1297, 1255, 890, 1268, 1255, 215, - /* 300 */ 240, 361, 891, 889, 1047, 1264, 1270, 66, 1282, 1283, - /* 310 */ 1286, 1329, 11, 1055, 1075, 1328, 1325, 339, 889, 1017, - /* 320 */ 378, 915, 892, 320, 895, 896, 206, 11, 939, 335, - /* 330 */ 1074, 121, 900, 1, 81, 438, 437, 80, 79, 78, - /* 340 */ 77, 76, 75, 74, 73, 72, 121, 1136, 1, 1054, - /* 350 */ 331, 1015, 1016, 1018, 1019, 1255, 1046, 442, 905, 1297, - /* 360 */ 908, 896, 377, 321, 1073, 1281, 361, 1155, 351, 890, - /* 370 */ 914, 1255, 442, 90, 89, 88, 87, 86, 85, 84, - /* 380 */ 83, 82, 1343, 1158, 890, 1297, 1343, 1134, 1281, 412, - /* 390 */ 1390, 1072, 348, 284, 338, 892, 988, 895, 896, 206, - /* 400 */ 1340, 939, 363, 120, 1339, 1255, 1255, 1388, 1297, 912, - /* 410 */ 892, 1281, 895, 896, 206, 361, 939, 1071, 65, 1282, - /* 420 */ 1283, 1286, 1329, 169, 1205, 363, 233, 1325, 115, 1255, - /* 430 */ 230, 1297, 1255, 412, 345, 1203, 1343, 729, 361, 992, - /* 440 */ 1070, 65, 1282, 1283, 1286, 1329, 55, 1357, 363, 233, - /* 450 */ 1325, 1402, 1255, 291, 1338, 95, 958, 916, 1255, 356, - /* 460 */ 1386, 30, 28, 1151, 65, 1282, 1283, 1286, 1329, 240, - /* 470 */ 1281, 891, 233, 1325, 1402, 1135, 318, 107, 30, 28, - /* 480 */ 362, 1255, 21, 1347, 93, 1161, 240, 889, 891, 316, - /* 490 */ 1297, 962, 30, 28, 117, 1336, 1337, 361, 1341, 403, - /* 500 */ 240, 1069, 891, 194, 889, 244, 1188, 363, 1068, 377, - /* 510 */ 1065, 1255, 141, 107, 374, 139, 349, 7, 889, 143, - /* 520 */ 1064, 1160, 142, 207, 1282, 1283, 1286, 323, 224, 1205, - /* 530 */ 1158, 1067, 409, 1063, 7, 245, 408, 30, 28, 101, - /* 540 */ 1203, 442, 1255, 1390, 1205, 240, 1125, 891, 7, 1255, - /* 550 */ 297, 1255, 357, 890, 296, 1204, 120, 410, 442, 155, - /* 560 */ 1388, 1255, 1147, 889, 225, 1000, 223, 222, 1281, 295, - /* 570 */ 890, 913, 442, 1143, 1255, 298, 407, 406, 405, 892, - /* 580 */ 404, 895, 896, 206, 890, 939, 145, 377, 1297, 144, - /* 590 */ 991, 1281, 375, 1, 353, 361, 892, 1145, 895, 896, - /* 600 */ 206, 147, 939, 121, 146, 363, 1348, 988, 1158, 1255, - /* 610 */ 892, 1297, 895, 896, 206, 377, 939, 442, 361, 250, - /* 620 */ 188, 66, 1282, 1283, 1286, 1329, 1141, 107, 363, 890, - /* 630 */ 1326, 1205, 1255, 199, 1062, 1160, 1158, 252, 201, 9, - /* 640 */ 8, 1061, 1203, 1281, 66, 1282, 1283, 1286, 1329, 1281, - /* 650 */ 200, 345, 359, 1325, 1281, 892, 402, 895, 896, 206, - /* 660 */ 127, 939, 938, 1297, 940, 941, 942, 943, 944, 1297, - /* 670 */ 361, 1014, 95, 377, 1297, 1255, 361, 1060, 254, 899, - /* 680 */ 363, 361, 1255, 42, 1255, 354, 363, 1059, 1058, 171, - /* 690 */ 1255, 363, 1093, 239, 1158, 1255, 110, 1282, 1283, 1286, - /* 700 */ 1281, 93, 211, 1282, 1283, 1286, 1281, 110, 1282, 1283, - /* 710 */ 1286, 118, 1336, 1337, 307, 1341, 253, 1057, 1255, 160, - /* 720 */ 1297, 67, 1049, 1050, 107, 360, 1297, 361, 1255, 1255, - /* 730 */ 1281, 158, 1160, 361, 350, 1403, 891, 363, 44, 43, - /* 740 */ 261, 1255, 122, 363, 328, 902, 1404, 1255, 332, 1199, - /* 750 */ 1297, 164, 889, 211, 1282, 1283, 1286, 361, 1255, 210, - /* 760 */ 1282, 1283, 1286, 911, 963, 923, 1275, 363, 1281, 121, - /* 770 */ 265, 1255, 1088, 277, 237, 898, 32, 32, 1273, 445, - /* 780 */ 875, 290, 278, 211, 1282, 1283, 1286, 20, 1297, 1359, - /* 790 */ 1298, 341, 32, 191, 309, 361, 91, 31, 29, 27, - /* 800 */ 26, 25, 434, 22, 190, 363, 442, 1086, 179, 1255, - /* 810 */ 948, 1281, 241, 31, 29, 27, 26, 25, 890, 346, - /* 820 */ 177, 211, 1282, 1283, 1286, 369, 61, 63, 185, 312, - /* 830 */ 186, 1297, 173, 796, 2, 884, 57, 98, 361, 791, - /* 840 */ 99, 901, 1281, 192, 892, 101, 895, 896, 363, 911, - /* 850 */ 276, 42, 1255, 271, 270, 269, 268, 267, 824, 1224, - /* 860 */ 123, 373, 1297, 828, 209, 1282, 1283, 1286, 834, 361, - /* 870 */ 382, 266, 833, 1281, 273, 99, 275, 279, 326, 363, - /* 880 */ 100, 151, 1281, 1255, 101, 919, 31, 29, 27, 26, - /* 890 */ 25, 102, 274, 1297, 280, 212, 1282, 1283, 1286, 128, - /* 900 */ 361, 918, 1297, 99, 1281, 282, 281, 131, 45, 361, - /* 910 */ 363, 285, 917, 1281, 1255, 134, 292, 294, 1148, 363, - /* 920 */ 229, 138, 1144, 1255, 1297, 150, 204, 1282, 1283, 1286, - /* 930 */ 140, 361, 103, 1297, 1133, 213, 1282, 1283, 1286, 71, - /* 940 */ 361, 363, 104, 1281, 1146, 1255, 1142, 325, 105, 106, - /* 950 */ 363, 1281, 153, 322, 1255, 916, 367, 205, 1282, 1283, - /* 960 */ 1286, 324, 333, 1297, 1370, 896, 214, 1282, 1283, 1286, - /* 970 */ 361, 1297, 156, 330, 1281, 1360, 232, 1369, 361, 159, - /* 980 */ 363, 5, 342, 1350, 1255, 337, 94, 329, 363, 4, - /* 990 */ 163, 409, 1255, 113, 1297, 408, 1294, 1282, 1283, 1286, - /* 1000 */ 988, 361, 915, 33, 1293, 1282, 1283, 1286, 1344, 166, - /* 1010 */ 234, 363, 165, 1281, 358, 1255, 410, 355, 17, 365, - /* 1020 */ 1311, 1281, 1233, 370, 181, 1405, 1232, 1292, 1282, 1283, - /* 1030 */ 1286, 366, 242, 1297, 371, 407, 406, 405, 1387, 404, - /* 1040 */ 361, 1297, 183, 172, 1281, 372, 193, 54, 361, 1159, - /* 1050 */ 363, 56, 1281, 189, 1255, 311, 380, 195, 363, 441, - /* 1060 */ 202, 197, 1255, 203, 1297, 39, 220, 1282, 1283, 1286, - /* 1070 */ 319, 361, 1297, 198, 219, 1282, 1283, 1286, 1249, 361, - /* 1080 */ 887, 363, 886, 1281, 149, 1255, 259, 314, 1243, 363, - /* 1090 */ 1242, 260, 308, 1255, 1241, 148, 1240, 221, 1282, 1283, - /* 1100 */ 1286, 858, 1217, 1297, 1216, 218, 1282, 1283, 1286, 97, - /* 1110 */ 361, 1215, 1214, 1213, 1212, 1211, 1210, 860, 41, 136, - /* 1120 */ 363, 40, 114, 1209, 1255, 1208, 1207, 1206, 289, 1099, - /* 1130 */ 135, 1239, 1230, 1137, 130, 742, 208, 1282, 1283, 1286, - /* 1140 */ 1098, 1096, 287, 286, 288, 1085, 1084, 306, 1081, 301, - /* 1150 */ 1139, 70, 305, 47, 137, 304, 133, 302, 300, 841, - /* 1160 */ 303, 839, 840, 1138, 1094, 226, 771, 1089, 770, 227, - /* 1170 */ 1087, 228, 769, 768, 767, 766, 765, 1080, 315, 1079, - /* 1180 */ 317, 310, 313, 1238, 1237, 68, 36, 1229, 48, 154, - /* 1190 */ 3, 32, 14, 15, 152, 34, 10, 51, 37, 162, - /* 1200 */ 19, 8, 1273, 132, 368, 949, 1228, 129, 1053, 184, - /* 1210 */ 1053, 835, 1035, 1034, 235, 1053, 1039, 1053, 1038, 236, - /* 1220 */ 1053, 157, 1013, 111, 906, 161, 1053, 1053, 1007, 49, - /* 1230 */ 1053, 1006, 1053, 1053, 50, 35, 1053, 985, 984, 1053, - /* 1240 */ 168, 1040, 1053, 182, 1053, 381, 249, 1053, 1053, 1053, - /* 1250 */ 832, 119, 385, 13, 16, 924, 18, 388, 176, 1011, - /* 1260 */ 178, 391, 175, 180, 52, 53, 802, 394, 1095, 57, - /* 1270 */ 1053, 38, 1053, 825, 1272, 830, 444, 836, 187, 822, - /* 1280 */ 379, 383, 762, 386, 831, 754, 819, 1083, 389, 761, - /* 1290 */ 760, 813, 392, 759, 811, 740, 758, 757, 395, 817, - /* 1300 */ 756, 411, 755, 753, 752, 751, 58, 431, 750, 59, - /* 1310 */ 60, 1082, 749, 748, 747, 433, 746, 745, 401, 432, - /* 1320 */ 816, 1078, 435, 436, 439, 440, 815, 893, 196, 814, - /* 1330 */ 443, + /* 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, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 223, 188, 240, 241, 219, 219, 228, 222, 231, 232, - /* 10 */ 225, 225, 12, 13, 14, 15, 16, 182, 188, 188, - /* 20 */ 1, 2, 209, 193, 193, 12, 13, 14, 15, 16, - /* 30 */ 200, 200, 188, 255, 181, 187, 183, 202, 188, 209, - /* 40 */ 209, 228, 182, 193, 209, 197, 268, 47, 0, 211, - /* 50 */ 272, 238, 204, 209, 219, 20, 218, 219, 223, 209, - /* 60 */ 47, 248, 249, 250, 201, 252, 0, 190, 255, 69, - /* 70 */ 235, 236, 237, 238, 239, 212, 199, 77, 243, 244, - /* 80 */ 245, 268, 238, 223, 207, 272, 191, 192, 69, 254, - /* 90 */ 77, 247, 248, 249, 250, 63, 252, 49, 50, 51, + /* 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, 49, 116, 51, 20, 20, - /* 120 */ 54, 22, 20, 57, 179, 59, 60, 21, 62, 116, - /* 130 */ 24, 25, 26, 27, 28, 29, 30, 31, 32, 40, - /* 140 */ 108, 109, 142, 143, 144, 145, 146, 147, 148, 149, - /* 150 */ 150, 151, 14, 15, 16, 142, 143, 144, 145, 146, - /* 160 */ 147, 148, 149, 150, 151, 182, 68, 46, 12, 13, - /* 170 */ 14, 15, 16, 228, 83, 84, 85, 86, 87, 88, - /* 180 */ 89, 90, 91, 92, 93, 202, 95, 96, 97, 98, - /* 190 */ 99, 100, 209, 12, 13, 14, 15, 16, 206, 202, - /* 200 */ 255, 3, 219, 182, 12, 13, 223, 129, 182, 131, - /* 210 */ 213, 228, 20, 268, 22, 223, 255, 272, 235, 236, - /* 220 */ 237, 238, 239, 231, 232, 69, 243, 244, 202, 268, - /* 230 */ 38, 190, 154, 272, 20, 209, 120, 188, 255, 47, - /* 240 */ 12, 13, 193, 57, 223, 219, 209, 61, 207, 223, - /* 250 */ 22, 268, 154, 216, 182, 272, 154, 182, 209, 20, - /* 260 */ 68, 235, 236, 237, 238, 239, 38, 188, 82, 243, - /* 270 */ 244, 245, 193, 188, 202, 159, 160, 12, 13, 14, - /* 280 */ 206, 209, 68, 257, 92, 20, 43, 22, 209, 263, - /* 290 */ 264, 219, 12, 13, 202, 223, 104, 223, 223, 214, - /* 300 */ 20, 209, 22, 38, 123, 231, 232, 235, 236, 237, - /* 310 */ 238, 239, 47, 0, 182, 243, 244, 20, 38, 132, - /* 320 */ 92, 20, 130, 188, 132, 133, 134, 47, 136, 237, - /* 330 */ 182, 154, 104, 68, 21, 185, 186, 24, 25, 26, - /* 340 */ 27, 28, 29, 30, 31, 32, 154, 0, 68, 0, - /* 350 */ 163, 164, 165, 166, 167, 223, 175, 92, 130, 202, - /* 360 */ 132, 133, 188, 228, 182, 182, 209, 193, 170, 104, - /* 370 */ 20, 223, 92, 24, 25, 26, 27, 28, 29, 30, - /* 380 */ 31, 32, 233, 209, 104, 202, 233, 0, 182, 46, - /* 390 */ 255, 182, 209, 46, 237, 130, 153, 132, 133, 134, - /* 400 */ 251, 136, 219, 268, 251, 223, 223, 272, 202, 20, - /* 410 */ 130, 182, 132, 133, 134, 209, 136, 182, 235, 236, - /* 420 */ 237, 238, 239, 122, 202, 219, 243, 244, 245, 223, - /* 430 */ 208, 202, 223, 46, 188, 213, 233, 22, 209, 4, - /* 440 */ 182, 235, 236, 237, 238, 239, 187, 264, 219, 243, - /* 450 */ 244, 245, 223, 38, 251, 209, 116, 20, 223, 81, - /* 460 */ 254, 12, 13, 204, 235, 236, 237, 238, 239, 20, - /* 470 */ 182, 22, 243, 244, 245, 0, 21, 202, 12, 13, - /* 480 */ 14, 223, 142, 254, 238, 210, 20, 38, 22, 34, - /* 490 */ 202, 151, 12, 13, 248, 249, 250, 209, 252, 79, - /* 500 */ 20, 182, 22, 195, 38, 194, 198, 219, 182, 188, - /* 510 */ 182, 223, 72, 202, 193, 75, 228, 68, 38, 72, - /* 520 */ 182, 210, 75, 235, 236, 237, 238, 69, 35, 202, - /* 530 */ 209, 183, 57, 182, 68, 208, 61, 12, 13, 81, - /* 540 */ 213, 92, 223, 255, 202, 20, 192, 22, 68, 223, - /* 550 */ 57, 223, 174, 104, 61, 213, 268, 82, 92, 122, - /* 560 */ 272, 223, 203, 38, 71, 14, 73, 74, 182, 76, - /* 570 */ 104, 20, 92, 203, 223, 82, 101, 102, 103, 130, - /* 580 */ 105, 132, 133, 134, 104, 136, 72, 188, 202, 75, - /* 590 */ 155, 182, 193, 68, 81, 209, 130, 203, 132, 133, - /* 600 */ 134, 72, 136, 154, 75, 219, 152, 153, 209, 223, - /* 610 */ 130, 202, 132, 133, 134, 188, 136, 92, 209, 194, - /* 620 */ 193, 235, 236, 237, 238, 239, 203, 202, 219, 104, - /* 630 */ 244, 202, 223, 18, 182, 210, 209, 208, 23, 1, - /* 640 */ 2, 182, 213, 182, 235, 236, 237, 238, 239, 182, - /* 650 */ 35, 188, 243, 244, 182, 130, 203, 132, 133, 134, - /* 660 */ 45, 136, 135, 202, 137, 138, 139, 140, 141, 202, - /* 670 */ 209, 69, 209, 188, 202, 223, 209, 182, 193, 38, - /* 680 */ 219, 209, 223, 81, 223, 172, 219, 182, 182, 275, - /* 690 */ 223, 219, 0, 226, 209, 223, 235, 236, 237, 238, - /* 700 */ 182, 238, 235, 236, 237, 238, 182, 235, 236, 237, - /* 710 */ 238, 248, 249, 250, 22, 252, 194, 182, 223, 69, - /* 720 */ 202, 106, 177, 178, 202, 47, 202, 209, 223, 223, - /* 730 */ 182, 81, 210, 209, 273, 274, 22, 219, 123, 124, - /* 740 */ 125, 223, 127, 219, 226, 104, 274, 223, 266, 212, - /* 750 */ 202, 260, 38, 235, 236, 237, 238, 209, 223, 235, - /* 760 */ 236, 237, 238, 20, 69, 69, 68, 219, 182, 154, - /* 770 */ 27, 223, 0, 30, 226, 38, 81, 81, 80, 19, - /* 780 */ 69, 185, 39, 235, 236, 237, 238, 2, 202, 234, - /* 790 */ 202, 267, 81, 33, 22, 209, 36, 12, 13, 14, - /* 800 */ 15, 16, 42, 2, 44, 219, 92, 0, 69, 223, - /* 810 */ 132, 182, 226, 12, 13, 14, 15, 16, 104, 253, - /* 820 */ 81, 235, 236, 237, 238, 69, 68, 67, 69, 22, - /* 830 */ 70, 202, 269, 69, 256, 128, 78, 81, 209, 69, - /* 840 */ 81, 104, 182, 229, 130, 81, 132, 133, 219, 20, - /* 850 */ 107, 81, 223, 110, 111, 112, 113, 114, 69, 188, - /* 860 */ 115, 101, 202, 69, 235, 236, 237, 238, 69, 209, - /* 870 */ 81, 217, 69, 182, 215, 81, 215, 188, 118, 219, - /* 880 */ 81, 121, 182, 223, 81, 20, 12, 13, 14, 15, - /* 890 */ 16, 69, 116, 202, 227, 235, 236, 237, 238, 190, - /* 900 */ 209, 20, 202, 81, 182, 220, 209, 190, 190, 209, - /* 910 */ 219, 188, 20, 182, 223, 190, 184, 202, 202, 219, - /* 920 */ 184, 202, 202, 223, 202, 187, 235, 236, 237, 238, - /* 930 */ 202, 209, 202, 202, 0, 235, 236, 237, 238, 188, - /* 940 */ 209, 219, 202, 182, 202, 223, 202, 220, 202, 202, - /* 950 */ 219, 182, 187, 227, 223, 20, 161, 235, 236, 237, - /* 960 */ 238, 209, 162, 202, 265, 133, 235, 236, 237, 238, - /* 970 */ 209, 202, 224, 223, 182, 234, 223, 265, 209, 224, - /* 980 */ 219, 169, 168, 262, 223, 223, 209, 157, 219, 156, - /* 990 */ 261, 57, 223, 259, 202, 61, 235, 236, 237, 238, - /* 1000 */ 153, 209, 20, 115, 235, 236, 237, 238, 233, 246, - /* 1010 */ 176, 219, 258, 182, 173, 223, 82, 171, 68, 223, - /* 1020 */ 242, 182, 224, 119, 209, 276, 224, 235, 236, 237, - /* 1030 */ 238, 223, 223, 202, 221, 101, 102, 103, 271, 105, - /* 1040 */ 209, 202, 187, 270, 182, 220, 198, 187, 209, 209, - /* 1050 */ 219, 68, 182, 187, 223, 4, 205, 188, 219, 184, - /* 1060 */ 196, 189, 223, 196, 202, 230, 235, 236, 237, 238, - /* 1070 */ 19, 209, 202, 180, 235, 236, 237, 238, 0, 209, - /* 1080 */ 104, 219, 130, 182, 33, 223, 50, 36, 0, 219, - /* 1090 */ 0, 126, 41, 223, 0, 44, 0, 235, 236, 237, - /* 1100 */ 238, 80, 0, 202, 0, 235, 236, 237, 238, 115, - /* 1110 */ 209, 0, 0, 0, 0, 0, 0, 22, 67, 33, - /* 1120 */ 219, 70, 36, 0, 223, 0, 0, 0, 42, 0, - /* 1130 */ 44, 0, 0, 0, 43, 48, 235, 236, 237, 238, - /* 1140 */ 0, 0, 36, 38, 43, 0, 0, 49, 0, 51, - /* 1150 */ 0, 77, 54, 67, 75, 57, 70, 59, 60, 38, - /* 1160 */ 62, 22, 38, 0, 0, 22, 38, 0, 38, 22, - /* 1170 */ 0, 22, 38, 38, 38, 38, 38, 0, 22, 0, - /* 1180 */ 22, 39, 38, 0, 0, 20, 122, 0, 68, 117, - /* 1190 */ 81, 81, 158, 158, 43, 152, 158, 4, 81, 81, - /* 1200 */ 81, 2, 80, 117, 120, 132, 0, 121, 277, 117, - /* 1210 */ 277, 104, 38, 38, 38, 277, 38, 277, 38, 38, - /* 1220 */ 277, 69, 69, 68, 22, 68, 277, 277, 69, 68, - /* 1230 */ 277, 69, 277, 277, 68, 81, 277, 69, 69, 277, - /* 1240 */ 80, 69, 277, 43, 277, 38, 38, 277, 277, 277, - /* 1250 */ 38, 80, 38, 68, 81, 69, 68, 38, 69, 69, - /* 1260 */ 68, 38, 80, 68, 68, 68, 22, 38, 0, 78, - /* 1270 */ 277, 68, 277, 69, 80, 22, 20, 38, 80, 69, - /* 1280 */ 79, 68, 22, 68, 38, 22, 69, 0, 68, 38, - /* 1290 */ 38, 69, 68, 38, 69, 48, 38, 38, 68, 94, - /* 1300 */ 38, 47, 38, 38, 38, 38, 68, 38, 38, 68, - /* 1310 */ 68, 0, 38, 38, 38, 43, 38, 38, 82, 36, - /* 1320 */ 94, 0, 38, 37, 22, 21, 94, 22, 22, 94, - /* 1330 */ 21, 277, 277, 277, 277, 277, 277, 277, 277, 277, - /* 1340 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, - /* 1350 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, - /* 1360 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, - /* 1370 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, - /* 1380 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, - /* 1390 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, - /* 1400 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, - /* 1410 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, - /* 1420 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, - /* 1430 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, - /* 1440 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, - /* 1450 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, - /* 1460 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, - /* 1470 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, - /* 1480 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, - /* 1490 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, - /* 1500 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, + /* 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, }; -#define YY_SHIFT_COUNT (445) +#define YY_SHIFT_COUNT (450) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (1321) +#define YY_SHIFT_MAX (1308) static const unsigned short int yy_shift_ofst[] = { - /* 0 */ 615, 192, 265, 280, 280, 280, 280, 449, 280, 280, - /* 10 */ 480, 525, 98, 466, 480, 480, 480, 480, 480, 480, - /* 20 */ 480, 480, 480, 480, 480, 480, 480, 480, 480, 480, - /* 30 */ 480, 480, 480, 214, 214, 214, 102, 228, 228, 78, - /* 40 */ 35, 35, 228, 35, 35, 35, 35, 121, 239, 297, - /* 50 */ 297, 177, 350, 239, 35, 35, 239, 35, 239, 350, - /* 60 */ 239, 239, 35, 343, 0, 13, 13, 743, 106, 493, - /* 70 */ 714, 1098, 714, 714, 714, 714, 714, 714, 714, 714, - /* 80 */ 714, 714, 714, 714, 714, 714, 714, 714, 714, 714, - /* 90 */ 714, 99, 347, 301, 301, 301, 387, 389, 350, 239, - /* 100 */ 239, 239, 420, 91, 91, 91, 91, 91, 313, 66, - /* 110 */ 181, 187, 186, 116, 415, 437, 454, 243, 454, 551, - /* 120 */ 198, 435, 707, 829, 745, 776, 776, 829, 865, 121, - /* 130 */ 389, 881, 121, 121, 829, 121, 892, 239, 239, 239, - /* 140 */ 239, 239, 239, 239, 239, 239, 239, 239, 829, 892, - /* 150 */ 865, 343, 389, 881, 343, 935, 800, 795, 832, 800, - /* 160 */ 795, 832, 832, 812, 814, 830, 833, 847, 389, 982, - /* 170 */ 888, 834, 841, 846, 950, 239, 795, 832, 832, 795, - /* 180 */ 832, 904, 389, 881, 343, 420, 343, 389, 983, 829, - /* 190 */ 343, 892, 1331, 1331, 1331, 1331, 1331, 48, 349, 760, - /* 200 */ 1086, 1051, 475, 934, 785, 801, 527, 156, 874, 874, - /* 210 */ 874, 874, 874, 874, 874, 32, 19, 340, 138, 138, - /* 220 */ 138, 138, 440, 447, 514, 529, 692, 772, 807, 455, - /* 230 */ 458, 602, 650, 638, 545, 513, 378, 695, 678, 696, - /* 240 */ 698, 711, 739, 756, 759, 764, 641, 737, 770, 789, - /* 250 */ 794, 799, 803, 822, 758, 1078, 976, 952, 1088, 1090, - /* 260 */ 1036, 965, 1094, 1096, 1021, 1102, 1104, 994, 1111, 1112, - /* 270 */ 1113, 1114, 1115, 1116, 1095, 1123, 1125, 1126, 1127, 1129, - /* 280 */ 1131, 1132, 1091, 1133, 1087, 1140, 1141, 1105, 1106, 1101, - /* 290 */ 1145, 1146, 1148, 1150, 1074, 1079, 1121, 1124, 1139, 1163, - /* 300 */ 1128, 1130, 1134, 1135, 1136, 1137, 1138, 1164, 1143, 1167, - /* 310 */ 1147, 1142, 1170, 1149, 1144, 1177, 1156, 1179, 1158, 1165, - /* 320 */ 1183, 1184, 1064, 1187, 1120, 1151, 1072, 1109, 1110, 1034, - /* 330 */ 1152, 1117, 1153, 1155, 1157, 1159, 1161, 1162, 1118, 1122, - /* 340 */ 1166, 1119, 1035, 1168, 1169, 1160, 1043, 1154, 1171, 1172, - /* 350 */ 1173, 1038, 1193, 1174, 1175, 1176, 1178, 1180, 1181, 1199, - /* 360 */ 1073, 1182, 1186, 1185, 1188, 1189, 1190, 1192, 1195, 1084, - /* 370 */ 1196, 1206, 1200, 1092, 1197, 1191, 1194, 1198, 1202, 1203, - /* 380 */ 1201, 1204, 1207, 1208, 1213, 1210, 1214, 1215, 1217, 1219, - /* 390 */ 1220, 1222, 1223, 1224, 1225, 1229, 1230, 1205, 1226, 1232, - /* 400 */ 1235, 1244, 1236, 1238, 1239, 1107, 1241, 1242, 1212, 1246, - /* 410 */ 1253, 1247, 1254, 1260, 1251, 1252, 1255, 1258, 1259, 1262, - /* 420 */ 1264, 1263, 1265, 1266, 1267, 1270, 1274, 1275, 1276, 1278, - /* 430 */ 1279, 1268, 1269, 1283, 1272, 1287, 1284, 1286, 1311, 1321, - /* 440 */ 1302, 1304, 1305, 1306, 1309, 1256, + /* 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, }; -#define YY_REDUCE_COUNT (196) -#define YY_REDUCE_MIN (-238) -#define YY_REDUCE_MAX (901) +#define YY_REDUCE_COUNT (200) +#define YY_REDUCE_MIN (-251) +#define YY_REDUCE_MAX (970) static const short yy_reduce_ofst[] = { - /* 0 */ -55, -17, 26, 183, -165, 206, 229, 288, 72, 409, - /* 10 */ 461, 386, -187, 467, 518, 524, 472, 548, 586, 629, - /* 20 */ 660, 691, 700, 722, 731, 761, 769, 792, 831, 839, - /* 30 */ 862, 870, 901, -156, 246, 463, 135, -8, 74, -222, - /* 40 */ -170, -169, -223, -150, 49, 79, 174, -123, 222, 92, - /* 50 */ 157, -39, -215, 311, 321, 399, 327, 427, 425, -162, - /* 60 */ 429, 522, 485, -152, -238, -238, -238, 85, -147, -137, - /* 70 */ -140, -105, 21, 75, 132, 148, 182, 209, 235, 258, - /* 80 */ 319, 326, 328, 338, 351, 452, 459, 495, 505, 506, - /* 90 */ 535, 150, 41, 149, 153, 203, 259, 37, -214, 275, - /* 100 */ -3, 342, 308, 359, 370, 394, 423, 453, 348, 354, - /* 110 */ 414, 482, 537, 491, 596, 555, 566, 566, 566, 588, - /* 120 */ 563, 578, 614, 671, 654, 659, 661, 689, 667, 709, - /* 130 */ 697, 685, 717, 718, 723, 725, 732, 715, 716, 719, - /* 140 */ 720, 728, 730, 740, 742, 744, 746, 747, 751, 736, - /* 150 */ 726, 738, 752, 727, 765, 741, 699, 748, 750, 712, - /* 160 */ 755, 753, 762, 721, 729, 734, 754, 566, 777, 775, - /* 170 */ 763, 749, 767, 773, 778, 588, 798, 796, 808, 802, - /* 180 */ 809, 813, 815, 825, 855, 848, 860, 840, 851, 869, - /* 190 */ 866, 875, 835, 864, 867, 872, 893, + /* 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, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, - /* 10 */ 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, - /* 20 */ 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, - /* 30 */ 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, - /* 40 */ 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1104, 1051, 1051, - /* 50 */ 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, - /* 60 */ 1051, 1051, 1051, 1102, 1051, 1331, 1051, 1218, 1051, 1051, - /* 70 */ 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, - /* 80 */ 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, - /* 90 */ 1051, 1051, 1104, 1342, 1342, 1342, 1102, 1051, 1051, 1051, - /* 100 */ 1051, 1051, 1187, 1051, 1051, 1051, 1051, 1051, 1051, 1051, - /* 110 */ 1406, 1051, 1140, 1366, 1051, 1358, 1334, 1348, 1335, 1051, - /* 120 */ 1391, 1351, 1244, 1051, 1223, 1220, 1220, 1051, 1051, 1104, - /* 130 */ 1051, 1051, 1104, 1104, 1051, 1104, 1051, 1051, 1051, 1051, - /* 140 */ 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, - /* 150 */ 1051, 1102, 1051, 1051, 1102, 1051, 1373, 1371, 1051, 1373, - /* 160 */ 1371, 1051, 1051, 1385, 1381, 1364, 1362, 1348, 1051, 1051, - /* 170 */ 1051, 1409, 1397, 1393, 1051, 1051, 1371, 1051, 1051, 1371, - /* 180 */ 1051, 1231, 1051, 1051, 1102, 1051, 1102, 1051, 1156, 1051, - /* 190 */ 1102, 1051, 1246, 1190, 1190, 1105, 1056, 1051, 1051, 1051, - /* 200 */ 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1296, 1384, - /* 210 */ 1383, 1295, 1308, 1307, 1306, 1051, 1051, 1051, 1290, 1291, - /* 220 */ 1289, 1288, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, - /* 230 */ 1051, 1051, 1051, 1332, 1051, 1394, 1398, 1051, 1051, 1051, - /* 240 */ 1274, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, - /* 250 */ 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, - /* 260 */ 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, - /* 270 */ 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, - /* 280 */ 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, - /* 290 */ 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, - /* 300 */ 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, - /* 310 */ 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, - /* 320 */ 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1355, 1365, 1051, - /* 330 */ 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1274, - /* 340 */ 1051, 1382, 1051, 1341, 1337, 1051, 1051, 1333, 1051, 1051, - /* 350 */ 1392, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1327, - /* 360 */ 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, - /* 370 */ 1051, 1051, 1051, 1051, 1051, 1051, 1273, 1051, 1051, 1051, - /* 380 */ 1051, 1051, 1051, 1051, 1184, 1051, 1051, 1051, 1051, 1051, - /* 390 */ 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1169, 1167, 1166, - /* 400 */ 1165, 1051, 1162, 1051, 1051, 1051, 1051, 1051, 1051, 1051, - /* 410 */ 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, - /* 420 */ 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, - /* 430 */ 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, - /* 440 */ 1051, 1051, 1051, 1051, 1051, 1051, + /* 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, }; /********** End of lemon-generated parsing tables *****************************/ @@ -793,21 +793,21 @@ static const char *const yyTokenName[] = { /* 64 */ "SINGLE_STABLE", /* 65 */ "STREAM_MODE", /* 66 */ "RETENTIONS", - /* 67 */ "TABLE", - /* 68 */ "NK_LP", - /* 69 */ "NK_RP", - /* 70 */ "STABLE", - /* 71 */ "ADD", - /* 72 */ "COLUMN", - /* 73 */ "MODIFY", - /* 74 */ "RENAME", - /* 75 */ "TAG", - /* 76 */ "SET", - /* 77 */ "NK_EQ", - /* 78 */ "USING", - /* 79 */ "TAGS", - /* 80 */ "NK_DOT", - /* 81 */ "NK_COMMA", + /* 67 */ "NK_COMMA", + /* 68 */ "TABLE", + /* 69 */ "NK_LP", + /* 70 */ "NK_RP", + /* 71 */ "STABLE", + /* 72 */ "ADD", + /* 73 */ "COLUMN", + /* 74 */ "MODIFY", + /* 75 */ "RENAME", + /* 76 */ "TAG", + /* 77 */ "SET", + /* 78 */ "NK_EQ", + /* 79 */ "USING", + /* 80 */ "TAGS", + /* 81 */ "NK_DOT", /* 82 */ "COMMENT", /* 83 */ "BOOL", /* 84 */ "TINYINT", @@ -918,91 +918,92 @@ static const char *const yyTokenName[] = { /* 189 */ "db_options", /* 190 */ "exists_opt", /* 191 */ "alter_db_options", - /* 192 */ "alter_db_option", - /* 193 */ "full_table_name", - /* 194 */ "column_def_list", - /* 195 */ "tags_def_opt", - /* 196 */ "table_options", - /* 197 */ "multi_create_clause", - /* 198 */ "tags_def", - /* 199 */ "multi_drop_clause", - /* 200 */ "alter_table_clause", - /* 201 */ "alter_table_options", - /* 202 */ "column_name", - /* 203 */ "type_name", - /* 204 */ "create_subtable_clause", - /* 205 */ "specific_tags_opt", - /* 206 */ "literal_list", - /* 207 */ "drop_table_clause", - /* 208 */ "col_name_list", - /* 209 */ "table_name", - /* 210 */ "column_def", - /* 211 */ "func_name_list", - /* 212 */ "alter_table_option", - /* 213 */ "col_name", - /* 214 */ "db_name_cond_opt", - /* 215 */ "like_pattern_opt", - /* 216 */ "table_name_cond", - /* 217 */ "from_db_opt", - /* 218 */ "func_name", - /* 219 */ "function_name", - /* 220 */ "index_name", - /* 221 */ "index_options", - /* 222 */ "func_list", - /* 223 */ "duration_literal", - /* 224 */ "sliding_opt", - /* 225 */ "func", - /* 226 */ "expression_list", - /* 227 */ "topic_name", - /* 228 */ "query_expression", - /* 229 */ "analyze_opt", - /* 230 */ "explain_options", - /* 231 */ "signed", - /* 232 */ "signed_literal", - /* 233 */ "table_alias", - /* 234 */ "column_alias", - /* 235 */ "expression", - /* 236 */ "pseudo_column", - /* 237 */ "column_reference", - /* 238 */ "subquery", - /* 239 */ "predicate", - /* 240 */ "compare_op", - /* 241 */ "in_op", - /* 242 */ "in_predicate_value", - /* 243 */ "boolean_value_expression", - /* 244 */ "boolean_primary", - /* 245 */ "common_expression", - /* 246 */ "from_clause", - /* 247 */ "table_reference_list", - /* 248 */ "table_reference", - /* 249 */ "table_primary", - /* 250 */ "joined_table", - /* 251 */ "alias_opt", - /* 252 */ "parenthesized_joined_table", - /* 253 */ "join_type", - /* 254 */ "search_condition", - /* 255 */ "query_specification", - /* 256 */ "set_quantifier_opt", - /* 257 */ "select_list", - /* 258 */ "where_clause_opt", - /* 259 */ "partition_by_clause_opt", - /* 260 */ "twindow_clause_opt", - /* 261 */ "group_by_clause_opt", - /* 262 */ "having_clause_opt", - /* 263 */ "select_sublist", - /* 264 */ "select_item", - /* 265 */ "fill_opt", - /* 266 */ "fill_mode", - /* 267 */ "group_by_list", - /* 268 */ "query_expression_body", - /* 269 */ "order_by_clause_opt", - /* 270 */ "slimit_clause_opt", - /* 271 */ "limit_clause_opt", - /* 272 */ "query_primary", - /* 273 */ "sort_specification_list", - /* 274 */ "sort_specification", - /* 275 */ "ordering_specification_opt", - /* 276 */ "null_ordering_opt", + /* 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", }; #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ @@ -1070,7 +1071,7 @@ static const char *const yyRuleName[] = { /* 57 */ "db_options ::= db_options FSYNC NK_INTEGER", /* 58 */ "db_options ::= db_options MAXROWS NK_INTEGER", /* 59 */ "db_options ::= db_options MINROWS NK_INTEGER", - /* 60 */ "db_options ::= db_options KEEP NK_INTEGER", + /* 60 */ "db_options ::= db_options KEEP integer_list", /* 61 */ "db_options ::= db_options PRECISION NK_STRING", /* 62 */ "db_options ::= db_options QUORUM NK_INTEGER", /* 63 */ "db_options ::= db_options REPLICA NK_INTEGER", @@ -1084,290 +1085,292 @@ static const char *const yyRuleName[] = { /* 71 */ "alter_db_options ::= alter_db_options alter_db_option", /* 72 */ "alter_db_option ::= BLOCKS NK_INTEGER", /* 73 */ "alter_db_option ::= FSYNC NK_INTEGER", - /* 74 */ "alter_db_option ::= KEEP NK_INTEGER", + /* 74 */ "alter_db_option ::= KEEP integer_list", /* 75 */ "alter_db_option ::= WAL NK_INTEGER", /* 76 */ "alter_db_option ::= QUORUM NK_INTEGER", /* 77 */ "alter_db_option ::= CACHELAST NK_INTEGER", /* 78 */ "alter_db_option ::= REPLICA NK_INTEGER", - /* 79 */ "cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options", - /* 80 */ "cmd ::= CREATE TABLE multi_create_clause", - /* 81 */ "cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options", - /* 82 */ "cmd ::= DROP TABLE multi_drop_clause", - /* 83 */ "cmd ::= DROP STABLE exists_opt full_table_name", - /* 84 */ "cmd ::= ALTER TABLE alter_table_clause", - /* 85 */ "cmd ::= ALTER STABLE alter_table_clause", - /* 86 */ "alter_table_clause ::= full_table_name alter_table_options", - /* 87 */ "alter_table_clause ::= full_table_name ADD COLUMN column_name type_name", - /* 88 */ "alter_table_clause ::= full_table_name DROP COLUMN column_name", - /* 89 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name", - /* 90 */ "alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name", - /* 91 */ "alter_table_clause ::= full_table_name ADD TAG column_name type_name", - /* 92 */ "alter_table_clause ::= full_table_name DROP TAG column_name", - /* 93 */ "alter_table_clause ::= full_table_name MODIFY TAG column_name type_name", - /* 94 */ "alter_table_clause ::= full_table_name RENAME TAG column_name column_name", - /* 95 */ "alter_table_clause ::= full_table_name SET TAG column_name NK_EQ literal", - /* 96 */ "multi_create_clause ::= create_subtable_clause", - /* 97 */ "multi_create_clause ::= multi_create_clause create_subtable_clause", - /* 98 */ "create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP", - /* 99 */ "multi_drop_clause ::= drop_table_clause", - /* 100 */ "multi_drop_clause ::= multi_drop_clause drop_table_clause", - /* 101 */ "drop_table_clause ::= exists_opt full_table_name", - /* 102 */ "specific_tags_opt ::=", - /* 103 */ "specific_tags_opt ::= NK_LP col_name_list NK_RP", - /* 104 */ "full_table_name ::= table_name", - /* 105 */ "full_table_name ::= db_name NK_DOT table_name", - /* 106 */ "column_def_list ::= column_def", - /* 107 */ "column_def_list ::= column_def_list NK_COMMA column_def", - /* 108 */ "column_def ::= column_name type_name", - /* 109 */ "column_def ::= column_name type_name COMMENT NK_STRING", - /* 110 */ "type_name ::= BOOL", - /* 111 */ "type_name ::= TINYINT", - /* 112 */ "type_name ::= SMALLINT", - /* 113 */ "type_name ::= INT", - /* 114 */ "type_name ::= INTEGER", - /* 115 */ "type_name ::= BIGINT", - /* 116 */ "type_name ::= FLOAT", - /* 117 */ "type_name ::= DOUBLE", - /* 118 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP", - /* 119 */ "type_name ::= TIMESTAMP", - /* 120 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP", - /* 121 */ "type_name ::= TINYINT UNSIGNED", - /* 122 */ "type_name ::= SMALLINT UNSIGNED", - /* 123 */ "type_name ::= INT UNSIGNED", - /* 124 */ "type_name ::= BIGINT UNSIGNED", - /* 125 */ "type_name ::= JSON", - /* 126 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP", - /* 127 */ "type_name ::= MEDIUMBLOB", - /* 128 */ "type_name ::= BLOB", - /* 129 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP", - /* 130 */ "type_name ::= DECIMAL", - /* 131 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP", - /* 132 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", - /* 133 */ "tags_def_opt ::=", - /* 134 */ "tags_def_opt ::= tags_def", - /* 135 */ "tags_def ::= TAGS NK_LP column_def_list NK_RP", - /* 136 */ "table_options ::=", - /* 137 */ "table_options ::= table_options COMMENT NK_STRING", - /* 138 */ "table_options ::= table_options KEEP NK_INTEGER", - /* 139 */ "table_options ::= table_options TTL NK_INTEGER", - /* 140 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP", - /* 141 */ "table_options ::= table_options ROLLUP NK_LP func_name_list NK_RP", - /* 142 */ "table_options ::= table_options FILE_FACTOR NK_FLOAT", - /* 143 */ "table_options ::= table_options DELAY NK_INTEGER", - /* 144 */ "alter_table_options ::= alter_table_option", - /* 145 */ "alter_table_options ::= alter_table_options alter_table_option", - /* 146 */ "alter_table_option ::= COMMENT NK_STRING", - /* 147 */ "alter_table_option ::= KEEP NK_INTEGER", - /* 148 */ "alter_table_option ::= TTL NK_INTEGER", - /* 149 */ "col_name_list ::= col_name", - /* 150 */ "col_name_list ::= col_name_list NK_COMMA col_name", - /* 151 */ "col_name ::= column_name", - /* 152 */ "cmd ::= SHOW DNODES", - /* 153 */ "cmd ::= SHOW USERS", - /* 154 */ "cmd ::= SHOW DATABASES", - /* 155 */ "cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt", - /* 156 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt", - /* 157 */ "cmd ::= SHOW db_name_cond_opt VGROUPS", - /* 158 */ "cmd ::= SHOW MNODES", - /* 159 */ "cmd ::= SHOW MODULES", - /* 160 */ "cmd ::= SHOW QNODES", - /* 161 */ "cmd ::= SHOW FUNCTIONS", - /* 162 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt", - /* 163 */ "cmd ::= SHOW STREAMS", - /* 164 */ "db_name_cond_opt ::=", - /* 165 */ "db_name_cond_opt ::= db_name NK_DOT", - /* 166 */ "like_pattern_opt ::=", - /* 167 */ "like_pattern_opt ::= LIKE NK_STRING", - /* 168 */ "table_name_cond ::= table_name", - /* 169 */ "from_db_opt ::=", - /* 170 */ "from_db_opt ::= FROM db_name", - /* 171 */ "func_name_list ::= func_name", - /* 172 */ "func_name_list ::= func_name_list NK_COMMA col_name", - /* 173 */ "func_name ::= function_name", - /* 174 */ "cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options", - /* 175 */ "cmd ::= CREATE FULLTEXT INDEX not_exists_opt index_name ON table_name NK_LP col_name_list NK_RP", - /* 176 */ "cmd ::= DROP INDEX exists_opt index_name ON table_name", - /* 177 */ "index_options ::=", - /* 178 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt", - /* 179 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt", - /* 180 */ "func_list ::= func", - /* 181 */ "func_list ::= func_list NK_COMMA func", - /* 182 */ "func ::= function_name NK_LP expression_list NK_RP", - /* 183 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression", - /* 184 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS db_name", - /* 185 */ "cmd ::= DROP TOPIC exists_opt topic_name", - /* 186 */ "cmd ::= DESC full_table_name", - /* 187 */ "cmd ::= DESCRIBE full_table_name", - /* 188 */ "cmd ::= RESET QUERY CACHE", - /* 189 */ "cmd ::= EXPLAIN analyze_opt explain_options query_expression", - /* 190 */ "analyze_opt ::=", - /* 191 */ "analyze_opt ::= ANALYZE", - /* 192 */ "explain_options ::=", - /* 193 */ "explain_options ::= explain_options VERBOSE NK_BOOL", - /* 194 */ "explain_options ::= explain_options RATIO NK_FLOAT", - /* 195 */ "cmd ::= query_expression", - /* 196 */ "literal ::= NK_INTEGER", - /* 197 */ "literal ::= NK_FLOAT", - /* 198 */ "literal ::= NK_STRING", - /* 199 */ "literal ::= NK_BOOL", - /* 200 */ "literal ::= TIMESTAMP NK_STRING", - /* 201 */ "literal ::= duration_literal", - /* 202 */ "literal ::= NULL", - /* 203 */ "duration_literal ::= NK_VARIABLE", - /* 204 */ "signed ::= NK_INTEGER", - /* 205 */ "signed ::= NK_PLUS NK_INTEGER", - /* 206 */ "signed ::= NK_MINUS NK_INTEGER", - /* 207 */ "signed ::= NK_FLOAT", - /* 208 */ "signed ::= NK_PLUS NK_FLOAT", - /* 209 */ "signed ::= NK_MINUS NK_FLOAT", - /* 210 */ "signed_literal ::= signed", - /* 211 */ "signed_literal ::= NK_STRING", - /* 212 */ "signed_literal ::= NK_BOOL", - /* 213 */ "signed_literal ::= TIMESTAMP NK_STRING", - /* 214 */ "signed_literal ::= duration_literal", - /* 215 */ "signed_literal ::= NULL", - /* 216 */ "literal_list ::= signed_literal", - /* 217 */ "literal_list ::= literal_list NK_COMMA signed_literal", - /* 218 */ "db_name ::= NK_ID", - /* 219 */ "table_name ::= NK_ID", - /* 220 */ "column_name ::= NK_ID", - /* 221 */ "function_name ::= NK_ID", - /* 222 */ "table_alias ::= NK_ID", - /* 223 */ "column_alias ::= NK_ID", - /* 224 */ "user_name ::= NK_ID", - /* 225 */ "index_name ::= NK_ID", - /* 226 */ "topic_name ::= NK_ID", - /* 227 */ "expression ::= literal", - /* 228 */ "expression ::= pseudo_column", - /* 229 */ "expression ::= column_reference", - /* 230 */ "expression ::= function_name NK_LP expression_list NK_RP", - /* 231 */ "expression ::= function_name NK_LP NK_STAR NK_RP", - /* 232 */ "expression ::= subquery", - /* 233 */ "expression ::= NK_LP expression NK_RP", - /* 234 */ "expression ::= NK_PLUS expression", - /* 235 */ "expression ::= NK_MINUS expression", - /* 236 */ "expression ::= expression NK_PLUS expression", - /* 237 */ "expression ::= expression NK_MINUS expression", - /* 238 */ "expression ::= expression NK_STAR expression", - /* 239 */ "expression ::= expression NK_SLASH expression", - /* 240 */ "expression ::= expression NK_REM expression", - /* 241 */ "expression_list ::= expression", - /* 242 */ "expression_list ::= expression_list NK_COMMA expression", - /* 243 */ "column_reference ::= column_name", - /* 244 */ "column_reference ::= table_name NK_DOT column_name", - /* 245 */ "pseudo_column ::= NK_UNDERLINE ROWTS", - /* 246 */ "pseudo_column ::= TBNAME", - /* 247 */ "pseudo_column ::= NK_UNDERLINE QSTARTTS", - /* 248 */ "pseudo_column ::= NK_UNDERLINE QENDTS", - /* 249 */ "pseudo_column ::= NK_UNDERLINE WSTARTTS", - /* 250 */ "pseudo_column ::= NK_UNDERLINE WENDTS", - /* 251 */ "pseudo_column ::= NK_UNDERLINE WDURATION", - /* 252 */ "predicate ::= expression compare_op expression", - /* 253 */ "predicate ::= expression BETWEEN expression AND expression", - /* 254 */ "predicate ::= expression NOT BETWEEN expression AND expression", - /* 255 */ "predicate ::= expression IS NULL", - /* 256 */ "predicate ::= expression IS NOT NULL", - /* 257 */ "predicate ::= expression in_op in_predicate_value", - /* 258 */ "compare_op ::= NK_LT", - /* 259 */ "compare_op ::= NK_GT", - /* 260 */ "compare_op ::= NK_LE", - /* 261 */ "compare_op ::= NK_GE", - /* 262 */ "compare_op ::= NK_NE", - /* 263 */ "compare_op ::= NK_EQ", - /* 264 */ "compare_op ::= LIKE", - /* 265 */ "compare_op ::= NOT LIKE", - /* 266 */ "compare_op ::= MATCH", - /* 267 */ "compare_op ::= NMATCH", - /* 268 */ "in_op ::= IN", - /* 269 */ "in_op ::= NOT IN", - /* 270 */ "in_predicate_value ::= NK_LP expression_list NK_RP", - /* 271 */ "boolean_value_expression ::= boolean_primary", - /* 272 */ "boolean_value_expression ::= NOT boolean_primary", - /* 273 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", - /* 274 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", - /* 275 */ "boolean_primary ::= predicate", - /* 276 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", - /* 277 */ "common_expression ::= expression", - /* 278 */ "common_expression ::= boolean_value_expression", - /* 279 */ "from_clause ::= FROM table_reference_list", - /* 280 */ "table_reference_list ::= table_reference", - /* 281 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", - /* 282 */ "table_reference ::= table_primary", - /* 283 */ "table_reference ::= joined_table", - /* 284 */ "table_primary ::= table_name alias_opt", - /* 285 */ "table_primary ::= db_name NK_DOT table_name alias_opt", - /* 286 */ "table_primary ::= subquery alias_opt", - /* 287 */ "table_primary ::= parenthesized_joined_table", - /* 288 */ "alias_opt ::=", - /* 289 */ "alias_opt ::= table_alias", - /* 290 */ "alias_opt ::= AS table_alias", - /* 291 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", - /* 292 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", - /* 293 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", - /* 294 */ "join_type ::=", - /* 295 */ "join_type ::= INNER", - /* 296 */ "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", - /* 297 */ "set_quantifier_opt ::=", - /* 298 */ "set_quantifier_opt ::= DISTINCT", - /* 299 */ "set_quantifier_opt ::= ALL", - /* 300 */ "select_list ::= NK_STAR", - /* 301 */ "select_list ::= select_sublist", - /* 302 */ "select_sublist ::= select_item", - /* 303 */ "select_sublist ::= select_sublist NK_COMMA select_item", - /* 304 */ "select_item ::= common_expression", - /* 305 */ "select_item ::= common_expression column_alias", - /* 306 */ "select_item ::= common_expression AS column_alias", - /* 307 */ "select_item ::= table_name NK_DOT NK_STAR", - /* 308 */ "where_clause_opt ::=", - /* 309 */ "where_clause_opt ::= WHERE search_condition", - /* 310 */ "partition_by_clause_opt ::=", - /* 311 */ "partition_by_clause_opt ::= PARTITION BY expression_list", - /* 312 */ "twindow_clause_opt ::=", - /* 313 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", - /* 314 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP", - /* 315 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", - /* 316 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", - /* 317 */ "sliding_opt ::=", - /* 318 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", - /* 319 */ "fill_opt ::=", - /* 320 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", - /* 321 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", - /* 322 */ "fill_mode ::= NONE", - /* 323 */ "fill_mode ::= PREV", - /* 324 */ "fill_mode ::= NULL", - /* 325 */ "fill_mode ::= LINEAR", - /* 326 */ "fill_mode ::= NEXT", - /* 327 */ "group_by_clause_opt ::=", - /* 328 */ "group_by_clause_opt ::= GROUP BY group_by_list", - /* 329 */ "group_by_list ::= expression", - /* 330 */ "group_by_list ::= group_by_list NK_COMMA expression", - /* 331 */ "having_clause_opt ::=", - /* 332 */ "having_clause_opt ::= HAVING search_condition", - /* 333 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt", - /* 334 */ "query_expression_body ::= query_primary", - /* 335 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body", - /* 336 */ "query_primary ::= query_specification", - /* 337 */ "order_by_clause_opt ::=", - /* 338 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", - /* 339 */ "slimit_clause_opt ::=", - /* 340 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", - /* 341 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", - /* 342 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 343 */ "limit_clause_opt ::=", - /* 344 */ "limit_clause_opt ::= LIMIT NK_INTEGER", - /* 345 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", - /* 346 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 347 */ "subquery ::= NK_LP query_expression NK_RP", - /* 348 */ "search_condition ::= common_expression", - /* 349 */ "sort_specification_list ::= sort_specification", - /* 350 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", - /* 351 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt", - /* 352 */ "ordering_specification_opt ::=", - /* 353 */ "ordering_specification_opt ::= ASC", - /* 354 */ "ordering_specification_opt ::= DESC", - /* 355 */ "null_ordering_opt ::=", - /* 356 */ "null_ordering_opt ::= NULLS FIRST", - /* 357 */ "null_ordering_opt ::= NULLS LAST", + /* 79 */ "integer_list ::= NK_INTEGER", + /* 80 */ "integer_list ::= integer_list NK_COMMA NK_INTEGER", + /* 81 */ "cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options", + /* 82 */ "cmd ::= CREATE TABLE multi_create_clause", + /* 83 */ "cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options", + /* 84 */ "cmd ::= DROP TABLE multi_drop_clause", + /* 85 */ "cmd ::= DROP STABLE exists_opt full_table_name", + /* 86 */ "cmd ::= ALTER TABLE alter_table_clause", + /* 87 */ "cmd ::= ALTER STABLE alter_table_clause", + /* 88 */ "alter_table_clause ::= full_table_name alter_table_options", + /* 89 */ "alter_table_clause ::= full_table_name ADD COLUMN column_name type_name", + /* 90 */ "alter_table_clause ::= full_table_name DROP COLUMN column_name", + /* 91 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name", + /* 92 */ "alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name", + /* 93 */ "alter_table_clause ::= full_table_name ADD TAG column_name type_name", + /* 94 */ "alter_table_clause ::= full_table_name DROP TAG column_name", + /* 95 */ "alter_table_clause ::= full_table_name MODIFY TAG column_name type_name", + /* 96 */ "alter_table_clause ::= full_table_name RENAME TAG column_name column_name", + /* 97 */ "alter_table_clause ::= full_table_name SET TAG column_name NK_EQ literal", + /* 98 */ "multi_create_clause ::= create_subtable_clause", + /* 99 */ "multi_create_clause ::= multi_create_clause create_subtable_clause", + /* 100 */ "create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP", + /* 101 */ "multi_drop_clause ::= drop_table_clause", + /* 102 */ "multi_drop_clause ::= multi_drop_clause drop_table_clause", + /* 103 */ "drop_table_clause ::= exists_opt full_table_name", + /* 104 */ "specific_tags_opt ::=", + /* 105 */ "specific_tags_opt ::= NK_LP col_name_list NK_RP", + /* 106 */ "full_table_name ::= table_name", + /* 107 */ "full_table_name ::= db_name NK_DOT table_name", + /* 108 */ "column_def_list ::= column_def", + /* 109 */ "column_def_list ::= column_def_list NK_COMMA column_def", + /* 110 */ "column_def ::= column_name type_name", + /* 111 */ "column_def ::= column_name type_name COMMENT NK_STRING", + /* 112 */ "type_name ::= BOOL", + /* 113 */ "type_name ::= TINYINT", + /* 114 */ "type_name ::= SMALLINT", + /* 115 */ "type_name ::= INT", + /* 116 */ "type_name ::= INTEGER", + /* 117 */ "type_name ::= BIGINT", + /* 118 */ "type_name ::= FLOAT", + /* 119 */ "type_name ::= DOUBLE", + /* 120 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP", + /* 121 */ "type_name ::= TIMESTAMP", + /* 122 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP", + /* 123 */ "type_name ::= TINYINT UNSIGNED", + /* 124 */ "type_name ::= SMALLINT UNSIGNED", + /* 125 */ "type_name ::= INT UNSIGNED", + /* 126 */ "type_name ::= BIGINT UNSIGNED", + /* 127 */ "type_name ::= JSON", + /* 128 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP", + /* 129 */ "type_name ::= MEDIUMBLOB", + /* 130 */ "type_name ::= BLOB", + /* 131 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP", + /* 132 */ "type_name ::= DECIMAL", + /* 133 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP", + /* 134 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", + /* 135 */ "tags_def_opt ::=", + /* 136 */ "tags_def_opt ::= tags_def", + /* 137 */ "tags_def ::= TAGS NK_LP column_def_list NK_RP", + /* 138 */ "table_options ::=", + /* 139 */ "table_options ::= table_options COMMENT NK_STRING", + /* 140 */ "table_options ::= table_options KEEP integer_list", + /* 141 */ "table_options ::= table_options TTL NK_INTEGER", + /* 142 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP", + /* 143 */ "table_options ::= table_options ROLLUP NK_LP func_name_list NK_RP", + /* 144 */ "table_options ::= table_options FILE_FACTOR NK_FLOAT", + /* 145 */ "table_options ::= table_options DELAY NK_INTEGER", + /* 146 */ "alter_table_options ::= alter_table_option", + /* 147 */ "alter_table_options ::= alter_table_options alter_table_option", + /* 148 */ "alter_table_option ::= COMMENT NK_STRING", + /* 149 */ "alter_table_option ::= KEEP integer_list", + /* 150 */ "alter_table_option ::= TTL NK_INTEGER", + /* 151 */ "col_name_list ::= col_name", + /* 152 */ "col_name_list ::= col_name_list NK_COMMA col_name", + /* 153 */ "col_name ::= column_name", + /* 154 */ "cmd ::= SHOW DNODES", + /* 155 */ "cmd ::= SHOW USERS", + /* 156 */ "cmd ::= SHOW DATABASES", + /* 157 */ "cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt", + /* 158 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt", + /* 159 */ "cmd ::= SHOW db_name_cond_opt VGROUPS", + /* 160 */ "cmd ::= SHOW MNODES", + /* 161 */ "cmd ::= SHOW MODULES", + /* 162 */ "cmd ::= SHOW QNODES", + /* 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", }; #endif /* NDEBUG */ @@ -1498,56 +1501,56 @@ static void yy_destructor( case 182: /* literal */ case 189: /* db_options */ case 191: /* alter_db_options */ - case 193: /* full_table_name */ - case 196: /* table_options */ - case 200: /* alter_table_clause */ - case 201: /* alter_table_options */ - case 204: /* create_subtable_clause */ - case 207: /* drop_table_clause */ - case 210: /* column_def */ - case 213: /* col_name */ - case 214: /* db_name_cond_opt */ - case 215: /* like_pattern_opt */ - case 216: /* table_name_cond */ - case 217: /* from_db_opt */ - case 218: /* func_name */ - case 221: /* index_options */ - case 223: /* duration_literal */ - case 224: /* sliding_opt */ - case 225: /* func */ - case 228: /* query_expression */ - case 230: /* explain_options */ - case 231: /* signed */ - case 232: /* signed_literal */ - case 235: /* expression */ - case 236: /* pseudo_column */ - case 237: /* column_reference */ - case 238: /* subquery */ - case 239: /* predicate */ - case 242: /* in_predicate_value */ - case 243: /* boolean_value_expression */ - case 244: /* boolean_primary */ - case 245: /* common_expression */ - case 246: /* from_clause */ - case 247: /* table_reference_list */ - case 248: /* table_reference */ - case 249: /* table_primary */ - case 250: /* joined_table */ - case 252: /* parenthesized_joined_table */ - case 254: /* search_condition */ - case 255: /* query_specification */ - case 258: /* where_clause_opt */ - case 260: /* twindow_clause_opt */ - case 262: /* having_clause_opt */ - case 264: /* select_item */ - case 265: /* fill_opt */ - case 268: /* query_expression_body */ - case 270: /* slimit_clause_opt */ - case 271: /* limit_clause_opt */ - case 272: /* query_primary */ - case 274: /* sort_specification */ + 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 */ { - nodesDestroyNode((yypminor->yy46)); + nodesDestroyNode((yypminor->yy24)); } break; case 180: /* account_options */ @@ -1561,81 +1564,82 @@ static void yy_destructor( case 185: /* dnode_endpoint */ case 186: /* dnode_host_name */ case 188: /* db_name */ - case 202: /* column_name */ - case 209: /* table_name */ - case 219: /* function_name */ - case 220: /* index_name */ - case 227: /* topic_name */ - case 233: /* table_alias */ - case 234: /* column_alias */ - case 251: /* alias_opt */ + 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 */ { } break; case 187: /* not_exists_opt */ case 190: /* exists_opt */ - case 229: /* analyze_opt */ - case 256: /* set_quantifier_opt */ + case 230: /* analyze_opt */ + case 257: /* set_quantifier_opt */ { } break; - case 192: /* alter_db_option */ - case 212: /* alter_table_option */ + 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 */ +{ + nodesDestroyList((yypminor->yy504)); +} + break; + case 193: /* alter_db_option */ + case 213: /* alter_table_option */ { } break; - case 194: /* column_def_list */ - case 195: /* tags_def_opt */ - case 197: /* multi_create_clause */ - case 198: /* tags_def */ - case 199: /* multi_drop_clause */ - case 205: /* specific_tags_opt */ - case 206: /* literal_list */ - case 208: /* col_name_list */ - case 211: /* func_name_list */ - case 222: /* func_list */ - case 226: /* expression_list */ - case 257: /* select_list */ - case 259: /* partition_by_clause_opt */ - case 261: /* group_by_clause_opt */ - case 263: /* select_sublist */ - case 267: /* group_by_list */ - case 269: /* order_by_clause_opt */ - case 273: /* sort_specification_list */ -{ - nodesDestroyList((yypminor->yy194)); -} - break; - case 203: /* type_name */ + case 204: /* type_name */ { } break; - case 240: /* compare_op */ - case 241: /* in_op */ + case 241: /* compare_op */ + case 242: /* in_op */ { } break; - case 253: /* join_type */ + case 254: /* join_type */ { } break; - case 266: /* fill_mode */ + case 267: /* fill_mode */ { } break; - case 275: /* ordering_specification_opt */ + case 276: /* ordering_specification_opt */ { } break; - case 276: /* null_ordering_opt */ + case 277: /* null_ordering_opt */ { } @@ -1994,7 +1998,7 @@ static const struct { { 189, -3 }, /* (57) db_options ::= db_options FSYNC NK_INTEGER */ { 189, -3 }, /* (58) db_options ::= db_options MAXROWS NK_INTEGER */ { 189, -3 }, /* (59) db_options ::= db_options MINROWS NK_INTEGER */ - { 189, -3 }, /* (60) db_options ::= db_options KEEP NK_INTEGER */ + { 189, -3 }, /* (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 */ @@ -2006,292 +2010,294 @@ static const struct { { 189, -3 }, /* (69) db_options ::= db_options RETENTIONS NK_STRING */ { 191, -1 }, /* (70) alter_db_options ::= alter_db_option */ { 191, -2 }, /* (71) alter_db_options ::= alter_db_options alter_db_option */ - { 192, -2 }, /* (72) alter_db_option ::= BLOCKS NK_INTEGER */ - { 192, -2 }, /* (73) alter_db_option ::= FSYNC NK_INTEGER */ - { 192, -2 }, /* (74) alter_db_option ::= KEEP NK_INTEGER */ - { 192, -2 }, /* (75) alter_db_option ::= WAL NK_INTEGER */ - { 192, -2 }, /* (76) alter_db_option ::= QUORUM NK_INTEGER */ - { 192, -2 }, /* (77) alter_db_option ::= CACHELAST NK_INTEGER */ - { 192, -2 }, /* (78) alter_db_option ::= REPLICA NK_INTEGER */ - { 179, -9 }, /* (79) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ - { 179, -3 }, /* (80) cmd ::= CREATE TABLE multi_create_clause */ - { 179, -9 }, /* (81) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ - { 179, -3 }, /* (82) cmd ::= DROP TABLE multi_drop_clause */ - { 179, -4 }, /* (83) cmd ::= DROP STABLE exists_opt full_table_name */ - { 179, -3 }, /* (84) cmd ::= ALTER TABLE alter_table_clause */ - { 179, -3 }, /* (85) cmd ::= ALTER STABLE alter_table_clause */ - { 200, -2 }, /* (86) alter_table_clause ::= full_table_name alter_table_options */ - { 200, -5 }, /* (87) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ - { 200, -4 }, /* (88) alter_table_clause ::= full_table_name DROP COLUMN column_name */ - { 200, -5 }, /* (89) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ - { 200, -5 }, /* (90) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ - { 200, -5 }, /* (91) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ - { 200, -4 }, /* (92) alter_table_clause ::= full_table_name DROP TAG column_name */ - { 200, -5 }, /* (93) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ - { 200, -5 }, /* (94) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ - { 200, -6 }, /* (95) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ literal */ - { 197, -1 }, /* (96) multi_create_clause ::= create_subtable_clause */ - { 197, -2 }, /* (97) multi_create_clause ::= multi_create_clause create_subtable_clause */ - { 204, -9 }, /* (98) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP */ - { 199, -1 }, /* (99) multi_drop_clause ::= drop_table_clause */ - { 199, -2 }, /* (100) multi_drop_clause ::= multi_drop_clause drop_table_clause */ - { 207, -2 }, /* (101) drop_table_clause ::= exists_opt full_table_name */ - { 205, 0 }, /* (102) specific_tags_opt ::= */ - { 205, -3 }, /* (103) specific_tags_opt ::= NK_LP col_name_list NK_RP */ - { 193, -1 }, /* (104) full_table_name ::= table_name */ - { 193, -3 }, /* (105) full_table_name ::= db_name NK_DOT table_name */ - { 194, -1 }, /* (106) column_def_list ::= column_def */ - { 194, -3 }, /* (107) column_def_list ::= column_def_list NK_COMMA column_def */ - { 210, -2 }, /* (108) column_def ::= column_name type_name */ - { 210, -4 }, /* (109) column_def ::= column_name type_name COMMENT NK_STRING */ - { 203, -1 }, /* (110) type_name ::= BOOL */ - { 203, -1 }, /* (111) type_name ::= TINYINT */ - { 203, -1 }, /* (112) type_name ::= SMALLINT */ - { 203, -1 }, /* (113) type_name ::= INT */ - { 203, -1 }, /* (114) type_name ::= INTEGER */ - { 203, -1 }, /* (115) type_name ::= BIGINT */ - { 203, -1 }, /* (116) type_name ::= FLOAT */ - { 203, -1 }, /* (117) type_name ::= DOUBLE */ - { 203, -4 }, /* (118) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ - { 203, -1 }, /* (119) type_name ::= TIMESTAMP */ - { 203, -4 }, /* (120) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ - { 203, -2 }, /* (121) type_name ::= TINYINT UNSIGNED */ - { 203, -2 }, /* (122) type_name ::= SMALLINT UNSIGNED */ - { 203, -2 }, /* (123) type_name ::= INT UNSIGNED */ - { 203, -2 }, /* (124) type_name ::= BIGINT UNSIGNED */ - { 203, -1 }, /* (125) type_name ::= JSON */ - { 203, -4 }, /* (126) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ - { 203, -1 }, /* (127) type_name ::= MEDIUMBLOB */ - { 203, -1 }, /* (128) type_name ::= BLOB */ - { 203, -4 }, /* (129) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ - { 203, -1 }, /* (130) type_name ::= DECIMAL */ - { 203, -4 }, /* (131) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ - { 203, -6 }, /* (132) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - { 195, 0 }, /* (133) tags_def_opt ::= */ - { 195, -1 }, /* (134) tags_def_opt ::= tags_def */ - { 198, -4 }, /* (135) tags_def ::= TAGS NK_LP column_def_list NK_RP */ - { 196, 0 }, /* (136) table_options ::= */ - { 196, -3 }, /* (137) table_options ::= table_options COMMENT NK_STRING */ - { 196, -3 }, /* (138) table_options ::= table_options KEEP NK_INTEGER */ - { 196, -3 }, /* (139) table_options ::= table_options TTL NK_INTEGER */ - { 196, -5 }, /* (140) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ - { 196, -5 }, /* (141) table_options ::= table_options ROLLUP NK_LP func_name_list NK_RP */ - { 196, -3 }, /* (142) table_options ::= table_options FILE_FACTOR NK_FLOAT */ - { 196, -3 }, /* (143) table_options ::= table_options DELAY NK_INTEGER */ - { 201, -1 }, /* (144) alter_table_options ::= alter_table_option */ - { 201, -2 }, /* (145) alter_table_options ::= alter_table_options alter_table_option */ - { 212, -2 }, /* (146) alter_table_option ::= COMMENT NK_STRING */ - { 212, -2 }, /* (147) alter_table_option ::= KEEP NK_INTEGER */ - { 212, -2 }, /* (148) alter_table_option ::= TTL NK_INTEGER */ - { 208, -1 }, /* (149) col_name_list ::= col_name */ - { 208, -3 }, /* (150) col_name_list ::= col_name_list NK_COMMA col_name */ - { 213, -1 }, /* (151) col_name ::= column_name */ - { 179, -2 }, /* (152) cmd ::= SHOW DNODES */ - { 179, -2 }, /* (153) cmd ::= SHOW USERS */ - { 179, -2 }, /* (154) cmd ::= SHOW DATABASES */ - { 179, -4 }, /* (155) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ - { 179, -4 }, /* (156) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ - { 179, -3 }, /* (157) cmd ::= SHOW db_name_cond_opt VGROUPS */ - { 179, -2 }, /* (158) cmd ::= SHOW MNODES */ - { 179, -2 }, /* (159) cmd ::= SHOW MODULES */ - { 179, -2 }, /* (160) cmd ::= SHOW QNODES */ - { 179, -2 }, /* (161) cmd ::= SHOW FUNCTIONS */ - { 179, -5 }, /* (162) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ - { 179, -2 }, /* (163) cmd ::= SHOW STREAMS */ - { 214, 0 }, /* (164) db_name_cond_opt ::= */ - { 214, -2 }, /* (165) db_name_cond_opt ::= db_name NK_DOT */ - { 215, 0 }, /* (166) like_pattern_opt ::= */ - { 215, -2 }, /* (167) like_pattern_opt ::= LIKE NK_STRING */ - { 216, -1 }, /* (168) table_name_cond ::= table_name */ - { 217, 0 }, /* (169) from_db_opt ::= */ - { 217, -2 }, /* (170) from_db_opt ::= FROM db_name */ - { 211, -1 }, /* (171) func_name_list ::= func_name */ - { 211, -3 }, /* (172) func_name_list ::= func_name_list NK_COMMA col_name */ - { 218, -1 }, /* (173) func_name ::= function_name */ - { 179, -8 }, /* (174) cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ - { 179, -10 }, /* (175) cmd ::= CREATE FULLTEXT INDEX not_exists_opt index_name ON table_name NK_LP col_name_list NK_RP */ - { 179, -6 }, /* (176) cmd ::= DROP INDEX exists_opt index_name ON table_name */ - { 221, 0 }, /* (177) index_options ::= */ - { 221, -9 }, /* (178) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt */ - { 221, -11 }, /* (179) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt */ - { 222, -1 }, /* (180) func_list ::= func */ - { 222, -3 }, /* (181) func_list ::= func_list NK_COMMA func */ - { 225, -4 }, /* (182) func ::= function_name NK_LP expression_list NK_RP */ - { 179, -6 }, /* (183) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ - { 179, -6 }, /* (184) cmd ::= CREATE TOPIC not_exists_opt topic_name AS db_name */ - { 179, -4 }, /* (185) cmd ::= DROP TOPIC exists_opt topic_name */ - { 179, -2 }, /* (186) cmd ::= DESC full_table_name */ - { 179, -2 }, /* (187) cmd ::= DESCRIBE full_table_name */ - { 179, -3 }, /* (188) cmd ::= RESET QUERY CACHE */ - { 179, -4 }, /* (189) cmd ::= EXPLAIN analyze_opt explain_options query_expression */ - { 229, 0 }, /* (190) analyze_opt ::= */ - { 229, -1 }, /* (191) analyze_opt ::= ANALYZE */ - { 230, 0 }, /* (192) explain_options ::= */ - { 230, -3 }, /* (193) explain_options ::= explain_options VERBOSE NK_BOOL */ - { 230, -3 }, /* (194) explain_options ::= explain_options RATIO NK_FLOAT */ - { 179, -1 }, /* (195) cmd ::= query_expression */ - { 182, -1 }, /* (196) literal ::= NK_INTEGER */ - { 182, -1 }, /* (197) literal ::= NK_FLOAT */ - { 182, -1 }, /* (198) literal ::= NK_STRING */ - { 182, -1 }, /* (199) literal ::= NK_BOOL */ - { 182, -2 }, /* (200) literal ::= TIMESTAMP NK_STRING */ - { 182, -1 }, /* (201) literal ::= duration_literal */ - { 182, -1 }, /* (202) literal ::= NULL */ - { 223, -1 }, /* (203) duration_literal ::= NK_VARIABLE */ - { 231, -1 }, /* (204) signed ::= NK_INTEGER */ - { 231, -2 }, /* (205) signed ::= NK_PLUS NK_INTEGER */ - { 231, -2 }, /* (206) signed ::= NK_MINUS NK_INTEGER */ - { 231, -1 }, /* (207) signed ::= NK_FLOAT */ - { 231, -2 }, /* (208) signed ::= NK_PLUS NK_FLOAT */ - { 231, -2 }, /* (209) signed ::= NK_MINUS NK_FLOAT */ - { 232, -1 }, /* (210) signed_literal ::= signed */ - { 232, -1 }, /* (211) signed_literal ::= NK_STRING */ - { 232, -1 }, /* (212) signed_literal ::= NK_BOOL */ - { 232, -2 }, /* (213) signed_literal ::= TIMESTAMP NK_STRING */ - { 232, -1 }, /* (214) signed_literal ::= duration_literal */ - { 232, -1 }, /* (215) signed_literal ::= NULL */ - { 206, -1 }, /* (216) literal_list ::= signed_literal */ - { 206, -3 }, /* (217) literal_list ::= literal_list NK_COMMA signed_literal */ - { 188, -1 }, /* (218) db_name ::= NK_ID */ - { 209, -1 }, /* (219) table_name ::= NK_ID */ - { 202, -1 }, /* (220) column_name ::= NK_ID */ - { 219, -1 }, /* (221) function_name ::= NK_ID */ - { 233, -1 }, /* (222) table_alias ::= NK_ID */ - { 234, -1 }, /* (223) column_alias ::= NK_ID */ - { 184, -1 }, /* (224) user_name ::= NK_ID */ - { 220, -1 }, /* (225) index_name ::= NK_ID */ - { 227, -1 }, /* (226) topic_name ::= NK_ID */ - { 235, -1 }, /* (227) expression ::= literal */ - { 235, -1 }, /* (228) expression ::= pseudo_column */ - { 235, -1 }, /* (229) expression ::= column_reference */ - { 235, -4 }, /* (230) expression ::= function_name NK_LP expression_list NK_RP */ - { 235, -4 }, /* (231) expression ::= function_name NK_LP NK_STAR NK_RP */ - { 235, -1 }, /* (232) expression ::= subquery */ - { 235, -3 }, /* (233) expression ::= NK_LP expression NK_RP */ - { 235, -2 }, /* (234) expression ::= NK_PLUS expression */ - { 235, -2 }, /* (235) expression ::= NK_MINUS expression */ - { 235, -3 }, /* (236) expression ::= expression NK_PLUS expression */ - { 235, -3 }, /* (237) expression ::= expression NK_MINUS expression */ - { 235, -3 }, /* (238) expression ::= expression NK_STAR expression */ - { 235, -3 }, /* (239) expression ::= expression NK_SLASH expression */ - { 235, -3 }, /* (240) expression ::= expression NK_REM expression */ - { 226, -1 }, /* (241) expression_list ::= expression */ - { 226, -3 }, /* (242) expression_list ::= expression_list NK_COMMA expression */ - { 237, -1 }, /* (243) column_reference ::= column_name */ - { 237, -3 }, /* (244) column_reference ::= table_name NK_DOT column_name */ - { 236, -2 }, /* (245) pseudo_column ::= NK_UNDERLINE ROWTS */ - { 236, -1 }, /* (246) pseudo_column ::= TBNAME */ - { 236, -2 }, /* (247) pseudo_column ::= NK_UNDERLINE QSTARTTS */ - { 236, -2 }, /* (248) pseudo_column ::= NK_UNDERLINE QENDTS */ - { 236, -2 }, /* (249) pseudo_column ::= NK_UNDERLINE WSTARTTS */ - { 236, -2 }, /* (250) pseudo_column ::= NK_UNDERLINE WENDTS */ - { 236, -2 }, /* (251) pseudo_column ::= NK_UNDERLINE WDURATION */ - { 239, -3 }, /* (252) predicate ::= expression compare_op expression */ - { 239, -5 }, /* (253) predicate ::= expression BETWEEN expression AND expression */ - { 239, -6 }, /* (254) predicate ::= expression NOT BETWEEN expression AND expression */ - { 239, -3 }, /* (255) predicate ::= expression IS NULL */ - { 239, -4 }, /* (256) predicate ::= expression IS NOT NULL */ - { 239, -3 }, /* (257) predicate ::= expression in_op in_predicate_value */ - { 240, -1 }, /* (258) compare_op ::= NK_LT */ - { 240, -1 }, /* (259) compare_op ::= NK_GT */ - { 240, -1 }, /* (260) compare_op ::= NK_LE */ - { 240, -1 }, /* (261) compare_op ::= NK_GE */ - { 240, -1 }, /* (262) compare_op ::= NK_NE */ - { 240, -1 }, /* (263) compare_op ::= NK_EQ */ - { 240, -1 }, /* (264) compare_op ::= LIKE */ - { 240, -2 }, /* (265) compare_op ::= NOT LIKE */ - { 240, -1 }, /* (266) compare_op ::= MATCH */ - { 240, -1 }, /* (267) compare_op ::= NMATCH */ - { 241, -1 }, /* (268) in_op ::= IN */ - { 241, -2 }, /* (269) in_op ::= NOT IN */ - { 242, -3 }, /* (270) in_predicate_value ::= NK_LP expression_list NK_RP */ - { 243, -1 }, /* (271) boolean_value_expression ::= boolean_primary */ - { 243, -2 }, /* (272) boolean_value_expression ::= NOT boolean_primary */ - { 243, -3 }, /* (273) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - { 243, -3 }, /* (274) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - { 244, -1 }, /* (275) boolean_primary ::= predicate */ - { 244, -3 }, /* (276) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - { 245, -1 }, /* (277) common_expression ::= expression */ - { 245, -1 }, /* (278) common_expression ::= boolean_value_expression */ - { 246, -2 }, /* (279) from_clause ::= FROM table_reference_list */ - { 247, -1 }, /* (280) table_reference_list ::= table_reference */ - { 247, -3 }, /* (281) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - { 248, -1 }, /* (282) table_reference ::= table_primary */ - { 248, -1 }, /* (283) table_reference ::= joined_table */ - { 249, -2 }, /* (284) table_primary ::= table_name alias_opt */ - { 249, -4 }, /* (285) table_primary ::= db_name NK_DOT table_name alias_opt */ - { 249, -2 }, /* (286) table_primary ::= subquery alias_opt */ - { 249, -1 }, /* (287) table_primary ::= parenthesized_joined_table */ - { 251, 0 }, /* (288) alias_opt ::= */ - { 251, -1 }, /* (289) alias_opt ::= table_alias */ - { 251, -2 }, /* (290) alias_opt ::= AS table_alias */ - { 252, -3 }, /* (291) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - { 252, -3 }, /* (292) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - { 250, -6 }, /* (293) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ - { 253, 0 }, /* (294) join_type ::= */ - { 253, -1 }, /* (295) join_type ::= INNER */ - { 255, -9 }, /* (296) query_specification ::= SELECT set_quantifier_opt select_list from_clause where_clause_opt partition_by_clause_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ - { 256, 0 }, /* (297) set_quantifier_opt ::= */ - { 256, -1 }, /* (298) set_quantifier_opt ::= DISTINCT */ - { 256, -1 }, /* (299) set_quantifier_opt ::= ALL */ - { 257, -1 }, /* (300) select_list ::= NK_STAR */ - { 257, -1 }, /* (301) select_list ::= select_sublist */ - { 263, -1 }, /* (302) select_sublist ::= select_item */ - { 263, -3 }, /* (303) select_sublist ::= select_sublist NK_COMMA select_item */ - { 264, -1 }, /* (304) select_item ::= common_expression */ - { 264, -2 }, /* (305) select_item ::= common_expression column_alias */ - { 264, -3 }, /* (306) select_item ::= common_expression AS column_alias */ - { 264, -3 }, /* (307) select_item ::= table_name NK_DOT NK_STAR */ - { 258, 0 }, /* (308) where_clause_opt ::= */ - { 258, -2 }, /* (309) where_clause_opt ::= WHERE search_condition */ - { 259, 0 }, /* (310) partition_by_clause_opt ::= */ - { 259, -3 }, /* (311) partition_by_clause_opt ::= PARTITION BY expression_list */ - { 260, 0 }, /* (312) twindow_clause_opt ::= */ - { 260, -6 }, /* (313) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ - { 260, -4 }, /* (314) twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP */ - { 260, -6 }, /* (315) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ - { 260, -8 }, /* (316) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ - { 224, 0 }, /* (317) sliding_opt ::= */ - { 224, -4 }, /* (318) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ - { 265, 0 }, /* (319) fill_opt ::= */ - { 265, -4 }, /* (320) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - { 265, -6 }, /* (321) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ - { 266, -1 }, /* (322) fill_mode ::= NONE */ - { 266, -1 }, /* (323) fill_mode ::= PREV */ - { 266, -1 }, /* (324) fill_mode ::= NULL */ - { 266, -1 }, /* (325) fill_mode ::= LINEAR */ - { 266, -1 }, /* (326) fill_mode ::= NEXT */ - { 261, 0 }, /* (327) group_by_clause_opt ::= */ - { 261, -3 }, /* (328) group_by_clause_opt ::= GROUP BY group_by_list */ - { 267, -1 }, /* (329) group_by_list ::= expression */ - { 267, -3 }, /* (330) group_by_list ::= group_by_list NK_COMMA expression */ - { 262, 0 }, /* (331) having_clause_opt ::= */ - { 262, -2 }, /* (332) having_clause_opt ::= HAVING search_condition */ - { 228, -4 }, /* (333) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ - { 268, -1 }, /* (334) query_expression_body ::= query_primary */ - { 268, -4 }, /* (335) query_expression_body ::= query_expression_body UNION ALL query_expression_body */ - { 272, -1 }, /* (336) query_primary ::= query_specification */ - { 269, 0 }, /* (337) order_by_clause_opt ::= */ - { 269, -3 }, /* (338) order_by_clause_opt ::= ORDER BY sort_specification_list */ - { 270, 0 }, /* (339) slimit_clause_opt ::= */ - { 270, -2 }, /* (340) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - { 270, -4 }, /* (341) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - { 270, -4 }, /* (342) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - { 271, 0 }, /* (343) limit_clause_opt ::= */ - { 271, -2 }, /* (344) limit_clause_opt ::= LIMIT NK_INTEGER */ - { 271, -4 }, /* (345) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - { 271, -4 }, /* (346) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - { 238, -3 }, /* (347) subquery ::= NK_LP query_expression NK_RP */ - { 254, -1 }, /* (348) search_condition ::= common_expression */ - { 273, -1 }, /* (349) sort_specification_list ::= sort_specification */ - { 273, -3 }, /* (350) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - { 274, -3 }, /* (351) sort_specification ::= expression ordering_specification_opt null_ordering_opt */ - { 275, 0 }, /* (352) ordering_specification_opt ::= */ - { 275, -1 }, /* (353) ordering_specification_opt ::= ASC */ - { 275, -1 }, /* (354) ordering_specification_opt ::= DESC */ - { 276, 0 }, /* (355) null_ordering_opt ::= */ - { 276, -2 }, /* (356) null_ordering_opt ::= NULLS FIRST */ - { 276, -2 }, /* (357) null_ordering_opt ::= NULLS LAST */ + { 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 */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -2428,28 +2434,28 @@ static YYACTIONTYPE yy_reduce( yy_destructor(yypParser,182,&yymsp[0].minor); break; case 24: /* cmd ::= CREATE USER user_name PASS NK_STRING */ -{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-2].minor.yy95, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-2].minor.yy337, &yymsp[0].minor.yy0); } break; case 25: /* cmd ::= ALTER USER user_name PASS NK_STRING */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy95, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy337, 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.yy95, TSDB_ALTER_USER_PRIVILEGES, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy337, TSDB_ALTER_USER_PRIVILEGES, &yymsp[0].minor.yy0); } break; case 27: /* cmd ::= DROP USER user_name */ -{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy95); } +{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy337); } break; case 28: /* cmd ::= CREATE DNODE dnode_endpoint */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy95, NULL); } +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy337, NULL); } break; case 29: /* cmd ::= CREATE DNODE dnode_host_name PORT NK_INTEGER */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy95, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy337, &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.yy95); } +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy337); } break; case 32: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); } @@ -2466,17 +2472,17 @@ static YYACTIONTYPE yy_reduce( case 36: /* dnode_endpoint ::= NK_STRING */ case 37: /* dnode_host_name ::= NK_ID */ yytestcase(yyruleno==37); case 38: /* dnode_host_name ::= NK_IPTOKEN */ yytestcase(yyruleno==38); - case 218: /* db_name ::= NK_ID */ yytestcase(yyruleno==218); - case 219: /* table_name ::= NK_ID */ yytestcase(yyruleno==219); - case 220: /* column_name ::= NK_ID */ yytestcase(yyruleno==220); - case 221: /* function_name ::= NK_ID */ yytestcase(yyruleno==221); - case 222: /* table_alias ::= NK_ID */ yytestcase(yyruleno==222); - case 223: /* column_alias ::= NK_ID */ yytestcase(yyruleno==223); - case 224: /* user_name ::= NK_ID */ yytestcase(yyruleno==224); - case 225: /* index_name ::= NK_ID */ yytestcase(yyruleno==225); - case 226: /* topic_name ::= NK_ID */ yytestcase(yyruleno==226); -{ yylhsminor.yy95 = yymsp[0].minor.yy0; } - yymsp[0].minor.yy95 = yylhsminor.yy95; + 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; break; case 39: /* cmd ::= ALTER LOCAL NK_STRING */ { pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[0].minor.yy0, NULL); } @@ -2491,977 +2497,985 @@ 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.yy151, &yymsp[-1].minor.yy95, yymsp[0].minor.yy46); } +{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy265, &yymsp[-1].minor.yy337, yymsp[0].minor.yy24); } break; case 44: /* cmd ::= DROP DATABASE exists_opt db_name */ -{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy151, &yymsp[0].minor.yy95); } +{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy265, &yymsp[0].minor.yy337); } break; case 45: /* cmd ::= USE db_name */ -{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy95); } +{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy337); } break; case 46: /* cmd ::= ALTER DATABASE db_name alter_db_options */ -{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy95, yymsp[0].minor.yy46); } +{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy337, yymsp[0].minor.yy24); } break; case 47: /* not_exists_opt ::= IF NOT EXISTS */ -{ yymsp[-2].minor.yy151 = true; } +{ yymsp[-2].minor.yy265 = true; } break; case 48: /* not_exists_opt ::= */ case 50: /* exists_opt ::= */ yytestcase(yyruleno==50); - case 190: /* analyze_opt ::= */ yytestcase(yyruleno==190); - case 297: /* set_quantifier_opt ::= */ yytestcase(yyruleno==297); -{ yymsp[1].minor.yy151 = false; } + case 192: /* analyze_opt ::= */ yytestcase(yyruleno==192); + case 299: /* set_quantifier_opt ::= */ yytestcase(yyruleno==299); +{ yymsp[1].minor.yy265 = false; } break; case 49: /* exists_opt ::= IF EXISTS */ -{ yymsp[-1].minor.yy151 = true; } +{ yymsp[-1].minor.yy265 = true; } break; case 51: /* db_options ::= */ -{ yymsp[1].minor.yy46 = createDefaultDatabaseOptions(pCxt); } +{ yymsp[1].minor.yy24 = createDefaultDatabaseOptions(pCxt); } break; case 52: /* db_options ::= db_options BLOCKS NK_INTEGER */ -{ yylhsminor.yy46 = setDatabaseOption(pCxt, yymsp[-2].minor.yy46, DB_OPTION_BLOCKS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy46 = yylhsminor.yy46; +{ yylhsminor.yy24 = setDatabaseOption(pCxt, yymsp[-2].minor.yy24, DB_OPTION_BLOCKS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy24 = yylhsminor.yy24; break; case 53: /* db_options ::= db_options CACHE NK_INTEGER */ -{ yylhsminor.yy46 = setDatabaseOption(pCxt, yymsp[-2].minor.yy46, DB_OPTION_CACHE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy46 = yylhsminor.yy46; +{ yylhsminor.yy24 = setDatabaseOption(pCxt, yymsp[-2].minor.yy24, DB_OPTION_CACHE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy24 = yylhsminor.yy24; break; case 54: /* db_options ::= db_options CACHELAST NK_INTEGER */ -{ yylhsminor.yy46 = setDatabaseOption(pCxt, yymsp[-2].minor.yy46, DB_OPTION_CACHELAST, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy46 = yylhsminor.yy46; +{ yylhsminor.yy24 = setDatabaseOption(pCxt, yymsp[-2].minor.yy24, DB_OPTION_CACHELAST, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy24 = yylhsminor.yy24; break; case 55: /* db_options ::= db_options COMP NK_INTEGER */ -{ yylhsminor.yy46 = setDatabaseOption(pCxt, yymsp[-2].minor.yy46, DB_OPTION_COMP, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy46 = yylhsminor.yy46; +{ yylhsminor.yy24 = setDatabaseOption(pCxt, yymsp[-2].minor.yy24, DB_OPTION_COMP, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy24 = yylhsminor.yy24; break; case 56: /* db_options ::= db_options DAYS NK_INTEGER */ -{ yylhsminor.yy46 = setDatabaseOption(pCxt, yymsp[-2].minor.yy46, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy46 = yylhsminor.yy46; +{ yylhsminor.yy24 = setDatabaseOption(pCxt, yymsp[-2].minor.yy24, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy24 = yylhsminor.yy24; break; case 57: /* db_options ::= db_options FSYNC NK_INTEGER */ -{ yylhsminor.yy46 = setDatabaseOption(pCxt, yymsp[-2].minor.yy46, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy46 = yylhsminor.yy46; +{ yylhsminor.yy24 = setDatabaseOption(pCxt, yymsp[-2].minor.yy24, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy24 = yylhsminor.yy24; break; case 58: /* db_options ::= db_options MAXROWS NK_INTEGER */ -{ yylhsminor.yy46 = setDatabaseOption(pCxt, yymsp[-2].minor.yy46, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy46 = yylhsminor.yy46; +{ yylhsminor.yy24 = setDatabaseOption(pCxt, yymsp[-2].minor.yy24, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy24 = yylhsminor.yy24; break; case 59: /* db_options ::= db_options MINROWS NK_INTEGER */ -{ yylhsminor.yy46 = setDatabaseOption(pCxt, yymsp[-2].minor.yy46, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy46 = yylhsminor.yy46; +{ yylhsminor.yy24 = setDatabaseOption(pCxt, yymsp[-2].minor.yy24, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy24 = yylhsminor.yy24; break; - case 60: /* db_options ::= db_options KEEP NK_INTEGER */ -{ yylhsminor.yy46 = setDatabaseOption(pCxt, yymsp[-2].minor.yy46, DB_OPTION_KEEP, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy46 = yylhsminor.yy46; + 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; break; case 61: /* db_options ::= db_options PRECISION NK_STRING */ -{ yylhsminor.yy46 = setDatabaseOption(pCxt, yymsp[-2].minor.yy46, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy46 = yylhsminor.yy46; +{ yylhsminor.yy24 = setDatabaseOption(pCxt, yymsp[-2].minor.yy24, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy24 = yylhsminor.yy24; break; case 62: /* db_options ::= db_options QUORUM NK_INTEGER */ -{ yylhsminor.yy46 = setDatabaseOption(pCxt, yymsp[-2].minor.yy46, DB_OPTION_QUORUM, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy46 = yylhsminor.yy46; +{ yylhsminor.yy24 = setDatabaseOption(pCxt, yymsp[-2].minor.yy24, DB_OPTION_QUORUM, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy24 = yylhsminor.yy24; break; case 63: /* db_options ::= db_options REPLICA NK_INTEGER */ -{ yylhsminor.yy46 = setDatabaseOption(pCxt, yymsp[-2].minor.yy46, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy46 = yylhsminor.yy46; +{ yylhsminor.yy24 = setDatabaseOption(pCxt, yymsp[-2].minor.yy24, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy24 = yylhsminor.yy24; break; case 64: /* db_options ::= db_options TTL NK_INTEGER */ -{ yylhsminor.yy46 = setDatabaseOption(pCxt, yymsp[-2].minor.yy46, DB_OPTION_TTL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy46 = yylhsminor.yy46; +{ yylhsminor.yy24 = setDatabaseOption(pCxt, yymsp[-2].minor.yy24, DB_OPTION_TTL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy24 = yylhsminor.yy24; break; case 65: /* db_options ::= db_options WAL NK_INTEGER */ -{ yylhsminor.yy46 = setDatabaseOption(pCxt, yymsp[-2].minor.yy46, DB_OPTION_WAL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy46 = yylhsminor.yy46; +{ yylhsminor.yy24 = setDatabaseOption(pCxt, yymsp[-2].minor.yy24, DB_OPTION_WAL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy24 = yylhsminor.yy24; break; case 66: /* db_options ::= db_options VGROUPS NK_INTEGER */ -{ yylhsminor.yy46 = setDatabaseOption(pCxt, yymsp[-2].minor.yy46, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy46 = yylhsminor.yy46; +{ yylhsminor.yy24 = setDatabaseOption(pCxt, yymsp[-2].minor.yy24, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy24 = yylhsminor.yy24; break; case 67: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */ -{ yylhsminor.yy46 = setDatabaseOption(pCxt, yymsp[-2].minor.yy46, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy46 = yylhsminor.yy46; +{ yylhsminor.yy24 = setDatabaseOption(pCxt, yymsp[-2].minor.yy24, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy24 = yylhsminor.yy24; break; case 68: /* db_options ::= db_options STREAM_MODE NK_INTEGER */ -{ yylhsminor.yy46 = setDatabaseOption(pCxt, yymsp[-2].minor.yy46, DB_OPTION_STREAM_MODE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy46 = yylhsminor.yy46; +{ yylhsminor.yy24 = setDatabaseOption(pCxt, yymsp[-2].minor.yy24, DB_OPTION_STREAM_MODE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy24 = yylhsminor.yy24; break; case 69: /* db_options ::= db_options RETENTIONS NK_STRING */ -{ yylhsminor.yy46 = setDatabaseOption(pCxt, yymsp[-2].minor.yy46, DB_OPTION_RETENTIONS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy46 = yylhsminor.yy46; +{ yylhsminor.yy24 = setDatabaseOption(pCxt, yymsp[-2].minor.yy24, DB_OPTION_RETENTIONS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy24 = yylhsminor.yy24; break; case 70: /* alter_db_options ::= alter_db_option */ -{ yylhsminor.yy46 = createDefaultAlterDatabaseOptions(pCxt); yylhsminor.yy46 = setDatabaseOption(pCxt, yylhsminor.yy46, yymsp[0].minor.yy145.type, &yymsp[0].minor.yy145.val); } - yymsp[0].minor.yy46 = yylhsminor.yy46; +{ yylhsminor.yy24 = createDefaultAlterDatabaseOptions(pCxt); yylhsminor.yy24 = setDatabaseAlterOption(pCxt, yylhsminor.yy24, &yymsp[0].minor.yy553); } + yymsp[0].minor.yy24 = yylhsminor.yy24; break; case 71: /* alter_db_options ::= alter_db_options alter_db_option */ -{ yylhsminor.yy46 = setDatabaseOption(pCxt, yymsp[-1].minor.yy46, yymsp[0].minor.yy145.type, &yymsp[0].minor.yy145.val); } - yymsp[-1].minor.yy46 = yylhsminor.yy46; +{ yylhsminor.yy24 = setDatabaseAlterOption(pCxt, yymsp[-1].minor.yy24, &yymsp[0].minor.yy553); } + yymsp[-1].minor.yy24 = yylhsminor.yy24; break; case 72: /* alter_db_option ::= BLOCKS NK_INTEGER */ -{ yymsp[-1].minor.yy145.type = DB_OPTION_BLOCKS; yymsp[-1].minor.yy145.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy553.type = DB_OPTION_BLOCKS; yymsp[-1].minor.yy553.val = yymsp[0].minor.yy0; } break; case 73: /* alter_db_option ::= FSYNC NK_INTEGER */ -{ yymsp[-1].minor.yy145.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy145.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy553.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy553.val = yymsp[0].minor.yy0; } break; - case 74: /* alter_db_option ::= KEEP NK_INTEGER */ -{ yymsp[-1].minor.yy145.type = DB_OPTION_KEEP; yymsp[-1].minor.yy145.val = yymsp[0].minor.yy0; } + 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; } break; case 75: /* alter_db_option ::= WAL NK_INTEGER */ -{ yymsp[-1].minor.yy145.type = DB_OPTION_WAL; yymsp[-1].minor.yy145.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy553.type = DB_OPTION_WAL; yymsp[-1].minor.yy553.val = yymsp[0].minor.yy0; } break; case 76: /* alter_db_option ::= QUORUM NK_INTEGER */ -{ yymsp[-1].minor.yy145.type = DB_OPTION_QUORUM; yymsp[-1].minor.yy145.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy553.type = DB_OPTION_QUORUM; yymsp[-1].minor.yy553.val = yymsp[0].minor.yy0; } break; case 77: /* alter_db_option ::= CACHELAST NK_INTEGER */ -{ yymsp[-1].minor.yy145.type = DB_OPTION_CACHELAST; yymsp[-1].minor.yy145.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy553.type = DB_OPTION_CACHELAST; yymsp[-1].minor.yy553.val = yymsp[0].minor.yy0; } break; case 78: /* alter_db_option ::= REPLICA NK_INTEGER */ -{ yymsp[-1].minor.yy145.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy145.val = yymsp[0].minor.yy0; } - break; - case 79: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ - case 81: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==81); -{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy151, yymsp[-5].minor.yy46, yymsp[-3].minor.yy194, yymsp[-1].minor.yy194, yymsp[0].minor.yy46); } - break; - case 80: /* cmd ::= CREATE TABLE multi_create_clause */ -{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy194); } - break; - case 82: /* cmd ::= DROP TABLE multi_drop_clause */ -{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy194); } - break; - case 83: /* cmd ::= DROP STABLE exists_opt full_table_name */ -{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy151, yymsp[0].minor.yy46); } - break; - case 84: /* cmd ::= ALTER TABLE alter_table_clause */ - case 85: /* cmd ::= ALTER STABLE alter_table_clause */ yytestcase(yyruleno==85); - case 195: /* cmd ::= query_expression */ yytestcase(yyruleno==195); -{ pCxt->pRootNode = yymsp[0].minor.yy46; } - break; - case 86: /* alter_table_clause ::= full_table_name alter_table_options */ -{ yylhsminor.yy46 = createAlterTableOption(pCxt, yymsp[-1].minor.yy46, yymsp[0].minor.yy46); } - yymsp[-1].minor.yy46 = yylhsminor.yy46; - break; - case 87: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ -{ yylhsminor.yy46 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy46, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy95, yymsp[0].minor.yy400); } - yymsp[-4].minor.yy46 = yylhsminor.yy46; - break; - case 88: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ -{ yylhsminor.yy46 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy46, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy95); } - yymsp[-3].minor.yy46 = yylhsminor.yy46; - break; - case 89: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ -{ yylhsminor.yy46 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy46, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy95, yymsp[0].minor.yy400); } - yymsp[-4].minor.yy46 = yylhsminor.yy46; - break; - case 90: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ -{ yylhsminor.yy46 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy46, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy95, &yymsp[0].minor.yy95); } - yymsp[-4].minor.yy46 = yylhsminor.yy46; - break; - case 91: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ -{ yylhsminor.yy46 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy46, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy95, yymsp[0].minor.yy400); } - yymsp[-4].minor.yy46 = yylhsminor.yy46; - break; - case 92: /* alter_table_clause ::= full_table_name DROP TAG column_name */ -{ yylhsminor.yy46 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy46, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy95); } - yymsp[-3].minor.yy46 = yylhsminor.yy46; - break; - case 93: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ -{ yylhsminor.yy46 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy46, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy95, yymsp[0].minor.yy400); } - yymsp[-4].minor.yy46 = yylhsminor.yy46; - break; - case 94: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ -{ yylhsminor.yy46 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy46, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy95, &yymsp[0].minor.yy95); } - yymsp[-4].minor.yy46 = yylhsminor.yy46; - break; - case 95: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ literal */ -{ yylhsminor.yy46 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy46, &yymsp[-2].minor.yy95, yymsp[0].minor.yy46); } - yymsp[-5].minor.yy46 = yylhsminor.yy46; - break; - case 96: /* multi_create_clause ::= create_subtable_clause */ - case 99: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==99); - case 106: /* column_def_list ::= column_def */ yytestcase(yyruleno==106); - case 149: /* col_name_list ::= col_name */ yytestcase(yyruleno==149); - case 171: /* func_name_list ::= func_name */ yytestcase(yyruleno==171); - case 180: /* func_list ::= func */ yytestcase(yyruleno==180); - case 216: /* literal_list ::= signed_literal */ yytestcase(yyruleno==216); - case 302: /* select_sublist ::= select_item */ yytestcase(yyruleno==302); - case 349: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==349); -{ yylhsminor.yy194 = createNodeList(pCxt, yymsp[0].minor.yy46); } - yymsp[0].minor.yy194 = yylhsminor.yy194; +{ yymsp[-1].minor.yy553.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy553.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; + 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; + 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); } + break; + case 82: /* cmd ::= CREATE TABLE multi_create_clause */ +{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy504); } + break; + case 84: /* cmd ::= DROP TABLE multi_drop_clause */ +{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy504); } + break; + case 85: /* cmd ::= DROP STABLE exists_opt full_table_name */ +{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy265, yymsp[0].minor.yy24); } + 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; } + 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; + 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; + 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; + 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; + 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; + 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; + 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; + 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; + 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; + 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; + 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; break; - case 97: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ - case 100: /* multi_drop_clause ::= multi_drop_clause drop_table_clause */ yytestcase(yyruleno==100); -{ yylhsminor.yy194 = addNodeToList(pCxt, yymsp[-1].minor.yy194, yymsp[0].minor.yy46); } - yymsp[-1].minor.yy194 = yylhsminor.yy194; + 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; break; - case 98: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP */ -{ yylhsminor.yy46 = createCreateSubTableClause(pCxt, yymsp[-8].minor.yy151, yymsp[-7].minor.yy46, yymsp[-5].minor.yy46, yymsp[-4].minor.yy194, yymsp[-1].minor.yy194); } - yymsp[-8].minor.yy46 = yylhsminor.yy46; + 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; break; - case 101: /* drop_table_clause ::= exists_opt full_table_name */ -{ yylhsminor.yy46 = createDropTableClause(pCxt, yymsp[-1].minor.yy151, yymsp[0].minor.yy46); } - yymsp[-1].minor.yy46 = yylhsminor.yy46; + 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; break; - case 102: /* specific_tags_opt ::= */ - case 133: /* tags_def_opt ::= */ yytestcase(yyruleno==133); - case 310: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==310); - case 327: /* group_by_clause_opt ::= */ yytestcase(yyruleno==327); - case 337: /* order_by_clause_opt ::= */ yytestcase(yyruleno==337); -{ yymsp[1].minor.yy194 = NULL; } + 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; } break; - case 103: /* specific_tags_opt ::= NK_LP col_name_list NK_RP */ -{ yymsp[-2].minor.yy194 = yymsp[-1].minor.yy194; } + case 105: /* specific_tags_opt ::= NK_LP col_name_list NK_RP */ +{ yymsp[-2].minor.yy504 = yymsp[-1].minor.yy504; } break; - case 104: /* full_table_name ::= table_name */ -{ yylhsminor.yy46 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy95, NULL); } - yymsp[0].minor.yy46 = yylhsminor.yy46; + case 106: /* full_table_name ::= table_name */ +{ yylhsminor.yy24 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy337, NULL); } + yymsp[0].minor.yy24 = yylhsminor.yy24; break; - case 105: /* full_table_name ::= db_name NK_DOT table_name */ -{ yylhsminor.yy46 = createRealTableNode(pCxt, &yymsp[-2].minor.yy95, &yymsp[0].minor.yy95, NULL); } - yymsp[-2].minor.yy46 = yylhsminor.yy46; + 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; break; - case 107: /* column_def_list ::= column_def_list NK_COMMA column_def */ - case 150: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==150); - case 172: /* func_name_list ::= func_name_list NK_COMMA col_name */ yytestcase(yyruleno==172); - case 181: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==181); - case 217: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==217); - case 303: /* select_sublist ::= select_sublist NK_COMMA select_item */ yytestcase(yyruleno==303); - case 350: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==350); -{ yylhsminor.yy194 = addNodeToList(pCxt, yymsp[-2].minor.yy194, yymsp[0].minor.yy46); } - yymsp[-2].minor.yy194 = yylhsminor.yy194; + 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; break; - case 108: /* column_def ::= column_name type_name */ -{ yylhsminor.yy46 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy95, yymsp[0].minor.yy400, NULL); } - yymsp[-1].minor.yy46 = yylhsminor.yy46; + 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; break; - case 109: /* column_def ::= column_name type_name COMMENT NK_STRING */ -{ yylhsminor.yy46 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy95, yymsp[-2].minor.yy400, &yymsp[0].minor.yy0); } - yymsp[-3].minor.yy46 = yylhsminor.yy46; + 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; break; - case 110: /* type_name ::= BOOL */ -{ yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_BOOL); } + case 112: /* type_name ::= BOOL */ +{ yymsp[0].minor.yy212 = createDataType(TSDB_DATA_TYPE_BOOL); } break; - case 111: /* type_name ::= TINYINT */ -{ yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_TINYINT); } + case 113: /* type_name ::= TINYINT */ +{ yymsp[0].minor.yy212 = createDataType(TSDB_DATA_TYPE_TINYINT); } break; - case 112: /* type_name ::= SMALLINT */ -{ yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_SMALLINT); } + case 114: /* type_name ::= SMALLINT */ +{ yymsp[0].minor.yy212 = createDataType(TSDB_DATA_TYPE_SMALLINT); } break; - case 113: /* type_name ::= INT */ - case 114: /* type_name ::= INTEGER */ yytestcase(yyruleno==114); -{ yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_INT); } + case 115: /* type_name ::= INT */ + case 116: /* type_name ::= INTEGER */ yytestcase(yyruleno==116); +{ yymsp[0].minor.yy212 = createDataType(TSDB_DATA_TYPE_INT); } break; - case 115: /* type_name ::= BIGINT */ -{ yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_BIGINT); } + case 117: /* type_name ::= BIGINT */ +{ yymsp[0].minor.yy212 = createDataType(TSDB_DATA_TYPE_BIGINT); } break; - case 116: /* type_name ::= FLOAT */ -{ yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_FLOAT); } + case 118: /* type_name ::= FLOAT */ +{ yymsp[0].minor.yy212 = createDataType(TSDB_DATA_TYPE_FLOAT); } break; - case 117: /* type_name ::= DOUBLE */ -{ yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_DOUBLE); } + case 119: /* type_name ::= DOUBLE */ +{ yymsp[0].minor.yy212 = createDataType(TSDB_DATA_TYPE_DOUBLE); } break; - case 118: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy400 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } + case 120: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy212 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } break; - case 119: /* type_name ::= TIMESTAMP */ -{ yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } + case 121: /* type_name ::= TIMESTAMP */ +{ yymsp[0].minor.yy212 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } break; - case 120: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy400 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } + case 122: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy212 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } break; - case 121: /* type_name ::= TINYINT UNSIGNED */ -{ yymsp[-1].minor.yy400 = createDataType(TSDB_DATA_TYPE_UTINYINT); } + case 123: /* type_name ::= TINYINT UNSIGNED */ +{ yymsp[-1].minor.yy212 = createDataType(TSDB_DATA_TYPE_UTINYINT); } break; - case 122: /* type_name ::= SMALLINT UNSIGNED */ -{ yymsp[-1].minor.yy400 = createDataType(TSDB_DATA_TYPE_USMALLINT); } + case 124: /* type_name ::= SMALLINT UNSIGNED */ +{ yymsp[-1].minor.yy212 = createDataType(TSDB_DATA_TYPE_USMALLINT); } break; - case 123: /* type_name ::= INT UNSIGNED */ -{ yymsp[-1].minor.yy400 = createDataType(TSDB_DATA_TYPE_UINT); } + case 125: /* type_name ::= INT UNSIGNED */ +{ yymsp[-1].minor.yy212 = createDataType(TSDB_DATA_TYPE_UINT); } break; - case 124: /* type_name ::= BIGINT UNSIGNED */ -{ yymsp[-1].minor.yy400 = createDataType(TSDB_DATA_TYPE_UBIGINT); } + case 126: /* type_name ::= BIGINT UNSIGNED */ +{ yymsp[-1].minor.yy212 = createDataType(TSDB_DATA_TYPE_UBIGINT); } break; - case 125: /* type_name ::= JSON */ -{ yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_JSON); } + case 127: /* type_name ::= JSON */ +{ yymsp[0].minor.yy212 = createDataType(TSDB_DATA_TYPE_JSON); } break; - case 126: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy400 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } + case 128: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy212 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } break; - case 127: /* type_name ::= MEDIUMBLOB */ -{ yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } + case 129: /* type_name ::= MEDIUMBLOB */ +{ yymsp[0].minor.yy212 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } break; - case 128: /* type_name ::= BLOB */ -{ yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_BLOB); } + case 130: /* type_name ::= BLOB */ +{ yymsp[0].minor.yy212 = createDataType(TSDB_DATA_TYPE_BLOB); } break; - case 129: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy400 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } + case 131: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy212 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } break; - case 130: /* type_name ::= DECIMAL */ -{ yymsp[0].minor.yy400 = createDataType(TSDB_DATA_TYPE_DECIMAL); } + case 132: /* type_name ::= DECIMAL */ +{ yymsp[0].minor.yy212 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; - case 131: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy400 = createDataType(TSDB_DATA_TYPE_DECIMAL); } + case 133: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy212 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; - case 132: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ -{ yymsp[-5].minor.yy400 = createDataType(TSDB_DATA_TYPE_DECIMAL); } + case 134: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ +{ yymsp[-5].minor.yy212 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; - case 134: /* tags_def_opt ::= tags_def */ - case 301: /* select_list ::= select_sublist */ yytestcase(yyruleno==301); -{ yylhsminor.yy194 = yymsp[0].minor.yy194; } - yymsp[0].minor.yy194 = yylhsminor.yy194; + 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; break; - case 135: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */ -{ yymsp[-3].minor.yy194 = yymsp[-1].minor.yy194; } + case 137: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */ +{ yymsp[-3].minor.yy504 = yymsp[-1].minor.yy504; } break; - case 136: /* table_options ::= */ -{ yymsp[1].minor.yy46 = createDefaultTableOptions(pCxt); } + case 138: /* table_options ::= */ +{ yymsp[1].minor.yy24 = createDefaultTableOptions(pCxt); } break; - case 137: /* table_options ::= table_options COMMENT NK_STRING */ -{ yylhsminor.yy46 = setTableOption(pCxt, yymsp[-2].minor.yy46, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy46 = yylhsminor.yy46; + 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; break; - case 138: /* table_options ::= table_options KEEP NK_INTEGER */ -{ yylhsminor.yy46 = setTableOption(pCxt, yymsp[-2].minor.yy46, TABLE_OPTION_KEEP, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy46 = yylhsminor.yy46; + 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; break; - case 139: /* table_options ::= table_options TTL NK_INTEGER */ -{ yylhsminor.yy46 = setTableOption(pCxt, yymsp[-2].minor.yy46, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy46 = yylhsminor.yy46; + 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; break; - case 140: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ -{ yylhsminor.yy46 = setTableSmaOption(pCxt, yymsp[-4].minor.yy46, yymsp[-1].minor.yy194); } - yymsp[-4].minor.yy46 = yylhsminor.yy46; + 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; break; - case 141: /* table_options ::= table_options ROLLUP NK_LP func_name_list NK_RP */ -{ yylhsminor.yy46 = setTableRollupOption(pCxt, yymsp[-4].minor.yy46, yymsp[-1].minor.yy194); } - yymsp[-4].minor.yy46 = yylhsminor.yy46; + 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; break; - case 142: /* table_options ::= table_options FILE_FACTOR NK_FLOAT */ -{ yylhsminor.yy46 = setTableOption(pCxt, yymsp[-2].minor.yy46, TABLE_OPTION_FILE_FACTOR, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy46 = yylhsminor.yy46; + 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; break; - case 143: /* table_options ::= table_options DELAY NK_INTEGER */ -{ yylhsminor.yy46 = setTableOption(pCxt, yymsp[-2].minor.yy46, TABLE_OPTION_DELAY, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy46 = yylhsminor.yy46; + 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; break; - case 144: /* alter_table_options ::= alter_table_option */ -{ yylhsminor.yy46 = createDefaultAlterTableOptions(pCxt); yylhsminor.yy46 = setTableOption(pCxt, yylhsminor.yy46, yymsp[0].minor.yy145.type, &yymsp[0].minor.yy145.val); } - yymsp[0].minor.yy46 = yylhsminor.yy46; + 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; break; - case 145: /* alter_table_options ::= alter_table_options alter_table_option */ -{ yylhsminor.yy46 = setTableOption(pCxt, yymsp[-1].minor.yy46, yymsp[0].minor.yy145.type, &yymsp[0].minor.yy145.val); } - yymsp[-1].minor.yy46 = yylhsminor.yy46; + 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; break; - case 146: /* alter_table_option ::= COMMENT NK_STRING */ -{ yymsp[-1].minor.yy145.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy145.val = yymsp[0].minor.yy0; } + 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; } break; - case 147: /* alter_table_option ::= KEEP NK_INTEGER */ -{ yymsp[-1].minor.yy145.type = TABLE_OPTION_KEEP; yymsp[-1].minor.yy145.val = yymsp[0].minor.yy0; } + 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; } break; - case 148: /* alter_table_option ::= TTL NK_INTEGER */ -{ yymsp[-1].minor.yy145.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy145.val = yymsp[0].minor.yy0; } + 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; } break; - case 151: /* col_name ::= column_name */ -{ yylhsminor.yy46 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy95); } - yymsp[0].minor.yy46 = yylhsminor.yy46; + case 153: /* col_name ::= column_name */ +{ yylhsminor.yy24 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy337); } + yymsp[0].minor.yy24 = yylhsminor.yy24; break; - case 152: /* cmd ::= SHOW DNODES */ + case 154: /* cmd ::= SHOW DNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT, NULL, NULL); } break; - case 153: /* cmd ::= SHOW USERS */ + case 155: /* cmd ::= SHOW USERS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USERS_STMT, NULL, NULL); } break; - case 154: /* cmd ::= SHOW DATABASES */ + case 156: /* cmd ::= SHOW DATABASES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT, NULL, NULL); } break; - case 155: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy46, yymsp[0].minor.yy46); } + 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); } break; - case 156: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy46, yymsp[0].minor.yy46); } + 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); } break; - case 157: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy46, NULL); } + case 159: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy24, NULL); } break; - case 158: /* cmd ::= SHOW MNODES */ + case 160: /* cmd ::= SHOW MNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT, NULL, NULL); } break; - case 159: /* cmd ::= SHOW MODULES */ + case 161: /* cmd ::= SHOW MODULES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MODULES_STMT, NULL, NULL); } break; - case 160: /* cmd ::= SHOW QNODES */ + case 162: /* cmd ::= SHOW QNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QNODES_STMT, NULL, NULL); } break; - case 161: /* cmd ::= SHOW FUNCTIONS */ + case 163: /* cmd ::= SHOW FUNCTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT, NULL, NULL); } break; - case 162: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[-1].minor.yy46, yymsp[0].minor.yy46); } + 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); } break; - case 163: /* cmd ::= SHOW STREAMS */ + case 165: /* cmd ::= SHOW STREAMS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT, NULL, NULL); } break; - case 164: /* db_name_cond_opt ::= */ - case 169: /* from_db_opt ::= */ yytestcase(yyruleno==169); -{ yymsp[1].minor.yy46 = createDefaultDatabaseCondValue(pCxt); } + case 166: /* db_name_cond_opt ::= */ + case 171: /* from_db_opt ::= */ yytestcase(yyruleno==171); +{ yymsp[1].minor.yy24 = createDefaultDatabaseCondValue(pCxt); } break; - case 165: /* db_name_cond_opt ::= db_name NK_DOT */ -{ yylhsminor.yy46 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy95); } - yymsp[-1].minor.yy46 = yylhsminor.yy46; + 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; break; - case 166: /* like_pattern_opt ::= */ - case 177: /* index_options ::= */ yytestcase(yyruleno==177); - case 308: /* where_clause_opt ::= */ yytestcase(yyruleno==308); - case 312: /* twindow_clause_opt ::= */ yytestcase(yyruleno==312); - case 317: /* sliding_opt ::= */ yytestcase(yyruleno==317); - case 319: /* fill_opt ::= */ yytestcase(yyruleno==319); - case 331: /* having_clause_opt ::= */ yytestcase(yyruleno==331); - case 339: /* slimit_clause_opt ::= */ yytestcase(yyruleno==339); - case 343: /* limit_clause_opt ::= */ yytestcase(yyruleno==343); -{ yymsp[1].minor.yy46 = NULL; } + 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; } break; - case 167: /* like_pattern_opt ::= LIKE NK_STRING */ -{ yymsp[-1].minor.yy46 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } + case 169: /* like_pattern_opt ::= LIKE NK_STRING */ +{ yymsp[-1].minor.yy24 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } break; - case 168: /* table_name_cond ::= table_name */ -{ yylhsminor.yy46 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy95); } - yymsp[0].minor.yy46 = yylhsminor.yy46; + 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; break; - case 170: /* from_db_opt ::= FROM db_name */ -{ yymsp[-1].minor.yy46 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy95); } + case 172: /* from_db_opt ::= FROM db_name */ +{ yymsp[-1].minor.yy24 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy337); } break; - case 173: /* func_name ::= function_name */ -{ yylhsminor.yy46 = createFunctionNode(pCxt, &yymsp[0].minor.yy95, NULL); } - yymsp[0].minor.yy46 = yylhsminor.yy46; + case 175: /* func_name ::= function_name */ +{ yylhsminor.yy24 = createFunctionNode(pCxt, &yymsp[0].minor.yy337, NULL); } + yymsp[0].minor.yy24 = yylhsminor.yy24; break; - case 174: /* cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ -{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy151, &yymsp[-3].minor.yy95, &yymsp[-1].minor.yy95, NULL, yymsp[0].minor.yy46); } + 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); } break; - case 175: /* 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.yy151, &yymsp[-5].minor.yy95, &yymsp[-3].minor.yy95, yymsp[-1].minor.yy194, NULL); } + 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); } break; - case 176: /* cmd ::= DROP INDEX exists_opt index_name ON table_name */ -{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-3].minor.yy151, &yymsp[-2].minor.yy95, &yymsp[0].minor.yy95); } + 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); } break; - case 178: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt */ -{ yymsp[-8].minor.yy46 = createIndexOption(pCxt, yymsp[-6].minor.yy194, releaseRawExprNode(pCxt, yymsp[-2].minor.yy46), NULL, yymsp[0].minor.yy46); } + 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); } break; - case 179: /* 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.yy46 = createIndexOption(pCxt, yymsp[-8].minor.yy194, releaseRawExprNode(pCxt, yymsp[-4].minor.yy46), releaseRawExprNode(pCxt, yymsp[-2].minor.yy46), yymsp[0].minor.yy46); } + 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); } break; - case 182: /* func ::= function_name NK_LP expression_list NK_RP */ -{ yylhsminor.yy46 = createFunctionNode(pCxt, &yymsp[-3].minor.yy95, yymsp[-1].minor.yy194); } - yymsp[-3].minor.yy46 = yylhsminor.yy46; + 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; break; - case 183: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ -{ pCxt->pRootNode = createCreateTopicStmt(pCxt, yymsp[-3].minor.yy151, &yymsp[-2].minor.yy95, yymsp[0].minor.yy46, NULL); } + 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); } break; - case 184: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS db_name */ -{ pCxt->pRootNode = createCreateTopicStmt(pCxt, yymsp[-3].minor.yy151, &yymsp[-2].minor.yy95, NULL, &yymsp[0].minor.yy95); } + 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); } break; - case 185: /* cmd ::= DROP TOPIC exists_opt topic_name */ -{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy151, &yymsp[0].minor.yy95); } + case 187: /* cmd ::= DROP TOPIC exists_opt topic_name */ +{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy265, &yymsp[0].minor.yy337); } break; - case 186: /* cmd ::= DESC full_table_name */ - case 187: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==187); -{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy46); } + 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); } break; - case 188: /* cmd ::= RESET QUERY CACHE */ + case 190: /* cmd ::= RESET QUERY CACHE */ { pCxt->pRootNode = createResetQueryCacheStmt(pCxt); } break; - case 189: /* cmd ::= EXPLAIN analyze_opt explain_options query_expression */ -{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy151, yymsp[-1].minor.yy46, yymsp[0].minor.yy46); } + 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); } break; - case 191: /* analyze_opt ::= ANALYZE */ - case 298: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==298); -{ yymsp[0].minor.yy151 = true; } + case 193: /* analyze_opt ::= ANALYZE */ + case 300: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==300); +{ yymsp[0].minor.yy265 = true; } break; - case 192: /* explain_options ::= */ -{ yymsp[1].minor.yy46 = createDefaultExplainOptions(pCxt); } + case 194: /* explain_options ::= */ +{ yymsp[1].minor.yy24 = createDefaultExplainOptions(pCxt); } break; - case 193: /* explain_options ::= explain_options VERBOSE NK_BOOL */ -{ yylhsminor.yy46 = setExplainVerbose(pCxt, yymsp[-2].minor.yy46, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy46 = yylhsminor.yy46; + 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; break; - case 194: /* explain_options ::= explain_options RATIO NK_FLOAT */ -{ yylhsminor.yy46 = setExplainRatio(pCxt, yymsp[-2].minor.yy46, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy46 = yylhsminor.yy46; + 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; break; - case 196: /* literal ::= NK_INTEGER */ -{ yylhsminor.yy46 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy46 = yylhsminor.yy46; + 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; break; - case 197: /* literal ::= NK_FLOAT */ -{ yylhsminor.yy46 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy46 = yylhsminor.yy46; + 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; break; - case 198: /* literal ::= NK_STRING */ -{ yylhsminor.yy46 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy46 = yylhsminor.yy46; + 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; break; - case 199: /* literal ::= NK_BOOL */ -{ yylhsminor.yy46 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy46 = yylhsminor.yy46; + 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; break; - case 200: /* literal ::= TIMESTAMP NK_STRING */ -{ yylhsminor.yy46 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } - yymsp[-1].minor.yy46 = yylhsminor.yy46; + 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; break; - case 201: /* literal ::= duration_literal */ - case 210: /* signed_literal ::= signed */ yytestcase(yyruleno==210); - case 227: /* expression ::= literal */ yytestcase(yyruleno==227); - case 228: /* expression ::= pseudo_column */ yytestcase(yyruleno==228); - case 229: /* expression ::= column_reference */ yytestcase(yyruleno==229); - case 232: /* expression ::= subquery */ yytestcase(yyruleno==232); - case 271: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==271); - case 275: /* boolean_primary ::= predicate */ yytestcase(yyruleno==275); - case 277: /* common_expression ::= expression */ yytestcase(yyruleno==277); - case 278: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==278); - case 280: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==280); - case 282: /* table_reference ::= table_primary */ yytestcase(yyruleno==282); - case 283: /* table_reference ::= joined_table */ yytestcase(yyruleno==283); - case 287: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==287); - case 334: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==334); - case 336: /* query_primary ::= query_specification */ yytestcase(yyruleno==336); -{ yylhsminor.yy46 = yymsp[0].minor.yy46; } - yymsp[0].minor.yy46 = yylhsminor.yy46; + 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; break; - case 202: /* literal ::= NULL */ -{ yylhsminor.yy46 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, NULL)); } - yymsp[0].minor.yy46 = yylhsminor.yy46; + 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; break; - case 203: /* duration_literal ::= NK_VARIABLE */ -{ yylhsminor.yy46 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy46 = yylhsminor.yy46; + 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; break; - case 204: /* signed ::= NK_INTEGER */ -{ yylhsminor.yy46 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy46 = yylhsminor.yy46; + case 206: /* signed ::= NK_INTEGER */ +{ yylhsminor.yy24 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy24 = yylhsminor.yy24; break; - case 205: /* signed ::= NK_PLUS NK_INTEGER */ -{ yymsp[-1].minor.yy46 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } + case 207: /* signed ::= NK_PLUS NK_INTEGER */ +{ yymsp[-1].minor.yy24 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } break; - case 206: /* signed ::= NK_MINUS NK_INTEGER */ + case 208: /* 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.yy46 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); + yylhsminor.yy24 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); } - yymsp[-1].minor.yy46 = yylhsminor.yy46; + yymsp[-1].minor.yy24 = yylhsminor.yy24; break; - case 207: /* signed ::= NK_FLOAT */ -{ yylhsminor.yy46 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy46 = yylhsminor.yy46; + case 209: /* signed ::= NK_FLOAT */ +{ yylhsminor.yy24 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy24 = yylhsminor.yy24; break; - case 208: /* signed ::= NK_PLUS NK_FLOAT */ -{ yymsp[-1].minor.yy46 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + case 210: /* signed ::= NK_PLUS NK_FLOAT */ +{ yymsp[-1].minor.yy24 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } break; - case 209: /* signed ::= NK_MINUS NK_FLOAT */ + case 211: /* 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.yy46 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); + yylhsminor.yy24 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); } - yymsp[-1].minor.yy46 = yylhsminor.yy46; + yymsp[-1].minor.yy24 = yylhsminor.yy24; break; - case 211: /* signed_literal ::= NK_STRING */ -{ yylhsminor.yy46 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy46 = yylhsminor.yy46; + case 213: /* signed_literal ::= NK_STRING */ +{ yylhsminor.yy24 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy24 = yylhsminor.yy24; break; - case 212: /* signed_literal ::= NK_BOOL */ -{ yylhsminor.yy46 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy46 = yylhsminor.yy46; + case 214: /* signed_literal ::= NK_BOOL */ +{ yylhsminor.yy24 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy24 = yylhsminor.yy24; break; - case 213: /* signed_literal ::= TIMESTAMP NK_STRING */ -{ yymsp[-1].minor.yy46 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } + case 215: /* signed_literal ::= TIMESTAMP NK_STRING */ +{ yymsp[-1].minor.yy24 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } break; - case 214: /* signed_literal ::= duration_literal */ - case 348: /* search_condition ::= common_expression */ yytestcase(yyruleno==348); -{ yylhsminor.yy46 = releaseRawExprNode(pCxt, yymsp[0].minor.yy46); } - yymsp[0].minor.yy46 = yylhsminor.yy46; + 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; break; - case 215: /* signed_literal ::= NULL */ -{ yymsp[0].minor.yy46 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, NULL); } + case 217: /* signed_literal ::= NULL */ +{ yymsp[0].minor.yy24 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, NULL); } break; - case 230: /* expression ::= function_name NK_LP expression_list NK_RP */ -{ yylhsminor.yy46 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy95, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy95, yymsp[-1].minor.yy194)); } - yymsp[-3].minor.yy46 = yylhsminor.yy46; + 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; break; - case 231: /* expression ::= function_name NK_LP NK_STAR NK_RP */ -{ yylhsminor.yy46 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy95, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy95, createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy0)))); } - yymsp[-3].minor.yy46 = yylhsminor.yy46; + 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; break; - case 233: /* expression ::= NK_LP expression NK_RP */ - case 276: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==276); -{ yylhsminor.yy46 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy46)); } - yymsp[-2].minor.yy46 = yylhsminor.yy46; + 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; break; - case 234: /* expression ::= NK_PLUS expression */ + case 236: /* expression ::= NK_PLUS expression */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy46); - yylhsminor.yy46 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy46)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy24); + yylhsminor.yy24 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy24)); } - yymsp[-1].minor.yy46 = yylhsminor.yy46; + yymsp[-1].minor.yy24 = yylhsminor.yy24; break; - case 235: /* expression ::= NK_MINUS expression */ + case 237: /* expression ::= NK_MINUS expression */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy46); - yylhsminor.yy46 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[0].minor.yy46), NULL)); + 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)); } - yymsp[-1].minor.yy46 = yylhsminor.yy46; + yymsp[-1].minor.yy24 = yylhsminor.yy24; break; - case 236: /* expression ::= expression NK_PLUS expression */ + case 238: /* expression ::= expression NK_PLUS expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy46); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy46); - yylhsminor.yy46 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy46), releaseRawExprNode(pCxt, yymsp[0].minor.yy46))); + 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))); } - yymsp[-2].minor.yy46 = yylhsminor.yy46; + yymsp[-2].minor.yy24 = yylhsminor.yy24; break; - case 237: /* expression ::= expression NK_MINUS expression */ + case 239: /* expression ::= expression NK_MINUS expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy46); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy46); - yylhsminor.yy46 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy46), releaseRawExprNode(pCxt, yymsp[0].minor.yy46))); + 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))); } - yymsp[-2].minor.yy46 = yylhsminor.yy46; + yymsp[-2].minor.yy24 = yylhsminor.yy24; break; - case 238: /* expression ::= expression NK_STAR expression */ + case 240: /* expression ::= expression NK_STAR expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy46); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy46); - yylhsminor.yy46 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy46), releaseRawExprNode(pCxt, yymsp[0].minor.yy46))); + 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))); } - yymsp[-2].minor.yy46 = yylhsminor.yy46; + yymsp[-2].minor.yy24 = yylhsminor.yy24; break; - case 239: /* expression ::= expression NK_SLASH expression */ + case 241: /* expression ::= expression NK_SLASH expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy46); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy46); - yylhsminor.yy46 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy46), releaseRawExprNode(pCxt, yymsp[0].minor.yy46))); + 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))); } - yymsp[-2].minor.yy46 = yylhsminor.yy46; + yymsp[-2].minor.yy24 = yylhsminor.yy24; break; - case 240: /* expression ::= expression NK_REM expression */ + case 242: /* expression ::= expression NK_REM expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy46); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy46); - yylhsminor.yy46 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MOD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy46), releaseRawExprNode(pCxt, yymsp[0].minor.yy46))); + 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))); } - yymsp[-2].minor.yy46 = yylhsminor.yy46; + yymsp[-2].minor.yy24 = yylhsminor.yy24; break; - case 241: /* expression_list ::= expression */ -{ yylhsminor.yy194 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy46)); } - yymsp[0].minor.yy194 = yylhsminor.yy194; + case 243: /* expression_list ::= expression */ +{ yylhsminor.yy504 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy24)); } + yymsp[0].minor.yy504 = yylhsminor.yy504; break; - case 242: /* expression_list ::= expression_list NK_COMMA expression */ -{ yylhsminor.yy194 = addNodeToList(pCxt, yymsp[-2].minor.yy194, releaseRawExprNode(pCxt, yymsp[0].minor.yy46)); } - yymsp[-2].minor.yy194 = yylhsminor.yy194; + 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; break; - case 243: /* column_reference ::= column_name */ -{ yylhsminor.yy46 = createRawExprNode(pCxt, &yymsp[0].minor.yy95, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy95)); } - yymsp[0].minor.yy46 = yylhsminor.yy46; + 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; break; - case 244: /* column_reference ::= table_name NK_DOT column_name */ -{ yylhsminor.yy46 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy95, &yymsp[0].minor.yy95, createColumnNode(pCxt, &yymsp[-2].minor.yy95, &yymsp[0].minor.yy95)); } - yymsp[-2].minor.yy46 = yylhsminor.yy46; + 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; break; - case 245: /* pseudo_column ::= NK_UNDERLINE ROWTS */ - case 247: /* pseudo_column ::= NK_UNDERLINE QSTARTTS */ yytestcase(yyruleno==247); - case 248: /* pseudo_column ::= NK_UNDERLINE QENDTS */ yytestcase(yyruleno==248); - case 249: /* pseudo_column ::= NK_UNDERLINE WSTARTTS */ yytestcase(yyruleno==249); - case 250: /* pseudo_column ::= NK_UNDERLINE WENDTS */ yytestcase(yyruleno==250); - case 251: /* pseudo_column ::= NK_UNDERLINE WDURATION */ yytestcase(yyruleno==251); + 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); { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy46 = createRawExprNode(pCxt, &t, createFunctionNode(pCxt, &t, NULL)); + yylhsminor.yy24 = createRawExprNode(pCxt, &t, createFunctionNode(pCxt, &t, NULL)); } - yymsp[-1].minor.yy46 = yylhsminor.yy46; + yymsp[-1].minor.yy24 = yylhsminor.yy24; break; - case 246: /* pseudo_column ::= TBNAME */ -{ yylhsminor.yy46 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } - yymsp[0].minor.yy46 = yylhsminor.yy46; + 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; break; - case 252: /* predicate ::= expression compare_op expression */ - case 257: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==257); + case 254: /* predicate ::= expression compare_op expression */ + case 259: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==259); { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy46); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy46); - yylhsminor.yy46 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy292, releaseRawExprNode(pCxt, yymsp[-2].minor.yy46), releaseRawExprNode(pCxt, yymsp[0].minor.yy46))); + 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))); } - yymsp[-2].minor.yy46 = yylhsminor.yy46; + yymsp[-2].minor.yy24 = yylhsminor.yy24; break; - case 253: /* predicate ::= expression BETWEEN expression AND expression */ + case 255: /* predicate ::= expression BETWEEN expression AND expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy46); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy46); - yylhsminor.yy46 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy46), releaseRawExprNode(pCxt, yymsp[-2].minor.yy46), releaseRawExprNode(pCxt, yymsp[0].minor.yy46))); + 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))); } - yymsp[-4].minor.yy46 = yylhsminor.yy46; + yymsp[-4].minor.yy24 = yylhsminor.yy24; break; - case 254: /* predicate ::= expression NOT BETWEEN expression AND expression */ + case 256: /* predicate ::= expression NOT BETWEEN expression AND expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy46); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy46); - yylhsminor.yy46 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy46), releaseRawExprNode(pCxt, yymsp[-5].minor.yy46), releaseRawExprNode(pCxt, yymsp[0].minor.yy46))); + 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))); } - yymsp[-5].minor.yy46 = yylhsminor.yy46; + yymsp[-5].minor.yy24 = yylhsminor.yy24; break; - case 255: /* predicate ::= expression IS NULL */ + case 257: /* predicate ::= expression IS NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy46); - yylhsminor.yy46 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy46), NULL)); + 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)); } - yymsp[-2].minor.yy46 = yylhsminor.yy46; + yymsp[-2].minor.yy24 = yylhsminor.yy24; break; - case 256: /* predicate ::= expression IS NOT NULL */ + case 258: /* predicate ::= expression IS NOT NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy46); - yylhsminor.yy46 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy46), NULL)); + 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)); } - yymsp[-3].minor.yy46 = yylhsminor.yy46; + yymsp[-3].minor.yy24 = yylhsminor.yy24; break; - case 258: /* compare_op ::= NK_LT */ -{ yymsp[0].minor.yy292 = OP_TYPE_LOWER_THAN; } + case 260: /* compare_op ::= NK_LT */ +{ yymsp[0].minor.yy36 = OP_TYPE_LOWER_THAN; } break; - case 259: /* compare_op ::= NK_GT */ -{ yymsp[0].minor.yy292 = OP_TYPE_GREATER_THAN; } + case 261: /* compare_op ::= NK_GT */ +{ yymsp[0].minor.yy36 = OP_TYPE_GREATER_THAN; } break; - case 260: /* compare_op ::= NK_LE */ -{ yymsp[0].minor.yy292 = OP_TYPE_LOWER_EQUAL; } + case 262: /* compare_op ::= NK_LE */ +{ yymsp[0].minor.yy36 = OP_TYPE_LOWER_EQUAL; } break; - case 261: /* compare_op ::= NK_GE */ -{ yymsp[0].minor.yy292 = OP_TYPE_GREATER_EQUAL; } + case 263: /* compare_op ::= NK_GE */ +{ yymsp[0].minor.yy36 = OP_TYPE_GREATER_EQUAL; } break; - case 262: /* compare_op ::= NK_NE */ -{ yymsp[0].minor.yy292 = OP_TYPE_NOT_EQUAL; } + case 264: /* compare_op ::= NK_NE */ +{ yymsp[0].minor.yy36 = OP_TYPE_NOT_EQUAL; } break; - case 263: /* compare_op ::= NK_EQ */ -{ yymsp[0].minor.yy292 = OP_TYPE_EQUAL; } + case 265: /* compare_op ::= NK_EQ */ +{ yymsp[0].minor.yy36 = OP_TYPE_EQUAL; } break; - case 264: /* compare_op ::= LIKE */ -{ yymsp[0].minor.yy292 = OP_TYPE_LIKE; } + case 266: /* compare_op ::= LIKE */ +{ yymsp[0].minor.yy36 = OP_TYPE_LIKE; } break; - case 265: /* compare_op ::= NOT LIKE */ -{ yymsp[-1].minor.yy292 = OP_TYPE_NOT_LIKE; } + case 267: /* compare_op ::= NOT LIKE */ +{ yymsp[-1].minor.yy36 = OP_TYPE_NOT_LIKE; } break; - case 266: /* compare_op ::= MATCH */ -{ yymsp[0].minor.yy292 = OP_TYPE_MATCH; } + case 268: /* compare_op ::= MATCH */ +{ yymsp[0].minor.yy36 = OP_TYPE_MATCH; } break; - case 267: /* compare_op ::= NMATCH */ -{ yymsp[0].minor.yy292 = OP_TYPE_NMATCH; } + case 269: /* compare_op ::= NMATCH */ +{ yymsp[0].minor.yy36 = OP_TYPE_NMATCH; } break; - case 268: /* in_op ::= IN */ -{ yymsp[0].minor.yy292 = OP_TYPE_IN; } + case 270: /* in_op ::= IN */ +{ yymsp[0].minor.yy36 = OP_TYPE_IN; } break; - case 269: /* in_op ::= NOT IN */ -{ yymsp[-1].minor.yy292 = OP_TYPE_NOT_IN; } + case 271: /* in_op ::= NOT IN */ +{ yymsp[-1].minor.yy36 = OP_TYPE_NOT_IN; } break; - case 270: /* in_predicate_value ::= NK_LP expression_list NK_RP */ -{ yylhsminor.yy46 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy194)); } - yymsp[-2].minor.yy46 = yylhsminor.yy46; + 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; break; - case 272: /* boolean_value_expression ::= NOT boolean_primary */ + case 274: /* boolean_value_expression ::= NOT boolean_primary */ { - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy46); - yylhsminor.yy46 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy46), NULL)); + 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)); } - yymsp[-1].minor.yy46 = yylhsminor.yy46; + yymsp[-1].minor.yy24 = yylhsminor.yy24; break; - case 273: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + case 275: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy46); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy46); - yylhsminor.yy46 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy46), releaseRawExprNode(pCxt, yymsp[0].minor.yy46))); + 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))); } - yymsp[-2].minor.yy46 = yylhsminor.yy46; + yymsp[-2].minor.yy24 = yylhsminor.yy24; break; - case 274: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + case 276: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy46); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy46); - yylhsminor.yy46 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy46), releaseRawExprNode(pCxt, yymsp[0].minor.yy46))); + 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))); } - yymsp[-2].minor.yy46 = yylhsminor.yy46; + yymsp[-2].minor.yy24 = yylhsminor.yy24; break; - case 279: /* from_clause ::= FROM table_reference_list */ - case 309: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==309); - case 332: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==332); -{ yymsp[-1].minor.yy46 = yymsp[0].minor.yy46; } + 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; } break; - case 281: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ -{ yylhsminor.yy46 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy46, yymsp[0].minor.yy46, NULL); } - yymsp[-2].minor.yy46 = yylhsminor.yy46; + 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; break; - case 284: /* table_primary ::= table_name alias_opt */ -{ yylhsminor.yy46 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy95, &yymsp[0].minor.yy95); } - yymsp[-1].minor.yy46 = yylhsminor.yy46; + 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; break; - case 285: /* table_primary ::= db_name NK_DOT table_name alias_opt */ -{ yylhsminor.yy46 = createRealTableNode(pCxt, &yymsp[-3].minor.yy95, &yymsp[-1].minor.yy95, &yymsp[0].minor.yy95); } - yymsp[-3].minor.yy46 = yylhsminor.yy46; + 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; break; - case 286: /* table_primary ::= subquery alias_opt */ -{ yylhsminor.yy46 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy46), &yymsp[0].minor.yy95); } - yymsp[-1].minor.yy46 = yylhsminor.yy46; + 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; break; - case 288: /* alias_opt ::= */ -{ yymsp[1].minor.yy95 = nil_token; } + case 290: /* alias_opt ::= */ +{ yymsp[1].minor.yy337 = nil_token; } break; - case 289: /* alias_opt ::= table_alias */ -{ yylhsminor.yy95 = yymsp[0].minor.yy95; } - yymsp[0].minor.yy95 = yylhsminor.yy95; + case 291: /* alias_opt ::= table_alias */ +{ yylhsminor.yy337 = yymsp[0].minor.yy337; } + yymsp[0].minor.yy337 = yylhsminor.yy337; break; - case 290: /* alias_opt ::= AS table_alias */ -{ yymsp[-1].minor.yy95 = yymsp[0].minor.yy95; } + case 292: /* alias_opt ::= AS table_alias */ +{ yymsp[-1].minor.yy337 = yymsp[0].minor.yy337; } break; - case 291: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - case 292: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==292); -{ yymsp[-2].minor.yy46 = yymsp[-1].minor.yy46; } + 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; } break; - case 293: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ -{ yylhsminor.yy46 = createJoinTableNode(pCxt, yymsp[-4].minor.yy10, yymsp[-5].minor.yy46, yymsp[-2].minor.yy46, yymsp[0].minor.yy46); } - yymsp[-5].minor.yy46 = yylhsminor.yy46; + 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; break; - case 294: /* join_type ::= */ -{ yymsp[1].minor.yy10 = JOIN_TYPE_INNER; } + case 296: /* join_type ::= */ +{ yymsp[1].minor.yy320 = JOIN_TYPE_INNER; } break; - case 295: /* join_type ::= INNER */ -{ yymsp[0].minor.yy10 = JOIN_TYPE_INNER; } + case 297: /* join_type ::= INNER */ +{ yymsp[0].minor.yy320 = JOIN_TYPE_INNER; } break; - case 296: /* 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 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 */ { - yymsp[-8].minor.yy46 = createSelectStmt(pCxt, yymsp[-7].minor.yy151, yymsp[-6].minor.yy194, yymsp[-5].minor.yy46); - yymsp[-8].minor.yy46 = addWhereClause(pCxt, yymsp[-8].minor.yy46, yymsp[-4].minor.yy46); - yymsp[-8].minor.yy46 = addPartitionByClause(pCxt, yymsp[-8].minor.yy46, yymsp[-3].minor.yy194); - yymsp[-8].minor.yy46 = addWindowClauseClause(pCxt, yymsp[-8].minor.yy46, yymsp[-2].minor.yy46); - yymsp[-8].minor.yy46 = addGroupByClause(pCxt, yymsp[-8].minor.yy46, yymsp[-1].minor.yy194); - yymsp[-8].minor.yy46 = addHavingClause(pCxt, yymsp[-8].minor.yy46, yymsp[0].minor.yy46); + 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); } break; - case 299: /* set_quantifier_opt ::= ALL */ -{ yymsp[0].minor.yy151 = false; } + case 301: /* set_quantifier_opt ::= ALL */ +{ yymsp[0].minor.yy265 = false; } break; - case 300: /* select_list ::= NK_STAR */ -{ yymsp[0].minor.yy194 = NULL; } + case 302: /* select_list ::= NK_STAR */ +{ yymsp[0].minor.yy504 = NULL; } break; - case 304: /* select_item ::= common_expression */ + case 306: /* select_item ::= common_expression */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy46); - yylhsminor.yy46 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy46), &t); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy24); + yylhsminor.yy24 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy24), &t); } - yymsp[0].minor.yy46 = yylhsminor.yy46; + yymsp[0].minor.yy24 = yylhsminor.yy24; break; - case 305: /* select_item ::= common_expression column_alias */ -{ yylhsminor.yy46 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy46), &yymsp[0].minor.yy95); } - yymsp[-1].minor.yy46 = yylhsminor.yy46; + 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; break; - case 306: /* select_item ::= common_expression AS column_alias */ -{ yylhsminor.yy46 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy46), &yymsp[0].minor.yy95); } - yymsp[-2].minor.yy46 = yylhsminor.yy46; + 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; break; - case 307: /* select_item ::= table_name NK_DOT NK_STAR */ -{ yylhsminor.yy46 = createColumnNode(pCxt, &yymsp[-2].minor.yy95, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy46 = yylhsminor.yy46; + 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; break; - case 311: /* partition_by_clause_opt ::= PARTITION BY expression_list */ - case 328: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==328); - case 338: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==338); -{ yymsp[-2].minor.yy194 = yymsp[0].minor.yy194; } + 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; } break; - case 313: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ -{ yymsp[-5].minor.yy46 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy46), releaseRawExprNode(pCxt, yymsp[-1].minor.yy46)); } + 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)); } break; - case 314: /* twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP */ -{ yymsp[-3].minor.yy46 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy46)); } + 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)); } break; - case 315: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-5].minor.yy46 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy46), NULL, yymsp[-1].minor.yy46, yymsp[0].minor.yy46); } + 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); } break; - case 316: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-7].minor.yy46 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy46), releaseRawExprNode(pCxt, yymsp[-3].minor.yy46), yymsp[-1].minor.yy46, yymsp[0].minor.yy46); } + 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); } break; - case 318: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ -{ yymsp[-3].minor.yy46 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy46); } + case 320: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ +{ yymsp[-3].minor.yy24 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy24); } break; - case 320: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ -{ yymsp[-3].minor.yy46 = createFillNode(pCxt, yymsp[-1].minor.yy6, NULL); } + case 322: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ +{ yymsp[-3].minor.yy24 = createFillNode(pCxt, yymsp[-1].minor.yy550, NULL); } break; - case 321: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ -{ yymsp[-5].minor.yy46 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy194)); } + 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)); } break; - case 322: /* fill_mode ::= NONE */ -{ yymsp[0].minor.yy6 = FILL_MODE_NONE; } + case 324: /* fill_mode ::= NONE */ +{ yymsp[0].minor.yy550 = FILL_MODE_NONE; } break; - case 323: /* fill_mode ::= PREV */ -{ yymsp[0].minor.yy6 = FILL_MODE_PREV; } + case 325: /* fill_mode ::= PREV */ +{ yymsp[0].minor.yy550 = FILL_MODE_PREV; } break; - case 324: /* fill_mode ::= NULL */ -{ yymsp[0].minor.yy6 = FILL_MODE_NULL; } + case 326: /* fill_mode ::= NULL */ +{ yymsp[0].minor.yy550 = FILL_MODE_NULL; } break; - case 325: /* fill_mode ::= LINEAR */ -{ yymsp[0].minor.yy6 = FILL_MODE_LINEAR; } + case 327: /* fill_mode ::= LINEAR */ +{ yymsp[0].minor.yy550 = FILL_MODE_LINEAR; } break; - case 326: /* fill_mode ::= NEXT */ -{ yymsp[0].minor.yy6 = FILL_MODE_NEXT; } + case 328: /* fill_mode ::= NEXT */ +{ yymsp[0].minor.yy550 = FILL_MODE_NEXT; } break; - case 329: /* group_by_list ::= expression */ -{ yylhsminor.yy194 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy46))); } - yymsp[0].minor.yy194 = yylhsminor.yy194; + case 331: /* group_by_list ::= expression */ +{ yylhsminor.yy504 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy24))); } + yymsp[0].minor.yy504 = yylhsminor.yy504; break; - case 330: /* group_by_list ::= group_by_list NK_COMMA expression */ -{ yylhsminor.yy194 = addNodeToList(pCxt, yymsp[-2].minor.yy194, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy46))); } - yymsp[-2].minor.yy194 = yylhsminor.yy194; + 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; break; - case 333: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ + case 335: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ { - yylhsminor.yy46 = addOrderByClause(pCxt, yymsp[-3].minor.yy46, yymsp[-2].minor.yy194); - yylhsminor.yy46 = addSlimitClause(pCxt, yylhsminor.yy46, yymsp[-1].minor.yy46); - yylhsminor.yy46 = addLimitClause(pCxt, yylhsminor.yy46, yymsp[0].minor.yy46); + 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); } - yymsp[-3].minor.yy46 = yylhsminor.yy46; + yymsp[-3].minor.yy24 = yylhsminor.yy24; break; - case 335: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */ -{ yylhsminor.yy46 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy46, yymsp[0].minor.yy46); } - yymsp[-3].minor.yy46 = yylhsminor.yy46; + 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; break; - case 340: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ - case 344: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==344); -{ yymsp[-1].minor.yy46 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } + 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); } break; - case 341: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - case 345: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==345); -{ yymsp[-3].minor.yy46 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } + 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); } break; - case 342: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - case 346: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==346); -{ yymsp[-3].minor.yy46 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } + 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); } break; - case 347: /* subquery ::= NK_LP query_expression NK_RP */ -{ yylhsminor.yy46 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy46); } - yymsp[-2].minor.yy46 = yylhsminor.yy46; + 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; break; - case 351: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */ -{ yylhsminor.yy46 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy46), yymsp[-1].minor.yy456, yymsp[0].minor.yy273); } - yymsp[-2].minor.yy46 = yylhsminor.yy46; + 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; break; - case 352: /* ordering_specification_opt ::= */ -{ yymsp[1].minor.yy456 = ORDER_ASC; } + case 354: /* ordering_specification_opt ::= */ +{ yymsp[1].minor.yy346 = ORDER_ASC; } break; - case 353: /* ordering_specification_opt ::= ASC */ -{ yymsp[0].minor.yy456 = ORDER_ASC; } + case 355: /* ordering_specification_opt ::= ASC */ +{ yymsp[0].minor.yy346 = ORDER_ASC; } break; - case 354: /* ordering_specification_opt ::= DESC */ -{ yymsp[0].minor.yy456 = ORDER_DESC; } + case 356: /* ordering_specification_opt ::= DESC */ +{ yymsp[0].minor.yy346 = ORDER_DESC; } break; - case 355: /* null_ordering_opt ::= */ -{ yymsp[1].minor.yy273 = NULL_ORDER_DEFAULT; } + case 357: /* null_ordering_opt ::= */ +{ yymsp[1].minor.yy45 = NULL_ORDER_DEFAULT; } break; - case 356: /* null_ordering_opt ::= NULLS FIRST */ -{ yymsp[-1].minor.yy273 = NULL_ORDER_FIRST; } + case 358: /* null_ordering_opt ::= NULLS FIRST */ +{ yymsp[-1].minor.yy45 = NULL_ORDER_FIRST; } break; - case 357: /* null_ordering_opt ::= NULLS LAST */ -{ yymsp[-1].minor.yy273 = NULL_ORDER_LAST; } + case 359: /* null_ordering_opt ::= NULLS LAST */ +{ yymsp[-1].minor.yy45 = NULL_ORDER_LAST; } break; default: break; diff --git a/tests/script/tsim/db/alter_option.sim b/tests/script/tsim/db/alter_option.sim index 0fc7175cb1..234eb16744 100644 --- a/tests/script/tsim/db/alter_option.sim +++ b/tests/script/tsim/db/alter_option.sim @@ -66,7 +66,7 @@ print ============= create database # | REPLICA value [1 | 3] # | WAL value [1 | 2] -sql create database db BLOCKS 7 CACHE 3 CACHELAST 3 COMP 0 DAYS 240 FSYNC 1000 MAXROWS 8000 MINROWS 10 KEEP 1000 PRECISION 'ns' QUORUM 1 REPLICA 3 TTL 7 WAL 2 VGROUPS 6 SINGLE_STABLE 1 STREAM_MODE 1 +sql create database db BLOCKS 7 CACHE 3 CACHELAST 3 COMP 0 DAYS 345600 FSYNC 1000 MAXROWS 8000 MINROWS 10 KEEP 1440000 PRECISION 'ns' QUORUM 1 REPLICA 3 TTL 7 WAL 2 VGROUPS 6 SINGLE_STABLE 1 STREAM_MODE 1 sql show databases print rows: $rows print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 @@ -92,10 +92,10 @@ endi if $data5_db != 1 then # quorum return -1 endi -if $data6_db != 240 then # days +if $data6_db != 345600 then # days return -1 endi -if $data7_db != 1000,1000,1000 then # keep +if $data7_db != 1440000,1440000,1440000 then # keep return -1 endi if $data8_db != 3 then # cache @@ -186,7 +186,7 @@ print ============== modify keep sql alter database db keep 2000 sql show databases print keep $data7_db -if $data7_db != 1000,1000,2000 then +if $data7_db != 2000,2000,2000 then return -1 endi From 53a8ebc83a853359bc0dd9cefb35eb69549856c1 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Thu, 31 Mar 2022 07:47:36 -0400 Subject: [PATCH 36/47] fix compile error --- source/libs/parser/src/parAstCreater.c | 32 +++++++++++++------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c index 0ebda70bbe..c74ef1454e 100644 --- a/source/libs/parser/src/parAstCreater.c +++ b/source/libs/parser/src/parAstCreater.c @@ -46,7 +46,7 @@ static SDatabaseOptions* setDbBlocks(SAstCreateContext* pCxt, SDatabaseOptions* int64_t val = strtol(pVal->z, NULL, 10); if (val < TSDB_MIN_TOTAL_BLOCKS || val > TSDB_MAX_TOTAL_BLOCKS) { snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, - "invalid db option totalBlocks: %"PRId64" valid range: [%d, %d]", val, TSDB_MIN_TOTAL_BLOCKS, TSDB_MAX_TOTAL_BLOCKS); + "invalid db option totalBlocks: %"PRId64" valid range: [%"PRId64", %"PRId64"]", val, TSDB_MIN_TOTAL_BLOCKS, TSDB_MAX_TOTAL_BLOCKS); pCxt->valid = false; return pOptions; } @@ -58,7 +58,7 @@ static SDatabaseOptions* setDbCache(SAstCreateContext* pCxt, SDatabaseOptions* p int64_t val = strtol(pVal->z, NULL, 10); if (val < TSDB_MIN_CACHE_BLOCK_SIZE || val > TSDB_MAX_CACHE_BLOCK_SIZE) { snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, - "invalid db option cacheBlockSize: %"PRId64" valid range: [%d, %d]", val, TSDB_MIN_CACHE_BLOCK_SIZE, TSDB_MAX_CACHE_BLOCK_SIZE); + "invalid db option cacheBlockSize: %"PRId64" valid range: [%"PRId64", %"PRId64"]", val, TSDB_MIN_CACHE_BLOCK_SIZE, TSDB_MAX_CACHE_BLOCK_SIZE); pCxt->valid = false; return pOptions; } @@ -70,7 +70,7 @@ static SDatabaseOptions* setDbCacheLast(SAstCreateContext* pCxt, SDatabaseOption int64_t val = strtol(pVal->z, NULL, 10); if (val < TSDB_MIN_DB_CACHE_LAST_ROW || val > TSDB_MAX_DB_CACHE_LAST_ROW) { snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, - "invalid db option cacheLast: %"PRId64" valid range: [%d, %d]", val, TSDB_MIN_DB_CACHE_LAST_ROW, TSDB_MAX_DB_CACHE_LAST_ROW); + "invalid db option cacheLast: %"PRId64" valid range: [%"PRId64", %"PRId64"]", val, TSDB_MIN_DB_CACHE_LAST_ROW, TSDB_MAX_DB_CACHE_LAST_ROW); pCxt->valid = false; return pOptions; } @@ -82,7 +82,7 @@ static SDatabaseOptions* setDbComp(SAstCreateContext* pCxt, SDatabaseOptions* pO int64_t val = strtol(pVal->z, NULL, 10); if (val < TSDB_MIN_COMP_LEVEL || val > TSDB_MAX_COMP_LEVEL) { snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, - "invalid db option compression: %"PRId64" valid range: [%d, %d]", val, TSDB_MIN_COMP_LEVEL, TSDB_MAX_COMP_LEVEL); + "invalid db option compression: %"PRId64" valid range: [%"PRId64", %"PRId64"]", val, TSDB_MIN_COMP_LEVEL, TSDB_MAX_COMP_LEVEL); pCxt->valid = false; return pOptions; } @@ -94,7 +94,7 @@ static SDatabaseOptions* setDbDays(SAstCreateContext* pCxt, SDatabaseOptions* pO int64_t val = strtol(pVal->z, NULL, 10); if (val < TSDB_MIN_DAYS_PER_FILE || val > TSDB_MAX_DAYS_PER_FILE) { snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, - "invalid db option daysPerFile: %"PRId64" valid range: [%d, %d]", val, TSDB_MIN_DAYS_PER_FILE, TSDB_MAX_DAYS_PER_FILE); + "invalid db option daysPerFile: %"PRId64" valid range: [%"PRId64", %"PRId64"]", val, TSDB_MIN_DAYS_PER_FILE, TSDB_MAX_DAYS_PER_FILE); pCxt->valid = false; return pOptions; } @@ -106,7 +106,7 @@ static SDatabaseOptions* setDbFsync(SAstCreateContext* pCxt, SDatabaseOptions* p int64_t val = strtol(pVal->z, NULL, 10); if (val < TSDB_MIN_FSYNC_PERIOD || val > TSDB_MAX_FSYNC_PERIOD) { snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, - "invalid db option fsyncPeriod: %"PRId64" valid range: [%d, %d]", val, TSDB_MIN_FSYNC_PERIOD, TSDB_MAX_FSYNC_PERIOD); + "invalid db option fsyncPeriod: %"PRId64" valid range: [%"PRId64", %"PRId64"]", val, TSDB_MIN_FSYNC_PERIOD, TSDB_MAX_FSYNC_PERIOD); pCxt->valid = false; return pOptions; } @@ -118,7 +118,7 @@ static SDatabaseOptions* setDbMaxRows(SAstCreateContext* pCxt, SDatabaseOptions* int64_t val = strtol(pVal->z, NULL, 10); if (val < TSDB_MIN_MAX_ROW_FBLOCK || val > TSDB_MAX_MAX_ROW_FBLOCK) { snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, - "invalid db option maxRowsPerBlock: %"PRId64" valid range: [%d, %d]", val, TSDB_MIN_MAX_ROW_FBLOCK, TSDB_MAX_MAX_ROW_FBLOCK); + "invalid db option maxRowsPerBlock: %"PRId64" valid range: [%"PRId64", %"PRId64"]", val, TSDB_MIN_MAX_ROW_FBLOCK, TSDB_MAX_MAX_ROW_FBLOCK); pCxt->valid = false; return pOptions; } @@ -130,7 +130,7 @@ static SDatabaseOptions* setDbMinRows(SAstCreateContext* pCxt, SDatabaseOptions* int64_t val = strtol(pVal->z, NULL, 10); if (val < TSDB_MIN_MIN_ROW_FBLOCK || val > TSDB_MAX_MIN_ROW_FBLOCK) { snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, - "invalid db option minRowsPerBlock: %"PRId64" valid range: [%d, %d]", val, TSDB_MIN_MIN_ROW_FBLOCK, TSDB_MAX_MIN_ROW_FBLOCK); + "invalid db option minRowsPerBlock: %"PRId64" valid range: [%"PRId64", %"PRId64"]", val, TSDB_MIN_MIN_ROW_FBLOCK, TSDB_MAX_MIN_ROW_FBLOCK); pCxt->valid = false; return pOptions; } @@ -158,7 +158,7 @@ static SDatabaseOptions* setDbQuorum(SAstCreateContext* pCxt, SDatabaseOptions* int64_t val = strtol(pVal->z, NULL, 10); if (val < TSDB_MIN_DB_QUORUM_OPTION || val > TSDB_MAX_DB_QUORUM_OPTION) { snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, - "invalid db option quorum: %"PRId64" valid range: [%d, %d]", val, TSDB_MIN_DB_QUORUM_OPTION, TSDB_MAX_DB_QUORUM_OPTION); + "invalid db option quorum: %"PRId64" valid range: [%"PRId64", %"PRId64"]", val, TSDB_MIN_DB_QUORUM_OPTION, TSDB_MAX_DB_QUORUM_OPTION); pCxt->valid = false; return pOptions; } @@ -182,7 +182,7 @@ static SDatabaseOptions* setDbTtl(SAstCreateContext* pCxt, SDatabaseOptions* pOp int64_t val = strtol(pVal->z, NULL, 10); if (val < TSDB_MIN_DB_TTL_OPTION) { snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, - "invalid db option ttl: %"PRId64", should be greater than or equal to %d", val, TSDB_MIN_DB_TTL_OPTION); + "invalid db option ttl: %"PRId64", should be greater than or equal to %"PRId64"", val, TSDB_MIN_DB_TTL_OPTION); pCxt->valid = false; return pOptions; } @@ -205,7 +205,7 @@ static SDatabaseOptions* setDbVgroups(SAstCreateContext* pCxt, SDatabaseOptions* int64_t val = strtol(pVal->z, NULL, 10); if (val < TSDB_MIN_VNODES_PER_DB || val > TSDB_MAX_VNODES_PER_DB) { snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, - "invalid db option vgroups: %"PRId64" valid range: [%d, %d]", val, TSDB_MIN_VNODES_PER_DB, TSDB_MAX_VNODES_PER_DB); + "invalid db option vgroups: %"PRId64" valid range: [%"PRId64", %"PRId64"]", val, TSDB_MIN_VNODES_PER_DB, TSDB_MAX_VNODES_PER_DB); pCxt->valid = false; return pOptions; } @@ -294,7 +294,7 @@ static STableOptions* setTableTtl(SAstCreateContext* pCxt, STableOptions* pOptio int64_t val = strtol(pVal->z, NULL, 10); if (val < TSDB_MIN_DB_TTL_OPTION) { snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, - "invalid table option ttl: %"PRId64", should be greater than or equal to %d", val, TSDB_MIN_DB_TTL_OPTION); + "invalid table option ttl: %"PRId64", should be greater than or equal to %"PRId64"", val, TSDB_MIN_DB_TTL_OPTION); pCxt->valid = false; return pOptions; } @@ -305,7 +305,7 @@ static STableOptions* setTableTtl(SAstCreateContext* pCxt, STableOptions* pOptio static STableOptions* setTableComment(SAstCreateContext* pCxt, STableOptions* pOptions, const SToken* pVal) { if (pVal->n >= sizeof(pOptions->comments)) { snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, - "invalid table option comment, length cannot exceed %d", (int32_t)(sizeof(pOptions->comments) - 1)); + "invalid table option comment, length cannot exceed %"PRId64"", (int32_t)(sizeof(pOptions->comments) - 1)); pCxt->valid = false; return pOptions; } @@ -317,7 +317,7 @@ static STableOptions* setTableFileFactor(SAstCreateContext* pCxt, STableOptions* double val = strtod(pVal->z, NULL); if (val < TSDB_MIN_DB_FILE_FACTOR || val > TSDB_MAX_DB_FILE_FACTOR) { snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, - "invalid table option file_factor: %f valid range: [%d, %d]", val, TSDB_MIN_DB_FILE_FACTOR, TSDB_MAX_DB_FILE_FACTOR); + "invalid table option file_factor: %f valid range: [%"PRId64", %"PRId64"]", val, TSDB_MIN_DB_FILE_FACTOR, TSDB_MAX_DB_FILE_FACTOR); pCxt->valid = false; return pOptions; } @@ -329,7 +329,7 @@ static STableOptions* setTableDelay(SAstCreateContext* pCxt, STableOptions* pOpt int64_t val = strtol(pVal->z, NULL, 10); if (val < TSDB_MIN_DB_DELAY || val > TSDB_MAX_DB_DELAY) { snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, - "invalid table option delay: %"PRId64" valid range: [%d, %d]", val, TSDB_MIN_DB_DELAY, TSDB_MAX_DB_DELAY); + "invalid table option delay: %"PRId64" valid range: [%"PRId64", %"PRId64"]", val, TSDB_MIN_DB_DELAY, TSDB_MAX_DB_DELAY); pCxt->valid = false; return pOptions; } @@ -922,7 +922,7 @@ static bool checkAndSetKeepOption(SAstCreateContext* pCxt, SNodeList* pKeep, int if (daysToKeep0 < TSDB_MIN_KEEP || daysToKeep1 < TSDB_MIN_KEEP || daysToKeep2 < TSDB_MIN_KEEP || daysToKeep0 > TSDB_MAX_KEEP || daysToKeep1 > TSDB_MAX_KEEP || daysToKeep2 > TSDB_MAX_KEEP) { snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, - "invalid option keep: %"PRId64", %"PRId64", %"PRId64" valid range: [%d, %d]", daysToKeep0, daysToKeep1, daysToKeep2, TSDB_MIN_KEEP, TSDB_MAX_KEEP); + "invalid option keep: %"PRId64", %"PRId64", %"PRId64" valid range: [%"PRId64", %"PRId64"]", daysToKeep0, daysToKeep1, daysToKeep2, TSDB_MIN_KEEP, TSDB_MAX_KEEP); return false; } From fe2620ac1b8d9aff0babcdc940847f7294eb7c2a Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Thu, 31 Mar 2022 08:00:35 -0400 Subject: [PATCH 37/47] fix compile error --- source/libs/parser/src/parAstCreater.c | 38 +++++++++++++------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c index c74ef1454e..50ab120c56 100644 --- a/source/libs/parser/src/parAstCreater.c +++ b/source/libs/parser/src/parAstCreater.c @@ -46,7 +46,7 @@ static SDatabaseOptions* setDbBlocks(SAstCreateContext* pCxt, SDatabaseOptions* int64_t val = strtol(pVal->z, NULL, 10); if (val < TSDB_MIN_TOTAL_BLOCKS || val > TSDB_MAX_TOTAL_BLOCKS) { snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, - "invalid db option totalBlocks: %"PRId64" valid range: [%"PRId64", %"PRId64"]", val, TSDB_MIN_TOTAL_BLOCKS, TSDB_MAX_TOTAL_BLOCKS); + "invalid db option totalBlocks: %"PRId64" valid range: [%d, %d]", val, TSDB_MIN_TOTAL_BLOCKS, TSDB_MAX_TOTAL_BLOCKS); pCxt->valid = false; return pOptions; } @@ -58,7 +58,7 @@ static SDatabaseOptions* setDbCache(SAstCreateContext* pCxt, SDatabaseOptions* p int64_t val = strtol(pVal->z, NULL, 10); if (val < TSDB_MIN_CACHE_BLOCK_SIZE || val > TSDB_MAX_CACHE_BLOCK_SIZE) { snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, - "invalid db option cacheBlockSize: %"PRId64" valid range: [%"PRId64", %"PRId64"]", val, TSDB_MIN_CACHE_BLOCK_SIZE, TSDB_MAX_CACHE_BLOCK_SIZE); + "invalid db option cacheBlockSize: %"PRId64" valid range: [%d, %d]", val, TSDB_MIN_CACHE_BLOCK_SIZE, TSDB_MAX_CACHE_BLOCK_SIZE); pCxt->valid = false; return pOptions; } @@ -70,7 +70,7 @@ static SDatabaseOptions* setDbCacheLast(SAstCreateContext* pCxt, SDatabaseOption int64_t val = strtol(pVal->z, NULL, 10); if (val < TSDB_MIN_DB_CACHE_LAST_ROW || val > TSDB_MAX_DB_CACHE_LAST_ROW) { snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, - "invalid db option cacheLast: %"PRId64" valid range: [%"PRId64", %"PRId64"]", val, TSDB_MIN_DB_CACHE_LAST_ROW, TSDB_MAX_DB_CACHE_LAST_ROW); + "invalid db option cacheLast: %"PRId64" valid range: [%d, %d]", val, TSDB_MIN_DB_CACHE_LAST_ROW, TSDB_MAX_DB_CACHE_LAST_ROW); pCxt->valid = false; return pOptions; } @@ -82,7 +82,7 @@ static SDatabaseOptions* setDbComp(SAstCreateContext* pCxt, SDatabaseOptions* pO int64_t val = strtol(pVal->z, NULL, 10); if (val < TSDB_MIN_COMP_LEVEL || val > TSDB_MAX_COMP_LEVEL) { snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, - "invalid db option compression: %"PRId64" valid range: [%"PRId64", %"PRId64"]", val, TSDB_MIN_COMP_LEVEL, TSDB_MAX_COMP_LEVEL); + "invalid db option compression: %"PRId64" valid range: [%d, %d]", val, TSDB_MIN_COMP_LEVEL, TSDB_MAX_COMP_LEVEL); pCxt->valid = false; return pOptions; } @@ -94,7 +94,7 @@ static SDatabaseOptions* setDbDays(SAstCreateContext* pCxt, SDatabaseOptions* pO int64_t val = strtol(pVal->z, NULL, 10); if (val < TSDB_MIN_DAYS_PER_FILE || val > TSDB_MAX_DAYS_PER_FILE) { snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, - "invalid db option daysPerFile: %"PRId64" valid range: [%"PRId64", %"PRId64"]", val, TSDB_MIN_DAYS_PER_FILE, TSDB_MAX_DAYS_PER_FILE); + "invalid db option daysPerFile: %"PRId64" valid range: [%d, %d]", val, TSDB_MIN_DAYS_PER_FILE, TSDB_MAX_DAYS_PER_FILE); pCxt->valid = false; return pOptions; } @@ -106,7 +106,7 @@ static SDatabaseOptions* setDbFsync(SAstCreateContext* pCxt, SDatabaseOptions* p int64_t val = strtol(pVal->z, NULL, 10); if (val < TSDB_MIN_FSYNC_PERIOD || val > TSDB_MAX_FSYNC_PERIOD) { snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, - "invalid db option fsyncPeriod: %"PRId64" valid range: [%"PRId64", %"PRId64"]", val, TSDB_MIN_FSYNC_PERIOD, TSDB_MAX_FSYNC_PERIOD); + "invalid db option fsyncPeriod: %"PRId64" valid range: [%d, %d]", val, TSDB_MIN_FSYNC_PERIOD, TSDB_MAX_FSYNC_PERIOD); pCxt->valid = false; return pOptions; } @@ -118,7 +118,7 @@ static SDatabaseOptions* setDbMaxRows(SAstCreateContext* pCxt, SDatabaseOptions* int64_t val = strtol(pVal->z, NULL, 10); if (val < TSDB_MIN_MAX_ROW_FBLOCK || val > TSDB_MAX_MAX_ROW_FBLOCK) { snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, - "invalid db option maxRowsPerBlock: %"PRId64" valid range: [%"PRId64", %"PRId64"]", val, TSDB_MIN_MAX_ROW_FBLOCK, TSDB_MAX_MAX_ROW_FBLOCK); + "invalid db option maxRowsPerBlock: %"PRId64" valid range: [%d, %d]", val, TSDB_MIN_MAX_ROW_FBLOCK, TSDB_MAX_MAX_ROW_FBLOCK); pCxt->valid = false; return pOptions; } @@ -130,7 +130,7 @@ static SDatabaseOptions* setDbMinRows(SAstCreateContext* pCxt, SDatabaseOptions* int64_t val = strtol(pVal->z, NULL, 10); if (val < TSDB_MIN_MIN_ROW_FBLOCK || val > TSDB_MAX_MIN_ROW_FBLOCK) { snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, - "invalid db option minRowsPerBlock: %"PRId64" valid range: [%"PRId64", %"PRId64"]", val, TSDB_MIN_MIN_ROW_FBLOCK, TSDB_MAX_MIN_ROW_FBLOCK); + "invalid db option minRowsPerBlock: %"PRId64" valid range: [%d, %d]", val, TSDB_MIN_MIN_ROW_FBLOCK, TSDB_MAX_MIN_ROW_FBLOCK); pCxt->valid = false; return pOptions; } @@ -158,7 +158,7 @@ static SDatabaseOptions* setDbQuorum(SAstCreateContext* pCxt, SDatabaseOptions* int64_t val = strtol(pVal->z, NULL, 10); if (val < TSDB_MIN_DB_QUORUM_OPTION || val > TSDB_MAX_DB_QUORUM_OPTION) { snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, - "invalid db option quorum: %"PRId64" valid range: [%"PRId64", %"PRId64"]", val, TSDB_MIN_DB_QUORUM_OPTION, TSDB_MAX_DB_QUORUM_OPTION); + "invalid db option quorum: %"PRId64" valid range: [%d, %d]", val, TSDB_MIN_DB_QUORUM_OPTION, TSDB_MAX_DB_QUORUM_OPTION); pCxt->valid = false; return pOptions; } @@ -182,7 +182,7 @@ static SDatabaseOptions* setDbTtl(SAstCreateContext* pCxt, SDatabaseOptions* pOp int64_t val = strtol(pVal->z, NULL, 10); if (val < TSDB_MIN_DB_TTL_OPTION) { snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, - "invalid db option ttl: %"PRId64", should be greater than or equal to %"PRId64"", val, TSDB_MIN_DB_TTL_OPTION); + "invalid db option ttl: %"PRId64", should be greater than or equal to %d", val, TSDB_MIN_DB_TTL_OPTION); pCxt->valid = false; return pOptions; } @@ -193,7 +193,7 @@ static SDatabaseOptions* setDbTtl(SAstCreateContext* pCxt, SDatabaseOptions* pOp static SDatabaseOptions* setDbWal(SAstCreateContext* pCxt, SDatabaseOptions* pOptions, const SToken* pVal) { int64_t val = strtol(pVal->z, NULL, 10); if (val < TSDB_MIN_WAL_LEVEL || val > TSDB_MAX_WAL_LEVEL) { - snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, "invalid db option walLevel: %"PRId64", only 1-2 allowed", val); + snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, "invalid db option walLevel: %d, only 1-2 allowed", val); pCxt->valid = false; return pOptions; } @@ -205,7 +205,7 @@ static SDatabaseOptions* setDbVgroups(SAstCreateContext* pCxt, SDatabaseOptions* int64_t val = strtol(pVal->z, NULL, 10); if (val < TSDB_MIN_VNODES_PER_DB || val > TSDB_MAX_VNODES_PER_DB) { snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, - "invalid db option vgroups: %"PRId64" valid range: [%"PRId64", %"PRId64"]", val, TSDB_MIN_VNODES_PER_DB, TSDB_MAX_VNODES_PER_DB); + "invalid db option vgroups: %"PRId64" valid range: [%d, %d]", val, TSDB_MIN_VNODES_PER_DB, TSDB_MAX_VNODES_PER_DB); pCxt->valid = false; return pOptions; } @@ -216,7 +216,7 @@ static SDatabaseOptions* setDbVgroups(SAstCreateContext* pCxt, SDatabaseOptions* static SDatabaseOptions* setDbSingleStable(SAstCreateContext* pCxt, SDatabaseOptions* pOptions, const SToken* pVal) { int64_t val = strtol(pVal->z, NULL, 10); if (val < TSDB_MIN_DB_SINGLE_STABLE_OPTION || val > TSDB_MAX_DB_SINGLE_STABLE_OPTION) { - snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, "invalid db option singleStable: %"PRId64", only 0-1 allowed", val); + snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, "invalid db option singleStable: %d, only 0-1 allowed", val); pCxt->valid = false; return pOptions; } @@ -227,7 +227,7 @@ static SDatabaseOptions* setDbSingleStable(SAstCreateContext* pCxt, SDatabaseOpt static SDatabaseOptions* setDbStreamMode(SAstCreateContext* pCxt, SDatabaseOptions* pOptions, const SToken* pVal) { int64_t val = strtol(pVal->z, NULL, 10); if (val < TSDB_MIN_DB_STREAM_MODE_OPTION || val > TSDB_MAX_DB_STREAM_MODE_OPTION) { - snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, "invalid db option streamMode: %"PRId64", only 0-1 allowed", val); + snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, "invalid db option streamMode: %d, only 0-1 allowed", val); pCxt->valid = false; return pOptions; } @@ -294,7 +294,7 @@ static STableOptions* setTableTtl(SAstCreateContext* pCxt, STableOptions* pOptio int64_t val = strtol(pVal->z, NULL, 10); if (val < TSDB_MIN_DB_TTL_OPTION) { snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, - "invalid table option ttl: %"PRId64", should be greater than or equal to %"PRId64"", val, TSDB_MIN_DB_TTL_OPTION); + "invalid table option ttl: %"PRId64", should be greater than or equal to %d", val, TSDB_MIN_DB_TTL_OPTION); pCxt->valid = false; return pOptions; } @@ -305,7 +305,7 @@ static STableOptions* setTableTtl(SAstCreateContext* pCxt, STableOptions* pOptio static STableOptions* setTableComment(SAstCreateContext* pCxt, STableOptions* pOptions, const SToken* pVal) { if (pVal->n >= sizeof(pOptions->comments)) { snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, - "invalid table option comment, length cannot exceed %"PRId64"", (int32_t)(sizeof(pOptions->comments) - 1)); + "invalid table option comment, length cannot exceed %d", (int32_t)(sizeof(pOptions->comments) - 1)); pCxt->valid = false; return pOptions; } @@ -317,7 +317,7 @@ static STableOptions* setTableFileFactor(SAstCreateContext* pCxt, STableOptions* double val = strtod(pVal->z, NULL); if (val < TSDB_MIN_DB_FILE_FACTOR || val > TSDB_MAX_DB_FILE_FACTOR) { snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, - "invalid table option file_factor: %f valid range: [%"PRId64", %"PRId64"]", val, TSDB_MIN_DB_FILE_FACTOR, TSDB_MAX_DB_FILE_FACTOR); + "invalid table option file_factor: %f valid range: [%d, %d]", val, TSDB_MIN_DB_FILE_FACTOR, TSDB_MAX_DB_FILE_FACTOR); pCxt->valid = false; return pOptions; } @@ -329,7 +329,7 @@ static STableOptions* setTableDelay(SAstCreateContext* pCxt, STableOptions* pOpt int64_t val = strtol(pVal->z, NULL, 10); if (val < TSDB_MIN_DB_DELAY || val > TSDB_MAX_DB_DELAY) { snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, - "invalid table option delay: %"PRId64" valid range: [%"PRId64", %"PRId64"]", val, TSDB_MIN_DB_DELAY, TSDB_MAX_DB_DELAY); + "invalid table option delay: %"PRId64" valid range: [%d, %d]", val, TSDB_MIN_DB_DELAY, TSDB_MAX_DB_DELAY); pCxt->valid = false; return pOptions; } @@ -922,7 +922,7 @@ static bool checkAndSetKeepOption(SAstCreateContext* pCxt, SNodeList* pKeep, int if (daysToKeep0 < TSDB_MIN_KEEP || daysToKeep1 < TSDB_MIN_KEEP || daysToKeep2 < TSDB_MIN_KEEP || daysToKeep0 > TSDB_MAX_KEEP || daysToKeep1 > TSDB_MAX_KEEP || daysToKeep2 > TSDB_MAX_KEEP) { snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, - "invalid option keep: %"PRId64", %"PRId64", %"PRId64" valid range: [%"PRId64", %"PRId64"]", daysToKeep0, daysToKeep1, daysToKeep2, TSDB_MIN_KEEP, TSDB_MAX_KEEP); + "invalid option keep: %d, %d, %d valid range: [%d, %d]", daysToKeep0, daysToKeep1, daysToKeep2, TSDB_MIN_KEEP, TSDB_MAX_KEEP); return false; } From 08eef9351d0ecd186fbbe8a62bedfd217a5fbb17 Mon Sep 17 00:00:00 2001 From: plum-lihui Date: Fri, 1 Apr 2022 09:11:07 +0800 Subject: [PATCH 38/47] [add tmq cases] --- tests/script/tsim/tmq/multiTopic.sim | 224 +++++++++++++++++++++++ tests/script/tsim/tmq/oneTopic.sim | 264 +++++++++++++++++++++++++++ 2 files changed, 488 insertions(+) create mode 100644 tests/script/tsim/tmq/multiTopic.sim create mode 100644 tests/script/tsim/tmq/oneTopic.sim diff --git a/tests/script/tsim/tmq/multiTopic.sim b/tests/script/tsim/tmq/multiTopic.sim new file mode 100644 index 0000000000..cd977e5909 --- /dev/null +++ b/tests/script/tsim/tmq/multiTopic.sim @@ -0,0 +1,224 @@ +#### test scenario, please refer to https://jira.taosdata.com:18090/pages/viewpage.action?pageId=135120406 +# scene1: vgroups=1, one topic for one consumer, include: columns from stb/ctb/ntb, * from stb/ctb/ntb, Scalar function from stb/ctb/ntb +# scene2: vgroups=1, multi topics for one consumer, include: columns from stb/ctb/ntb, * from stb/ctb/ntb, Scalar function from stb/ctb/ntb +# scene3: vgroups=4, one topic for one consumer, include: columns from stb/ctb/ntb, * from stb/ctb/ntb, Scalar function from stb/ctb/ntb +# scene4: vgroups=4, multi topics for one consumer, include: columns from stb/ctb/ntb, * from stb/ctb/ntb, Scalar function from stb/ctb/ntb +# notes1: Scalar function: ABS/ACOS/ASIN/ATAN/CEIL/COS/FLOOR/LOG/POW/ROUND/SIN/SQRT/TAN +# The above use cases are combined with where filter conditions, such as: where ts > "2017-08-12 18:25:58.128Z" and sin(a) > 0.5; +# +# notes2: not support aggregate functions(such as sum/count/min/max) and time-windows(interval). +# +######## ######## ######## ######## ######## ######## ######## ######## ######## ######## +######## This test case include scene2 and scene4 +######## ######## ######## ######## ######## ######## ######## ######## ######## ######## + +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 + +$loop_cnt = 0 +$vgroups = 1 +$dbNamme = d0 +loop_vgroups: +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 + +if $loop_cnt == 0 then + if $rows != 2 then + return -1 + endi + if $data02 != 1 then # vgroups + print vgroups: $data02 + return -1 + endi +else + if $rows != 3 then + return -1 + endi + if $data00 == d1 then + if $data02 != 4 then # vgroups + print vgroups: $data02 + return -1 + endi + else + if $data12 != 4 then # vgroups + print vgroups: $data12 + return -1 + endi + endi +endi + +sql use $dbNamme + +print =============== create super table +sql create table if not exists stb (ts timestamp, c1 int, c2 float, c3 binary(10)) tags (t1 int) + +sql show stables +if $rows != 1 then + return -1 +endi + +print =============== create child table +$tbPrefix = ct +$tbNum = 100 + +$i = 0 +while $i < $tbNum + $tb = $tbPrefix . $i + sql create table $tb using stb tags( $i ) + $i = $i + 1 +endw + +print =============== create normal table +sql create table ntb (ts timestamp, c1 int, c2 float, c3 binary(10)) + +print =============== create multi topics. notes: now only support: +print =============== 1. columns from stb/ctb/ntb; 2. * from ctb/ntb; 3. function from stb/ctb/ntb +print =============== will support: * from stb + +sql create topic topic_stb_column as select ts, c1, c3 from stb +#sql create topic topic_stb_all as select * from stb +sql create topic topic_stb_function as select ts, abs(c1), sin(c2) from stb + +sql create topic topic_ctb_column as select ts, c1, c3 from ct0 +sql create topic topic_ctb_all as select * from ct0 +sql create topic topic_ctb_function as select ts, abs(c1), sin(c2) from ct0 + +sql create topic topic_ntb_column as select ts, c1, c3 from ntb +sql create topic topic_ntb_all as select * from ntb +sql create topic topic_ntb_function as select ts, abs(c1), sin(c2) from ntb + +sql show tables +if $rows != 101 then + return -1 +endi + +print =============== insert data +$rowNum = 100 +$tstart = 1640966400000 # 2022-01-01 00:00:00.000 + +$i = 0 +while $i < $tbNum + $tb = $tbPrefix . $i + + $x = 0 + while $x < $rowNum + $c = $x / 10 + $c = $c * 10 + $c = $x - $c + + $binary = ' . binary + $binary = $binary . $c + $binary = $binary . ' + + sql insert into $tb values ($tstart , $c , $x , $binary ) + sql insert into ntb values ($tstart , $c , $x , $binary ) + $tstart = $tstart + 1 + $x = $x + 1 + endw + + $i = $i + 1 + $tstart = 1640966400000 +endw + +#root@trd02 /home $ tmq_sim --help +# -c Configuration directory, default is +# -d The name of the database for cosumer, no default +# -t The topic string for cosumer, no default +# -k The key-value string for cosumer, no default +# -g showMsgFlag, default is 0 +# + +$totalMsgCnt = $rowNum * $tbNum +print inserted totalMsgCnt: $totalMsgCnt + +# supported key: +# group.id: +# enable.auto.commit: +# auto.offset.reset: +# td.connect.ip: +# td.connect.user:root +# td.connect.pass:taosdata +# td.connect.port:6030 +# td.connect.db:db + +$numOfTopics = 2 +$totalMsgCntOfmultiTopics = $totalMsgCnt * $numOfTopics +$expect_result = @{consume success: @ +$expect_result = $expect_result . $totalMsgCntOfmultiTopics +$expect_result = $expect_result . @, @ +$expect_result = $expect_result . 0} +print expect_result----> $expect_result +#print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_stb_column, topic_stb_function, topic_stb_all" -k "group.id:tg2" +#system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_stb_column, topic_stb_function, topic_stb_all" -k "group.id:tg2" +print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_stb_column, topic_stb_function" -k "group.id:tg2" +system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_stb_column, topic_stb_function" -k "group.id:tg2" +print cmd result----> $system_content +#if $system_content != @{consume success: 20000, 0}@ then +if $system_content != $expect_result then + return -1 +endi + +$numOfTopics = 3 +$totalMsgCntOfmultiTopics = $rowNum * $numOfTopics +$expect_result = @{consume success: @ +$expect_result = $expect_result . $totalMsgCntOfmultiTopics +$expect_result = $expect_result . @, @ +$expect_result = $expect_result . 0} +print expect_result----> $expect_result +print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ctb_column, topic_ctb_function, topic_ctb_all" -k "group.id:tg2" +system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ctb_column, topic_ctb_function, topic_ctb_all" -k "group.id:tg2" +print cmd result----> $system_content +#if $system_content != @{consume success: 300, 0}@ then +if $system_content != $expect_result then + return -1 +endi + +$numOfTopics = 3 +$totalMsgCntOfmultiTopics = $totalMsgCnt * $numOfTopics +$expect_result = @{consume success: @ +$expect_result = $expect_result . $totalMsgCntOfmultiTopics +$expect_result = $expect_result . @, @ +$expect_result = $expect_result . 0} +print expect_result----> $expect_result +print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ntb_column, topic_ntb_all, topic_ntb_function" -k "group.id:tg2" +system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ntb_column, topic_ntb_all, topic_ntb_function" -k "group.id:tg2" +print cmd result----> $system_content +#if $system_content != @{consume success: 30000, 0}@ then +if $system_content != $expect_result then + return -1 +endi + +if $loop_cnt == 0 then + $loop_cnt = 1 + $vgroups = 4 + $dbNamme = d1 + goto loop_vgroups +endi + + +#system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/tmq/oneTopic.sim b/tests/script/tsim/tmq/oneTopic.sim new file mode 100644 index 0000000000..8e8d00977c --- /dev/null +++ b/tests/script/tsim/tmq/oneTopic.sim @@ -0,0 +1,264 @@ +#### test scenario, please refer to https://jira.taosdata.com:18090/pages/viewpage.action?pageId=135120406 +# scene1: vgroups=1, one topic for one consumer, include: columns from stb/ctb/ntb, * from stb/ctb/ntb, Scalar function from stb/ctb/ntb +# scene2: vgroups=1, multi topics for one consumer, include: columns from stb/ctb/ntb, * from stb/ctb/ntb, Scalar function from stb/ctb/ntb +# scene3: vgroups=4, one topic for one consumer, include: columns from stb/ctb/ntb, * from stb/ctb/ntb, Scalar function from stb/ctb/ntb +# scene4: vgroups=4, multi topics for one consumer, include: columns from stb/ctb/ntb, * from stb/ctb/ntb, Scalar function from stb/ctb/ntb +# notes1: Scalar function: ABS/ACOS/ASIN/ATAN/CEIL/COS/FLOOR/LOG/POW/ROUND/SIN/SQRT/TAN +# The above use cases are combined with where filter conditions, such as: where ts > "2017-08-12 18:25:58.128Z" and sin(a) > 0.5; +# +# notes2: not support aggregate functions(such as sum/count/min/max) and time-windows(interval). +# +######## ######## ######## ######## ######## ######## ######## ######## ######## ######## +######## This test case include scene1 and scene3 +######## ######## ######## ######## ######## ######## ######## ######## ######## ######## + +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 + +$loop_cnt = 0 +$vgroups = 1 +$dbNamme = d0 +loop_vgroups: +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 + +if $loop_cnt == 0 then + if $rows != 2 then + return -1 + endi + if $data02 != 1 then # vgroups + print vgroups: $data02 + return -1 + endi +else + if $rows != 3 then + return -1 + endi + if $data00 == d1 then + if $data02 != 4 then # vgroups + print vgroups: $data02 + return -1 + endi + else + if $data12 != 4 then # vgroups + print vgroups: $data12 + return -1 + endi + endi +endi + +sql use $dbNamme + +print =============== create super table +sql create table if not exists stb (ts timestamp, c1 int, c2 float, c3 binary(10)) tags (t1 int) + +sql show stables +if $rows != 1 then + return -1 +endi + +print =============== create child table +$tbPrefix = ct +$tbNum = 100 + +$i = 0 +while $i < $tbNum + $tb = $tbPrefix . $i + sql create table $tb using stb tags( $i ) + $i = $i + 1 +endw + +print =============== create normal table +sql create table ntb (ts timestamp, c1 int, c2 float, c3 binary(10)) + +print =============== create multi topics. notes: now only support: +print =============== 1. columns from stb/ctb/ntb; 2. * from ctb/ntb; 3. function from stb/ctb/ntb +print =============== will support: * from stb + +sql create topic topic_stb_column as select ts, c1, c3 from stb +#sql create topic topic_stb_all as select * from stb +sql create topic topic_stb_function as select ts, abs(c1), sin(c2) from stb + +sql create topic topic_ctb_column as select ts, c1, c3 from ct0 +sql create topic topic_ctb_all as select * from ct0 +sql create topic topic_ctb_function as select ts, abs(c1), sin(c2) from ct0 + +sql create topic topic_ntb_column as select ts, c1, c3 from ntb +sql create topic topic_ntb_all as select * from ntb +sql create topic topic_ntb_function as select ts, abs(c1), sin(c2) from ntb + +sql show tables +if $rows != 101 then + return -1 +endi + +print =============== insert data +$rowNum = 100 +$tstart = 1640966400000 # 2022-01-01 00:00:00.000 + +$i = 0 +while $i < $tbNum + $tb = $tbPrefix . $i + + $x = 0 + while $x < $rowNum + $c = $x / 10 + $c = $c * 10 + $c = $x - $c + + $binary = ' . binary + $binary = $binary . $c + $binary = $binary . ' + + sql insert into $tb values ($tstart , $c , $x , $binary ) + sql insert into ntb values ($tstart , $c , $x , $binary ) + $tstart = $tstart + 1 + $x = $x + 1 + endw + + $i = $i + 1 + $tstart = 1640966400000 +endw + +#root@trd02 /home $ tmq_sim --help +# -c Configuration directory, default is +# -d The name of the database for cosumer, no default +# -t The topic string for cosumer, no default +# -k The key-value string for cosumer, no default +# -g showMsgFlag, default is 0 +# + +$totalMsgCnt = $rowNum * $tbNum +print inserted totalMsgCnt: $totalMsgCnt + +# supported key: +# group.id: +# enable.auto.commit: +# auto.offset.reset: +# td.connect.ip: +# td.connect.user:root +# td.connect.pass:taosdata +# td.connect.port:6030 +# td.connect.db:db + +$expect_result = @{consume success: @ +$expect_result = $expect_result . $totalMsgCnt +$expect_result = $expect_result . @, @ +$expect_result = $expect_result . 0} +print expect_result----> $expect_result +print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_stb_column" -k "group.id:tg2" +system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_stb_column" -k "group.id:tg2" +print cmd result----> $system_content +#if $system_content != @{consume success: 10000, 0}@ then +if $system_content != $expect_result then + return -1 +endi + +#print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_stb_all" -k "group.id:tg2" +#system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_stb_all" -k "group.id:tg2" +#print cmd result----> $system_content +##if $system_content != @{consume success: 10000, 0}@ then +#if $system_content != $expect_result then +# return -1 +#endi + +print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_stb_function" -k "group.id:tg2" +system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_stb_function" -k "group.id:tg2" +print cmd result----> $system_content +#if $system_content != @{consume success: 10000, 0}@ then +if $system_content != $expect_result then + return -1 +endi + +$expect_result = @{consume success: @ +$expect_result = $expect_result . $rowNum +$expect_result = $expect_result . @, @ +$expect_result = $expect_result . 0} +print expect_result----> $expect_result +print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ctb_column" -k "group.id:tg2" +system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ctb_column" -k "group.id:tg2" +print cmd result----> $system_content +#if $system_content != @{consume success: 100, 0}@ then +if $system_content != $expect_result then + return -1 +endi + +print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ctb_all" -k "group.id:tg2" +system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ctb_all" -k "group.id:tg2" +print cmd result----> $system_content +#if $system_content != @{consume success: 100, 0}@ then +if $system_content != $expect_result then + return -1 +endi + +print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ctb_function" -k "group.id:tg2" +system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ctb_function" -k "group.id:tg2" +print cmd result----> $system_content +#if $system_content != @{consume success: 100, 0}@ then +if $system_content != $expect_result then + return -1 +endi + +$expect_result = @{consume success: @ +$expect_result = $expect_result . $totalMsgCnt +$expect_result = $expect_result . @, @ +$expect_result = $expect_result . 0} +print expect_result----> $expect_result +print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ntb_column" -k "group.id:tg2" +system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ntb_column" -k "group.id:tg2" +print cmd result----> $system_content +#if $system_content != @{consume success: 10000, 0}@ then +if $system_content != $expect_result then + return -1 +endi + +print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ntb_all" -k "group.id:tg2" +system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ntb_all" -k "group.id:tg2" +print cmd result----> $system_content +#if $system_content != @{consume success: 10000, 0}@ then +if $system_content != $expect_result then + return -1 +endi + +print cmd===> system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ntb_function" -k "group.id:tg2" +system_content ../../debug/tests/test/c/tmq_sim -c ../../sim/tsim/cfg -d $dbNamme -t "topic_ntb_function" -k "group.id:tg2" +print cmd result----> $system_content +#if $system_content != @{consume success: 10000, 0}@ then +if $system_content != $expect_result then + return -1 +endi + +if $loop_cnt == 0 then + $loop_cnt = 1 + $vgroups = 4 + $dbNamme = d1 + goto loop_vgroups +endi + + +#system sh/exec.sh -n dnode1 -s stop -x SIGINT From d9091f74db74ec42bbaa277c40249d6f02119484 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Fri, 1 Apr 2022 09:55:11 +0800 Subject: [PATCH 39/47] fix catalog exit issue --- source/libs/catalog/src/catalog.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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; From b449369265894a3fdcb8070e8bab040db50bdcf9 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Fri, 1 Apr 2022 10:29:20 +0800 Subject: [PATCH 40/47] feature/qnode --- source/libs/catalog/src/catalog.c | 28 ++++++++++++---- source/libs/command/inc/commandInt.h | 6 ++-- source/libs/command/src/explain.c | 44 ++++++++++++------------- source/libs/nodes/src/nodesToSQLFuncs.c | 35 ++++++++++---------- source/libs/nodes/src/nodesUtilFuncs.c | 5 +-- 5 files changed, 65 insertions(+), 53 deletions(-) diff --git a/source/libs/catalog/src/catalog.c b/source/libs/catalog/src/catalog.c index db772000b5..e1f5332899 100644 --- a/source/libs/catalog/src/catalog.c +++ b/source/libs/catalog/src/catalog.c @@ -2011,7 +2011,9 @@ void* ctgUpdateThreadFunc(void* param) { CTG_LOCK(CTG_READ, &gCtgMgmt.lock); while (true) { - tsem_wait(&gCtgMgmt.queue.reqSem); + if (tsem_wait(&gCtgMgmt.queue.reqSem)) { + qError("ctg tsem_wait failed, error:%s", tstrerror(TAOS_SYSTEM_ERROR(errno))); + } if (atomic_load_8((int8_t*)&gCtgMgmt.exit)) { tsem_post(&gCtgMgmt.queue.rspSem); @@ -2175,10 +2177,15 @@ 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); + if (tsem_init(&gCtgMgmt.queue.reqSem, 0, 0)) { + qError("tsem_init failed, error:%s", tstrerror(TAOS_SYSTEM_ERROR(errno))); + CTG_ERR_RET(TSDB_CODE_CTG_SYS_ERROR); + } + + if (tsem_init(&gCtgMgmt.queue.rspSem, 0, 0)) { + qError("tsem_init failed, error:%s", tstrerror(TAOS_SYSTEM_ERROR(errno))); + CTG_ERR_RET(TSDB_CODE_CTG_SYS_ERROR); + } gCtgMgmt.queue.head = taosMemoryCalloc(1, sizeof(SCtgQNode)); if (NULL == gCtgMgmt.queue.head) { @@ -2187,6 +2194,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; @@ -2718,8 +2727,13 @@ void catalogDestroy(void) { atomic_store_8((int8_t*)&gCtgMgmt.exit, true); - tsem_post(&gCtgMgmt.queue.reqSem); - tsem_post(&gCtgMgmt.queue.rspSem); + if (tsem_post(&gCtgMgmt.queue.reqSem)) { + qError("tsem_post failed, error:%s", tstrerror(TAOS_SYSTEM_ERROR(errno))); + } + + if (tsem_post(&gCtgMgmt.queue.rspSem)) { + qError("tsem_post failed, error:%s", tstrerror(TAOS_SYSTEM_ERROR(errno))); + } while (CTG_IS_LOCKED(&gCtgMgmt.lock)) { taosUsleep(1); diff --git a/source/libs/command/inc/commandInt.h b/source/libs/command/inc/commandInt.h index 5915aa7f36..cc3e1d8b55 100644 --- a/source/libs/command/inc/commandInt.h +++ b/source/libs/command/inc/commandInt.h @@ -26,9 +26,9 @@ extern "C" { #define EXPLAIN_MAX_GROUP_NUM 100 //newline area -#define EXPLAIN_TAG_SCAN_FORMAT "Tag Scan on %s columns=%d" -#define EXPLAIN_TBL_SCAN_FORMAT "Table Scan on %s columns=%d" -#define EXPLAIN_SYSTBL_SCAN_FORMAT "System Table Scan on %s columns=%d" +#define EXPLAIN_TAG_SCAN_FORMAT "Tag Scan on %s columns=%d width=%d" +#define EXPLAIN_TBL_SCAN_FORMAT "Table Scan on %s columns=%d width=%d" +#define EXPLAIN_SYSTBL_SCAN_FORMAT "System Table Scan on %s columns=%d width=%d" #define EXPLAIN_PROJECTION_FORMAT "Projection columns=%d width=%d" #define EXPLAIN_JOIN_FORMAT "%s between %d tables width=%d" #define EXPLAIN_AGG_FORMAT "Aggragate functions=%d" diff --git a/source/libs/command/src/explain.c b/source/libs/command/src/explain.c index 5fa12f5ebe..847a863e76 100644 --- a/source/libs/command/src/explain.c +++ b/source/libs/command/src/explain.c @@ -266,7 +266,6 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i bool isVerboseLine = false; char *tbuf = ctx->tbuf; bool verbose = ctx->verbose; - int32_t filterLen = 0; SPhysiNode* pNode = pResNode->pNode; if (NULL == pNode) { qError("pyhsical node in explain res node is NULL"); @@ -276,7 +275,7 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i switch (pNode->type) { case QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN: { STagScanPhysiNode *pTagScanNode = (STagScanPhysiNode *)pNode; - EXPLAIN_ROW_NEW(level, EXPLAIN_TAG_SCAN_FORMAT, pTagScanNode->tableName.tname, pTagScanNode->pScanCols->length); + EXPLAIN_ROW_NEW(level, EXPLAIN_TAG_SCAN_FORMAT, pTagScanNode->tableName.tname, pTagScanNode->pScanCols->length, pTagScanNode->node.pOutputDataBlockDesc->outputRowSize); if (pResNode->pExecInfo) { QRY_ERR_RET(qExplainBufAppendExecInfo(pResNode->pExecInfo, tbuf, &tlen)); } @@ -297,7 +296,7 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i case QUERY_NODE_PHYSICAL_PLAN_TABLE_SEQ_SCAN: case QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN:{ STableScanPhysiNode *pTblScanNode = (STableScanPhysiNode *)pNode; - EXPLAIN_ROW_NEW(level, EXPLAIN_TBL_SCAN_FORMAT, pTblScanNode->scan.tableName.tname, pTblScanNode->scan.pScanCols->length); + EXPLAIN_ROW_NEW(level, EXPLAIN_TBL_SCAN_FORMAT, pTblScanNode->scan.tableName.tname, pTblScanNode->scan.pScanCols->length, pTblScanNode->scan.node.pOutputDataBlockDesc->outputRowSize); if (pResNode->pExecInfo) { QRY_ERR_RET(qExplainBufAppendExecInfo(pResNode->pExecInfo, tbuf, &tlen)); } @@ -319,8 +318,7 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i if (pTblScanNode->scan.node.pConditions) { EXPLAIN_ROW_NEW(level + 1, EXPLAIN_FILTER_FORMAT); - QRY_ERR_RET(nodesNodeToSQL(pTblScanNode->scan.node.pConditions, tbuf + tlen, TSDB_EXPLAIN_RESULT_ROW_SIZE - tlen, &filterLen)); - tlen += filterLen; + QRY_ERR_RET(nodesNodeToSQL(pTblScanNode->scan.node.pConditions, tbuf + VARSTR_HEADER_SIZE, TSDB_EXPLAIN_RESULT_ROW_SIZE, &tlen)); EXPLAIN_ROW_END(); QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); } @@ -329,7 +327,7 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i } case QUERY_NODE_PHYSICAL_PLAN_SYSTABLE_SCAN:{ SSystemTableScanPhysiNode *pSTblScanNode = (SSystemTableScanPhysiNode *)pNode; - EXPLAIN_ROW_NEW(level, EXPLAIN_SYSTBL_SCAN_FORMAT, pSTblScanNode->scan.tableName.tname, pSTblScanNode->scan.pScanCols->length); + EXPLAIN_ROW_NEW(level, EXPLAIN_SYSTBL_SCAN_FORMAT, pSTblScanNode->scan.tableName.tname, pSTblScanNode->scan.pScanCols->length, pSTblScanNode->scan.node.pOutputDataBlockDesc->outputRowSize); if (pResNode->pExecInfo) { QRY_ERR_RET(qExplainBufAppendExecInfo(pResNode->pExecInfo, tbuf, &tlen)); } @@ -343,7 +341,15 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i if (verbose) { EXPLAIN_ROW_NEW(level + 1, EXPLAIN_ORDER_FORMAT, EXPLAIN_ORDER_STRING(pSTblScanNode->scan.order)); EXPLAIN_ROW_END(); - QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); + QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); + + if (pSTblScanNode->scan.node.pConditions) { + EXPLAIN_ROW_NEW(level + 1, EXPLAIN_FILTER_FORMAT); + QRY_ERR_RET(nodesNodeToSQL(pSTblScanNode->scan.node.pConditions, tbuf + VARSTR_HEADER_SIZE, TSDB_EXPLAIN_RESULT_ROW_SIZE, &tlen)); + EXPLAIN_ROW_END(); + QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); + } + } break; } @@ -359,8 +365,7 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i if (verbose) { if (pPrjNode->node.pConditions) { EXPLAIN_ROW_NEW(level + 1, EXPLAIN_FILTER_FORMAT); - QRY_ERR_RET(nodesNodeToSQL(pPrjNode->node.pConditions, tbuf + tlen, TSDB_EXPLAIN_RESULT_ROW_SIZE - tlen, &filterLen)); - tlen += filterLen; + QRY_ERR_RET(nodesNodeToSQL(pPrjNode->node.pConditions, tbuf + VARSTR_HEADER_SIZE, TSDB_EXPLAIN_RESULT_ROW_SIZE, &tlen)); EXPLAIN_ROW_END(); QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); } @@ -379,15 +384,13 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i if (verbose) { if (pJoinNode->node.pConditions) { EXPLAIN_ROW_NEW(level + 1, EXPLAIN_FILTER_FORMAT); - QRY_ERR_RET(nodesNodeToSQL(pJoinNode->node.pConditions, tbuf + tlen, TSDB_EXPLAIN_RESULT_ROW_SIZE - tlen, &filterLen)); - tlen += filterLen; + QRY_ERR_RET(nodesNodeToSQL(pJoinNode->node.pConditions, tbuf + VARSTR_HEADER_SIZE, TSDB_EXPLAIN_RESULT_ROW_SIZE, &tlen)); EXPLAIN_ROW_END(); QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); } EXPLAIN_ROW_NEW(level + 1, EXPLAIN_ON_CONDITIONS_FORMAT); - QRY_ERR_RET(nodesNodeToSQL(pJoinNode->pOnConditions, tbuf + tlen, TSDB_EXPLAIN_RESULT_ROW_SIZE - tlen, &filterLen)); - tlen += filterLen; + QRY_ERR_RET(nodesNodeToSQL(pJoinNode->pOnConditions, tbuf + VARSTR_HEADER_SIZE, TSDB_EXPLAIN_RESULT_ROW_SIZE, &tlen)); EXPLAIN_ROW_END(); QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); } @@ -410,8 +413,7 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i if (verbose) { if (pAggNode->node.pConditions) { EXPLAIN_ROW_NEW(level + 1, EXPLAIN_FILTER_FORMAT); - QRY_ERR_RET(nodesNodeToSQL(pAggNode->node.pConditions, tbuf + tlen, TSDB_EXPLAIN_RESULT_ROW_SIZE - tlen, &filterLen)); - tlen += filterLen; + QRY_ERR_RET(nodesNodeToSQL(pAggNode->node.pConditions, tbuf + VARSTR_HEADER_SIZE, TSDB_EXPLAIN_RESULT_ROW_SIZE, &tlen)); EXPLAIN_ROW_END(); QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); } @@ -436,8 +438,7 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i if (verbose) { if (pExchNode->node.pConditions) { EXPLAIN_ROW_NEW(level + 1, EXPLAIN_FILTER_FORMAT); - QRY_ERR_RET(nodesNodeToSQL(pExchNode->node.pConditions, tbuf + tlen, TSDB_EXPLAIN_RESULT_ROW_SIZE - tlen, &filterLen)); - tlen += filterLen; + QRY_ERR_RET(nodesNodeToSQL(pExchNode->node.pConditions, tbuf + VARSTR_HEADER_SIZE, TSDB_EXPLAIN_RESULT_ROW_SIZE, &tlen)); EXPLAIN_ROW_END(); QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); } @@ -458,8 +459,7 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i if (verbose) { if (pSortNode->node.pConditions) { EXPLAIN_ROW_NEW(level + 1, EXPLAIN_FILTER_FORMAT); - QRY_ERR_RET(nodesNodeToSQL(pSortNode->node.pConditions, tbuf + tlen, TSDB_EXPLAIN_RESULT_ROW_SIZE - tlen, &filterLen)); - tlen += filterLen; + QRY_ERR_RET(nodesNodeToSQL(pSortNode->node.pConditions, tbuf + VARSTR_HEADER_SIZE, TSDB_EXPLAIN_RESULT_ROW_SIZE, &tlen)); EXPLAIN_ROW_END(); QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); } @@ -488,8 +488,7 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i if (pIntNode->window.node.pConditions) { EXPLAIN_ROW_NEW(level + 1, EXPLAIN_FILTER_FORMAT); - QRY_ERR_RET(nodesNodeToSQL(pIntNode->window.node.pConditions, tbuf + tlen, TSDB_EXPLAIN_RESULT_ROW_SIZE - tlen, &filterLen)); - tlen += filterLen; + QRY_ERR_RET(nodesNodeToSQL(pIntNode->window.node.pConditions, tbuf + VARSTR_HEADER_SIZE, TSDB_EXPLAIN_RESULT_ROW_SIZE, &tlen)); EXPLAIN_ROW_END(); QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); } @@ -508,8 +507,7 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i if (verbose) { if (pIntNode->window.node.pConditions) { EXPLAIN_ROW_NEW(level + 1, EXPLAIN_FILTER_FORMAT); - QRY_ERR_RET(nodesNodeToSQL(pIntNode->window.node.pConditions, tbuf + tlen, TSDB_EXPLAIN_RESULT_ROW_SIZE - tlen, &filterLen)); - tlen += filterLen; + QRY_ERR_RET(nodesNodeToSQL(pIntNode->window.node.pConditions, tbuf + VARSTR_HEADER_SIZE, TSDB_EXPLAIN_RESULT_ROW_SIZE, &tlen)); EXPLAIN_ROW_END(); QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); } diff --git a/source/libs/nodes/src/nodesToSQLFuncs.c b/source/libs/nodes/src/nodesToSQLFuncs.c index fa941cfe9c..68f38bb6a7 100644 --- a/source/libs/nodes/src/nodesToSQLFuncs.c +++ b/source/libs/nodes/src/nodesToSQLFuncs.c @@ -30,18 +30,17 @@ int32_t nodesNodeToSQL(SNode *pNode, char *buf, int32_t bufSize, int32_t *len) { switch (pNode->type) { case QUERY_NODE_COLUMN: { SColumnNode *colNode = (SColumnNode *)pNode; - *len = 0; if (colNode->dbName[0]) { - *len += snprintf(buf, bufSize - *len, "`%s`.", colNode->dbName); + *len += snprintf(buf + *len, bufSize - *len, "`%s`.", colNode->dbName); } if (colNode->tableAlias[0]) { - *len += snprintf(buf, bufSize - *len, "`%s`.", colNode->tableAlias); + *len += snprintf(buf + *len, bufSize - *len, "`%s`.", colNode->tableAlias); } else if (colNode->tableName[0]) { - *len += snprintf(buf, bufSize - *len, "`%s`.", colNode->tableName); + *len += snprintf(buf + *len, bufSize - *len, "`%s`.", colNode->tableName); } - *len += snprintf(buf, bufSize - *len, "`%s`", colNode->colName); + *len += snprintf(buf + *len, bufSize - *len, "`%s`", colNode->colName); return TSDB_CODE_SUCCESS; } @@ -53,14 +52,14 @@ int32_t nodesNodeToSQL(SNode *pNode, char *buf, int32_t bufSize, int32_t *len) { NODES_ERR_RET(TSDB_CODE_QRY_APP_ERROR); } - *len += snprintf(buf, bufSize - *len, "%s", t); + *len += snprintf(buf + *len, bufSize - *len, "%s", t); taosMemoryFree(t); return TSDB_CODE_SUCCESS; } case QUERY_NODE_OPERATOR: { SOperatorNode* pOpNode = (SOperatorNode*)pNode; - *len += snprintf(buf, bufSize - *len, "("); + *len += snprintf(buf + *len, bufSize - *len, "("); if (pOpNode->pLeft) { NODES_ERR_RET(nodesNodeToSQL(pOpNode->pLeft, buf, bufSize, len)); } @@ -70,13 +69,13 @@ int32_t nodesNodeToSQL(SNode *pNode, char *buf, int32_t bufSize, int32_t *len) { NODES_ERR_RET(TSDB_CODE_QRY_APP_ERROR); } - *len += snprintf(buf, bufSize - *len, " %s ", gOperatorStr[pOpNode->opType]); + *len += snprintf(buf + *len, bufSize - *len, " %s ", gOperatorStr[pOpNode->opType]); if (pOpNode->pRight) { NODES_ERR_RET(nodesNodeToSQL(pOpNode->pRight, buf, bufSize, len)); } - *len += snprintf(buf, bufSize - *len, ")"); + *len += snprintf(buf + *len, bufSize - *len, ")"); return TSDB_CODE_SUCCESS; } @@ -85,17 +84,17 @@ int32_t nodesNodeToSQL(SNode *pNode, char *buf, int32_t bufSize, int32_t *len) { SNode* node = NULL; bool first = true; - *len += snprintf(buf, bufSize - *len, "("); + *len += snprintf(buf + *len, bufSize - *len, "("); FOREACH(node, pLogicNode->pParameterList) { if (!first) { - *len += snprintf(buf, bufSize - *len, " %s ", gLogicConditionStr[pLogicNode->condType]); + *len += snprintf(buf + *len, bufSize - *len, " %s ", gLogicConditionStr[pLogicNode->condType]); } NODES_ERR_RET(nodesNodeToSQL(node, buf, bufSize, len)); first = false; } - *len += snprintf(buf, bufSize - *len, ")"); + *len += snprintf(buf + *len, bufSize - *len, ")"); return TSDB_CODE_SUCCESS; } @@ -104,17 +103,17 @@ int32_t nodesNodeToSQL(SNode *pNode, char *buf, int32_t bufSize, int32_t *len) { SNode* node = NULL; bool first = true; - *len += snprintf(buf, bufSize - *len, "%s(", pFuncNode->functionName); + *len += snprintf(buf + *len, bufSize - *len, "%s(", pFuncNode->functionName); FOREACH(node, pFuncNode->pParameterList) { if (!first) { - *len += snprintf(buf, bufSize - *len, ", "); + *len += snprintf(buf + *len, bufSize - *len, ", "); } NODES_ERR_RET(nodesNodeToSQL(node, buf, bufSize, len)); first = false; } - *len += snprintf(buf, bufSize - *len, ")"); + *len += snprintf(buf + *len, bufSize - *len, ")"); return TSDB_CODE_SUCCESS; } @@ -123,17 +122,17 @@ int32_t nodesNodeToSQL(SNode *pNode, char *buf, int32_t bufSize, int32_t *len) { SNode* node = NULL; bool first = true; - *len += snprintf(buf, bufSize - *len, "("); + *len += snprintf(buf + *len, bufSize - *len, "("); FOREACH(node, pListNode->pNodeList) { if (!first) { - *len += snprintf(buf, bufSize - *len, ", "); + *len += snprintf(buf + *len, bufSize - *len, ", "); } NODES_ERR_RET(nodesNodeToSQL(node, buf, bufSize, len)); first = false; } - *len += snprintf(buf, bufSize - *len, ")"); + *len += snprintf(buf + *len, bufSize - *len, ")"); return TSDB_CODE_SUCCESS; } diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index de46c5a48b..732d9acfbe 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -839,12 +839,13 @@ char* nodesGetStrValueFromNode(SValueNode *pNode) { case TSDB_DATA_TYPE_NCHAR: case TSDB_DATA_TYPE_VARCHAR: case TSDB_DATA_TYPE_VARBINARY: { - void *buf = taosMemoryMalloc(varDataLen(pNode->datum.p) + 1); + int32_t bufSize = varDataLen(pNode->datum.p) + 2 + 1; + void *buf = taosMemoryMalloc(bufSize); if (NULL == buf) { return NULL; } - strncpy(buf, varDataVal(pNode->datum.p), varDataLen(pNode->datum.p) + 1); + snprintf(buf, bufSize, "'%s'", varDataVal(pNode->datum.p)); return buf; } default: From db08d3ca9b27b9cdca35c3513e602ad576ffbb6e Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Thu, 31 Mar 2022 22:38:48 -0400 Subject: [PATCH 41/47] TD-14392 bugfix --- include/common/ttokendef.h | 30 +++++++++++++------------- include/util/taoserror.h | 1 + source/libs/parser/src/parAstCreater.c | 6 +++--- source/libs/parser/src/parTranslater.c | 16 +++++++++++--- source/libs/parser/src/parUtil.c | 2 ++ 5 files changed, 34 insertions(+), 21 deletions(-) diff --git a/include/common/ttokendef.h b/include/common/ttokendef.h index 47a97071aa..07ca829bf0 100644 --- a/include/common/ttokendef.h +++ b/include/common/ttokendef.h @@ -82,21 +82,21 @@ #define TK_SINGLE_STABLE 64 #define TK_STREAM_MODE 65 #define TK_RETENTIONS 66 -#define TK_TABLE 67 -#define TK_NK_LP 68 -#define TK_NK_RP 69 -#define TK_STABLE 70 -#define TK_ADD 71 -#define TK_COLUMN 72 -#define TK_MODIFY 73 -#define TK_RENAME 74 -#define TK_TAG 75 -#define TK_SET 76 -#define TK_NK_EQ 77 -#define TK_USING 78 -#define TK_TAGS 79 -#define TK_NK_DOT 80 -#define TK_NK_COMMA 81 +#define TK_NK_COMMA 67 +#define TK_TABLE 68 +#define TK_NK_LP 69 +#define TK_NK_RP 70 +#define TK_STABLE 71 +#define TK_ADD 72 +#define TK_COLUMN 73 +#define TK_MODIFY 74 +#define TK_RENAME 75 +#define TK_TAG 76 +#define TK_SET 77 +#define TK_NK_EQ 78 +#define TK_USING 79 +#define TK_TAGS 80 +#define TK_NK_DOT 81 #define TK_COMMENT 82 #define TK_BOOL 83 #define TK_TINYINT 84 diff --git a/include/util/taoserror.h b/include/util/taoserror.h index 7c6ecd6d9a..4e2cb7944a 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -481,6 +481,7 @@ int32_t* taosGetErrno(); #define TSDB_CODE_PAR_INTERVAL_VALUE_TOO_SMALL TAOS_DEF_ERROR_CODE(0, 0x2615) #define TSDB_CODE_PAR_DB_NOT_SPECIFIED TAOS_DEF_ERROR_CODE(0, 0x2616) #define TSDB_CODE_PAR_INVALID_IDENTIFIER_NAME TAOS_DEF_ERROR_CODE(0, 0x2617) +#define TSDB_CODE_PAR_CORRESPONDING_STABLE_ERR TAOS_DEF_ERROR_CODE(0, 0x2618) #ifdef __cplusplus } diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c index 50ab120c56..028238ab60 100644 --- a/source/libs/parser/src/parAstCreater.c +++ b/source/libs/parser/src/parAstCreater.c @@ -193,7 +193,7 @@ static SDatabaseOptions* setDbTtl(SAstCreateContext* pCxt, SDatabaseOptions* pOp static SDatabaseOptions* setDbWal(SAstCreateContext* pCxt, SDatabaseOptions* pOptions, const SToken* pVal) { int64_t val = strtol(pVal->z, NULL, 10); if (val < TSDB_MIN_WAL_LEVEL || val > TSDB_MAX_WAL_LEVEL) { - snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, "invalid db option walLevel: %d, only 1-2 allowed", val); + snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, "invalid db option walLevel: %"PRId64", only 1-2 allowed", val); pCxt->valid = false; return pOptions; } @@ -216,7 +216,7 @@ static SDatabaseOptions* setDbVgroups(SAstCreateContext* pCxt, SDatabaseOptions* static SDatabaseOptions* setDbSingleStable(SAstCreateContext* pCxt, SDatabaseOptions* pOptions, const SToken* pVal) { int64_t val = strtol(pVal->z, NULL, 10); if (val < TSDB_MIN_DB_SINGLE_STABLE_OPTION || val > TSDB_MAX_DB_SINGLE_STABLE_OPTION) { - snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, "invalid db option singleStable: %d, only 0-1 allowed", val); + snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, "invalid db option singleStable: %"PRId64", only 0-1 allowed", val); pCxt->valid = false; return pOptions; } @@ -227,7 +227,7 @@ static SDatabaseOptions* setDbSingleStable(SAstCreateContext* pCxt, SDatabaseOpt static SDatabaseOptions* setDbStreamMode(SAstCreateContext* pCxt, SDatabaseOptions* pOptions, const SToken* pVal) { int64_t val = strtol(pVal->z, NULL, 10); if (val < TSDB_MIN_DB_STREAM_MODE_OPTION || val > TSDB_MAX_DB_STREAM_MODE_OPTION) { - snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, "invalid db option streamMode: %d, only 0-1 allowed", val); + snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, "invalid db option streamMode: %"PRId64", only 0-1 allowed", val); pCxt->valid = false; return pOptions; } diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 2a5fa5fdfe..a3ba53c496 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -1120,7 +1120,7 @@ static const SColumnDefNode* findColDef(const SNodeList* pCols, const SColumnNod return NULL; } -static int32_t checkCreateTable(STranslateContext* pCxt, SCreateTableStmt* pStmt) { +static int32_t checkCreateSuperTable(STranslateContext* pCxt, SCreateTableStmt* pStmt) { if (NULL != pStmt->pOptions->pSma) { SNode* pNode = NULL; FOREACH(pNode, pStmt->pOptions->pSma) { @@ -1149,7 +1149,7 @@ static int32_t getAggregationMethod(SNodeList* pFuncs) { } static int32_t translateCreateSuperTable(STranslateContext* pCxt, SCreateTableStmt* pStmt) { - int32_t code = checkCreateTable(pCxt, pStmt); + int32_t code = checkCreateSuperTable(pCxt, pStmt); if (TSDB_CODE_SUCCESS != code) { return code; } @@ -2448,9 +2448,19 @@ static int32_t buildKVRowForAllTags(STranslateContext* pCxt, SCreateSubTableClau return TSDB_CODE_SUCCESS; } +static int32_t checkCreateSubTable(STranslateContext* pCxt, SCreateSubTableClause* pStmt) { + if (0 != strcmp(pStmt->dbName, pStmt->useDbName)) { + return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_CORRESPONDING_STABLE_ERR);; + } + return TSDB_CODE_SUCCESS; +} static int32_t rewriteCreateSubTable(STranslateContext* pCxt, SCreateSubTableClause* pStmt, SHashObj* pVgroupHashmap) { + int32_t code = checkCreateSubTable(pCxt, pStmt); + STableMeta* pSuperTableMeta = NULL; - int32_t code = getTableMeta(pCxt, pStmt->useDbName, pStmt->useTableName, &pSuperTableMeta); + if (TSDB_CODE_SUCCESS == code) { + code = getTableMeta(pCxt, pStmt->useDbName, pStmt->useTableName, &pSuperTableMeta); + } SKVRowBuilder kvRowBuilder = {0}; if (TSDB_CODE_SUCCESS == code) { diff --git a/source/libs/parser/src/parUtil.c b/source/libs/parser/src/parUtil.c index 0b999322ce..aeed7719f3 100644 --- a/source/libs/parser/src/parUtil.c +++ b/source/libs/parser/src/parUtil.c @@ -65,6 +65,8 @@ static char* getSyntaxErrFormat(int32_t errCode) { return "db not specified"; case TSDB_CODE_PAR_INVALID_IDENTIFIER_NAME: return "Invalid identifier name : %s"; + case TSDB_CODE_PAR_CORRESPONDING_STABLE_ERR: + return "corresponding super table not in this db"; case TSDB_CODE_OUT_OF_MEMORY: return "Out of memory"; default: From 8fcaee6d97d3b9fc08de6e60c5961e10bd770d74 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 1 Apr 2022 10:39:59 +0800 Subject: [PATCH 42/47] minor changes --- source/dnode/mgmt/dm/src/dmFile.c | 2 +- source/dnode/mgmt/main/src/dndExec.c | 10 ++++++++-- source/util/src/tconfig.c | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/source/dnode/mgmt/dm/src/dmFile.c b/source/dnode/mgmt/dm/src/dmFile.c index 444f18e6e0..d5105bcb1b 100644 --- a/source/dnode/mgmt/dm/src/dmFile.c +++ b/source/dnode/mgmt/dm/src/dmFile.c @@ -200,7 +200,7 @@ int32_t dmWriteFile(SDnodeMgmt *pMgmt) { taosMemoryFree(content); char realfile[PATH_MAX]; - snprintf(realfile, sizeof(realfile), "%s%smnode.json", pMgmt->path, TD_DIRSEP); + snprintf(realfile, sizeof(realfile), "%s%sdnode.json", pMgmt->path, TD_DIRSEP); if (taosRenameFile(file, realfile) != 0) { terrno = TAOS_SYSTEM_ERROR(errno); diff --git a/source/dnode/mgmt/main/src/dndExec.c b/source/dnode/mgmt/main/src/dndExec.c index fdc6125fb0..82f54d4fc9 100644 --- a/source/dnode/mgmt/main/src/dndExec.c +++ b/source/dnode/mgmt/main/src/dndExec.c @@ -20,9 +20,9 @@ static bool dndRequireNode(SMgmtWrapper *pWrapper) { bool required = false; int32_t code = (*pWrapper->fp.requiredFp)(pWrapper, &required); if (!required) { - dDebug("node:%s, no need to start", pWrapper->name); + dDebug("node:%s, does not require startup", pWrapper->name); } else { - dDebug("node:%s, need to start", pWrapper->name); + dDebug("node:%s, needs to be started", pWrapper->name); } return required; } @@ -279,6 +279,12 @@ static int32_t dndRunInChildProcess(SDnode *pDnode) { SMgmtWrapper *pWrapper = &pDnode->wrappers[pDnode->ntype]; dInfo("%s run in child process", pWrapper->name); + pWrapper->required = dndRequireNode(pWrapper); + if (!pWrapper->required) { + dError("%s does not require startup", pWrapper->name); + return -1; + } + SMsgCb msgCb = dndCreateMsgcb(pWrapper); tmsgSetDefaultMsgCb(&msgCb); pWrapper->procType = PROC_CHILD; diff --git a/source/util/src/tconfig.c b/source/util/src/tconfig.c index 9101d3c7c8..ce9ef5b1c0 100644 --- a/source/util/src/tconfig.c +++ b/source/util/src/tconfig.c @@ -590,7 +590,7 @@ void cfgDumpCfg(SConfig *pCfg, bool tsc, bool dump) { } int32_t cfgLoadFromEnvVar(SConfig *pConfig) { - uInfo("load from global env variables not implemented yet"); + uInfo("load from env variables not implemented yet"); return 0; } From 5d1f87e0738dbc48d48ce81daa85ef0b18115f2f Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Thu, 31 Mar 2022 22:54:00 -0400 Subject: [PATCH 43/47] bugfix --- tests/script/tsim/db/basic6.sim | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/script/tsim/db/basic6.sim b/tests/script/tsim/db/basic6.sim index 7e57fe8f1b..a768a0da38 100644 --- a/tests/script/tsim/db/basic6.sim +++ b/tests/script/tsim/db/basic6.sim @@ -15,7 +15,7 @@ $tb = $tbPrefix . $i print =============== step1 # quorum presicion -sql create database $db vgroups 8 replica 1 days 20 keep 3650 cache 32 blocks 12 minrows 80 maxrows 10000 wal 2 fsync 1000 comp 0 cachelast 2 precision 'us' +sql create database $db vgroups 8 replica 1 days 2880 keep 3650 cache 32 blocks 12 minrows 80 maxrows 10000 wal 2 fsync 1000 comp 0 cachelast 2 precision 'us' sql show databases print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1 print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 @@ -35,7 +35,7 @@ endi if $data04 != 1 then return -1 endi -if $data06 != 20 then +if $data06 != 2880 then return -1 endi if $data07 != 3650,3650,3650 then @@ -67,7 +67,7 @@ print =============== step4 sql_error drop database $db print =============== step5 -sql create database $db replica 1 days 15 keep 1500 +sql create database $db replica 1 days 21600 keep 2160000 sql show databases print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 if $data00 != $db then @@ -79,7 +79,7 @@ endi if $data04 != 1 then return -1 endi -if $data06 != 15 then +if $data06 != 21600 then return -1 endi From e9ced960b9cacb4028934e8ad4357ef30c5d4b87 Mon Sep 17 00:00:00 2001 From: cpwu Date: Fri, 1 Apr 2022 11:18:52 +0800 Subject: [PATCH 44/47] fix interval-offset sim case --- tests/script/tsim/query/interval-offset.sim | 217 +++++++++----------- 1 file changed, 95 insertions(+), 122 deletions(-) diff --git a/tests/script/tsim/query/interval-offset.sim b/tests/script/tsim/query/interval-offset.sim index ffb13979cd..616ece99e0 100644 --- a/tests/script/tsim/query/interval-offset.sim +++ b/tests/script/tsim/query/interval-offset.sim @@ -73,39 +73,45 @@ sql insert into ct4 values ( '2022-12-01 01:01:30.000', 8 ) sql insert into ct4 values ( '2022-12-31 01:01:36.000', 9 ) print ================ start query ====================== -sql select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(*) from ct1 interval(10s, 2s) -print ===> select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(*) from ct1 interval(10s, 2s) +sql select _wstartts, _wendts, _wduration, _qstartts, _qendts, count(*) from ct1 interval(10s, 2s) +print ===> select _wstartts, _wendts, _wduration, _qstartts, _qendts, count(*) from ct1 interval(10s, 2s) print ===> rows: $rows -print ===> rows0: $data00 $data01 $data02 $data03 $data04 -print ===> rows1: $data10 $data11 $data12 $data13 $data14 -print ===> rows2: $data20 $data21 $data22 $data23 $data24 -print ===> rows3: $data30 $data31 $data32 $data33 $data34 -print ===> rows4: $data40 $data41 $data42 $data43 $data44 +print ===> rows0: $data00 $data01 $data02 $data05 +print ===> rows1: $data10 $data11 $data12 $data15 +print ===> rows2: $data20 $data21 $data22 $data25 +print ===> rows3: $data30 $data31 $data32 $data35 +print ===> rows4: $data40 $data41 $data42 $data45 if $rows != 5 then return -1 endi -if $data00 != 1 then +if $data00 != @22-01-01 01:00:52.000@ then return -1 endi -if $data40 != 1 then +if $data02 != 10000 then + return -1 +endi +if $data45 != 1 then return -1 endi -sql select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(*) from ct1 interval(10s, 2s) sliding(10s) -print ===> select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(*) from ct1 interval(10s, 2s) sliding(10s) +sql select _wstartts, _wendts, _wduration, _qstartts, _qendts, count(*) from ct1 interval(10s, 2s) sliding(10s) +print ===> select _wstartts, _wendts, _wduration, _qstartts, _qendts, count(*) from ct1 interval(10s, 2s) sliding(10s) print ===> rows: $rows -print ===> rows0: $data00 $data01 $data02 $data03 $data04 -print ===> rows1: $data10 $data11 $data12 $data13 $data14 -print ===> rows2: $data20 $data21 $data22 $data23 $data24 -print ===> rows3: $data30 $data31 $data32 $data33 $data34 -print ===> rows4: $data40 $data41 $data42 $data43 $data44 +print ===> rows0: $data00 $data01 $data02 $data05 +print ===> rows1: $data10 $data11 $data12 $data15 +print ===> rows2: $data20 $data21 $data22 $data25 +print ===> rows3: $data30 $data31 $data32 $data35 +print ===> rows4: $data40 $data41 $data42 $data45 if $rows != 5 then return -1 endi -if $data00 != 1 then +if $data00 != @22-01-01 01:00:52.000@ then return -1 endi -if $data40 != 1 then +if $data02 != 10000 then + return -1 +endi +if $data45 != 1 then return -1 endi @@ -176,107 +182,81 @@ if $data70 != 1 then return -1 endi -sql select _wstartts, _wendts, _wduration, _qstartts, _qendts, count(tbcol) from ct2 interval(1d, 2h) sliding(12h) -print ===> select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(*) from ct2 interval(1d, 2h) sliding(12h) -print ===> rows: $rows -print ===> rows0: $data00 $data01 $data02 $data03 $data04 $data05 -print ===> rows1: $data10 $data11 $data12 $data13 $data14 $data15 -print ===> rows2: $data20 $data21 $data22 $data23 $data24 $data25 -print ===> rows3: $data30 $data31 $data32 $data33 $data34 $data35 -print ===> rows4: $data40 $data41 $data42 $data43 $data44 $data45 -print ===> rows5: $data50 $data51 $data52 $data53 $data54 $data55 -print ===> rows6: $data60 $data61 $data62 $data63 $data64 $data65 -print ===> rows7: $data70 $data71 $data72 $data73 $data74 $data75 -if $rows != 8 then - return -1 -endi -if $data05 != 1 then - return -1 -endi -if $data15 != 2 then - return -1 -endi -if $data75 != 1 then - return -1 -endi -if $data02 != 86400000 then - return -1 -endi - -sql select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(*) from ct3 interval(1n, 1w) +sql select _wstartts, count(tbcol), _wduration, _wstartts, count(*) from ct3 interval(1n, 1w) print ===> select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(*) from ct3 interval(1n, 1w) print ===> rows: $rows print ===> rows0: $data00 $data01 $data02 $data03 $data04 print ===> rows1: $data10 $data11 $data12 $data13 $data14 print ===> rows2: $data20 $data21 $data22 $data23 $data24 print ===> rows3: $data30 $data31 $data32 $data33 $data34 -print ===> rows4: $data40 $data41 $data42 $data43 $data44 -# if $rows != 5 then -# return -1 -# endi -# f $data00 != 1 then -# return -1 -# endi -# if $data40 != 1 then -# return -1 -# endi +if $rows != 4 then + return -1 +endi +if $data00 != @21-12-08 00:00:00.000@ then + return -1 +endi +if $data31 != 1 then + return -1 +endi +if $data34 != $data31 then + return -1 +endi +if $data02 != 2678400000 then + return -1 +endi -sql select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(*) from ct3 interval(1n, 1w) sliding(2w) +sql select _wstartts, count(tbcol), _wduration, _wstartts, count(*) from ct3 interval(1n, 1w) sliding(2w) print ===> select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(*) from ct3 interval(1n, 1w) sliding(2w) print ===> rows: $rows print ===> rows0: $data00 $data01 $data02 $data03 $data04 print ===> rows1: $data10 $data11 $data12 $data13 $data14 print ===> rows2: $data20 $data21 $data22 $data23 $data24 print ===> rows3: $data30 $data31 $data32 $data33 $data34 -print ===> rows4: $data40 $data41 $data42 $data43 $data44 -#if $rows != 5 then -# return -1 -#endi -#if $data00 != 1 then -# return -1 -#endi -#if $data40 != 1 then -# return -1 -#endi +if $rows != 4 then + return -1 +endi +if $data00 != @21-11-30 08:00:00.000@ then + return -1 +endi +if $data01 != NULL then + return -1 +endi +if $data31 != $data34 then + return -1 +endi -sql select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(*) from ct3 interval(1n, 1w) sliding(4w) -print ===> select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(*) from ct3 interval(1n, 1w) sliding(4w) +sql select _wstartts, count(tbcol), _wduration, _wstartts, count(*) from ct3 interval(1n, 1w) sliding(4w) +print ===> select _wstartts, count(tbcol), _wduration, _wstartts, count(*) from ct3 interval(1n, 1w) sliding(4w) print ===> rows: $rows print ===> rows0: $data00 $data01 $data02 $data03 $data04 print ===> rows1: $data10 $data11 $data12 $data13 $data14 print ===> rows2: $data20 $data21 $data22 $data23 $data24 print ===> rows3: $data30 $data31 $data32 $data33 $data34 -print ===> rows4: $data40 $data41 $data42 $data43 $data44 -print ===> rows5: $data50 $data51 $data52 $data53 $data54 -print ===> rows6: $data60 $data61 $data62 $data63 $data64 -print ===> rows7: $data70 $data71 $data72 $data73 $data74 -#if $rows != 8 then -# return -1 -#endi -#if $data00 != 2 then -# return -1 -#endi -#if $data70 != 1 then -# return -1 -#endi +if $rows != 4 then + return -1 +endi +if $data01 != NULL then + return -1 +endi +if $data04 != 1 then + return -1 +endi -sql select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(*) from ct4 interval(1y, 6n) -print ===> select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(*) from ct4 interval(1y, 6n) +sql select _wstartts, count(tbcol), _wduration, _wstartts, count(*) from ct4 interval(1y, 6n) +print ===> select _wstartts, count(tbcol), _wduration, _wstartts, count(*) from ct4 interval(1y, 6n) print ===> rows: $rows print ===> rows0: $data00 $data01 $data02 $data03 $data04 print ===> rows1: $data10 $data11 $data12 $data13 $data14 print ===> rows2: $data20 $data21 $data22 $data23 $data24 -print ===> rows3: $data30 $data31 $data32 $data33 $data34 -print ===> rows4: $data40 $data41 $data42 $data43 $data44 -#if $rows != 5 then -# return -1 -#endi -#if $data00 != 1 then -# return -1 -#endi -#if $data40 != 1 then -# return -1 -#endi +if $rows != 3 then + return -1 +endi +if $data01 != 2 then + return -1 +endi +if $data04 != 2 then + return -1 +endi sql select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(*) from ct4 interval(1y, 6n) sliding(6n) print ===> select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(*) from ct4 interval(1y, 6n) sliding(6n) @@ -284,38 +264,31 @@ print ===> rows: $rows print ===> rows0: $data00 $data01 $data02 $data03 $data04 print ===> rows1: $data10 $data11 $data12 $data13 $data14 print ===> rows2: $data20 $data21 $data22 $data23 $data24 -print ===> rows3: $data30 $data31 $data32 $data33 $data34 -print ===> rows4: $data40 $data41 $data42 $data43 $data44 -#if $rows != 5 then -# return -1 -#endi -#if $data00 != 1 then -# return -1 -#endi -#if $data40 != 1 then -# return -1 -#endi +if $rows != 3 then + return -1 +endi +if $data00 != 2 then + return -1 +endi +if $data04 != 2 then + return -1 +endi -sql select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(*) from ct4 interval(1y, 6n) sliding(12n) -print ===> select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(*) from ct4 interval(1y, 6n) sliding(12n) +sql select _wstartts, count(tbcol), _wduration, _wstartts, count(*) from ct4 interval(1y, 6n) sliding(12n) +print ===> select _wstartts, count(tbcol), _wduration, _wstartts, count(*) from ct4 interval(1y, 6n) sliding(12n) print ===> rows: $rows print ===> rows0: $data00 $data01 $data02 $data03 $data04 print ===> rows1: $data10 $data11 $data12 $data13 $data14 print ===> rows2: $data20 $data21 $data22 $data23 $data24 -print ===> rows3: $data30 $data31 $data32 $data33 $data34 -print ===> rows4: $data40 $data41 $data42 $data43 $data44 -print ===> rows5: $data50 $data51 $data52 $data53 $data54 -print ===> rows6: $data60 $data61 $data62 $data63 $data64 -print ===> rows7: $data70 $data71 $data72 $data73 $data74 -#if $rows != 8 then -# return -1 -#endi -#if $data00 != 2 then -# return -1 -#endi -#if $data70 != 1 then -# return -1 -#endi +if $rows != 3 then + return -1 +endi +if $data01 != 2 then + return -1 +endi +if $data04 != 2 then + return -1 +endi #================================================= print =============== stop and restart taosd From 1bf4b37591d22fa2014f69fec9da7c6f39330eb5 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Fri, 1 Apr 2022 11:19:21 +0800 Subject: [PATCH 45/47] feature/qnode --- source/libs/command/inc/commandInt.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/source/libs/command/inc/commandInt.h b/source/libs/command/inc/commandInt.h index cc3e1d8b55..771baca2ab 100644 --- a/source/libs/command/inc/commandInt.h +++ b/source/libs/command/inc/commandInt.h @@ -79,10 +79,14 @@ typedef struct SExplainCtx { #define INVERAL_TIME_FROM_PRECISION_TO_UNIT(_t, _u, _p) (((_u) == 'n' || (_u) == 'y') ? (_t) : (convertTimeFromPrecisionToUnit(_t, _p, _u))) -#define EXPLAIN_ROW_NEW(level, ...) \ - do { \ - tlen = snprintf(tbuf + VARSTR_HEADER_SIZE, TSDB_EXPLAIN_RESULT_ROW_SIZE, "%*s%s", (level) * 2, "", (isVerboseLine ? "" : "-> ")); \ - tlen += snprintf(tbuf + VARSTR_HEADER_SIZE + tlen, TSDB_EXPLAIN_RESULT_ROW_SIZE - tlen, __VA_ARGS__); \ +#define EXPLAIN_ROW_NEW(level, ...) \ + do { \ + if (isVerboseLine) { \ + tlen = snprintf(tbuf + VARSTR_HEADER_SIZE, TSDB_EXPLAIN_RESULT_ROW_SIZE, "%*s", (level) * 2 + 3, ""); \ + } else { \ + tlen = snprintf(tbuf + VARSTR_HEADER_SIZE, TSDB_EXPLAIN_RESULT_ROW_SIZE, "%*s%s", (level) * 2, "", "-> "); \ + } \ + tlen += snprintf(tbuf + VARSTR_HEADER_SIZE + tlen, TSDB_EXPLAIN_RESULT_ROW_SIZE - tlen, __VA_ARGS__); \ } while (0) #define EXPLAIN_ROW_APPEND(...) tlen += snprintf(tbuf + VARSTR_HEADER_SIZE + tlen, TSDB_EXPLAIN_RESULT_ROW_SIZE - tlen, __VA_ARGS__) From 7060fb793a63ded88413f5d4a753abef4757a892 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Thu, 31 Mar 2022 23:27:19 -0400 Subject: [PATCH 46/47] modify unit test since the unit of db/table option DAYS/KEEP changes --- source/dnode/mnode/impl/test/sma/sma.cpp | 8 ++++---- source/dnode/mnode/impl/test/topic/topic.cpp | 8 ++++---- source/dnode/mnode/impl/test/user/user.cpp | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/source/dnode/mnode/impl/test/sma/sma.cpp b/source/dnode/mnode/impl/test/sma/sma.cpp index 85f6a86183..4b0e33a323 100644 --- a/source/dnode/mnode/impl/test/sma/sma.cpp +++ b/source/dnode/mnode/impl/test/sma/sma.cpp @@ -42,10 +42,10 @@ void* MndTestSma::BuildCreateDbReq(const char* dbname, int32_t* pContLen) { createReq.numOfVgroups = 2; createReq.cacheBlockSize = 16; createReq.totalBlocks = 10; - createReq.daysPerFile = 10; - createReq.daysToKeep0 = 3650; - createReq.daysToKeep1 = 3650; - createReq.daysToKeep2 = 3650; + createReq.daysPerFile = 10 * 1440; + createReq.daysToKeep0 = 3650 * 1440; + createReq.daysToKeep1 = 3650 * 1440; + createReq.daysToKeep2 = 3650 * 1440; createReq.minRows = 100; createReq.maxRows = 4096; createReq.commitTime = 3600; diff --git a/source/dnode/mnode/impl/test/topic/topic.cpp b/source/dnode/mnode/impl/test/topic/topic.cpp index 73eefd875d..5d603ab5b2 100644 --- a/source/dnode/mnode/impl/test/topic/topic.cpp +++ b/source/dnode/mnode/impl/test/topic/topic.cpp @@ -35,10 +35,10 @@ void* MndTestTopic::BuildCreateDbReq(const char* dbname, int32_t* pContLen) { createReq.numOfVgroups = 2; createReq.cacheBlockSize = 16; createReq.totalBlocks = 10; - createReq.daysPerFile = 10; - createReq.daysToKeep0 = 3650; - createReq.daysToKeep1 = 3650; - createReq.daysToKeep2 = 3650; + createReq.daysPerFile = 10 * 1440; + createReq.daysToKeep0 = 3650 * 1440; + createReq.daysToKeep1 = 3650 * 1440; + createReq.daysToKeep2 = 3650 * 1440; createReq.minRows = 100; createReq.maxRows = 4096; createReq.commitTime = 3600; diff --git a/source/dnode/mnode/impl/test/user/user.cpp b/source/dnode/mnode/impl/test/user/user.cpp index 61b99beeb7..97a144fdee 100644 --- a/source/dnode/mnode/impl/test/user/user.cpp +++ b/source/dnode/mnode/impl/test/user/user.cpp @@ -324,10 +324,10 @@ TEST_F(MndTestUser, 03_Alter_User) { createReq.numOfVgroups = 2; createReq.cacheBlockSize = 16; createReq.totalBlocks = 10; - createReq.daysPerFile = 10; - createReq.daysToKeep0 = 3650; - createReq.daysToKeep1 = 3650; - createReq.daysToKeep2 = 3650; + createReq.daysPerFile = 10 * 1440; + createReq.daysToKeep0 = 3650 * 1440; + createReq.daysToKeep1 = 3650 * 1440; + createReq.daysToKeep2 = 3650 * 1440; createReq.minRows = 100; createReq.maxRows = 4096; createReq.commitTime = 3600; From 8eb99ef6d1a0297b3ca5f98cd6ce82c6c6486627 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 1 Apr 2022 11:57:35 +0800 Subject: [PATCH 47/47] shm --- include/os/osProc.h | 4 ++- source/dnode/mgmt/main/src/dndExec.c | 40 +++++++++++++++++++++------- source/os/src/osProc.c | 17 ++++++++---- 3 files changed, 46 insertions(+), 15 deletions(-) diff --git a/include/os/osProc.h b/include/os/osProc.h index 0b22105e5e..f09b695ef4 100644 --- a/include/os/osProc.h +++ b/include/os/osProc.h @@ -21,9 +21,11 @@ extern "C" { #endif int32_t taosNewProc(char **args); +void taosWaitProc(int32_t pid); +void taosKillProc(int32_t pid); +bool taosProcExist(int32_t pid); void taosSetProcName(int32_t argc, char **argv, const char *name); void taosSetProcPath(int32_t argc, char **argv); -bool taosProcExists(int32_t pid); #ifdef __cplusplus } diff --git a/source/dnode/mgmt/main/src/dndExec.c b/source/dnode/mgmt/main/src/dndExec.c index 82f54d4fc9..b37893aa6f 100644 --- a/source/dnode/mgmt/main/src/dndExec.c +++ b/source/dnode/mgmt/main/src/dndExec.c @@ -255,17 +255,39 @@ static int32_t dndRunInParentProcess(SDnode *pDnode) { while (1) { if (pDnode->event == DND_EVENT_STOP) { dInfo("dnode is about to stop"); + 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); + } + } + + for (ENodeType n = DNODE + 1; n < NODE_MAX; ++n) { + SMgmtWrapper *pWrapper = &pDnode->wrappers[n]; + if (!pWrapper->required) continue; + if (pDnode->ntype == NODE_MAX) continue; + + if (pWrapper->procId > 0 && taosProcExist(pWrapper->procId)) { + dInfo("node:%s, wait for child process:%d to stop", pWrapper->name, pWrapper->procId); + taosWaitProc(pWrapper->procId); + dInfo("node:%s, child process:%d is stopped", pWrapper->name, pWrapper->procId); + } + } break; - } + } else { + for (ENodeType n = DNODE + 1; n < NODE_MAX; ++n) { + SMgmtWrapper *pWrapper = &pDnode->wrappers[n]; + if (!pWrapper->required) continue; + if (pDnode->ntype == NODE_MAX) continue; - for (ENodeType n = DNODE + 1; n < NODE_MAX; ++n) { - SMgmtWrapper *pWrapper = &pDnode->wrappers[n]; - if (!pWrapper->required) continue; - if (pDnode->ntype == NODE_MAX) continue; - - if (pWrapper->procId <= 0 || !taosProcExists(pWrapper->procId)) { - dInfo("node:%s, process:%d is killed and needs to be restarted", pWrapper->name, pWrapper->procId); - dndNewProc(pWrapper, n); + if (pWrapper->procId <= 0 || !taosProcExist(pWrapper->procId)) { + dInfo("node:%s, process:%d is killed and needs to be restarted", pWrapper->name, pWrapper->procId); + dndNewProc(pWrapper, n); + } } } diff --git a/source/os/src/osProc.c b/source/os/src/osProc.c index 2d2174a4c8..6b52fa30be 100644 --- a/source/os/src/osProc.c +++ b/source/os/src/osProc.c @@ -32,6 +32,18 @@ int32_t taosNewProc(char **args) { } } +void taosWaitProc(int32_t pid) { + int32_t status = 0; + waitpid(pid, &status, 0); +} + +void taosKillProc(int32_t pid) { kill(pid, SIGINT); } + +bool taosProcExist(int32_t pid) { + int32_t p = getpgid(pid); + return p >= 0; +} + // the length of the new name must be less than the original name to take effect void taosSetProcName(int32_t argc, char **argv, const char *name) { prctl(PR_SET_NAME, name); @@ -48,8 +60,3 @@ void taosSetProcName(int32_t argc, char **argv, const char *name) { } void taosSetProcPath(int32_t argc, char **argv) { tsProcPath = argv[0]; } - -bool taosProcExists(int32_t pid) { - int32_t p = getpgid(pid); - return p >= 0; -}