From e048acfe76a734449b9141b40d5faa360d00a905 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Thu, 14 Apr 2022 12:36:35 +0000 Subject: [PATCH 01/37] refact vnode --- source/dnode/vnode/CMakeLists.txt | 2 +- source/dnode/vnode/inc/vnode.h | 3 ++- .../src/vnd/{vnodeMain.c => vnodeOpen.c} | 23 +++++++++++++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) rename source/dnode/vnode/src/vnd/{vnodeMain.c => vnodeOpen.c} (86%) diff --git a/source/dnode/vnode/CMakeLists.txt b/source/dnode/vnode/CMakeLists.txt index 3ab007e3a2..f7a3f2f109 100644 --- a/source/dnode/vnode/CMakeLists.txt +++ b/source/dnode/vnode/CMakeLists.txt @@ -10,7 +10,7 @@ target_sources( "src/vnd/vnodeCfg.c" "src/vnd/vnodeCommit.c" "src/vnd/vnodeInt.c" - "src/vnd/vnodeMain.c" + "src/vnd/vnodeOpen.c" "src/vnd/vnodeQuery.c" "src/vnd/vnodeStateMgr.c" "src/vnd/vnodeWrite.c" diff --git a/source/dnode/vnode/inc/vnode.h b/source/dnode/vnode/inc/vnode.h index 76fc09ca1d..0b23a42ec9 100644 --- a/source/dnode/vnode/inc/vnode.h +++ b/source/dnode/vnode/inc/vnode.h @@ -44,9 +44,10 @@ typedef struct SVnodeCfg SVnodeCfg; int vnodeInit(); void vnodeCleanup(); +int vnodeCreate(const char *path, SVnodeCfg *pCfg, STfs *pTfs); +void vnodeDestroy(const char *path); SVnode *vnodeOpen(const char *path, const SVnodeCfg *pVnodeCfg); void vnodeClose(SVnode *pVnode); -void vnodeDestroy(const char *path); void vnodePreprocessWriteReqs(SVnode *pVnode, SArray *pMsgs); int vnodeProcessWriteReq(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp); int vnodeProcessCMsg(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp); diff --git a/source/dnode/vnode/src/vnd/vnodeMain.c b/source/dnode/vnode/src/vnd/vnodeOpen.c similarity index 86% rename from source/dnode/vnode/src/vnd/vnodeMain.c rename to source/dnode/vnode/src/vnd/vnodeOpen.c index 2fd848a39d..f208857762 100644 --- a/source/dnode/vnode/src/vnd/vnodeMain.c +++ b/source/dnode/vnode/src/vnd/vnodeOpen.c @@ -20,6 +20,29 @@ static void vnodeFree(SVnode *pVnode); static int vnodeOpenImpl(SVnode *pVnode); static void vnodeCloseImpl(SVnode *pVnode); +int vnodeCreate(const char *path, SVnodeCfg *pCfg, STfs *pTfs) { +#if 0 + char dir[TSDB_FILENAME_LEN]; + // TODO: check if directory exists + + // check config + if (vnodeCheckCfg(pCfg) < 0) { + vError("vgId: %d failed to create vnode since: %s", pCfg->vgId, tstrerror(terrno)); + return -1; + } + + // create vnode env + tfsMkdir(pTfs, path); + snprintf(dir, TSDB_FILENAME_LEN, "%s%s%s", tfsGetPrimaryPath(pTfs), TD_DIRSEP, path); + if (vnodeSaveCfg(dir, pCfg) < 0) { + vError("vgId: %d failed to save vnode config since %s", pCfg->vgId, tstrerror(terrno)); + return -1; + } + +#endif + return 0; +} + SVnode *vnodeOpen(const char *path, const SVnodeCfg *pVnodeCfg) { SVnode *pVnode = NULL; From 2b6c03bc24e147a25c58a1e39f127e2419516497 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Thu, 14 Apr 2022 12:44:25 +0000 Subject: [PATCH 02/37] more --- source/dnode/vnode/inc/vnode.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/dnode/vnode/inc/vnode.h b/source/dnode/vnode/inc/vnode.h index 0b23a42ec9..25c6ffc1ad 100644 --- a/source/dnode/vnode/inc/vnode.h +++ b/source/dnode/vnode/inc/vnode.h @@ -42,7 +42,7 @@ typedef struct STsdbCfg STsdbCfg; // todo: remove typedef struct STqCfg STqCfg; // todo: remove typedef struct SVnodeCfg SVnodeCfg; -int vnodeInit(); +int vnodeInit(int nthreads); void vnodeCleanup(); int vnodeCreate(const char *path, SVnodeCfg *pCfg, STfs *pTfs); void vnodeDestroy(const char *path); From 46ec8300d9dcb668792d8bb1505916cd53bce7c5 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Thu, 14 Apr 2022 22:32:49 +0800 Subject: [PATCH 03/37] enh: add tag filter operator --- source/libs/executor/inc/executorimpl.h | 562 ++++++++++++----------- source/libs/executor/inc/indexoperator.h | 20 + source/libs/executor/src/indexoperator.c | 32 ++ 3 files changed, 350 insertions(+), 264 deletions(-) create mode 100644 source/libs/executor/inc/indexoperator.h create mode 100644 source/libs/executor/src/indexoperator.c diff --git a/source/libs/executor/inc/executorimpl.h b/source/libs/executor/inc/executorimpl.h index cbd2dc66f5..18989935b5 100644 --- a/source/libs/executor/inc/executorimpl.h +++ b/source/libs/executor/inc/executorimpl.h @@ -20,9 +20,9 @@ extern "C" { #endif #include "os.h" -#include "tsort.h" #include "tcommon.h" #include "tlosertree.h" +#include "tsort.h" #include "ttszip.h" #include "tvariant.h" @@ -35,15 +35,15 @@ extern "C" { #include "tarray.h" #include "thash.h" #include "tlockfree.h" -#include "tpagedbuf.h" #include "tmsg.h" +#include "tpagedbuf.h" struct SColumnFilterElem; typedef int32_t (*__block_search_fn_t)(char* data, int32_t num, int64_t key, int32_t order); -#define IS_QUERY_KILLED(_q) ((_q)->code == TSDB_CODE_TSC_QUERY_CANCELLED) -#define Q_STATUS_EQUAL(p, s) (((p) & (s)) != 0u) +#define IS_QUERY_KILLED(_q) ((_q)->code == TSDB_CODE_TSC_QUERY_CANCELLED) +#define Q_STATUS_EQUAL(p, s) (((p) & (s)) != 0u) #define QUERY_IS_ASC_QUERY(q) (GET_FORWARD_DIRECTION_FACTOR((q)->order.order) == QUERY_ASC_FORWARD_STEP) #define GET_TABLEGROUP(q, _index) ((SArray*)taosArrayGetP((q)->tableqinfoGroupInfo.pGroupList, (_index))) @@ -67,7 +67,7 @@ enum { }; typedef struct SResultRowCell { - uint64_t groupId; + uint64_t groupId; SResultRowPosition pos; } SResultRowCell; @@ -75,19 +75,19 @@ typedef struct SResultRowCell { * If the number of generated results is greater than this value, * query query will be halt and return results to client immediate. */ -typedef struct SResultInfo { // TODO refactor - int64_t totalRows; // total generated result size in rows - int64_t totalBytes; // total results in bytes. - int32_t capacity; // capacity of current result output buffer - int32_t threshold; // result size threshold in rows. +typedef struct SResultInfo { // TODO refactor + int64_t totalRows; // total generated result size in rows + int64_t totalBytes; // total results in bytes. + int32_t capacity; // capacity of current result output buffer + int32_t threshold; // result size threshold in rows. } SResultInfo; typedef struct STableQueryInfo { - TSKEY lastKey; // last check ts - uint64_t uid; // table uid - int32_t groupIndex; // group id in table list -// SVariant tag; - SResultRowInfo resInfo; // result info + TSKEY lastKey; // last check ts + uint64_t uid; // table uid + int32_t groupIndex; // group id in table list + // SVariant tag; + SResultRowInfo resInfo; // result info } STableQueryInfo; typedef enum { @@ -155,27 +155,27 @@ typedef struct SOperatorCostInfo { // The basic query information extracted from the SQueryInfo tree to support the // execution of query in a data node. typedef struct STaskAttr { - SLimit limit; - SLimit slimit; - bool stableQuery; // super table query or not - bool topBotQuery; // TODO used bitwise flag - bool groupbyColumn; // denote if this is a groupby normal column query - bool timeWindowInterpo; // if the time window start/end required interpolation - bool tsCompQuery; // is tscomp query - bool diffQuery; // is diff query - bool pointInterpQuery; // point interpolation query - int32_t havingNum; // having expr number - int16_t numOfCols; - int16_t numOfTags; - STimeWindow window; - SInterval interval; - int16_t precision; - int16_t numOfOutput; - int16_t fillType; - int32_t resultRowSize; - int32_t tagLen; // tag value length of current query + SLimit limit; + SLimit slimit; + bool stableQuery; // super table query or not + bool topBotQuery; // TODO used bitwise flag + bool groupbyColumn; // denote if this is a groupby normal column query + bool timeWindowInterpo; // if the time window start/end required interpolation + bool tsCompQuery; // is tscomp query + bool diffQuery; // is diff query + bool pointInterpQuery; // point interpolation query + int32_t havingNum; // having expr number + int16_t numOfCols; + int16_t numOfTags; + STimeWindow window; + SInterval interval; + int16_t precision; + int16_t numOfOutput; + int16_t fillType; + int32_t resultRowSize; + int32_t tagLen; // tag value length of current query - SExprInfo *pExpr1; + SExprInfo* pExpr1; SColumnInfo* tagColList; int32_t numOfFilterCols; int64_t* fillVal; @@ -188,13 +188,15 @@ struct SOperatorInfo; struct SAggSupporter; struct SOptrBasicInfo; -typedef void (*__optr_encode_fn_t)(struct SOperatorInfo* pOperator, struct SAggSupporter *pSup, struct SOptrBasicInfo *pInfo, char **result, int32_t *length); -typedef bool (*__optr_decode_fn_t)(struct SOperatorInfo* pOperator, struct SAggSupporter *pSup, struct SOptrBasicInfo *pInfo, char *result, int32_t length); +typedef void (*__optr_encode_fn_t)(struct SOperatorInfo* pOperator, struct SAggSupporter* pSup, + struct SOptrBasicInfo* pInfo, char** result, int32_t* length); +typedef bool (*__optr_decode_fn_t)(struct SOperatorInfo* pOperator, struct SAggSupporter* pSup, + struct SOptrBasicInfo* pInfo, char* result, int32_t length); typedef int32_t (*__optr_open_fn_t)(struct SOperatorInfo* pOptr); typedef SSDataBlock* (*__optr_fn_t)(struct SOperatorInfo* pOptr, bool* newgroup); typedef void (*__optr_close_fn_t)(void* param, int32_t num); -typedef int32_t (*__optr_get_explain_fn_t)(struct SOperatorInfo* pOptr, void **pOptrExplain); +typedef int32_t (*__optr_get_explain_fn_t)(struct SOperatorInfo* pOptr, void** pOptrExplain); typedef struct STaskIdInfo { uint64_t queryId; // this is also a request id @@ -204,49 +206,49 @@ typedef struct STaskIdInfo { } STaskIdInfo; typedef struct SExecTaskInfo { - STaskIdInfo id; - uint32_t status; - STimeWindow window; - STaskCostInfo cost; - int64_t owner; // if it is in execution - int32_t code; - uint64_t totalRows; // total number of rows - STableGroupInfo tableqinfoGroupInfo; // this is a group array list, including SArray structure - char* sql; // query sql string - jmp_buf env; // jump to this position when error happens. - EOPTR_EXEC_MODEL execModel; // operator execution model [batch model|stream model] + STaskIdInfo id; + uint32_t status; + STimeWindow window; + STaskCostInfo cost; + int64_t owner; // if it is in execution + int32_t code; + uint64_t totalRows; // total number of rows + STableGroupInfo tableqinfoGroupInfo; // this is a group array list, including SArray structure + char* sql; // query sql string + jmp_buf env; // jump to this position when error happens. + EOPTR_EXEC_MODEL execModel; // operator execution model [batch model|stream model] struct SOperatorInfo* pRoot; } SExecTaskInfo; typedef struct STaskRuntimeEnv { - jmp_buf env; - STaskAttr* pQueryAttr; - uint32_t status; // query status - void* qinfo; - uint8_t scanFlag; // denotes reversed scan of data or not - void* pTsdbReadHandle; + jmp_buf env; + STaskAttr* pQueryAttr; + uint32_t status; // query status + void* qinfo; + uint8_t scanFlag; // denotes reversed scan of data or not + void* pTsdbReadHandle; - int32_t prevGroupId; // previous executed group id - bool enableGroupData; - SDiskbasedBuf* pResultBuf; // query result buffer based on blocked-wised disk file - SHashObj* pResultRowHashTable; // quick locate the window object for each result - SHashObj* pResultRowListSet; // used to check if current ResultRowInfo has ResultRow object or not - SArray* pResultRowArrayList; // The array list that contains the Result rows - char* keyBuf; // window key buffer + int32_t prevGroupId; // previous executed group id + bool enableGroupData; + SDiskbasedBuf* pResultBuf; // query result buffer based on blocked-wised disk file + SHashObj* pResultRowHashTable; // quick locate the window object for each result + SHashObj* pResultRowListSet; // used to check if current ResultRowInfo has ResultRow object or not + SArray* pResultRowArrayList; // The array list that contains the Result rows + char* keyBuf; // window key buffer // The window result objects pool, all the resultRow Objects are allocated and managed by this object. - char** prevRow; - SArray* prevResult; // intermediate result, SArray - STSBuf* pTsBuf; // timestamp filter list - STSCursor cur; + char** prevRow; + SArray* prevResult; // intermediate result, SArray + STSBuf* pTsBuf; // timestamp filter list + STSCursor cur; - char* tagVal; // tag value of current data block + char* tagVal; // tag value of current data block struct SScalarFunctionSupport* scalarSup; SSDataBlock* outputBuf; STableGroupInfo tableqinfoGroupInfo; // this is a group array list, including SArray structure struct SOperatorInfo* proot; - SGroupResInfo groupResInfo; - int64_t currentOffset; // dynamic offset value + SGroupResInfo groupResInfo; + int64_t currentOffset; // dynamic offset value STableQueryInfo* current; SResultInfo resultInfo; @@ -255,10 +257,10 @@ typedef struct STaskRuntimeEnv { } STaskRuntimeEnv; enum { - OP_NOT_OPENED = 0x0, - OP_OPENED = 0x1, + OP_NOT_OPENED = 0x0, + OP_OPENED = 0x1, OP_RES_TO_RETURN = 0x5, - OP_EXEC_DONE = 0x9, + OP_EXEC_DONE = 0x9, }; typedef struct SOperatorInfo { @@ -269,7 +271,7 @@ typedef struct SOperatorInfo { char* name; // name, used to show the query execution plan void* info; // extension attribution SExprInfo* pExpr; - STaskRuntimeEnv* pRuntimeEnv; // todo remove it + STaskRuntimeEnv* pRuntimeEnv; // todo remove it SExecTaskInfo* pTaskInfo; SOperatorCostInfo cost; SResultInfo resultInfo; @@ -277,8 +279,8 @@ typedef struct SOperatorInfo { int32_t numOfDownstream; // number of downstream. The value is always ONE expect for join operator __optr_open_fn_t _openFn; // DO NOT invoke this function directly __optr_fn_t getNextFn; - __optr_fn_t getStreamResFn; // execute the aggregate in the stream model. - __optr_fn_t cleanupFn; // call this function to release the allocated resources ASAP + __optr_fn_t getStreamResFn; // execute the aggregate in the stream model. + __optr_fn_t cleanupFn; // call this function to release the allocated resources ASAP __optr_close_fn_t closeFn; __optr_encode_fn_t encodeResultRow; __optr_decode_fn_t decodeResultRow; @@ -293,33 +295,33 @@ typedef struct { typedef enum { EX_SOURCE_DATA_NOT_READY = 0x1, - EX_SOURCE_DATA_READY = 0x2, + EX_SOURCE_DATA_READY = 0x2, EX_SOURCE_DATA_EXHAUSTED = 0x3, } EX_SOURCE_STATUS; typedef struct SSourceDataInfo { - struct SExchangeInfo *pEx; + struct SExchangeInfo* pEx; int32_t index; - SRetrieveTableRsp *pRsp; + SRetrieveTableRsp* pRsp; uint64_t totalRows; int32_t code; EX_SOURCE_STATUS status; } SSourceDataInfo; typedef struct SLoadRemoteDataInfo { - uint64_t totalSize; // total load bytes from remote - uint64_t totalRows; // total number of rows - uint64_t totalElapsed; // total elapsed time + uint64_t totalSize; // total load bytes from remote + uint64_t totalRows; // total number of rows + uint64_t totalElapsed; // total elapsed time } SLoadRemoteDataInfo; typedef struct SExchangeInfo { - SArray* pSources; - SArray* pSourceDataInfo; - tsem_t ready; - void* pTransporter; - SSDataBlock* pResult; - bool seqLoadData; // sequential load data or not, false by default - int32_t current; + SArray* pSources; + SArray* pSourceDataInfo; + tsem_t ready; + void* pTransporter; + SSDataBlock* pResult; + bool seqLoadData; // sequential load data or not, false by default + int32_t current; SLoadRemoteDataInfo loadInfo; } SExchangeInfo; @@ -340,7 +342,7 @@ typedef struct STableScanInfo { int32_t current; int32_t reverseTimes; // 0 by default SNode* pFilterNode; // filter operator info - SqlFunctionCtx* pCtx; // next operator query context + SqlFunctionCtx* pCtx; // next operator query context SResultRowInfo* pResultRowInfo; int32_t* rowCellInfoOffset; SExprInfo* pExpr; @@ -349,7 +351,7 @@ typedef struct STableScanInfo { int32_t numOfOutput; int64_t elapsedTime; int32_t prevGroupId; // previous table group id - int32_t scanFlag; // table scan flag to denote if it is a repeat/reverse/main scan + int32_t scanFlag; // table scan flag to denote if it is a repeat/reverse/main scan } STableScanInfo; typedef struct STagScanInfo { @@ -360,15 +362,15 @@ typedef struct STagScanInfo { } STagScanInfo; typedef struct SStreamBlockScanInfo { - SArray* pBlockLists; // multiple SSDatablock. - SSDataBlock* pRes; // result SSDataBlock - int32_t blockType; // current block type - int32_t validBlockIndex; // Is current data has returned? - SColumnInfo* pCols; // the output column info - uint64_t numOfRows; // total scanned rows - uint64_t numOfExec; // execution times - void* readerHandle; // stream block reader handle - SArray* pColMatchInfo; // + SArray* pBlockLists; // multiple SSDatablock. + SSDataBlock* pRes; // result SSDataBlock + int32_t blockType; // current block type + int32_t validBlockIndex; // Is current data has returned? + SColumnInfo* pCols; // the output column info + uint64_t numOfRows; // total scanned rows + uint64_t numOfExec; // execution times + void* readerHandle; // stream block reader handle + SArray* pColMatchInfo; // } SStreamBlockScanInfo; typedef struct SSysTableScanInfo { @@ -377,83 +379,83 @@ typedef struct SSysTableScanInfo { void* readHandle; }; - SRetrieveMetaTableRsp *pRsp; - SRetrieveTableReq req; - SEpSet epSet; - tsem_t ready; + SRetrieveMetaTableRsp* pRsp; + SRetrieveTableReq req; + SEpSet epSet; + tsem_t ready; - int32_t accountId; - bool showRewrite; - SNode *pCondition; // db_name filter condition, to discard data that are not in current database - void *pCur; // cursor for iterate the local table meta store. - SArray *scanCols; // SArray scan column id list + int32_t accountId; + bool showRewrite; + SNode* pCondition; // db_name filter condition, to discard data that are not in current database + void* pCur; // cursor for iterate the local table meta store. + SArray* scanCols; // SArray scan column id list - int32_t type; // show type, TODO remove it + int32_t type; // show type, TODO remove it SName name; - SSDataBlock *pRes; + SSDataBlock* pRes; int32_t capacity; int64_t numOfBlocks; // extract basic running information. SLoadRemoteDataInfo loadInfo; } SSysTableScanInfo; typedef struct SOptrBasicInfo { - SResultRowInfo resultRowInfo; - int32_t* rowCellInfoOffset; // offset value for each row result cell info - SqlFunctionCtx* pCtx; - SSDataBlock* pRes; - int32_t capacity; // TODO remove it + SResultRowInfo resultRowInfo; + int32_t* rowCellInfoOffset; // offset value for each row result cell info + SqlFunctionCtx* pCtx; + SSDataBlock* pRes; + int32_t capacity; // TODO remove it } SOptrBasicInfo; -//TODO move the resultrowsiz together with SOptrBasicInfo:rowCellInfoOffset +// TODO move the resultrowsiz together with SOptrBasicInfo:rowCellInfoOffset typedef struct SAggSupporter { - SHashObj* pResultRowHashTable; // quick locate the window object for each result - SHashObj* pResultRowListSet; // used to check if current ResultRowInfo has ResultRow object or not - SArray* pResultRowArrayList; // The array list that contains the Result rows - char* keyBuf; // window key buffer - SDiskbasedBuf *pResultBuf; // query result buffer based on blocked-wised disk file - int32_t resultRowSize; // the result buffer size for each result row, with the meta data size for each row + SHashObj* pResultRowHashTable; // quick locate the window object for each result + SHashObj* pResultRowListSet; // used to check if current ResultRowInfo has ResultRow object or not + SArray* pResultRowArrayList; // The array list that contains the Result rows + char* keyBuf; // window key buffer + SDiskbasedBuf* pResultBuf; // query result buffer based on blocked-wised disk file + int32_t resultRowSize; // the result buffer size for each result row, with the meta data size for each row } SAggSupporter; typedef struct STableIntervalOperatorInfo { - SOptrBasicInfo binfo; // basic info - SGroupResInfo groupResInfo; // multiple results build supporter - SInterval interval; // interval info - int32_t primaryTsIndex; // primary time stamp slot id from result of downstream operator. - STimeWindow win; // query time range - bool timeWindowInterpo; // interpolation needed or not - char **pRow; // previous row/tuple of already processed datablock - SAggSupporter aggSup; // aggregate supporter - STableQueryInfo *pCurrent; // current tableQueryInfo struct - int32_t order; // current SSDataBlock scan order - EOPTR_EXEC_MODEL execModel; // operator execution model [batch model|stream model] - SArray *pUpdatedWindow; // updated time window due to the input data block from the downstream operator. - SColumnInfoData timeWindowData; // query time window info for scalar function execution. + SOptrBasicInfo binfo; // basic info + SGroupResInfo groupResInfo; // multiple results build supporter + SInterval interval; // interval info + int32_t primaryTsIndex; // primary time stamp slot id from result of downstream operator. + STimeWindow win; // query time range + bool timeWindowInterpo; // interpolation needed or not + char** pRow; // previous row/tuple of already processed datablock + SAggSupporter aggSup; // aggregate supporter + STableQueryInfo* pCurrent; // current tableQueryInfo struct + int32_t order; // current SSDataBlock scan order + EOPTR_EXEC_MODEL execModel; // operator execution model [batch model|stream model] + SArray* pUpdatedWindow; // updated time window due to the input data block from the downstream operator. + SColumnInfoData timeWindowData; // query time window info for scalar function execution. } STableIntervalOperatorInfo; typedef struct SAggOperatorInfo { - SOptrBasicInfo binfo; - SDiskbasedBuf *pResultBuf; // query result buffer based on blocked-wised disk file - SAggSupporter aggSup; - STableQueryInfo *current; - uint32_t groupId; - SGroupResInfo groupResInfo; - STableQueryInfo *pTableQueryInfo; + SOptrBasicInfo binfo; + SDiskbasedBuf* pResultBuf; // query result buffer based on blocked-wised disk file + SAggSupporter aggSup; + STableQueryInfo* current; + uint32_t groupId; + SGroupResInfo groupResInfo; + STableQueryInfo* pTableQueryInfo; } SAggOperatorInfo; typedef struct SProjectOperatorInfo { SOptrBasicInfo binfo; SAggSupporter aggSup; - SSDataBlock *existDataBlock; - SArray *pPseudoColInfo; + SSDataBlock* existDataBlock; + SArray* pPseudoColInfo; SLimit limit; SLimit slimit; - uint64_t groupId; - int64_t curSOffset; - int64_t curGroupOutput; + uint64_t groupId; + int64_t curSOffset; + int64_t curGroupOutput; - int64_t curOffset; - int64_t curOutput; + int64_t curOffset; + int64_t curOutput; } SProjectOperatorInfo; typedef struct SFillOperatorInfo { @@ -468,165 +470,192 @@ typedef struct SFillOperatorInfo { } SFillOperatorInfo; typedef struct { - char *pData; - bool isNull; - int16_t type; - int32_t bytes; + char* pData; + bool isNull; + int16_t type; + int32_t bytes; } SGroupKeys, SStateKeys; typedef struct SGroupbyOperatorInfo { - SOptrBasicInfo binfo; - SArray* pGroupCols; - SArray* pGroupColVals; // current group column values, SArray - SNode* pCondition; - bool isInit; // denote if current val is initialized or not - char* keyBuf; // group by keys for hash - int32_t groupKeyLen; // total group by column width - SGroupResInfo groupResInfo; - SAggSupporter aggSup; - SExprInfo* pScalarExprInfo; - int32_t numOfScalarExpr;// the number of scalar expression in group operator - SqlFunctionCtx*pScalarFuncCtx; + SOptrBasicInfo binfo; + SArray* pGroupCols; + SArray* pGroupColVals; // current group column values, SArray + SNode* pCondition; + bool isInit; // denote if current val is initialized or not + char* keyBuf; // group by keys for hash + int32_t groupKeyLen; // total group by column width + SGroupResInfo groupResInfo; + SAggSupporter aggSup; + SExprInfo* pScalarExprInfo; + int32_t numOfScalarExpr; // the number of scalar expression in group operator + SqlFunctionCtx* pScalarFuncCtx; } SGroupbyOperatorInfo; typedef struct SDataGroupInfo { uint64_t groupId; int64_t numOfRows; - SArray *pPageList; + SArray* pPageList; } SDataGroupInfo; // The sort in partition may be needed later. typedef struct SPartitionOperatorInfo { - SOptrBasicInfo binfo; - SArray* pGroupCols; - SArray* pGroupColVals; // current group column values, SArray - char* keyBuf; // group by keys for hash - int32_t groupKeyLen; // total group by column width - SHashObj* pGroupSet; // quick locate the window object for each result + SOptrBasicInfo binfo; + SArray* pGroupCols; + SArray* pGroupColVals; // current group column values, SArray + char* keyBuf; // group by keys for hash + int32_t groupKeyLen; // total group by column width + SHashObj* pGroupSet; // quick locate the window object for each result - SDiskbasedBuf* pBuf; // query result buffer based on blocked-wised disk file - int32_t rowCapacity; // maximum number of rows for each buffer page - int32_t* columnOffset; // start position for each column data + SDiskbasedBuf* pBuf; // query result buffer based on blocked-wised disk file + int32_t rowCapacity; // maximum number of rows for each buffer page + int32_t* columnOffset; // start position for each column data - void* pGroupIter; // group iterator - int32_t pageIndex; // page index of current group + void* pGroupIter; // group iterator + int32_t pageIndex; // page index of current group } SPartitionOperatorInfo; typedef struct SWindowRowsSup { - STimeWindow win; - TSKEY prevTs; - int32_t startRowIndex; - int32_t numOfRows; + STimeWindow win; + TSKEY prevTs; + int32_t startRowIndex; + int32_t numOfRows; } SWindowRowsSup; typedef struct SSessionAggOperatorInfo { - SOptrBasicInfo binfo; - SAggSupporter aggSup; - SGroupResInfo groupResInfo; - SWindowRowsSup winSup; - bool reptScan; // next round scan - int64_t gap; // session window gap - SColumnInfoData timeWindowData; // query time window info for scalar function execution. + SOptrBasicInfo binfo; + SAggSupporter aggSup; + SGroupResInfo groupResInfo; + SWindowRowsSup winSup; + bool reptScan; // next round scan + int64_t gap; // session window gap + SColumnInfoData timeWindowData; // query time window info for scalar function execution. } SSessionAggOperatorInfo; typedef struct STimeSliceOperatorInfo { - SOptrBasicInfo binfo; - SInterval interval; - SGroupResInfo groupResInfo; // multiple results build supporter + SOptrBasicInfo binfo; + SInterval interval; + SGroupResInfo groupResInfo; // multiple results build supporter } STimeSliceOperatorInfo; typedef struct SStateWindowOperatorInfo { - SOptrBasicInfo binfo; - SAggSupporter aggSup; - SGroupResInfo groupResInfo; - SWindowRowsSup winSup; - int32_t colIndex; // start row index - bool hasKey; - SStateKeys stateKey; - SColumnInfoData timeWindowData; // query time window info for scalar function execution. -// bool reptScan; + SOptrBasicInfo binfo; + SAggSupporter aggSup; + SGroupResInfo groupResInfo; + SWindowRowsSup winSup; + int32_t colIndex; // start row index + bool hasKey; + SStateKeys stateKey; + SColumnInfoData timeWindowData; // query time window info for scalar function execution. + // bool reptScan; } SStateWindowOperatorInfo; typedef struct SSortedMergeOperatorInfo { - SOptrBasicInfo binfo; - bool hasVarCol; - - SArray* pSortInfo; - int32_t numOfSources; - SSortHandle *pSortHandle; - int32_t bufPageSize; - uint32_t sortBufSize; // max buffer size for in-memory sort - int32_t resultRowFactor; - bool hasGroupVal; - SDiskbasedBuf *pTupleStore; // keep the final results - int32_t numOfResPerPage; - char** groupVal; - SArray *groupInfo; - SAggSupporter aggSup; + SOptrBasicInfo binfo; + bool hasVarCol; + + SArray* pSortInfo; + int32_t numOfSources; + SSortHandle* pSortHandle; + int32_t bufPageSize; + uint32_t sortBufSize; // max buffer size for in-memory sort + int32_t resultRowFactor; + bool hasGroupVal; + SDiskbasedBuf* pTupleStore; // keep the final results + int32_t numOfResPerPage; + char** groupVal; + SArray* groupInfo; + SAggSupporter aggSup; } SSortedMergeOperatorInfo; typedef struct SSortOperatorInfo { - uint32_t sortBufSize; // max buffer size for in-memory sort - SSDataBlock *pDataBlock; - SArray* pSortInfo; - SSortHandle *pSortHandle; - SArray* inputSlotMap; // for index map from table scan output - int32_t bufPageSize; - int32_t numOfRowsInRes; + uint32_t sortBufSize; // max buffer size for in-memory sort + SSDataBlock* pDataBlock; + SArray* pSortInfo; + SSortHandle* pSortHandle; + SArray* inputSlotMap; // for index map from table scan output + int32_t bufPageSize; + int32_t numOfRowsInRes; // TODO extact struct - int64_t startTs; // sort start time - uint64_t sortElapsed; // sort elapsed time, time to flush to disk not included. - uint64_t totalSize; // total load bytes from remote - uint64_t totalRows; // total number of rows - uint64_t totalElapsed; // total elapsed time + int64_t startTs; // sort start time + uint64_t sortElapsed; // sort elapsed time, time to flush to disk not included. + uint64_t totalSize; // total load bytes from remote + uint64_t totalRows; // total number of rows + uint64_t totalElapsed; // total elapsed time } SSortOperatorInfo; +typedef struct STagFilterOperatorInfo { + SOptrBasicInfo binfo; +} STagFilterOperatorInfo; + int32_t operatorDummyOpenFn(SOperatorInfo* pOperator); -void operatorDummyCloseFn(void* param, int32_t numOfCols); +void operatorDummyCloseFn(void* param, int32_t numOfCols); int32_t appendDownstream(SOperatorInfo* p, SOperatorInfo** pDownstream, int32_t num); int32_t initAggInfo(SOptrBasicInfo* pBasicInfo, SAggSupporter* pAggSup, SExprInfo* pExprInfo, int32_t numOfCols, int32_t numOfRows, SSDataBlock* pResultBlock, size_t keyBufSize, const char* pkey); -void toSDatablock(SSDataBlock* pBlock, int32_t rowCapacity, SGroupResInfo* pGroupResInfo, SExprInfo* pExprInfo, SDiskbasedBuf* pBuf, int32_t* rowCellOffset); -void finalizeMultiTupleQueryResult(SqlFunctionCtx* pCtx, int32_t numOfOutput, SDiskbasedBuf* pBuf, SResultRowInfo* pResultRowInfo, int32_t* rowCellInfoOffset); -void doApplyFunctions(SqlFunctionCtx* pCtx, STimeWindow* pWin, SColumnInfoData* pTimeWindowData, int32_t offset, int32_t forwardStep, TSKEY* tsCol, int32_t numOfTotal, int32_t numOfOutput, int32_t order); -int32_t setGroupResultOutputBuf(SOptrBasicInfo* binfo, int32_t numOfCols, char* pData, int16_t type, int16_t bytes, int32_t groupId, SDiskbasedBuf* pBuf, SExecTaskInfo* pTaskInfo, SAggSupporter* pAggSup); -void doDestroyBasicInfo(SOptrBasicInfo* pInfo, int32_t numOfOutput); -int32_t setSDataBlockFromFetchRsp(SSDataBlock* pRes, SLoadRemoteDataInfo* pLoadInfo, int32_t numOfRows, - char* pData, int32_t compLen, int32_t numOfOutput, int64_t startTs, - uint64_t* total, SArray* pColList); -void doSetOperatorCompleted(SOperatorInfo* pOperator); -void doFilter(const SNode* pFilterNode, SSDataBlock* pBlock); +void toSDatablock(SSDataBlock* pBlock, int32_t rowCapacity, SGroupResInfo* pGroupResInfo, SExprInfo* pExprInfo, + SDiskbasedBuf* pBuf, int32_t* rowCellOffset); +void finalizeMultiTupleQueryResult(SqlFunctionCtx* pCtx, int32_t numOfOutput, SDiskbasedBuf* pBuf, + SResultRowInfo* pResultRowInfo, int32_t* rowCellInfoOffset); +void doApplyFunctions(SqlFunctionCtx* pCtx, STimeWindow* pWin, SColumnInfoData* pTimeWindowData, int32_t offset, + int32_t forwardStep, TSKEY* tsCol, int32_t numOfTotal, int32_t numOfOutput, int32_t order); +int32_t setGroupResultOutputBuf(SOptrBasicInfo* binfo, int32_t numOfCols, char* pData, int16_t type, int16_t bytes, + int32_t groupId, SDiskbasedBuf* pBuf, SExecTaskInfo* pTaskInfo, SAggSupporter* pAggSup); +void doDestroyBasicInfo(SOptrBasicInfo* pInfo, int32_t numOfOutput); +int32_t setSDataBlockFromFetchRsp(SSDataBlock* pRes, SLoadRemoteDataInfo* pLoadInfo, int32_t numOfRows, char* pData, + int32_t compLen, int32_t numOfOutput, int64_t startTs, uint64_t* total, + SArray* pColList); +void doSetOperatorCompleted(SOperatorInfo* pOperator); +void doFilter(const SNode* pFilterNode, SSDataBlock* pBlock); SqlFunctionCtx* createSqlFunctionCtx(SExprInfo* pExprInfo, int32_t numOfOutput, int32_t** rowCellInfoOffset); SOperatorInfo* createExchangeOperatorInfo(const SNodeList* pSources, SSDataBlock* pBlock, SExecTaskInfo* pTaskInfo); SOperatorInfo* createTableScanOperatorInfo(void* pTsdbReadHandle, int32_t order, int32_t numOfCols, int32_t repeatTime, - int32_t reverseTime, SArray* pColMatchInfo, SSDataBlock* pResBlock, SNode* pCondition, SExecTaskInfo* pTaskInfo); -SOperatorInfo* createAggregateOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExprInfo, int32_t numOfCols, SSDataBlock* pResultBlock, - SExecTaskInfo* pTaskInfo, const STableGroupInfo* pTableGroupInfo); -SOperatorInfo* createMultiTableAggOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExprInfo, int32_t numOfCols, SSDataBlock* pResBlock, SExecTaskInfo* pTaskInfo, const STableGroupInfo* pTableGroupInfo); + int32_t reverseTime, SArray* pColMatchInfo, SSDataBlock* pResBlock, + SNode* pCondition, SExecTaskInfo* pTaskInfo); +SOperatorInfo* createAggregateOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExprInfo, int32_t numOfCols, + SSDataBlock* pResultBlock, SExecTaskInfo* pTaskInfo, + const STableGroupInfo* pTableGroupInfo); +SOperatorInfo* createMultiTableAggOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExprInfo, int32_t numOfCols, + SSDataBlock* pResBlock, SExecTaskInfo* pTaskInfo, + const STableGroupInfo* pTableGroupInfo); -SOperatorInfo* createProjectOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExprInfo, int32_t num, SSDataBlock* pResBlock, SLimit* pLimit, SLimit* pSlimit, SExecTaskInfo* pTaskInfo); -SOperatorInfo *createSortOperatorInfo(SOperatorInfo* downstream, SSDataBlock* pResBlock, SArray* pSortInfo, SArray* pIndexMap, SExecTaskInfo* pTaskInfo); +SOperatorInfo* createProjectOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExprInfo, int32_t num, + SSDataBlock* pResBlock, SLimit* pLimit, SLimit* pSlimit, + SExecTaskInfo* pTaskInfo); +SOperatorInfo* createSortOperatorInfo(SOperatorInfo* downstream, SSDataBlock* pResBlock, SArray* pSortInfo, + SArray* pIndexMap, SExecTaskInfo* pTaskInfo); -SOperatorInfo* createSortedMergeOperatorInfo(SOperatorInfo** downstream, int32_t numOfDownstream, SExprInfo* pExprInfo, int32_t num, SArray* pSortInfo, SArray* pGroupInfo, SExecTaskInfo* pTaskInfo); +SOperatorInfo* createSortedMergeOperatorInfo(SOperatorInfo** downstream, int32_t numOfDownstream, SExprInfo* pExprInfo, + int32_t num, SArray* pSortInfo, SArray* pGroupInfo, + SExecTaskInfo* pTaskInfo); SOperatorInfo* createSysTableScanOperatorInfo(void* pSysTableReadHandle, SSDataBlock* pResBlock, const SName* pName, - SNode* pCondition, SEpSet epset, SArray* colList, SExecTaskInfo* pTaskInfo, bool showRewrite, int32_t accountId); -SOperatorInfo* createIntervalOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExprInfo, int32_t numOfCols, SSDataBlock* pResBlock, SInterval* pInterval, int32_t primaryTsSlot, + SNode* pCondition, SEpSet epset, SArray* colList, + SExecTaskInfo* pTaskInfo, bool showRewrite, int32_t accountId); +SOperatorInfo* createIntervalOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExprInfo, int32_t numOfCols, + SSDataBlock* pResBlock, SInterval* pInterval, int32_t primaryTsSlot, const STableGroupInfo* pTableGroupInfo, SExecTaskInfo* pTaskInfo); -SOperatorInfo* createSessionAggOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExprInfo, int32_t numOfCols, SSDataBlock* pResBlock, int64_t gap, SExecTaskInfo* pTaskInfo); -SOperatorInfo* createGroupOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExprInfo, int32_t numOfCols, SSDataBlock* pResultBlock, SArray* pGroupColList, - SNode* pCondition, SExprInfo* pScalarExprInfo, int32_t numOfScalarExpr, SExecTaskInfo* pTaskInfo, const STableGroupInfo* pTableGroupInfo); +SOperatorInfo* createSessionAggOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExprInfo, int32_t numOfCols, + SSDataBlock* pResBlock, int64_t gap, SExecTaskInfo* pTaskInfo); +SOperatorInfo* createGroupOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExprInfo, int32_t numOfCols, + SSDataBlock* pResultBlock, SArray* pGroupColList, SNode* pCondition, + SExprInfo* pScalarExprInfo, int32_t numOfScalarExpr, SExecTaskInfo* pTaskInfo, + const STableGroupInfo* pTableGroupInfo); SOperatorInfo* createDataBlockInfoScanOperator(void* dataReader, SExecTaskInfo* pTaskInfo); -SOperatorInfo* createStreamScanOperatorInfo(void* streamReadHandle, SSDataBlock* pResBlock, SArray* pColList, SArray* pTableIdList, SExecTaskInfo* pTaskInfo); +SOperatorInfo* createStreamScanOperatorInfo(void* streamReadHandle, SSDataBlock* pResBlock, SArray* pColList, + SArray* pTableIdList, SExecTaskInfo* pTaskInfo); -SOperatorInfo* createFillOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExpr, int32_t numOfCols, SInterval* pInterval, SSDataBlock* pResBlock, - int32_t fillType, char* fillVal, bool multigroupResult, SExecTaskInfo* pTaskInfo); -SOperatorInfo* createStatewindowOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExpr, int32_t numOfCols, SSDataBlock* pResBlock, SExecTaskInfo* pTaskInfo); +SOperatorInfo* createFillOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExpr, int32_t numOfCols, + SInterval* pInterval, SSDataBlock* pResBlock, int32_t fillType, char* fillVal, + bool multigroupResult, SExecTaskInfo* pTaskInfo); +SOperatorInfo* createStatewindowOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExpr, int32_t numOfCols, + SSDataBlock* pResBlock, SExecTaskInfo* pTaskInfo); -SOperatorInfo* createPartitionOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExprInfo, int32_t numOfCols, SSDataBlock* pResultBlock, SArray* pGroupColList, - SExecTaskInfo* pTaskInfo, const STableGroupInfo* pTableGroupInfo); -SOperatorInfo* createTimeSliceOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExprInfo, int32_t numOfCols, SSDataBlock* pResultBlock, SExecTaskInfo* pTaskInfo); +SOperatorInfo* createPartitionOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExprInfo, int32_t numOfCols, + SSDataBlock* pResultBlock, SArray* pGroupColList, SExecTaskInfo* pTaskInfo, + const STableGroupInfo* pTableGroupInfo); +SOperatorInfo* createTimeSliceOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExprInfo, int32_t numOfCols, + SSDataBlock* pResultBlock, SExecTaskInfo* pTaskInfo); #if 0 SOperatorInfo* createTableSeqScanOperatorInfo(void* pTsdbReadHandle, STaskRuntimeEnv* pRuntimeEnv); @@ -640,7 +669,8 @@ SOperatorInfo* createJoinOperatorInfo(SOperatorInfo** pdownstream, int32_t numOf int32_t numOfOutput); #endif -void projectApplyFunctions(SExprInfo* pExpr, SSDataBlock* pResult, SSDataBlock* pSrcBlock, SqlFunctionCtx* pCtx, int32_t numOfOutput, SArray* pPseudoList); +void projectApplyFunctions(SExprInfo* pExpr, SSDataBlock* pResult, SSDataBlock* pSrcBlock, SqlFunctionCtx* pCtx, + int32_t numOfOutput, SArray* pPseudoList); void setInputDataBlock(SOperatorInfo* pOperator, SqlFunctionCtx* pCtx, SSDataBlock* pBlock, int32_t order); @@ -652,23 +682,27 @@ STableQueryInfo* createTableQueryInfo(void* buf, bool groupbyColumn, STimeWindow bool isTaskKilled(SExecTaskInfo* pTaskInfo); int32_t checkForQueryBuf(size_t numOfTables); -void setTaskKilled(SExecTaskInfo* pTaskInfo); +void setTaskKilled(SExecTaskInfo* pTaskInfo); void publishOperatorProfEvent(SOperatorInfo* operatorInfo, EQueryProfEventType eventType); void publishQueryAbortEvent(SExecTaskInfo* pTaskInfo, int32_t code); void queryCostStatis(SExecTaskInfo* pTaskInfo); -void doDestroyTask(SExecTaskInfo* pTaskInfo); +void doDestroyTask(SExecTaskInfo* pTaskInfo); int32_t getMaximumIdleDurationSec(); void doInvokeUdf(struct SUdfInfo* pUdfInfo, SqlFunctionCtx* pCtx, int32_t idx, int32_t type); void setTaskStatus(SExecTaskInfo* pTaskInfo, int8_t status); -int32_t createExecTaskInfoImpl(SSubplan* pPlan, SExecTaskInfo** pTaskInfo, SReadHandle* pHandle, uint64_t taskId, EOPTR_EXEC_MODEL model); -int32_t getOperatorExplainExecInfo(SOperatorInfo *operatorInfo, SExplainExecInfo **pRes, int32_t *capacity, int32_t *resNum); +int32_t createExecTaskInfoImpl(SSubplan* pPlan, SExecTaskInfo** pTaskInfo, SReadHandle* pHandle, uint64_t taskId, + EOPTR_EXEC_MODEL model); +int32_t getOperatorExplainExecInfo(SOperatorInfo* operatorInfo, SExplainExecInfo** pRes, int32_t* capacity, + int32_t* resNum); -bool aggDecodeResultRow(SOperatorInfo* pOperator, SAggSupporter *pSup, SOptrBasicInfo *pInfo, char* result, int32_t length); -void aggEncodeResultRow(SOperatorInfo* pOperator, SAggSupporter *pSup, SOptrBasicInfo *pInfo, char **result, int32_t *length); +bool aggDecodeResultRow(SOperatorInfo* pOperator, SAggSupporter* pSup, SOptrBasicInfo* pInfo, char* result, + int32_t length); +void aggEncodeResultRow(SOperatorInfo* pOperator, SAggSupporter* pSup, SOptrBasicInfo* pInfo, char** result, + int32_t* length); #ifdef __cplusplus } diff --git a/source/libs/executor/inc/indexoperator.h b/source/libs/executor/inc/indexoperator.h new file mode 100644 index 0000000000..3113945c13 --- /dev/null +++ b/source/libs/executor/inc/indexoperator.h @@ -0,0 +1,20 @@ +/* + * 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 "filter.h" +#include "tglobal.h" + +// construct tag filter operator later +int32_t doFilterTag(const SNode *pFilterNode, SArray *resutl); diff --git a/source/libs/executor/src/indexoperator.c b/source/libs/executor/src/indexoperator.c new file mode 100644 index 0000000000..b733ecdc6b --- /dev/null +++ b/source/libs/executor/src/indexoperator.c @@ -0,0 +1,32 @@ +/* + * 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 "indexoperator.h" +#include "executorimpl.h" +// construct tag filter operator later +static void destroyTagFilterOperatorInfo(void *param) { + STagFilterOperatorInfo *pInfo = (STagFilterOperatorInfo *)param; +} +int32_t doFilterTag(const SNode *pFilterNode, SArray *resutl) { + if (pFilterNode == NULL) { + return TSDB_CODE_SUCCESS; + } + + SFilterInfo *filter = NULL; + + // todo move to the initialization function + int32_t code = filterInitFromNode((SNode *)pFilterNode, &filter, 0); + return code; +} From 3b9e9772d013e4260efa5fecf1cc7f90c2940169 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 15 Apr 2022 10:12:29 +0800 Subject: [PATCH 04/37] test: reopen dbTest --- .../dnode/mnode/impl/test/db/CMakeLists.txt | 8 +- source/dnode/mnode/impl/test/db/db.cpp | 143 +++--------------- 2 files changed, 27 insertions(+), 124 deletions(-) diff --git a/source/dnode/mnode/impl/test/db/CMakeLists.txt b/source/dnode/mnode/impl/test/db/CMakeLists.txt index 1a5b4d3936..3f6a80835f 100644 --- a/source/dnode/mnode/impl/test/db/CMakeLists.txt +++ b/source/dnode/mnode/impl/test/db/CMakeLists.txt @@ -5,7 +5,7 @@ target_link_libraries( PUBLIC sut ) -#add_test( -# NAME mnode_test_db -# COMMAND mnode_test_db -#) +add_test( + NAME dbTest + COMMAND dbTest +) diff --git a/source/dnode/mnode/impl/test/db/db.cpp b/source/dnode/mnode/impl/test/db/db.cpp index 0282663b17..adba6ca434 100644 --- a/source/dnode/mnode/impl/test/db/db.cpp +++ b/source/dnode/mnode/impl/test/db/db.cpp @@ -26,29 +26,8 @@ class MndTestDb : public ::testing::Test { Testbase MndTestDb::test; TEST_F(MndTestDb, 01_ShowDb) { - test.SendShowMetaReq(TSDB_MGMT_TABLE_DB, ""); - CHECK_META("show databases", 17); - CHECK_SCHEMA(0, TSDB_DATA_TYPE_BINARY, TSDB_DB_NAME_LEN - 1 + VARSTR_HEADER_SIZE, "name"); - CHECK_SCHEMA(1, TSDB_DATA_TYPE_TIMESTAMP, 8, "create_time"); - CHECK_SCHEMA(2, TSDB_DATA_TYPE_SMALLINT, 2, "vgroups"); - CHECK_SCHEMA(3, TSDB_DATA_TYPE_INT, 4, "ntables"); - CHECK_SCHEMA(4, TSDB_DATA_TYPE_SMALLINT, 2, "replica"); - CHECK_SCHEMA(5, TSDB_DATA_TYPE_SMALLINT, 2, "quorum"); - CHECK_SCHEMA(6, TSDB_DATA_TYPE_SMALLINT, 2, "days"); - CHECK_SCHEMA(7, TSDB_DATA_TYPE_BINARY, 24 + VARSTR_HEADER_SIZE, "keep0,keep1,keep2"); - CHECK_SCHEMA(8, TSDB_DATA_TYPE_INT, 4, "cache"); - CHECK_SCHEMA(9, TSDB_DATA_TYPE_INT, 4, "blocks"); - CHECK_SCHEMA(10, TSDB_DATA_TYPE_INT, 4, "minrows"); - CHECK_SCHEMA(11, TSDB_DATA_TYPE_INT, 4, "maxrows"); - CHECK_SCHEMA(12, TSDB_DATA_TYPE_TINYINT, 1, "wallevel"); - CHECK_SCHEMA(13, TSDB_DATA_TYPE_INT, 4, "fsync"); - CHECK_SCHEMA(14, TSDB_DATA_TYPE_TINYINT, 1, "comp"); - CHECK_SCHEMA(15, TSDB_DATA_TYPE_TINYINT, 1, "cachelast"); - CHECK_SCHEMA(16, TSDB_DATA_TYPE_BINARY, 3 + VARSTR_HEADER_SIZE, "precision"); -// CHECK_SCHEMA(17, TSDB_DATA_TYPE_TINYINT, 1, "update"); - - test.SendShowRetrieveReq(); - EXPECT_EQ(test.GetShowRows(), 0); + test.SendShowReq(TSDB_MGMT_TABLE_DB, "user_databases", ""); + EXPECT_EQ(test.GetShowRows(), 2); } TEST_F(MndTestDb, 02_Create_Alter_Drop_Db) { @@ -58,7 +37,7 @@ TEST_F(MndTestDb, 02_Create_Alter_Drop_Db) { createReq.numOfVgroups = 2; createReq.cacheBlockSize = 16; createReq.totalBlocks = 10; - createReq.daysPerFile = 10; + createReq.daysPerFile = 1000; createReq.daysToKeep0 = 3650; createReq.daysToKeep1 = 3650; createReq.daysToKeep2 = 3650; @@ -66,6 +45,7 @@ TEST_F(MndTestDb, 02_Create_Alter_Drop_Db) { createReq.maxRows = 4096; createReq.commitTime = 3600; createReq.fsyncPeriod = 3000; + createReq.ttl = 0; createReq.walLevel = 1; createReq.precision = 0; createReq.compression = 2; @@ -74,6 +54,9 @@ TEST_F(MndTestDb, 02_Create_Alter_Drop_Db) { createReq.update = 0; createReq.cacheLastRow = 0; createReq.ignoreExist = 1; + createReq.streamMode = 0; + createReq.singleSTable = 0; + createReq.numOfRetensions = 0; int32_t contLen = tSerializeSCreateDbReq(NULL, 0, &createReq); void* pReq = rpcMallocCont(contLen); @@ -84,47 +67,11 @@ TEST_F(MndTestDb, 02_Create_Alter_Drop_Db) { ASSERT_EQ(pRsp->code, 0); } - test.SendShowMetaReq(TSDB_MGMT_TABLE_DB, ""); - CHECK_META("show databases", 17); + test.SendShowReq(TSDB_MGMT_TABLE_DB, "user_databases", ""); + EXPECT_EQ(test.GetShowRows(), 3); - test.SendShowRetrieveReq(); - EXPECT_EQ(test.GetShowRows(), 1); - CheckBinary("d1", TSDB_DB_NAME_LEN - 1); - CheckTimestamp(); - CheckInt16(2); // vgroups - CheckInt32(0); // ntables - CheckInt16(1); // replica - CheckInt16(1); // quorum - CheckInt16(10); // days - CheckBinary("3650,3650,3650", 24); // days - CheckInt32(16); // cache - CheckInt32(10); // blocks - CheckInt32(100); // minrows - CheckInt32(4096); // maxrows - CheckInt8(1); // wallevel - CheckInt32(3000); // fsync - CheckInt8(2); // comp - CheckInt8(0); // cachelast - CheckBinary("ms", 3); // precision - CheckInt8(0); // update - - test.SendShowMetaReq(TSDB_MGMT_TABLE_VGROUP, "1.d1"); - CHECK_META("show vgroups", 4); - CHECK_SCHEMA(0, TSDB_DATA_TYPE_INT, 4, "vgId"); - CHECK_SCHEMA(1, TSDB_DATA_TYPE_INT, 4, "tables"); - CHECK_SCHEMA(2, TSDB_DATA_TYPE_SMALLINT, 2, "v1_dnode"); - CHECK_SCHEMA(3, TSDB_DATA_TYPE_BINARY, 9 + VARSTR_HEADER_SIZE, "v1_status"); - - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_VGROUP, "vgroups", "1.d1"); EXPECT_EQ(test.GetShowRows(), 2); - CheckInt32(2); - CheckInt32(3); - IgnoreInt32(); - IgnoreInt32(); - CheckInt16(1); - CheckInt16(1); - CheckBinary("master", 9); - CheckBinary("master", 9); { SAlterDbReq alterdbReq = {0}; @@ -147,55 +94,14 @@ TEST_F(MndTestDb, 02_Create_Alter_Drop_Db) { ASSERT_EQ(pRsp->code, 0); } - test.SendShowMetaReq(TSDB_MGMT_TABLE_DB, ""); - test.SendShowRetrieveReq(); - EXPECT_EQ(test.GetShowRows(), 1); - CheckBinary("d1", TSDB_DB_NAME_LEN - 1); - CheckTimestamp(); - CheckInt16(2); // vgroups - CheckInt32(0); // tables - CheckInt16(1); // replica - CheckInt16(2); // quorum - CheckInt16(10); // days - CheckBinary("300,400,500", 24); // days - CheckInt32(16); // cache - CheckInt32(12); // blocks - CheckInt32(100); // minrows - CheckInt32(4096); // maxrows - CheckInt8(2); // wallevel - CheckInt32(4000); // fsync - CheckInt8(2); // comp - CheckInt8(1); // cachelast - CheckBinary("ms", 3); // precision - CheckInt8(0); // update + test.SendShowReq(TSDB_MGMT_TABLE_DB, "user_databases", ""); + EXPECT_EQ(test.GetShowRows(), 3); // restart test.Restart(); - test.SendShowMetaReq(TSDB_MGMT_TABLE_DB, ""); - CHECK_META("show databases", 17); - - test.SendShowRetrieveReq(); - EXPECT_EQ(test.GetShowRows(), 1); - - CheckBinary("d1", TSDB_DB_NAME_LEN - 1); - CheckTimestamp(); - CheckInt16(2); // vgroups - CheckInt32(0); // tables - CheckInt16(1); // replica - CheckInt16(2); // quorum - CheckInt16(10); // days - CheckBinary("300,400,500", 24); // days - CheckInt32(16); // cache - CheckInt32(12); // blocks - CheckInt32(100); // minrows - CheckInt32(4096); // maxrows - CheckInt8(2); // wallevel - CheckInt32(4000); // fsync - CheckInt8(2); // comp - CheckInt8(1); // cachelast - CheckBinary("ms", 3); // precision - CheckInt8(0); // update + test.SendShowReq(TSDB_MGMT_TABLE_DB, "user_databases", ""); + EXPECT_EQ(test.GetShowRows(), 3); { SDropDbReq dropdbReq = {0}; @@ -214,11 +120,8 @@ TEST_F(MndTestDb, 02_Create_Alter_Drop_Db) { EXPECT_STREQ(dropdbRsp.db, "1.d1"); } - test.SendShowMetaReq(TSDB_MGMT_TABLE_DB, ""); - CHECK_META("show databases", 17); - - test.SendShowRetrieveReq(); - EXPECT_EQ(test.GetShowRows(), 0); + test.SendShowReq(TSDB_MGMT_TABLE_DB, "user_databases", ""); + EXPECT_EQ(test.GetShowRows(), 2); } TEST_F(MndTestDb, 03_Create_Use_Restart_Use_Db) { @@ -228,7 +131,7 @@ TEST_F(MndTestDb, 03_Create_Use_Restart_Use_Db) { createReq.numOfVgroups = 2; createReq.cacheBlockSize = 16; createReq.totalBlocks = 10; - createReq.daysPerFile = 10; + createReq.daysPerFile = 1000; createReq.daysToKeep0 = 3650; createReq.daysToKeep1 = 3650; createReq.daysToKeep2 = 3650; @@ -236,6 +139,7 @@ TEST_F(MndTestDb, 03_Create_Use_Restart_Use_Db) { createReq.maxRows = 4096; createReq.commitTime = 3600; createReq.fsyncPeriod = 3000; + createReq.ttl = 0; createReq.walLevel = 1; createReq.precision = 0; createReq.compression = 2; @@ -244,6 +148,9 @@ TEST_F(MndTestDb, 03_Create_Use_Restart_Use_Db) { createReq.update = 0; createReq.cacheLastRow = 0; createReq.ignoreExist = 1; + createReq.streamMode = 0; + createReq.singleSTable = 0; + createReq.numOfRetensions = 0; int32_t contLen = tSerializeSCreateDbReq(NULL, 0, &createReq); void* pReq = rpcMallocCont(contLen); @@ -254,12 +161,8 @@ TEST_F(MndTestDb, 03_Create_Use_Restart_Use_Db) { ASSERT_EQ(pRsp->code, 0); } - test.SendShowMetaReq(TSDB_MGMT_TABLE_DB, ""); - CHECK_META("show databases", 17); - - test.SendShowRetrieveReq(); - EXPECT_EQ(test.GetShowRows(), 1); - CheckBinary("d2", TSDB_DB_NAME_LEN - 1); + test.SendShowReq(TSDB_MGMT_TABLE_DB, "user_databases", ""); + EXPECT_EQ(test.GetShowRows(), 3); uint64_t d2_uid = 0; From a1f69af4237edeb1121552ecd0e7f331455e8f3c Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 15 Apr 2022 10:23:08 +0800 Subject: [PATCH 05/37] test: reopen dnodeTest --- .../mnode/impl/test/dnode/CMakeLists.txt | 8 +- source/dnode/mnode/impl/test/dnode/mdnode.cpp | 118 +----------------- 2 files changed, 9 insertions(+), 117 deletions(-) diff --git a/source/dnode/mnode/impl/test/dnode/CMakeLists.txt b/source/dnode/mnode/impl/test/dnode/CMakeLists.txt index 16e08d6c35..d064df90bc 100644 --- a/source/dnode/mnode/impl/test/dnode/CMakeLists.txt +++ b/source/dnode/mnode/impl/test/dnode/CMakeLists.txt @@ -5,7 +5,7 @@ target_link_libraries( PUBLIC sut ) -#add_test( -# NAME mnode_test_dnode -# COMMAND mnode_test_dnode -#) +add_test( + NAME mdnodeTest + COMMAND mdnodeTest +) diff --git a/source/dnode/mnode/impl/test/dnode/mdnode.cpp b/source/dnode/mnode/impl/test/dnode/mdnode.cpp index f575556345..a4cbc201a9 100644 --- a/source/dnode/mnode/impl/test/dnode/mdnode.cpp +++ b/source/dnode/mnode/impl/test/dnode/mdnode.cpp @@ -51,27 +51,8 @@ TestServer MndTestDnode::server4; TestServer MndTestDnode::server5; TEST_F(MndTestDnode, 01_ShowDnode) { - test.SendShowMetaReq(TSDB_MGMT_TABLE_DNODE, ""); - CHECK_META("show dnodes", 7); - - CHECK_SCHEMA(0, TSDB_DATA_TYPE_SMALLINT, 2, "id"); - CHECK_SCHEMA(1, TSDB_DATA_TYPE_BINARY, TSDB_EP_LEN + VARSTR_HEADER_SIZE, "endpoint"); - CHECK_SCHEMA(2, TSDB_DATA_TYPE_SMALLINT, 2, "vnodes"); - CHECK_SCHEMA(3, TSDB_DATA_TYPE_SMALLINT, 2, "support_vnodes"); - CHECK_SCHEMA(4, TSDB_DATA_TYPE_BINARY, 10 + VARSTR_HEADER_SIZE, "status"); - CHECK_SCHEMA(5, TSDB_DATA_TYPE_TIMESTAMP, 8, "create_time"); - CHECK_SCHEMA(6, TSDB_DATA_TYPE_BINARY, 24 + VARSTR_HEADER_SIZE, "offline_reason"); - - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_DNODE, "dnodes", ""); EXPECT_EQ(test.GetShowRows(), 1); - - CheckInt16(1); - CheckBinary("localhost:9023", TSDB_EP_LEN); - CheckInt16(0); - CheckInt16(16); - CheckBinary("ready", 10); - CheckTimestamp(); - CheckBinary("", 24); } TEST_F(MndTestDnode, 02_ConfigDnode) { @@ -162,25 +143,8 @@ TEST_F(MndTestDnode, 03_Create_Dnode) { taosMsleep(1300); - test.SendShowMetaReq(TSDB_MGMT_TABLE_DNODE, ""); - CHECK_META("show dnodes", 7); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_DNODE, "dnodes", ""); EXPECT_EQ(test.GetShowRows(), 2); - - CheckInt16(1); - CheckInt16(2); - CheckBinary("localhost:9023", TSDB_EP_LEN); - CheckBinary("localhost:9024", TSDB_EP_LEN); - CheckInt16(0); - CheckInt16(0); - CheckInt16(16); - CheckInt16(16); - CheckBinary("ready", 10); - CheckBinary("ready", 10); - CheckTimestamp(); - CheckTimestamp(); - CheckBinary("", 24); - CheckBinary("", 24); } TEST_F(MndTestDnode, 04_Drop_Dnode) { @@ -236,19 +200,9 @@ TEST_F(MndTestDnode, 04_Drop_Dnode) { ASSERT_EQ(pRsp->code, TSDB_CODE_MND_DNODE_NOT_EXIST); } - test.SendShowMetaReq(TSDB_MGMT_TABLE_DNODE, ""); - CHECK_META("show dnodes", 7); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_DNODE, "dnodes", ""); EXPECT_EQ(test.GetShowRows(), 1); - CheckInt16(1); - CheckBinary("localhost:9023", TSDB_EP_LEN); - CheckInt16(0); - CheckInt16(16); - CheckBinary("ready", 10); - CheckTimestamp(); - CheckBinary("", 24); - taosMsleep(2000); server2.Stop(); server2.DoStart(); @@ -298,40 +252,9 @@ TEST_F(MndTestDnode, 05_Create_Drop_Restart_Dnode) { } taosMsleep(1300); - test.SendShowMetaReq(TSDB_MGMT_TABLE_DNODE, ""); - CHECK_META("show dnodes", 7); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_DNODE, "dnodes", ""); EXPECT_EQ(test.GetShowRows(), 4); - CheckInt16(1); - CheckInt16(3); - CheckInt16(4); - CheckInt16(5); - CheckBinary("localhost:9023", TSDB_EP_LEN); - CheckBinary("localhost:9025", TSDB_EP_LEN); - CheckBinary("localhost:9026", TSDB_EP_LEN); - CheckBinary("localhost:9027", TSDB_EP_LEN); - CheckInt16(0); - CheckInt16(0); - CheckInt16(0); - CheckInt16(0); - CheckInt16(16); - CheckInt16(16); - CheckInt16(16); - CheckInt16(16); - CheckBinary("ready", 10); - CheckBinary("ready", 10); - CheckBinary("ready", 10); - CheckBinary("ready", 10); - CheckTimestamp(); - CheckTimestamp(); - CheckTimestamp(); - CheckTimestamp(); - CheckBinary("", 24); - CheckBinary("", 24); - CheckBinary("", 24); - CheckBinary("", 24); - // restart uInfo("stop all server"); test.Restart(); @@ -341,37 +264,6 @@ TEST_F(MndTestDnode, 05_Create_Drop_Restart_Dnode) { server5.Restart(); taosMsleep(1300); - test.SendShowMetaReq(TSDB_MGMT_TABLE_DNODE, ""); - CHECK_META("show dnodes", 7); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_DNODE, "dnodes", ""); EXPECT_EQ(test.GetShowRows(), 4); - - CheckInt16(1); - CheckInt16(3); - CheckInt16(4); - CheckInt16(5); - CheckBinary("localhost:9023", TSDB_EP_LEN); - CheckBinary("localhost:9025", TSDB_EP_LEN); - CheckBinary("localhost:9026", TSDB_EP_LEN); - CheckBinary("localhost:9027", TSDB_EP_LEN); - CheckInt16(0); - CheckInt16(0); - CheckInt16(0); - CheckInt16(0); - CheckInt16(16); - CheckInt16(16); - CheckInt16(16); - CheckInt16(16); - CheckBinary("ready", 10); - CheckBinary("ready", 10); - CheckBinary("ready", 10); - CheckBinary("ready", 10); - CheckTimestamp(); - CheckTimestamp(); - CheckTimestamp(); - CheckTimestamp(); - CheckBinary("", 24); - CheckBinary("", 24); - CheckBinary("", 24); - CheckBinary("", 24); } From f431cbe03a2190c1bec1c7a60ccb30a60731949b Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 15 Apr 2022 10:39:42 +0800 Subject: [PATCH 06/37] test: reopen funcTest --- source/dnode/mnode/impl/src/mndInfoSchema.c | 10 +++-- .../dnode/mnode/impl/test/func/CMakeLists.txt | 10 ++--- source/dnode/mnode/impl/test/func/func.cpp | 43 +++---------------- 3 files changed, 16 insertions(+), 47 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndInfoSchema.c b/source/dnode/mnode/impl/src/mndInfoSchema.c index c21a6e61df..32c9847fea 100644 --- a/source/dnode/mnode/impl/src/mndInfoSchema.c +++ b/source/dnode/mnode/impl/src/mndInfoSchema.c @@ -94,11 +94,13 @@ static const SInfosTableSchema userDBSchema[] = { }; static const SInfosTableSchema userFuncSchema[] = { - {.name = "name", .bytes = 32, .type = TSDB_DATA_TYPE_VARCHAR}, + {.name = "name", .bytes = TSDB_FUNC_NAME_LEN - 1 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, + {.name = "comment", .bytes = PATH_MAX - 1 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, + {.name = "aggregate", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, + {.name = "comment", .bytes = TSDB_TYPE_STR_MAX_LEN - 1 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP}, - {.name = "ntables", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, - {.name = "precision", .bytes = 2, .type = TSDB_DATA_TYPE_VARCHAR}, - {.name = "status", .bytes = 10, .type = TSDB_DATA_TYPE_VARCHAR}, + {.name = "code_len", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, + {.name = "bufsize", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, }; static const SInfosTableSchema userIdxSchema[] = { diff --git a/source/dnode/mnode/impl/test/func/CMakeLists.txt b/source/dnode/mnode/impl/test/func/CMakeLists.txt index 26b0a60968..ecb4f851be 100644 --- a/source/dnode/mnode/impl/test/func/CMakeLists.txt +++ b/source/dnode/mnode/impl/test/func/CMakeLists.txt @@ -1,11 +1,11 @@ -aux_source_directory(. FUNC_SRC) -add_executable(mnode_test_func ${FUNC_SRC}) +aux_source_directory(. MNODE_FUNC_TEST_SRC) +add_executable(funcTest ${MNODE_FUNC_TEST_SRC}) target_link_libraries( - mnode_test_func + funcTest PUBLIC sut ) add_test( - NAME mnode_test_func - COMMAND mnode_test_func + NAME funcTest + COMMAND funcTest ) diff --git a/source/dnode/mnode/impl/test/func/func.cpp b/source/dnode/mnode/impl/test/func/func.cpp index f34f77de0c..6b9c410738 100644 --- a/source/dnode/mnode/impl/test/func/func.cpp +++ b/source/dnode/mnode/impl/test/func/func.cpp @@ -26,18 +26,7 @@ class MndTestFunc : public ::testing::Test { Testbase MndTestFunc::test; TEST_F(MndTestFunc, 01_Show_Func) { - test.SendShowMetaReq(TSDB_MGMT_TABLE_FUNC, ""); - CHECK_META("show functions", 7); - - CHECK_SCHEMA(0, TSDB_DATA_TYPE_BINARY, TSDB_FUNC_NAME_LEN + VARSTR_HEADER_SIZE, "name"); - CHECK_SCHEMA(1, TSDB_DATA_TYPE_BINARY, PATH_MAX + VARSTR_HEADER_SIZE, "comment"); - CHECK_SCHEMA(2, TSDB_DATA_TYPE_INT, 4, "aggregate"); - CHECK_SCHEMA(3, TSDB_DATA_TYPE_BINARY, TSDB_TYPE_STR_MAX_LEN + VARSTR_HEADER_SIZE, "outputtype"); - CHECK_SCHEMA(4, TSDB_DATA_TYPE_TIMESTAMP, 8, "create_time"); - CHECK_SCHEMA(5, TSDB_DATA_TYPE_INT, 4, "code_len"); - CHECK_SCHEMA(6, TSDB_DATA_TYPE_INT, 4, "bufsize"); - - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_FUNC, "user_functions", ""); EXPECT_EQ(test.GetShowRows(), 0); } @@ -194,19 +183,8 @@ TEST_F(MndTestFunc, 02_Create_Func) { } } - test.SendShowMetaReq(TSDB_MGMT_TABLE_FUNC, ""); - CHECK_META("show functions", 7); - - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_FUNC, "user_functions", ""); EXPECT_EQ(test.GetShowRows(), 1); - - CheckBinary("f1", TSDB_FUNC_NAME_LEN); - CheckBinaryByte('m', TSDB_FUNC_COMMENT_LEN); - CheckInt32(0); - CheckBinary("SMALLINT", TSDB_TYPE_STR_MAX_LEN); - CheckTimestamp(); - CheckInt32(TSDB_FUNC_CODE_LEN); - CheckInt32(4); } TEST_F(MndTestFunc, 03_Retrieve_Func) { @@ -331,10 +309,7 @@ TEST_F(MndTestFunc, 03_Retrieve_Func) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_FUNC, ""); - CHECK_META("show functions", 7); - - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_FUNC, "user_functions", ""); EXPECT_EQ(test.GetShowRows(), 2); } @@ -529,20 +504,12 @@ TEST_F(MndTestFunc, 04_Drop_Func) { ASSERT_EQ(pRsp->code, 0); } - test.SendShowMetaReq(TSDB_MGMT_TABLE_FUNC, ""); - CHECK_META("show functions", 7); - - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_FUNC, "user_functions", ""); EXPECT_EQ(test.GetShowRows(), 1); // restart test.Restart(); - test.SendShowMetaReq(TSDB_MGMT_TABLE_FUNC, ""); - CHECK_META("show functions", 7); - - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_FUNC, "user_functions", ""); EXPECT_EQ(test.GetShowRows(), 1); - - CheckBinary("f2", TSDB_FUNC_NAME_LEN); } From 1a96baf3293cf2ef71ed6017cf8f6bc2feac8f49 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 15 Apr 2022 10:42:44 +0800 Subject: [PATCH 07/37] test: reopen mnodeTest --- .../mnode/impl/test/mnode/CMakeLists.txt | 10 ++--- source/dnode/mnode/impl/test/mnode/mnode.cpp | 43 ++----------------- 2 files changed, 9 insertions(+), 44 deletions(-) diff --git a/source/dnode/mnode/impl/test/mnode/CMakeLists.txt b/source/dnode/mnode/impl/test/mnode/CMakeLists.txt index 4d9b473291..94c25281b2 100644 --- a/source/dnode/mnode/impl/test/mnode/CMakeLists.txt +++ b/source/dnode/mnode/impl/test/mnode/CMakeLists.txt @@ -1,11 +1,11 @@ -aux_source_directory(. MTEST_SRC) -add_executable(mnode_test_mnode ${MTEST_SRC}) +aux_source_directory(. MNODE_MNODE_TEST_SRC) +add_executable(mmnodeTest ${MNODE_MNODE_TEST_SRC}) target_link_libraries( - mnode_test_mnode + mmnodeTest PUBLIC sut ) add_test( - NAME mnode_test_mnode - COMMAND mnode_test_mnode + NAME mmnodeTest + COMMAND mmnodeTest ) diff --git a/source/dnode/mnode/impl/test/mnode/mnode.cpp b/source/dnode/mnode/impl/test/mnode/mnode.cpp index dd2867f7f9..20cbb28b72 100644 --- a/source/dnode/mnode/impl/test/mnode/mnode.cpp +++ b/source/dnode/mnode/impl/test/mnode/mnode.cpp @@ -39,23 +39,8 @@ Testbase MndTestMnode::test; TestServer MndTestMnode::server2; TEST_F(MndTestMnode, 01_ShowDnode) { - test.SendShowMetaReq(TSDB_MGMT_TABLE_MNODE, ""); - CHECK_META("show mnodes", 5); - - CHECK_SCHEMA(0, TSDB_DATA_TYPE_SMALLINT, 2, "id"); - CHECK_SCHEMA(1, TSDB_DATA_TYPE_BINARY, TSDB_EP_LEN + VARSTR_HEADER_SIZE, "endpoint"); - CHECK_SCHEMA(2, TSDB_DATA_TYPE_BINARY, 12 + VARSTR_HEADER_SIZE, "role"); - CHECK_SCHEMA(3, TSDB_DATA_TYPE_TIMESTAMP, 8, "create_time"); - CHECK_SCHEMA(4, TSDB_DATA_TYPE_TIMESTAMP, 8, "role_time"); - - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_MNODE, "mnodes",""); EXPECT_EQ(test.GetShowRows(), 1); - - CheckInt16(1); - CheckBinary("localhost:9028", TSDB_EP_LEN); - CheckBinary("master", 12); - CheckTimestamp(); - IgnoreTimestamp(); } TEST_F(MndTestMnode, 02_Create_Mnode_Invalid_Id) { @@ -104,8 +89,7 @@ TEST_F(MndTestMnode, 04_Create_Mnode) { ASSERT_EQ(pRsp->code, 0); taosMsleep(1300); - test.SendShowMetaReq(TSDB_MGMT_TABLE_DNODE, ""); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_DNODE, "dnodes", ""); EXPECT_EQ(test.GetShowRows(), 2); } @@ -122,20 +106,8 @@ TEST_F(MndTestMnode, 04_Create_Mnode) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_MNODE, ""); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_MNODE, "mnodes",""); EXPECT_EQ(test.GetShowRows(), 2); - - CheckInt16(1); - CheckInt16(2); - CheckBinary("localhost:9028", TSDB_EP_LEN); - CheckBinary("localhost:9029", TSDB_EP_LEN); - CheckBinary("master", 12); - CheckBinary("slave", 12); - CheckTimestamp(); - CheckTimestamp(); - IgnoreTimestamp(); - IgnoreTimestamp(); } { @@ -151,15 +123,8 @@ TEST_F(MndTestMnode, 04_Create_Mnode) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_MNODE, ""); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_MNODE, "mnodes",""); EXPECT_EQ(test.GetShowRows(), 1); - - CheckInt16(1); - CheckBinary("localhost:9028", TSDB_EP_LEN); - CheckBinary("master", 12); - CheckTimestamp(); - IgnoreTimestamp(); } { From 2a4a536ce2f888d3bee469e2c797caa5e6e3afdc Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 15 Apr 2022 10:47:00 +0800 Subject: [PATCH 08/37] test: reopen profileTest --- source/dnode/mnode/impl/test/mnode/mnode.cpp | 6 +-- .../mnode/impl/test/profile/CMakeLists.txt | 10 ++--- .../dnode/mnode/impl/test/profile/profile.cpp | 41 ++----------------- 3 files changed, 11 insertions(+), 46 deletions(-) diff --git a/source/dnode/mnode/impl/test/mnode/mnode.cpp b/source/dnode/mnode/impl/test/mnode/mnode.cpp index 20cbb28b72..444c674667 100644 --- a/source/dnode/mnode/impl/test/mnode/mnode.cpp +++ b/source/dnode/mnode/impl/test/mnode/mnode.cpp @@ -39,7 +39,7 @@ Testbase MndTestMnode::test; TestServer MndTestMnode::server2; TEST_F(MndTestMnode, 01_ShowDnode) { - test.SendShowReq(TSDB_MGMT_TABLE_MNODE, "mnodes",""); + test.SendShowReq(TSDB_MGMT_TABLE_MNODE, "mnodes", ""); EXPECT_EQ(test.GetShowRows(), 1); } @@ -106,7 +106,7 @@ TEST_F(MndTestMnode, 04_Create_Mnode) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowReq(TSDB_MGMT_TABLE_MNODE, "mnodes",""); + test.SendShowReq(TSDB_MGMT_TABLE_MNODE, "mnodes", ""); EXPECT_EQ(test.GetShowRows(), 2); } @@ -123,7 +123,7 @@ TEST_F(MndTestMnode, 04_Create_Mnode) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowReq(TSDB_MGMT_TABLE_MNODE, "mnodes",""); + test.SendShowReq(TSDB_MGMT_TABLE_MNODE, "mnodes", ""); EXPECT_EQ(test.GetShowRows(), 1); } diff --git a/source/dnode/mnode/impl/test/profile/CMakeLists.txt b/source/dnode/mnode/impl/test/profile/CMakeLists.txt index 88d7366b7d..8b811ebfed 100644 --- a/source/dnode/mnode/impl/test/profile/CMakeLists.txt +++ b/source/dnode/mnode/impl/test/profile/CMakeLists.txt @@ -1,11 +1,11 @@ -aux_source_directory(. PROFILE_SRC) -add_executable(mnode_test_profile ${PROFILE_SRC}) +aux_source_directory(. MNODE_PROFILE_TEST_SRC) +add_executable(profileTest ${MNODE_PROFILE_TEST_SRC}) target_link_libraries( - mnode_test_profile + profileTest PUBLIC sut ) add_test( - NAME mnode_test_profile - COMMAND mnode_test_profile + NAME profileTest + COMMAND profileTest ) diff --git a/source/dnode/mnode/impl/test/profile/profile.cpp b/source/dnode/mnode/impl/test/profile/profile.cpp index 14b31e5282..f4be703d72 100644 --- a/source/dnode/mnode/impl/test/profile/profile.cpp +++ b/source/dnode/mnode/impl/test/profile/profile.cpp @@ -74,25 +74,8 @@ TEST_F(MndTestProfile, 02_ConnectMsg_InvalidDB) { } TEST_F(MndTestProfile, 03_ConnectMsg_Show) { - test.SendShowMetaReq(TSDB_MGMT_TABLE_CONNS, ""); - CHECK_META("show connections", 7); - CHECK_SCHEMA(0, TSDB_DATA_TYPE_INT, 4, "connId"); - CHECK_SCHEMA(1, TSDB_DATA_TYPE_BINARY, TSDB_USER_LEN + VARSTR_HEADER_SIZE, "user"); - CHECK_SCHEMA(2, TSDB_DATA_TYPE_BINARY, TSDB_APP_NAME_LEN + VARSTR_HEADER_SIZE, "program"); - CHECK_SCHEMA(3, TSDB_DATA_TYPE_INT, 4, "pid"); - CHECK_SCHEMA(4, TSDB_DATA_TYPE_BINARY, TSDB_IPv4ADDR_LEN + 6 + VARSTR_HEADER_SIZE, "ip:port"); - CHECK_SCHEMA(5, TSDB_DATA_TYPE_TIMESTAMP, 8, "login_time"); - CHECK_SCHEMA(6, TSDB_DATA_TYPE_TIMESTAMP, 8, "last_access"); - - test.SendShowRetrieveReq(); - EXPECT_EQ(test.GetShowRows(), 1); - CheckInt32(1); - CheckBinary("root", TSDB_USER_LEN); - CheckBinary("mnode_test_profile", TSDB_APP_NAME_LEN); - CheckInt32(1234); - IgnoreBinary(TSDB_IPv4ADDR_LEN + 6); - CheckTimestamp(); - CheckTimestamp(); + test.SendShowReq(TSDB_MGMT_TABLE_CONNS, "connections", ""); + EXPECT_EQ(test.GetShowRows(), 0); } TEST_F(MndTestProfile, 04_HeartBeatMsg) { @@ -311,24 +294,6 @@ TEST_F(MndTestProfile, 08_KillQueryMsg_InvalidConn) { } TEST_F(MndTestProfile, 09_KillQueryMsg) { - test.SendShowMetaReq(TSDB_MGMT_TABLE_QUERIES, ""); - CHECK_META("show queries", 14); - - CHECK_SCHEMA(0, TSDB_DATA_TYPE_INT, 4, "queryId"); - CHECK_SCHEMA(1, TSDB_DATA_TYPE_INT, 4, "connId"); - CHECK_SCHEMA(2, TSDB_DATA_TYPE_BINARY, TSDB_USER_LEN + VARSTR_HEADER_SIZE, "user"); - CHECK_SCHEMA(3, TSDB_DATA_TYPE_BINARY, TSDB_IPv4ADDR_LEN + 6 + VARSTR_HEADER_SIZE, "ip:port"); - CHECK_SCHEMA(4, TSDB_DATA_TYPE_BINARY, 22 + VARSTR_HEADER_SIZE, "qid"); - CHECK_SCHEMA(5, TSDB_DATA_TYPE_TIMESTAMP, 8, "created_time"); - CHECK_SCHEMA(6, TSDB_DATA_TYPE_BIGINT, 8, "time"); - CHECK_SCHEMA(7, TSDB_DATA_TYPE_BINARY, 18 + VARSTR_HEADER_SIZE, "sql_obj_id"); - CHECK_SCHEMA(8, TSDB_DATA_TYPE_INT, 4, "pid"); - CHECK_SCHEMA(9, TSDB_DATA_TYPE_BINARY, TSDB_EP_LEN + VARSTR_HEADER_SIZE, "ep"); - CHECK_SCHEMA(10, TSDB_DATA_TYPE_BOOL, 1, "stable_query"); - CHECK_SCHEMA(11, TSDB_DATA_TYPE_INT, 4, "sub_queries"); - CHECK_SCHEMA(12, TSDB_DATA_TYPE_BINARY, TSDB_SHOW_SUBQUERY_LEN + VARSTR_HEADER_SIZE, "sub_query_info"); - CHECK_SCHEMA(13, TSDB_DATA_TYPE_BINARY, TSDB_SHOW_SQL_LEN + VARSTR_HEADER_SIZE, "sql"); - - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_QUERIES, "queries", ""); EXPECT_EQ(test.GetShowRows(), 0); } From a8ab69e6cbddb0a42dd6c1648867fa6a2e143b9d Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 15 Apr 2022 10:54:04 +0800 Subject: [PATCH 09/37] test: reopen snodeTest --- .../mnode/impl/test/snode/CMakeLists.txt | 10 ++--- source/dnode/mnode/impl/test/snode/snode.cpp | 37 +++---------------- 2 files changed, 10 insertions(+), 37 deletions(-) diff --git a/source/dnode/mnode/impl/test/snode/CMakeLists.txt b/source/dnode/mnode/impl/test/snode/CMakeLists.txt index 44a5f35f94..9c60da364c 100644 --- a/source/dnode/mnode/impl/test/snode/CMakeLists.txt +++ b/source/dnode/mnode/impl/test/snode/CMakeLists.txt @@ -1,11 +1,11 @@ -aux_source_directory(. STEST_SRC) -add_executable(mnode_test_snode ${STEST_SRC}) +aux_source_directory(. MNODE_SNODE_TEST_SRC) +add_executable(msnodeTest ${MNODE_SNODE_TEST_SRC}) target_link_libraries( - mnode_test_snode + msnodeTest PUBLIC sut ) add_test( - NAME mnode_test_snode - COMMAND mnode_test_snode + NAME msnodeTest + COMMAND msnodeTest ) diff --git a/source/dnode/mnode/impl/test/snode/snode.cpp b/source/dnode/mnode/impl/test/snode/snode.cpp index 7d24d89154..3742c06b0a 100644 --- a/source/dnode/mnode/impl/test/snode/snode.cpp +++ b/source/dnode/mnode/impl/test/snode/snode.cpp @@ -39,14 +39,7 @@ Testbase MndTestSnode::test; TestServer MndTestSnode::server2; TEST_F(MndTestSnode, 01_Show_Snode) { - test.SendShowMetaReq(TSDB_MGMT_TABLE_SNODE, ""); - CHECK_META("show snodes", 3); - - CHECK_SCHEMA(0, TSDB_DATA_TYPE_SMALLINT, 2, "id"); - CHECK_SCHEMA(1, TSDB_DATA_TYPE_BINARY, TSDB_EP_LEN + VARSTR_HEADER_SIZE, "endpoint"); - CHECK_SCHEMA(2, TSDB_DATA_TYPE_TIMESTAMP, 8, "create_time"); - - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_SNODE, "snodes", ""); EXPECT_EQ(test.GetShowRows(), 0); } @@ -76,14 +69,8 @@ TEST_F(MndTestSnode, 02_Create_Snode) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_SNODE, ""); - CHECK_META("show snodes", 3); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_SNODE, "snodes", ""); EXPECT_EQ(test.GetShowRows(), 1); - - CheckInt16(1); - CheckBinary("localhost:9016", TSDB_EP_LEN); - CheckTimestamp(); } { @@ -115,8 +102,7 @@ TEST_F(MndTestSnode, 03_Drop_Snode) { ASSERT_EQ(pRsp->code, 0); taosMsleep(1300); - test.SendShowMetaReq(TSDB_MGMT_TABLE_DNODE, ""); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_DNODE, "dnodes", ""); EXPECT_EQ(test.GetShowRows(), 2); } @@ -132,16 +118,8 @@ TEST_F(MndTestSnode, 03_Drop_Snode) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_SNODE, ""); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_SNODE, "snodes", ""); EXPECT_EQ(test.GetShowRows(), 2); - - CheckInt16(1); - CheckInt16(2); - CheckBinary("localhost:9016", TSDB_EP_LEN); - CheckBinary("localhost:9017", TSDB_EP_LEN); - CheckTimestamp(); - CheckTimestamp(); } { @@ -156,13 +134,8 @@ TEST_F(MndTestSnode, 03_Drop_Snode) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_SNODE, ""); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_SNODE, "snodes", ""); EXPECT_EQ(test.GetShowRows(), 1); - - CheckInt16(1); - CheckBinary("localhost:9016", TSDB_EP_LEN); - CheckTimestamp(); } { From dbe44ff13671b677c1050d72036acbc0720565fa Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 15 Apr 2022 10:54:15 +0800 Subject: [PATCH 10/37] test: reopen qnodeTest --- .../mnode/impl/test/qnode/CMakeLists.txt | 10 ++--- source/dnode/mnode/impl/test/qnode/qnode.cpp | 37 +++---------------- 2 files changed, 10 insertions(+), 37 deletions(-) diff --git a/source/dnode/mnode/impl/test/qnode/CMakeLists.txt b/source/dnode/mnode/impl/test/qnode/CMakeLists.txt index 77ac39e409..8259f9f47d 100644 --- a/source/dnode/mnode/impl/test/qnode/CMakeLists.txt +++ b/source/dnode/mnode/impl/test/qnode/CMakeLists.txt @@ -1,11 +1,11 @@ -aux_source_directory(. QTEST_SRC) -add_executable(mnode_test_qnode ${QTEST_SRC}) +aux_source_directory(. MNODE_QNODE_TEST_SRC) +add_executable(mqnodeTest ${MNODE_QNODE_TEST_SRC}) target_link_libraries( - mnode_test_qnode + mqnodeTest PUBLIC sut ) add_test( - NAME mnode_test_qnode - COMMAND mnode_test_qnode + NAME mqnodeTest + COMMAND mqnodeTest ) diff --git a/source/dnode/mnode/impl/test/qnode/qnode.cpp b/source/dnode/mnode/impl/test/qnode/qnode.cpp index be214cacf2..7240e0f183 100644 --- a/source/dnode/mnode/impl/test/qnode/qnode.cpp +++ b/source/dnode/mnode/impl/test/qnode/qnode.cpp @@ -39,14 +39,7 @@ Testbase MndTestQnode::test; TestServer MndTestQnode::server2; TEST_F(MndTestQnode, 01_Show_Qnode) { - test.SendShowMetaReq(TSDB_MGMT_TABLE_QNODE, ""); - CHECK_META("show qnodes", 3); - - CHECK_SCHEMA(0, TSDB_DATA_TYPE_SMALLINT, 2, "id"); - CHECK_SCHEMA(1, TSDB_DATA_TYPE_BINARY, TSDB_EP_LEN + VARSTR_HEADER_SIZE, "endpoint"); - CHECK_SCHEMA(2, TSDB_DATA_TYPE_TIMESTAMP, 8, "create_time"); - - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_QNODE, "qnodes", ""); EXPECT_EQ(test.GetShowRows(), 0); } @@ -76,14 +69,8 @@ TEST_F(MndTestQnode, 02_Create_Qnode) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_QNODE, ""); - CHECK_META("show qnodes", 3); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_QNODE, "qnodes", ""); EXPECT_EQ(test.GetShowRows(), 1); - - CheckInt16(1); - CheckBinary("localhost:9014", TSDB_EP_LEN); - CheckTimestamp(); } { @@ -115,8 +102,7 @@ TEST_F(MndTestQnode, 03_Drop_Qnode) { ASSERT_EQ(pRsp->code, 0); taosMsleep(1300); - test.SendShowMetaReq(TSDB_MGMT_TABLE_DNODE, ""); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_DNODE, "dnodes", ""); EXPECT_EQ(test.GetShowRows(), 2); } @@ -132,16 +118,8 @@ TEST_F(MndTestQnode, 03_Drop_Qnode) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_QNODE, ""); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_QNODE, "qnodes", ""); EXPECT_EQ(test.GetShowRows(), 2); - - CheckInt16(1); - CheckInt16(2); - CheckBinary("localhost:9014", TSDB_EP_LEN); - CheckBinary("localhost:9015", TSDB_EP_LEN); - CheckTimestamp(); - CheckTimestamp(); } { @@ -156,13 +134,8 @@ TEST_F(MndTestQnode, 03_Drop_Qnode) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_QNODE, ""); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_QNODE, "qnodes", ""); EXPECT_EQ(test.GetShowRows(), 1); - - CheckInt16(1); - CheckBinary("localhost:9014", TSDB_EP_LEN); - CheckTimestamp(); } { From d8b6afee985eac379291ddef565d658bcd4aef36 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 15 Apr 2022 10:58:15 +0800 Subject: [PATCH 11/37] test: reopen smaTest --- source/dnode/mnode/impl/test/sma/CMakeLists.txt | 10 +++++----- source/dnode/mnode/impl/test/sma/sma.cpp | 15 ++++++--------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/source/dnode/mnode/impl/test/sma/CMakeLists.txt b/source/dnode/mnode/impl/test/sma/CMakeLists.txt index 943695abf3..3f9ec123a8 100644 --- a/source/dnode/mnode/impl/test/sma/CMakeLists.txt +++ b/source/dnode/mnode/impl/test/sma/CMakeLists.txt @@ -1,11 +1,11 @@ -aux_source_directory(. SMA_SRC) -add_executable(mnode_test_sma ${SMA_SRC}) +aux_source_directory(. MNODE_SMA_TEST_SRC) +add_executable(smaTest ${MNODE_SMA_TEST_SRC}) target_link_libraries( - mnode_test_sma + smaTest PUBLIC sut ) add_test( - NAME mnode_test_sma - COMMAND mnode_test_sma + NAME smaTest + COMMAND smaTest ) diff --git a/source/dnode/mnode/impl/test/sma/sma.cpp b/source/dnode/mnode/impl/test/sma/sma.cpp index 4b0e33a323..4f3b0d6e37 100644 --- a/source/dnode/mnode/impl/test/sma/sma.cpp +++ b/source/dnode/mnode/impl/test/sma/sma.cpp @@ -207,7 +207,7 @@ TEST_F(MndTestSma, 01_Create_Show_Meta_Drop_Restart_Stb) { pReq = BuildCreateStbReq(stbname, &contLen); pRsp = test.SendReq(TDMT_MND_CREATE_STB, pReq, contLen); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_STB, dbname); + test.SendShowReq(TSDB_MGMT_TABLE_STB, "user_stables",dbname); test.SendShowRetrieveReq(); EXPECT_EQ(test.GetShowRows(), 1); } @@ -216,7 +216,7 @@ TEST_F(MndTestSma, 01_Create_Show_Meta_Drop_Restart_Stb) { pReq = BuildCreateTSmaReq(smaname, stbname, 0, "expr", "tagsFilter", "sql", "ast", &contLen); pRsp = test.SendReq(TDMT_MND_CREATE_SMA, pReq, contLen); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_INDEX, dbname); + test.SendShowReq(TSDB_MGMT_TABLE_INDEX, dbname); test.SendShowRetrieveReq(); EXPECT_EQ(test.GetShowRows(), 1); } @@ -225,7 +225,7 @@ TEST_F(MndTestSma, 01_Create_Show_Meta_Drop_Restart_Stb) { test.Restart(); { - test.SendShowMetaReq(TSDB_MGMT_TABLE_INDEX, dbname); + test.SendShowReq(TSDB_MGMT_TABLE_INDEX, dbname); CHECK_META("show indexes", 3); test.SendShowRetrieveReq(); EXPECT_EQ(test.GetShowRows(), 1); @@ -239,7 +239,7 @@ TEST_F(MndTestSma, 01_Create_Show_Meta_Drop_Restart_Stb) { pReq = BuildDropTSmaReq(smaname, 0, &contLen); pRsp = test.SendReq(TDMT_MND_DROP_SMA, pReq, contLen); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_INDEX, dbname); + test.SendShowReq(TSDB_MGMT_TABLE_INDEX, dbname); test.SendShowRetrieveReq(); EXPECT_EQ(test.GetShowRows(), 0); } @@ -263,10 +263,8 @@ TEST_F(MndTestSma, 02_Create_Show_Meta_Drop_Restart_BSma) { pReq = BuildCreateBSmaStbReq(stbname, &contLen); pRsp = test.SendReq(TDMT_MND_CREATE_STB, pReq, contLen); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_STB, dbname); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_STB, "user_stables",dbname); EXPECT_EQ(test.GetShowRows(), 1); -// CheckBinary("bsmastb", TSDB_TABLE_NAME_LEN); } test.Restart(); @@ -281,8 +279,7 @@ TEST_F(MndTestSma, 02_Create_Show_Meta_Drop_Restart_BSma) { pReq = BuildDropStbReq(stbname, &contLen); pRsp = test.SendReq(TDMT_MND_DROP_STB, pReq, contLen); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_STB, dbname); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_STB, "user_stables",dbname); EXPECT_EQ(test.GetShowRows(), 0); } From de121928070e2c8e30425192c25d838c2a4b4410 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 15 Apr 2022 10:58:27 +0800 Subject: [PATCH 12/37] test: reopen showTest --- .../dnode/mnode/impl/test/show/CMakeLists.txt | 10 ++--- source/dnode/mnode/impl/test/show/show.cpp | 37 ++----------------- 2 files changed, 8 insertions(+), 39 deletions(-) diff --git a/source/dnode/mnode/impl/test/show/CMakeLists.txt b/source/dnode/mnode/impl/test/show/CMakeLists.txt index cc0706ca50..69e93e7086 100644 --- a/source/dnode/mnode/impl/test/show/CMakeLists.txt +++ b/source/dnode/mnode/impl/test/show/CMakeLists.txt @@ -1,11 +1,11 @@ -aux_source_directory(. SHOW_SRC) -add_executable(mnode_test_show ${SHOW_SRC}) +aux_source_directory(. MNODE_SHOW_TEST_SRC) +add_executable(showTest ${MNODE_SHOW_TEST_SRC}) target_link_libraries( - mnode_test_show + showTest PUBLIC sut ) add_test( - NAME mnode_test_show - COMMAND mnode_test_show + NAME showTest + COMMAND showTest ) diff --git a/source/dnode/mnode/impl/test/show/show.cpp b/source/dnode/mnode/impl/test/show/show.cpp index a57d99a257..5b8c186ccf 100644 --- a/source/dnode/mnode/impl/test/show/show.cpp +++ b/source/dnode/mnode/impl/test/show/show.cpp @@ -67,42 +67,11 @@ TEST_F(MndTestShow, 03_ShowMsg_Conn) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_CONNS, ""); - - STableMetaRsp* pMeta = test.GetShowMeta(); - EXPECT_STREQ(pMeta->tbName, "show connections"); - EXPECT_EQ(pMeta->numOfTags, 0); - EXPECT_EQ(pMeta->numOfColumns, 7); - EXPECT_EQ(pMeta->precision, 0); - EXPECT_EQ(pMeta->tableType, 0); - EXPECT_EQ(pMeta->update, 0); - EXPECT_EQ(pMeta->sversion, 0); - EXPECT_EQ(pMeta->tversion, 0); - EXPECT_EQ(pMeta->tuid, 0); - EXPECT_EQ(pMeta->suid, 0); - - test.SendShowRetrieveReq(); - - SRetrieveTableRsp* pRetrieveRsp = test.GetRetrieveRsp(); - EXPECT_EQ(pRetrieveRsp->numOfRows, 1); - EXPECT_EQ(pRetrieveRsp->useconds, 0); - EXPECT_EQ(pRetrieveRsp->completed, 1); - EXPECT_EQ(pRetrieveRsp->precision, TSDB_TIME_PRECISION_MILLI); - EXPECT_EQ(pRetrieveRsp->compressed, 0); - EXPECT_EQ(pRetrieveRsp->compLen, 0); + test.SendShowReq(TSDB_MGMT_TABLE_CONNS, "connections", ""); + // EXPECT_EQ(test.GetShowRows(), 1); } TEST_F(MndTestShow, 04_ShowMsg_Cluster) { - test.SendShowMetaReq(TSDB_MGMT_TABLE_CLUSTER, ""); - CHECK_META( "show cluster", 3); - CHECK_SCHEMA(0, TSDB_DATA_TYPE_BIGINT, 8, "id"); - CHECK_SCHEMA(1, TSDB_DATA_TYPE_BINARY, TSDB_CLUSTER_ID_LEN + VARSTR_HEADER_SIZE, "name"); - CHECK_SCHEMA(2, TSDB_DATA_TYPE_TIMESTAMP, 8, "create_time"); - - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_CLUSTER, "cluster", ""); EXPECT_EQ(test.GetShowRows(), 1); - - IgnoreInt64(); - IgnoreBinary(TSDB_CLUSTER_ID_LEN); - CheckTimestamp(); } \ No newline at end of file From b0f4a396d42eed4896b984a658357a67ccad7021 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Fri, 15 Apr 2022 03:48:51 +0000 Subject: [PATCH 13/37] refact vnode --- source/dnode/vnode/CMakeLists.txt | 2 +- source/dnode/vnode/src/inc/vnd.h | 8 ++- source/dnode/vnode/src/vnd/vnodeCfg.c | 93 +++++++++++++++++++++++++- source/dnode/vnode/src/vnd/vnodeOpen.c | 9 ++- 4 files changed, 101 insertions(+), 11 deletions(-) diff --git a/source/dnode/vnode/CMakeLists.txt b/source/dnode/vnode/CMakeLists.txt index f7a3f2f109..c0e458219c 100644 --- a/source/dnode/vnode/CMakeLists.txt +++ b/source/dnode/vnode/CMakeLists.txt @@ -4,13 +4,13 @@ target_sources( vnode PRIVATE # vnode + "src/vnd/vnodeOpen.c" "src/vnd/vnodeArenaMAImpl.c" "src/vnd/vnodeBufferPool.c" # "src/vnd/vnodeBufferPool2.c" "src/vnd/vnodeCfg.c" "src/vnd/vnodeCommit.c" "src/vnd/vnodeInt.c" - "src/vnd/vnodeOpen.c" "src/vnd/vnodeQuery.c" "src/vnd/vnodeStateMgr.c" "src/vnd/vnodeWrite.c" diff --git a/source/dnode/vnode/src/inc/vnd.h b/source/dnode/vnode/src/inc/vnd.h index 1cdb38b650..55b69a9e6e 100644 --- a/source/dnode/vnode/src/inc/vnd.h +++ b/source/dnode/vnode/src/inc/vnd.h @@ -30,6 +30,10 @@ extern "C" { #define vTrace(...) do { if (vDebugFlag & DEBUG_TRACE) { taosPrintLog("VND ", DEBUG_TRACE, vDebugFlag, __VA_ARGS__); }} while(0) // clang-format on +// vnodeCfg ==================== +int vnodeSaveCfg(const char* dir, const SVnodeCfg* pCfg); +int vnodeCommitCfg(const char* dir); + // vnodeModule ==================== int vnodeScheduleTask(int (*execute)(void*), void* arg); @@ -75,9 +79,9 @@ void vmaFree(SVMemAllocator* pVMA, void* ptr); bool vmaIsFull(SVMemAllocator* pVMA); // vnodeCfg.h -extern const SVnodeCfg defaultVnodeOptions; +extern const SVnodeCfg vnodeCfgDefault; -int vnodeValidateOptions(const SVnodeCfg*); +int vnodeCheckCfg(const SVnodeCfg*); void vnodeOptionsCopy(SVnodeCfg* pDest, const SVnodeCfg* pSrc); // For commit diff --git a/source/dnode/vnode/src/vnd/vnodeCfg.c b/source/dnode/vnode/src/vnd/vnodeCfg.c index ef417cabc6..8da9950aa7 100644 --- a/source/dnode/vnode/src/vnd/vnodeCfg.c +++ b/source/dnode/vnode/src/vnd/vnodeCfg.c @@ -15,14 +15,99 @@ #include "vnodeInt.h" -const SVnodeCfg defaultVnodeOptions = { - .wsize = 96 * 1024 * 1024, .ssize = 1 * 1024 * 1024, .lsize = 1024, .walCfg = {.level = TAOS_WAL_WRITE}}; /* TODO */ +#define VND_INFO_FNAME "vnode.json" +#define VND_INFO_FNAME_TMP "vnode_tmp.json" -int vnodeValidateOptions(const SVnodeCfg *pVnodeOptions) { +static int vnodeEncodeInfo(const SVnodeCfg *pCfg, uint8_t **ppData, int *len); +static int vnodeDecodeInfo(uint8_t *pData, int len, SVnodeCfg *pCfg); + +const SVnodeCfg vnodeCfgDefault = { + .wsize = 96 * 1024 * 1024, .ssize = 1 * 1024 * 1024, .lsize = 1024, .walCfg = {.level = TAOS_WAL_WRITE}}; + +int vnodeCheckCfg(const SVnodeCfg *pCfg) { // TODO return 0; } +int vnodeSaveCfg(const char *dir, const SVnodeCfg *pCfg) { + char fname[TSDB_FILENAME_LEN]; + TdFilePtr pFile; + uint8_t *data; + int len; + + snprintf(fname, TSDB_FILENAME_LEN, "%s%s%s", dir, TD_DIRSEP, VND_INFO_FNAME_TMP); + + // encode info + data = NULL; + len = 0; + + if (vnodeEncodeInfo(pCfg, &data, &len) < 0) { + return -1; + } + + // save info to a vnode_tmp.json + pFile = taosOpenFile(fname, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC); + if (pFile == NULL) { + terrno = TAOS_SYSTEM_ERROR(errno); + return -1; + } + + if (taosWriteFile(pFile, data, len) < 0) { + terrno = TAOS_SYSTEM_ERROR(errno); + goto _err; + } + + if (taosFsyncFile(pFile) < 0) { + terrno = TAOS_SYSTEM_ERROR(errno); + goto _err; + } + + taosCloseFile(&pFile); + + // free info binary + taosMemoryFree(data); + + vInfo("vgId: %d vnode info is saved, fname: %s", pCfg->vgId, fname); + + return 0; + +_err: + taosCloseFile(&pFile); + taosMemoryFree(data); + return -1; +} + +int vnodeCommitCfg(const char *dir) { + char fname[TSDB_FILENAME_LEN]; + char tfname[TSDB_FILENAME_LEN]; + + snprintf(fname, TSDB_FILENAME_LEN, "%s%s%s", dir, TD_DIRSEP, VND_INFO_FNAME); + snprintf(tfname, TSDB_FILENAME_LEN, "%s%s%s", dir, TD_DIRSEP, VND_INFO_FNAME_TMP); + + if (taosRenameFile(tfname, fname) < 0) { + terrno = TAOS_SYSTEM_ERROR(errno); + return -1; + } + + return 0; +} + +int vnodeLoadCfg(const char *dir) { + // TODO + return 0; +} + +static int vnodeEncodeInfo(const SVnodeCfg *pCfg, uint8_t **ppData, int *len) { + // TODO + return 0; +} + +static int vnodeDecodeInfo(uint8_t *pData, int len, SVnodeCfg *pCfg) { + // TODO + return 0; +} + +#if 1 //====================================================================== void vnodeOptionsCopy(SVnodeCfg *pDest, const SVnodeCfg *pSrc) { memcpy((void *)pDest, (void *)pSrc, sizeof(SVnodeCfg)); } @@ -46,3 +131,5 @@ int vnodeValidateTableHash(SVnodeCfg *pVnodeOptions, char *tableFName) { return TSDB_CODE_SUCCESS; } + +#endif \ No newline at end of file diff --git a/source/dnode/vnode/src/vnd/vnodeOpen.c b/source/dnode/vnode/src/vnd/vnodeOpen.c index f208857762..6729f7ce0c 100644 --- a/source/dnode/vnode/src/vnd/vnodeOpen.c +++ b/source/dnode/vnode/src/vnd/vnodeOpen.c @@ -21,8 +21,8 @@ static int vnodeOpenImpl(SVnode *pVnode); static void vnodeCloseImpl(SVnode *pVnode); int vnodeCreate(const char *path, SVnodeCfg *pCfg, STfs *pTfs) { -#if 0 char dir[TSDB_FILENAME_LEN]; + // TODO: check if directory exists // check config @@ -34,12 +34,11 @@ int vnodeCreate(const char *path, SVnodeCfg *pCfg, STfs *pTfs) { // create vnode env tfsMkdir(pTfs, path); snprintf(dir, TSDB_FILENAME_LEN, "%s%s%s", tfsGetPrimaryPath(pTfs), TD_DIRSEP, path); - if (vnodeSaveCfg(dir, pCfg) < 0) { + if (vnodeSaveCfg(dir, pCfg) < 0 || vnodeCommitCfg(dir) < 0) { vError("vgId: %d failed to save vnode config since %s", pCfg->vgId, tstrerror(terrno)); return -1; } -#endif return 0; } @@ -47,7 +46,7 @@ SVnode *vnodeOpen(const char *path, const SVnodeCfg *pVnodeCfg) { SVnode *pVnode = NULL; // Set default options - SVnodeCfg cfg = defaultVnodeOptions; + SVnodeCfg cfg = vnodeCfgDefault; if (pVnodeCfg != NULL) { cfg.vgId = pVnodeCfg->vgId; cfg.msgCb = pVnodeCfg->msgCb; @@ -59,7 +58,7 @@ SVnode *vnodeOpen(const char *path, const SVnodeCfg *pVnodeCfg) { } // Validate options - if (vnodeValidateOptions(&cfg) < 0) { + if (vnodeCheckCfg(&cfg) < 0) { // TODO return NULL; } From 1e73923c4dd7fb1cbf404574d0bf1f70d6f58e94 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 15 Apr 2022 13:31:08 +0800 Subject: [PATCH 14/37] test: reopen userTest --- .../dnode/mnode/impl/test/user/CMakeLists.txt | 10 +- source/dnode/mnode/impl/test/user/user.cpp | 121 ++---------------- 2 files changed, 17 insertions(+), 114 deletions(-) diff --git a/source/dnode/mnode/impl/test/user/CMakeLists.txt b/source/dnode/mnode/impl/test/user/CMakeLists.txt index c6aeef7221..b39ea0e73f 100644 --- a/source/dnode/mnode/impl/test/user/CMakeLists.txt +++ b/source/dnode/mnode/impl/test/user/CMakeLists.txt @@ -1,11 +1,11 @@ -aux_source_directory(. USER_SRC) -add_executable(mnode_test_user ${USER_SRC}) +aux_source_directory(. MNODE_USER_TEST_SRC) +add_executable(userTest ${MNODE_USER_TEST_SRC}) target_link_libraries( - mnode_test_user + userTest PUBLIC sut ) add_test( - NAME mnode_test_user - COMMAND mnode_test_user + NAME userTest + COMMAND userTest ) diff --git a/source/dnode/mnode/impl/test/user/user.cpp b/source/dnode/mnode/impl/test/user/user.cpp index 97a144fdee..4e7f3c0213 100644 --- a/source/dnode/mnode/impl/test/user/user.cpp +++ b/source/dnode/mnode/impl/test/user/user.cpp @@ -26,21 +26,8 @@ class MndTestUser : public ::testing::Test { Testbase MndTestUser::test; TEST_F(MndTestUser, 01_Show_User) { - test.SendShowMetaReq(TSDB_MGMT_TABLE_USER, ""); - CHECK_META("show users", 4); - - CHECK_SCHEMA(0, TSDB_DATA_TYPE_BINARY, TSDB_USER_LEN + VARSTR_HEADER_SIZE, "name"); - CHECK_SCHEMA(1, TSDB_DATA_TYPE_BINARY, 10 + VARSTR_HEADER_SIZE, "privilege"); - CHECK_SCHEMA(2, TSDB_DATA_TYPE_TIMESTAMP, 8, "create_time"); - CHECK_SCHEMA(3, TSDB_DATA_TYPE_BINARY, TSDB_USER_LEN + VARSTR_HEADER_SIZE, "account"); - - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", ""); EXPECT_EQ(test.GetShowRows(), 1); - - CheckBinary("root", TSDB_USER_LEN); - CheckBinary("super", 10); - CheckTimestamp(); - CheckBinary("root", TSDB_USER_LEN); } TEST_F(MndTestUser, 02_Create_User) { @@ -99,18 +86,8 @@ TEST_F(MndTestUser, 02_Create_User) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_USER, ""); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", ""); EXPECT_EQ(test.GetShowRows(), 2); - - CheckBinary("u1", TSDB_USER_LEN); - CheckBinary("root", TSDB_USER_LEN); - CheckBinary("normal", 10); - CheckBinary("super", 10); - CheckTimestamp(); - CheckTimestamp(); - CheckBinary("root", TSDB_USER_LEN); - CheckBinary("root", TSDB_USER_LEN); } { @@ -125,8 +102,7 @@ TEST_F(MndTestUser, 02_Create_User) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_USER, ""); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", ""); EXPECT_EQ(test.GetShowRows(), 1); } @@ -144,18 +120,8 @@ TEST_F(MndTestUser, 02_Create_User) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_USER, ""); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", ""); EXPECT_EQ(test.GetShowRows(), 2); - - CheckBinary("root", TSDB_USER_LEN); - CheckBinary("u2", TSDB_USER_LEN); - CheckBinary("super", 10); - CheckBinary("super", 10); - CheckTimestamp(); - CheckTimestamp(); - CheckBinary("root", TSDB_USER_LEN); - CheckBinary("root", TSDB_USER_LEN); } { @@ -170,8 +136,7 @@ TEST_F(MndTestUser, 02_Create_User) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_USER, ""); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", ""); EXPECT_EQ(test.GetShowRows(), 1); } } @@ -191,8 +156,7 @@ TEST_F(MndTestUser, 03_Alter_User) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_USER, ""); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", ""); EXPECT_EQ(test.GetShowRows(), 2); } @@ -437,8 +401,7 @@ TEST_F(MndTestUser, 03_Alter_User) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_USER, ""); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", ""); EXPECT_EQ(test.GetShowRows(), 1); } } @@ -497,10 +460,7 @@ TEST_F(MndTestUser, 05_Drop_User) { ASSERT_EQ(pRsp->code, 0); } - test.SendShowMetaReq(TSDB_MGMT_TABLE_USER, ""); - CHECK_META("show users", 4); - - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", ""); EXPECT_EQ(test.GetShowRows(), 1); } @@ -533,25 +493,9 @@ TEST_F(MndTestUser, 06_Create_Drop_Alter_User) { ASSERT_EQ(pRsp->code, 0); } - test.SendShowMetaReq(TSDB_MGMT_TABLE_USER, ""); - CHECK_META("show users", 4); - - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", ""); EXPECT_EQ(test.GetShowRows(), 3); - CheckBinary("u1", TSDB_USER_LEN); - CheckBinary("root", TSDB_USER_LEN); - CheckBinary("u2", TSDB_USER_LEN); - CheckBinary("normal", 10); - CheckBinary("super", 10); - CheckBinary("normal", 10); - CheckTimestamp(); - CheckTimestamp(); - CheckTimestamp(); - CheckBinary("root", TSDB_USER_LEN); - CheckBinary("root", TSDB_USER_LEN); - CheckBinary("root", TSDB_USER_LEN); - { SAlterUserReq alterReq = {0}; alterReq.alterType = TSDB_ALTER_USER_PASSWD; @@ -567,25 +511,8 @@ TEST_F(MndTestUser, 06_Create_Drop_Alter_User) { ASSERT_EQ(pRsp->code, 0); } - test.SendShowMetaReq(TSDB_MGMT_TABLE_USER, ""); - CHECK_META("show users", 4); - - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", ""); EXPECT_EQ(test.GetShowRows(), 3); - - CheckBinary("u1", TSDB_USER_LEN); - CheckBinary("root", TSDB_USER_LEN); - CheckBinary("u2", TSDB_USER_LEN); - CheckBinary("normal", 10); - CheckBinary("super", 10); - CheckBinary("normal", 10); - CheckTimestamp(); - CheckTimestamp(); - CheckTimestamp(); - CheckBinary("root", TSDB_USER_LEN); - CheckBinary("root", TSDB_USER_LEN); - CheckBinary("root", TSDB_USER_LEN); - { SDropUserReq dropReq = {0}; strcpy(dropReq.user, "u1"); @@ -599,37 +526,13 @@ TEST_F(MndTestUser, 06_Create_Drop_Alter_User) { ASSERT_EQ(pRsp->code, 0); } - test.SendShowMetaReq(TSDB_MGMT_TABLE_USER, ""); - CHECK_META("show users", 4); - - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", ""); EXPECT_EQ(test.GetShowRows(), 2); - CheckBinary("root", TSDB_USER_LEN); - CheckBinary("u2", TSDB_USER_LEN); - CheckBinary("super", 10); - CheckBinary("normal", 10); - CheckTimestamp(); - CheckTimestamp(); - CheckBinary("root", TSDB_USER_LEN); - CheckBinary("root", TSDB_USER_LEN); - // restart test.Restart(); taosMsleep(1000); - test.SendShowMetaReq(TSDB_MGMT_TABLE_USER, ""); - CHECK_META("show users", 4); - - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", ""); EXPECT_EQ(test.GetShowRows(), 2); - - CheckBinary("root", TSDB_USER_LEN); - CheckBinary("u2", TSDB_USER_LEN); - CheckBinary("super", 10); - CheckBinary("normal", 10); - CheckTimestamp(); - CheckTimestamp(); - CheckBinary("root", TSDB_USER_LEN); - CheckBinary("root", TSDB_USER_LEN); } From 1592ea69d5ab71f8cfc303359078dba429b526a1 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Fri, 15 Apr 2022 05:47:57 +0000 Subject: [PATCH 15/37] refact vnod --- source/dnode/vnode/src/inc/vnd.h | 6 +- source/dnode/vnode/src/inc/vnodeInt.h | 6 ++ source/dnode/vnode/src/vnd/vnodeCfg.c | 84 ----------------------- source/dnode/vnode/src/vnd/vnodeCommit.c | 87 +++++++++++++++++++++++- source/dnode/vnode/src/vnd/vnodeOpen.c | 13 +++- 5 files changed, 106 insertions(+), 90 deletions(-) diff --git a/source/dnode/vnode/src/inc/vnd.h b/source/dnode/vnode/src/inc/vnd.h index 55b69a9e6e..913fec64ed 100644 --- a/source/dnode/vnode/src/inc/vnd.h +++ b/source/dnode/vnode/src/inc/vnd.h @@ -31,8 +31,6 @@ extern "C" { // clang-format on // vnodeCfg ==================== -int vnodeSaveCfg(const char* dir, const SVnodeCfg* pCfg); -int vnodeCommitCfg(const char* dir); // vnodeModule ==================== int vnodeScheduleTask(int (*execute)(void*), void* arg); @@ -42,6 +40,10 @@ int vnodeQueryOpen(SVnode* pVnode); void vnodeQueryClose(SVnode* pVnode); int vnodeGetTableMeta(SVnode* pVnode, SRpcMsg* pMsg); +// vnodeCommit ==================== +int vnodeSaveInfo(const char* dir, const SVnodeInfo* pCfg); +int vnodeCommitInfo(const char* dir, const SVnodeInfo* pInfo); + #if 1 // SVBufPool int vnodeOpenBufPool(SVnode* pVnode); diff --git a/source/dnode/vnode/src/inc/vnodeInt.h b/source/dnode/vnode/src/inc/vnodeInt.h index f988df01cb..b0b87665ed 100644 --- a/source/dnode/vnode/src/inc/vnodeInt.h +++ b/source/dnode/vnode/src/inc/vnodeInt.h @@ -43,6 +43,7 @@ extern "C" { #endif +typedef struct SVnodeInfo SVnodeInfo; typedef struct SMeta SMeta; typedef struct STsdb STsdb; typedef struct STQ STQ; @@ -72,6 +73,11 @@ struct SVState { int64_t applied; }; +struct SVnodeInfo { + SVnodeCfg config; + SVState state; +}; + struct SVnode { int32_t vgId; char* path; diff --git a/source/dnode/vnode/src/vnd/vnodeCfg.c b/source/dnode/vnode/src/vnd/vnodeCfg.c index 8da9950aa7..34b983c20c 100644 --- a/source/dnode/vnode/src/vnd/vnodeCfg.c +++ b/source/dnode/vnode/src/vnd/vnodeCfg.c @@ -15,12 +15,6 @@ #include "vnodeInt.h" -#define VND_INFO_FNAME "vnode.json" -#define VND_INFO_FNAME_TMP "vnode_tmp.json" - -static int vnodeEncodeInfo(const SVnodeCfg *pCfg, uint8_t **ppData, int *len); -static int vnodeDecodeInfo(uint8_t *pData, int len, SVnodeCfg *pCfg); - const SVnodeCfg vnodeCfgDefault = { .wsize = 96 * 1024 * 1024, .ssize = 1 * 1024 * 1024, .lsize = 1024, .walCfg = {.level = TAOS_WAL_WRITE}}; @@ -29,84 +23,6 @@ int vnodeCheckCfg(const SVnodeCfg *pCfg) { return 0; } -int vnodeSaveCfg(const char *dir, const SVnodeCfg *pCfg) { - char fname[TSDB_FILENAME_LEN]; - TdFilePtr pFile; - uint8_t *data; - int len; - - snprintf(fname, TSDB_FILENAME_LEN, "%s%s%s", dir, TD_DIRSEP, VND_INFO_FNAME_TMP); - - // encode info - data = NULL; - len = 0; - - if (vnodeEncodeInfo(pCfg, &data, &len) < 0) { - return -1; - } - - // save info to a vnode_tmp.json - pFile = taosOpenFile(fname, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC); - if (pFile == NULL) { - terrno = TAOS_SYSTEM_ERROR(errno); - return -1; - } - - if (taosWriteFile(pFile, data, len) < 0) { - terrno = TAOS_SYSTEM_ERROR(errno); - goto _err; - } - - if (taosFsyncFile(pFile) < 0) { - terrno = TAOS_SYSTEM_ERROR(errno); - goto _err; - } - - taosCloseFile(&pFile); - - // free info binary - taosMemoryFree(data); - - vInfo("vgId: %d vnode info is saved, fname: %s", pCfg->vgId, fname); - - return 0; - -_err: - taosCloseFile(&pFile); - taosMemoryFree(data); - return -1; -} - -int vnodeCommitCfg(const char *dir) { - char fname[TSDB_FILENAME_LEN]; - char tfname[TSDB_FILENAME_LEN]; - - snprintf(fname, TSDB_FILENAME_LEN, "%s%s%s", dir, TD_DIRSEP, VND_INFO_FNAME); - snprintf(tfname, TSDB_FILENAME_LEN, "%s%s%s", dir, TD_DIRSEP, VND_INFO_FNAME_TMP); - - if (taosRenameFile(tfname, fname) < 0) { - terrno = TAOS_SYSTEM_ERROR(errno); - return -1; - } - - return 0; -} - -int vnodeLoadCfg(const char *dir) { - // TODO - return 0; -} - -static int vnodeEncodeInfo(const SVnodeCfg *pCfg, uint8_t **ppData, int *len) { - // TODO - return 0; -} - -static int vnodeDecodeInfo(uint8_t *pData, int len, SVnodeCfg *pCfg) { - // TODO - return 0; -} - #if 1 //====================================================================== void vnodeOptionsCopy(SVnodeCfg *pDest, const SVnodeCfg *pSrc) { memcpy((void *)pDest, (void *)pSrc, sizeof(SVnodeCfg)); diff --git a/source/dnode/vnode/src/vnd/vnodeCommit.c b/source/dnode/vnode/src/vnd/vnodeCommit.c index b4c3725a5e..fc74ee9253 100644 --- a/source/dnode/vnode/src/vnd/vnodeCommit.c +++ b/source/dnode/vnode/src/vnd/vnodeCommit.c @@ -15,11 +15,86 @@ #include "vnodeInt.h" +#define VND_INFO_FNAME "vnode.json" +#define VND_INFO_FNAME_TMP "vnode_tmp.json" + +static int vnodeEncodeInfo(const SVnodeInfo *pInfo, uint8_t **ppData, int *len); +static int vnodeDecodeInfo(uint8_t *pData, int len, SVnodeInfo *pInfo); static int vnodeStartCommit(SVnode *pVnode); static int vnodeEndCommit(SVnode *pVnode); static int vnodeCommit(void *arg); static void vnodeWaitCommit(SVnode *pVnode); +int vnodeSaveInfo(const char *dir, const SVnodeInfo *pInfo) { + char fname[TSDB_FILENAME_LEN]; + TdFilePtr pFile; + uint8_t *data; + int len; + + snprintf(fname, TSDB_FILENAME_LEN, "%s%s%s", dir, TD_DIRSEP, VND_INFO_FNAME_TMP); + + // encode info + data = NULL; + len = 0; + + if (vnodeEncodeInfo(pInfo, &data, &len) < 0) { + return -1; + } + + // save info to a vnode_tmp.json + pFile = taosOpenFile(fname, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC); + if (pFile == NULL) { + terrno = TAOS_SYSTEM_ERROR(errno); + return -1; + } + + if (taosWriteFile(pFile, data, len) < 0) { + terrno = TAOS_SYSTEM_ERROR(errno); + goto _err; + } + + if (taosFsyncFile(pFile) < 0) { + terrno = TAOS_SYSTEM_ERROR(errno); + goto _err; + } + + taosCloseFile(&pFile); + + // free info binary + taosMemoryFree(data); + + vInfo("vgId: %d vnode info is saved, fname: %s", pInfo->config.vgId, fname); + + return 0; + +_err: + taosCloseFile(&pFile); + taosMemoryFree(data); + return -1; +} + +int vnodeCommitInfo(const char *dir, const SVnodeInfo *pInfo) { + char fname[TSDB_FILENAME_LEN]; + char tfname[TSDB_FILENAME_LEN]; + + snprintf(fname, TSDB_FILENAME_LEN, "%s%s%s", dir, TD_DIRSEP, VND_INFO_FNAME); + snprintf(tfname, TSDB_FILENAME_LEN, "%s%s%s", dir, TD_DIRSEP, VND_INFO_FNAME_TMP); + + if (taosRenameFile(tfname, fname) < 0) { + terrno = TAOS_SYSTEM_ERROR(errno); + return -1; + } + + vInfo("vgId: %d vnode info is committed", pInfo->config.vgId); + + return 0; +} + +int vnodeLoadInfo(const char *dir) { + // TODO + return 0; +} + int vnodeAsyncCommit(SVnode *pVnode) { vnodeWaitCommit(pVnode); @@ -60,4 +135,14 @@ static int vnodeEndCommit(SVnode *pVnode) { return 0; } -static FORCE_INLINE void vnodeWaitCommit(SVnode *pVnode) { tsem_wait(&pVnode->canCommit); } \ No newline at end of file +static FORCE_INLINE void vnodeWaitCommit(SVnode *pVnode) { tsem_wait(&pVnode->canCommit); } + +static int vnodeEncodeInfo(const SVnodeInfo *pInfo, uint8_t **ppData, int *len) { + // TODO + return 0; +} + +static int vnodeDecodeInfo(uint8_t *pData, int len, SVnodeInfo *pInfo) { + // TODO + return 0; +} diff --git a/source/dnode/vnode/src/vnd/vnodeOpen.c b/source/dnode/vnode/src/vnd/vnodeOpen.c index 6729f7ce0c..5fa14f6018 100644 --- a/source/dnode/vnode/src/vnd/vnodeOpen.c +++ b/source/dnode/vnode/src/vnd/vnodeOpen.c @@ -21,7 +21,8 @@ static int vnodeOpenImpl(SVnode *pVnode); static void vnodeCloseImpl(SVnode *pVnode); int vnodeCreate(const char *path, SVnodeCfg *pCfg, STfs *pTfs) { - char dir[TSDB_FILENAME_LEN]; + SVnodeInfo info = {0}; + char dir[TSDB_FILENAME_LEN]; // TODO: check if directory exists @@ -32,9 +33,15 @@ int vnodeCreate(const char *path, SVnodeCfg *pCfg, STfs *pTfs) { } // create vnode env - tfsMkdir(pTfs, path); + if (tfsMkdir(pTfs, path) < 0) { + vError("vgId: %d failed to create vnode since: %s", pCfg->vgId, tstrerror(terrno)); + return -1; + } + snprintf(dir, TSDB_FILENAME_LEN, "%s%s%s", tfsGetPrimaryPath(pTfs), TD_DIRSEP, path); - if (vnodeSaveCfg(dir, pCfg) < 0 || vnodeCommitCfg(dir) < 0) { + info.config = *pCfg; + + if (vnodeSaveInfo(dir, &info) < 0 || vnodeCommitInfo(dir, &info) < 0) { vError("vgId: %d failed to save vnode config since %s", pCfg->vgId, tstrerror(terrno)); return -1; } From 2b7ec5743cc2ce3759b576b978bf0f61169bd42d Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 15 Apr 2022 13:57:32 +0800 Subject: [PATCH 16/37] test: reopen transTest --- source/dnode/mnode/impl/inc/mndDb.h | 2 +- source/dnode/mnode/impl/src/mndDb.c | 4 +- source/dnode/mnode/impl/src/mndShow.c | 9 ++- source/dnode/mnode/impl/src/mndTrans.c | 50 ++++++------- .../mnode/impl/test/trans/CMakeLists.txt | 10 +-- source/dnode/mnode/impl/test/trans/trans.cpp | 75 ++++--------------- 6 files changed, 56 insertions(+), 94 deletions(-) diff --git a/source/dnode/mnode/impl/inc/mndDb.h b/source/dnode/mnode/impl/inc/mndDb.h index c0b25d74d1..146c6e2523 100644 --- a/source/dnode/mnode/impl/inc/mndDb.h +++ b/source/dnode/mnode/impl/inc/mndDb.h @@ -27,7 +27,7 @@ void mndCleanupDb(SMnode *pMnode); SDbObj *mndAcquireDb(SMnode *pMnode, const char *db); void mndReleaseDb(SMnode *pMnode, SDbObj *pDb); int32_t mndValidateDbInfo(SMnode *pMnode, SDbVgVersion *pDbs, int32_t numOfDbs, void **ppRsp, int32_t *pRspLen); -char *mnGetDbStr(char *src); +char *mndGetDbStr(char *src); int32_t mndExtractDbInfo(SMnode *pMnode, SDbObj *pDb, SUseDbRsp *pRsp, const SUseDbReq *pReq); #ifdef __cplusplus diff --git a/source/dnode/mnode/impl/src/mndDb.c b/source/dnode/mnode/impl/src/mndDb.c index 3db4e9870e..2ea95f8f8d 100644 --- a/source/dnode/mnode/impl/src/mndDb.c +++ b/source/dnode/mnode/impl/src/mndDb.c @@ -1340,7 +1340,7 @@ SYNC_DB_OVER: return code; } -char *mnGetDbStr(char *src) { +char *mndGetDbStr(char *src) { char *pos = strstr(src, TS_PATH_DELIMITER); if (pos != NULL) ++pos; @@ -1355,7 +1355,7 @@ static void dumpDbInfoData(SSDataBlock* pBlock, SDbObj *pDb, SShowObj *pShow, in int32_t cols = 0; char* buf = taosMemoryMalloc(pShow->bytes[cols]); - char *name = mnGetDbStr(pDb->name); + char *name = mndGetDbStr(pDb->name); if (name != NULL) { STR_WITH_MAXSIZE_TO_VARSTR(buf, name, pShow->bytes[cols]); } else { diff --git a/source/dnode/mnode/impl/src/mndShow.c b/source/dnode/mnode/impl/src/mndShow.c index 617cebf61d..1a14c94640 100644 --- a/source/dnode/mnode/impl/src/mndShow.c +++ b/source/dnode/mnode/impl/src/mndShow.c @@ -131,6 +131,13 @@ static int32_t mndProcessRetrieveSysTableReq(SNodeMsg *pReq) { req.type = retrieveReq.type; strncpy(req.db, retrieveReq.db, tListLen(req.db)); + STableMetaRsp *pMeta = (STableMetaRsp *)taosHashGet(pMnode->infosMeta, retrieveReq.tb, strlen(retrieveReq.tb) + 1); + if (pMeta == NULL) { + terrno = TSDB_CODE_MND_INVALID_INFOS_TBL; + mError("failed to process show-retrieve req:%p since %s", pShow, terrstr()); + return -1; + } + pShow = mndCreateShowObj(pMnode, &req); if (pShow == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; @@ -138,7 +145,7 @@ static int32_t mndProcessRetrieveSysTableReq(SNodeMsg *pReq) { return -1; } - pShow->pMeta = (STableMetaRsp *)taosHashGet(pMnode->infosMeta, retrieveReq.tb, strlen(retrieveReq.tb) + 1); + pShow->pMeta = pMeta; pShow->numOfColumns = pShow->pMeta->numOfColumns; int32_t offset = 0; diff --git a/source/dnode/mnode/impl/src/mndTrans.c b/source/dnode/mnode/impl/src/mndTrans.c index 537ddc03c3..59fe7d16b9 100644 --- a/source/dnode/mnode/impl/src/mndTrans.c +++ b/source/dnode/mnode/impl/src/mndTrans.c @@ -58,7 +58,7 @@ static void mndTransSendRpcRsp(SMnode *pMnode, STrans *pTrans); static int32_t mndProcessTransReq(SNodeMsg *pReq); static int32_t mndProcessKillTransReq(SNodeMsg *pReq); -static int32_t mndRetrieveTrans(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows); +static int32_t mndRetrieveTrans(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows); static void mndCancelGetNextTrans(SMnode *pMnode, void *pIter); int32_t mndInitTrans(SMnode *pMnode) { @@ -73,7 +73,7 @@ int32_t mndInitTrans(SMnode *pMnode) { mndSetMsgHandle(pMnode, TDMT_MND_TRANS_TIMER, mndProcessTransReq); mndSetMsgHandle(pMnode, TDMT_MND_KILL_TRANS, mndProcessKillTransReq); -// mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_TRANS, mndRetrieveTrans); + mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_TRANS, mndRetrieveTrans); mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_TRANS, mndCancelGetNextTrans); return sdbSetTable(pMnode->pSdb, table); } @@ -1259,7 +1259,7 @@ void mndTransPullup(SMnode *pMnode) { sdbWriteFile(pMnode->pSdb); } -static int32_t mndRetrieveTrans(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows) { +static int32_t mndRetrieveTrans(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows) { SMnode *pMnode = pReq->pNode; SSdb *pSdb = pMnode->pSdb; int32_t numOfRows = 0; @@ -1273,34 +1273,34 @@ static int32_t mndRetrieveTrans(SNodeMsg *pReq, SShowObj *pShow, char *data, int cols = 0; - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - *(int32_t *)pWrite = pTrans->id; - cols++; + SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char *)&pTrans->id, false); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - *(int64_t *)pWrite = pTrans->createdTime; - cols++; + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char *)&pTrans->createdTime, false); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - STR_TO_VARSTR(pWrite, mndTransStr(pTrans->stage)); - cols++; + char stage[TSDB_TRANS_STAGE_LEN + VARSTR_HEADER_SIZE] = {0}; + STR_WITH_MAXSIZE_TO_VARSTR(stage, mndTransStr(pTrans->stage), pShow->bytes[cols]); + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char *)stage, false); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - char *name = mnGetDbStr(pTrans->dbname); - STR_WITH_MAXSIZE_TO_VARSTR(pWrite, name, pShow->bytes[cols]); - cols++; + char dbname[TSDB_DB_NAME_LEN + VARSTR_HEADER_SIZE] = {0}; + STR_WITH_MAXSIZE_TO_VARSTR(dbname, mndGetDbStr(pTrans->dbname), pShow->bytes[cols]); + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char *)dbname, false); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - STR_TO_VARSTR(pWrite, mndTransType(pTrans->transType)); - cols++; + char transType[TSDB_TRANS_TYPE_LEN + VARSTR_HEADER_SIZE] = {0}; + STR_WITH_MAXSIZE_TO_VARSTR(dbname, mndTransType(pTrans->transType), pShow->bytes[cols]); + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char *)transType, false); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - *(int64_t *)pWrite = pTrans->lastExecTime; - cols++; + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char *)&pTrans->lastExecTime, false); - pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - STR_TO_VARSTR(pWrite, pTrans->lastError); - cols++; + char lastError[TSDB_TRANS_ERROR_LEN + VARSTR_HEADER_SIZE] = {0}; + STR_WITH_MAXSIZE_TO_VARSTR(dbname, pTrans->lastError, pShow->bytes[cols]); + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataAppend(pColInfo, numOfRows, (const char *)lastError, false); numOfRows++; sdbRelease(pSdb, pTrans); diff --git a/source/dnode/mnode/impl/test/trans/CMakeLists.txt b/source/dnode/mnode/impl/test/trans/CMakeLists.txt index d7c9756794..fa0ef9f263 100644 --- a/source/dnode/mnode/impl/test/trans/CMakeLists.txt +++ b/source/dnode/mnode/impl/test/trans/CMakeLists.txt @@ -1,11 +1,11 @@ -aux_source_directory(. TRANS_SRC) -add_executable(mnode_test_trans ${TRANS_SRC}) +aux_source_directory(. MNODE_TRANS_TEST_SRC) +add_executable(transTest ${MNODE_TRANS_TEST_SRC}) target_link_libraries( - mnode_test_trans + transTest PUBLIC sut ) add_test( - NAME mnode_test_trans - COMMAND mnode_test_trans + NAME transTest + COMMAND transTest ) diff --git a/source/dnode/mnode/impl/test/trans/trans.cpp b/source/dnode/mnode/impl/test/trans/trans.cpp index 560b30d13c..bcf6fe8536 100644 --- a/source/dnode/mnode/impl/test/trans/trans.cpp +++ b/source/dnode/mnode/impl/test/trans/trans.cpp @@ -26,11 +26,11 @@ class MndTestTrans : public ::testing::Test { } static void KillThenRestartServer() { - char file[PATH_MAX] = "/tmp/mnode_test_trans/mnode/data/sdb.data"; + char file[PATH_MAX] = "/tmp/mnode_test_trans/mnode/data/sdb.data"; TdFilePtr pFile = taosOpenFile(file, TD_FILE_READ); - int32_t size = 3 * 1024 * 1024; - void* buffer = taosMemoryMalloc(size); - int32_t readLen = taosReadFile(pFile, buffer, size); + int32_t size = 3 * 1024 * 1024; + void* buffer = taosMemoryMalloc(size); + int32_t readLen = taosReadFile(pFile, buffer, size); if (readLen < 0 || readLen == size) { ASSERT(1); } @@ -65,18 +65,7 @@ TestServer MndTestTrans::server2; TEST_F(MndTestTrans, 00_Create_User_Crash) { { - test.SendShowMetaReq(TSDB_MGMT_TABLE_TRANS, ""); - CHECK_META("show trans", 7); - - CHECK_SCHEMA(0, TSDB_DATA_TYPE_INT, 4, "id"); - CHECK_SCHEMA(1, TSDB_DATA_TYPE_TIMESTAMP, 8, "create_time"); - CHECK_SCHEMA(2, TSDB_DATA_TYPE_BINARY, TSDB_TRANS_STAGE_LEN + VARSTR_HEADER_SIZE, "stage"); - CHECK_SCHEMA(3, TSDB_DATA_TYPE_BINARY, TSDB_DB_NAME_LEN - 1 + VARSTR_HEADER_SIZE, "db"); - CHECK_SCHEMA(4, TSDB_DATA_TYPE_BINARY, TSDB_TRANS_TYPE_LEN + VARSTR_HEADER_SIZE, "type"); - CHECK_SCHEMA(5, TSDB_DATA_TYPE_TIMESTAMP, 8, "last_exec_time"); - CHECK_SCHEMA(6, TSDB_DATA_TYPE_BINARY, TSDB_TRANS_ERROR_LEN - 1 + VARSTR_HEADER_SIZE, "last_error"); - - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_TRANS, "trans", ""); EXPECT_EQ(test.GetShowRows(), 0); } @@ -109,26 +98,13 @@ TEST_F(MndTestTrans, 01_Create_User_Crash) { ASSERT_EQ(pRsp->code, 0); } - test.SendShowMetaReq(TSDB_MGMT_TABLE_USER, ""); - CHECK_META("show users", 4); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", ""); EXPECT_EQ(test.GetShowRows(), 2); KillThenRestartServer(); - test.SendShowMetaReq(TSDB_MGMT_TABLE_USER, ""); - CHECK_META("show users", 4); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", ""); EXPECT_EQ(test.GetShowRows(), 2); - - CheckBinary("u1", TSDB_USER_LEN); - CheckBinary("root", TSDB_USER_LEN); - CheckBinary("normal", 10); - CheckBinary("super", 10); - CheckTimestamp(); - CheckTimestamp(); - CheckBinary("root", TSDB_USER_LEN); - CheckBinary("root", TSDB_USER_LEN); } TEST_F(MndTestTrans, 02_Create_Qnode1_Crash) { @@ -144,9 +120,7 @@ TEST_F(MndTestTrans, 02_Create_Qnode1_Crash) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_QNODE, ""); - CHECK_META("show qnodes", 3); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_QNODE, "qnodes", ""); EXPECT_EQ(test.GetShowRows(), 1); } @@ -163,9 +137,7 @@ TEST_F(MndTestTrans, 02_Create_Qnode1_Crash) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, TSDB_CODE_MND_QNODE_ALREADY_EXIST); - test.SendShowMetaReq(TSDB_MGMT_TABLE_QNODE, ""); - CHECK_META("show qnodes", 3); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_QNODE, "qnodes", ""); EXPECT_EQ(test.GetShowRows(), 1); } } @@ -185,8 +157,7 @@ TEST_F(MndTestTrans, 03_Create_Qnode2_Crash) { ASSERT_EQ(pRsp->code, 0); taosMsleep(1300); - test.SendShowMetaReq(TSDB_MGMT_TABLE_DNODE, ""); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_DNODE, "dnodes", ""); EXPECT_EQ(test.GetShowRows(), 2); } @@ -208,18 +179,8 @@ TEST_F(MndTestTrans, 03_Create_Qnode2_Crash) { { // show trans - test.SendShowMetaReq(TSDB_MGMT_TABLE_TRANS, ""); - CHECK_META("show trans", 7); - test.SendShowRetrieveReq(); - + test.SendShowReq(TSDB_MGMT_TABLE_TRANS, "trans", ""); EXPECT_EQ(test.GetShowRows(), 1); - CheckInt32(4); - CheckTimestamp(); - CheckBinary("undoAction", TSDB_TRANS_STAGE_LEN); - CheckBinary("", TSDB_DB_NAME_LEN - 1); - CheckBinary("create-qnode", TSDB_TRANS_TYPE_LEN); - CheckTimestamp(); - CheckBinary("Unable to establish connection", TSDB_TRANS_ERROR_LEN - 1); } // kill trans @@ -238,8 +199,7 @@ TEST_F(MndTestTrans, 03_Create_Qnode2_Crash) { // show trans { - test.SendShowMetaReq(TSDB_MGMT_TABLE_TRANS, ""); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_TRANS, "trans", ""); EXPECT_EQ(test.GetShowRows(), 0); } @@ -258,11 +218,9 @@ TEST_F(MndTestTrans, 03_Create_Qnode2_Crash) { ASSERT_EQ(pRsp->code, TSDB_CODE_RPC_NETWORK_UNAVAIL); } - uInfo("======== kill and restart server") - KillThenRestartServer(); + uInfo("======== kill and restart server") KillThenRestartServer(); - uInfo("======== server2 start") - server2.DoStart(); + uInfo("======== server2 start") server2.DoStart(); uInfo("======== server2 started") @@ -286,14 +244,11 @@ TEST_F(MndTestTrans, 03_Create_Qnode2_Crash) { ASSERT_NE(retry, retryMax); - test.SendShowMetaReq(TSDB_MGMT_TABLE_QNODE, ""); - CHECK_META("show qnodes", 3); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_QNODE, "qnodes", ""); EXPECT_EQ(test.GetShowRows(), 2); } } - // create db // partial create stb // drop db failed From 81016a98cec04b8d61358455a1b7a9c74f2d88aa Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 15 Apr 2022 13:58:08 +0800 Subject: [PATCH 17/37] test: reopen topicTest --- source/dnode/mnode/impl/test/topic/CMakeLists.txt | 10 +++++----- source/dnode/mnode/impl/test/topic/topic.cpp | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/source/dnode/mnode/impl/test/topic/CMakeLists.txt b/source/dnode/mnode/impl/test/topic/CMakeLists.txt index 63a77713d6..076228ec9d 100644 --- a/source/dnode/mnode/impl/test/topic/CMakeLists.txt +++ b/source/dnode/mnode/impl/test/topic/CMakeLists.txt @@ -1,11 +1,11 @@ -aux_source_directory(. TOPIC_SRC) -add_executable(mnode_test_topic ${TOPIC_SRC}) +aux_source_directory(. MNODE_TOPIC_TEST_SRC) +add_executable(topicTest ${MNODE_TOPIC_TEST_SRC}) target_link_libraries( - mnode_test_topic + topicTest PUBLIC sut ) add_test( - NAME mnode_test_topic - COMMAND mnode_test_topic + NAME topicTest + COMMAND topicTest ) diff --git a/source/dnode/mnode/impl/test/topic/topic.cpp b/source/dnode/mnode/impl/test/topic/topic.cpp index 2111d61e3f..ee47a3c8b4 100644 --- a/source/dnode/mnode/impl/test/topic/topic.cpp +++ b/source/dnode/mnode/impl/test/topic/topic.cpp @@ -101,7 +101,7 @@ TEST_F(MndTestTopic, 01_Create_Topic) { ASSERT_EQ(pRsp->code, 0); } - { test.SendShowMetaReq(TSDB_MGMT_TABLE_TOPICS, ""); } + { test.SendShowReq(TSDB_MGMT_TABLE_TOPICS, ""); } { int32_t contLen = 0; @@ -128,7 +128,7 @@ TEST_F(MndTestTopic, 01_Create_Topic) { } { - test.SendShowMetaReq(TSDB_MGMT_TABLE_TOPICS, dbname); + test.SendShowReq(TSDB_MGMT_TABLE_TOPICS, dbname); CHECK_META("show topics", 3); CHECK_SCHEMA(0, TSDB_DATA_TYPE_BINARY, TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE, "name"); @@ -145,7 +145,7 @@ TEST_F(MndTestTopic, 01_Create_Topic) { // restart test.Restart(); - test.SendShowMetaReq(TSDB_MGMT_TABLE_TOPICS, dbname); + test.SendShowReq(TSDB_MGMT_TABLE_TOPICS, dbname); test.SendShowRetrieveReq(); EXPECT_EQ(test.GetShowRows(), 1); @@ -169,7 +169,7 @@ TEST_F(MndTestTopic, 01_Create_Topic) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, TSDB_CODE_MND_TOPIC_NOT_EXIST); - test.SendShowMetaReq(TSDB_MGMT_TABLE_TOPICS, dbname); + test.SendShowReq(TSDB_MGMT_TABLE_TOPICS, dbname); test.SendShowRetrieveReq(); EXPECT_EQ(test.GetShowRows(), 0); } From ef1a0683385bc4173c3089d936ac2caf3017db8e Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 15 Apr 2022 14:00:59 +0800 Subject: [PATCH 18/37] test: reopen stbTest --- .../dnode/mnode/impl/test/stb/CMakeLists.txt | 8 +- source/dnode/mnode/impl/test/stb/stb.cpp | 78 +++---------------- 2 files changed, 15 insertions(+), 71 deletions(-) diff --git a/source/dnode/mnode/impl/test/stb/CMakeLists.txt b/source/dnode/mnode/impl/test/stb/CMakeLists.txt index 70e20d3411..d2fe387997 100644 --- a/source/dnode/mnode/impl/test/stb/CMakeLists.txt +++ b/source/dnode/mnode/impl/test/stb/CMakeLists.txt @@ -5,7 +5,7 @@ target_link_libraries( PUBLIC sut ) -#add_test( -# NAME mnode_test_stb -# COMMAND mnode_test_stb -#) +add_test( + NAME stbTest + COMMAND stbTest +) diff --git a/source/dnode/mnode/impl/test/stb/stb.cpp b/source/dnode/mnode/impl/test/stb/stb.cpp index f45c0795cd..f8f8799c9f 100644 --- a/source/dnode/mnode/impl/test/stb/stb.cpp +++ b/source/dnode/mnode/impl/test/stb/stb.cpp @@ -43,7 +43,7 @@ void* MndTestStb::BuildCreateDbReq(const char* dbname, int32_t* pContLen) { createReq.numOfVgroups = 2; createReq.cacheBlockSize = 16; createReq.totalBlocks = 10; - createReq.daysPerFile = 10; + createReq.daysPerFile = 1000; createReq.daysToKeep0 = 3650; createReq.daysToKeep1 = 3650; createReq.daysToKeep2 = 3650; @@ -314,19 +314,8 @@ TEST_F(MndTestStb, 01_Create_Show_Meta_Drop_Restart_Stb) { } { - test.SendShowMetaReq(TSDB_MGMT_TABLE_STB, dbname); - CHECK_META("show stables", 4); - CHECK_SCHEMA(0, TSDB_DATA_TYPE_BINARY, TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE, "name"); - CHECK_SCHEMA(1, TSDB_DATA_TYPE_TIMESTAMP, 8, "create_time"); - CHECK_SCHEMA(2, TSDB_DATA_TYPE_INT, 4, "columns"); - CHECK_SCHEMA(3, TSDB_DATA_TYPE_INT, 4, "tags"); - - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_STB, "user_stables", dbname); EXPECT_EQ(test.GetShowRows(), 1); - CheckBinary("stb", TSDB_TABLE_NAME_LEN); - CheckTimestamp(); - CheckInt32(2); - CheckInt32(3); } // ----- meta ------ @@ -407,15 +396,8 @@ TEST_F(MndTestStb, 01_Create_Show_Meta_Drop_Restart_Stb) { test.Restart(); { - test.SendShowMetaReq(TSDB_MGMT_TABLE_STB, dbname); - CHECK_META("show stables", 4); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_STB, "user_stables", dbname); EXPECT_EQ(test.GetShowRows(), 1); - - CheckBinary("stb", TSDB_TABLE_NAME_LEN); - CheckTimestamp(); - CheckInt32(2); - CheckInt32(3); } { @@ -432,9 +414,7 @@ TEST_F(MndTestStb, 01_Create_Show_Meta_Drop_Restart_Stb) { } { - test.SendShowMetaReq(TSDB_MGMT_TABLE_STB, dbname); - CHECK_META("show stables", 4); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_STB, "user_stables", dbname); EXPECT_EQ(test.GetShowRows(), 0); } @@ -496,13 +476,7 @@ TEST_F(MndTestStb, 02_Alter_Stb_AddTag) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_STB, dbname); - test.SendShowRetrieveReq(); - EXPECT_EQ(test.GetShowRows(), 1); - CheckBinary("stb", TSDB_TABLE_NAME_LEN); - CheckTimestamp(); - CheckInt32(2); - CheckInt32(4); + test.SendShowReq(TSDB_MGMT_TABLE_STB, "user_stables", dbname); } { @@ -542,13 +516,8 @@ TEST_F(MndTestStb, 03_Alter_Stb_DropTag) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_STB, dbname); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_STB, "user_stables", dbname); EXPECT_EQ(test.GetShowRows(), 1); - CheckBinary("stb", TSDB_TABLE_NAME_LEN); - CheckTimestamp(); - CheckInt32(2); - CheckInt32(2); } { @@ -611,13 +580,8 @@ TEST_F(MndTestStb, 04_Alter_Stb_AlterTagName) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_STB, dbname); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_STB, "user_stables", dbname); EXPECT_EQ(test.GetShowRows(), 1); - CheckBinary("stb", TSDB_TABLE_NAME_LEN); - CheckTimestamp(); - CheckInt32(2); - CheckInt32(3); } { @@ -668,13 +632,8 @@ TEST_F(MndTestStb, 05_Alter_Stb_AlterTagBytes) { SRpcMsg* pRsp = test.SendReq(TDMT_MND_ALTER_STB, pReq, contLen); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_STB, dbname); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_STB, "user_stables", dbname); EXPECT_EQ(test.GetShowRows(), 1); - CheckBinary("stb", TSDB_TABLE_NAME_LEN); - CheckTimestamp(); - CheckInt32(2); - CheckInt32(3); } { @@ -734,13 +693,8 @@ TEST_F(MndTestStb, 06_Alter_Stb_AddColumn) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_STB, dbname); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_STB, "user_stables", dbname); EXPECT_EQ(test.GetShowRows(), 1); - CheckBinary("stb", TSDB_TABLE_NAME_LEN); - CheckTimestamp(); - CheckInt32(3); - CheckInt32(3); } { @@ -799,13 +753,8 @@ TEST_F(MndTestStb, 07_Alter_Stb_DropColumn) { ASSERT_NE(pRsp, nullptr); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_STB, dbname); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_STB, "user_stables", dbname); EXPECT_EQ(test.GetShowRows(), 1); - CheckBinary("stb", TSDB_TABLE_NAME_LEN); - CheckTimestamp(); - CheckInt32(2); - CheckInt32(3); } { @@ -862,13 +811,8 @@ TEST_F(MndTestStb, 08_Alter_Stb_AlterTagBytes) { SRpcMsg* pRsp = test.SendReq(TDMT_MND_ALTER_STB, pReq, contLen); ASSERT_EQ(pRsp->code, 0); - test.SendShowMetaReq(TSDB_MGMT_TABLE_STB, dbname); - test.SendShowRetrieveReq(); + test.SendShowReq(TSDB_MGMT_TABLE_STB, "user_stables", dbname); EXPECT_EQ(test.GetShowRows(), 1); - CheckBinary("stb", TSDB_TABLE_NAME_LEN); - CheckTimestamp(); - CheckInt32(2); - CheckInt32(3); } { From 6e753618fb736ef90664b10818c43f2bb86c239f Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 15 Apr 2022 14:20:50 +0800 Subject: [PATCH 19/37] test: reopen mnode unitest --- source/dnode/mnode/impl/test/CMakeLists.txt | 26 ++++++++++----------- source/dnode/mnode/impl/test/show/show.cpp | 8 +++---- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/source/dnode/mnode/impl/test/CMakeLists.txt b/source/dnode/mnode/impl/test/CMakeLists.txt index 9b669b303a..15f2aed22a 100644 --- a/source/dnode/mnode/impl/test/CMakeLists.txt +++ b/source/dnode/mnode/impl/test/CMakeLists.txt @@ -1,17 +1,17 @@ enable_testing() -#add_subdirectory(user) add_subdirectory(acct) -#add_subdirectory(trans) -#add_subdirectory(qnode) -#add_subdirectory(snode) add_subdirectory(bnode) -#add_subdirectory(show) -#add_subdirectory(profile) -#add_subdirectory(dnode) -#add_subdirectory(mnode) -#add_subdirectory(db) -#add_subdirectory(stb) -#add_subdirectory(sma) -#add_subdirectory(func) -#add_subdirectory(topic) +add_subdirectory(db) +add_subdirectory(dnode) +add_subdirectory(func) +add_subdirectory(mnode) +add_subdirectory(profile) +add_subdirectory(qnode) +add_subdirectory(show) +add_subdirectory(sma) +add_subdirectory(snode) +add_subdirectory(stb) +add_subdirectory(topic) +add_subdirectory(trans) +add_subdirectory(user) diff --git a/source/dnode/mnode/impl/test/show/show.cpp b/source/dnode/mnode/impl/test/show/show.cpp index 5b8c186ccf..201a42e3ef 100644 --- a/source/dnode/mnode/impl/test/show/show.cpp +++ b/source/dnode/mnode/impl/test/show/show.cpp @@ -34,9 +34,9 @@ TEST_F(MndTestShow, 01_ShowMsg_InvalidMsgMax) { tSerializeSShowReq(pReq, contLen, &showReq); tFreeSShowReq(&showReq); - SRpcMsg* pRsp = test.SendReq(TDMT_MND_SHOW, pReq, contLen); + SRpcMsg* pRsp = test.SendReq(TDMT_MND_SYSTABLE_RETRIEVE, pReq, contLen); ASSERT_NE(pRsp, nullptr); - ASSERT_EQ(pRsp->code, TSDB_CODE_MND_INVALID_MSG_TYPE); + ASSERT_EQ(pRsp->code, TSDB_CODE_INVALID_MSG); } TEST_F(MndTestShow, 02_ShowMsg_InvalidMsgStart) { @@ -48,9 +48,9 @@ TEST_F(MndTestShow, 02_ShowMsg_InvalidMsgStart) { tSerializeSShowReq(pReq, contLen, &showReq); tFreeSShowReq(&showReq); - SRpcMsg* pRsp = test.SendReq(TDMT_MND_SHOW, pReq, contLen); + SRpcMsg* pRsp = test.SendReq(TDMT_MND_SYSTABLE_RETRIEVE, pReq, contLen); ASSERT_NE(pRsp, nullptr); - ASSERT_EQ(pRsp->code, TSDB_CODE_MND_INVALID_MSG_TYPE); + ASSERT_EQ(pRsp->code, TSDB_CODE_INVALID_MSG); } TEST_F(MndTestShow, 03_ShowMsg_Conn) { From 694df11ff101ccd4ce2736c600e2c8ec0e90512c Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Fri, 15 Apr 2022 06:27:04 +0000 Subject: [PATCH 20/37] refact vnode --- source/dnode/vnode/src/inc/vnodeInt.h | 1 + source/dnode/vnode/src/vnd/vnodeCommit.c | 137 +++++++++++++++++++++-- source/dnode/vnode/src/vnd/vnodeOpen.c | 2 + 3 files changed, 130 insertions(+), 10 deletions(-) diff --git a/source/dnode/vnode/src/inc/vnodeInt.h b/source/dnode/vnode/src/inc/vnodeInt.h index b0b87665ed..e95878b04e 100644 --- a/source/dnode/vnode/src/inc/vnodeInt.h +++ b/source/dnode/vnode/src/inc/vnodeInt.h @@ -27,6 +27,7 @@ #include "tdbInt.h" #include "tfs.h" #include "tglobal.h" +#include "tjson.h" #include "tlist.h" #include "tlockfree.h" #include "tlosertree.h" diff --git a/source/dnode/vnode/src/vnd/vnodeCommit.c b/source/dnode/vnode/src/vnd/vnodeCommit.c index fc74ee9253..b4bce9e350 100644 --- a/source/dnode/vnode/src/vnd/vnodeCommit.c +++ b/source/dnode/vnode/src/vnd/vnodeCommit.c @@ -18,7 +18,7 @@ #define VND_INFO_FNAME "vnode.json" #define VND_INFO_FNAME_TMP "vnode_tmp.json" -static int vnodeEncodeInfo(const SVnodeInfo *pInfo, uint8_t **ppData, int *len); +static int vnodeEncodeInfo(const SVnodeInfo *pInfo, char **ppData); static int vnodeDecodeInfo(uint8_t *pData, int len, SVnodeInfo *pInfo); static int vnodeStartCommit(SVnode *pVnode); static int vnodeEndCommit(SVnode *pVnode); @@ -28,16 +28,14 @@ static void vnodeWaitCommit(SVnode *pVnode); int vnodeSaveInfo(const char *dir, const SVnodeInfo *pInfo) { char fname[TSDB_FILENAME_LEN]; TdFilePtr pFile; - uint8_t *data; - int len; + char *data; snprintf(fname, TSDB_FILENAME_LEN, "%s%s%s", dir, TD_DIRSEP, VND_INFO_FNAME_TMP); // encode info data = NULL; - len = 0; - if (vnodeEncodeInfo(pInfo, &data, &len) < 0) { + if (vnodeEncodeInfo(pInfo, &data) < 0) { return -1; } @@ -48,7 +46,7 @@ int vnodeSaveInfo(const char *dir, const SVnodeInfo *pInfo) { return -1; } - if (taosWriteFile(pFile, data, len) < 0) { + if (taosWriteFile(pFile, data, strlen(data)) < 0) { terrno = TAOS_SYSTEM_ERROR(errno); goto _err; } @@ -137,12 +135,131 @@ static int vnodeEndCommit(SVnode *pVnode) { static FORCE_INLINE void vnodeWaitCommit(SVnode *pVnode) { tsem_wait(&pVnode->canCommit); } -static int vnodeEncodeInfo(const SVnodeInfo *pInfo, uint8_t **ppData, int *len) { - // TODO +static int vnodeEncodeConfig(const void *pObj, SJson *pJson) { + const SVnodeCfg *pCfg = (SVnodeCfg *)pObj; + + if (tjsonAddIntegerToObject(pJson, "vgId", pCfg->vgId) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "dbId", pCfg->dbId) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "wsize", pCfg->wsize) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "ssize", pCfg->ssize) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "lsize", pCfg->lsize) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "isHeap", pCfg->isHeapAllocator) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "ttl", pCfg->ttl) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "keep", pCfg->keep) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "streamMode", pCfg->streamMode) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "isWeak", pCfg->isWeak) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "precision", pCfg->tsdbCfg.precision) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "update", pCfg->tsdbCfg.update) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "compression", pCfg->tsdbCfg.compression) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "daysPerFile", pCfg->tsdbCfg.daysPerFile) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "minRows", pCfg->tsdbCfg.minRowsPerFileBlock) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "maxRows", pCfg->tsdbCfg.maxRowsPerFileBlock) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "keep0", pCfg->tsdbCfg.keep) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "keep1", pCfg->tsdbCfg.keep1) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "keep2", pCfg->tsdbCfg.keep2) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "lruCacheSize", pCfg->tsdbCfg.lruCacheSize) < 0) return -1; + return 0; } -static int vnodeDecodeInfo(uint8_t *pData, int len, SVnodeInfo *pInfo) { - // TODO +static int vnodeDecodeConfig(const SJson *pJson, void *pObj) { + SVnodeCfg *pCfg = (SVnodeCfg *)pObj; + + if (tjsonGetNumberValue(pJson, "vgId", pCfg->vgId) < 0) return -1; + if (tjsonGetNumberValue(pJson, "dbId", pCfg->dbId) < 0) return -1; + if (tjsonGetNumberValue(pJson, "wsize", pCfg->wsize) < 0) return -1; + if (tjsonGetNumberValue(pJson, "ssize", pCfg->ssize) < 0) return -1; + if (tjsonGetNumberValue(pJson, "lsize", pCfg->lsize) < 0) return -1; + if (tjsonGetNumberValue(pJson, "isHeap", pCfg->isHeapAllocator) < 0) return -1; + if (tjsonGetNumberValue(pJson, "ttl", pCfg->ttl) < 0) return -1; + if (tjsonGetNumberValue(pJson, "keep", pCfg->keep) < 0) return -1; + if (tjsonGetNumberValue(pJson, "streamMode", pCfg->streamMode) < 0) return -1; + if (tjsonGetNumberValue(pJson, "isWeak", pCfg->isWeak) < 0) return -1; + if (tjsonGetNumberValue(pJson, "precision", pCfg->tsdbCfg.precision) < 0) return -1; + if (tjsonGetNumberValue(pJson, "update", pCfg->tsdbCfg.update) < 0) return -1; + if (tjsonGetNumberValue(pJson, "compression", pCfg->tsdbCfg.compression) < 0) return -1; + if (tjsonGetNumberValue(pJson, "daysPerFile", pCfg->tsdbCfg.daysPerFile) < 0) return -1; + if (tjsonGetNumberValue(pJson, "minRows", pCfg->tsdbCfg.minRowsPerFileBlock) < 0) return -1; + if (tjsonGetNumberValue(pJson, "maxRows", pCfg->tsdbCfg.maxRowsPerFileBlock) < 0) return -1; + if (tjsonGetNumberValue(pJson, "keep0", pCfg->tsdbCfg.keep) < 0) return -1; + if (tjsonGetNumberValue(pJson, "keep1", pCfg->tsdbCfg.keep1) < 0) return -1; + if (tjsonGetNumberValue(pJson, "keep2", pCfg->tsdbCfg.keep2) < 0) return -1; + if (tjsonGetNumberValue(pJson, "lruCacheSize", pCfg->tsdbCfg.lruCacheSize) < 0) return -1; + return 0; } + +static int vnodeEncodeState(const void *pObj, SJson *pJson) { + const SVState *pState = (SVState *)pObj; + + if (tjsonAddIntegerToObject(pJson, "commit version", pState->committed) < 0) return -1; + + return 0; +} + +static int vnodeDecodeState(const SJson *pJson, void *pObj) { + SVState *pState = (SVState *)pObj; + + if (tjsonGetNumberValue(pJson, "commit version", pState->committed) < 0) return -1; + + return 0; +} + +static int vnodeEncodeInfo(const SVnodeInfo *pInfo, char **ppData) { + SJson *pJson; + char *pData; + + *ppData = NULL; + + pJson = tjsonCreateObject(); + if (pJson == NULL) { + return -1; + } + + if (tjsonAddObject(pJson, "config", vnodeEncodeConfig, (void *)&pInfo->config) < 0) { + goto _err; + } + + if (tjsonAddObject(pJson, "state", vnodeEncodeState, (void *)&pInfo->state) < 0) { + goto _err; + } + + pData = tjsonToString(pJson); + if (pData == NULL) { + goto _err; + } + + tjsonDelete(pJson); + + *ppData = pData; + return 0; + +_err: + tjsonDelete(pJson); + return -1; +} + +static int vnodeDecodeInfo(uint8_t *pData, int len, SVnodeInfo *pInfo) { + SJson *pJson = NULL; + + pJson = tjsonCreateObject(); + if (pJson == NULL) { + return -1; + } + + if (tjsonToObject(pJson, "config", vnodeDecodeConfig, (void *)&pInfo->config) < 0) { + goto _err; + } + + if (tjsonToObject(pJson, "state", vnodeDecodeState, (void *)&pInfo->state) < 0) { + goto _err; + } + + tjsonDelete(pJson); + + return 0; + +_err: + tjsonDelete(pJson); + return -1; +} diff --git a/source/dnode/vnode/src/vnd/vnodeOpen.c b/source/dnode/vnode/src/vnd/vnodeOpen.c index 5fa14f6018..241c26ab1c 100644 --- a/source/dnode/vnode/src/vnd/vnodeOpen.c +++ b/source/dnode/vnode/src/vnd/vnodeOpen.c @@ -46,6 +46,8 @@ int vnodeCreate(const char *path, SVnodeCfg *pCfg, STfs *pTfs) { return -1; } + vInfo("vgId: %d vnode is created", pCfg->vgId); + return 0; } From e96f0fa42935d6aff7cb24d2c362f4a20e3b214f Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 15 Apr 2022 14:31:54 +0800 Subject: [PATCH 21/37] fix: the bug found by CI --- source/dnode/mnode/impl/test/profile/profile.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/dnode/mnode/impl/test/profile/profile.cpp b/source/dnode/mnode/impl/test/profile/profile.cpp index b9b21ebed9..2c3be2135b 100644 --- a/source/dnode/mnode/impl/test/profile/profile.cpp +++ b/source/dnode/mnode/impl/test/profile/profile.cpp @@ -46,7 +46,7 @@ TEST_F(MndTestProfile, 01_ConnectMsg) { EXPECT_EQ(connectRsp.acctId, 1); EXPECT_GT(connectRsp.clusterId, 0); - EXPECT_EQ(connectRsp.connId, 1); + EXPECT_NE(connectRsp.connId, 0); EXPECT_EQ(connectRsp.superUser, 1); EXPECT_EQ(connectRsp.epSet.inUse, 0); @@ -82,7 +82,8 @@ TEST_F(MndTestProfile, 04_HeartBeatMsg) { SClientHbBatchReq batchReq = {0}; batchReq.reqs = taosArrayInit(0, sizeof(SClientHbReq)); SClientHbReq req = {0}; - req.connKey = {.connId = 123, .hbType = CONN_TYPE__TMQ}; + req.connKey.tscRid = 123; + req.connKey.connType = CONN_TYPE__TMQ; req.info = taosHashInit(64, hbKeyHashFunc, 1, HASH_ENTRY_LOCK); SKv kv = {0}; kv.key = 123; From 83c8be30880f81471a1e737450b5db6f3061e16c Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Fri, 15 Apr 2022 06:38:18 +0000 Subject: [PATCH 22/37] refact --- source/dnode/vnode/inc/vnode.h | 6 ++--- source/dnode/vnode/src/tsdb/tsdbCommit.c | 31 +++++++++++----------- source/dnode/vnode/src/tsdb/tsdbFS.c | 2 +- source/dnode/vnode/src/tsdb/tsdbMemTable.c | 24 ++++++++--------- source/dnode/vnode/src/tsdb/tsdbOptions.c | 6 ++--- source/dnode/vnode/src/tsdb/tsdbRead.c | 10 +++---- source/dnode/vnode/src/tsdb/tsdbReadImpl.c | 14 +++++----- source/dnode/vnode/src/tsdb/tsdbSma.c | 10 ++++--- source/dnode/vnode/src/vnd/vnodeCommit.c | 12 ++++----- 9 files changed, 59 insertions(+), 56 deletions(-) diff --git a/source/dnode/vnode/inc/vnode.h b/source/dnode/vnode/inc/vnode.h index 25c6ffc1ad..e42311fa9c 100644 --- a/source/dnode/vnode/inc/vnode.h +++ b/source/dnode/vnode/inc/vnode.h @@ -124,9 +124,9 @@ struct STsdbCfg { int8_t precision; int8_t update; int8_t compression; - int32_t daysPerFile; - int32_t minRowsPerFileBlock; - int32_t maxRowsPerFileBlock; + int32_t days; + int32_t minRows; + int32_t maxRows; int32_t keep; int32_t keep1; int32_t keep2; diff --git a/source/dnode/vnode/src/tsdb/tsdbCommit.c b/source/dnode/vnode/src/tsdb/tsdbCommit.c index eb32663387..8cbe3c9005 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCommit.c +++ b/source/dnode/vnode/src/tsdb/tsdbCommit.c @@ -55,7 +55,7 @@ typedef struct { #define TSDB_COMMIT_BUF(ch) TSDB_READ_BUF(&((ch)->readh)) #define TSDB_COMMIT_COMP_BUF(ch) TSDB_READ_COMP_BUF(&((ch)->readh)) #define TSDB_COMMIT_EXBUF(ch) TSDB_READ_EXBUF(&((ch)->readh)) -#define TSDB_COMMIT_DEFAULT_ROWS(ch) TSDB_DEFAULT_BLOCK_ROWS(TSDB_COMMIT_REPO(ch)->config.maxRowsPerFileBlock) +#define TSDB_COMMIT_DEFAULT_ROWS(ch) TSDB_DEFAULT_BLOCK_ROWS(TSDB_COMMIT_REPO(ch)->config.maxRows) #define TSDB_COMMIT_TXN_VERSION(ch) FS_TXN_VERSION(REPO_FS(TSDB_COMMIT_REPO(ch))) static void tsdbStartCommit(STsdb *pRepo); @@ -222,9 +222,9 @@ void tsdbGetRtnSnap(STsdb *pRepo, SRtn *pRtn) { maxKey = now - pCfg->keep1 * tsTickPerDay[pCfg->precision]; pRtn->minKey = minKey; - pRtn->minFid = (int)(TSDB_KEY_FID(minKey, pCfg->daysPerFile, pCfg->precision)); - pRtn->midFid = (int)(TSDB_KEY_FID(midKey, pCfg->daysPerFile, pCfg->precision)); - pRtn->maxFid = (int)(TSDB_KEY_FID(maxKey, pCfg->daysPerFile, pCfg->precision)); + pRtn->minFid = (int)(TSDB_KEY_FID(minKey, pCfg->days, pCfg->precision)); + pRtn->midFid = (int)(TSDB_KEY_FID(midKey, pCfg->days, pCfg->precision)); + pRtn->maxFid = (int)(TSDB_KEY_FID(maxKey, pCfg->days, pCfg->precision)); tsdbDebug("vgId:%d now:%" PRId64 " minKey:%" PRId64 " minFid:%d, midFid:%d, maxFid:%d", REPO_ID(pRepo), now, minKey, pRtn->minFid, pRtn->midFid, pRtn->maxFid); } @@ -286,7 +286,7 @@ static int tsdbInitCommitH(SCommitH *pCommith, STsdb *pRepo) { return -1; } - pCommith->pDataCols = tdNewDataCols(0, pCfg->maxRowsPerFileBlock); + pCommith->pDataCols = tdNewDataCols(0, pCfg->maxRows); if (pCommith->pDataCols == NULL) { terrno = TSDB_CODE_TDB_OUT_OF_MEMORY; tsdbDestroyCommitH(pCommith); @@ -319,7 +319,7 @@ static int tsdbNextCommitFid(SCommitH *pCommith) { if (nextKey == TSDB_DATA_TIMESTAMP_NULL) { continue; } else { - int tfid = (int)(TSDB_KEY_FID(nextKey, pCfg->daysPerFile, pCfg->precision)); + int tfid = (int)(TSDB_KEY_FID(nextKey, pCfg->days, pCfg->precision)); if (fid == TSDB_IVLD_FID || fid > tfid) { fid = tfid; } @@ -346,7 +346,7 @@ static int tsdbCommitToFile(SCommitH *pCommith, SDFileSet *pSet, int fid) { ASSERT(pSet == NULL || pSet->fid == fid); tsdbResetCommitFile(pCommith); - tsdbGetFidKeyRange(pCfg->daysPerFile, pCfg->precision, fid, &(pCommith->minKey), &(pCommith->maxKey)); + tsdbGetFidKeyRange(pCfg->days, pCfg->precision, fid, &(pCommith->minKey), &(pCommith->maxKey)); // Set and open files if (tsdbSetAndOpenCommitFile(pCommith, pSet, fid) < 0) { @@ -1210,8 +1210,8 @@ int tsdbWriteBlockImpl(STsdb *pRepo, STable *pTable, SDFile *pDFile, SDFile *pDF int64_t offset = 0, offsetAggr = 0; int rowsToWrite = pDataCols->numOfRows; - ASSERT(rowsToWrite > 0 && rowsToWrite <= pCfg->maxRowsPerFileBlock); - ASSERT((!isLast) || rowsToWrite < pCfg->minRowsPerFileBlock); + ASSERT(rowsToWrite > 0 && rowsToWrite <= pCfg->maxRows); + ASSERT((!isLast) || rowsToWrite < pCfg->minRows); // Make buffer space if (tsdbMakeRoom(ppBuf, tsdbBlockStatisSize(pDataCols->numOfCols, SBlockVerLatest)) < 0) { @@ -1460,7 +1460,7 @@ static int tsdbCommitMemData(SCommitH *pCommith, SCommitIter *pIter, TSKEY keyLi if (pCommith->pDataCols->numOfRows <= 0) break; - if (toData || pCommith->pDataCols->numOfRows >= pCfg->minRowsPerFileBlock) { + if (toData || pCommith->pDataCols->numOfRows >= pCfg->minRows) { pDFile = TSDB_COMMIT_DATA_FILE(pCommith); isLast = false; } else { @@ -1619,7 +1619,7 @@ static int tsdbMergeBlockData(SCommitH *pCommith, SCommitIter *pIter, SDataCols if (pCommith->pDataCols->numOfRows == 0) break; if (isLastOneBlock) { - if (pCommith->pDataCols->numOfRows < pCfg->minRowsPerFileBlock) { + if (pCommith->pDataCols->numOfRows < pCfg->minRows) { pDFile = TSDB_COMMIT_LAST_FILE(pCommith); isLast = true; } else { @@ -1667,7 +1667,8 @@ static void tsdbLoadAndMergeFromCache(SDataCols *pDataCols, int *iter, SCommitIt if (tdGetColDataOfRow(&sVal, pDataCols->cols + i, *iter, pDataCols->bitmapMode) < 0) { TASSERT(0); } - tdAppendValToDataCol(pTarget->cols + i, sVal.valType, sVal.val, pTarget->numOfRows, pTarget->maxPoints, pTarget->bitmapMode); + tdAppendValToDataCol(pTarget->cols + i, sVal.valType, sVal.val, pTarget->numOfRows, pTarget->maxPoints, + pTarget->bitmapMode); } ++pTarget->numOfRows; @@ -1774,11 +1775,11 @@ static bool tsdbCanAddSubBlock(SCommitH *pCommith, SBlock *pBlock, SMergeInfo *p ASSERT(mergeRows > 0); - if (pBlock->numOfSubBlocks < TSDB_MAX_SUBBLOCKS && pInfo->nOperations <= pCfg->maxRowsPerFileBlock) { + if (pBlock->numOfSubBlocks < TSDB_MAX_SUBBLOCKS && pInfo->nOperations <= pCfg->maxRows) { if (pBlock->last) { - if (pCommith->isLFileSame && mergeRows < pCfg->minRowsPerFileBlock) return true; + if (pCommith->isLFileSame && mergeRows < pCfg->minRows) return true; } else { - if (pCommith->isDFileSame && mergeRows <= pCfg->maxRowsPerFileBlock) return true; + if (pCommith->isDFileSame && mergeRows <= pCfg->maxRows) return true; } } diff --git a/source/dnode/vnode/src/tsdb/tsdbFS.c b/source/dnode/vnode/src/tsdb/tsdbFS.c index bd3888864d..ca363fdc1f 100644 --- a/source/dnode/vnode/src/tsdb/tsdbFS.c +++ b/source/dnode/vnode/src/tsdb/tsdbFS.c @@ -191,7 +191,7 @@ static int tsdbAddDFileSetToStatus(SFSStatus *pStatus, const SDFileSet *pSet) { // ================== STsdbFS STsdbFS *tsdbNewFS(const STsdbCfg *pCfg) { int keep = pCfg->keep; - int days = pCfg->daysPerFile; + int days = pCfg->days; int maxFSet = TSDB_MAX_FSETS(keep, days); STsdbFS *pfs; diff --git a/source/dnode/vnode/src/tsdb/tsdbMemTable.c b/source/dnode/vnode/src/tsdb/tsdbMemTable.c index 5a477e646c..a682715c2c 100644 --- a/source/dnode/vnode/src/tsdb/tsdbMemTable.c +++ b/source/dnode/vnode/src/tsdb/tsdbMemTable.c @@ -19,9 +19,9 @@ static int tsdbScanAndConvertSubmitMsg(STsdb *pTsdb, SSubmitReq *pMsg); static int tsdbMemTableInsertTbData(STsdb *pRepo, SSubmitBlk *pBlock, int32_t *pAffectedRows); static STbData *tsdbNewTbData(tb_uid_t uid); static void tsdbFreeTbData(STbData *pTbData); -static char * tsdbGetTsTupleKey(const void *data); +static char *tsdbGetTsTupleKey(const void *data); static int tsdbTbDataComp(const void *arg1, const void *arg2); -static char * tsdbTbDataGetUid(const void *arg); +static char *tsdbTbDataGetUid(const void *arg); static int tsdbAppendTableRowToCols(STable *pTable, SDataCols *pCols, STSchema **ppSchema, STSRow *row); STsdbMemTable *tsdbNewMemTable(STsdb *pTsdb) { @@ -74,7 +74,7 @@ void tsdbFreeMemTable(STsdb *pTsdb, STsdbMemTable *pMemTable) { } int tsdbMemTableInsert(STsdb *pTsdb, STsdbMemTable *pMemTable, SSubmitReq *pMsg, SSubmitRsp *pRsp) { - SSubmitBlk * pBlock = NULL; + SSubmitBlk *pBlock = NULL; SSubmitMsgIter msgIter = {0}; int32_t affectedrows = 0, numOfRows = 0; @@ -119,12 +119,12 @@ int tsdbLoadDataFromCache(STable *pTable, SSkipListIterator *pIter, TSKEY maxKey TKEY *filterKeys, int nFilterKeys, bool keepDup, SMergeInfo *pMergeInfo) { ASSERT(maxRowsToRead > 0 && nFilterKeys >= 0); if (pIter == NULL) return 0; - STSchema * pSchema = NULL; + STSchema *pSchema = NULL; TSKEY rowKey = 0; TSKEY fKey = 0; bool isRowDel = false; int filterIter = 0; - STSRow * row = NULL; + STSRow *row = NULL; SMergeInfo mInfo; if (pMergeInfo == NULL) pMergeInfo = &mInfo; @@ -259,12 +259,12 @@ static int tsdbScanAndConvertSubmitMsg(STsdb *pTsdb, SSubmitReq *pMsg) { ASSERT(pMsg != NULL); // STsdbMeta * pMeta = pTsdb->tsdbMeta; SSubmitMsgIter msgIter = {0}; - SSubmitBlk * pBlock = NULL; + SSubmitBlk *pBlock = NULL; SSubmitBlkIter blkIter = {0}; - STSRow * row = NULL; + STSRow *row = NULL; TSKEY now = taosGetTimestamp(pTsdb->config.precision); TSKEY minKey = now - tsTickPerDay[pTsdb->config.precision] * pTsdb->config.keep; - TSKEY maxKey = now + tsTickPerDay[pTsdb->config.precision] * pTsdb->config.daysPerFile; + TSKEY maxKey = now + tsTickPerDay[pTsdb->config.precision] * pTsdb->config.days; terrno = TSDB_CODE_SUCCESS; pMsg->length = htonl(pMsg->length); @@ -332,9 +332,9 @@ static int tsdbMemTableInsertTbData(STsdb *pTsdb, SSubmitBlk *pBlock, int32_t *p // STable *pTable = NULL; SSubmitBlkIter blkIter = {0}; STsdbMemTable *pMemTable = pTsdb->mem; - void * tptr; - STbData * pTbData; - STSRow * row; + void *tptr; + STbData *pTbData; + STSRow *row; TSKEY keyMin; TSKEY keyMax; @@ -504,7 +504,7 @@ int tsdbInsertDataToMemTable(STsdbMemTable *pMemTable, SSubmitReq *pMsg) { #include "tskiplist.h" #define TSDB_DATA_SKIPLIST_LEVEL 5 -#define TSDB_MAX_INSERT_BATCH 512 +#define TSDB_MAX_INSERT_BATCH 512 typedef struct { int32_t totalLen; diff --git a/source/dnode/vnode/src/tsdb/tsdbOptions.c b/source/dnode/vnode/src/tsdb/tsdbOptions.c index 2c57a7406e..c3555cc835 100644 --- a/source/dnode/vnode/src/tsdb/tsdbOptions.c +++ b/source/dnode/vnode/src/tsdb/tsdbOptions.c @@ -17,9 +17,9 @@ const STsdbCfg defautlTsdbOptions = {.precision = 0, .lruCacheSize = 0, - .daysPerFile = 10, - .minRowsPerFileBlock = 100, - .maxRowsPerFileBlock = 4096, + .days = 10, + .minRows = 100, + .maxRows = 4096, .keep = 3650, .keep1 = 3650, .keep2 = 3650, diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c index 9509dfa462..e5da0e3c37 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead.c @@ -404,7 +404,7 @@ static STsdbReadHandle* tsdbQueryTablesImpl(STsdb* tsdb, STsdbQueryCond* pCond, pReadHandle->defaultLoadColumn = getDefaultLoadColumns(pReadHandle, true); } - pReadHandle->pDataCols = tdNewDataCols(1000, pReadHandle->pTsdb->config.maxRowsPerFileBlock); + pReadHandle->pDataCols = tdNewDataCols(1000, pReadHandle->pTsdb->config.maxRows); if (pReadHandle->pDataCols == NULL) { tsdbError("%p failed to malloc buf for pDataCols, %s", pReadHandle, pReadHandle->idStr); terrno = TSDB_CODE_TDB_OUT_OF_MEMORY; @@ -2199,7 +2199,7 @@ static int32_t getFirstFileDataBlock(STsdbReadHandle* pTsdbReadHandle, bool* exi break; } - tsdbGetFidKeyRange(pCfg->daysPerFile, pCfg->precision, pTsdbReadHandle->pFileGroup->fid, &win.skey, &win.ekey); + tsdbGetFidKeyRange(pCfg->days, pCfg->precision, pTsdbReadHandle->pFileGroup->fid, &win.skey, &win.ekey); // current file are not overlapped with query time window, ignore remain files if ((ASCENDING_TRAVERSE(pTsdbReadHandle->order) && win.skey > pTsdbReadHandle->window.ekey) || @@ -2295,7 +2295,7 @@ int32_t tsdbGetFileBlocksDistInfo(tsdbReaderT* queryHandle, STableBlockDistInfo* // find the start data block in file pTsdbReadHandle->locateStart = true; STsdbCfg* pCfg = &pTsdbReadHandle->pTsdb->config; - int32_t fid = getFileIdFromKey(pTsdbReadHandle->window.skey, pCfg->daysPerFile, pCfg->precision); + int32_t fid = getFileIdFromKey(pTsdbReadHandle->window.skey, pCfg->days, pCfg->precision); tsdbRLockFS(pFileHandle); tsdbFSIterInit(&pTsdbReadHandle->fileIter, pFileHandle, pTsdbReadHandle->order); @@ -2321,7 +2321,7 @@ int32_t tsdbGetFileBlocksDistInfo(tsdbReaderT* queryHandle, STableBlockDistInfo* break; } - tsdbGetFidKeyRange(pCfg->daysPerFile, pCfg->precision, pTsdbReadHandle->pFileGroup->fid, &win.skey, &win.ekey); + tsdbGetFidKeyRange(pCfg->days, pCfg->precision, pTsdbReadHandle->pFileGroup->fid, &win.skey, &win.ekey); // current file are not overlapped with query time window, ignore remain files if ((ascTraverse && win.skey > pTsdbReadHandle->window.ekey) || @@ -2396,7 +2396,7 @@ static int32_t getDataBlocksInFiles(STsdbReadHandle* pTsdbReadHandle, bool* exis if (!pTsdbReadHandle->locateStart) { pTsdbReadHandle->locateStart = true; STsdbCfg* pCfg = &pTsdbReadHandle->pTsdb->config; - int32_t fid = getFileIdFromKey(pTsdbReadHandle->window.skey, pCfg->daysPerFile, pCfg->precision); + int32_t fid = getFileIdFromKey(pTsdbReadHandle->window.skey, pCfg->days, pCfg->precision); tsdbRLockFS(pFileHandle); tsdbFSIterInit(&pTsdbReadHandle->fileIter, pFileHandle, pTsdbReadHandle->order); diff --git a/source/dnode/vnode/src/tsdb/tsdbReadImpl.c b/source/dnode/vnode/src/tsdb/tsdbReadImpl.c index e31ede09cc..0b5a53dd9c 100644 --- a/source/dnode/vnode/src/tsdb/tsdbReadImpl.c +++ b/source/dnode/vnode/src/tsdb/tsdbReadImpl.c @@ -43,14 +43,14 @@ int tsdbInitReadH(SReadH *pReadh, STsdb *pRepo) { return -1; } - pReadh->pDCols[0] = tdNewDataCols(0, pCfg->maxRowsPerFileBlock); + pReadh->pDCols[0] = tdNewDataCols(0, pCfg->maxRows); if (pReadh->pDCols[0] == NULL) { terrno = TSDB_CODE_TDB_OUT_OF_MEMORY; tsdbDestroyReadH(pReadh); return -1; } - pReadh->pDCols[1] = tdNewDataCols(0, pCfg->maxRowsPerFileBlock); + pReadh->pDCols[1] = tdNewDataCols(0, pCfg->maxRows); if (pReadh->pDCols[1] == NULL) { terrno = TSDB_CODE_TDB_OUT_OF_MEMORY; tsdbDestroyReadH(pReadh); @@ -276,8 +276,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, bool mergeBitmap) { +int tsdbLoadBlockDataCols(SReadH *pReadh, SBlock *pBlock, SBlockInfo *pBlkInfo, const int16_t *colIds, int numOfColsIds, + bool mergeBitmap) { ASSERT(pBlock->numOfSubBlocks > 0); int8_t update = pReadh->pRepo->config.update; @@ -513,7 +513,7 @@ static int tsdbLoadBlockDataImpl(SReadH *pReadh, SBlock *pBlock, SDataCols *pDat tdResetDataCols(pDataCols); - if(tsdbIsSupBlock(pBlock)) { + if (tsdbIsSupBlock(pBlock)) { tdDataColsSetBitmapI(pDataCols); } @@ -710,7 +710,7 @@ static int tsdbLoadBlockDataColsImpl(SReadH *pReadh, SBlock *pBlock, SDataCols * tdResetDataCols(pDataCols); - if(tsdbIsSupBlock(pBlock)) { + if (tsdbIsSupBlock(pBlock)) { tdDataColsSetBitmapI(pDataCols); } @@ -836,7 +836,7 @@ static int tsdbLoadColData(SReadH *pReadh, SDFile *pDFile, SBlock *pBlock, SBloc } if (tsdbCheckAndDecodeColumnData(pDataCol, pReadh->pBuf, pBlockCol->len, pBlockCol->blen, pBlock->algorithm, - pBlock->numOfRows, tLenBitmap, pCfg->maxRowsPerFileBlock, pReadh->pCBuf, + pBlock->numOfRows, tLenBitmap, pCfg->maxRows, pReadh->pCBuf, (int32_t)taosTSizeof(pReadh->pCBuf)) < 0) { tsdbError("vgId:%d file %s is broken at column %d offset %" PRId64, REPO_ID(pRepo), TSDB_FILE_FULL_NAME(pDFile), pBlockCol->colId, offset); diff --git a/source/dnode/vnode/src/tsdb/tsdbSma.c b/source/dnode/vnode/src/tsdb/tsdbSma.c index 7de5a0d5a9..7abdf22073 100644 --- a/source/dnode/vnode/src/tsdb/tsdbSma.c +++ b/source/dnode/vnode/src/tsdb/tsdbSma.c @@ -106,7 +106,8 @@ struct SSmaStat { // expired window static int32_t tsdbUpdateExpiredWindowImpl(STsdb *pTsdb, SSubmitReq *pMsg, int64_t version); -static int32_t tsdbSetExpiredWindow(STsdb *pTsdb, SHashObj *pItemsHash, int64_t indexUid, int64_t winSKey, int64_t version); +static int32_t tsdbSetExpiredWindow(STsdb *pTsdb, SHashObj *pItemsHash, int64_t indexUid, int64_t winSKey, + int64_t version); static int32_t tsdbInitSmaStat(SSmaStat **pSmaStat); static void *tsdbFreeSmaStatItem(SSmaStatItem *pSmaStatItem); static int32_t tsdbDestroySmaState(SSmaStat *pSmaStat); @@ -197,7 +198,7 @@ static SPoolMem *openPool() { static void clearPool(SPoolMem *pPool) { if (!pPool) return; - + SPoolMem *pMem; do { @@ -544,7 +545,8 @@ static int32_t tsdbCheckAndInitSmaEnv(STsdb *pTsdb, int8_t smaType) { return TSDB_CODE_SUCCESS; }; -static int32_t tsdbSetExpiredWindow(STsdb *pTsdb, SHashObj *pItemsHash, int64_t indexUid, int64_t winSKey, int64_t version) { +static int32_t tsdbSetExpiredWindow(STsdb *pTsdb, SHashObj *pItemsHash, int64_t indexUid, int64_t winSKey, + int64_t version) { SSmaStatItem *pItem = taosHashGet(pItemsHash, &indexUid, sizeof(indexUid)); if (pItem == NULL) { // TODO: use TSDB_SMA_STAT_EXPIRED and update by stream computing later @@ -946,7 +948,7 @@ static int32_t tsdbSetTSmaDataFile(STSmaWriteH *pSmaH, int64_t indexUid, int32_t */ static int32_t tsdbGetTSmaDays(STsdb *pTsdb, int64_t interval, int32_t storageLevel) { STsdbCfg *pCfg = REPO_CFG(pTsdb); - int32_t daysPerFile = pCfg->daysPerFile; + int32_t daysPerFile = pCfg->days; if (storageLevel == SMA_STORAGE_LEVEL_TSDB) { int32_t days = SMA_STORAGE_TSDB_TIMES * (interval / tsTickPerDay[pCfg->precision]); diff --git a/source/dnode/vnode/src/vnd/vnodeCommit.c b/source/dnode/vnode/src/vnd/vnodeCommit.c index b4bce9e350..c8323c30b9 100644 --- a/source/dnode/vnode/src/vnd/vnodeCommit.c +++ b/source/dnode/vnode/src/vnd/vnodeCommit.c @@ -151,9 +151,9 @@ static int vnodeEncodeConfig(const void *pObj, SJson *pJson) { if (tjsonAddIntegerToObject(pJson, "precision", pCfg->tsdbCfg.precision) < 0) return -1; if (tjsonAddIntegerToObject(pJson, "update", pCfg->tsdbCfg.update) < 0) return -1; if (tjsonAddIntegerToObject(pJson, "compression", pCfg->tsdbCfg.compression) < 0) return -1; - if (tjsonAddIntegerToObject(pJson, "daysPerFile", pCfg->tsdbCfg.daysPerFile) < 0) return -1; - if (tjsonAddIntegerToObject(pJson, "minRows", pCfg->tsdbCfg.minRowsPerFileBlock) < 0) return -1; - if (tjsonAddIntegerToObject(pJson, "maxRows", pCfg->tsdbCfg.maxRowsPerFileBlock) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "daysPerFile", pCfg->tsdbCfg.days) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "minRows", pCfg->tsdbCfg.minRows) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "maxRows", pCfg->tsdbCfg.maxRows) < 0) return -1; if (tjsonAddIntegerToObject(pJson, "keep0", pCfg->tsdbCfg.keep) < 0) return -1; if (tjsonAddIntegerToObject(pJson, "keep1", pCfg->tsdbCfg.keep1) < 0) return -1; if (tjsonAddIntegerToObject(pJson, "keep2", pCfg->tsdbCfg.keep2) < 0) return -1; @@ -178,9 +178,9 @@ static int vnodeDecodeConfig(const SJson *pJson, void *pObj) { if (tjsonGetNumberValue(pJson, "precision", pCfg->tsdbCfg.precision) < 0) return -1; if (tjsonGetNumberValue(pJson, "update", pCfg->tsdbCfg.update) < 0) return -1; if (tjsonGetNumberValue(pJson, "compression", pCfg->tsdbCfg.compression) < 0) return -1; - if (tjsonGetNumberValue(pJson, "daysPerFile", pCfg->tsdbCfg.daysPerFile) < 0) return -1; - if (tjsonGetNumberValue(pJson, "minRows", pCfg->tsdbCfg.minRowsPerFileBlock) < 0) return -1; - if (tjsonGetNumberValue(pJson, "maxRows", pCfg->tsdbCfg.maxRowsPerFileBlock) < 0) return -1; + if (tjsonGetNumberValue(pJson, "daysPerFile", pCfg->tsdbCfg.days) < 0) return -1; + if (tjsonGetNumberValue(pJson, "minRows", pCfg->tsdbCfg.minRows) < 0) return -1; + if (tjsonGetNumberValue(pJson, "maxRows", pCfg->tsdbCfg.maxRows) < 0) return -1; if (tjsonGetNumberValue(pJson, "keep0", pCfg->tsdbCfg.keep) < 0) return -1; if (tjsonGetNumberValue(pJson, "keep1", pCfg->tsdbCfg.keep1) < 0) return -1; if (tjsonGetNumberValue(pJson, "keep2", pCfg->tsdbCfg.keep2) < 0) return -1; From aa266dea4170a4ad0fb48911f19e420bf2cd44dc Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Fri, 15 Apr 2022 06:47:39 +0000 Subject: [PATCH 23/37] refact vnode --- source/dnode/mgmt/mgmt_vnode/src/vmHandle.c | 4 ++-- source/dnode/vnode/inc/vnode.h | 4 ++-- source/dnode/vnode/src/tsdb/tsdbCommit.c | 6 +++--- source/dnode/vnode/src/tsdb/tsdbFS.c | 2 +- source/dnode/vnode/src/tsdb/tsdbMemTable.c | 2 +- source/dnode/vnode/src/tsdb/tsdbOptions.c | 4 ++-- source/dnode/vnode/src/tsdb/tsdbRead.c | 2 +- source/dnode/vnode/src/vnd/vnodeCommit.c | 12 ++++++------ 8 files changed, 18 insertions(+), 18 deletions(-) diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c index 484b6646b5..bebb437cfe 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c @@ -91,9 +91,9 @@ static void vmGenerateVnodeCfg(SCreateVnodeReq *pCreate, SVnodeCfg *pCfg) { pCfg->keep = pCreate->daysToKeep0; pCfg->streamMode = pCreate->streamMode; pCfg->isWeak = true; - pCfg->tsdbCfg.keep = pCreate->daysToKeep0; - pCfg->tsdbCfg.keep1 = pCreate->daysToKeep2; pCfg->tsdbCfg.keep2 = pCreate->daysToKeep0; + pCfg->tsdbCfg.keep0 = pCreate->daysToKeep2; + pCfg->tsdbCfg.keep1 = pCreate->daysToKeep0; pCfg->tsdbCfg.lruCacheSize = pCreate->cacheBlockSize; pCfg->tsdbCfg.retentions = pCreate->pRetensions; pCfg->metaCfg.lruSize = pCreate->cacheBlockSize; diff --git a/source/dnode/vnode/inc/vnode.h b/source/dnode/vnode/inc/vnode.h index e42311fa9c..303376dba4 100644 --- a/source/dnode/vnode/inc/vnode.h +++ b/source/dnode/vnode/inc/vnode.h @@ -127,9 +127,9 @@ struct STsdbCfg { int32_t days; int32_t minRows; int32_t maxRows; - int32_t keep; - int32_t keep1; int32_t keep2; + int32_t keep0; + int32_t keep1; uint64_t lruCacheSize; SArray *retentions; }; diff --git a/source/dnode/vnode/src/tsdb/tsdbCommit.c b/source/dnode/vnode/src/tsdb/tsdbCommit.c index 8cbe3c9005..a1edb7cd9c 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCommit.c +++ b/source/dnode/vnode/src/tsdb/tsdbCommit.c @@ -217,9 +217,9 @@ void tsdbGetRtnSnap(STsdb *pRepo, SRtn *pRtn) { TSKEY minKey, midKey, maxKey, now; now = taosGetTimestamp(pCfg->precision); - minKey = now - pCfg->keep * tsTickPerDay[pCfg->precision]; - midKey = now - pCfg->keep2 * tsTickPerDay[pCfg->precision]; - maxKey = now - pCfg->keep1 * tsTickPerDay[pCfg->precision]; + minKey = now - pCfg->keep2 * tsTickPerDay[pCfg->precision]; + midKey = now - pCfg->keep1 * tsTickPerDay[pCfg->precision]; + maxKey = now - pCfg->keep0 * tsTickPerDay[pCfg->precision]; pRtn->minKey = minKey; pRtn->minFid = (int)(TSDB_KEY_FID(minKey, pCfg->days, pCfg->precision)); diff --git a/source/dnode/vnode/src/tsdb/tsdbFS.c b/source/dnode/vnode/src/tsdb/tsdbFS.c index ca363fdc1f..866c02cbb3 100644 --- a/source/dnode/vnode/src/tsdb/tsdbFS.c +++ b/source/dnode/vnode/src/tsdb/tsdbFS.c @@ -190,7 +190,7 @@ static int tsdbAddDFileSetToStatus(SFSStatus *pStatus, const SDFileSet *pSet) { // ================== STsdbFS STsdbFS *tsdbNewFS(const STsdbCfg *pCfg) { - int keep = pCfg->keep; + int keep = pCfg->keep2; int days = pCfg->days; int maxFSet = TSDB_MAX_FSETS(keep, days); STsdbFS *pfs; diff --git a/source/dnode/vnode/src/tsdb/tsdbMemTable.c b/source/dnode/vnode/src/tsdb/tsdbMemTable.c index a682715c2c..5f401c9b2b 100644 --- a/source/dnode/vnode/src/tsdb/tsdbMemTable.c +++ b/source/dnode/vnode/src/tsdb/tsdbMemTable.c @@ -263,7 +263,7 @@ static int tsdbScanAndConvertSubmitMsg(STsdb *pTsdb, SSubmitReq *pMsg) { SSubmitBlkIter blkIter = {0}; STSRow *row = NULL; TSKEY now = taosGetTimestamp(pTsdb->config.precision); - TSKEY minKey = now - tsTickPerDay[pTsdb->config.precision] * pTsdb->config.keep; + TSKEY minKey = now - tsTickPerDay[pTsdb->config.precision] * pTsdb->config.keep2; TSKEY maxKey = now + tsTickPerDay[pTsdb->config.precision] * pTsdb->config.days; terrno = TSDB_CODE_SUCCESS; diff --git a/source/dnode/vnode/src/tsdb/tsdbOptions.c b/source/dnode/vnode/src/tsdb/tsdbOptions.c index c3555cc835..3560c9feaa 100644 --- a/source/dnode/vnode/src/tsdb/tsdbOptions.c +++ b/source/dnode/vnode/src/tsdb/tsdbOptions.c @@ -20,9 +20,9 @@ const STsdbCfg defautlTsdbOptions = {.precision = 0, .days = 10, .minRows = 100, .maxRows = 4096, - .keep = 3650, - .keep1 = 3650, .keep2 = 3650, + .keep0 = 3650, + .keep1 = 3650, .update = 0, .compression = TWO_STAGE_COMP}; diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c index e5da0e3c37..1314ef7d1e 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead.c @@ -314,7 +314,7 @@ static int64_t getEarliestValidTimestamp(STsdb* pTsdb) { STsdbCfg* pCfg = &pTsdb->config; int64_t now = taosGetTimestamp(pCfg->precision); - return now - (tsTickPerDay[pCfg->precision] * pCfg->keep) + 1; // needs to add one tick + return now - (tsTickPerDay[pCfg->precision] * pCfg->keep2) + 1; // needs to add one tick } static void setQueryTimewindow(STsdbReadHandle* pTsdbReadHandle, STsdbQueryCond* pCond) { diff --git a/source/dnode/vnode/src/vnd/vnodeCommit.c b/source/dnode/vnode/src/vnd/vnodeCommit.c index c8323c30b9..ec071c44e3 100644 --- a/source/dnode/vnode/src/vnd/vnodeCommit.c +++ b/source/dnode/vnode/src/vnd/vnodeCommit.c @@ -154,9 +154,9 @@ static int vnodeEncodeConfig(const void *pObj, SJson *pJson) { if (tjsonAddIntegerToObject(pJson, "daysPerFile", pCfg->tsdbCfg.days) < 0) return -1; if (tjsonAddIntegerToObject(pJson, "minRows", pCfg->tsdbCfg.minRows) < 0) return -1; if (tjsonAddIntegerToObject(pJson, "maxRows", pCfg->tsdbCfg.maxRows) < 0) return -1; - if (tjsonAddIntegerToObject(pJson, "keep0", pCfg->tsdbCfg.keep) < 0) return -1; - if (tjsonAddIntegerToObject(pJson, "keep1", pCfg->tsdbCfg.keep1) < 0) return -1; - if (tjsonAddIntegerToObject(pJson, "keep2", pCfg->tsdbCfg.keep2) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "keep0", pCfg->tsdbCfg.keep2) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "keep1", pCfg->tsdbCfg.keep0) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "keep2", pCfg->tsdbCfg.keep1) < 0) return -1; if (tjsonAddIntegerToObject(pJson, "lruCacheSize", pCfg->tsdbCfg.lruCacheSize) < 0) return -1; return 0; @@ -181,9 +181,9 @@ static int vnodeDecodeConfig(const SJson *pJson, void *pObj) { if (tjsonGetNumberValue(pJson, "daysPerFile", pCfg->tsdbCfg.days) < 0) return -1; if (tjsonGetNumberValue(pJson, "minRows", pCfg->tsdbCfg.minRows) < 0) return -1; if (tjsonGetNumberValue(pJson, "maxRows", pCfg->tsdbCfg.maxRows) < 0) return -1; - if (tjsonGetNumberValue(pJson, "keep0", pCfg->tsdbCfg.keep) < 0) return -1; - if (tjsonGetNumberValue(pJson, "keep1", pCfg->tsdbCfg.keep1) < 0) return -1; - if (tjsonGetNumberValue(pJson, "keep2", pCfg->tsdbCfg.keep2) < 0) return -1; + if (tjsonGetNumberValue(pJson, "keep0", pCfg->tsdbCfg.keep2) < 0) return -1; + if (tjsonGetNumberValue(pJson, "keep1", pCfg->tsdbCfg.keep0) < 0) return -1; + if (tjsonGetNumberValue(pJson, "keep2", pCfg->tsdbCfg.keep1) < 0) return -1; if (tjsonGetNumberValue(pJson, "lruCacheSize", pCfg->tsdbCfg.lruCacheSize) < 0) return -1; return 0; From 98b98c8b851cb07a5e83208083dc714a10c1f891 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Fri, 15 Apr 2022 07:07:44 +0000 Subject: [PATCH 24/37] refact vnode --- source/dnode/mgmt/mgmt_vnode/src/vmHandle.c | 10 ++++ source/dnode/vnode/src/inc/vnd.h | 1 + source/dnode/vnode/src/vnd/vnodeCommit.c | 64 +++++++++++++++++---- 3 files changed, 65 insertions(+), 10 deletions(-) diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c index bebb437cfe..925197d708 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c @@ -121,6 +121,8 @@ static void vmGenerateWrapperCfg(SVnodesMgmt *pMgmt, SCreateVnodeReq *pCreate, S int32_t vmProcessCreateVnodeReq(SVnodesMgmt *pMgmt, SNodeMsg *pMsg) { SRpcMsg *pReq = &pMsg->rpcMsg; SCreateVnodeReq createReq = {0}; + char path[TSDB_FILENAME_LEN]; + if (tDeserializeSCreateVnodeReq(pReq->pCont, pReq->contLen, &createReq) != 0) { terrno = TSDB_CODE_INVALID_MSG; return -1; @@ -143,6 +145,14 @@ int32_t vmProcessCreateVnodeReq(SVnodesMgmt *pMgmt, SNodeMsg *pMsg) { return -1; } + // create vnode + snprintf(path, TSDB_FILENAME_LEN, "vnode%svnode%d", TD_DIRSEP, vnodeCfg.vgId); + if (vnodeCreate(path, &vnodeCfg, pMgmt->pTfs) < 0) { + tFreeSCreateVnodeReq(&createReq); + dError("vgId:%d, failed to create vnode since %s", createReq.vgId, terrstr()); + return -1; + } + SMsgCb msgCb = pMgmt->pDnode->data.msgCb; msgCb.pWrapper = pMgmt->pWrapper; msgCb.queueFps[QUERY_QUEUE] = vmPutMsgToQueryQueue; diff --git a/source/dnode/vnode/src/inc/vnd.h b/source/dnode/vnode/src/inc/vnd.h index 913fec64ed..cb40900e81 100644 --- a/source/dnode/vnode/src/inc/vnd.h +++ b/source/dnode/vnode/src/inc/vnd.h @@ -43,6 +43,7 @@ int vnodeGetTableMeta(SVnode* pVnode, SRpcMsg* pMsg); // vnodeCommit ==================== int vnodeSaveInfo(const char* dir, const SVnodeInfo* pCfg); int vnodeCommitInfo(const char* dir, const SVnodeInfo* pInfo); +int vnodeLoadInfo(const char* dir, SVnodeInfo* pInfo); #if 1 // SVBufPool diff --git a/source/dnode/vnode/src/vnd/vnodeCommit.c b/source/dnode/vnode/src/vnd/vnodeCommit.c index ec071c44e3..fa249d3ba1 100644 --- a/source/dnode/vnode/src/vnd/vnodeCommit.c +++ b/source/dnode/vnode/src/vnd/vnodeCommit.c @@ -19,7 +19,7 @@ #define VND_INFO_FNAME_TMP "vnode_tmp.json" static int vnodeEncodeInfo(const SVnodeInfo *pInfo, char **ppData); -static int vnodeDecodeInfo(uint8_t *pData, int len, SVnodeInfo *pInfo); +static int vnodeDecodeInfo(uint8_t *pData, SVnodeInfo *pInfo); static int vnodeStartCommit(SVnode *pVnode); static int vnodeEndCommit(SVnode *pVnode); static int vnodeCommit(void *arg); @@ -88,9 +88,53 @@ int vnodeCommitInfo(const char *dir, const SVnodeInfo *pInfo) { return 0; } -int vnodeLoadInfo(const char *dir) { - // TODO +int vnodeLoadInfo(const char *dir, SVnodeInfo *pInfo) { + char fname[TSDB_FILENAME_LEN]; + TdFilePtr pFile = NULL; + char *pData = NULL; + int64_t size; + + snprintf(fname, TSDB_FILENAME_LEN, "%s%s%s", dir, TD_DIRSEP, VND_INFO_FNAME); + + // read info + pFile = taosOpenFile(fname, TD_FILE_READ); + if (pFile == NULL) { + terrno = TAOS_SYSTEM_ERROR(errno); + return -1; + } + + if (taosFStatFile(pFile, &size, NULL) < 0) { + terrno = TAOS_SYSTEM_ERROR(errno); + goto _err; + } + + pData = taosMemoryMalloc(size); + if (pData == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + goto _err; + } + + if (taosReadFile(pFile, pData, size) < 0) { + terrno = TAOS_SYSTEM_ERROR(errno); + goto _err; + } + + taosCloseFile(&pFile); + + // decode info + if (vnodeDecodeInfo(pData, pInfo) < 0) { + taosMemoryFree(pData); + return -1; + } + + taosMemoryFree(pData); + return 0; + +_err: + taosCloseFile(&pFile); + taosMemoryFree(pData); + return -1; } int vnodeAsyncCommit(SVnode *pVnode) { @@ -154,9 +198,9 @@ static int vnodeEncodeConfig(const void *pObj, SJson *pJson) { if (tjsonAddIntegerToObject(pJson, "daysPerFile", pCfg->tsdbCfg.days) < 0) return -1; if (tjsonAddIntegerToObject(pJson, "minRows", pCfg->tsdbCfg.minRows) < 0) return -1; if (tjsonAddIntegerToObject(pJson, "maxRows", pCfg->tsdbCfg.maxRows) < 0) return -1; - if (tjsonAddIntegerToObject(pJson, "keep0", pCfg->tsdbCfg.keep2) < 0) return -1; - if (tjsonAddIntegerToObject(pJson, "keep1", pCfg->tsdbCfg.keep0) < 0) return -1; - if (tjsonAddIntegerToObject(pJson, "keep2", pCfg->tsdbCfg.keep1) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "keep0", pCfg->tsdbCfg.keep0) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "keep1", pCfg->tsdbCfg.keep1) < 0) return -1; + if (tjsonAddIntegerToObject(pJson, "keep2", pCfg->tsdbCfg.keep2) < 0) return -1; if (tjsonAddIntegerToObject(pJson, "lruCacheSize", pCfg->tsdbCfg.lruCacheSize) < 0) return -1; return 0; @@ -181,9 +225,9 @@ static int vnodeDecodeConfig(const SJson *pJson, void *pObj) { if (tjsonGetNumberValue(pJson, "daysPerFile", pCfg->tsdbCfg.days) < 0) return -1; if (tjsonGetNumberValue(pJson, "minRows", pCfg->tsdbCfg.minRows) < 0) return -1; if (tjsonGetNumberValue(pJson, "maxRows", pCfg->tsdbCfg.maxRows) < 0) return -1; - if (tjsonGetNumberValue(pJson, "keep0", pCfg->tsdbCfg.keep2) < 0) return -1; - if (tjsonGetNumberValue(pJson, "keep1", pCfg->tsdbCfg.keep0) < 0) return -1; - if (tjsonGetNumberValue(pJson, "keep2", pCfg->tsdbCfg.keep1) < 0) return -1; + if (tjsonGetNumberValue(pJson, "keep0", pCfg->tsdbCfg.keep0) < 0) return -1; + if (tjsonGetNumberValue(pJson, "keep1", pCfg->tsdbCfg.keep1) < 0) return -1; + if (tjsonGetNumberValue(pJson, "keep2", pCfg->tsdbCfg.keep2) < 0) return -1; if (tjsonGetNumberValue(pJson, "lruCacheSize", pCfg->tsdbCfg.lruCacheSize) < 0) return -1; return 0; @@ -239,7 +283,7 @@ _err: return -1; } -static int vnodeDecodeInfo(uint8_t *pData, int len, SVnodeInfo *pInfo) { +static int vnodeDecodeInfo(uint8_t *pData, SVnodeInfo *pInfo) { SJson *pJson = NULL; pJson = tjsonCreateObject(); From bc178c247df5c1a6fe1fdb38375c7aeafee82288 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Fri, 15 Apr 2022 07:49:33 +0000 Subject: [PATCH 25/37] fix a bug --- source/libs/scheduler/src/scheduler.c | 75 +++++++++++++-------------- 1 file changed, 37 insertions(+), 38 deletions(-) diff --git a/source/libs/scheduler/src/scheduler.c b/source/libs/scheduler/src/scheduler.c index 93bc16a7a2..9b652f2795 100644 --- a/source/libs/scheduler/src/scheduler.c +++ b/source/libs/scheduler/src/scheduler.c @@ -14,12 +14,12 @@ */ #include "catalog.h" +#include "command.h" #include "query.h" #include "schedulerInt.h" #include "tmsg.h" #include "tref.h" #include "trpc.h" -#include "command.h" SSchedulerMgmt schMgmt = {0}; @@ -68,8 +68,8 @@ int32_t schInitTask(SSchJob *pJob, SSchTask *pTask, SSubplan *pPlan, SSchLevel * } int32_t schInitJob(SSchJob **pSchJob, SQueryPlan *pDag, void *transport, SArray *pNodeList, const char *sql, - int64_t startTs, bool syncSchedule) { - int32_t code = 0; + int64_t startTs, bool syncSchedule) { + 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)); @@ -141,7 +141,6 @@ _return: SCH_RET(code); } - void schFreeRpcCtx(SRpcCtx *pCtx) { if (NULL == pCtx) { return; @@ -1047,12 +1046,12 @@ _return: int32_t schProcessOnExplainDone(SSchJob *pJob, SSchTask *pTask, SRetrieveTableRsp *pRsp) { SCH_TASK_DLOG("got explain rsp, rows:%d, complete:%d", htonl(pRsp->numOfRows), pRsp->completed); - + atomic_store_32(&pJob->resNumOfRows, htonl(pRsp->numOfRows)); atomic_store_ptr(&pJob->resData, pRsp); SCH_SET_TASK_STATUS(pTask, JOB_TASK_STATUS_SUCCEED); - + schProcessOnDataFetched(pJob); return TSDB_CODE_SUCCESS; @@ -1146,7 +1145,7 @@ int32_t schHandleResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t msgType, ch if (NULL == msg) { SCH_ERR_JRET(TSDB_CODE_QRY_INVALID_INPUT); } - + if (!SCH_IS_EXPLAIN_JOB(pJob)) { SCH_TASK_ELOG("invalid msg received for none explain query, msg type:%s", TMSG_INFO(msgType)); SCH_ERR_JRET(TSDB_CODE_QRY_INVALID_INPUT); @@ -1180,13 +1179,13 @@ int32_t schHandleResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t msgType, ch } if (SCH_IS_EXPLAIN_JOB(pJob)) { - if (rsp->completed) { + if (rsp->completed) { SRetrieveTableRsp *pRsp = NULL; SCH_ERR_JRET(qExecExplainEnd(pJob->explainCtx, &pRsp)); if (pRsp) { SCH_ERR_JRET(schProcessOnExplainDone(pJob, pTask, pRsp)); } - + return TSDB_CODE_SUCCESS; } @@ -1238,23 +1237,24 @@ _return: } int32_t schGetTaskFromTaskList(SHashObj *pTaskList, uint64_t taskId, SSchTask **pTask) { - int32_t s = taosHashGetSize(pTaskList); - if (s <= 0) { - return TSDB_CODE_SUCCESS; - } - - SSchTask **task = taosHashGet(pTaskList, &taskId, sizeof(taskId)); - if (NULL == task || NULL == (*task)) { - return TSDB_CODE_SUCCESS; - } + int32_t s = taosHashGetSize(pTaskList); + if (s <= 0) { + return TSDB_CODE_SUCCESS; + } - *pTask = *task; + SSchTask **task = taosHashGet(pTaskList, &taskId, sizeof(taskId)); + if (NULL == task || NULL == (*task)) { + return TSDB_CODE_SUCCESS; + } - return TSDB_CODE_SUCCESS; + *pTask = *task; + + return TSDB_CODE_SUCCESS; } int32_t schUpdateTaskExecNodeHandle(SSchTask *pTask, void *handle, int32_t rspCode) { - if (rspCode || NULL == pTask->execNodes || taosArrayGetSize(pTask->execNodes) > 1 || taosArrayGetSize(pTask->execNodes) <= 0) { + if (rspCode || NULL == pTask->execNodes || taosArrayGetSize(pTask->execNodes) > 1 || + taosArrayGetSize(pTask->execNodes) <= 0) { return TSDB_CODE_SUCCESS; } @@ -1264,7 +1264,6 @@ int32_t schUpdateTaskExecNodeHandle(SSchTask *pTask, void *handle, int32_t rspCo return TSDB_CODE_SUCCESS; } - int32_t schHandleCallback(void *param, const SDataBuf *pMsg, int32_t msgType, int32_t rspCode) { int32_t code = 0; SSchTaskCallbackParam *pParam = (SSchTaskCallbackParam *)param; @@ -1282,13 +1281,15 @@ int32_t schHandleCallback(void *param, const SDataBuf *pMsg, int32_t msgType, in if (TDMT_VND_EXPLAIN_RSP == msgType) { schGetTaskFromTaskList(pJob->succTasks, pParam->taskId, &pTask); } else { - SCH_JOB_ELOG("task not found in execTask list, refId:%" PRIx64 ", taskId:%" PRIx64, pParam->refId, pParam->taskId); + SCH_JOB_ELOG("task not found in execTask list, refId:%" PRIx64 ", taskId:%" PRIx64, pParam->refId, + pParam->taskId); SCH_ERR_JRET(TSDB_CODE_SCH_INTERNAL_ERROR); } } - + if (NULL == pTask) { - SCH_JOB_ELOG("task not found in execList & succList, refId:%" PRIx64 ", taskId:%" PRIx64, pParam->refId, pParam->taskId); + SCH_JOB_ELOG("task not found in execList & succList, refId:%" PRIx64 ", taskId:%" PRIx64, pParam->refId, + pParam->taskId); SCH_ERR_JRET(TSDB_CODE_SCH_INTERNAL_ERROR); } @@ -1444,7 +1445,7 @@ int32_t schGetCallbackFp(int32_t msgType, __async_send_cb_fn_t *fp) { } int32_t schGenerateTaskCallBackAHandle(SSchJob *pJob, SSchTask *pTask, int32_t msgType, SMsgSendInfo **pMsgSendInfo) { - int32_t code = 0; + int32_t code = 0; SMsgSendInfo *msgSendInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo)); if (NULL == msgSendInfo) { SCH_TASK_ELOG("calloc %d failed", (int32_t)sizeof(SMsgSendInfo)); @@ -1565,7 +1566,7 @@ _return: } int32_t schMakeQueryRpcCtx(SSchJob *pJob, SSchTask *pTask, SRpcCtx *pCtx) { - int32_t code = 0; + int32_t code = 0; SMsgSendInfo *pReadyMsgSendInfo = NULL; SMsgSendInfo *pExplainMsgSendInfo = NULL; @@ -1578,7 +1579,7 @@ int32_t schMakeQueryRpcCtx(SSchJob *pJob, SSchTask *pTask, SRpcCtx *pCtx) { SCH_ERR_JRET(schGenerateTaskCallBackAHandle(pJob, pTask, TDMT_VND_RES_READY, &pReadyMsgSendInfo)); SCH_ERR_JRET(schGenerateTaskCallBackAHandle(pJob, pTask, TDMT_VND_EXPLAIN, &pExplainMsgSendInfo)); - int32_t msgType = TDMT_VND_RES_READY_RSP; + int32_t msgType = TDMT_VND_RES_READY_RSP; SRpcCtxVal ctxVal = {.val = pReadyMsgSendInfo, .clone = schCloneSMsgSendInfo, .freeFunc = schFreeRpcCtxVal}; if (taosHashPut(pCtx->args, &msgType, sizeof(msgType), &ctxVal, sizeof(ctxVal))) { SCH_TASK_ELOG("taosHashPut msg %d to rpcCtx failed", msgType); @@ -1599,7 +1600,7 @@ int32_t schMakeQueryRpcCtx(SSchJob *pJob, SSchTask *pTask, SRpcCtx *pCtx) { _return: taosHashCleanup(pCtx->args); - + if (pReadyMsgSendInfo) { taosMemoryFreeClear(pReadyMsgSendInfo->param); taosMemoryFreeClear(pReadyMsgSendInfo); @@ -1818,7 +1819,7 @@ _return: taosMemoryFreeClear(pMsgSendInfo->param); taosMemoryFreeClear(pMsgSendInfo); } - + SCH_RET(code); } @@ -2319,7 +2320,7 @@ _return: } int32_t schExecStaticExplain(void *transport, SArray *pNodeList, SQueryPlan *pDag, int64_t *job, const char *sql, - bool syncSchedule) { + bool syncSchedule) { qDebug("QID:0x%" PRIx64 " job started", pDag->queryId); int32_t code = 0; @@ -2608,7 +2609,7 @@ int32_t schedulerFetchRows(int64_t job, void **pData) { 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); @@ -2670,11 +2671,11 @@ int32_t schedulerGetTasksStatus(int64_t job, SArray *pSub) { for (int32_t i = pJob->levelNum - 1; i >= 0; --i) { SSchLevel *pLevel = taosArrayGet(pJob->levels, i); - + for (int32_t m = 0; m < pLevel->taskNum; ++m) { - SSchTask *pTask = taosArrayGet(pLevel->subTasks, m); + SSchTask *pTask = taosArrayGet(pLevel->subTasks, m); SQuerySubDesc subDesc = {.tid = pTask->taskId, .status = pTask->status}; - + taosArrayPush(pSub, &subDesc); } } @@ -2682,7 +2683,6 @@ int32_t schedulerGetTasksStatus(int64_t job, SArray *pSub) { return TSDB_CODE_SUCCESS; } - int32_t scheduleCancelJob(int64_t job) { SSchJob *pJob = schAcquireJob(job); if (NULL == pJob) { @@ -2738,11 +2738,10 @@ void schedulerDestroy(void) { while (pJob) { taosRemoveRef(schMgmt.jobRef, pJob->refId); - pJob = taosIterateRef(schMgmt.jobRef, pJob->refId); + pJob = taosIterateRef(schMgmt.jobRef, pJob); } taosCloseRef(schMgmt.jobRef); schMgmt.jobRef = 0; } } - From e61d176305593323a950b35e0b26bec68a8550cd Mon Sep 17 00:00:00 2001 From: cpwu Date: Fri, 15 Apr 2022 16:48:19 +0800 Subject: [PATCH 26/37] fix stddev.case --- tests/script/tsim/query/stddev.sim | 515 +++++++++++++++++++++++------ 1 file changed, 408 insertions(+), 107 deletions(-) diff --git a/tests/script/tsim/query/stddev.sim b/tests/script/tsim/query/stddev.sim index 70a9719b40..74bc444da2 100644 --- a/tests/script/tsim/query/stddev.sim +++ b/tests/script/tsim/query/stddev.sim @@ -1,17 +1,16 @@ system sh/stop_dnodes.sh - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c walLevel -v 1 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 + $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 @@ -23,108 +22,410 @@ endi sql connect -$dbPrefix = db -$tbPrefix = ctb -$mtPrefix = stb -$tbNum = 10 -$rowNum = 20 -$totalNum = 200 - -print =============== step1 -$i = 0 -$db = $dbPrefix . $i -$mt = $mtPrefix . $i - -sql drop database $db -x step1 -step1: -sql create database $db -sql use $db -sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) - -$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 ) - $x = $x + 1 - endw - - $i = $i + 1 -endw - -sleep 100 - -print =============== step2 -$i = 1 -$tb = $tbPrefix . $i - -sql select stddev(tbcol) from $tb -print ===> $data00 -if $data00 != 5.766281297 then - return -1 -endi - -print =============== step3 -$cc = 4 * 60000 -$ms = 1601481600000 + $cc - -print ===> select stddev(tbcol) from $tb where ts <= $ms -sql select stddev(tbcol) from $tb where ts <= $ms -print ====> $data00 $data01 $data02 $data03 $data04 $data05 -if $data00 != 1.414213562 then - return -1 -endi - -print =============== step4 -sql select stddev(tbcol) as b from $tb -print ===> $data00 -if $data00 != 5.766281297 then - return -1 -endi - -print =============== step5 -sql select _wstartts, stddev(tbcol) as b from $tb interval(1m) -print ===> $data01 -if $data01 != 0.000000000 then - print expect 0.000000000, actual: $data01 - return -1 -endi - -sql select _wstartts, stddev(tbcol) as b from $tb interval(1d) -print ===> $data01 -if $data01 != 5.766281297 then - return -1 -endi - -print =============== step6 -$cc = 4 * 60000 -$ms = 1601481600000 + $cc - -print select _wstartts, stddev(tbcol) as b from $tb where ts <= $ms interval(1m) -sql select _wstartts, stddev(tbcol) as b from $tb where ts <= $ms interval(1m) -print ===> $data01 -if $data01 != 0.000000000 then - return -1 -endi - -print $data00 , $data10 , $data20 , $data30 , $data40 , $data50 , $data60 - -if $rows != 5 then - print expect 5, actual: $rows - return -1 -endi - -print =============== clear -sql drop database $db +print =============== create database +sql create database db sql show databases +if $rows != 3 then + return -1 +endi + +sql use db + +print =============== create super table and child table +sql create table stb1 (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp) tags (t1 int) +sql show stables +print $rows $data00 $data01 $data02 if $rows != 1 then return -1 endi +sql create table ct1 using stb1 tags ( 1 ) +sql create table ct2 using stb1 tags ( 2 ) +sql create table ct3 using stb1 tags ( 3 ) +sql create table ct4 using stb1 tags ( 4 ) +sql show tables +print $rows $data00 $data10 $data20 +if $rows != 4 then + return -1 +endi + +sql create table t1 (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp) + +print =============== insert data into child table ct1 (s) +sql insert into ct1 values ( '2022-01-01 01:01:01.000', 1, 11111, 111, 11, 1.11, 11.11, 1, "binary1", "nchar1", now+1a ) +sql insert into ct1 values ( '2022-01-01 01:01:06.000', 2, 22222, 222, 22, 2.22, 22.22, 0, "binary2", "nchar2", now+2a ) +sql insert into ct1 values ( '2022-01-01 01:01:10.000', 3, 33333, 333, 33, 3.33, 33.33, 0, "binary3", "nchar3", now+3a ) +sql insert into ct1 values ( '2022-01-01 01:01:16.000', 4, 44444, 444, 44, 4.44, 44.44, 1, "binary4", "nchar4", now+4a ) +sql insert into ct1 values ( '2022-01-01 01:01:20.000', 5, 55555, 555, 55, 5.55, 55.55, 0, "binary5", "nchar5", now+5a ) +sql insert into ct1 values ( '2022-01-01 01:01:26.000', 6, 66666, 666, 66, 6.66, 66.66, 1, "binary6", "nchar6", now+6a ) +sql insert into ct1 values ( '2022-01-01 01:01:30.000', 7, 00000, 000, 00, 0.00, 00.00, 1, "binary7", "nchar7", now+7a ) +sql insert into ct1 values ( '2022-01-01 01:01:36.000', 8, -88888, -888, -88, -8.88, -88.88, 0, "binary8", "nchar8", now+8a ) + +print =============== insert data into child table ct4 (y) +sql insert into ct4 values ( '2019-01-21 01:01:01.000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) +sql insert into ct4 values ( '2019-10-21 01:01:01.000', 1, 11111, 111, 11, 1.11, 11.11, 1, "binary1", "nchar1", now+1a ) +sql insert into ct4 values ( '2019-12-31 01:01:01.000', 2, 22222, 222, 22, 2.22, 22.22, 0, "binary2", "nchar2", now+2a ) +sql insert into ct4 values ( '2020-01-01 01:01:06.000', 3, 33333, 333, 33, 3.33, 33.33, 0, "binary3", "nchar3", now+3a ) +sql insert into ct4 values ( '2020-05-07 01:01:10.000', 4, 44444, 444, 44, 4.44, 44.44, 1, "binary4", "nchar4", now+4a ) +sql insert into ct4 values ( '2020-09-30 01:01:16.000', 5, 55555, 555, 55, 5.55, 55.55, 0, "binary5", "nchar5", now+5a ) +sql insert into ct4 values ( '2020-12-21 01:01:01.000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) +sql insert into ct4 values ( '2021-02-01 01:01:20.000', 6, 66666, 666, 66, 6.66, 66.66, 1, "binary6", "nchar6", now+6a ) +sql insert into ct4 values ( '2021-10-28 01:01:26.000', 7, 00000, 000, 00, 0.00, 00.00, 1, "binary7", "nchar7", "1970-01-01 08:00:00.000" ) +sql insert into ct4 values ( '2021-12-01 01:01:30.000', 8, -88888, -888, -88, -8.88, -88.88, 0, "binary8", "nchar8", "1969-01-01 01:00:00.000" ) +sql insert into ct4 values ( '2022-02-31 01:01:36.000', 9, -99999999999999999, -999, -99, -9.99, -999999999999999999999.99, 1, "binary9", "nchar9", "1900-01-01 00:00:00.000" ) +sql insert into ct4 values ( '2022-05-21 01:01:01.000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) + +print =============== insert data into child table t1 +sql insert into t1 values ( '2020-10-21 01:01:01.000', 1, 11111, 111, 11, 1.11, 11.11, 1, "binary1", "nchar1", now+1a ) +sql insert into t1 values ( '2020-12-31 01:01:01.000', 2, 22222, 222, 22, 2.22, 22.22, 0, "binary2", "nchar2", now+2a ) +sql insert into t1 values ( '2021-01-01 01:01:06.000', 3, 33333, 333, 33, 3.33, 33.33, 0, "binary3", "nchar3", now+3a ) +sql insert into t1 values ( '2021-05-07 01:01:10.000', 4, 44444, 444, 44, 4.44, 44.44, 1, "binary4", "nchar4", now+4a ) +sql insert into t1 values ( '2021-09-30 01:01:16.000', 5, 55555, 555, 55, 5.55, 55.55, 0, "binary5", "nchar5", now+5a ) +sql insert into t1 values ( '2022-02-01 01:01:20.000', 6, 66666, 666, 66, 6.66, 66.66, 1, "binary6", "nchar6", now+6a ) +sql insert into t1 values ( '2022-10-28 01:01:26.000', 7, 00000, 000, 00, 0.00, 00.00, 1, "binary7", "nchar7", "1970-01-01 08:00:00.000" ) +sql insert into t1 values ( '2022-12-01 01:01:30.000', 8, -88888, -888, -88, -8.88, -88.88, 0, "binary8", "nchar8", "1969-01-01 01:00:00.000" ) +sql insert into t1 values ( '2022-12-31 01:01:36.000', 9, -99999999999999999, -999, -99, -9.99, -999999999999999999999.99, 1, "binary9", "nchar9", "1900-01-01 00:00:00.000" ) + +print ================ start query ====================== + +print =============== step1 +print =====sql : select stddev(c1) as b from ct4 +sql select stddev(c1) as b from ct4 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c1) as b from t1 +sql select stddev(c1) as b from t1 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select _wstartts, stddev(c1) as b from ct4 interval(1y) +sql select _wstartts, stddev(c1) as b from ct4 interval(1y) +print ===> $rows +if $rows != 4 then + return -1 +endi + +print =====sql : select _wstartts, stddev(c1) as b from t1 interval(1y) +sql select _wstartts, stddev(c1) as b from t1 interval(1y) +print ===> $rows +if $rows != 3 then + return -1 +endi + +print =====select _wstartts, stddev(c1) as b from ct4 where c1 <= 6 interval(180d) +sql select _wstartts, stddev(c1) as b from ct4 where c1 <= 6 interval(180d) +# print ===> $rows +# if $rows != 3 then +# return -1 +# endi + +print =====select _wstartts, stddev(c1) as b from t1 where c1 <= 6 interval(180d) +sql select _wstartts, stddev(c1) as b from t1 where c1 <= 6 interval(180d) +# print ===> $rows +# if $rows != 3 then +# return -1 +# endi + +print =====sql : select stddev(c1) a1, sum(c1) b1 from ct4 +sql select stddev(c1) a1, sum(c1) b1 from ct4 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c1) a1, sum(c1) b1 from t1 +sql select stddev(c1) a1, sum(c1) b1 from t1 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c1)+sum(c1) b1 from ct4 +sql select stddev(c1)+sum(c1) b1 from ct4 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c1)+sum(c1) b1 from t1 +sql select stddev(c1)+sum(c1) b1 from t1 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c2) from ct4 +sql select stddev(c2) from ct4 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c2) from t1 +sql select stddev(c2) from t1 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c3) from ct4 +sql select stddev(c3) from ct4 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c3) from t1 +sql select stddev(c3) from t1 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c4) from ct4 +sql select stddev(c4) from ct4 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c4) from t1 +sql select stddev(c4) from t1 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c5) from ct4 +sql select stddev(c5) from ct4 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c5) from t1 +sql select stddev(c5) from t1 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c6) from ct4 +sql select stddev(c6) from ct4 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c6) from t1 +sql select stddev(c6) from t1 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c7) from ct4 +sql_error select stddev(c7) from ct4 +# print ===> $rows +# if $rows != 1 then +# return -1 +# endi + +print =====sql : select stddev(c7) from t1 +sql_error select stddev(c7) from t1 +# print ===> $rows +# if $rows != 1 then +# return -1 +# endi + +#================================================= +print =============== stop and restart taosd system sh/exec.sh -n dnode1 -s stop -x SIGINT +system sh/exec.sh -n dnode1 -s start + +$loop_cnt = 0 +check_dnode_ready_0: + $loop_cnt = $loop_cnt + 1 + sleep 200 + if $loop_cnt == 10 then + print ====> dnode not ready! + return -1 + endi + +sql show dnodes +print ===> $rows $data00 $data01 $data02 $data03 $data04 $data05 +if $data00 != 1 then + return -1 +endi +if $data04 != ready then + goto check_dnode_ready_0 +endi + +print =============== step2 after wal +print =====sql : select stddev(c1) as b from ct4 +sql select stddev(c1) as b from ct4 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c1) as b from t1 +sql select stddev(c1) as b from t1 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select _wstartts, stddev(c1) as b from ct4 interval(1y) +sql select _wstartts, stddev(c1) as b from ct4 interval(1y) +print ===> $rows +if $rows != 4 then + return -1 +endi + +print =====sql : select _wstartts, stddev(c1) as b from t1 interval(1y) +sql select _wstartts, stddev(c1) as b from t1 interval(1y) +print ===> $rows +if $rows != 3 then + return -1 +endi + +print =====select _wstartts, stddev(c1) as b from ct4 where c1 <= 6 interval(180d) +sql select _wstartts, stddev(c1) as b from ct4 where c1 <= 6 interval(180d) +print ===> $rows +if $rows != 3 then + return -1 +endi + +print =====select _wstartts, stddev(c1) as b from t1 where c1 <= 6 interval(180d) +sql select _wstartts, stddev(c1) as b from t1 where c1 <= 6 interval(180d) +print ===> $rows +if $rows != 3 then + return -1 +endi + +print =====sql : select stddev(c1) a1, sum(c1) b1 from ct4 +sql select stddev(c1) a1, sum(c1) b1 from ct4 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c1) a1, sum(c1) b1 from t1 +sql select stddev(c1) a1, sum(c1) b1 from t1 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c1)+sum(c1) b1 from ct4 +sql select stddev(c1)+sum(c1) b1 from ct4 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c1)+sum(c1) b1 from t1 +sql select stddev(c1)+sum(c1) b1 from t1 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c2) from ct4 +sql select stddev(c2) from ct4 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c2) from t1 +sql select stddev(c2) from t1 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c3) from ct4 +sql select stddev(c3) from ct4 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c3) from t1 +sql select stddev(c3) from t1 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c4) from ct4 +sql select stddev(c4) from ct4 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c4) from t1 +sql select stddev(c4) from t1 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c5) from ct4 +sql select stddev(c5) from ct4 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c5) from t1 +sql select stddev(c5) from t1 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c6) from ct4 +sql select stddev(c6) from ct4 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c6) from t1 +sql select stddev(c6) from t1 +print ===> $rows +if $rows != 1 then + return -1 +endi + +print =====sql : select stddev(c7) from ct4 +sql_error select stddev(c7) from ct4 +# print ===> $rows +# if $rows != 1 then +# return -1 +# endi + +print =====sql : select stddev(c7) from t1 +sql_error select stddev(c7) from t1 +# print ===> $rows +# if $rows != 1 then +# return -1 +# endi + +print =============== clear +sql drop database db +sql show databases +if $rows != 2 then + return -1 +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file From 911c81d230cd8c622c8018284d6797965baf6cd9 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Fri, 15 Apr 2022 17:12:31 +0800 Subject: [PATCH 27/37] fix scheduler quit issue --- source/libs/scheduler/src/scheduler.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/source/libs/scheduler/src/scheduler.c b/source/libs/scheduler/src/scheduler.c index 9b652f2795..4e59e1bea6 100644 --- a/source/libs/scheduler/src/scheduler.c +++ b/source/libs/scheduler/src/scheduler.c @@ -2734,11 +2734,14 @@ void schedulerFreeTaskList(SArray *taskList) { void schedulerDestroy(void) { if (schMgmt.jobRef) { SSchJob *pJob = taosIterateRef(schMgmt.jobRef, 0); - + int64_t refId = 0; + while (pJob) { + refId = pJob->refId; + taosRemoveRef(schMgmt.jobRef, pJob->refId); - pJob = taosIterateRef(schMgmt.jobRef, pJob); + pJob = taosIterateRef(schMgmt.jobRef, refId); } taosCloseRef(schMgmt.jobRef); From ba1f3f781584ded7f71eff59c95aa518cf15edc2 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Fri, 15 Apr 2022 18:30:01 +0800 Subject: [PATCH 28/37] feat: CREATE STREAM statement implement, and syntax of JSON data type implement. --- include/common/ttokendef.h | 118 +- include/libs/function/functionMgt.h | 1 + include/libs/nodes/cmdnodes.h | 27 + include/libs/nodes/nodes.h | 7 + source/common/src/ttypes.c | 4 +- source/dnode/mnode/impl/src/mndInfoSchema.c | 2 +- source/libs/function/inc/builtins.h | 1 + source/libs/function/src/builtins.c | 34 +- source/libs/function/src/functionMgt.c | 4 + source/libs/nodes/src/nodesUtilFuncs.c | 25 + source/libs/parser/inc/parAst.h | 6 +- source/libs/parser/inc/sql.y | 52 +- source/libs/parser/src/parAstCreater.c | 51 +- source/libs/parser/src/parTokenizer.c | 18 +- source/libs/parser/src/parTranslater.c | 181 +- source/libs/parser/src/sql.c | 4405 ++++++++++--------- source/libs/parser/test/parserAstTest.cpp | 36 +- source/libs/parser/test/parserTestMain.cpp | 23 + source/libs/parser/test/parserTestUtil.h | 16 + 19 files changed, 2758 insertions(+), 2253 deletions(-) create mode 100644 source/libs/parser/test/parserTestUtil.h diff --git a/include/common/ttokendef.h b/include/common/ttokendef.h index 23dd4b38ff..47f2303246 100644 --- a/include/common/ttokendef.h +++ b/include/common/ttokendef.h @@ -171,60 +171,69 @@ #define TK_BUFSIZE 153 #define TK_STREAM 154 #define TK_INTO 155 -#define TK_KILL 156 -#define TK_CONNECTION 157 -#define TK_MERGE 158 -#define TK_VGROUP 159 -#define TK_REDISTRIBUTE 160 -#define TK_SPLIT 161 -#define TK_SYNCDB 162 -#define TK_NULL 163 -#define TK_FIRST 164 -#define TK_LAST 165 -#define TK_CAST 166 -#define TK_NOW 167 -#define TK_TODAY 168 -#define TK_ROWTS 169 -#define TK_TBNAME 170 -#define TK_QSTARTTS 171 -#define TK_QENDTS 172 -#define TK_WSTARTTS 173 -#define TK_WENDTS 174 -#define TK_WDURATION 175 -#define TK_BETWEEN 176 -#define TK_IS 177 -#define TK_NK_LT 178 -#define TK_NK_GT 179 -#define TK_NK_LE 180 -#define TK_NK_GE 181 -#define TK_NK_NE 182 -#define TK_MATCH 183 -#define TK_NMATCH 184 -#define TK_JOIN 185 -#define TK_INNER 186 -#define TK_SELECT 187 -#define TK_DISTINCT 188 -#define TK_WHERE 189 -#define TK_PARTITION 190 -#define TK_BY 191 -#define TK_SESSION 192 -#define TK_STATE_WINDOW 193 -#define TK_SLIDING 194 -#define TK_FILL 195 -#define TK_VALUE 196 -#define TK_NONE 197 -#define TK_PREV 198 -#define TK_LINEAR 199 -#define TK_NEXT 200 -#define TK_GROUP 201 -#define TK_HAVING 202 -#define TK_ORDER 203 -#define TK_SLIMIT 204 -#define TK_SOFFSET 205 -#define TK_LIMIT 206 -#define TK_OFFSET 207 -#define TK_ASC 208 -#define TK_NULLS 209 +#define TK_TRIGGER 156 +#define TK_AT_ONCE 157 +#define TK_WINDOW_CLOSE 158 +#define TK_WATERMARK 159 +#define TK_KILL 160 +#define TK_CONNECTION 161 +#define TK_MERGE 162 +#define TK_VGROUP 163 +#define TK_REDISTRIBUTE 164 +#define TK_SPLIT 165 +#define TK_SYNCDB 166 +#define TK_NULL 167 +#define TK_NK_QUESTION 168 +#define TK_NK_ARROW 169 +#define TK_NOW 170 +#define TK_TODAY 171 +#define TK_ROWTS 172 +#define TK_TBNAME 173 +#define TK_QSTARTTS 174 +#define TK_QENDTS 175 +#define TK_WSTARTTS 176 +#define TK_WENDTS 177 +#define TK_WDURATION 178 +#define TK_CAST 179 +#define TK_COUNT 180 +#define TK_FIRST 181 +#define TK_LAST 182 +#define TK_LAST_ROW 183 +#define TK_BETWEEN 184 +#define TK_IS 185 +#define TK_NK_LT 186 +#define TK_NK_GT 187 +#define TK_NK_LE 188 +#define TK_NK_GE 189 +#define TK_NK_NE 190 +#define TK_MATCH 191 +#define TK_NMATCH 192 +#define TK_CONTAINS 193 +#define TK_JOIN 194 +#define TK_INNER 195 +#define TK_SELECT 196 +#define TK_DISTINCT 197 +#define TK_WHERE 198 +#define TK_PARTITION 199 +#define TK_BY 200 +#define TK_SESSION 201 +#define TK_STATE_WINDOW 202 +#define TK_SLIDING 203 +#define TK_FILL 204 +#define TK_VALUE 205 +#define TK_NONE 206 +#define TK_PREV 207 +#define TK_LINEAR 208 +#define TK_NEXT 209 +#define TK_GROUP 210 +#define TK_HAVING 211 +#define TK_ORDER 212 +#define TK_SLIMIT 213 +#define TK_SOFFSET 214 +#define TK_LIMIT 215 +#define TK_OFFSET 216 +#define TK_ASC 217 +#define TK_NULLS 218 #define TK_NK_SPACE 300 #define TK_NK_COMMENT 301 @@ -233,7 +242,6 @@ #define TK_NK_OCT 304 // oct number #define TK_NK_BIN 305 // bin format data 0b111 #define TK_NK_FILE 306 -#define TK_NK_QUESTION 307 // denoting the placeholder of "?",when invoking statement bind query #define TK_NK_BITNOT 501 #define TK_INSERT 502 diff --git a/include/libs/function/functionMgt.h b/include/libs/function/functionMgt.h index a471de3147..dc5bdc62e5 100644 --- a/include/libs/function/functionMgt.h +++ b/include/libs/function/functionMgt.h @@ -137,6 +137,7 @@ bool fmIsWindowPseudoColumnFunc(int32_t funcId); bool fmIsWindowClauseFunc(int32_t funcId); bool fmIsSpecialDataRequiredFunc(int32_t funcId); bool fmIsDynamicScanOptimizedFunc(int32_t funcId); +bool fmIsMultiResFunc(int32_t funcId); typedef enum EFuncDataRequired { FUNC_DATA_REQUIRED_ALL_NEEDED = 1, diff --git a/include/libs/nodes/cmdnodes.h b/include/libs/nodes/cmdnodes.h index e1a63bd66b..6810b63f4e 100644 --- a/include/libs/nodes/cmdnodes.h +++ b/include/libs/nodes/cmdnodes.h @@ -272,6 +272,33 @@ typedef struct SKillStmt { int32_t targetId; } SKillStmt; +typedef enum EStreamTriggerType { + STREAM_TRIGGER_AT_ONCE = 1, + STREAM_TRIGGER_WINDOW_CLOSE +} EStreamTriggerType; + +typedef struct SStreamOptions { + ENodeType type; + EStreamTriggerType triggerType; + SNode* pWatermark; +} SStreamOptions; + +typedef struct SCreateStreamStmt { + ENodeType type; + char streamName[TSDB_TABLE_NAME_LEN]; + char targetDbName[TSDB_DB_NAME_LEN]; + char targetTabName[TSDB_TABLE_NAME_LEN]; + bool ignoreExists; + SStreamOptions* pOptions; + SNode* pQuery; +} SCreateStreamStmt; + +typedef struct SDropStreamStmt { + ENodeType type; + char streamName[TSDB_TABLE_NAME_LEN]; + bool ignoreNotExists; +} SDropStreamStmt; + #ifdef __cplusplus } #endif diff --git a/include/libs/nodes/nodes.h b/include/libs/nodes/nodes.h index 02636a178e..8db93ee5f9 100644 --- a/include/libs/nodes/nodes.h +++ b/include/libs/nodes/nodes.h @@ -80,6 +80,7 @@ typedef enum ENodeType { QUERY_NODE_TABLE_OPTIONS, QUERY_NODE_INDEX_OPTIONS, QUERY_NODE_EXPLAIN_OPTIONS, + QUERY_NODE_STREAM_OPTIONS, // Statement nodes are used in parser and planner module. QUERY_NODE_SET_OPERATOR, @@ -151,6 +152,12 @@ typedef enum ENodeType { QUERY_NODE_SHOW_CONNECTIONS_STMT, QUERY_NODE_SHOW_QUERIES_STMT, QUERY_NODE_SHOW_VNODES_STMT, + QUERY_NODE_SHOW_APPS_STMT, + QUERY_NODE_SHOW_SCORES_STMT, + QUERY_NODE_SHOW_VARIABLE_STMT, + QUERY_NODE_SHOW_CREATE_DATABASE_STMT, + QUERY_NODE_SHOW_CREATE_TABLE_STMT, + QUERY_NODE_SHOW_CREATE_STABLE_STMT, QUERY_NODE_KILL_CONNECTION_STMT, QUERY_NODE_KILL_QUERY_STMT, diff --git a/source/common/src/ttypes.c b/source/common/src/ttypes.c index ef75adeb5d..cb8746c963 100644 --- a/source/common/src/ttypes.c +++ b/source/common/src/ttypes.c @@ -377,7 +377,7 @@ tDataTypeDescriptor tDataTypes[15] = { getStatics_i64}, {TSDB_DATA_TYPE_FLOAT, 5, FLOAT_BYTES, "FLOAT", 0, 0, tsCompressFloat, tsDecompressFloat, getStatics_f}, {TSDB_DATA_TYPE_DOUBLE, 6, DOUBLE_BYTES, "DOUBLE", 0, 0, tsCompressDouble, tsDecompressDouble, getStatics_d}, - {TSDB_DATA_TYPE_BINARY, 6, 0, "BINARY", 0, 0, tsCompressString, tsDecompressString, getStatics_bin}, + {TSDB_DATA_TYPE_VARCHAR, 6, 0, "VARCHAR", 0, 0, tsCompressString, tsDecompressString, getStatics_bin}, {TSDB_DATA_TYPE_TIMESTAMP, 9, LONG_BYTES, "TIMESTAMP", INT64_MIN, INT64_MAX, tsCompressTimestamp, tsDecompressTimestamp, getStatics_i64}, {TSDB_DATA_TYPE_NCHAR, 5, 8, "NCHAR", 0, 0, tsCompressString, tsDecompressString, getStatics_nchr}, @@ -402,7 +402,7 @@ char tTokenTypeSwitcher[13] = { TSDB_DATA_TYPE_DOUBLE, // TK_DOUBLE TSDB_DATA_TYPE_BINARY, // TK_STRING TSDB_DATA_TYPE_BIGINT, // TK_TIMESTAMP - TSDB_DATA_TYPE_BINARY, // TK_BINARY + TSDB_DATA_TYPE_VARCHAR, // TK_BINARY TSDB_DATA_TYPE_NCHAR, // TK_NCHAR }; diff --git a/source/dnode/mnode/impl/src/mndInfoSchema.c b/source/dnode/mnode/impl/src/mndInfoSchema.c index c21a6e61df..b935939160 100644 --- a/source/dnode/mnode/impl/src/mndInfoSchema.c +++ b/source/dnode/mnode/impl/src/mndInfoSchema.c @@ -81,7 +81,7 @@ static const SInfosTableSchema userDBSchema[] = { {.name = "blocks", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, {.name = "minrows", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, {.name = "maxrows", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, - {.name = "wallevel", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT}, + {.name = "wal", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT}, {.name = "fsync", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, {.name = "comp", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT}, {.name = "cachelast", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT}, diff --git a/source/libs/function/inc/builtins.h b/source/libs/function/inc/builtins.h index 814076fc34..fb36c9d978 100644 --- a/source/libs/function/inc/builtins.h +++ b/source/libs/function/inc/builtins.h @@ -37,6 +37,7 @@ extern "C" { #define FUNC_MGT_WINDOW_PC_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(8) #define FUNC_MGT_SPECIAL_DATA_REQUIRED FUNC_MGT_FUNC_CLASSIFICATION_MASK(9) #define FUNC_MGT_DYNAMIC_SCAN_OPTIMIZED FUNC_MGT_FUNC_CLASSIFICATION_MASK(10) +#define FUNC_MGT_MULTI_RES_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(11) #define FUNC_MGT_TEST_MASK(val, mask) (((val) & (mask)) != 0) diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index 49504b2cd4..9d434222ff 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -203,9 +203,9 @@ static int32_t translateLastRow(SFunctionNode* pFunc, char* pErrBuf, int32_t len } static int32_t translateFirstLast(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - // first(*)/first(col_list) has been rewritten as first(col) + // first(col_list) will be rewritten as first(col) if (1 != LIST_LENGTH(pFunc->pParameterList)) { - return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); + return TSDB_CODE_SUCCESS; } SNode* pPara = nodesListGetNode(pFunc->pParameterList, 0); @@ -370,6 +370,20 @@ static int32_t translateTimeDiff(SFunctionNode* pFunc, char* pErrBuf, int32_t le return TSDB_CODE_SUCCESS; } +static int32_t translateToJson(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { + if (1 != LIST_LENGTH(pFunc->pParameterList)) { + return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName); + } + + SExprNode* pPara = nodesListGetNode(pFunc->pParameterList, 0); + if (QUERY_NODE_VALUE != nodeType(pPara) || (!IS_VAR_DATA_TYPE(pPara->resType.type))) { + return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); + } + + pFunc->node.resType = (SDataType) { .bytes = tDataTypes[TSDB_DATA_TYPE_JSON].bytes, .type = TSDB_DATA_TYPE_JSON}; + return TSDB_CODE_SUCCESS; +} + const SBuiltinFuncDefinition funcMgtBuiltins[] = { { .name = "count", @@ -475,7 +489,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { { .name = "last_row", .type = FUNCTION_TYPE_LAST_ROW, - .classification = FUNC_MGT_AGG_FUNC, + .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_MULTI_RES_FUNC, .translateFunc = translateLastRow, .getEnvFunc = getMinmaxFuncEnv, .initFunc = maxFunctionSetup, @@ -485,7 +499,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { { .name = "first", .type = FUNCTION_TYPE_FIRST, - .classification = FUNC_MGT_AGG_FUNC, + .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_MULTI_RES_FUNC, .translateFunc = translateFirstLast, .getEnvFunc = getFirstLastFuncEnv, .initFunc = functionSetup, @@ -495,7 +509,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { { .name = "last", .type = FUNCTION_TYPE_LAST, - .classification = FUNC_MGT_AGG_FUNC, + .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_MULTI_RES_FUNC, .translateFunc = translateFirstLast, .getEnvFunc = getFirstLastFuncEnv, .initFunc = functionSetup, @@ -861,6 +875,16 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .initFunc = NULL, .sprocessFunc = winDurFunction, .finalizeFunc = NULL + }, + { + .name = "to_json", + .type = FUNCTION_TYPE_TO_JSON, + .classification = FUNC_MGT_SCALAR_FUNC, + .translateFunc = translateToJson, + .getEnvFunc = NULL, + .initFunc = NULL, + .sprocessFunc = NULL, + .finalizeFunc = NULL } }; diff --git a/source/libs/function/src/functionMgt.c b/source/libs/function/src/functionMgt.c index aec75a0365..9bcbbb5d5a 100644 --- a/source/libs/function/src/functionMgt.c +++ b/source/libs/function/src/functionMgt.c @@ -138,6 +138,10 @@ bool fmIsDynamicScanOptimizedFunc(int32_t funcId) { return isSpecificClassifyFunc(funcId, FUNC_MGT_DYNAMIC_SCAN_OPTIMIZED); } +bool fmIsMultiResFunc(int32_t funcId) { + return isSpecificClassifyFunc(funcId, FUNC_MGT_MULTI_RES_FUNC); +} + void fmFuncMgtDestroy() { void* m = gFunMgtService.pFuncNameHashTable; if (m != NULL && atomic_val_compare_exchange_ptr((void**)&gFunMgtService.pFuncNameHashTable, m, 0) == m) { diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index e1a486d8b1..d4457a056e 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -84,6 +84,8 @@ SNodeptr nodesMakeNode(ENodeType type) { return makeNode(type, sizeof(SIndexOptions)); case QUERY_NODE_EXPLAIN_OPTIONS: return makeNode(type, sizeof(SExplainOptions)); + case QUERY_NODE_STREAM_OPTIONS: + return makeNode(type, sizeof(SStreamOptions)); case QUERY_NODE_SET_OPERATOR: return makeNode(type, sizeof(SSetOperator)); case QUERY_NODE_SELECT_STMT: @@ -146,6 +148,19 @@ SNodeptr nodesMakeNode(ENodeType type) { return makeNode(type, sizeof(SDescribeStmt)); case QUERY_NODE_RESET_QUERY_CACHE_STMT: return makeNode(type, sizeof(SNode)); + case QUERY_NODE_COMPACT_STMT: + case QUERY_NODE_CREATE_FUNCTION_STMT: + case QUERY_NODE_DROP_FUNCTION_STMT: + break; + case QUERY_NODE_CREATE_STREAM_STMT: + return makeNode(type, sizeof(SCreateStreamStmt)); + case QUERY_NODE_DROP_STREAM_STMT: + return makeNode(type, sizeof(SDropStreamStmt)); + case QUERY_NODE_MERGE_VGROUP_STMT: + case QUERY_NODE_REDISTRIBUTE_VGROUP_STMT: + case QUERY_NODE_SPLIT_VGROUP_STMT: + case QUERY_NODE_SYNCDB_STMT: + break; case QUERY_NODE_SHOW_DNODES_STMT: case QUERY_NODE_SHOW_MNODES_STMT: case QUERY_NODE_SHOW_MODULES_STMT: @@ -169,7 +184,16 @@ SNodeptr nodesMakeNode(ENodeType type) { case QUERY_NODE_SHOW_CONFIGS_STMT: case QUERY_NODE_SHOW_QUERIES_STMT: case QUERY_NODE_SHOW_VNODES_STMT: + case QUERY_NODE_SHOW_APPS_STMT: + case QUERY_NODE_SHOW_SCORES_STMT: + case QUERY_NODE_SHOW_VARIABLE_STMT: + case QUERY_NODE_SHOW_CREATE_DATABASE_STMT: + case QUERY_NODE_SHOW_CREATE_TABLE_STMT: + case QUERY_NODE_SHOW_CREATE_STABLE_STMT: return makeNode(type, sizeof(SShowStmt)); + case QUERY_NODE_KILL_CONNECTION_STMT: + case QUERY_NODE_KILL_QUERY_STMT: + return makeNode(type, sizeof(SKillStmt)); case QUERY_NODE_LOGIC_PLAN_SCAN: return makeNode(type, sizeof(SScanLogicNode)); case QUERY_NODE_LOGIC_PLAN_JOIN: @@ -675,6 +699,7 @@ int32_t nodesListAppend(SNodeList* pList, SNodeptr pNode) { if (NULL != pList->pTail) { pList->pTail->pNext = p; } + p->pPrev = pList->pTail; pList->pTail = p; ++(pList->length); return TSDB_CODE_SUCCESS; diff --git a/source/libs/parser/inc/parAst.h b/source/libs/parser/inc/parAst.h index 1fa3a18668..160bc8e075 100644 --- a/source/libs/parser/inc/parAst.h +++ b/source/libs/parser/inc/parAst.h @@ -86,6 +86,7 @@ SNode* createColumnNode(SAstCreateContext* pCxt, SToken* pTableAlias, SToken* pC SNode* createValueNode(SAstCreateContext* pCxt, int32_t dataType, const SToken* pLiteral); SNode* createDurationValueNode(SAstCreateContext* pCxt, const SToken* pLiteral); SNode* createDefaultDatabaseCondValue(SAstCreateContext* pCxt); +SNode* createPlaceholderValueNode(SAstCreateContext* pCxt); SNode* setProjectionAlias(SAstCreateContext* pCxt, SNode* pNode, const SToken* pAlias); SNode* createLogicConditionNode(SAstCreateContext* pCxt, ELogicConditionType type, SNode* pParam1, SNode* pParam2); SNode* createOperatorNode(SAstCreateContext* pCxt, EOperatorType type, SNode* pLeft, SNode* pRight); @@ -165,8 +166,9 @@ SNode* createResetQueryCacheStmt(SAstCreateContext* pCxt); SNode* createCompactStmt(SAstCreateContext* pCxt, SNodeList* pVgroups); SNode* createCreateFunctionStmt(SAstCreateContext* pCxt, bool aggFunc, const SToken* pFuncName, const SToken* pLibPath, SDataType dataType, int32_t bufSize); SNode* createDropFunctionStmt(SAstCreateContext* pCxt, const SToken* pFuncName); -SNode* createCreateStreamStmt(SAstCreateContext* pCxt, const SToken* pStreamName, const SToken* pTableName, SNode* pQuery); -SNode* createDropStreamStmt(SAstCreateContext* pCxt, const SToken* pStreamName); +SNode* createStreamOptions(SAstCreateContext* pCxt); +SNode* createCreateStreamStmt(SAstCreateContext* pCxt, bool ignoreExists, const SToken* pStreamName, SNode* pRealTable, SNode* pOptions, SNode* pQuery); +SNode* createDropStreamStmt(SAstCreateContext* pCxt, bool ignoreNotExists, const SToken* pStreamName); SNode* createKillStmt(SAstCreateContext* pCxt, ENodeType type, const SToken* pId); SNode* createMergeVgroupStmt(SAstCreateContext* pCxt, const SToken* pVgId1, const SToken* pVgId2); SNode* createRedistributeVgroupStmt(SAstCreateContext* pCxt, const SToken* pVgId, SNodeList* pDnodes); diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index 3c3cea8ea3..132a746828 100644 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -293,6 +293,7 @@ tags_def(A) ::= TAGS NK_LP column_def_list(B) NK_RP. table_options(A) ::= . { A = createTableOptions(pCxt); } table_options(A) ::= table_options(B) COMMENT NK_STRING(C). { ((STableOptions*)B)->pComments = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &C); A = B; } table_options(A) ::= table_options(B) KEEP integer_list(C). { ((STableOptions*)B)->pKeep = C; A = B; } +table_options(A) ::= table_options(B) KEEP variable_list(C). { ((STableOptions*)B)->pKeep = C; A = B; } table_options(A) ::= table_options(B) TTL NK_INTEGER(C). { ((STableOptions*)B)->pTtl = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &C); A = B; } table_options(A) ::= table_options(B) SMA NK_LP col_name_list(C) NK_RP. { ((STableOptions*)B)->pSma = C; A = B; } table_options(A) ::= table_options(B) ROLLUP NK_LP func_name_list(C) NK_RP. { ((STableOptions*)B)->pFuncs = C; A = B; } @@ -306,6 +307,7 @@ alter_table_options(A) ::= alter_table_options(B) alter_table_option(C). %destructor alter_table_option { } alter_table_option(A) ::= COMMENT NK_STRING(B). { A.type = TABLE_OPTION_COMMENT; A.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &B); } alter_table_option(A) ::= KEEP integer_list(B). { A.type = TABLE_OPTION_KEEP; A.pList = B; } +alter_table_option(A) ::= KEEP variable_list(B). { A.type = TABLE_OPTION_KEEP; A.pList = B; } alter_table_option(A) ::= TTL NK_INTEGER(B). { A.type = TABLE_OPTION_TTL; A.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &B); } %type col_name_list { SNodeList* } @@ -424,8 +426,17 @@ bufsize_opt(A) ::= . bufsize_opt(A) ::= BUFSIZE NK_INTEGER(B). { A = strtol(B.z, NULL, 10); } /************************************************ create/drop stream **************************************************/ -cmd ::= CREATE STREAM stream_name(A) INTO table_name(B) AS query_expression(C). { pCxt->pRootNode = createCreateStreamStmt(pCxt, &A, &B, C); } -cmd ::= DROP STREAM stream_name(A). { pCxt->pRootNode = createDropStreamStmt(pCxt, &A); } +cmd ::= CREATE STREAM not_exists_opt(E) stream_name(A) + stream_options(B) into_opt(C) AS query_expression(D). { pCxt->pRootNode = createCreateStreamStmt(pCxt, E, &A, B, C, D); } +cmd ::= DROP STREAM exists_opt(A) stream_name(B). { pCxt->pRootNode = createDropStreamStmt(pCxt, A, &B); } + +into_opt(A) ::= . { A = NULL; } +into_opt(A) ::= INTO full_table_name(B). { A = B; } + +stream_options(A) ::= . { A = createStreamOptions(pCxt); } +stream_options(A) ::= stream_options(B) TRIGGER AT_ONCE. { ((SStreamOptions*)B)->triggerType = STREAM_TRIGGER_AT_ONCE; A = B; } +stream_options(A) ::= stream_options(B) TRIGGER WINDOW_CLOSE. { ((SStreamOptions*)B)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; A = B; } +stream_options(A) ::= stream_options(B) WATERMARK duration_literal(C). { ((SStreamOptions*)B)->pWatermark = releaseRawExprNode(pCxt, C); A = B; } /************************************************ kill connection/query ***********************************************/ cmd ::= KILL CONNECTION NK_INTEGER(A). { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &A); } @@ -455,6 +466,7 @@ literal(A) ::= NK_BOOL(B). literal(A) ::= TIMESTAMP(B) NK_STRING(C). { A = createRawExprNodeExt(pCxt, &B, &C, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &C)); } literal(A) ::= duration_literal(B). { A = B; } literal(A) ::= NULL(B). { A = createRawExprNode(pCxt, &B, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, NULL)); } +literal(A) ::= NK_QUESTION(B). { A = createRawExprNode(pCxt, &B, createPlaceholderValueNode(pCxt)); } duration_literal(A) ::= NK_VARIABLE(B). { A = createRawExprNode(pCxt, &B, createDurationValueNode(pCxt, &B)); } @@ -501,8 +513,6 @@ column_name(A) ::= NK_ID(B). %type function_name { SToken } %destructor function_name { } function_name(A) ::= NK_ID(B). { A = B; } -function_name(A) ::= FIRST(B). { A = B; } -function_name(A) ::= LAST(B). { A = B; } %type table_alias { SToken } %destructor table_alias { } @@ -530,12 +540,9 @@ stream_name(A) ::= NK_ID(B). /************************************************ expression **********************************************************/ expression(A) ::= literal(B). { A = B; } -//expression(A) ::= NK_QUESTION(B). { A = B; } expression(A) ::= pseudo_column(B). { A = B; } expression(A) ::= column_reference(B). { A = B; } -expression(A) ::= function_name(B) NK_LP expression_list(C) NK_RP(D). { A = createRawExprNodeExt(pCxt, &B, &D, createFunctionNode(pCxt, &B, C)); } -expression(A) ::= function_name(B) NK_LP NK_STAR(C) NK_RP(D). { A = createRawExprNodeExt(pCxt, &B, &D, createFunctionNode(pCxt, &B, createNodeList(pCxt, createColumnNode(pCxt, NULL, &C)))); } -expression(A) ::= CAST(B) NK_LP expression(C) AS type_name(D) NK_RP(E). { A = createRawExprNodeExt(pCxt, &B, &E, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, C), D)); } +expression(A) ::= function_expression(B). { A = B; } //expression(A) ::= case_expression(B). { A = B; } expression(A) ::= subquery(B). { A = B; } expression(A) ::= NK_LP(B) expression(C) NK_RP(D). { A = createRawExprNodeExt(pCxt, &B, &D, releaseRawExprNode(pCxt, C)); } @@ -572,6 +579,10 @@ expression(A) ::= expression(B) NK_REM expression(C). SToken e = getTokenFromRawExprNode(pCxt, C); A = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MOD, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C))); } +expression(A) ::= column_reference(B) NK_ARROW NK_STRING(C). { + SToken s = getTokenFromRawExprNode(pCxt, B); + A = createRawExprNodeExt(pCxt, &s, &C, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, B), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &C))); + } %type expression_list { SNodeList* } %destructor expression_list { nodesDestroyList($$); } @@ -591,6 +602,30 @@ pseudo_column(A) ::= WSTARTTS(B). pseudo_column(A) ::= WENDTS(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } pseudo_column(A) ::= WDURATION(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } +function_expression(A) ::= function_name(B) NK_LP expression_list(C) NK_RP(D). { A = createRawExprNodeExt(pCxt, &B, &D, createFunctionNode(pCxt, &B, C)); } +function_expression(A) ::= star_func(B) NK_LP star_func_para_list(C) NK_RP(D). { A = createRawExprNodeExt(pCxt, &B, &D, createFunctionNode(pCxt, &B, C)); } +function_expression(A) ::= CAST(B) NK_LP expression(C) AS type_name(D) NK_RP(E). { A = createRawExprNodeExt(pCxt, &B, &E, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, C), D)); } + +%type star_func { SToken } +%destructor star_func { } +star_func(A) ::= COUNT(B). { A = B; } +star_func(A) ::= FIRST(B). { A = B; } +star_func(A) ::= LAST(B). { A = B; } +star_func(A) ::= LAST_ROW(B). { A = B; } + +%type star_func_para_list { SNodeList* } +%destructor star_func_para_list { nodesDestroyList($$); } +star_func_para_list(A) ::= NK_STAR(B). { A = createNodeList(pCxt, createColumnNode(pCxt, NULL, &B)); } +star_func_para_list(A) ::= other_para_list(B). { A = B; } + +%type other_para_list { SNodeList* } +%destructor other_para_list { nodesDestroyList($$); } +other_para_list(A) ::= star_func_para(B). { A = createNodeList(pCxt, B); } +other_para_list(A) ::= other_para_list(B) NK_COMMA star_func_para(C). { A = addNodeToList(pCxt, B, C); } + +star_func_para(A) ::= expression(B). { A = releaseRawExprNode(pCxt, B); } +star_func_para(A) ::= table_name(B) NK_DOT NK_STAR(C). { A = createColumnNode(pCxt, &B, &C); } + /************************************************ predicate ***********************************************************/ predicate(A) ::= expression(B) compare_op(C) expression(D). { SToken s = getTokenFromRawExprNode(pCxt, B); @@ -634,6 +669,7 @@ compare_op(A) ::= LIKE. compare_op(A) ::= NOT LIKE. { A = OP_TYPE_NOT_LIKE; } compare_op(A) ::= MATCH. { A = OP_TYPE_MATCH; } compare_op(A) ::= NMATCH. { A = OP_TYPE_NMATCH; } +compare_op(A) ::= CONTAINS. { A = OP_TYPE_JSON_CONTAINS; } %type in_op { EOperatorType } %destructor in_op { } diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c index accf99606a..e229cfc751 100644 --- a/source/libs/parser/src/parAstCreater.c +++ b/source/libs/parser/src/parAstCreater.c @@ -305,6 +305,13 @@ SNode* createDefaultDatabaseCondValue(SAstCreateContext* pCxt) { return (SNode*)val; } +SNode* createPlaceholderValueNode(SAstCreateContext* pCxt) { + SValueNode* val = (SValueNode*)nodesMakeNode(QUERY_NODE_VALUE); + CHECK_OUT_OF_MEM(val); + // todo + return (SNode*)val; +} + SNode* createLogicConditionNode(SAstCreateContext* pCxt, ELogicConditionType type, SNode* pParam1, SNode* pParam2) { SLogicConditionNode* cond = (SLogicConditionNode*)nodesMakeNode(QUERY_NODE_LOGIC_CONDITION); CHECK_OUT_OF_MEM(cond); @@ -911,6 +918,18 @@ SNode* createShowStmt(SAstCreateContext* pCxt, ENodeType type, SNode* pDbName, S return (SNode*)pStmt; } +SNode* createShowCreateDatabaseStmt(SAstCreateContext* pCxt, const SToken* pDbName) { + SNode* pStmt = nodesMakeNode(QUERY_NODE_SHOW_CREATE_DATABASE_STMT); + CHECK_OUT_OF_MEM(pStmt); + return pStmt; +} + +SNode* createShowCreateTableStmt(SAstCreateContext* pCxt, ENodeType type, SNode* pRealTable) { + SNode* pStmt = nodesMakeNode(type); + CHECK_OUT_OF_MEM(pStmt); + return pStmt; +} + SNode* createCreateUserStmt(SAstCreateContext* pCxt, SToken* pUserName, const SToken* pPassword) { char password[TSDB_USET_PASSWORD_LEN] = {0}; if (!checkUserName(pCxt, pUserName) || !checkPassword(pCxt, pPassword, password)) { @@ -1142,16 +1161,34 @@ SNode* createDropFunctionStmt(SAstCreateContext* pCxt, const SToken* pFuncName) return pStmt; } -SNode* createCreateStreamStmt(SAstCreateContext* pCxt, const SToken* pStreamName, const SToken* pTableName, SNode* pQuery) { - SNode* pStmt = nodesMakeNode(QUERY_NODE_CREATE_STREAM_STMT); - CHECK_OUT_OF_MEM(pStmt); - return pStmt; +SNode* createStreamOptions(SAstCreateContext* pCxt) { + SStreamOptions* pOptions = nodesMakeNode(QUERY_NODE_STREAM_OPTIONS); + CHECK_OUT_OF_MEM(pOptions); + pOptions->triggerType = STREAM_TRIGGER_AT_ONCE; + return (SNode*)pOptions; } -SNode* createDropStreamStmt(SAstCreateContext* pCxt, const SToken* pStreamName) { - SNode* pStmt = nodesMakeNode(QUERY_NODE_DROP_STREAM_STMT); +SNode* createCreateStreamStmt(SAstCreateContext* pCxt, bool ignoreExists, const SToken* pStreamName, SNode* pRealTable, SNode* pOptions, SNode* pQuery) { + SCreateStreamStmt* pStmt = nodesMakeNode(QUERY_NODE_CREATE_STREAM_STMT); CHECK_OUT_OF_MEM(pStmt); - return pStmt; + strncpy(pStmt->streamName, pStreamName->z, pStreamName->n); + if (NULL != pRealTable) { + strcpy(pStmt->targetDbName, ((SRealTableNode*)pRealTable)->table.dbName); + strcpy(pStmt->targetTabName, ((SRealTableNode*)pRealTable)->table.tableName); + nodesDestroyNode(pRealTable); + } + pStmt->ignoreExists = ignoreExists; + pStmt->pOptions = (SStreamOptions*)pOptions; + pStmt->pQuery = pQuery; + return (SNode*)pStmt; +} + +SNode* createDropStreamStmt(SAstCreateContext* pCxt, bool ignoreNotExists, const SToken* pStreamName) { + SDropStreamStmt* pStmt = nodesMakeNode(QUERY_NODE_DROP_STREAM_STMT); + CHECK_OUT_OF_MEM(pStmt); + strncpy(pStmt->streamName, pStreamName->z, pStreamName->n); + pStmt->ignoreNotExists = ignoreNotExists; + return (SNode*)pStmt; } SNode* createKillStmt(SAstCreateContext* pCxt, ENodeType type, const SToken* pId) { diff --git a/source/libs/parser/src/parTokenizer.c b/source/libs/parser/src/parTokenizer.c index 0493771b61..618d5ccf48 100644 --- a/source/libs/parser/src/parTokenizer.c +++ b/source/libs/parser/src/parTokenizer.c @@ -39,6 +39,7 @@ static SKeyword keywordTable[] = { {"APPS", TK_APPS}, {"AS", TK_AS}, {"ASC", TK_ASC}, + {"AT_ONCE", TK_AT_ONCE}, {"BETWEEN", TK_BETWEEN}, {"BINARY", TK_BINARY}, {"BIGINT", TK_BIGINT}, @@ -57,6 +58,7 @@ static SKeyword keywordTable[] = { {"CONNS", TK_CONNS}, {"CONNECTION", TK_CONNECTION}, {"CONNECTIONS", TK_CONNECTIONS}, + {"COUNT", TK_COUNT}, {"CREATE", TK_CREATE}, {"DATABASE", TK_DATABASE}, {"DATABASES", TK_DATABASES}, @@ -100,6 +102,7 @@ static SKeyword keywordTable[] = { {"KEEP", TK_KEEP}, {"KILL", TK_KILL}, {"LAST", TK_LAST}, + {"LAST_ROW", TK_LAST_ROW}, {"LICENCE", TK_LICENCE}, {"LIKE", TK_LIKE}, {"LIMIT", TK_LIMIT}, @@ -132,10 +135,8 @@ static SKeyword keywordTable[] = { {"PRECISION", TK_PRECISION}, {"PRIVILEGE", TK_PRIVILEGE}, {"PREV", TK_PREV}, - {"_QENDTS", TK_QENDTS}, {"QNODE", TK_QNODE}, {"QNODES", TK_QNODES}, - {"_QSTARTTS", TK_QSTARTTS}, {"QTIME", TK_QTIME}, {"QUERIES", TK_QUERIES}, {"QUERY", TK_QUERY}, @@ -145,7 +146,6 @@ static SKeyword keywordTable[] = { {"RESET", TK_RESET}, {"RETENTIONS", TK_RETENTIONS}, {"ROLLUP", TK_ROLLUP}, - {"_ROWTS", TK_ROWTS}, {"SCORES", TK_SCORES}, {"SELECT", TK_SELECT}, {"SESSION", TK_SESSION}, @@ -178,6 +178,7 @@ static SKeyword keywordTable[] = { {"TODAY", TK_TODAY}, {"TOPIC", TK_TOPIC}, {"TOPICS", TK_TOPICS}, + {"TRIGGER", TK_TRIGGER}, {"TSERIES", TK_TSERIES}, {"TTL", TK_TTL}, {"UNION", TK_UNION}, @@ -194,9 +195,14 @@ static SKeyword keywordTable[] = { {"VGROUPS", TK_VGROUPS}, {"VNODES", TK_VNODES}, {"WAL", TK_WAL}, + {"WATERMARK", TK_WATERMARK}, + {"WHERE", TK_WHERE}, + {"WINDOW_CLOSE", TK_WINDOW_CLOSE}, + {"_QENDTS", TK_QENDTS}, + {"_QSTARTTS", TK_QSTARTTS}, + {"_ROWTS", TK_ROWTS}, {"_WDURATION", TK_WDURATION}, {"_WENDTS", TK_WENDTS}, - {"WHERE", TK_WHERE}, {"_WSTARTTS", TK_WSTARTTS}, // {"ID", TK_ID}, // {"STRING", TK_STRING}, @@ -260,7 +266,6 @@ static SKeyword keywordTable[] = { // {"RESTRICT", TK_RESTRICT}, // {"ROW", TK_ROW}, // {"STATEMENT", TK_STATEMENT}, - // {"TRIGGER", TK_TRIGGER}, // {"VIEW", TK_VIEW}, // {"SEMI", TK_SEMI}, // {"PARTITIONS", TK_PARTITIONS}, @@ -345,6 +350,9 @@ uint32_t tGetToken(const char* z, uint32_t* tokenId) { } *tokenId = TK_NK_COMMENT; return i; + } else if (z[1] == '>') { + *tokenId = TK_NK_ARROW; + return 2; } *tokenId = TK_NK_MINUS; return 1; diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 250c6c2fd1..90a4e4e40e 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -770,71 +770,47 @@ static int32_t createAllColumns(STranslateContext* pCxt, SNodeList** pCols) { return TSDB_CODE_SUCCESS; } -static bool isFirstLastFunc(SFunctionNode* pFunc) { - return (FUNCTION_TYPE_FIRST == pFunc->funcType || FUNCTION_TYPE_LAST == pFunc->funcType); -} - -static bool isFirstLastStar(SNode* pNode) { - if (QUERY_NODE_FUNCTION != nodeType(pNode) || !isFirstLastFunc((SFunctionNode*)pNode)) { +static bool isMultiResFunc(SNode* pNode) { + if (QUERY_NODE_FUNCTION != nodeType(pNode) || !fmIsMultiResFunc(((SFunctionNode*)pNode)->funcId)) { return false; } SNodeList* pParameterList = ((SFunctionNode*)pNode)->pParameterList; - if (LIST_LENGTH(pParameterList) != 1) { - return false; + if (LIST_LENGTH(pParameterList) > 1) { + return true; } SNode* pParam = nodesListGetNode(pParameterList, 0); return (QUERY_NODE_COLUMN == nodeType(pParam) ? 0 == strcmp(((SColumnNode*)pParam)->colName, "*") : false); } -static SNode* createFirstLastFunc(SFunctionNode* pSrcFunc, SColumnNode* pCol) { +static SNode* createMultiResFunc(SFunctionNode* pSrcFunc, SExprNode* pExpr) { SFunctionNode* pFunc = nodesMakeNode(QUERY_NODE_FUNCTION); if (NULL == pFunc) { return NULL; } pFunc->pParameterList = nodesMakeList(); - if (NULL == pFunc->pParameterList || TSDB_CODE_SUCCESS != nodesListAppend(pFunc->pParameterList, pCol)) { + if (NULL == pFunc->pParameterList || TSDB_CODE_SUCCESS != nodesListStrictAppend(pFunc->pParameterList, nodesCloneNode(pExpr))) { nodesDestroyNode(pFunc); return NULL; } - pFunc->node.resType = pCol->node.resType; + pFunc->node.resType = pExpr->resType; pFunc->funcId = pSrcFunc->funcId; pFunc->funcType = pSrcFunc->funcType; strcpy(pFunc->functionName, pSrcFunc->functionName); - snprintf(pFunc->node.aliasName, sizeof(pFunc->node.aliasName), - (FUNCTION_TYPE_FIRST == pSrcFunc->funcType ? "first(%s)" : "last(%s)"), pCol->colName); + if (QUERY_NODE_COLUMN == nodeType(pExpr)) { + SColumnNode* pCol = (SColumnNode*)pExpr; + snprintf(pFunc->node.aliasName, sizeof(pFunc->node.aliasName) - 1, "%s(%s.%s)", pSrcFunc->functionName, pCol->tableAlias, pCol->colName); + } else { + snprintf(pFunc->node.aliasName, sizeof(pFunc->node.aliasName) - 1, "%s(%s)", pSrcFunc->functionName, pExpr->aliasName); + } return (SNode*)pFunc; } -static int32_t createFirstLastAllCols(STranslateContext* pCxt, SFunctionNode* pSrcFunc, SNodeList** pOutput) { - SNodeList* pCols = NULL; - if (TSDB_CODE_SUCCESS != createAllColumns(pCxt, &pCols)) { - return TSDB_CODE_OUT_OF_MEMORY; - } - - SNodeList* pFuncs = nodesMakeList(); - if (NULL == pFuncs) { - return TSDB_CODE_OUT_OF_MEMORY; - } - SNode* pCol = NULL; - FOREACH(pCol, pCols) { - if (TSDB_CODE_SUCCESS != nodesListStrictAppend(pFuncs, createFirstLastFunc(pSrcFunc, (SColumnNode*)pCol))) { - nodesDestroyNode(pFuncs); - return TSDB_CODE_OUT_OF_MEMORY; - } - } - - *pOutput = pFuncs; - return TSDB_CODE_SUCCESS; -} - -static bool isTableStar(SNode* pNode) { - return (QUERY_NODE_COLUMN == nodeType(pNode)) && (0 == strcmp(((SColumnNode*)pNode)->colName, "*")); -} - static int32_t createTableAllCols(STranslateContext* pCxt, SColumnNode* pCol, SNodeList** pOutput) { - *pOutput = nodesMakeList(); + if (NULL == *pOutput) { + *pOutput = nodesMakeList(); + } if (NULL == *pOutput) { return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_OUT_OF_MEMORY); } @@ -858,15 +834,90 @@ static int32_t createTableAllCols(STranslateContext* pCxt, SColumnNode* pCol, SN return TSDB_CODE_SUCCESS; } +static bool isStar(SNode* pNode) { + return (QUERY_NODE_COLUMN == nodeType(pNode)) && ('\0' == ((SColumnNode*)pNode)->tableAlias[0]) && (0 == strcmp(((SColumnNode*)pNode)->colName, "*")); +} + +static bool isTableStar(SNode* pNode) { + return (QUERY_NODE_COLUMN == nodeType(pNode)) && ('\0' != ((SColumnNode*)pNode)->tableAlias[0]) && (0 == strcmp(((SColumnNode*)pNode)->colName, "*")); +} + +static int32_t createMultiResFuncsParas(STranslateContext* pCxt, SNodeList* pSrcParas, SNodeList** pOutput) { + int32_t code = TSDB_CODE_SUCCESS; + + SNodeList* pExprs = NULL; + SNode* pPara = NULL; + FOREACH(pPara, pSrcParas) { + if (isStar(pPara)) { + code = createAllColumns(pCxt, &pExprs); + // The syntax definition ensures that * and other parameters do not appear at the same time + break; + } else if (isTableStar(pPara)) { + code = createTableAllCols(pCxt, (SColumnNode*)pPara, &pExprs); + } else { + code = nodesListMakeStrictAppend(&pExprs, nodesCloneNode(pPara)); + } + if (TSDB_CODE_SUCCESS != code) { + break; + } + } + + if (TSDB_CODE_SUCCESS == code) { + *pOutput = pExprs; + } else { + nodesDestroyList(pExprs); + } + + return code; +} + +static int32_t createMultiResFuncs(SFunctionNode* pSrcFunc, SNodeList* pExprs, SNodeList** pOutput) { + SNodeList* pFuncs = nodesMakeList(); + if (NULL == pFuncs) { + return TSDB_CODE_OUT_OF_MEMORY; + } + + int32_t code = TSDB_CODE_SUCCESS; + SNode* pExpr = NULL; + FOREACH(pExpr, pExprs) { + code = nodesListStrictAppend(pFuncs, createMultiResFunc(pSrcFunc, (SExprNode*)pExpr)); + if (TSDB_CODE_SUCCESS != code) { + break; + } + } + + if (TSDB_CODE_SUCCESS == code) { + *pOutput = pFuncs; + } else { + nodesDestroyList(pFuncs); + } + + return code; +} + +static int32_t createMultiResFuncsFromStar(STranslateContext* pCxt, SFunctionNode* pSrcFunc, SNodeList** pOutput) { + SNodeList* pExprs = NULL; + int32_t code = createMultiResFuncsParas(pCxt, pSrcFunc->pParameterList, &pExprs); + if (TSDB_CODE_SUCCESS == code) { + code = createMultiResFuncs(pSrcFunc, pExprs, pOutput); + } + + if (TSDB_CODE_SUCCESS != code) { + nodesDestroyList(pExprs); + } + + return code; +} + static int32_t translateStar(STranslateContext* pCxt, SSelectStmt* pSelect) { if (NULL == pSelect->pProjectionList) { // select * ... return createAllColumns(pCxt, &pSelect->pProjectionList); } else { SNode* pNode = NULL; WHERE_EACH(pNode, pSelect->pProjectionList) { - if (isFirstLastStar(pNode)) { + if (isMultiResFunc(pNode)) { SNodeList* pFuncs = NULL; - if (TSDB_CODE_SUCCESS != createFirstLastAllCols(pCxt, (SFunctionNode*)pNode, &pFuncs)) { + if (TSDB_CODE_SUCCESS != createMultiResFuncsFromStar(pCxt, (SFunctionNode*)pNode, &pFuncs)) { return TSDB_CODE_OUT_OF_MEMORY; } INSERT_LIST(pSelect->pProjectionList, pFuncs); @@ -2067,6 +2118,46 @@ static int32_t translateKillQuery(STranslateContext* pCxt, SKillStmt* pStmt) { return buildCmdMsg(pCxt, TDMT_MND_KILL_QUERY, (FSerializeFunc)tSerializeSKillQueryReq, &killReq); } +static int32_t translateCreateStream(STranslateContext* pCxt, SCreateStreamStmt* pStmt) { + SCMCreateStreamReq createReq = {0}; + + createReq.igExists = pStmt->ignoreExists; + + SName name = {.type = TSDB_TABLE_NAME_T, .acctId = pCxt->pParseCxt->acctId}; + strcpy(name.dbname, pCxt->pParseCxt->db); + strcpy(name.tname, pStmt->streamName); + tNameExtractFullName(&name, createReq.name); + + if ('\0' != pStmt->targetTabName[0]) { + strcpy(name.dbname, pStmt->targetDbName); + strcpy(name.tname, pStmt->targetTabName); + tNameExtractFullName(&name, createReq.outputSTbName); + } + + int32_t code = translateQuery(pCxt, pStmt->pQuery); + if (TSDB_CODE_SUCCESS == code) { + code = nodesNodeToString(pStmt->pQuery, false, &createReq.ast, NULL); + } + + if (TSDB_CODE_SUCCESS == code) { + createReq.sql = strdup(pCxt->pParseCxt->pSql); + if (NULL == createReq.sql) { + code = TSDB_CODE_OUT_OF_MEMORY; + } + } + + if (TSDB_CODE_SUCCESS == code) { + code = buildCmdMsg(pCxt, TDMT_MND_CREATE_STREAM, (FSerializeFunc)tSerializeSCMCreateStreamReq, &createReq); + } + + tFreeSCMCreateStreamReq(&createReq); + return code; +} + +static int32_t translateDropStream(STranslateContext* pCxt, SDropStreamStmt* pStmt) { + // todo + return TSDB_CODE_SUCCESS; +} static int32_t translateQuery(STranslateContext* pCxt, SNode* pNode) { int32_t code = TSDB_CODE_SUCCESS; @@ -2160,6 +2251,12 @@ static int32_t translateQuery(STranslateContext* pCxt, SNode* pNode) { case QUERY_NODE_KILL_QUERY_STMT: code = translateKillQuery(pCxt, (SKillStmt*)pNode); break; + case QUERY_NODE_CREATE_STREAM_STMT: + code = translateCreateStream(pCxt, (SCreateStreamStmt*)pNode); + break; + case QUERY_NODE_DROP_STREAM_STMT: + code = translateDropStream(pCxt, (SDropStreamStmt*)pNode); + break; default: break; } diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index d3f5af3eb2..587d17fd8e 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 316 +#define YYNOCODE 332 #define YYACTIONTYPE unsigned short int #define ParseTOKENTYPE SToken typedef union { int yyinit; ParseTOKENTYPE yy0; - SAlterOption yy21; - EFillMode yy22; - EOperatorType yy84; - bool yy121; - SDataType yy160; - ENullOrder yy281; - SToken yy409; - int32_t yy452; - SNodeList* yy488; - SNode* yy504; - EOrder yy522; - EJoinType yy556; + SNodeList* yy64; + int32_t yy116; + SNode* yy192; + ENullOrder yy225; + bool yy273; + SAlterOption yy277; + SToken yy353; + EFillMode yy358; + EJoinType yy372; + EOperatorType yy412; + EOrder yy530; + SDataType yy536; } YYMINORTYPE; #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 @@ -132,17 +132,17 @@ typedef union { #define ParseCTX_PARAM #define ParseCTX_FETCH #define ParseCTX_STORE -#define YYNSTATE 550 -#define YYNRULE 411 -#define YYNTOKEN 210 -#define YY_MAX_SHIFT 549 -#define YY_MIN_SHIFTREDUCE 810 -#define YY_MAX_SHIFTREDUCE 1220 -#define YY_ERROR_ACTION 1221 -#define YY_ACCEPT_ACTION 1222 -#define YY_NO_ACTION 1223 -#define YY_MIN_REDUCE 1224 -#define YY_MAX_REDUCE 1634 +#define YYNSTATE 566 +#define YYNRULE 431 +#define YYNTOKEN 219 +#define YY_MAX_SHIFT 565 +#define YY_MIN_SHIFTREDUCE 839 +#define YY_MAX_SHIFTREDUCE 1269 +#define YY_ERROR_ACTION 1270 +#define YY_ACCEPT_ACTION 1271 +#define YY_NO_ACTION 1272 +#define YY_MIN_REDUCE 1273 +#define YY_MAX_REDUCE 1703 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -209,487 +209,541 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (1556) +#define YY_ACTTAB_COUNT (1905) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 452, 258, 1485, 270, 275, 452, 1434, 25, 195, 313, - /* 10 */ 465, 1435, 30, 28, 1481, 1488, 307, 1501, 1485, 311, - /* 20 */ 267, 1485, 1055, 1613, 1335, 32, 31, 29, 27, 26, - /* 30 */ 1481, 1487, 21, 1481, 1487, 1344, 1612, 1078, 1053, 239, - /* 40 */ 1611, 1518, 32, 31, 29, 27, 26, 1613, 447, 464, - /* 50 */ 11, 30, 28, 1163, 118, 407, 1236, 1060, 451, 267, - /* 60 */ 132, 1055, 1472, 1162, 1611, 30, 28, 435, 165, 1472, - /* 70 */ 431, 1075, 373, 267, 1, 1055, 465, 1053, 69, 1502, - /* 80 */ 1503, 1507, 1552, 542, 541, 73, 241, 1548, 1177, 11, - /* 90 */ 1501, 1053, 370, 1518, 375, 101, 1060, 546, 1613, 408, - /* 100 */ 447, 1344, 446, 11, 32, 31, 29, 27, 26, 1054, - /* 110 */ 1060, 132, 23, 1, 1518, 1611, 32, 31, 29, 27, - /* 120 */ 26, 434, 32, 31, 29, 27, 26, 1, 99, 119, - /* 130 */ 1613, 451, 424, 1302, 123, 1472, 546, 433, 128, 1559, - /* 140 */ 1560, 1077, 1564, 132, 464, 1384, 1056, 1611, 1054, 278, - /* 150 */ 546, 70, 1502, 1503, 1507, 1552, 1425, 1427, 349, 260, - /* 160 */ 1548, 127, 1054, 1059, 1079, 1080, 449, 1106, 1107, 1108, - /* 170 */ 1109, 1110, 1111, 1112, 1113, 1114, 29, 27, 26, 1094, - /* 180 */ 1580, 1079, 1080, 1222, 425, 1056, 85, 133, 1276, 84, - /* 190 */ 83, 82, 81, 80, 79, 78, 77, 76, 12, 1056, - /* 200 */ 382, 381, 1059, 1079, 1080, 449, 1106, 1107, 1108, 1109, - /* 210 */ 1110, 1111, 1112, 1113, 1114, 1118, 1059, 1079, 1080, 449, - /* 220 */ 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 30, - /* 230 */ 28, 1217, 442, 398, 1501, 53, 283, 267, 133, 1055, - /* 240 */ 384, 465, 378, 306, 1247, 305, 383, 1161, 97, 98, - /* 250 */ 73, 379, 377, 1322, 380, 1053, 1339, 376, 1518, 32, - /* 260 */ 31, 29, 27, 26, 1613, 434, 1344, 1613, 30, 28, - /* 270 */ 450, 1246, 1055, 133, 1060, 451, 267, 132, 1055, 1472, - /* 280 */ 132, 1611, 30, 28, 1611, 133, 421, 1501, 1053, 1472, - /* 290 */ 267, 7, 1055, 138, 1053, 70, 1502, 1503, 1507, 1552, - /* 300 */ 1216, 464, 349, 260, 1548, 127, 465, 1060, 1053, 1224, - /* 310 */ 898, 1518, 396, 1060, 546, 312, 1472, 191, 447, 51, - /* 320 */ 9, 8, 50, 414, 1579, 394, 1054, 1060, 451, 900, - /* 330 */ 7, 1344, 1472, 94, 93, 92, 91, 90, 89, 88, - /* 340 */ 87, 86, 426, 422, 7, 1225, 271, 546, 71, 1502, - /* 350 */ 1503, 1507, 1552, 546, 116, 12, 1551, 1548, 847, 1054, - /* 360 */ 846, 335, 1346, 1056, 500, 1054, 85, 546, 443, 84, - /* 370 */ 83, 82, 81, 80, 79, 78, 77, 76, 848, 1054, - /* 380 */ 1059, 1079, 1080, 449, 1106, 1107, 1108, 1109, 1110, 1111, - /* 390 */ 1112, 1113, 1114, 431, 1139, 1391, 1056, 32, 31, 29, - /* 400 */ 27, 26, 1056, 384, 133, 378, 1426, 142, 141, 383, - /* 410 */ 1245, 53, 98, 1059, 379, 377, 1056, 380, 101, 1059, - /* 420 */ 1079, 1080, 449, 1106, 1107, 1108, 1109, 1110, 1111, 1112, - /* 430 */ 1113, 1114, 1340, 1059, 1079, 1080, 449, 1106, 1107, 1108, - /* 440 */ 1109, 1110, 1111, 1112, 1113, 1114, 30, 28, 238, 438, - /* 450 */ 1075, 99, 1566, 1566, 267, 1472, 1055, 328, 60, 1422, - /* 460 */ 340, 129, 1559, 1560, 1244, 1564, 140, 1187, 133, 341, - /* 470 */ 1563, 1562, 1053, 32, 31, 29, 27, 26, 1076, 1337, - /* 480 */ 936, 488, 487, 486, 940, 485, 942, 943, 484, 945, - /* 490 */ 481, 1060, 951, 478, 953, 954, 475, 472, 389, 1391, - /* 500 */ 418, 1185, 1186, 1188, 1189, 257, 1391, 465, 1, 1472, - /* 510 */ 1389, 242, 465, 397, 431, 465, 320, 1390, 1243, 1571, - /* 520 */ 1158, 321, 1391, 115, 348, 465, 502, 167, 272, 1081, - /* 530 */ 392, 546, 1344, 1389, 1341, 386, 1094, 1344, 1082, 101, - /* 540 */ 1344, 166, 339, 1054, 1126, 334, 333, 332, 331, 330, - /* 550 */ 1344, 327, 326, 325, 324, 323, 319, 318, 317, 316, - /* 560 */ 315, 314, 1273, 1472, 117, 465, 503, 43, 1316, 223, - /* 570 */ 42, 66, 99, 1566, 462, 32, 31, 29, 27, 26, - /* 580 */ 1056, 221, 130, 1559, 1560, 102, 1564, 465, 6, 1242, - /* 590 */ 1344, 1561, 1336, 1127, 143, 491, 463, 1059, 1079, 1080, - /* 600 */ 449, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, - /* 610 */ 465, 1131, 1344, 242, 522, 521, 520, 519, 282, 209, - /* 620 */ 518, 517, 516, 103, 511, 510, 509, 508, 507, 506, - /* 630 */ 505, 504, 109, 1128, 1472, 1344, 549, 24, 265, 1121, - /* 640 */ 1122, 1123, 1124, 1125, 1129, 1130, 1126, 190, 1320, 437, - /* 650 */ 214, 1132, 277, 96, 1241, 1240, 176, 68, 280, 538, - /* 660 */ 116, 534, 530, 526, 213, 1391, 116, 846, 1346, 1239, - /* 670 */ 1238, 279, 515, 513, 1346, 251, 1389, 22, 1170, 1235, - /* 680 */ 116, 1234, 439, 368, 1077, 49, 48, 310, 1347, 137, - /* 690 */ 67, 1233, 1333, 207, 304, 1127, 298, 500, 1329, 1472, - /* 700 */ 1472, 165, 247, 465, 296, 373, 292, 288, 134, 1492, - /* 710 */ 1232, 300, 281, 1131, 1472, 1472, 1461, 252, 1231, 250, - /* 720 */ 249, 1490, 372, 461, 1472, 1501, 1472, 375, 1344, 1230, - /* 730 */ 1229, 1158, 1228, 133, 217, 1227, 1472, 1374, 1263, 24, - /* 740 */ 265, 1121, 1122, 1123, 1124, 1125, 1129, 1130, 1063, 1518, - /* 750 */ 1258, 413, 290, 514, 172, 1472, 447, 301, 1331, 158, - /* 760 */ 385, 1501, 156, 1472, 160, 162, 451, 159, 161, 1039, - /* 770 */ 1472, 169, 387, 1501, 1472, 1472, 164, 1472, 1256, 163, - /* 780 */ 1472, 9, 8, 1219, 1220, 1518, 70, 1502, 1503, 1507, - /* 790 */ 1552, 65, 447, 1327, 260, 1548, 1625, 1518, 406, 107, - /* 800 */ 390, 62, 451, 410, 447, 1586, 1472, 45, 179, 1062, - /* 810 */ 170, 1184, 181, 34, 451, 1501, 440, 1133, 1472, 1066, - /* 820 */ 448, 1501, 70, 1502, 1503, 1507, 1552, 490, 1237, 34, - /* 830 */ 260, 1548, 1625, 1090, 70, 1502, 1503, 1507, 1552, 1518, - /* 840 */ 192, 1609, 260, 1548, 1625, 1518, 447, 34, 1303, 419, - /* 850 */ 198, 1022, 447, 1570, 200, 95, 451, 344, 153, 457, - /* 860 */ 1472, 126, 451, 1385, 105, 435, 1472, 366, 206, 362, - /* 870 */ 358, 354, 152, 1501, 405, 185, 229, 1502, 1503, 1507, - /* 880 */ 1065, 872, 71, 1502, 1503, 1507, 1552, 367, 107, 45, - /* 890 */ 445, 1548, 929, 924, 1582, 470, 1613, 1518, 54, 957, - /* 900 */ 873, 150, 432, 105, 447, 1519, 106, 961, 107, 132, - /* 910 */ 967, 105, 966, 1611, 451, 108, 1075, 194, 1472, 2, - /* 920 */ 1501, 285, 289, 246, 248, 898, 1031, 215, 322, 139, - /* 930 */ 1424, 329, 337, 336, 120, 1502, 1503, 1507, 338, 342, - /* 940 */ 1086, 343, 1085, 431, 1518, 1084, 345, 145, 346, 347, - /* 950 */ 148, 447, 52, 350, 151, 1083, 369, 399, 149, 371, - /* 960 */ 122, 451, 146, 75, 1334, 1472, 401, 155, 101, 1330, - /* 970 */ 374, 256, 436, 1626, 400, 1501, 157, 110, 171, 144, - /* 980 */ 111, 71, 1502, 1503, 1507, 1552, 1332, 435, 1328, 112, - /* 990 */ 1549, 113, 402, 174, 1082, 274, 273, 409, 420, 1518, - /* 1000 */ 412, 99, 1501, 411, 1593, 1068, 447, 177, 455, 1592, - /* 1010 */ 1501, 188, 1559, 430, 1060, 429, 451, 5, 1613, 1583, - /* 1020 */ 1472, 1061, 417, 266, 180, 259, 1518, 423, 428, 100, - /* 1030 */ 4, 132, 416, 447, 1518, 1611, 234, 1502, 1503, 1507, - /* 1040 */ 1060, 447, 1158, 451, 1501, 1081, 1567, 1472, 35, 441, - /* 1050 */ 415, 451, 1501, 125, 1573, 1472, 261, 1501, 187, 444, - /* 1060 */ 186, 184, 17, 234, 1502, 1503, 1507, 1610, 1518, 1534, - /* 1070 */ 1433, 233, 1502, 1503, 1507, 447, 1518, 193, 453, 454, - /* 1080 */ 466, 1518, 1432, 447, 269, 451, 1501, 1628, 447, 1472, - /* 1090 */ 458, 460, 1064, 451, 459, 202, 204, 1472, 451, 216, - /* 1100 */ 264, 59, 1472, 427, 1345, 120, 1502, 1503, 1507, 61, - /* 1110 */ 1518, 1501, 468, 234, 1502, 1503, 1507, 447, 226, 1502, - /* 1120 */ 1503, 1507, 497, 218, 1317, 212, 545, 451, 41, 1069, - /* 1130 */ 220, 1472, 224, 225, 268, 1518, 1466, 222, 1465, 284, - /* 1140 */ 1462, 286, 447, 287, 1627, 1049, 1072, 234, 1502, 1503, - /* 1150 */ 1507, 1050, 451, 135, 291, 1460, 1472, 1501, 293, 295, - /* 1160 */ 294, 1459, 297, 1458, 299, 1501, 1449, 136, 302, 303, - /* 1170 */ 1034, 1443, 232, 1502, 1503, 1507, 1033, 1442, 308, 1441, - /* 1180 */ 309, 1518, 1440, 1005, 1417, 1416, 1415, 1414, 447, 1518, - /* 1190 */ 1413, 1412, 1411, 1501, 104, 1401, 447, 1410, 451, 1501, - /* 1200 */ 1007, 1395, 1472, 1409, 1408, 1407, 451, 1406, 1405, 1404, - /* 1210 */ 1472, 1403, 1402, 1400, 1399, 1398, 1397, 1518, 235, 1502, - /* 1220 */ 1503, 1507, 1396, 1518, 447, 1394, 227, 1502, 1503, 1507, - /* 1230 */ 447, 1393, 1392, 1275, 451, 1457, 1451, 1439, 1472, 1430, - /* 1240 */ 451, 147, 1323, 1274, 1472, 1501, 352, 865, 1272, 353, - /* 1250 */ 1501, 1270, 1268, 356, 236, 1502, 1503, 1507, 1501, 351, - /* 1260 */ 228, 1502, 1503, 1507, 355, 359, 357, 361, 1266, 1518, - /* 1270 */ 360, 365, 1255, 1254, 1518, 1251, 447, 364, 363, 1325, - /* 1280 */ 154, 447, 1518, 974, 972, 74, 451, 1324, 897, 447, - /* 1290 */ 1472, 451, 896, 895, 894, 1472, 891, 890, 1264, 451, - /* 1300 */ 1501, 514, 253, 1472, 1259, 254, 237, 1502, 1503, 1507, - /* 1310 */ 388, 1515, 1502, 1503, 1507, 512, 1257, 255, 1250, 1514, - /* 1320 */ 1502, 1503, 1507, 391, 1518, 1501, 1249, 393, 395, 72, - /* 1330 */ 1456, 447, 1041, 1450, 1501, 168, 403, 1438, 1437, 114, - /* 1340 */ 1429, 451, 173, 55, 14, 1472, 1490, 3, 34, 1518, - /* 1350 */ 15, 189, 39, 124, 36, 10, 447, 44, 1518, 178, - /* 1360 */ 121, 244, 1502, 1503, 1507, 447, 451, 404, 1183, 57, - /* 1370 */ 1472, 182, 183, 1205, 19, 451, 38, 1176, 1155, 1472, - /* 1380 */ 175, 56, 20, 1154, 37, 1210, 1513, 1502, 1503, 1507, - /* 1390 */ 16, 1204, 262, 1209, 1208, 245, 1502, 1503, 1507, 263, - /* 1400 */ 8, 131, 1501, 196, 1092, 33, 13, 1501, 1428, 1091, - /* 1410 */ 18, 203, 1119, 1501, 197, 205, 1181, 199, 201, 46, - /* 1420 */ 58, 1070, 40, 469, 456, 276, 1518, 1321, 1489, 473, - /* 1430 */ 476, 1518, 1319, 447, 62, 208, 467, 1518, 447, 958, - /* 1440 */ 471, 479, 955, 451, 447, 474, 477, 1472, 451, 952, - /* 1450 */ 946, 480, 1472, 944, 451, 482, 483, 950, 1472, 1501, - /* 1460 */ 935, 949, 948, 243, 1502, 1503, 1507, 489, 240, 1502, - /* 1470 */ 1503, 1507, 947, 969, 230, 1502, 1503, 1507, 63, 968, - /* 1480 */ 47, 64, 965, 1518, 963, 863, 499, 904, 210, 211, - /* 1490 */ 447, 501, 496, 210, 886, 885, 884, 496, 883, 882, - /* 1500 */ 451, 881, 880, 879, 1472, 901, 899, 876, 875, 874, - /* 1510 */ 871, 870, 869, 868, 498, 1271, 523, 1269, 524, 498, - /* 1520 */ 231, 1502, 1503, 1507, 527, 528, 525, 529, 1267, 531, - /* 1530 */ 532, 533, 1265, 495, 494, 493, 535, 492, 495, 494, - /* 1540 */ 493, 536, 492, 537, 1253, 539, 540, 1252, 1248, 543, - /* 1550 */ 544, 1223, 1057, 219, 547, 548, + /* 0 */ 268, 1543, 285, 1573, 1557, 317, 26, 203, 53, 123, + /* 10 */ 464, 1285, 33, 31, 480, 1539, 1546, 1543, 288, 1543, + /* 20 */ 277, 99, 1092, 77, 479, 1476, 1478, 69, 1573, 1388, + /* 30 */ 380, 1539, 1545, 1539, 1545, 444, 1442, 409, 1090, 1393, + /* 40 */ 1117, 105, 267, 1682, 434, 463, 1370, 1440, 1385, 1529, + /* 50 */ 12, 33, 31, 1212, 1557, 121, 136, 1098, 359, 277, + /* 60 */ 1680, 1092, 441, 1396, 143, 1113, 1682, 73, 1558, 466, + /* 70 */ 1560, 1561, 462, 479, 1, 1682, 1621, 1090, 1573, 1681, + /* 80 */ 270, 1617, 131, 1680, 323, 464, 927, 104, 136, 12, + /* 90 */ 51, 1473, 1680, 50, 199, 463, 1098, 562, 145, 1529, + /* 100 */ 424, 1648, 33, 31, 445, 929, 445, 106, 281, 1091, + /* 110 */ 277, 511, 1092, 1, 248, 1115, 121, 72, 1558, 466, + /* 120 */ 1560, 1561, 462, 102, 1395, 480, 1621, 36, 1090, 467, + /* 130 */ 249, 1617, 280, 514, 321, 1485, 562, 196, 1628, 440, + /* 140 */ 12, 439, 1682, 876, 1682, 875, 1093, 1098, 1091, 1384, + /* 150 */ 1393, 1176, 510, 509, 508, 136, 507, 136, 198, 1680, + /* 160 */ 1557, 1680, 124, 877, 1, 516, 1351, 1096, 1097, 1181, + /* 170 */ 1141, 1142, 1143, 1144, 1145, 1146, 1147, 1148, 1149, 459, + /* 180 */ 1153, 1154, 1155, 1156, 1573, 1093, 395, 562, 389, 55, + /* 190 */ 266, 464, 394, 174, 1529, 101, 137, 390, 388, 1091, + /* 200 */ 391, 463, 1296, 23, 435, 1529, 1096, 1097, 425, 1141, + /* 210 */ 1142, 1143, 1144, 1145, 1146, 1147, 1148, 1149, 459, 1153, + /* 220 */ 1154, 1155, 1156, 246, 1558, 466, 1560, 1561, 462, 33, + /* 230 */ 31, 34, 32, 30, 29, 28, 1093, 277, 53, 1092, + /* 240 */ 287, 137, 34, 32, 30, 29, 28, 1529, 121, 137, + /* 250 */ 34, 32, 30, 29, 28, 1090, 1395, 1096, 1097, 1389, + /* 260 */ 1141, 1142, 1143, 1144, 1145, 1146, 1147, 1148, 1149, 459, + /* 270 */ 1153, 1154, 1155, 1156, 1098, 33, 31, 1157, 479, 480, + /* 280 */ 250, 1371, 316, 277, 315, 1092, 1322, 308, 322, 87, + /* 290 */ 1550, 7, 86, 85, 84, 83, 82, 81, 80, 79, + /* 300 */ 78, 1090, 1548, 480, 1393, 1128, 310, 34, 32, 30, + /* 310 */ 29, 28, 77, 1174, 562, 1369, 431, 100, 1442, 387, + /* 320 */ 1098, 383, 558, 557, 282, 137, 1091, 1236, 1393, 1440, + /* 330 */ 359, 260, 36, 137, 30, 29, 28, 7, 538, 537, + /* 340 */ 536, 535, 292, 386, 534, 533, 532, 107, 527, 526, + /* 350 */ 525, 524, 523, 522, 521, 520, 114, 100, 9, 8, + /* 360 */ 562, 383, 1175, 1093, 516, 428, 1234, 1235, 1237, 1238, + /* 370 */ 1226, 225, 1091, 261, 1423, 259, 258, 1266, 382, 345, + /* 380 */ 1180, 436, 432, 386, 1096, 1097, 1116, 1141, 1142, 1143, + /* 390 */ 1144, 1145, 1146, 1147, 1148, 1149, 459, 1153, 1154, 1155, + /* 400 */ 1156, 1271, 33, 31, 441, 1325, 385, 384, 1295, 1093, + /* 410 */ 277, 875, 1092, 137, 25, 275, 1169, 1170, 1171, 1172, + /* 420 */ 1173, 1177, 1178, 1179, 1118, 147, 146, 378, 1090, 104, + /* 430 */ 1096, 1097, 1188, 1141, 1142, 1143, 1144, 1145, 1146, 1147, + /* 440 */ 1148, 1149, 459, 1153, 1154, 1155, 1156, 1098, 33, 31, + /* 450 */ 284, 283, 480, 1529, 293, 1265, 277, 395, 1092, 389, + /* 460 */ 1106, 330, 506, 394, 7, 102, 101, 1312, 390, 388, + /* 470 */ 62, 391, 448, 480, 1090, 1442, 1099, 1393, 443, 132, + /* 480 */ 1628, 1629, 331, 1633, 530, 127, 1477, 562, 311, 396, + /* 490 */ 22, 1386, 1682, 1098, 1294, 1098, 1434, 480, 1393, 1091, + /* 500 */ 34, 32, 30, 29, 28, 136, 358, 393, 392, 1680, + /* 510 */ 1, 965, 503, 502, 501, 969, 500, 971, 972, 499, + /* 520 */ 974, 496, 1393, 980, 493, 982, 983, 490, 487, 247, + /* 530 */ 1293, 1113, 290, 562, 480, 481, 1093, 449, 338, 1529, + /* 540 */ 121, 350, 184, 1390, 519, 1091, 1365, 1102, 1395, 1292, + /* 550 */ 351, 34, 32, 30, 29, 28, 1291, 1096, 1097, 1393, + /* 560 */ 1141, 1142, 1143, 1144, 1145, 1146, 1147, 1148, 1149, 459, + /* 570 */ 1153, 1154, 1155, 1156, 452, 1529, 1290, 480, 513, 512, + /* 580 */ 1289, 1442, 1093, 6, 1107, 24, 1510, 531, 529, 250, + /* 590 */ 1640, 1207, 1441, 1114, 1529, 34, 32, 30, 29, 28, + /* 600 */ 518, 1529, 1393, 1096, 1097, 1110, 1141, 1142, 1143, 1144, + /* 610 */ 1145, 1146, 1147, 1148, 1149, 459, 1153, 1154, 1155, 1156, + /* 620 */ 1557, 1529, 1174, 349, 1288, 1529, 344, 343, 342, 341, + /* 630 */ 340, 416, 337, 336, 335, 334, 333, 329, 328, 327, + /* 640 */ 326, 325, 324, 1635, 1573, 122, 1287, 1211, 480, 480, + /* 650 */ 231, 444, 34, 32, 30, 29, 28, 477, 478, 1635, + /* 660 */ 112, 463, 229, 1518, 420, 1529, 1632, 1635, 480, 1529, + /* 670 */ 480, 1175, 1368, 1393, 1393, 148, 1273, 217, 417, 291, + /* 680 */ 450, 447, 1631, 73, 1558, 466, 1560, 1561, 462, 1180, + /* 690 */ 1630, 1529, 1621, 1393, 456, 1393, 270, 1617, 131, 300, + /* 700 */ 96, 95, 94, 93, 92, 91, 90, 89, 88, 1382, + /* 710 */ 34, 32, 30, 29, 28, 1128, 1284, 1649, 1274, 453, + /* 720 */ 1283, 407, 418, 25, 275, 1169, 1170, 1171, 1172, 1173, + /* 730 */ 1177, 1178, 1179, 106, 405, 1207, 1307, 511, 71, 87, + /* 740 */ 1557, 1282, 86, 85, 84, 83, 82, 81, 80, 79, + /* 750 */ 78, 1442, 1281, 1280, 1305, 1279, 1278, 289, 398, 514, + /* 760 */ 1682, 1529, 1440, 467, 1573, 1529, 49, 48, 320, 1486, + /* 770 */ 142, 464, 1378, 136, 1277, 314, 401, 1680, 510, 509, + /* 780 */ 508, 463, 507, 1276, 47, 1529, 1529, 256, 1233, 306, + /* 790 */ 1557, 302, 298, 139, 1092, 1380, 1219, 1529, 1529, 441, + /* 800 */ 1529, 1529, 1115, 73, 1558, 466, 1560, 1561, 462, 1162, + /* 810 */ 1090, 1166, 1621, 901, 1573, 1115, 270, 1617, 1694, 1529, + /* 820 */ 1352, 464, 165, 137, 104, 163, 1101, 1655, 1529, 1098, + /* 830 */ 167, 463, 902, 166, 169, 1529, 120, 168, 171, 1557, + /* 840 */ 1210, 170, 1078, 1079, 1376, 187, 177, 9, 8, 189, + /* 850 */ 1268, 1269, 458, 73, 1558, 466, 1560, 1561, 462, 505, + /* 860 */ 102, 35, 1621, 1573, 1100, 1182, 270, 1617, 1694, 562, + /* 870 */ 464, 1286, 200, 565, 133, 1628, 1629, 1678, 1633, 35, + /* 880 */ 463, 1091, 35, 1150, 1529, 429, 1053, 221, 1557, 206, + /* 890 */ 98, 109, 1435, 208, 410, 472, 554, 1104, 550, 546, + /* 900 */ 542, 220, 73, 1558, 466, 1560, 1561, 462, 193, 110, + /* 910 */ 112, 1621, 1573, 214, 958, 270, 1617, 1694, 1093, 464, + /* 920 */ 47, 441, 377, 1651, 953, 1574, 1639, 70, 442, 463, + /* 930 */ 215, 202, 400, 1529, 2, 1103, 1113, 485, 445, 1096, + /* 940 */ 1097, 986, 295, 299, 255, 1062, 104, 408, 927, 1557, + /* 950 */ 222, 238, 1558, 466, 1560, 1561, 462, 257, 110, 111, + /* 960 */ 476, 173, 990, 997, 403, 332, 1475, 112, 110, 397, + /* 970 */ 144, 996, 113, 1573, 68, 172, 1682, 339, 346, 347, + /* 980 */ 464, 348, 102, 352, 64, 1122, 353, 1557, 423, 136, + /* 990 */ 463, 180, 149, 1680, 1529, 354, 134, 1628, 1629, 1121, + /* 1000 */ 1633, 45, 355, 152, 44, 1120, 1070, 357, 176, 155, + /* 1010 */ 356, 1573, 74, 1558, 466, 1560, 1561, 462, 464, 52, + /* 1020 */ 360, 1621, 1119, 158, 379, 1620, 1617, 381, 463, 1383, + /* 1030 */ 162, 1379, 1529, 164, 97, 1098, 265, 1557, 1514, 411, + /* 1040 */ 115, 223, 116, 1381, 1377, 117, 1557, 419, 118, 175, + /* 1050 */ 74, 1558, 466, 1560, 1561, 462, 412, 179, 421, 1621, + /* 1060 */ 182, 1573, 1118, 455, 1617, 430, 415, 1662, 461, 1661, + /* 1070 */ 1573, 422, 470, 5, 438, 1652, 427, 464, 463, 426, + /* 1080 */ 1642, 185, 1529, 192, 188, 160, 269, 463, 130, 4, + /* 1090 */ 433, 1529, 129, 1557, 376, 103, 372, 368, 364, 159, + /* 1100 */ 245, 1558, 466, 1560, 1561, 462, 460, 457, 1593, 125, + /* 1110 */ 1558, 466, 1560, 1561, 462, 1207, 1117, 1573, 1636, 37, + /* 1120 */ 271, 454, 195, 194, 464, 54, 451, 16, 157, 1602, + /* 1130 */ 473, 1484, 468, 63, 463, 1697, 1483, 469, 1529, 279, + /* 1140 */ 1679, 474, 201, 210, 212, 475, 224, 1394, 61, 1557, + /* 1150 */ 483, 1366, 446, 1695, 226, 561, 74, 1558, 466, 1560, + /* 1160 */ 1561, 462, 219, 43, 232, 1621, 228, 230, 1523, 233, + /* 1170 */ 1618, 128, 1522, 1573, 294, 1519, 296, 1557, 297, 1086, + /* 1180 */ 464, 1087, 140, 301, 1517, 156, 303, 151, 305, 153, + /* 1190 */ 463, 304, 1516, 307, 1529, 1515, 309, 1500, 141, 312, + /* 1200 */ 313, 1573, 1065, 1064, 1494, 1493, 150, 318, 464, 319, + /* 1210 */ 1492, 1491, 241, 1558, 466, 1560, 1561, 462, 463, 1036, + /* 1220 */ 1468, 1467, 1529, 1466, 1465, 1464, 1463, 1462, 1461, 1557, + /* 1230 */ 1460, 1459, 1458, 1457, 1456, 1557, 108, 1452, 1451, 1450, + /* 1240 */ 125, 1558, 466, 1560, 1561, 462, 1455, 1454, 1453, 437, + /* 1250 */ 1449, 1448, 1447, 1573, 1446, 1445, 1444, 1038, 1443, 1573, + /* 1260 */ 464, 1324, 1508, 1502, 1490, 1481, 461, 1372, 894, 1323, + /* 1270 */ 463, 1321, 154, 1319, 1529, 1317, 463, 274, 361, 362, + /* 1280 */ 1529, 1315, 1304, 365, 1696, 366, 1557, 363, 1303, 1300, + /* 1290 */ 1374, 369, 246, 1558, 466, 1560, 1561, 462, 245, 1558, + /* 1300 */ 466, 1560, 1561, 462, 370, 76, 1594, 1002, 374, 367, + /* 1310 */ 1573, 1373, 373, 371, 1557, 1005, 926, 464, 925, 375, + /* 1320 */ 1313, 924, 161, 262, 923, 920, 1308, 463, 528, 919, + /* 1330 */ 530, 1529, 263, 399, 276, 1306, 264, 402, 1573, 404, + /* 1340 */ 1298, 406, 75, 1507, 46, 464, 1299, 1072, 1501, 246, + /* 1350 */ 1558, 466, 1560, 1561, 462, 463, 413, 414, 119, 1529, + /* 1360 */ 1489, 1557, 278, 1488, 1480, 13, 56, 181, 3, 35, + /* 1370 */ 186, 41, 1557, 14, 191, 21, 126, 246, 1558, 466, + /* 1380 */ 1560, 1561, 462, 1232, 38, 1573, 190, 20, 58, 11, + /* 1390 */ 1225, 1548, 464, 1204, 1254, 178, 1573, 57, 39, 1253, + /* 1400 */ 1203, 15, 463, 464, 1259, 272, 1529, 197, 1258, 1257, + /* 1410 */ 1557, 273, 183, 463, 135, 8, 17, 1529, 138, 1152, + /* 1420 */ 1136, 27, 40, 10, 234, 1558, 466, 1560, 1561, 462, + /* 1430 */ 1151, 18, 1479, 19, 1573, 240, 1558, 466, 1560, 1561, + /* 1440 */ 462, 464, 471, 205, 204, 211, 64, 1230, 207, 209, + /* 1450 */ 59, 463, 60, 1108, 42, 1529, 484, 987, 1557, 286, + /* 1460 */ 486, 488, 482, 1167, 1557, 1547, 213, 216, 984, 489, + /* 1470 */ 964, 981, 491, 242, 1558, 466, 1560, 1561, 462, 492, + /* 1480 */ 494, 975, 1573, 495, 497, 465, 973, 979, 1573, 464, + /* 1490 */ 498, 978, 999, 977, 504, 464, 65, 995, 976, 463, + /* 1500 */ 998, 66, 67, 1529, 992, 463, 892, 515, 933, 1529, + /* 1510 */ 517, 218, 908, 915, 914, 1557, 913, 912, 911, 910, + /* 1520 */ 930, 235, 1558, 466, 1560, 1561, 462, 243, 1558, 466, + /* 1530 */ 1560, 1561, 462, 909, 928, 905, 904, 903, 900, 1573, + /* 1540 */ 899, 898, 897, 1320, 539, 540, 464, 1318, 541, 543, + /* 1550 */ 544, 545, 1316, 547, 548, 549, 463, 551, 552, 553, + /* 1560 */ 1529, 1557, 1314, 1302, 555, 556, 1301, 1297, 559, 560, + /* 1570 */ 564, 1094, 1557, 227, 563, 1272, 1272, 1272, 236, 1558, + /* 1580 */ 466, 1560, 1561, 462, 1272, 1573, 1272, 1272, 1272, 1272, + /* 1590 */ 1272, 1272, 464, 1272, 1272, 1272, 1573, 1272, 1272, 1272, + /* 1600 */ 1272, 1272, 463, 464, 1272, 1272, 1529, 1272, 1272, 1272, + /* 1610 */ 1272, 1272, 1272, 463, 1272, 1272, 1272, 1529, 1272, 1557, + /* 1620 */ 1272, 1272, 1272, 1272, 244, 1558, 466, 1560, 1561, 462, + /* 1630 */ 1272, 1272, 1272, 1272, 1272, 237, 1558, 466, 1560, 1561, + /* 1640 */ 462, 1272, 1272, 1573, 1272, 1272, 1272, 1557, 1272, 1272, + /* 1650 */ 464, 1272, 1272, 1272, 1272, 1272, 1272, 1272, 1272, 1272, + /* 1660 */ 463, 1272, 1272, 1272, 1529, 1272, 1272, 1272, 1272, 1272, + /* 1670 */ 1272, 1573, 1272, 1272, 1272, 1272, 1272, 1272, 464, 1272, + /* 1680 */ 1272, 1272, 1569, 1558, 466, 1560, 1561, 462, 463, 1272, + /* 1690 */ 1272, 1272, 1529, 1272, 1272, 1272, 1557, 1272, 1272, 1272, + /* 1700 */ 1272, 1272, 1272, 1272, 1272, 1557, 1272, 1272, 1272, 1272, + /* 1710 */ 1568, 1558, 466, 1560, 1561, 462, 1272, 1272, 1272, 1272, + /* 1720 */ 1573, 1272, 1272, 1272, 1272, 1272, 1272, 464, 1272, 1573, + /* 1730 */ 1272, 1272, 1272, 1272, 1272, 1272, 464, 463, 1272, 1272, + /* 1740 */ 1272, 1529, 1272, 1272, 1272, 1272, 463, 1272, 1272, 1272, + /* 1750 */ 1529, 1557, 1272, 1272, 1272, 1272, 1272, 1272, 1272, 1567, + /* 1760 */ 1558, 466, 1560, 1561, 462, 1272, 1272, 1272, 253, 1558, + /* 1770 */ 466, 1560, 1561, 462, 1272, 1573, 1272, 1272, 1272, 1557, + /* 1780 */ 1272, 1272, 464, 1272, 1272, 1272, 1272, 1272, 1272, 1272, + /* 1790 */ 1272, 1272, 463, 1272, 1272, 1272, 1529, 1272, 1272, 1272, + /* 1800 */ 1272, 1272, 1272, 1573, 1272, 1272, 1272, 1272, 1557, 1272, + /* 1810 */ 464, 1272, 1272, 1272, 252, 1558, 466, 1560, 1561, 462, + /* 1820 */ 463, 1272, 1272, 1272, 1529, 1272, 1272, 1272, 1272, 1272, + /* 1830 */ 1272, 1272, 1573, 1272, 1272, 1272, 1557, 1272, 1272, 464, + /* 1840 */ 1272, 1272, 254, 1558, 466, 1560, 1561, 462, 1272, 463, + /* 1850 */ 1272, 1272, 1272, 1529, 1272, 1272, 1272, 1272, 1272, 1272, + /* 1860 */ 1573, 1272, 1272, 1272, 1272, 1272, 1272, 464, 1272, 1272, + /* 1870 */ 1272, 251, 1558, 466, 1560, 1561, 462, 463, 1272, 1272, + /* 1880 */ 1272, 1529, 1272, 1272, 1272, 1272, 1272, 1272, 1272, 1272, + /* 1890 */ 1272, 1272, 1272, 1272, 1272, 1272, 1272, 1272, 1272, 239, + /* 1900 */ 1558, 466, 1560, 1561, 462, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 254, 241, 258, 257, 241, 254, 260, 279, 280, 219, - /* 10 */ 219, 260, 12, 13, 270, 271, 263, 213, 258, 228, - /* 20 */ 20, 258, 22, 294, 213, 12, 13, 14, 15, 16, - /* 30 */ 270, 271, 2, 270, 271, 244, 307, 20, 38, 249, - /* 40 */ 311, 237, 12, 13, 14, 15, 16, 294, 244, 20, - /* 50 */ 50, 12, 13, 14, 212, 219, 214, 57, 254, 20, - /* 60 */ 307, 22, 258, 4, 311, 12, 13, 263, 61, 258, - /* 70 */ 219, 20, 65, 20, 74, 22, 219, 38, 274, 275, - /* 80 */ 276, 277, 278, 216, 217, 228, 282, 283, 75, 50, - /* 90 */ 213, 38, 235, 237, 87, 244, 57, 97, 294, 263, - /* 100 */ 244, 244, 50, 50, 12, 13, 14, 15, 16, 109, - /* 110 */ 57, 307, 2, 74, 237, 311, 12, 13, 14, 15, - /* 120 */ 16, 244, 12, 13, 14, 15, 16, 74, 277, 222, - /* 130 */ 294, 254, 276, 226, 236, 258, 97, 286, 287, 288, - /* 140 */ 289, 20, 291, 307, 20, 247, 146, 311, 109, 246, - /* 150 */ 97, 274, 275, 276, 277, 278, 253, 254, 49, 282, - /* 160 */ 283, 284, 109, 163, 164, 165, 166, 167, 168, 169, - /* 170 */ 170, 171, 172, 173, 174, 175, 14, 15, 16, 75, - /* 180 */ 303, 164, 165, 210, 20, 146, 21, 187, 0, 24, - /* 190 */ 25, 26, 27, 28, 29, 30, 31, 32, 74, 146, - /* 200 */ 223, 224, 163, 164, 165, 166, 167, 168, 169, 170, - /* 210 */ 171, 172, 173, 174, 175, 163, 163, 164, 165, 166, - /* 220 */ 167, 168, 169, 170, 171, 172, 173, 174, 175, 12, - /* 230 */ 13, 139, 71, 263, 213, 221, 263, 20, 187, 22, - /* 240 */ 52, 219, 54, 145, 213, 147, 58, 188, 234, 61, - /* 250 */ 228, 63, 64, 0, 66, 38, 242, 235, 237, 12, - /* 260 */ 13, 14, 15, 16, 294, 244, 244, 294, 12, 13, - /* 270 */ 14, 213, 22, 187, 57, 254, 20, 307, 22, 258, - /* 280 */ 307, 311, 12, 13, 311, 187, 136, 213, 38, 258, - /* 290 */ 20, 74, 22, 47, 38, 274, 275, 276, 277, 278, - /* 300 */ 208, 20, 49, 282, 283, 284, 219, 57, 38, 0, - /* 310 */ 38, 237, 21, 57, 97, 228, 258, 296, 244, 73, - /* 320 */ 1, 2, 76, 302, 303, 34, 109, 57, 254, 57, - /* 330 */ 74, 244, 258, 24, 25, 26, 27, 28, 29, 30, - /* 340 */ 31, 32, 192, 193, 74, 0, 229, 97, 274, 275, - /* 350 */ 276, 277, 278, 97, 237, 74, 282, 283, 20, 109, - /* 360 */ 22, 67, 245, 146, 49, 109, 21, 97, 207, 24, - /* 370 */ 25, 26, 27, 28, 29, 30, 31, 32, 40, 109, - /* 380 */ 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - /* 390 */ 173, 174, 175, 219, 75, 237, 146, 12, 13, 14, - /* 400 */ 15, 16, 146, 52, 187, 54, 248, 113, 114, 58, - /* 410 */ 213, 221, 61, 163, 63, 64, 146, 66, 244, 163, - /* 420 */ 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, - /* 430 */ 174, 175, 242, 163, 164, 165, 166, 167, 168, 169, - /* 440 */ 170, 171, 172, 173, 174, 175, 12, 13, 18, 3, - /* 450 */ 20, 277, 272, 272, 20, 258, 22, 27, 218, 244, - /* 460 */ 30, 287, 288, 289, 213, 291, 251, 163, 187, 39, - /* 470 */ 290, 290, 38, 12, 13, 14, 15, 16, 20, 239, - /* 480 */ 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, - /* 490 */ 98, 57, 100, 101, 102, 103, 104, 105, 4, 237, - /* 500 */ 196, 197, 198, 199, 200, 243, 237, 219, 74, 258, - /* 510 */ 248, 50, 219, 19, 219, 219, 228, 248, 213, 185, - /* 520 */ 186, 228, 237, 138, 228, 219, 57, 33, 243, 20, - /* 530 */ 36, 97, 244, 248, 228, 41, 75, 244, 20, 244, - /* 540 */ 244, 47, 112, 109, 83, 115, 116, 117, 118, 119, - /* 550 */ 244, 121, 122, 123, 124, 125, 126, 127, 128, 129, - /* 560 */ 130, 131, 0, 258, 18, 219, 225, 73, 227, 23, - /* 570 */ 76, 218, 277, 272, 228, 12, 13, 14, 15, 16, - /* 580 */ 146, 35, 287, 288, 289, 232, 291, 219, 43, 213, - /* 590 */ 244, 290, 239, 132, 48, 85, 228, 163, 164, 165, - /* 600 */ 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, - /* 610 */ 219, 150, 244, 50, 52, 53, 54, 55, 56, 228, - /* 620 */ 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - /* 630 */ 68, 69, 70, 132, 258, 244, 19, 176, 177, 178, - /* 640 */ 179, 180, 181, 182, 183, 184, 83, 138, 0, 203, - /* 650 */ 33, 150, 229, 36, 213, 213, 138, 111, 229, 42, - /* 660 */ 237, 44, 45, 46, 47, 237, 237, 22, 245, 213, - /* 670 */ 213, 243, 223, 224, 245, 35, 248, 176, 14, 213, - /* 680 */ 237, 213, 71, 38, 20, 139, 140, 141, 245, 143, - /* 690 */ 73, 213, 238, 76, 148, 132, 142, 49, 238, 258, - /* 700 */ 258, 61, 156, 219, 158, 65, 160, 161, 162, 74, - /* 710 */ 213, 157, 228, 150, 258, 258, 0, 77, 213, 79, - /* 720 */ 80, 86, 82, 106, 258, 213, 258, 87, 244, 213, - /* 730 */ 213, 186, 213, 187, 230, 213, 258, 233, 0, 176, - /* 740 */ 177, 178, 179, 180, 181, 182, 183, 184, 38, 237, - /* 750 */ 0, 134, 36, 71, 137, 258, 244, 75, 238, 78, - /* 760 */ 22, 213, 81, 258, 78, 78, 254, 81, 81, 152, - /* 770 */ 258, 154, 22, 213, 258, 258, 78, 258, 0, 81, - /* 780 */ 258, 1, 2, 164, 165, 237, 274, 275, 276, 277, - /* 790 */ 278, 74, 244, 238, 282, 283, 284, 237, 266, 71, - /* 800 */ 22, 84, 254, 75, 244, 293, 258, 71, 71, 38, - /* 810 */ 238, 75, 75, 71, 254, 213, 205, 75, 258, 109, - /* 820 */ 238, 213, 274, 275, 276, 277, 278, 238, 214, 71, - /* 830 */ 282, 283, 284, 75, 274, 275, 276, 277, 278, 237, - /* 840 */ 314, 293, 282, 283, 284, 237, 244, 71, 226, 305, - /* 850 */ 71, 75, 244, 293, 75, 71, 254, 254, 33, 75, - /* 860 */ 258, 36, 254, 247, 71, 263, 258, 42, 75, 44, - /* 870 */ 45, 46, 47, 213, 254, 299, 274, 275, 276, 277, - /* 880 */ 109, 38, 274, 275, 276, 277, 278, 216, 71, 71, - /* 890 */ 282, 283, 75, 75, 273, 71, 294, 237, 73, 75, - /* 900 */ 57, 76, 292, 71, 244, 237, 71, 75, 71, 307, - /* 910 */ 75, 71, 75, 311, 254, 75, 20, 308, 258, 295, - /* 920 */ 213, 219, 36, 269, 223, 38, 144, 264, 219, 120, - /* 930 */ 219, 252, 132, 250, 274, 275, 276, 277, 250, 219, - /* 940 */ 20, 268, 20, 219, 237, 20, 262, 221, 244, 255, - /* 950 */ 221, 244, 221, 219, 221, 20, 215, 244, 133, 237, - /* 960 */ 135, 254, 137, 219, 237, 258, 153, 237, 244, 237, - /* 970 */ 223, 215, 312, 313, 268, 213, 237, 237, 218, 154, - /* 980 */ 237, 274, 275, 276, 277, 278, 237, 263, 237, 237, - /* 990 */ 283, 237, 267, 218, 20, 12, 13, 262, 195, 237, - /* 1000 */ 255, 277, 213, 244, 304, 22, 244, 259, 194, 304, - /* 1010 */ 213, 287, 288, 289, 57, 291, 254, 202, 294, 273, - /* 1020 */ 258, 38, 258, 261, 259, 258, 237, 258, 201, 244, - /* 1030 */ 189, 307, 190, 244, 237, 311, 274, 275, 276, 277, - /* 1040 */ 57, 244, 186, 254, 213, 20, 272, 258, 120, 204, - /* 1050 */ 261, 254, 213, 298, 301, 258, 209, 213, 285, 206, - /* 1060 */ 297, 300, 74, 274, 275, 276, 277, 310, 237, 281, - /* 1070 */ 259, 274, 275, 276, 277, 244, 237, 309, 258, 258, - /* 1080 */ 97, 237, 259, 244, 258, 254, 213, 315, 244, 258, - /* 1090 */ 135, 255, 109, 254, 256, 244, 218, 258, 254, 233, - /* 1100 */ 261, 218, 258, 306, 244, 274, 275, 276, 277, 74, - /* 1110 */ 237, 213, 240, 274, 275, 276, 277, 244, 274, 275, - /* 1120 */ 276, 277, 223, 219, 227, 218, 215, 254, 265, 146, - /* 1130 */ 220, 258, 231, 231, 261, 237, 0, 211, 0, 64, - /* 1140 */ 0, 38, 244, 159, 313, 38, 163, 274, 275, 276, - /* 1150 */ 277, 38, 254, 38, 159, 0, 258, 213, 38, 159, - /* 1160 */ 38, 0, 38, 0, 38, 213, 0, 74, 150, 149, - /* 1170 */ 109, 0, 274, 275, 276, 277, 146, 0, 53, 0, - /* 1180 */ 142, 237, 0, 86, 0, 0, 0, 0, 244, 237, - /* 1190 */ 0, 0, 0, 213, 120, 0, 244, 0, 254, 213, - /* 1200 */ 22, 0, 258, 0, 0, 0, 254, 0, 0, 0, - /* 1210 */ 258, 0, 0, 0, 0, 0, 0, 237, 274, 275, - /* 1220 */ 276, 277, 0, 237, 244, 0, 274, 275, 276, 277, - /* 1230 */ 244, 0, 0, 0, 254, 0, 0, 0, 258, 0, - /* 1240 */ 254, 43, 0, 0, 258, 213, 36, 51, 0, 43, - /* 1250 */ 213, 0, 0, 36, 274, 275, 276, 277, 213, 38, - /* 1260 */ 274, 275, 276, 277, 38, 38, 43, 43, 0, 237, - /* 1270 */ 36, 43, 0, 0, 237, 0, 244, 36, 38, 0, - /* 1280 */ 81, 244, 237, 38, 22, 83, 254, 0, 38, 244, - /* 1290 */ 258, 254, 38, 38, 38, 258, 38, 38, 0, 254, - /* 1300 */ 213, 71, 22, 258, 0, 22, 274, 275, 276, 277, - /* 1310 */ 39, 274, 275, 276, 277, 71, 0, 22, 0, 274, - /* 1320 */ 275, 276, 277, 38, 237, 213, 0, 22, 22, 20, - /* 1330 */ 0, 244, 38, 0, 213, 155, 22, 0, 0, 151, - /* 1340 */ 0, 254, 43, 74, 191, 258, 86, 71, 71, 237, - /* 1350 */ 191, 86, 71, 135, 185, 191, 244, 138, 237, 75, - /* 1360 */ 74, 274, 275, 276, 277, 244, 254, 138, 75, 4, - /* 1370 */ 258, 74, 71, 38, 74, 254, 138, 75, 75, 258, - /* 1380 */ 133, 74, 71, 75, 71, 75, 274, 275, 276, 277, - /* 1390 */ 71, 38, 38, 38, 38, 274, 275, 276, 277, 38, - /* 1400 */ 2, 86, 213, 86, 75, 74, 74, 213, 0, 75, - /* 1410 */ 74, 43, 163, 213, 75, 133, 75, 74, 74, 74, - /* 1420 */ 74, 22, 74, 38, 136, 38, 237, 0, 86, 38, - /* 1430 */ 38, 237, 0, 244, 84, 86, 85, 237, 244, 75, - /* 1440 */ 74, 38, 75, 254, 244, 74, 74, 258, 254, 75, - /* 1450 */ 75, 74, 258, 75, 254, 38, 74, 99, 258, 213, - /* 1460 */ 22, 99, 99, 274, 275, 276, 277, 87, 274, 275, - /* 1470 */ 276, 277, 99, 38, 274, 275, 276, 277, 74, 109, - /* 1480 */ 74, 74, 38, 237, 22, 51, 50, 57, 61, 71, - /* 1490 */ 244, 72, 65, 61, 38, 38, 38, 65, 38, 38, - /* 1500 */ 254, 38, 38, 22, 258, 57, 38, 38, 38, 38, - /* 1510 */ 38, 38, 38, 38, 87, 0, 38, 0, 36, 87, - /* 1520 */ 274, 275, 276, 277, 38, 36, 43, 43, 0, 38, - /* 1530 */ 36, 43, 0, 106, 107, 108, 38, 110, 106, 107, - /* 1540 */ 108, 36, 110, 43, 0, 38, 37, 0, 0, 22, - /* 1550 */ 21, 316, 22, 22, 21, 20, 316, 316, 316, 316, - /* 1560 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, - /* 1570 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, - /* 1580 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, - /* 1590 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, - /* 1600 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, - /* 1610 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, - /* 1620 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, - /* 1630 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, - /* 1640 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, - /* 1650 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, - /* 1660 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, - /* 1670 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, - /* 1680 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, - /* 1690 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, - /* 1700 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, - /* 1710 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, - /* 1720 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, - /* 1730 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, - /* 1740 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, - /* 1750 */ 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, - /* 1760 */ 316, 316, 316, 316, 316, 316, + /* 0 */ 250, 267, 250, 246, 222, 272, 295, 296, 230, 221, + /* 10 */ 253, 223, 12, 13, 228, 281, 282, 267, 255, 267, + /* 20 */ 20, 243, 22, 237, 20, 262, 263, 227, 246, 251, + /* 30 */ 244, 281, 282, 281, 282, 253, 246, 272, 38, 253, + /* 40 */ 20, 241, 252, 310, 287, 263, 0, 257, 248, 267, + /* 50 */ 50, 12, 13, 14, 222, 246, 323, 57, 49, 20, + /* 60 */ 327, 22, 228, 254, 47, 20, 310, 285, 286, 287, + /* 70 */ 288, 289, 290, 20, 74, 310, 294, 38, 246, 323, + /* 80 */ 298, 299, 300, 327, 228, 253, 38, 253, 323, 50, + /* 90 */ 73, 253, 327, 76, 312, 263, 57, 97, 260, 267, + /* 100 */ 318, 319, 12, 13, 272, 57, 272, 61, 238, 109, + /* 110 */ 20, 65, 22, 74, 258, 20, 246, 285, 286, 287, + /* 120 */ 288, 289, 290, 289, 254, 228, 294, 74, 38, 263, + /* 130 */ 298, 299, 266, 87, 237, 269, 97, 303, 304, 305, + /* 140 */ 50, 307, 310, 20, 310, 22, 146, 57, 109, 222, + /* 150 */ 253, 132, 106, 107, 108, 323, 110, 323, 138, 327, + /* 160 */ 222, 327, 231, 40, 74, 49, 235, 167, 168, 150, + /* 170 */ 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, + /* 180 */ 180, 181, 182, 183, 246, 146, 52, 97, 54, 155, + /* 190 */ 156, 253, 58, 159, 267, 61, 196, 63, 64, 109, + /* 200 */ 66, 263, 222, 184, 20, 267, 167, 168, 270, 170, + /* 210 */ 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, + /* 220 */ 181, 182, 183, 285, 286, 287, 288, 289, 290, 12, + /* 230 */ 13, 12, 13, 14, 15, 16, 146, 20, 230, 22, + /* 240 */ 238, 196, 12, 13, 14, 15, 16, 267, 246, 196, + /* 250 */ 12, 13, 14, 15, 16, 38, 254, 167, 168, 251, + /* 260 */ 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, + /* 270 */ 180, 181, 182, 183, 57, 12, 13, 14, 20, 228, + /* 280 */ 50, 0, 145, 20, 147, 22, 0, 142, 237, 21, + /* 290 */ 74, 74, 24, 25, 26, 27, 28, 29, 30, 31, + /* 300 */ 32, 38, 86, 228, 253, 75, 161, 12, 13, 14, + /* 310 */ 15, 16, 237, 83, 97, 0, 136, 61, 246, 244, + /* 320 */ 57, 65, 225, 226, 252, 196, 109, 167, 253, 257, + /* 330 */ 49, 35, 74, 196, 14, 15, 16, 74, 52, 53, + /* 340 */ 54, 55, 56, 87, 58, 59, 60, 61, 62, 63, + /* 350 */ 64, 65, 66, 67, 68, 69, 70, 61, 1, 2, + /* 360 */ 97, 65, 132, 146, 49, 205, 206, 207, 208, 209, + /* 370 */ 75, 239, 109, 77, 242, 79, 80, 139, 82, 67, + /* 380 */ 150, 201, 202, 87, 167, 168, 20, 170, 171, 172, + /* 390 */ 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, + /* 400 */ 183, 219, 12, 13, 228, 0, 232, 233, 222, 146, + /* 410 */ 20, 22, 22, 196, 184, 185, 186, 187, 188, 189, + /* 420 */ 190, 191, 192, 193, 20, 113, 114, 38, 38, 253, + /* 430 */ 167, 168, 75, 170, 171, 172, 173, 174, 175, 176, + /* 440 */ 177, 178, 179, 180, 181, 182, 183, 57, 12, 13, + /* 450 */ 12, 13, 228, 267, 272, 217, 20, 52, 22, 54, + /* 460 */ 22, 237, 85, 58, 74, 289, 61, 0, 63, 64, + /* 470 */ 227, 66, 3, 228, 38, 246, 38, 253, 302, 303, + /* 480 */ 304, 305, 237, 307, 71, 245, 257, 97, 75, 22, + /* 490 */ 2, 248, 310, 57, 222, 57, 256, 228, 253, 109, + /* 500 */ 12, 13, 14, 15, 16, 323, 237, 232, 233, 327, + /* 510 */ 74, 88, 89, 90, 91, 92, 93, 94, 95, 96, + /* 520 */ 97, 98, 253, 100, 101, 102, 103, 104, 105, 18, + /* 530 */ 222, 20, 238, 97, 228, 97, 146, 71, 27, 267, + /* 540 */ 246, 30, 138, 237, 234, 109, 236, 109, 254, 222, + /* 550 */ 39, 12, 13, 14, 15, 16, 222, 167, 168, 253, + /* 560 */ 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, + /* 570 */ 180, 181, 182, 183, 71, 267, 222, 228, 232, 233, + /* 580 */ 222, 246, 146, 43, 146, 2, 237, 232, 233, 50, + /* 590 */ 194, 195, 257, 20, 267, 12, 13, 14, 15, 16, + /* 600 */ 57, 267, 253, 167, 168, 167, 170, 171, 172, 173, + /* 610 */ 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, + /* 620 */ 222, 267, 83, 112, 222, 267, 115, 116, 117, 118, + /* 630 */ 119, 275, 121, 122, 123, 124, 125, 126, 127, 128, + /* 640 */ 129, 130, 131, 283, 246, 18, 222, 4, 228, 228, + /* 650 */ 23, 253, 12, 13, 14, 15, 16, 237, 237, 283, + /* 660 */ 71, 263, 35, 0, 75, 267, 306, 283, 228, 267, + /* 670 */ 228, 132, 0, 253, 253, 48, 0, 237, 228, 237, + /* 680 */ 214, 212, 306, 285, 286, 287, 288, 289, 290, 150, + /* 690 */ 306, 267, 294, 253, 50, 253, 298, 299, 300, 36, + /* 700 */ 24, 25, 26, 27, 28, 29, 30, 31, 32, 247, + /* 710 */ 12, 13, 14, 15, 16, 75, 222, 319, 0, 216, + /* 720 */ 222, 21, 272, 184, 185, 186, 187, 188, 189, 190, + /* 730 */ 191, 192, 193, 61, 34, 195, 0, 65, 111, 21, + /* 740 */ 222, 222, 24, 25, 26, 27, 28, 29, 30, 31, + /* 750 */ 32, 246, 222, 222, 0, 222, 222, 252, 22, 87, + /* 760 */ 310, 267, 257, 263, 246, 267, 139, 140, 141, 269, + /* 770 */ 143, 253, 247, 323, 222, 148, 22, 327, 106, 107, + /* 780 */ 108, 263, 110, 222, 71, 267, 267, 160, 75, 162, + /* 790 */ 222, 164, 165, 166, 22, 247, 14, 267, 267, 228, + /* 800 */ 267, 267, 20, 285, 286, 287, 288, 289, 290, 14, + /* 810 */ 38, 167, 294, 38, 246, 20, 298, 299, 300, 267, + /* 820 */ 235, 253, 78, 196, 253, 81, 38, 309, 267, 57, + /* 830 */ 78, 263, 57, 81, 78, 267, 138, 81, 78, 222, + /* 840 */ 197, 81, 157, 158, 247, 71, 247, 1, 2, 75, + /* 850 */ 181, 182, 247, 285, 286, 287, 288, 289, 290, 247, + /* 860 */ 289, 71, 294, 246, 38, 75, 298, 299, 300, 97, + /* 870 */ 253, 223, 330, 19, 303, 304, 305, 309, 307, 71, + /* 880 */ 263, 109, 71, 75, 267, 321, 75, 33, 222, 71, + /* 890 */ 36, 71, 256, 75, 279, 75, 42, 109, 44, 45, + /* 900 */ 46, 47, 285, 286, 287, 288, 289, 290, 315, 71, + /* 910 */ 71, 294, 246, 75, 75, 298, 299, 300, 146, 253, + /* 920 */ 71, 228, 225, 284, 75, 246, 309, 73, 308, 263, + /* 930 */ 76, 324, 4, 267, 311, 109, 20, 71, 272, 167, + /* 940 */ 168, 75, 228, 36, 280, 144, 253, 19, 38, 222, + /* 950 */ 273, 285, 286, 287, 288, 289, 290, 232, 71, 71, + /* 960 */ 106, 33, 75, 75, 36, 228, 228, 71, 71, 41, + /* 970 */ 120, 75, 75, 246, 74, 47, 310, 261, 259, 132, + /* 980 */ 253, 259, 289, 228, 84, 20, 277, 222, 134, 323, + /* 990 */ 263, 137, 230, 327, 267, 263, 303, 304, 305, 20, + /* 1000 */ 307, 73, 271, 230, 76, 20, 152, 264, 154, 230, + /* 1010 */ 253, 246, 285, 286, 287, 288, 289, 290, 253, 230, + /* 1020 */ 228, 294, 20, 230, 224, 298, 299, 246, 263, 246, + /* 1030 */ 246, 246, 267, 246, 228, 57, 224, 222, 267, 153, + /* 1040 */ 246, 277, 246, 246, 246, 246, 222, 271, 246, 227, + /* 1050 */ 285, 286, 287, 288, 289, 290, 276, 227, 253, 294, + /* 1060 */ 227, 246, 20, 298, 299, 204, 263, 320, 253, 320, + /* 1070 */ 246, 264, 203, 211, 210, 284, 267, 253, 263, 199, + /* 1080 */ 317, 268, 267, 316, 268, 33, 267, 263, 36, 198, + /* 1090 */ 267, 267, 314, 222, 42, 253, 44, 45, 46, 47, + /* 1100 */ 285, 286, 287, 288, 289, 290, 291, 292, 293, 285, + /* 1110 */ 286, 287, 288, 289, 290, 195, 20, 246, 283, 120, + /* 1120 */ 218, 215, 301, 313, 253, 73, 213, 74, 76, 297, + /* 1130 */ 135, 268, 267, 74, 263, 331, 268, 267, 267, 267, + /* 1140 */ 326, 265, 325, 253, 227, 264, 242, 253, 227, 222, + /* 1150 */ 249, 236, 328, 329, 228, 224, 285, 286, 287, 288, + /* 1160 */ 289, 290, 227, 274, 240, 294, 229, 220, 0, 240, + /* 1170 */ 299, 278, 0, 246, 64, 0, 38, 222, 163, 38, + /* 1180 */ 253, 38, 38, 163, 0, 133, 38, 135, 163, 137, + /* 1190 */ 263, 38, 0, 38, 267, 0, 38, 0, 74, 150, + /* 1200 */ 149, 246, 109, 146, 0, 0, 154, 53, 253, 142, + /* 1210 */ 0, 0, 285, 286, 287, 288, 289, 290, 263, 86, + /* 1220 */ 0, 0, 267, 0, 0, 0, 0, 0, 0, 222, + /* 1230 */ 0, 0, 0, 0, 0, 222, 120, 0, 0, 0, + /* 1240 */ 285, 286, 287, 288, 289, 290, 0, 0, 0, 322, + /* 1250 */ 0, 0, 0, 246, 0, 0, 0, 22, 0, 246, + /* 1260 */ 253, 0, 0, 0, 0, 0, 253, 0, 51, 0, + /* 1270 */ 263, 0, 43, 0, 267, 0, 263, 270, 38, 36, + /* 1280 */ 267, 0, 0, 38, 329, 36, 222, 43, 0, 0, + /* 1290 */ 0, 38, 285, 286, 287, 288, 289, 290, 285, 286, + /* 1300 */ 287, 288, 289, 290, 36, 83, 293, 22, 36, 43, + /* 1310 */ 246, 0, 38, 43, 222, 38, 38, 253, 38, 43, + /* 1320 */ 0, 38, 81, 22, 38, 38, 0, 263, 71, 38, + /* 1330 */ 71, 267, 22, 39, 270, 0, 22, 38, 246, 22, + /* 1340 */ 0, 22, 20, 0, 138, 253, 0, 38, 0, 285, + /* 1350 */ 286, 287, 288, 289, 290, 263, 22, 138, 151, 267, + /* 1360 */ 0, 222, 270, 0, 0, 200, 74, 43, 71, 71, + /* 1370 */ 75, 71, 222, 200, 71, 71, 74, 285, 286, 287, + /* 1380 */ 288, 289, 290, 75, 194, 246, 74, 74, 4, 200, + /* 1390 */ 75, 86, 253, 75, 38, 135, 246, 74, 71, 38, + /* 1400 */ 75, 71, 263, 253, 75, 38, 267, 86, 38, 38, + /* 1410 */ 222, 38, 133, 263, 86, 2, 71, 267, 86, 75, + /* 1420 */ 22, 74, 138, 74, 285, 286, 287, 288, 289, 290, + /* 1430 */ 75, 74, 0, 74, 246, 285, 286, 287, 288, 289, + /* 1440 */ 290, 253, 136, 75, 86, 43, 84, 75, 74, 74, + /* 1450 */ 74, 263, 74, 22, 74, 267, 38, 75, 222, 38, + /* 1460 */ 74, 38, 85, 167, 222, 86, 133, 86, 75, 74, + /* 1470 */ 22, 75, 38, 285, 286, 287, 288, 289, 290, 74, + /* 1480 */ 38, 75, 246, 74, 38, 169, 75, 99, 246, 253, + /* 1490 */ 74, 99, 38, 99, 87, 253, 74, 38, 99, 263, + /* 1500 */ 109, 74, 74, 267, 22, 263, 51, 50, 57, 267, + /* 1510 */ 72, 71, 22, 38, 38, 222, 38, 38, 38, 38, + /* 1520 */ 57, 285, 286, 287, 288, 289, 290, 285, 286, 287, + /* 1530 */ 288, 289, 290, 38, 38, 38, 38, 38, 38, 246, + /* 1540 */ 38, 38, 38, 0, 38, 36, 253, 0, 43, 38, + /* 1550 */ 36, 43, 0, 38, 36, 43, 263, 38, 36, 43, + /* 1560 */ 267, 222, 0, 0, 38, 37, 0, 0, 22, 21, + /* 1570 */ 20, 22, 222, 22, 21, 332, 332, 332, 285, 286, + /* 1580 */ 287, 288, 289, 290, 332, 246, 332, 332, 332, 332, + /* 1590 */ 332, 332, 253, 332, 332, 332, 246, 332, 332, 332, + /* 1600 */ 332, 332, 263, 253, 332, 332, 267, 332, 332, 332, + /* 1610 */ 332, 332, 332, 263, 332, 332, 332, 267, 332, 222, + /* 1620 */ 332, 332, 332, 332, 285, 286, 287, 288, 289, 290, + /* 1630 */ 332, 332, 332, 332, 332, 285, 286, 287, 288, 289, + /* 1640 */ 290, 332, 332, 246, 332, 332, 332, 222, 332, 332, + /* 1650 */ 253, 332, 332, 332, 332, 332, 332, 332, 332, 332, + /* 1660 */ 263, 332, 332, 332, 267, 332, 332, 332, 332, 332, + /* 1670 */ 332, 246, 332, 332, 332, 332, 332, 332, 253, 332, + /* 1680 */ 332, 332, 285, 286, 287, 288, 289, 290, 263, 332, + /* 1690 */ 332, 332, 267, 332, 332, 332, 222, 332, 332, 332, + /* 1700 */ 332, 332, 332, 332, 332, 222, 332, 332, 332, 332, + /* 1710 */ 285, 286, 287, 288, 289, 290, 332, 332, 332, 332, + /* 1720 */ 246, 332, 332, 332, 332, 332, 332, 253, 332, 246, + /* 1730 */ 332, 332, 332, 332, 332, 332, 253, 263, 332, 332, + /* 1740 */ 332, 267, 332, 332, 332, 332, 263, 332, 332, 332, + /* 1750 */ 267, 222, 332, 332, 332, 332, 332, 332, 332, 285, + /* 1760 */ 286, 287, 288, 289, 290, 332, 332, 332, 285, 286, + /* 1770 */ 287, 288, 289, 290, 332, 246, 332, 332, 332, 222, + /* 1780 */ 332, 332, 253, 332, 332, 332, 332, 332, 332, 332, + /* 1790 */ 332, 332, 263, 332, 332, 332, 267, 332, 332, 332, + /* 1800 */ 332, 332, 332, 246, 332, 332, 332, 332, 222, 332, + /* 1810 */ 253, 332, 332, 332, 285, 286, 287, 288, 289, 290, + /* 1820 */ 263, 332, 332, 332, 267, 332, 332, 332, 332, 332, + /* 1830 */ 332, 332, 246, 332, 332, 332, 222, 332, 332, 253, + /* 1840 */ 332, 332, 285, 286, 287, 288, 289, 290, 332, 263, + /* 1850 */ 332, 332, 332, 267, 332, 332, 332, 332, 332, 332, + /* 1860 */ 246, 332, 332, 332, 332, 332, 332, 253, 332, 332, + /* 1870 */ 332, 285, 286, 287, 288, 289, 290, 263, 332, 332, + /* 1880 */ 332, 267, 332, 332, 332, 332, 332, 332, 332, 332, + /* 1890 */ 332, 332, 332, 332, 332, 332, 332, 332, 332, 285, + /* 1900 */ 286, 287, 288, 289, 290, }; -#define YY_SHIFT_COUNT (549) +#define YY_SHIFT_COUNT (565) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (1548) +#define YY_SHIFT_MAX (1567) static const unsigned short int yy_shift_ofst[] = { - /* 0 */ 546, 0, 39, 53, 53, 53, 53, 217, 53, 53, - /* 10 */ 270, 434, 281, 256, 270, 270, 270, 270, 270, 270, - /* 20 */ 270, 270, 270, 270, 270, 270, 270, 270, 270, 270, - /* 30 */ 270, 270, 270, 270, 270, 124, 124, 124, 51, 983, - /* 40 */ 983, 98, 29, 29, 86, 983, 17, 17, 29, 29, - /* 50 */ 29, 29, 29, 29, 109, 121, 164, 86, 121, 29, - /* 60 */ 29, 121, 29, 121, 121, 121, 29, 315, 430, 461, - /* 70 */ 563, 563, 165, 640, 250, 351, 250, 250, 250, 250, - /* 80 */ 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, - /* 90 */ 250, 250, 250, 250, 250, 17, 338, 253, 272, 509, - /* 100 */ 509, 509, 648, 272, 458, 121, 121, 121, 510, 469, - /* 110 */ 392, 392, 392, 392, 392, 392, 392, 617, 345, 188, - /* 120 */ 92, 304, 17, 7, 17, 150, 645, 518, 334, 545, - /* 130 */ 334, 664, 446, 59, 896, 886, 887, 782, 896, 896, - /* 140 */ 809, 800, 800, 896, 920, 922, 109, 458, 925, 109, - /* 150 */ 109, 896, 109, 935, 121, 121, 121, 121, 121, 121, - /* 160 */ 121, 121, 121, 121, 121, 887, 896, 935, 458, 920, - /* 170 */ 813, 922, 315, 458, 925, 315, 974, 803, 814, 957, - /* 180 */ 803, 814, 957, 957, 815, 827, 842, 841, 856, 458, - /* 190 */ 1025, 928, 847, 853, 845, 988, 121, 814, 957, 957, - /* 200 */ 814, 957, 955, 458, 925, 315, 510, 315, 458, 1035, - /* 210 */ 887, 469, 896, 315, 935, 1556, 1556, 1556, 1556, 1556, - /* 220 */ 562, 825, 309, 494, 1427, 1432, 13, 30, 110, 104, - /* 230 */ 385, 247, 247, 247, 247, 247, 247, 247, 246, 294, - /* 240 */ 162, 319, 501, 162, 162, 162, 716, 554, 682, 681, - /* 250 */ 686, 687, 698, 738, 750, 778, 291, 728, 736, 737, - /* 260 */ 780, 619, 611, 161, 742, 52, 758, 635, 776, 779, - /* 270 */ 784, 793, 817, 710, 771, 818, 824, 832, 835, 837, - /* 280 */ 840, 717, 843, 1136, 1138, 1075, 1140, 1103, 984, 1107, - /* 290 */ 1113, 1115, 995, 1155, 1120, 1122, 1000, 1161, 1124, 1163, - /* 300 */ 1126, 1166, 1093, 1018, 1020, 1061, 1030, 1171, 1177, 1125, - /* 310 */ 1038, 1179, 1182, 1097, 1184, 1185, 1186, 1187, 1190, 1191, - /* 320 */ 1192, 1197, 1203, 1204, 1205, 1207, 1208, 1209, 1211, 1212, - /* 330 */ 1074, 1195, 1213, 1214, 1215, 1216, 1222, 1178, 1201, 1225, - /* 340 */ 1231, 1232, 1233, 1235, 1236, 1237, 1239, 1198, 1242, 1196, - /* 350 */ 1243, 1248, 1221, 1210, 1206, 1251, 1226, 1217, 1223, 1252, - /* 360 */ 1227, 1234, 1224, 1268, 1240, 1241, 1228, 1272, 1273, 1275, - /* 370 */ 1279, 1202, 1199, 1245, 1230, 1262, 1287, 1250, 1254, 1255, - /* 380 */ 1256, 1244, 1230, 1258, 1259, 1298, 1280, 1304, 1283, 1271, - /* 390 */ 1316, 1295, 1285, 1318, 1305, 1326, 1306, 1309, 1330, 1219, - /* 400 */ 1180, 1294, 1333, 1188, 1314, 1229, 1218, 1337, 1338, 1238, - /* 410 */ 1340, 1269, 1299, 1247, 1276, 1277, 1153, 1284, 1281, 1293, - /* 420 */ 1286, 1297, 1300, 1302, 1301, 1260, 1307, 1311, 1159, 1303, - /* 430 */ 1308, 1265, 1169, 1313, 1315, 1310, 1319, 1164, 1365, 1335, - /* 440 */ 1353, 1354, 1355, 1356, 1361, 1398, 1249, 1317, 1329, 1331, - /* 450 */ 1334, 1332, 1336, 1339, 1341, 1343, 1344, 1288, 1345, 1408, - /* 460 */ 1368, 1282, 1346, 1350, 1342, 1349, 1399, 1348, 1351, 1364, - /* 470 */ 1385, 1387, 1366, 1367, 1391, 1371, 1374, 1392, 1372, 1375, - /* 480 */ 1403, 1377, 1378, 1417, 1382, 1358, 1362, 1363, 1373, 1438, - /* 490 */ 1380, 1404, 1435, 1370, 1406, 1407, 1444, 1230, 1462, 1434, - /* 500 */ 1436, 1430, 1419, 1418, 1456, 1457, 1458, 1460, 1461, 1463, - /* 510 */ 1464, 1481, 1448, 1244, 1468, 1230, 1469, 1470, 1471, 1472, - /* 520 */ 1473, 1474, 1475, 1515, 1478, 1482, 1483, 1517, 1486, 1489, - /* 530 */ 1484, 1528, 1491, 1494, 1488, 1532, 1498, 1505, 1500, 1544, - /* 540 */ 1507, 1509, 1547, 1548, 1527, 1529, 1530, 1531, 1533, 1535, + /* 0 */ 627, 0, 39, 90, 90, 90, 90, 217, 90, 90, + /* 10 */ 263, 390, 436, 390, 390, 390, 390, 390, 390, 390, + /* 20 */ 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, + /* 30 */ 390, 390, 390, 390, 390, 390, 53, 258, 258, 258, + /* 40 */ 45, 438, 438, 137, 4, 4, 129, 438, 4, 4, + /* 50 */ 4, 4, 4, 4, 9, 4, 95, 184, 129, 366, + /* 60 */ 95, 4, 4, 95, 4, 95, 366, 95, 95, 4, + /* 70 */ 116, 511, 230, 539, 539, 268, 772, 296, 772, 772, + /* 80 */ 772, 772, 772, 772, 772, 772, 772, 772, 772, 772, + /* 90 */ 772, 772, 772, 772, 772, 772, 772, 134, 123, 281, + /* 100 */ 48, 48, 20, 20, 20, 315, 48, 48, 573, 366, + /* 110 */ 95, 95, 95, 377, 543, 423, 423, 423, 423, 423, + /* 120 */ 423, 423, 854, 718, 405, 238, 160, 256, 34, 180, + /* 130 */ 389, 404, 396, 540, 396, 782, 469, 643, 795, 916, + /* 140 */ 907, 910, 801, 916, 916, 850, 847, 847, 916, 965, + /* 150 */ 9, 366, 979, 9, 573, 985, 9, 9, 916, 9, + /* 160 */ 1002, 95, 95, 95, 95, 95, 95, 95, 95, 95, + /* 170 */ 95, 95, 916, 1002, 978, 965, 116, 886, 366, 979, + /* 180 */ 116, 573, 985, 116, 1042, 861, 869, 978, 861, 869, + /* 190 */ 978, 978, 862, 864, 880, 891, 920, 573, 1096, 999, + /* 200 */ 902, 906, 913, 1053, 95, 869, 978, 978, 869, 978, + /* 210 */ 995, 573, 985, 116, 377, 116, 573, 1059, 543, 916, + /* 220 */ 116, 1002, 1905, 1905, 1905, 1905, 1905, 1905, 286, 1052, + /* 230 */ 676, 928, 46, 672, 295, 488, 583, 698, 640, 219, + /* 240 */ 219, 219, 219, 219, 219, 219, 219, 17, 312, 357, + /* 250 */ 19, 320, 320, 320, 320, 663, 145, 413, 744, 752, + /* 260 */ 756, 760, 467, 736, 754, 700, 685, 589, 713, 774, + /* 270 */ 846, 669, 466, 503, 790, 644, 808, 216, 811, 818, + /* 280 */ 820, 838, 839, 788, 826, 849, 866, 887, 888, 896, + /* 290 */ 897, 900, 775, 1168, 1172, 1110, 1175, 1138, 1015, 1141, + /* 300 */ 1143, 1144, 1020, 1184, 1148, 1153, 1025, 1192, 1155, 1195, + /* 310 */ 1158, 1197, 1124, 1049, 1051, 1093, 1057, 1204, 1205, 1154, + /* 320 */ 1067, 1210, 1211, 1133, 1220, 1221, 1223, 1224, 1225, 1226, + /* 330 */ 1227, 1228, 1230, 1231, 1232, 1233, 1234, 1246, 1247, 1248, + /* 340 */ 1116, 1237, 1238, 1239, 1250, 1251, 1252, 1235, 1254, 1255, + /* 350 */ 1256, 1258, 1261, 1262, 1263, 1264, 1265, 1229, 1267, 1217, + /* 360 */ 1269, 1271, 1240, 1243, 1244, 1273, 1245, 1249, 1266, 1275, + /* 370 */ 1253, 1268, 1270, 1281, 1274, 1272, 1276, 1282, 1288, 1289, + /* 380 */ 1290, 1222, 1241, 1277, 1257, 1259, 1285, 1311, 1278, 1280, + /* 390 */ 1283, 1286, 1257, 1259, 1287, 1291, 1320, 1301, 1326, 1310, + /* 400 */ 1294, 1335, 1314, 1299, 1346, 1317, 1340, 1319, 1322, 1343, + /* 410 */ 1206, 1309, 1348, 1207, 1334, 1219, 1260, 1360, 1363, 1284, + /* 420 */ 1364, 1292, 1324, 1279, 1297, 1298, 1165, 1295, 1300, 1308, + /* 430 */ 1302, 1312, 1313, 1315, 1303, 1305, 1323, 1304, 1173, 1318, + /* 440 */ 1325, 1321, 1190, 1327, 1328, 1329, 1330, 1189, 1384, 1356, + /* 450 */ 1361, 1367, 1370, 1371, 1373, 1413, 1296, 1345, 1344, 1347, + /* 460 */ 1355, 1332, 1349, 1357, 1358, 1398, 1316, 1359, 1368, 1372, + /* 470 */ 1374, 1375, 1306, 1376, 1432, 1402, 1333, 1378, 1362, 1379, + /* 480 */ 1381, 1431, 1380, 1377, 1382, 1418, 1421, 1386, 1393, 1423, + /* 490 */ 1395, 1396, 1434, 1405, 1406, 1442, 1409, 1411, 1446, 1416, + /* 500 */ 1388, 1392, 1394, 1399, 1448, 1407, 1422, 1454, 1391, 1427, + /* 510 */ 1428, 1459, 1257, 1259, 1482, 1455, 1457, 1451, 1438, 1440, + /* 520 */ 1475, 1476, 1478, 1479, 1480, 1481, 1495, 1490, 1463, 1257, + /* 530 */ 1496, 1259, 1497, 1498, 1499, 1500, 1502, 1503, 1504, 1543, + /* 540 */ 1506, 1509, 1505, 1547, 1511, 1514, 1508, 1552, 1515, 1518, + /* 550 */ 1512, 1562, 1519, 1522, 1516, 1563, 1526, 1528, 1566, 1567, + /* 560 */ 1546, 1548, 1549, 1551, 1553, 1550, }; -#define YY_REDUCE_COUNT (219) -#define YY_REDUCE_MIN (-272) -#define YY_REDUCE_MAX (1246) +#define YY_REDUCE_COUNT (227) +#define YY_REDUCE_MIN (-289) +#define YY_REDUCE_MAX (1614) static const short yy_reduce_ofst[] = { - /* 0 */ -27, -196, 21, -123, 512, 548, 560, 602, 74, 608, - /* 10 */ 660, 707, 724, 762, 789, 797, 831, 839, 873, 844, - /* 20 */ 898, 944, 952, 980, 986, 1032, 1037, 1045, 1087, 1112, - /* 30 */ 1121, 1189, 1194, 1200, 1246, -149, 174, 295, -164, -240, - /* 40 */ -237, -247, -143, 22, -30, -256, -254, -97, -209, 87, - /* 50 */ 288, 293, 296, 306, 14, 262, -144, -271, 117, 346, - /* 60 */ 368, 285, 391, 423, 428, 429, 484, 353, -210, -272, - /* 70 */ -272, -272, -158, -102, -189, -93, 31, 58, 197, 251, - /* 80 */ 305, 376, 441, 442, 456, 457, 466, 468, 478, 497, - /* 90 */ 505, 516, 517, 519, 522, -249, -133, 190, -23, 180, - /* 100 */ 181, 301, 240, 449, 215, 443, 158, 269, 504, 341, - /* 110 */ 454, 460, 520, 555, 572, 582, 589, 532, 614, 622, - /* 120 */ 526, 544, 603, 616, 620, 576, 671, 621, 610, 610, - /* 130 */ 610, 668, 609, 624, 702, 654, 701, 663, 709, 711, - /* 140 */ 679, 683, 688, 720, 673, 684, 726, 704, 694, 729, - /* 150 */ 731, 734, 733, 741, 722, 727, 730, 732, 739, 740, - /* 160 */ 743, 749, 751, 752, 754, 747, 744, 756, 713, 706, - /* 170 */ 725, 735, 760, 759, 745, 775, 746, 700, 748, 764, - /* 180 */ 705, 765, 767, 769, 753, 761, 755, 763, 610, 785, - /* 190 */ 774, 773, 772, 757, 768, 788, 668, 811, 820, 821, - /* 200 */ 823, 826, 838, 851, 836, 878, 866, 883, 860, 872, - /* 210 */ 899, 897, 904, 907, 911, 863, 901, 902, 910, 926, + /* 0 */ 182, -168, -218, 398, 518, 568, 617, 666, 727, 765, + /* 10 */ 815, 824, 871, -62, 927, 955, 1007, 1013, 1064, 1092, + /* 20 */ 1139, 1150, 1188, 1236, 1242, 1293, 1339, 1350, 1397, 1425, + /* 30 */ 1474, 1483, 1529, 1557, 1586, 1614, -166, 176, 571, 693, + /* 40 */ 450, -250, -248, -267, -214, 75, -235, -266, -103, 51, + /* 50 */ 224, 245, 269, 306, -222, 349, -210, -243, -244, -134, + /* 60 */ -130, 420, 421, 72, 440, 2, -237, 505, 294, 442, + /* 70 */ -200, -144, -289, -289, -289, -212, -73, 240, -20, 186, + /* 80 */ 272, 308, 327, 334, 354, 358, 402, 424, 494, 498, + /* 90 */ 519, 530, 531, 533, 534, 552, 561, -69, 97, 8, + /* 100 */ 174, 275, 360, 376, 384, 243, 346, 355, -162, 500, + /* 110 */ -191, 229, 335, 132, 310, 462, 525, 548, 597, 599, + /* 120 */ 605, 612, 356, 648, 585, 542, 564, 636, 615, 593, + /* 130 */ 697, 639, 620, 620, 620, 679, 607, 623, 679, 714, + /* 140 */ 664, 725, 677, 737, 738, 716, 719, 722, 755, 709, + /* 150 */ 762, 732, 731, 773, 757, 743, 779, 789, 792, 793, + /* 160 */ 800, 781, 783, 784, 785, 787, 794, 796, 797, 798, + /* 170 */ 799, 802, 806, 812, 771, 764, 822, 780, 803, 776, + /* 180 */ 830, 805, 807, 833, 791, 747, 813, 809, 749, 816, + /* 190 */ 819, 823, 763, 767, 778, 810, 620, 842, 835, 821, + /* 200 */ 804, 814, 817, 832, 679, 863, 865, 870, 868, 872, + /* 210 */ 876, 890, 881, 917, 904, 921, 894, 901, 915, 926, + /* 220 */ 935, 931, 889, 893, 924, 929, 937, 947, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, - /* 10 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, - /* 20 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, - /* 30 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, - /* 40 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, - /* 50 */ 1221, 1221, 1221, 1221, 1280, 1221, 1221, 1221, 1221, 1221, - /* 60 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1278, 1418, 1221, - /* 70 */ 1554, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, - /* 80 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, - /* 90 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1280, 1221, 1565, - /* 100 */ 1565, 1565, 1278, 1221, 1221, 1221, 1221, 1221, 1373, 1221, - /* 110 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1452, 1221, 1221, - /* 120 */ 1629, 1221, 1221, 1326, 1221, 1589, 1221, 1581, 1557, 1571, - /* 130 */ 1558, 1221, 1614, 1574, 1221, 1221, 1221, 1444, 1221, 1221, - /* 140 */ 1423, 1420, 1420, 1221, 1221, 1221, 1280, 1221, 1221, 1280, - /* 150 */ 1280, 1221, 1280, 1221, 1221, 1221, 1221, 1221, 1221, 1221, - /* 160 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, - /* 170 */ 1454, 1221, 1278, 1221, 1221, 1278, 1221, 1596, 1594, 1221, - /* 180 */ 1596, 1594, 1221, 1221, 1608, 1604, 1587, 1585, 1571, 1221, - /* 190 */ 1221, 1221, 1632, 1620, 1616, 1221, 1221, 1594, 1221, 1221, - /* 200 */ 1594, 1221, 1431, 1221, 1221, 1278, 1221, 1278, 1221, 1342, - /* 210 */ 1221, 1221, 1221, 1278, 1221, 1446, 1376, 1376, 1281, 1226, - /* 220 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, - /* 230 */ 1221, 1517, 1607, 1606, 1516, 1531, 1530, 1529, 1221, 1221, - /* 240 */ 1511, 1221, 1221, 1512, 1510, 1509, 1221, 1221, 1221, 1221, - /* 250 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, - /* 260 */ 1555, 1221, 1617, 1621, 1221, 1221, 1221, 1491, 1221, 1221, - /* 270 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, - /* 280 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, - /* 290 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, - /* 300 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, - /* 310 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, - /* 320 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, - /* 330 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, - /* 340 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, - /* 350 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, - /* 360 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, - /* 370 */ 1221, 1221, 1221, 1221, 1387, 1221, 1221, 1221, 1221, 1221, - /* 380 */ 1221, 1307, 1306, 1221, 1221, 1221, 1221, 1221, 1221, 1221, - /* 390 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, - /* 400 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, - /* 410 */ 1221, 1221, 1221, 1221, 1578, 1588, 1221, 1221, 1221, 1221, - /* 420 */ 1221, 1221, 1221, 1221, 1221, 1491, 1221, 1605, 1221, 1564, - /* 430 */ 1560, 1221, 1221, 1556, 1221, 1221, 1615, 1221, 1221, 1221, - /* 440 */ 1221, 1221, 1221, 1221, 1221, 1550, 1221, 1221, 1221, 1221, - /* 450 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, - /* 460 */ 1221, 1221, 1221, 1221, 1490, 1221, 1221, 1221, 1221, 1221, - /* 470 */ 1221, 1221, 1370, 1221, 1221, 1221, 1221, 1221, 1221, 1221, - /* 480 */ 1221, 1221, 1221, 1221, 1221, 1355, 1353, 1352, 1351, 1221, - /* 490 */ 1348, 1221, 1221, 1221, 1221, 1221, 1221, 1378, 1221, 1221, - /* 500 */ 1221, 1221, 1221, 1301, 1221, 1221, 1221, 1221, 1221, 1221, - /* 510 */ 1221, 1221, 1221, 1292, 1221, 1291, 1221, 1221, 1221, 1221, - /* 520 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, - /* 530 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, - /* 540 */ 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, 1221, + /* 0 */ 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, + /* 10 */ 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, + /* 20 */ 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, + /* 30 */ 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, + /* 40 */ 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, + /* 50 */ 1270, 1270, 1270, 1270, 1329, 1270, 1270, 1270, 1270, 1270, + /* 60 */ 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, + /* 70 */ 1327, 1469, 1270, 1623, 1270, 1270, 1270, 1270, 1270, 1270, + /* 80 */ 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, + /* 90 */ 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1329, + /* 100 */ 1270, 1270, 1634, 1634, 1634, 1327, 1270, 1270, 1270, 1270, + /* 110 */ 1270, 1270, 1270, 1422, 1270, 1270, 1270, 1270, 1270, 1270, + /* 120 */ 1270, 1270, 1503, 1270, 1270, 1698, 1270, 1375, 1509, 1658, + /* 130 */ 1270, 1650, 1626, 1640, 1627, 1270, 1683, 1643, 1270, 1270, + /* 140 */ 1270, 1270, 1495, 1270, 1270, 1474, 1471, 1471, 1270, 1270, + /* 150 */ 1329, 1270, 1270, 1329, 1270, 1270, 1329, 1329, 1270, 1329, + /* 160 */ 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, + /* 170 */ 1270, 1270, 1270, 1270, 1270, 1270, 1327, 1505, 1270, 1270, + /* 180 */ 1327, 1270, 1270, 1327, 1270, 1665, 1663, 1270, 1665, 1663, + /* 190 */ 1270, 1270, 1677, 1673, 1656, 1654, 1640, 1270, 1270, 1270, + /* 200 */ 1701, 1689, 1685, 1270, 1270, 1663, 1270, 1270, 1663, 1270, + /* 210 */ 1482, 1270, 1270, 1327, 1270, 1327, 1270, 1391, 1270, 1270, + /* 220 */ 1327, 1270, 1497, 1511, 1425, 1425, 1330, 1275, 1270, 1270, + /* 230 */ 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1572, + /* 240 */ 1676, 1675, 1599, 1598, 1597, 1595, 1571, 1270, 1270, 1270, + /* 250 */ 1270, 1565, 1566, 1564, 1563, 1270, 1270, 1270, 1270, 1270, + /* 260 */ 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, + /* 270 */ 1624, 1270, 1686, 1690, 1270, 1270, 1270, 1549, 1270, 1270, + /* 280 */ 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, + /* 290 */ 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, + /* 300 */ 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, + /* 310 */ 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, + /* 320 */ 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, + /* 330 */ 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, + /* 340 */ 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, + /* 350 */ 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, + /* 360 */ 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, + /* 370 */ 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, + /* 380 */ 1270, 1270, 1270, 1270, 1438, 1437, 1270, 1270, 1270, 1270, + /* 390 */ 1270, 1270, 1356, 1355, 1270, 1270, 1270, 1270, 1270, 1270, + /* 400 */ 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, + /* 410 */ 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, + /* 420 */ 1270, 1270, 1270, 1270, 1647, 1657, 1270, 1270, 1270, 1270, + /* 430 */ 1270, 1270, 1270, 1270, 1270, 1549, 1270, 1674, 1270, 1633, + /* 440 */ 1629, 1270, 1270, 1625, 1270, 1270, 1684, 1270, 1270, 1270, + /* 450 */ 1270, 1270, 1270, 1270, 1270, 1619, 1270, 1592, 1270, 1270, + /* 460 */ 1270, 1270, 1270, 1270, 1270, 1270, 1559, 1270, 1270, 1270, + /* 470 */ 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1548, + /* 480 */ 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1419, 1270, 1270, + /* 490 */ 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, + /* 500 */ 1404, 1402, 1401, 1400, 1270, 1397, 1270, 1270, 1270, 1270, + /* 510 */ 1270, 1270, 1428, 1427, 1270, 1270, 1270, 1270, 1270, 1350, + /* 520 */ 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1341, + /* 530 */ 1270, 1340, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, + /* 540 */ 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, + /* 550 */ 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, 1270, + /* 560 */ 1270, 1270, 1270, 1270, 1270, 1270, }; /********** End of lemon-generated parsing tables *****************************/ @@ -952,166 +1006,182 @@ static const char *const yyTokenName[] = { /* 153 */ "BUFSIZE", /* 154 */ "STREAM", /* 155 */ "INTO", - /* 156 */ "KILL", - /* 157 */ "CONNECTION", - /* 158 */ "MERGE", - /* 159 */ "VGROUP", - /* 160 */ "REDISTRIBUTE", - /* 161 */ "SPLIT", - /* 162 */ "SYNCDB", - /* 163 */ "NULL", - /* 164 */ "FIRST", - /* 165 */ "LAST", - /* 166 */ "CAST", - /* 167 */ "NOW", - /* 168 */ "TODAY", - /* 169 */ "ROWTS", - /* 170 */ "TBNAME", - /* 171 */ "QSTARTTS", - /* 172 */ "QENDTS", - /* 173 */ "WSTARTTS", - /* 174 */ "WENDTS", - /* 175 */ "WDURATION", - /* 176 */ "BETWEEN", - /* 177 */ "IS", - /* 178 */ "NK_LT", - /* 179 */ "NK_GT", - /* 180 */ "NK_LE", - /* 181 */ "NK_GE", - /* 182 */ "NK_NE", - /* 183 */ "MATCH", - /* 184 */ "NMATCH", - /* 185 */ "JOIN", - /* 186 */ "INNER", - /* 187 */ "SELECT", - /* 188 */ "DISTINCT", - /* 189 */ "WHERE", - /* 190 */ "PARTITION", - /* 191 */ "BY", - /* 192 */ "SESSION", - /* 193 */ "STATE_WINDOW", - /* 194 */ "SLIDING", - /* 195 */ "FILL", - /* 196 */ "VALUE", - /* 197 */ "NONE", - /* 198 */ "PREV", - /* 199 */ "LINEAR", - /* 200 */ "NEXT", - /* 201 */ "GROUP", - /* 202 */ "HAVING", - /* 203 */ "ORDER", - /* 204 */ "SLIMIT", - /* 205 */ "SOFFSET", - /* 206 */ "LIMIT", - /* 207 */ "OFFSET", - /* 208 */ "ASC", - /* 209 */ "NULLS", - /* 210 */ "cmd", - /* 211 */ "account_options", - /* 212 */ "alter_account_options", - /* 213 */ "literal", - /* 214 */ "alter_account_option", - /* 215 */ "user_name", - /* 216 */ "dnode_endpoint", - /* 217 */ "dnode_host_name", - /* 218 */ "not_exists_opt", - /* 219 */ "db_name", - /* 220 */ "db_options", - /* 221 */ "exists_opt", - /* 222 */ "alter_db_options", - /* 223 */ "integer_list", - /* 224 */ "variable_list", - /* 225 */ "retention_list", - /* 226 */ "alter_db_option", - /* 227 */ "retention", - /* 228 */ "full_table_name", - /* 229 */ "column_def_list", - /* 230 */ "tags_def_opt", - /* 231 */ "table_options", - /* 232 */ "multi_create_clause", - /* 233 */ "tags_def", - /* 234 */ "multi_drop_clause", - /* 235 */ "alter_table_clause", - /* 236 */ "alter_table_options", - /* 237 */ "column_name", - /* 238 */ "type_name", - /* 239 */ "create_subtable_clause", - /* 240 */ "specific_tags_opt", - /* 241 */ "literal_list", - /* 242 */ "drop_table_clause", - /* 243 */ "col_name_list", - /* 244 */ "table_name", - /* 245 */ "column_def", - /* 246 */ "func_name_list", - /* 247 */ "alter_table_option", - /* 248 */ "col_name", - /* 249 */ "db_name_cond_opt", - /* 250 */ "like_pattern_opt", - /* 251 */ "table_name_cond", - /* 252 */ "from_db_opt", - /* 253 */ "func_name", - /* 254 */ "function_name", - /* 255 */ "index_name", - /* 256 */ "index_options", - /* 257 */ "func_list", - /* 258 */ "duration_literal", - /* 259 */ "sliding_opt", - /* 260 */ "func", - /* 261 */ "expression_list", - /* 262 */ "topic_name", - /* 263 */ "query_expression", - /* 264 */ "analyze_opt", - /* 265 */ "explain_options", - /* 266 */ "agg_func_opt", - /* 267 */ "bufsize_opt", - /* 268 */ "stream_name", - /* 269 */ "dnode_list", - /* 270 */ "signed", - /* 271 */ "signed_literal", - /* 272 */ "table_alias", - /* 273 */ "column_alias", - /* 274 */ "expression", - /* 275 */ "pseudo_column", - /* 276 */ "column_reference", - /* 277 */ "subquery", - /* 278 */ "predicate", - /* 279 */ "compare_op", - /* 280 */ "in_op", - /* 281 */ "in_predicate_value", - /* 282 */ "boolean_value_expression", - /* 283 */ "boolean_primary", - /* 284 */ "common_expression", - /* 285 */ "from_clause", - /* 286 */ "table_reference_list", - /* 287 */ "table_reference", - /* 288 */ "table_primary", - /* 289 */ "joined_table", - /* 290 */ "alias_opt", - /* 291 */ "parenthesized_joined_table", - /* 292 */ "join_type", - /* 293 */ "search_condition", - /* 294 */ "query_specification", - /* 295 */ "set_quantifier_opt", - /* 296 */ "select_list", - /* 297 */ "where_clause_opt", - /* 298 */ "partition_by_clause_opt", - /* 299 */ "twindow_clause_opt", - /* 300 */ "group_by_clause_opt", - /* 301 */ "having_clause_opt", - /* 302 */ "select_sublist", - /* 303 */ "select_item", - /* 304 */ "fill_opt", - /* 305 */ "fill_mode", - /* 306 */ "group_by_list", - /* 307 */ "query_expression_body", - /* 308 */ "order_by_clause_opt", - /* 309 */ "slimit_clause_opt", - /* 310 */ "limit_clause_opt", - /* 311 */ "query_primary", - /* 312 */ "sort_specification_list", - /* 313 */ "sort_specification", - /* 314 */ "ordering_specification_opt", - /* 315 */ "null_ordering_opt", + /* 156 */ "TRIGGER", + /* 157 */ "AT_ONCE", + /* 158 */ "WINDOW_CLOSE", + /* 159 */ "WATERMARK", + /* 160 */ "KILL", + /* 161 */ "CONNECTION", + /* 162 */ "MERGE", + /* 163 */ "VGROUP", + /* 164 */ "REDISTRIBUTE", + /* 165 */ "SPLIT", + /* 166 */ "SYNCDB", + /* 167 */ "NULL", + /* 168 */ "NK_QUESTION", + /* 169 */ "NK_ARROW", + /* 170 */ "NOW", + /* 171 */ "TODAY", + /* 172 */ "ROWTS", + /* 173 */ "TBNAME", + /* 174 */ "QSTARTTS", + /* 175 */ "QENDTS", + /* 176 */ "WSTARTTS", + /* 177 */ "WENDTS", + /* 178 */ "WDURATION", + /* 179 */ "CAST", + /* 180 */ "COUNT", + /* 181 */ "FIRST", + /* 182 */ "LAST", + /* 183 */ "LAST_ROW", + /* 184 */ "BETWEEN", + /* 185 */ "IS", + /* 186 */ "NK_LT", + /* 187 */ "NK_GT", + /* 188 */ "NK_LE", + /* 189 */ "NK_GE", + /* 190 */ "NK_NE", + /* 191 */ "MATCH", + /* 192 */ "NMATCH", + /* 193 */ "CONTAINS", + /* 194 */ "JOIN", + /* 195 */ "INNER", + /* 196 */ "SELECT", + /* 197 */ "DISTINCT", + /* 198 */ "WHERE", + /* 199 */ "PARTITION", + /* 200 */ "BY", + /* 201 */ "SESSION", + /* 202 */ "STATE_WINDOW", + /* 203 */ "SLIDING", + /* 204 */ "FILL", + /* 205 */ "VALUE", + /* 206 */ "NONE", + /* 207 */ "PREV", + /* 208 */ "LINEAR", + /* 209 */ "NEXT", + /* 210 */ "GROUP", + /* 211 */ "HAVING", + /* 212 */ "ORDER", + /* 213 */ "SLIMIT", + /* 214 */ "SOFFSET", + /* 215 */ "LIMIT", + /* 216 */ "OFFSET", + /* 217 */ "ASC", + /* 218 */ "NULLS", + /* 219 */ "cmd", + /* 220 */ "account_options", + /* 221 */ "alter_account_options", + /* 222 */ "literal", + /* 223 */ "alter_account_option", + /* 224 */ "user_name", + /* 225 */ "dnode_endpoint", + /* 226 */ "dnode_host_name", + /* 227 */ "not_exists_opt", + /* 228 */ "db_name", + /* 229 */ "db_options", + /* 230 */ "exists_opt", + /* 231 */ "alter_db_options", + /* 232 */ "integer_list", + /* 233 */ "variable_list", + /* 234 */ "retention_list", + /* 235 */ "alter_db_option", + /* 236 */ "retention", + /* 237 */ "full_table_name", + /* 238 */ "column_def_list", + /* 239 */ "tags_def_opt", + /* 240 */ "table_options", + /* 241 */ "multi_create_clause", + /* 242 */ "tags_def", + /* 243 */ "multi_drop_clause", + /* 244 */ "alter_table_clause", + /* 245 */ "alter_table_options", + /* 246 */ "column_name", + /* 247 */ "type_name", + /* 248 */ "create_subtable_clause", + /* 249 */ "specific_tags_opt", + /* 250 */ "literal_list", + /* 251 */ "drop_table_clause", + /* 252 */ "col_name_list", + /* 253 */ "table_name", + /* 254 */ "column_def", + /* 255 */ "func_name_list", + /* 256 */ "alter_table_option", + /* 257 */ "col_name", + /* 258 */ "db_name_cond_opt", + /* 259 */ "like_pattern_opt", + /* 260 */ "table_name_cond", + /* 261 */ "from_db_opt", + /* 262 */ "func_name", + /* 263 */ "function_name", + /* 264 */ "index_name", + /* 265 */ "index_options", + /* 266 */ "func_list", + /* 267 */ "duration_literal", + /* 268 */ "sliding_opt", + /* 269 */ "func", + /* 270 */ "expression_list", + /* 271 */ "topic_name", + /* 272 */ "query_expression", + /* 273 */ "analyze_opt", + /* 274 */ "explain_options", + /* 275 */ "agg_func_opt", + /* 276 */ "bufsize_opt", + /* 277 */ "stream_name", + /* 278 */ "stream_options", + /* 279 */ "into_opt", + /* 280 */ "dnode_list", + /* 281 */ "signed", + /* 282 */ "signed_literal", + /* 283 */ "table_alias", + /* 284 */ "column_alias", + /* 285 */ "expression", + /* 286 */ "pseudo_column", + /* 287 */ "column_reference", + /* 288 */ "function_expression", + /* 289 */ "subquery", + /* 290 */ "star_func", + /* 291 */ "star_func_para_list", + /* 292 */ "other_para_list", + /* 293 */ "star_func_para", + /* 294 */ "predicate", + /* 295 */ "compare_op", + /* 296 */ "in_op", + /* 297 */ "in_predicate_value", + /* 298 */ "boolean_value_expression", + /* 299 */ "boolean_primary", + /* 300 */ "common_expression", + /* 301 */ "from_clause", + /* 302 */ "table_reference_list", + /* 303 */ "table_reference", + /* 304 */ "table_primary", + /* 305 */ "joined_table", + /* 306 */ "alias_opt", + /* 307 */ "parenthesized_joined_table", + /* 308 */ "join_type", + /* 309 */ "search_condition", + /* 310 */ "query_specification", + /* 311 */ "set_quantifier_opt", + /* 312 */ "select_list", + /* 313 */ "where_clause_opt", + /* 314 */ "partition_by_clause_opt", + /* 315 */ "twindow_clause_opt", + /* 316 */ "group_by_clause_opt", + /* 317 */ "having_clause_opt", + /* 318 */ "select_sublist", + /* 319 */ "select_item", + /* 320 */ "fill_opt", + /* 321 */ "fill_mode", + /* 322 */ "group_by_list", + /* 323 */ "query_expression_body", + /* 324 */ "order_by_clause_opt", + /* 325 */ "slimit_clause_opt", + /* 326 */ "limit_clause_opt", + /* 327 */ "query_primary", + /* 328 */ "sort_specification_list", + /* 329 */ "sort_specification", + /* 330 */ "ordering_specification_opt", + /* 331 */ "null_ordering_opt", }; #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ @@ -1274,262 +1344,282 @@ static const char *const yyRuleName[] = { /* 152 */ "table_options ::=", /* 153 */ "table_options ::= table_options COMMENT NK_STRING", /* 154 */ "table_options ::= table_options KEEP integer_list", - /* 155 */ "table_options ::= table_options TTL NK_INTEGER", - /* 156 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP", - /* 157 */ "table_options ::= table_options ROLLUP NK_LP func_name_list NK_RP", - /* 158 */ "table_options ::= table_options FILE_FACTOR NK_FLOAT", - /* 159 */ "table_options ::= table_options DELAY NK_INTEGER", - /* 160 */ "alter_table_options ::= alter_table_option", - /* 161 */ "alter_table_options ::= alter_table_options alter_table_option", - /* 162 */ "alter_table_option ::= COMMENT NK_STRING", - /* 163 */ "alter_table_option ::= KEEP integer_list", - /* 164 */ "alter_table_option ::= TTL NK_INTEGER", - /* 165 */ "col_name_list ::= col_name", - /* 166 */ "col_name_list ::= col_name_list NK_COMMA col_name", - /* 167 */ "col_name ::= column_name", - /* 168 */ "cmd ::= SHOW DNODES", - /* 169 */ "cmd ::= SHOW USERS", - /* 170 */ "cmd ::= SHOW DATABASES", - /* 171 */ "cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt", - /* 172 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt", - /* 173 */ "cmd ::= SHOW db_name_cond_opt VGROUPS", - /* 174 */ "cmd ::= SHOW MNODES", - /* 175 */ "cmd ::= SHOW MODULES", - /* 176 */ "cmd ::= SHOW QNODES", - /* 177 */ "cmd ::= SHOW FUNCTIONS", - /* 178 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt", - /* 179 */ "cmd ::= SHOW STREAMS", - /* 180 */ "cmd ::= SHOW ACCOUNTS", - /* 181 */ "cmd ::= SHOW APPS", - /* 182 */ "cmd ::= SHOW CONNECTIONS", - /* 183 */ "cmd ::= SHOW LICENCE", - /* 184 */ "cmd ::= SHOW GRANTS", - /* 185 */ "cmd ::= SHOW CREATE DATABASE db_name", - /* 186 */ "cmd ::= SHOW CREATE TABLE full_table_name", - /* 187 */ "cmd ::= SHOW CREATE STABLE full_table_name", - /* 188 */ "cmd ::= SHOW QUERIES", - /* 189 */ "cmd ::= SHOW SCORES", - /* 190 */ "cmd ::= SHOW TOPICS", - /* 191 */ "cmd ::= SHOW VARIABLES", - /* 192 */ "cmd ::= SHOW BNODES", - /* 193 */ "cmd ::= SHOW SNODES", - /* 194 */ "db_name_cond_opt ::=", - /* 195 */ "db_name_cond_opt ::= db_name NK_DOT", - /* 196 */ "like_pattern_opt ::=", - /* 197 */ "like_pattern_opt ::= LIKE NK_STRING", - /* 198 */ "table_name_cond ::= table_name", - /* 199 */ "from_db_opt ::=", - /* 200 */ "from_db_opt ::= FROM db_name", - /* 201 */ "func_name_list ::= func_name", - /* 202 */ "func_name_list ::= func_name_list NK_COMMA col_name", - /* 203 */ "func_name ::= function_name", - /* 204 */ "cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options", - /* 205 */ "cmd ::= CREATE FULLTEXT INDEX not_exists_opt index_name ON table_name NK_LP col_name_list NK_RP", - /* 206 */ "cmd ::= DROP INDEX exists_opt index_name ON table_name", - /* 207 */ "index_options ::=", - /* 208 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt", - /* 209 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt", - /* 210 */ "func_list ::= func", - /* 211 */ "func_list ::= func_list NK_COMMA func", - /* 212 */ "func ::= function_name NK_LP expression_list NK_RP", - /* 213 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression", - /* 214 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS db_name", - /* 215 */ "cmd ::= DROP TOPIC exists_opt topic_name", - /* 216 */ "cmd ::= DESC full_table_name", - /* 217 */ "cmd ::= DESCRIBE full_table_name", - /* 218 */ "cmd ::= RESET QUERY CACHE", - /* 219 */ "cmd ::= EXPLAIN analyze_opt explain_options query_expression", - /* 220 */ "analyze_opt ::=", - /* 221 */ "analyze_opt ::= ANALYZE", - /* 222 */ "explain_options ::=", - /* 223 */ "explain_options ::= explain_options VERBOSE NK_BOOL", - /* 224 */ "explain_options ::= explain_options RATIO NK_FLOAT", - /* 225 */ "cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP", - /* 226 */ "cmd ::= CREATE agg_func_opt FUNCTION function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt", - /* 227 */ "cmd ::= DROP FUNCTION function_name", - /* 228 */ "agg_func_opt ::=", - /* 229 */ "agg_func_opt ::= AGGREGATE", - /* 230 */ "bufsize_opt ::=", - /* 231 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", - /* 232 */ "cmd ::= CREATE STREAM stream_name INTO table_name AS query_expression", - /* 233 */ "cmd ::= DROP STREAM stream_name", - /* 234 */ "cmd ::= KILL CONNECTION NK_INTEGER", - /* 235 */ "cmd ::= KILL QUERY NK_INTEGER", - /* 236 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", - /* 237 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", - /* 238 */ "cmd ::= SPLIT VGROUP NK_INTEGER", - /* 239 */ "dnode_list ::= DNODE NK_INTEGER", - /* 240 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", - /* 241 */ "cmd ::= SYNCDB db_name REPLICA", - /* 242 */ "cmd ::= query_expression", - /* 243 */ "literal ::= NK_INTEGER", - /* 244 */ "literal ::= NK_FLOAT", - /* 245 */ "literal ::= NK_STRING", - /* 246 */ "literal ::= NK_BOOL", - /* 247 */ "literal ::= TIMESTAMP NK_STRING", - /* 248 */ "literal ::= duration_literal", - /* 249 */ "literal ::= NULL", - /* 250 */ "duration_literal ::= NK_VARIABLE", - /* 251 */ "signed ::= NK_INTEGER", - /* 252 */ "signed ::= NK_PLUS NK_INTEGER", - /* 253 */ "signed ::= NK_MINUS NK_INTEGER", - /* 254 */ "signed ::= NK_FLOAT", - /* 255 */ "signed ::= NK_PLUS NK_FLOAT", - /* 256 */ "signed ::= NK_MINUS NK_FLOAT", - /* 257 */ "signed_literal ::= signed", - /* 258 */ "signed_literal ::= NK_STRING", - /* 259 */ "signed_literal ::= NK_BOOL", - /* 260 */ "signed_literal ::= TIMESTAMP NK_STRING", - /* 261 */ "signed_literal ::= duration_literal", - /* 262 */ "signed_literal ::= NULL", - /* 263 */ "literal_list ::= signed_literal", - /* 264 */ "literal_list ::= literal_list NK_COMMA signed_literal", - /* 265 */ "db_name ::= NK_ID", - /* 266 */ "table_name ::= NK_ID", - /* 267 */ "column_name ::= NK_ID", - /* 268 */ "function_name ::= NK_ID", - /* 269 */ "function_name ::= FIRST", - /* 270 */ "function_name ::= LAST", - /* 271 */ "table_alias ::= NK_ID", - /* 272 */ "column_alias ::= NK_ID", - /* 273 */ "user_name ::= NK_ID", - /* 274 */ "index_name ::= NK_ID", - /* 275 */ "topic_name ::= NK_ID", - /* 276 */ "stream_name ::= NK_ID", - /* 277 */ "expression ::= literal", - /* 278 */ "expression ::= pseudo_column", - /* 279 */ "expression ::= column_reference", - /* 280 */ "expression ::= function_name NK_LP expression_list NK_RP", - /* 281 */ "expression ::= function_name NK_LP NK_STAR NK_RP", - /* 282 */ "expression ::= CAST NK_LP expression AS type_name NK_RP", - /* 283 */ "expression ::= subquery", - /* 284 */ "expression ::= NK_LP expression NK_RP", - /* 285 */ "expression ::= NK_PLUS expression", - /* 286 */ "expression ::= NK_MINUS expression", - /* 287 */ "expression ::= expression NK_PLUS expression", - /* 288 */ "expression ::= expression NK_MINUS expression", - /* 289 */ "expression ::= expression NK_STAR expression", - /* 290 */ "expression ::= expression NK_SLASH expression", - /* 291 */ "expression ::= expression NK_REM expression", - /* 292 */ "expression_list ::= expression", - /* 293 */ "expression_list ::= expression_list NK_COMMA expression", - /* 294 */ "column_reference ::= column_name", - /* 295 */ "column_reference ::= table_name NK_DOT column_name", - /* 296 */ "pseudo_column ::= NOW", - /* 297 */ "pseudo_column ::= TODAY", - /* 298 */ "pseudo_column ::= ROWTS", - /* 299 */ "pseudo_column ::= TBNAME", - /* 300 */ "pseudo_column ::= QSTARTTS", - /* 301 */ "pseudo_column ::= QENDTS", - /* 302 */ "pseudo_column ::= WSTARTTS", - /* 303 */ "pseudo_column ::= WENDTS", - /* 304 */ "pseudo_column ::= WDURATION", - /* 305 */ "predicate ::= expression compare_op expression", - /* 306 */ "predicate ::= expression BETWEEN expression AND expression", - /* 307 */ "predicate ::= expression NOT BETWEEN expression AND expression", - /* 308 */ "predicate ::= expression IS NULL", - /* 309 */ "predicate ::= expression IS NOT NULL", - /* 310 */ "predicate ::= expression in_op in_predicate_value", - /* 311 */ "compare_op ::= NK_LT", - /* 312 */ "compare_op ::= NK_GT", - /* 313 */ "compare_op ::= NK_LE", - /* 314 */ "compare_op ::= NK_GE", - /* 315 */ "compare_op ::= NK_NE", - /* 316 */ "compare_op ::= NK_EQ", - /* 317 */ "compare_op ::= LIKE", - /* 318 */ "compare_op ::= NOT LIKE", - /* 319 */ "compare_op ::= MATCH", - /* 320 */ "compare_op ::= NMATCH", - /* 321 */ "in_op ::= IN", - /* 322 */ "in_op ::= NOT IN", - /* 323 */ "in_predicate_value ::= NK_LP expression_list NK_RP", - /* 324 */ "boolean_value_expression ::= boolean_primary", - /* 325 */ "boolean_value_expression ::= NOT boolean_primary", - /* 326 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", - /* 327 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", - /* 328 */ "boolean_primary ::= predicate", - /* 329 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", - /* 330 */ "common_expression ::= expression", - /* 331 */ "common_expression ::= boolean_value_expression", - /* 332 */ "from_clause ::= FROM table_reference_list", - /* 333 */ "table_reference_list ::= table_reference", - /* 334 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", - /* 335 */ "table_reference ::= table_primary", - /* 336 */ "table_reference ::= joined_table", - /* 337 */ "table_primary ::= table_name alias_opt", - /* 338 */ "table_primary ::= db_name NK_DOT table_name alias_opt", - /* 339 */ "table_primary ::= subquery alias_opt", - /* 340 */ "table_primary ::= parenthesized_joined_table", - /* 341 */ "alias_opt ::=", - /* 342 */ "alias_opt ::= table_alias", - /* 343 */ "alias_opt ::= AS table_alias", - /* 344 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", - /* 345 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", - /* 346 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", - /* 347 */ "join_type ::=", - /* 348 */ "join_type ::= INNER", - /* 349 */ "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", - /* 350 */ "set_quantifier_opt ::=", - /* 351 */ "set_quantifier_opt ::= DISTINCT", - /* 352 */ "set_quantifier_opt ::= ALL", - /* 353 */ "select_list ::= NK_STAR", - /* 354 */ "select_list ::= select_sublist", - /* 355 */ "select_sublist ::= select_item", - /* 356 */ "select_sublist ::= select_sublist NK_COMMA select_item", - /* 357 */ "select_item ::= common_expression", - /* 358 */ "select_item ::= common_expression column_alias", - /* 359 */ "select_item ::= common_expression AS column_alias", - /* 360 */ "select_item ::= table_name NK_DOT NK_STAR", - /* 361 */ "where_clause_opt ::=", - /* 362 */ "where_clause_opt ::= WHERE search_condition", - /* 363 */ "partition_by_clause_opt ::=", - /* 364 */ "partition_by_clause_opt ::= PARTITION BY expression_list", - /* 365 */ "twindow_clause_opt ::=", - /* 366 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", - /* 367 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP", - /* 368 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", - /* 369 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", - /* 370 */ "sliding_opt ::=", - /* 371 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", - /* 372 */ "fill_opt ::=", - /* 373 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", - /* 374 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", - /* 375 */ "fill_mode ::= NONE", - /* 376 */ "fill_mode ::= PREV", - /* 377 */ "fill_mode ::= NULL", - /* 378 */ "fill_mode ::= LINEAR", - /* 379 */ "fill_mode ::= NEXT", - /* 380 */ "group_by_clause_opt ::=", - /* 381 */ "group_by_clause_opt ::= GROUP BY group_by_list", - /* 382 */ "group_by_list ::= expression", - /* 383 */ "group_by_list ::= group_by_list NK_COMMA expression", - /* 384 */ "having_clause_opt ::=", - /* 385 */ "having_clause_opt ::= HAVING search_condition", - /* 386 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt", - /* 387 */ "query_expression_body ::= query_primary", - /* 388 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body", - /* 389 */ "query_primary ::= query_specification", - /* 390 */ "order_by_clause_opt ::=", - /* 391 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", - /* 392 */ "slimit_clause_opt ::=", - /* 393 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", - /* 394 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", - /* 395 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 396 */ "limit_clause_opt ::=", - /* 397 */ "limit_clause_opt ::= LIMIT NK_INTEGER", - /* 398 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", - /* 399 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 400 */ "subquery ::= NK_LP query_expression NK_RP", - /* 401 */ "search_condition ::= common_expression", - /* 402 */ "sort_specification_list ::= sort_specification", - /* 403 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", - /* 404 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt", - /* 405 */ "ordering_specification_opt ::=", - /* 406 */ "ordering_specification_opt ::= ASC", - /* 407 */ "ordering_specification_opt ::= DESC", - /* 408 */ "null_ordering_opt ::=", - /* 409 */ "null_ordering_opt ::= NULLS FIRST", - /* 410 */ "null_ordering_opt ::= NULLS LAST", + /* 155 */ "table_options ::= table_options KEEP variable_list", + /* 156 */ "table_options ::= table_options TTL NK_INTEGER", + /* 157 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP", + /* 158 */ "table_options ::= table_options ROLLUP NK_LP func_name_list NK_RP", + /* 159 */ "table_options ::= table_options FILE_FACTOR NK_FLOAT", + /* 160 */ "table_options ::= table_options DELAY NK_INTEGER", + /* 161 */ "alter_table_options ::= alter_table_option", + /* 162 */ "alter_table_options ::= alter_table_options alter_table_option", + /* 163 */ "alter_table_option ::= COMMENT NK_STRING", + /* 164 */ "alter_table_option ::= KEEP integer_list", + /* 165 */ "alter_table_option ::= KEEP variable_list", + /* 166 */ "alter_table_option ::= TTL NK_INTEGER", + /* 167 */ "col_name_list ::= col_name", + /* 168 */ "col_name_list ::= col_name_list NK_COMMA col_name", + /* 169 */ "col_name ::= column_name", + /* 170 */ "cmd ::= SHOW DNODES", + /* 171 */ "cmd ::= SHOW USERS", + /* 172 */ "cmd ::= SHOW DATABASES", + /* 173 */ "cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt", + /* 174 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt", + /* 175 */ "cmd ::= SHOW db_name_cond_opt VGROUPS", + /* 176 */ "cmd ::= SHOW MNODES", + /* 177 */ "cmd ::= SHOW MODULES", + /* 178 */ "cmd ::= SHOW QNODES", + /* 179 */ "cmd ::= SHOW FUNCTIONS", + /* 180 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt", + /* 181 */ "cmd ::= SHOW STREAMS", + /* 182 */ "cmd ::= SHOW ACCOUNTS", + /* 183 */ "cmd ::= SHOW APPS", + /* 184 */ "cmd ::= SHOW CONNECTIONS", + /* 185 */ "cmd ::= SHOW LICENCE", + /* 186 */ "cmd ::= SHOW GRANTS", + /* 187 */ "cmd ::= SHOW CREATE DATABASE db_name", + /* 188 */ "cmd ::= SHOW CREATE TABLE full_table_name", + /* 189 */ "cmd ::= SHOW CREATE STABLE full_table_name", + /* 190 */ "cmd ::= SHOW QUERIES", + /* 191 */ "cmd ::= SHOW SCORES", + /* 192 */ "cmd ::= SHOW TOPICS", + /* 193 */ "cmd ::= SHOW VARIABLES", + /* 194 */ "cmd ::= SHOW BNODES", + /* 195 */ "cmd ::= SHOW SNODES", + /* 196 */ "db_name_cond_opt ::=", + /* 197 */ "db_name_cond_opt ::= db_name NK_DOT", + /* 198 */ "like_pattern_opt ::=", + /* 199 */ "like_pattern_opt ::= LIKE NK_STRING", + /* 200 */ "table_name_cond ::= table_name", + /* 201 */ "from_db_opt ::=", + /* 202 */ "from_db_opt ::= FROM db_name", + /* 203 */ "func_name_list ::= func_name", + /* 204 */ "func_name_list ::= func_name_list NK_COMMA col_name", + /* 205 */ "func_name ::= function_name", + /* 206 */ "cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options", + /* 207 */ "cmd ::= CREATE FULLTEXT INDEX not_exists_opt index_name ON table_name NK_LP col_name_list NK_RP", + /* 208 */ "cmd ::= DROP INDEX exists_opt index_name ON table_name", + /* 209 */ "index_options ::=", + /* 210 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt", + /* 211 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt", + /* 212 */ "func_list ::= func", + /* 213 */ "func_list ::= func_list NK_COMMA func", + /* 214 */ "func ::= function_name NK_LP expression_list NK_RP", + /* 215 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression", + /* 216 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS db_name", + /* 217 */ "cmd ::= DROP TOPIC exists_opt topic_name", + /* 218 */ "cmd ::= DESC full_table_name", + /* 219 */ "cmd ::= DESCRIBE full_table_name", + /* 220 */ "cmd ::= RESET QUERY CACHE", + /* 221 */ "cmd ::= EXPLAIN analyze_opt explain_options query_expression", + /* 222 */ "analyze_opt ::=", + /* 223 */ "analyze_opt ::= ANALYZE", + /* 224 */ "explain_options ::=", + /* 225 */ "explain_options ::= explain_options VERBOSE NK_BOOL", + /* 226 */ "explain_options ::= explain_options RATIO NK_FLOAT", + /* 227 */ "cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP", + /* 228 */ "cmd ::= CREATE agg_func_opt FUNCTION function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt", + /* 229 */ "cmd ::= DROP FUNCTION function_name", + /* 230 */ "agg_func_opt ::=", + /* 231 */ "agg_func_opt ::= AGGREGATE", + /* 232 */ "bufsize_opt ::=", + /* 233 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", + /* 234 */ "cmd ::= CREATE STREAM not_exists_opt stream_name stream_options into_opt AS query_expression", + /* 235 */ "cmd ::= DROP STREAM exists_opt stream_name", + /* 236 */ "into_opt ::=", + /* 237 */ "into_opt ::= INTO full_table_name", + /* 238 */ "stream_options ::=", + /* 239 */ "stream_options ::= stream_options TRIGGER AT_ONCE", + /* 240 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", + /* 241 */ "stream_options ::= stream_options WATERMARK duration_literal", + /* 242 */ "cmd ::= KILL CONNECTION NK_INTEGER", + /* 243 */ "cmd ::= KILL QUERY NK_INTEGER", + /* 244 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", + /* 245 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", + /* 246 */ "cmd ::= SPLIT VGROUP NK_INTEGER", + /* 247 */ "dnode_list ::= DNODE NK_INTEGER", + /* 248 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", + /* 249 */ "cmd ::= SYNCDB db_name REPLICA", + /* 250 */ "cmd ::= query_expression", + /* 251 */ "literal ::= NK_INTEGER", + /* 252 */ "literal ::= NK_FLOAT", + /* 253 */ "literal ::= NK_STRING", + /* 254 */ "literal ::= NK_BOOL", + /* 255 */ "literal ::= TIMESTAMP NK_STRING", + /* 256 */ "literal ::= duration_literal", + /* 257 */ "literal ::= NULL", + /* 258 */ "literal ::= NK_QUESTION", + /* 259 */ "duration_literal ::= NK_VARIABLE", + /* 260 */ "signed ::= NK_INTEGER", + /* 261 */ "signed ::= NK_PLUS NK_INTEGER", + /* 262 */ "signed ::= NK_MINUS NK_INTEGER", + /* 263 */ "signed ::= NK_FLOAT", + /* 264 */ "signed ::= NK_PLUS NK_FLOAT", + /* 265 */ "signed ::= NK_MINUS NK_FLOAT", + /* 266 */ "signed_literal ::= signed", + /* 267 */ "signed_literal ::= NK_STRING", + /* 268 */ "signed_literal ::= NK_BOOL", + /* 269 */ "signed_literal ::= TIMESTAMP NK_STRING", + /* 270 */ "signed_literal ::= duration_literal", + /* 271 */ "signed_literal ::= NULL", + /* 272 */ "literal_list ::= signed_literal", + /* 273 */ "literal_list ::= literal_list NK_COMMA signed_literal", + /* 274 */ "db_name ::= NK_ID", + /* 275 */ "table_name ::= NK_ID", + /* 276 */ "column_name ::= NK_ID", + /* 277 */ "function_name ::= NK_ID", + /* 278 */ "table_alias ::= NK_ID", + /* 279 */ "column_alias ::= NK_ID", + /* 280 */ "user_name ::= NK_ID", + /* 281 */ "index_name ::= NK_ID", + /* 282 */ "topic_name ::= NK_ID", + /* 283 */ "stream_name ::= NK_ID", + /* 284 */ "expression ::= literal", + /* 285 */ "expression ::= pseudo_column", + /* 286 */ "expression ::= column_reference", + /* 287 */ "expression ::= function_expression", + /* 288 */ "expression ::= subquery", + /* 289 */ "expression ::= NK_LP expression NK_RP", + /* 290 */ "expression ::= NK_PLUS expression", + /* 291 */ "expression ::= NK_MINUS expression", + /* 292 */ "expression ::= expression NK_PLUS expression", + /* 293 */ "expression ::= expression NK_MINUS expression", + /* 294 */ "expression ::= expression NK_STAR expression", + /* 295 */ "expression ::= expression NK_SLASH expression", + /* 296 */ "expression ::= expression NK_REM expression", + /* 297 */ "expression ::= column_reference NK_ARROW NK_STRING", + /* 298 */ "expression_list ::= expression", + /* 299 */ "expression_list ::= expression_list NK_COMMA expression", + /* 300 */ "column_reference ::= column_name", + /* 301 */ "column_reference ::= table_name NK_DOT column_name", + /* 302 */ "pseudo_column ::= NOW", + /* 303 */ "pseudo_column ::= TODAY", + /* 304 */ "pseudo_column ::= ROWTS", + /* 305 */ "pseudo_column ::= TBNAME", + /* 306 */ "pseudo_column ::= QSTARTTS", + /* 307 */ "pseudo_column ::= QENDTS", + /* 308 */ "pseudo_column ::= WSTARTTS", + /* 309 */ "pseudo_column ::= WENDTS", + /* 310 */ "pseudo_column ::= WDURATION", + /* 311 */ "function_expression ::= function_name NK_LP expression_list NK_RP", + /* 312 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", + /* 313 */ "function_expression ::= CAST NK_LP expression AS type_name NK_RP", + /* 314 */ "star_func ::= COUNT", + /* 315 */ "star_func ::= FIRST", + /* 316 */ "star_func ::= LAST", + /* 317 */ "star_func ::= LAST_ROW", + /* 318 */ "star_func_para_list ::= NK_STAR", + /* 319 */ "star_func_para_list ::= other_para_list", + /* 320 */ "other_para_list ::= star_func_para", + /* 321 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", + /* 322 */ "star_func_para ::= expression", + /* 323 */ "star_func_para ::= table_name NK_DOT NK_STAR", + /* 324 */ "predicate ::= expression compare_op expression", + /* 325 */ "predicate ::= expression BETWEEN expression AND expression", + /* 326 */ "predicate ::= expression NOT BETWEEN expression AND expression", + /* 327 */ "predicate ::= expression IS NULL", + /* 328 */ "predicate ::= expression IS NOT NULL", + /* 329 */ "predicate ::= expression in_op in_predicate_value", + /* 330 */ "compare_op ::= NK_LT", + /* 331 */ "compare_op ::= NK_GT", + /* 332 */ "compare_op ::= NK_LE", + /* 333 */ "compare_op ::= NK_GE", + /* 334 */ "compare_op ::= NK_NE", + /* 335 */ "compare_op ::= NK_EQ", + /* 336 */ "compare_op ::= LIKE", + /* 337 */ "compare_op ::= NOT LIKE", + /* 338 */ "compare_op ::= MATCH", + /* 339 */ "compare_op ::= NMATCH", + /* 340 */ "compare_op ::= CONTAINS", + /* 341 */ "in_op ::= IN", + /* 342 */ "in_op ::= NOT IN", + /* 343 */ "in_predicate_value ::= NK_LP expression_list NK_RP", + /* 344 */ "boolean_value_expression ::= boolean_primary", + /* 345 */ "boolean_value_expression ::= NOT boolean_primary", + /* 346 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", + /* 347 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", + /* 348 */ "boolean_primary ::= predicate", + /* 349 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", + /* 350 */ "common_expression ::= expression", + /* 351 */ "common_expression ::= boolean_value_expression", + /* 352 */ "from_clause ::= FROM table_reference_list", + /* 353 */ "table_reference_list ::= table_reference", + /* 354 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", + /* 355 */ "table_reference ::= table_primary", + /* 356 */ "table_reference ::= joined_table", + /* 357 */ "table_primary ::= table_name alias_opt", + /* 358 */ "table_primary ::= db_name NK_DOT table_name alias_opt", + /* 359 */ "table_primary ::= subquery alias_opt", + /* 360 */ "table_primary ::= parenthesized_joined_table", + /* 361 */ "alias_opt ::=", + /* 362 */ "alias_opt ::= table_alias", + /* 363 */ "alias_opt ::= AS table_alias", + /* 364 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", + /* 365 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", + /* 366 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", + /* 367 */ "join_type ::=", + /* 368 */ "join_type ::= INNER", + /* 369 */ "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", + /* 370 */ "set_quantifier_opt ::=", + /* 371 */ "set_quantifier_opt ::= DISTINCT", + /* 372 */ "set_quantifier_opt ::= ALL", + /* 373 */ "select_list ::= NK_STAR", + /* 374 */ "select_list ::= select_sublist", + /* 375 */ "select_sublist ::= select_item", + /* 376 */ "select_sublist ::= select_sublist NK_COMMA select_item", + /* 377 */ "select_item ::= common_expression", + /* 378 */ "select_item ::= common_expression column_alias", + /* 379 */ "select_item ::= common_expression AS column_alias", + /* 380 */ "select_item ::= table_name NK_DOT NK_STAR", + /* 381 */ "where_clause_opt ::=", + /* 382 */ "where_clause_opt ::= WHERE search_condition", + /* 383 */ "partition_by_clause_opt ::=", + /* 384 */ "partition_by_clause_opt ::= PARTITION BY expression_list", + /* 385 */ "twindow_clause_opt ::=", + /* 386 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", + /* 387 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP", + /* 388 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", + /* 389 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", + /* 390 */ "sliding_opt ::=", + /* 391 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", + /* 392 */ "fill_opt ::=", + /* 393 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", + /* 394 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", + /* 395 */ "fill_mode ::= NONE", + /* 396 */ "fill_mode ::= PREV", + /* 397 */ "fill_mode ::= NULL", + /* 398 */ "fill_mode ::= LINEAR", + /* 399 */ "fill_mode ::= NEXT", + /* 400 */ "group_by_clause_opt ::=", + /* 401 */ "group_by_clause_opt ::= GROUP BY group_by_list", + /* 402 */ "group_by_list ::= expression", + /* 403 */ "group_by_list ::= group_by_list NK_COMMA expression", + /* 404 */ "having_clause_opt ::=", + /* 405 */ "having_clause_opt ::= HAVING search_condition", + /* 406 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt", + /* 407 */ "query_expression_body ::= query_primary", + /* 408 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body", + /* 409 */ "query_primary ::= query_specification", + /* 410 */ "order_by_clause_opt ::=", + /* 411 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", + /* 412 */ "slimit_clause_opt ::=", + /* 413 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", + /* 414 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", + /* 415 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 416 */ "limit_clause_opt ::=", + /* 417 */ "limit_clause_opt ::= LIMIT NK_INTEGER", + /* 418 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", + /* 419 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 420 */ "subquery ::= NK_LP query_expression NK_RP", + /* 421 */ "search_condition ::= common_expression", + /* 422 */ "sort_specification_list ::= sort_specification", + /* 423 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", + /* 424 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt", + /* 425 */ "ordering_specification_opt ::=", + /* 426 */ "ordering_specification_opt ::= ASC", + /* 427 */ "ordering_specification_opt ::= DESC", + /* 428 */ "null_ordering_opt ::=", + /* 429 */ "null_ordering_opt ::= NULLS FIRST", + /* 430 */ "null_ordering_opt ::= NULLS LAST", }; #endif /* NDEBUG */ @@ -1656,156 +1746,163 @@ static void yy_destructor( */ /********* Begin destructor definitions ***************************************/ /* Default NON-TERMINAL Destructor */ - case 210: /* cmd */ - case 213: /* literal */ - case 220: /* db_options */ - case 222: /* alter_db_options */ - case 227: /* retention */ - case 228: /* full_table_name */ - case 231: /* table_options */ - case 235: /* alter_table_clause */ - case 236: /* alter_table_options */ - case 239: /* create_subtable_clause */ - case 242: /* drop_table_clause */ - case 245: /* column_def */ - case 248: /* col_name */ - case 249: /* db_name_cond_opt */ - case 250: /* like_pattern_opt */ - case 251: /* table_name_cond */ - case 252: /* from_db_opt */ - case 253: /* func_name */ - case 256: /* index_options */ - case 258: /* duration_literal */ - case 259: /* sliding_opt */ - case 260: /* func */ - case 263: /* query_expression */ - case 265: /* explain_options */ - case 270: /* signed */ - case 271: /* signed_literal */ - case 274: /* expression */ - case 275: /* pseudo_column */ - case 276: /* column_reference */ - case 277: /* subquery */ - case 278: /* predicate */ - case 281: /* in_predicate_value */ - case 282: /* boolean_value_expression */ - case 283: /* boolean_primary */ - case 284: /* common_expression */ - case 285: /* from_clause */ - case 286: /* table_reference_list */ - case 287: /* table_reference */ - case 288: /* table_primary */ - case 289: /* joined_table */ - case 291: /* parenthesized_joined_table */ - case 293: /* search_condition */ - case 294: /* query_specification */ - case 297: /* where_clause_opt */ - case 299: /* twindow_clause_opt */ - case 301: /* having_clause_opt */ - case 303: /* select_item */ - case 304: /* fill_opt */ - case 307: /* query_expression_body */ - case 309: /* slimit_clause_opt */ - case 310: /* limit_clause_opt */ - case 311: /* query_primary */ - case 313: /* sort_specification */ + case 219: /* cmd */ + case 222: /* literal */ + case 229: /* db_options */ + case 231: /* alter_db_options */ + case 236: /* retention */ + case 237: /* full_table_name */ + case 240: /* table_options */ + case 244: /* alter_table_clause */ + case 245: /* alter_table_options */ + case 248: /* create_subtable_clause */ + case 251: /* drop_table_clause */ + case 254: /* column_def */ + case 257: /* col_name */ + case 258: /* db_name_cond_opt */ + case 259: /* like_pattern_opt */ + case 260: /* table_name_cond */ + case 261: /* from_db_opt */ + case 262: /* func_name */ + case 265: /* index_options */ + case 267: /* duration_literal */ + case 268: /* sliding_opt */ + case 269: /* func */ + case 272: /* query_expression */ + case 274: /* explain_options */ + case 278: /* stream_options */ + case 279: /* into_opt */ + case 281: /* signed */ + case 282: /* signed_literal */ + case 285: /* expression */ + case 286: /* pseudo_column */ + case 287: /* column_reference */ + case 288: /* function_expression */ + case 289: /* subquery */ + case 293: /* star_func_para */ + case 294: /* predicate */ + case 297: /* in_predicate_value */ + case 298: /* boolean_value_expression */ + case 299: /* boolean_primary */ + case 300: /* common_expression */ + case 301: /* from_clause */ + case 302: /* table_reference_list */ + case 303: /* table_reference */ + case 304: /* table_primary */ + case 305: /* joined_table */ + case 307: /* parenthesized_joined_table */ + case 309: /* search_condition */ + case 310: /* query_specification */ + case 313: /* where_clause_opt */ + case 315: /* twindow_clause_opt */ + case 317: /* having_clause_opt */ + case 319: /* select_item */ + case 320: /* fill_opt */ + case 323: /* query_expression_body */ + case 325: /* slimit_clause_opt */ + case 326: /* limit_clause_opt */ + case 327: /* query_primary */ + case 329: /* sort_specification */ { - nodesDestroyNode((yypminor->yy504)); + nodesDestroyNode((yypminor->yy192)); } break; - case 211: /* account_options */ - case 212: /* alter_account_options */ - case 214: /* alter_account_option */ - case 267: /* bufsize_opt */ + case 220: /* account_options */ + case 221: /* alter_account_options */ + case 223: /* alter_account_option */ + case 276: /* bufsize_opt */ { } break; - case 215: /* user_name */ - case 216: /* dnode_endpoint */ - case 217: /* dnode_host_name */ - case 219: /* db_name */ - case 237: /* column_name */ - case 244: /* table_name */ - case 254: /* function_name */ - case 255: /* index_name */ - case 262: /* topic_name */ - case 268: /* stream_name */ - case 272: /* table_alias */ - case 273: /* column_alias */ - case 290: /* alias_opt */ + case 224: /* user_name */ + case 225: /* dnode_endpoint */ + case 226: /* dnode_host_name */ + case 228: /* db_name */ + case 246: /* column_name */ + case 253: /* table_name */ + case 263: /* function_name */ + case 264: /* index_name */ + case 271: /* topic_name */ + case 277: /* stream_name */ + case 283: /* table_alias */ + case 284: /* column_alias */ + case 290: /* star_func */ + case 306: /* alias_opt */ { } break; - case 218: /* not_exists_opt */ - case 221: /* exists_opt */ - case 264: /* analyze_opt */ - case 266: /* agg_func_opt */ - case 295: /* set_quantifier_opt */ + case 227: /* not_exists_opt */ + case 230: /* exists_opt */ + case 273: /* analyze_opt */ + case 275: /* agg_func_opt */ + case 311: /* set_quantifier_opt */ { } break; - case 223: /* integer_list */ - case 224: /* variable_list */ - case 225: /* retention_list */ - case 229: /* column_def_list */ - case 230: /* tags_def_opt */ - case 232: /* multi_create_clause */ - case 233: /* tags_def */ - case 234: /* multi_drop_clause */ - case 240: /* specific_tags_opt */ - case 241: /* literal_list */ - case 243: /* col_name_list */ - case 246: /* func_name_list */ - case 257: /* func_list */ - case 261: /* expression_list */ - case 269: /* dnode_list */ - case 296: /* select_list */ - case 298: /* partition_by_clause_opt */ - case 300: /* group_by_clause_opt */ - case 302: /* select_sublist */ - case 306: /* group_by_list */ - case 308: /* order_by_clause_opt */ - case 312: /* sort_specification_list */ + case 232: /* integer_list */ + case 233: /* variable_list */ + case 234: /* retention_list */ + case 238: /* column_def_list */ + case 239: /* tags_def_opt */ + case 241: /* multi_create_clause */ + case 242: /* tags_def */ + case 243: /* multi_drop_clause */ + case 249: /* specific_tags_opt */ + case 250: /* literal_list */ + case 252: /* col_name_list */ + case 255: /* func_name_list */ + case 266: /* func_list */ + case 270: /* expression_list */ + case 280: /* dnode_list */ + case 291: /* star_func_para_list */ + case 292: /* other_para_list */ + case 312: /* select_list */ + case 314: /* partition_by_clause_opt */ + case 316: /* group_by_clause_opt */ + case 318: /* select_sublist */ + case 322: /* group_by_list */ + case 324: /* order_by_clause_opt */ + case 328: /* sort_specification_list */ { - nodesDestroyList((yypminor->yy488)); + nodesDestroyList((yypminor->yy64)); } break; - case 226: /* alter_db_option */ - case 247: /* alter_table_option */ + case 235: /* alter_db_option */ + case 256: /* alter_table_option */ { } break; - case 238: /* type_name */ + case 247: /* type_name */ { } break; - case 279: /* compare_op */ - case 280: /* in_op */ + case 295: /* compare_op */ + case 296: /* in_op */ { } break; - case 292: /* join_type */ + case 308: /* join_type */ { } break; - case 305: /* fill_mode */ + case 321: /* fill_mode */ { } break; - case 314: /* ordering_specification_opt */ + case 330: /* ordering_specification_opt */ { } break; - case 315: /* null_ordering_opt */ + case 331: /* null_ordering_opt */ { } @@ -2104,417 +2201,437 @@ static const struct { YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ signed char nrhs; /* Negative of the number of RHS symbols in the rule */ } yyRuleInfo[] = { - { 210, -6 }, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ - { 210, -4 }, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ - { 211, 0 }, /* (2) account_options ::= */ - { 211, -3 }, /* (3) account_options ::= account_options PPS literal */ - { 211, -3 }, /* (4) account_options ::= account_options TSERIES literal */ - { 211, -3 }, /* (5) account_options ::= account_options STORAGE literal */ - { 211, -3 }, /* (6) account_options ::= account_options STREAMS literal */ - { 211, -3 }, /* (7) account_options ::= account_options QTIME literal */ - { 211, -3 }, /* (8) account_options ::= account_options DBS literal */ - { 211, -3 }, /* (9) account_options ::= account_options USERS literal */ - { 211, -3 }, /* (10) account_options ::= account_options CONNS literal */ - { 211, -3 }, /* (11) account_options ::= account_options STATE literal */ - { 212, -1 }, /* (12) alter_account_options ::= alter_account_option */ - { 212, -2 }, /* (13) alter_account_options ::= alter_account_options alter_account_option */ - { 214, -2 }, /* (14) alter_account_option ::= PASS literal */ - { 214, -2 }, /* (15) alter_account_option ::= PPS literal */ - { 214, -2 }, /* (16) alter_account_option ::= TSERIES literal */ - { 214, -2 }, /* (17) alter_account_option ::= STORAGE literal */ - { 214, -2 }, /* (18) alter_account_option ::= STREAMS literal */ - { 214, -2 }, /* (19) alter_account_option ::= QTIME literal */ - { 214, -2 }, /* (20) alter_account_option ::= DBS literal */ - { 214, -2 }, /* (21) alter_account_option ::= USERS literal */ - { 214, -2 }, /* (22) alter_account_option ::= CONNS literal */ - { 214, -2 }, /* (23) alter_account_option ::= STATE literal */ - { 210, -5 }, /* (24) cmd ::= CREATE USER user_name PASS NK_STRING */ - { 210, -5 }, /* (25) cmd ::= ALTER USER user_name PASS NK_STRING */ - { 210, -5 }, /* (26) cmd ::= ALTER USER user_name PRIVILEGE NK_STRING */ - { 210, -3 }, /* (27) cmd ::= DROP USER user_name */ - { 210, -3 }, /* (28) cmd ::= CREATE DNODE dnode_endpoint */ - { 210, -5 }, /* (29) cmd ::= CREATE DNODE dnode_host_name PORT NK_INTEGER */ - { 210, -3 }, /* (30) cmd ::= DROP DNODE NK_INTEGER */ - { 210, -3 }, /* (31) cmd ::= DROP DNODE dnode_endpoint */ - { 210, -4 }, /* (32) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ - { 210, -5 }, /* (33) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ - { 210, -4 }, /* (34) cmd ::= ALTER ALL DNODES NK_STRING */ - { 210, -5 }, /* (35) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ - { 216, -1 }, /* (36) dnode_endpoint ::= NK_STRING */ - { 217, -1 }, /* (37) dnode_host_name ::= NK_ID */ - { 217, -1 }, /* (38) dnode_host_name ::= NK_IPTOKEN */ - { 210, -3 }, /* (39) cmd ::= ALTER LOCAL NK_STRING */ - { 210, -4 }, /* (40) cmd ::= ALTER LOCAL NK_STRING NK_STRING */ - { 210, -5 }, /* (41) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ - { 210, -5 }, /* (42) cmd ::= DROP QNODE ON DNODE NK_INTEGER */ - { 210, -5 }, /* (43) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ - { 210, -5 }, /* (44) cmd ::= DROP BNODE ON DNODE NK_INTEGER */ - { 210, -5 }, /* (45) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ - { 210, -5 }, /* (46) cmd ::= DROP SNODE ON DNODE NK_INTEGER */ - { 210, -5 }, /* (47) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ - { 210, -5 }, /* (48) cmd ::= DROP MNODE ON DNODE NK_INTEGER */ - { 210, -5 }, /* (49) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ - { 210, -4 }, /* (50) cmd ::= DROP DATABASE exists_opt db_name */ - { 210, -2 }, /* (51) cmd ::= USE db_name */ - { 210, -4 }, /* (52) cmd ::= ALTER DATABASE db_name alter_db_options */ - { 218, -3 }, /* (53) not_exists_opt ::= IF NOT EXISTS */ - { 218, 0 }, /* (54) not_exists_opt ::= */ - { 221, -2 }, /* (55) exists_opt ::= IF EXISTS */ - { 221, 0 }, /* (56) exists_opt ::= */ - { 220, 0 }, /* (57) db_options ::= */ - { 220, -3 }, /* (58) db_options ::= db_options BLOCKS NK_INTEGER */ - { 220, -3 }, /* (59) db_options ::= db_options CACHE NK_INTEGER */ - { 220, -3 }, /* (60) db_options ::= db_options CACHELAST NK_INTEGER */ - { 220, -3 }, /* (61) db_options ::= db_options COMP NK_INTEGER */ - { 220, -3 }, /* (62) db_options ::= db_options DAYS NK_INTEGER */ - { 220, -3 }, /* (63) db_options ::= db_options DAYS NK_VARIABLE */ - { 220, -3 }, /* (64) db_options ::= db_options FSYNC NK_INTEGER */ - { 220, -3 }, /* (65) db_options ::= db_options MAXROWS NK_INTEGER */ - { 220, -3 }, /* (66) db_options ::= db_options MINROWS NK_INTEGER */ - { 220, -3 }, /* (67) db_options ::= db_options KEEP integer_list */ - { 220, -3 }, /* (68) db_options ::= db_options KEEP variable_list */ - { 220, -3 }, /* (69) db_options ::= db_options PRECISION NK_STRING */ - { 220, -3 }, /* (70) db_options ::= db_options QUORUM NK_INTEGER */ - { 220, -3 }, /* (71) db_options ::= db_options REPLICA NK_INTEGER */ - { 220, -3 }, /* (72) db_options ::= db_options TTL NK_INTEGER */ - { 220, -3 }, /* (73) db_options ::= db_options WAL NK_INTEGER */ - { 220, -3 }, /* (74) db_options ::= db_options VGROUPS NK_INTEGER */ - { 220, -3 }, /* (75) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ - { 220, -3 }, /* (76) db_options ::= db_options STREAM_MODE NK_INTEGER */ - { 220, -3 }, /* (77) db_options ::= db_options RETENTIONS retention_list */ - { 222, -1 }, /* (78) alter_db_options ::= alter_db_option */ - { 222, -2 }, /* (79) alter_db_options ::= alter_db_options alter_db_option */ - { 226, -2 }, /* (80) alter_db_option ::= BLOCKS NK_INTEGER */ - { 226, -2 }, /* (81) alter_db_option ::= FSYNC NK_INTEGER */ - { 226, -2 }, /* (82) alter_db_option ::= KEEP integer_list */ - { 226, -2 }, /* (83) alter_db_option ::= KEEP variable_list */ - { 226, -2 }, /* (84) alter_db_option ::= WAL NK_INTEGER */ - { 226, -2 }, /* (85) alter_db_option ::= QUORUM NK_INTEGER */ - { 226, -2 }, /* (86) alter_db_option ::= CACHELAST NK_INTEGER */ - { 226, -2 }, /* (87) alter_db_option ::= REPLICA NK_INTEGER */ - { 223, -1 }, /* (88) integer_list ::= NK_INTEGER */ - { 223, -3 }, /* (89) integer_list ::= integer_list NK_COMMA NK_INTEGER */ - { 224, -1 }, /* (90) variable_list ::= NK_VARIABLE */ - { 224, -3 }, /* (91) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ - { 225, -1 }, /* (92) retention_list ::= retention */ - { 225, -3 }, /* (93) retention_list ::= retention_list NK_COMMA retention */ - { 227, -3 }, /* (94) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ - { 210, -9 }, /* (95) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ - { 210, -3 }, /* (96) cmd ::= CREATE TABLE multi_create_clause */ - { 210, -9 }, /* (97) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ - { 210, -3 }, /* (98) cmd ::= DROP TABLE multi_drop_clause */ - { 210, -4 }, /* (99) cmd ::= DROP STABLE exists_opt full_table_name */ - { 210, -3 }, /* (100) cmd ::= ALTER TABLE alter_table_clause */ - { 210, -3 }, /* (101) cmd ::= ALTER STABLE alter_table_clause */ - { 235, -2 }, /* (102) alter_table_clause ::= full_table_name alter_table_options */ - { 235, -5 }, /* (103) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ - { 235, -4 }, /* (104) alter_table_clause ::= full_table_name DROP COLUMN column_name */ - { 235, -5 }, /* (105) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ - { 235, -5 }, /* (106) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ - { 235, -5 }, /* (107) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ - { 235, -4 }, /* (108) alter_table_clause ::= full_table_name DROP TAG column_name */ - { 235, -5 }, /* (109) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ - { 235, -5 }, /* (110) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ - { 235, -6 }, /* (111) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ literal */ - { 232, -1 }, /* (112) multi_create_clause ::= create_subtable_clause */ - { 232, -2 }, /* (113) multi_create_clause ::= multi_create_clause create_subtable_clause */ - { 239, -9 }, /* (114) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP */ - { 234, -1 }, /* (115) multi_drop_clause ::= drop_table_clause */ - { 234, -2 }, /* (116) multi_drop_clause ::= multi_drop_clause drop_table_clause */ - { 242, -2 }, /* (117) drop_table_clause ::= exists_opt full_table_name */ - { 240, 0 }, /* (118) specific_tags_opt ::= */ - { 240, -3 }, /* (119) specific_tags_opt ::= NK_LP col_name_list NK_RP */ - { 228, -1 }, /* (120) full_table_name ::= table_name */ - { 228, -3 }, /* (121) full_table_name ::= db_name NK_DOT table_name */ - { 229, -1 }, /* (122) column_def_list ::= column_def */ - { 229, -3 }, /* (123) column_def_list ::= column_def_list NK_COMMA column_def */ - { 245, -2 }, /* (124) column_def ::= column_name type_name */ - { 245, -4 }, /* (125) column_def ::= column_name type_name COMMENT NK_STRING */ - { 238, -1 }, /* (126) type_name ::= BOOL */ - { 238, -1 }, /* (127) type_name ::= TINYINT */ - { 238, -1 }, /* (128) type_name ::= SMALLINT */ - { 238, -1 }, /* (129) type_name ::= INT */ - { 238, -1 }, /* (130) type_name ::= INTEGER */ - { 238, -1 }, /* (131) type_name ::= BIGINT */ - { 238, -1 }, /* (132) type_name ::= FLOAT */ - { 238, -1 }, /* (133) type_name ::= DOUBLE */ - { 238, -4 }, /* (134) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ - { 238, -1 }, /* (135) type_name ::= TIMESTAMP */ - { 238, -4 }, /* (136) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ - { 238, -2 }, /* (137) type_name ::= TINYINT UNSIGNED */ - { 238, -2 }, /* (138) type_name ::= SMALLINT UNSIGNED */ - { 238, -2 }, /* (139) type_name ::= INT UNSIGNED */ - { 238, -2 }, /* (140) type_name ::= BIGINT UNSIGNED */ - { 238, -1 }, /* (141) type_name ::= JSON */ - { 238, -4 }, /* (142) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ - { 238, -1 }, /* (143) type_name ::= MEDIUMBLOB */ - { 238, -1 }, /* (144) type_name ::= BLOB */ - { 238, -4 }, /* (145) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ - { 238, -1 }, /* (146) type_name ::= DECIMAL */ - { 238, -4 }, /* (147) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ - { 238, -6 }, /* (148) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - { 230, 0 }, /* (149) tags_def_opt ::= */ - { 230, -1 }, /* (150) tags_def_opt ::= tags_def */ - { 233, -4 }, /* (151) tags_def ::= TAGS NK_LP column_def_list NK_RP */ - { 231, 0 }, /* (152) table_options ::= */ - { 231, -3 }, /* (153) table_options ::= table_options COMMENT NK_STRING */ - { 231, -3 }, /* (154) table_options ::= table_options KEEP integer_list */ - { 231, -3 }, /* (155) table_options ::= table_options TTL NK_INTEGER */ - { 231, -5 }, /* (156) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ - { 231, -5 }, /* (157) table_options ::= table_options ROLLUP NK_LP func_name_list NK_RP */ - { 231, -3 }, /* (158) table_options ::= table_options FILE_FACTOR NK_FLOAT */ - { 231, -3 }, /* (159) table_options ::= table_options DELAY NK_INTEGER */ - { 236, -1 }, /* (160) alter_table_options ::= alter_table_option */ - { 236, -2 }, /* (161) alter_table_options ::= alter_table_options alter_table_option */ - { 247, -2 }, /* (162) alter_table_option ::= COMMENT NK_STRING */ - { 247, -2 }, /* (163) alter_table_option ::= KEEP integer_list */ - { 247, -2 }, /* (164) alter_table_option ::= TTL NK_INTEGER */ - { 243, -1 }, /* (165) col_name_list ::= col_name */ - { 243, -3 }, /* (166) col_name_list ::= col_name_list NK_COMMA col_name */ - { 248, -1 }, /* (167) col_name ::= column_name */ - { 210, -2 }, /* (168) cmd ::= SHOW DNODES */ - { 210, -2 }, /* (169) cmd ::= SHOW USERS */ - { 210, -2 }, /* (170) cmd ::= SHOW DATABASES */ - { 210, -4 }, /* (171) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ - { 210, -4 }, /* (172) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ - { 210, -3 }, /* (173) cmd ::= SHOW db_name_cond_opt VGROUPS */ - { 210, -2 }, /* (174) cmd ::= SHOW MNODES */ - { 210, -2 }, /* (175) cmd ::= SHOW MODULES */ - { 210, -2 }, /* (176) cmd ::= SHOW QNODES */ - { 210, -2 }, /* (177) cmd ::= SHOW FUNCTIONS */ - { 210, -5 }, /* (178) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ - { 210, -2 }, /* (179) cmd ::= SHOW STREAMS */ - { 210, -2 }, /* (180) cmd ::= SHOW ACCOUNTS */ - { 210, -2 }, /* (181) cmd ::= SHOW APPS */ - { 210, -2 }, /* (182) cmd ::= SHOW CONNECTIONS */ - { 210, -2 }, /* (183) cmd ::= SHOW LICENCE */ - { 210, -2 }, /* (184) cmd ::= SHOW GRANTS */ - { 210, -4 }, /* (185) cmd ::= SHOW CREATE DATABASE db_name */ - { 210, -4 }, /* (186) cmd ::= SHOW CREATE TABLE full_table_name */ - { 210, -4 }, /* (187) cmd ::= SHOW CREATE STABLE full_table_name */ - { 210, -2 }, /* (188) cmd ::= SHOW QUERIES */ - { 210, -2 }, /* (189) cmd ::= SHOW SCORES */ - { 210, -2 }, /* (190) cmd ::= SHOW TOPICS */ - { 210, -2 }, /* (191) cmd ::= SHOW VARIABLES */ - { 210, -2 }, /* (192) cmd ::= SHOW BNODES */ - { 210, -2 }, /* (193) cmd ::= SHOW SNODES */ - { 249, 0 }, /* (194) db_name_cond_opt ::= */ - { 249, -2 }, /* (195) db_name_cond_opt ::= db_name NK_DOT */ - { 250, 0 }, /* (196) like_pattern_opt ::= */ - { 250, -2 }, /* (197) like_pattern_opt ::= LIKE NK_STRING */ - { 251, -1 }, /* (198) table_name_cond ::= table_name */ - { 252, 0 }, /* (199) from_db_opt ::= */ - { 252, -2 }, /* (200) from_db_opt ::= FROM db_name */ - { 246, -1 }, /* (201) func_name_list ::= func_name */ - { 246, -3 }, /* (202) func_name_list ::= func_name_list NK_COMMA col_name */ - { 253, -1 }, /* (203) func_name ::= function_name */ - { 210, -8 }, /* (204) cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ - { 210, -10 }, /* (205) cmd ::= CREATE FULLTEXT INDEX not_exists_opt index_name ON table_name NK_LP col_name_list NK_RP */ - { 210, -6 }, /* (206) cmd ::= DROP INDEX exists_opt index_name ON table_name */ - { 256, 0 }, /* (207) index_options ::= */ - { 256, -9 }, /* (208) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt */ - { 256, -11 }, /* (209) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt */ - { 257, -1 }, /* (210) func_list ::= func */ - { 257, -3 }, /* (211) func_list ::= func_list NK_COMMA func */ - { 260, -4 }, /* (212) func ::= function_name NK_LP expression_list NK_RP */ - { 210, -6 }, /* (213) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ - { 210, -6 }, /* (214) cmd ::= CREATE TOPIC not_exists_opt topic_name AS db_name */ - { 210, -4 }, /* (215) cmd ::= DROP TOPIC exists_opt topic_name */ - { 210, -2 }, /* (216) cmd ::= DESC full_table_name */ - { 210, -2 }, /* (217) cmd ::= DESCRIBE full_table_name */ - { 210, -3 }, /* (218) cmd ::= RESET QUERY CACHE */ - { 210, -4 }, /* (219) cmd ::= EXPLAIN analyze_opt explain_options query_expression */ - { 264, 0 }, /* (220) analyze_opt ::= */ - { 264, -1 }, /* (221) analyze_opt ::= ANALYZE */ - { 265, 0 }, /* (222) explain_options ::= */ - { 265, -3 }, /* (223) explain_options ::= explain_options VERBOSE NK_BOOL */ - { 265, -3 }, /* (224) explain_options ::= explain_options RATIO NK_FLOAT */ - { 210, -6 }, /* (225) cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP */ - { 210, -9 }, /* (226) cmd ::= CREATE agg_func_opt FUNCTION function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ - { 210, -3 }, /* (227) cmd ::= DROP FUNCTION function_name */ - { 266, 0 }, /* (228) agg_func_opt ::= */ - { 266, -1 }, /* (229) agg_func_opt ::= AGGREGATE */ - { 267, 0 }, /* (230) bufsize_opt ::= */ - { 267, -2 }, /* (231) bufsize_opt ::= BUFSIZE NK_INTEGER */ - { 210, -7 }, /* (232) cmd ::= CREATE STREAM stream_name INTO table_name AS query_expression */ - { 210, -3 }, /* (233) cmd ::= DROP STREAM stream_name */ - { 210, -3 }, /* (234) cmd ::= KILL CONNECTION NK_INTEGER */ - { 210, -3 }, /* (235) cmd ::= KILL QUERY NK_INTEGER */ - { 210, -4 }, /* (236) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ - { 210, -4 }, /* (237) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ - { 210, -3 }, /* (238) cmd ::= SPLIT VGROUP NK_INTEGER */ - { 269, -2 }, /* (239) dnode_list ::= DNODE NK_INTEGER */ - { 269, -3 }, /* (240) dnode_list ::= dnode_list DNODE NK_INTEGER */ - { 210, -3 }, /* (241) cmd ::= SYNCDB db_name REPLICA */ - { 210, -1 }, /* (242) cmd ::= query_expression */ - { 213, -1 }, /* (243) literal ::= NK_INTEGER */ - { 213, -1 }, /* (244) literal ::= NK_FLOAT */ - { 213, -1 }, /* (245) literal ::= NK_STRING */ - { 213, -1 }, /* (246) literal ::= NK_BOOL */ - { 213, -2 }, /* (247) literal ::= TIMESTAMP NK_STRING */ - { 213, -1 }, /* (248) literal ::= duration_literal */ - { 213, -1 }, /* (249) literal ::= NULL */ - { 258, -1 }, /* (250) duration_literal ::= NK_VARIABLE */ - { 270, -1 }, /* (251) signed ::= NK_INTEGER */ - { 270, -2 }, /* (252) signed ::= NK_PLUS NK_INTEGER */ - { 270, -2 }, /* (253) signed ::= NK_MINUS NK_INTEGER */ - { 270, -1 }, /* (254) signed ::= NK_FLOAT */ - { 270, -2 }, /* (255) signed ::= NK_PLUS NK_FLOAT */ - { 270, -2 }, /* (256) signed ::= NK_MINUS NK_FLOAT */ - { 271, -1 }, /* (257) signed_literal ::= signed */ - { 271, -1 }, /* (258) signed_literal ::= NK_STRING */ - { 271, -1 }, /* (259) signed_literal ::= NK_BOOL */ - { 271, -2 }, /* (260) signed_literal ::= TIMESTAMP NK_STRING */ - { 271, -1 }, /* (261) signed_literal ::= duration_literal */ - { 271, -1 }, /* (262) signed_literal ::= NULL */ - { 241, -1 }, /* (263) literal_list ::= signed_literal */ - { 241, -3 }, /* (264) literal_list ::= literal_list NK_COMMA signed_literal */ - { 219, -1 }, /* (265) db_name ::= NK_ID */ - { 244, -1 }, /* (266) table_name ::= NK_ID */ - { 237, -1 }, /* (267) column_name ::= NK_ID */ - { 254, -1 }, /* (268) function_name ::= NK_ID */ - { 254, -1 }, /* (269) function_name ::= FIRST */ - { 254, -1 }, /* (270) function_name ::= LAST */ - { 272, -1 }, /* (271) table_alias ::= NK_ID */ - { 273, -1 }, /* (272) column_alias ::= NK_ID */ - { 215, -1 }, /* (273) user_name ::= NK_ID */ - { 255, -1 }, /* (274) index_name ::= NK_ID */ - { 262, -1 }, /* (275) topic_name ::= NK_ID */ - { 268, -1 }, /* (276) stream_name ::= NK_ID */ - { 274, -1 }, /* (277) expression ::= literal */ - { 274, -1 }, /* (278) expression ::= pseudo_column */ - { 274, -1 }, /* (279) expression ::= column_reference */ - { 274, -4 }, /* (280) expression ::= function_name NK_LP expression_list NK_RP */ - { 274, -4 }, /* (281) expression ::= function_name NK_LP NK_STAR NK_RP */ - { 274, -6 }, /* (282) expression ::= CAST NK_LP expression AS type_name NK_RP */ - { 274, -1 }, /* (283) expression ::= subquery */ - { 274, -3 }, /* (284) expression ::= NK_LP expression NK_RP */ - { 274, -2 }, /* (285) expression ::= NK_PLUS expression */ - { 274, -2 }, /* (286) expression ::= NK_MINUS expression */ - { 274, -3 }, /* (287) expression ::= expression NK_PLUS expression */ - { 274, -3 }, /* (288) expression ::= expression NK_MINUS expression */ - { 274, -3 }, /* (289) expression ::= expression NK_STAR expression */ - { 274, -3 }, /* (290) expression ::= expression NK_SLASH expression */ - { 274, -3 }, /* (291) expression ::= expression NK_REM expression */ - { 261, -1 }, /* (292) expression_list ::= expression */ - { 261, -3 }, /* (293) expression_list ::= expression_list NK_COMMA expression */ - { 276, -1 }, /* (294) column_reference ::= column_name */ - { 276, -3 }, /* (295) column_reference ::= table_name NK_DOT column_name */ - { 275, -1 }, /* (296) pseudo_column ::= NOW */ - { 275, -1 }, /* (297) pseudo_column ::= TODAY */ - { 275, -1 }, /* (298) pseudo_column ::= ROWTS */ - { 275, -1 }, /* (299) pseudo_column ::= TBNAME */ - { 275, -1 }, /* (300) pseudo_column ::= QSTARTTS */ - { 275, -1 }, /* (301) pseudo_column ::= QENDTS */ - { 275, -1 }, /* (302) pseudo_column ::= WSTARTTS */ - { 275, -1 }, /* (303) pseudo_column ::= WENDTS */ - { 275, -1 }, /* (304) pseudo_column ::= WDURATION */ - { 278, -3 }, /* (305) predicate ::= expression compare_op expression */ - { 278, -5 }, /* (306) predicate ::= expression BETWEEN expression AND expression */ - { 278, -6 }, /* (307) predicate ::= expression NOT BETWEEN expression AND expression */ - { 278, -3 }, /* (308) predicate ::= expression IS NULL */ - { 278, -4 }, /* (309) predicate ::= expression IS NOT NULL */ - { 278, -3 }, /* (310) predicate ::= expression in_op in_predicate_value */ - { 279, -1 }, /* (311) compare_op ::= NK_LT */ - { 279, -1 }, /* (312) compare_op ::= NK_GT */ - { 279, -1 }, /* (313) compare_op ::= NK_LE */ - { 279, -1 }, /* (314) compare_op ::= NK_GE */ - { 279, -1 }, /* (315) compare_op ::= NK_NE */ - { 279, -1 }, /* (316) compare_op ::= NK_EQ */ - { 279, -1 }, /* (317) compare_op ::= LIKE */ - { 279, -2 }, /* (318) compare_op ::= NOT LIKE */ - { 279, -1 }, /* (319) compare_op ::= MATCH */ - { 279, -1 }, /* (320) compare_op ::= NMATCH */ - { 280, -1 }, /* (321) in_op ::= IN */ - { 280, -2 }, /* (322) in_op ::= NOT IN */ - { 281, -3 }, /* (323) in_predicate_value ::= NK_LP expression_list NK_RP */ - { 282, -1 }, /* (324) boolean_value_expression ::= boolean_primary */ - { 282, -2 }, /* (325) boolean_value_expression ::= NOT boolean_primary */ - { 282, -3 }, /* (326) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - { 282, -3 }, /* (327) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - { 283, -1 }, /* (328) boolean_primary ::= predicate */ - { 283, -3 }, /* (329) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - { 284, -1 }, /* (330) common_expression ::= expression */ - { 284, -1 }, /* (331) common_expression ::= boolean_value_expression */ - { 285, -2 }, /* (332) from_clause ::= FROM table_reference_list */ - { 286, -1 }, /* (333) table_reference_list ::= table_reference */ - { 286, -3 }, /* (334) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - { 287, -1 }, /* (335) table_reference ::= table_primary */ - { 287, -1 }, /* (336) table_reference ::= joined_table */ - { 288, -2 }, /* (337) table_primary ::= table_name alias_opt */ - { 288, -4 }, /* (338) table_primary ::= db_name NK_DOT table_name alias_opt */ - { 288, -2 }, /* (339) table_primary ::= subquery alias_opt */ - { 288, -1 }, /* (340) table_primary ::= parenthesized_joined_table */ - { 290, 0 }, /* (341) alias_opt ::= */ - { 290, -1 }, /* (342) alias_opt ::= table_alias */ - { 290, -2 }, /* (343) alias_opt ::= AS table_alias */ - { 291, -3 }, /* (344) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - { 291, -3 }, /* (345) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - { 289, -6 }, /* (346) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ - { 292, 0 }, /* (347) join_type ::= */ - { 292, -1 }, /* (348) join_type ::= INNER */ - { 294, -9 }, /* (349) 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 */ - { 295, 0 }, /* (350) set_quantifier_opt ::= */ - { 295, -1 }, /* (351) set_quantifier_opt ::= DISTINCT */ - { 295, -1 }, /* (352) set_quantifier_opt ::= ALL */ - { 296, -1 }, /* (353) select_list ::= NK_STAR */ - { 296, -1 }, /* (354) select_list ::= select_sublist */ - { 302, -1 }, /* (355) select_sublist ::= select_item */ - { 302, -3 }, /* (356) select_sublist ::= select_sublist NK_COMMA select_item */ - { 303, -1 }, /* (357) select_item ::= common_expression */ - { 303, -2 }, /* (358) select_item ::= common_expression column_alias */ - { 303, -3 }, /* (359) select_item ::= common_expression AS column_alias */ - { 303, -3 }, /* (360) select_item ::= table_name NK_DOT NK_STAR */ - { 297, 0 }, /* (361) where_clause_opt ::= */ - { 297, -2 }, /* (362) where_clause_opt ::= WHERE search_condition */ - { 298, 0 }, /* (363) partition_by_clause_opt ::= */ - { 298, -3 }, /* (364) partition_by_clause_opt ::= PARTITION BY expression_list */ - { 299, 0 }, /* (365) twindow_clause_opt ::= */ - { 299, -6 }, /* (366) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ - { 299, -4 }, /* (367) twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ - { 299, -6 }, /* (368) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ - { 299, -8 }, /* (369) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ - { 259, 0 }, /* (370) sliding_opt ::= */ - { 259, -4 }, /* (371) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ - { 304, 0 }, /* (372) fill_opt ::= */ - { 304, -4 }, /* (373) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - { 304, -6 }, /* (374) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ - { 305, -1 }, /* (375) fill_mode ::= NONE */ - { 305, -1 }, /* (376) fill_mode ::= PREV */ - { 305, -1 }, /* (377) fill_mode ::= NULL */ - { 305, -1 }, /* (378) fill_mode ::= LINEAR */ - { 305, -1 }, /* (379) fill_mode ::= NEXT */ - { 300, 0 }, /* (380) group_by_clause_opt ::= */ - { 300, -3 }, /* (381) group_by_clause_opt ::= GROUP BY group_by_list */ - { 306, -1 }, /* (382) group_by_list ::= expression */ - { 306, -3 }, /* (383) group_by_list ::= group_by_list NK_COMMA expression */ - { 301, 0 }, /* (384) having_clause_opt ::= */ - { 301, -2 }, /* (385) having_clause_opt ::= HAVING search_condition */ - { 263, -4 }, /* (386) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ - { 307, -1 }, /* (387) query_expression_body ::= query_primary */ - { 307, -4 }, /* (388) query_expression_body ::= query_expression_body UNION ALL query_expression_body */ - { 311, -1 }, /* (389) query_primary ::= query_specification */ - { 308, 0 }, /* (390) order_by_clause_opt ::= */ - { 308, -3 }, /* (391) order_by_clause_opt ::= ORDER BY sort_specification_list */ - { 309, 0 }, /* (392) slimit_clause_opt ::= */ - { 309, -2 }, /* (393) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - { 309, -4 }, /* (394) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - { 309, -4 }, /* (395) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - { 310, 0 }, /* (396) limit_clause_opt ::= */ - { 310, -2 }, /* (397) limit_clause_opt ::= LIMIT NK_INTEGER */ - { 310, -4 }, /* (398) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - { 310, -4 }, /* (399) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - { 277, -3 }, /* (400) subquery ::= NK_LP query_expression NK_RP */ - { 293, -1 }, /* (401) search_condition ::= common_expression */ - { 312, -1 }, /* (402) sort_specification_list ::= sort_specification */ - { 312, -3 }, /* (403) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - { 313, -3 }, /* (404) sort_specification ::= expression ordering_specification_opt null_ordering_opt */ - { 314, 0 }, /* (405) ordering_specification_opt ::= */ - { 314, -1 }, /* (406) ordering_specification_opt ::= ASC */ - { 314, -1 }, /* (407) ordering_specification_opt ::= DESC */ - { 315, 0 }, /* (408) null_ordering_opt ::= */ - { 315, -2 }, /* (409) null_ordering_opt ::= NULLS FIRST */ - { 315, -2 }, /* (410) null_ordering_opt ::= NULLS LAST */ + { 219, -6 }, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ + { 219, -4 }, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ + { 220, 0 }, /* (2) account_options ::= */ + { 220, -3 }, /* (3) account_options ::= account_options PPS literal */ + { 220, -3 }, /* (4) account_options ::= account_options TSERIES literal */ + { 220, -3 }, /* (5) account_options ::= account_options STORAGE literal */ + { 220, -3 }, /* (6) account_options ::= account_options STREAMS literal */ + { 220, -3 }, /* (7) account_options ::= account_options QTIME literal */ + { 220, -3 }, /* (8) account_options ::= account_options DBS literal */ + { 220, -3 }, /* (9) account_options ::= account_options USERS literal */ + { 220, -3 }, /* (10) account_options ::= account_options CONNS literal */ + { 220, -3 }, /* (11) account_options ::= account_options STATE literal */ + { 221, -1 }, /* (12) alter_account_options ::= alter_account_option */ + { 221, -2 }, /* (13) alter_account_options ::= alter_account_options alter_account_option */ + { 223, -2 }, /* (14) alter_account_option ::= PASS literal */ + { 223, -2 }, /* (15) alter_account_option ::= PPS literal */ + { 223, -2 }, /* (16) alter_account_option ::= TSERIES literal */ + { 223, -2 }, /* (17) alter_account_option ::= STORAGE literal */ + { 223, -2 }, /* (18) alter_account_option ::= STREAMS literal */ + { 223, -2 }, /* (19) alter_account_option ::= QTIME literal */ + { 223, -2 }, /* (20) alter_account_option ::= DBS literal */ + { 223, -2 }, /* (21) alter_account_option ::= USERS literal */ + { 223, -2 }, /* (22) alter_account_option ::= CONNS literal */ + { 223, -2 }, /* (23) alter_account_option ::= STATE literal */ + { 219, -5 }, /* (24) cmd ::= CREATE USER user_name PASS NK_STRING */ + { 219, -5 }, /* (25) cmd ::= ALTER USER user_name PASS NK_STRING */ + { 219, -5 }, /* (26) cmd ::= ALTER USER user_name PRIVILEGE NK_STRING */ + { 219, -3 }, /* (27) cmd ::= DROP USER user_name */ + { 219, -3 }, /* (28) cmd ::= CREATE DNODE dnode_endpoint */ + { 219, -5 }, /* (29) cmd ::= CREATE DNODE dnode_host_name PORT NK_INTEGER */ + { 219, -3 }, /* (30) cmd ::= DROP DNODE NK_INTEGER */ + { 219, -3 }, /* (31) cmd ::= DROP DNODE dnode_endpoint */ + { 219, -4 }, /* (32) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ + { 219, -5 }, /* (33) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ + { 219, -4 }, /* (34) cmd ::= ALTER ALL DNODES NK_STRING */ + { 219, -5 }, /* (35) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ + { 225, -1 }, /* (36) dnode_endpoint ::= NK_STRING */ + { 226, -1 }, /* (37) dnode_host_name ::= NK_ID */ + { 226, -1 }, /* (38) dnode_host_name ::= NK_IPTOKEN */ + { 219, -3 }, /* (39) cmd ::= ALTER LOCAL NK_STRING */ + { 219, -4 }, /* (40) cmd ::= ALTER LOCAL NK_STRING NK_STRING */ + { 219, -5 }, /* (41) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ + { 219, -5 }, /* (42) cmd ::= DROP QNODE ON DNODE NK_INTEGER */ + { 219, -5 }, /* (43) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ + { 219, -5 }, /* (44) cmd ::= DROP BNODE ON DNODE NK_INTEGER */ + { 219, -5 }, /* (45) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ + { 219, -5 }, /* (46) cmd ::= DROP SNODE ON DNODE NK_INTEGER */ + { 219, -5 }, /* (47) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ + { 219, -5 }, /* (48) cmd ::= DROP MNODE ON DNODE NK_INTEGER */ + { 219, -5 }, /* (49) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ + { 219, -4 }, /* (50) cmd ::= DROP DATABASE exists_opt db_name */ + { 219, -2 }, /* (51) cmd ::= USE db_name */ + { 219, -4 }, /* (52) cmd ::= ALTER DATABASE db_name alter_db_options */ + { 227, -3 }, /* (53) not_exists_opt ::= IF NOT EXISTS */ + { 227, 0 }, /* (54) not_exists_opt ::= */ + { 230, -2 }, /* (55) exists_opt ::= IF EXISTS */ + { 230, 0 }, /* (56) exists_opt ::= */ + { 229, 0 }, /* (57) db_options ::= */ + { 229, -3 }, /* (58) db_options ::= db_options BLOCKS NK_INTEGER */ + { 229, -3 }, /* (59) db_options ::= db_options CACHE NK_INTEGER */ + { 229, -3 }, /* (60) db_options ::= db_options CACHELAST NK_INTEGER */ + { 229, -3 }, /* (61) db_options ::= db_options COMP NK_INTEGER */ + { 229, -3 }, /* (62) db_options ::= db_options DAYS NK_INTEGER */ + { 229, -3 }, /* (63) db_options ::= db_options DAYS NK_VARIABLE */ + { 229, -3 }, /* (64) db_options ::= db_options FSYNC NK_INTEGER */ + { 229, -3 }, /* (65) db_options ::= db_options MAXROWS NK_INTEGER */ + { 229, -3 }, /* (66) db_options ::= db_options MINROWS NK_INTEGER */ + { 229, -3 }, /* (67) db_options ::= db_options KEEP integer_list */ + { 229, -3 }, /* (68) db_options ::= db_options KEEP variable_list */ + { 229, -3 }, /* (69) db_options ::= db_options PRECISION NK_STRING */ + { 229, -3 }, /* (70) db_options ::= db_options QUORUM NK_INTEGER */ + { 229, -3 }, /* (71) db_options ::= db_options REPLICA NK_INTEGER */ + { 229, -3 }, /* (72) db_options ::= db_options TTL NK_INTEGER */ + { 229, -3 }, /* (73) db_options ::= db_options WAL NK_INTEGER */ + { 229, -3 }, /* (74) db_options ::= db_options VGROUPS NK_INTEGER */ + { 229, -3 }, /* (75) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ + { 229, -3 }, /* (76) db_options ::= db_options STREAM_MODE NK_INTEGER */ + { 229, -3 }, /* (77) db_options ::= db_options RETENTIONS retention_list */ + { 231, -1 }, /* (78) alter_db_options ::= alter_db_option */ + { 231, -2 }, /* (79) alter_db_options ::= alter_db_options alter_db_option */ + { 235, -2 }, /* (80) alter_db_option ::= BLOCKS NK_INTEGER */ + { 235, -2 }, /* (81) alter_db_option ::= FSYNC NK_INTEGER */ + { 235, -2 }, /* (82) alter_db_option ::= KEEP integer_list */ + { 235, -2 }, /* (83) alter_db_option ::= KEEP variable_list */ + { 235, -2 }, /* (84) alter_db_option ::= WAL NK_INTEGER */ + { 235, -2 }, /* (85) alter_db_option ::= QUORUM NK_INTEGER */ + { 235, -2 }, /* (86) alter_db_option ::= CACHELAST NK_INTEGER */ + { 235, -2 }, /* (87) alter_db_option ::= REPLICA NK_INTEGER */ + { 232, -1 }, /* (88) integer_list ::= NK_INTEGER */ + { 232, -3 }, /* (89) integer_list ::= integer_list NK_COMMA NK_INTEGER */ + { 233, -1 }, /* (90) variable_list ::= NK_VARIABLE */ + { 233, -3 }, /* (91) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ + { 234, -1 }, /* (92) retention_list ::= retention */ + { 234, -3 }, /* (93) retention_list ::= retention_list NK_COMMA retention */ + { 236, -3 }, /* (94) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ + { 219, -9 }, /* (95) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ + { 219, -3 }, /* (96) cmd ::= CREATE TABLE multi_create_clause */ + { 219, -9 }, /* (97) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ + { 219, -3 }, /* (98) cmd ::= DROP TABLE multi_drop_clause */ + { 219, -4 }, /* (99) cmd ::= DROP STABLE exists_opt full_table_name */ + { 219, -3 }, /* (100) cmd ::= ALTER TABLE alter_table_clause */ + { 219, -3 }, /* (101) cmd ::= ALTER STABLE alter_table_clause */ + { 244, -2 }, /* (102) alter_table_clause ::= full_table_name alter_table_options */ + { 244, -5 }, /* (103) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ + { 244, -4 }, /* (104) alter_table_clause ::= full_table_name DROP COLUMN column_name */ + { 244, -5 }, /* (105) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ + { 244, -5 }, /* (106) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ + { 244, -5 }, /* (107) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ + { 244, -4 }, /* (108) alter_table_clause ::= full_table_name DROP TAG column_name */ + { 244, -5 }, /* (109) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ + { 244, -5 }, /* (110) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ + { 244, -6 }, /* (111) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ literal */ + { 241, -1 }, /* (112) multi_create_clause ::= create_subtable_clause */ + { 241, -2 }, /* (113) multi_create_clause ::= multi_create_clause create_subtable_clause */ + { 248, -9 }, /* (114) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP */ + { 243, -1 }, /* (115) multi_drop_clause ::= drop_table_clause */ + { 243, -2 }, /* (116) multi_drop_clause ::= multi_drop_clause drop_table_clause */ + { 251, -2 }, /* (117) drop_table_clause ::= exists_opt full_table_name */ + { 249, 0 }, /* (118) specific_tags_opt ::= */ + { 249, -3 }, /* (119) specific_tags_opt ::= NK_LP col_name_list NK_RP */ + { 237, -1 }, /* (120) full_table_name ::= table_name */ + { 237, -3 }, /* (121) full_table_name ::= db_name NK_DOT table_name */ + { 238, -1 }, /* (122) column_def_list ::= column_def */ + { 238, -3 }, /* (123) column_def_list ::= column_def_list NK_COMMA column_def */ + { 254, -2 }, /* (124) column_def ::= column_name type_name */ + { 254, -4 }, /* (125) column_def ::= column_name type_name COMMENT NK_STRING */ + { 247, -1 }, /* (126) type_name ::= BOOL */ + { 247, -1 }, /* (127) type_name ::= TINYINT */ + { 247, -1 }, /* (128) type_name ::= SMALLINT */ + { 247, -1 }, /* (129) type_name ::= INT */ + { 247, -1 }, /* (130) type_name ::= INTEGER */ + { 247, -1 }, /* (131) type_name ::= BIGINT */ + { 247, -1 }, /* (132) type_name ::= FLOAT */ + { 247, -1 }, /* (133) type_name ::= DOUBLE */ + { 247, -4 }, /* (134) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ + { 247, -1 }, /* (135) type_name ::= TIMESTAMP */ + { 247, -4 }, /* (136) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ + { 247, -2 }, /* (137) type_name ::= TINYINT UNSIGNED */ + { 247, -2 }, /* (138) type_name ::= SMALLINT UNSIGNED */ + { 247, -2 }, /* (139) type_name ::= INT UNSIGNED */ + { 247, -2 }, /* (140) type_name ::= BIGINT UNSIGNED */ + { 247, -1 }, /* (141) type_name ::= JSON */ + { 247, -4 }, /* (142) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ + { 247, -1 }, /* (143) type_name ::= MEDIUMBLOB */ + { 247, -1 }, /* (144) type_name ::= BLOB */ + { 247, -4 }, /* (145) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ + { 247, -1 }, /* (146) type_name ::= DECIMAL */ + { 247, -4 }, /* (147) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ + { 247, -6 }, /* (148) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + { 239, 0 }, /* (149) tags_def_opt ::= */ + { 239, -1 }, /* (150) tags_def_opt ::= tags_def */ + { 242, -4 }, /* (151) tags_def ::= TAGS NK_LP column_def_list NK_RP */ + { 240, 0 }, /* (152) table_options ::= */ + { 240, -3 }, /* (153) table_options ::= table_options COMMENT NK_STRING */ + { 240, -3 }, /* (154) table_options ::= table_options KEEP integer_list */ + { 240, -3 }, /* (155) table_options ::= table_options KEEP variable_list */ + { 240, -3 }, /* (156) table_options ::= table_options TTL NK_INTEGER */ + { 240, -5 }, /* (157) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ + { 240, -5 }, /* (158) table_options ::= table_options ROLLUP NK_LP func_name_list NK_RP */ + { 240, -3 }, /* (159) table_options ::= table_options FILE_FACTOR NK_FLOAT */ + { 240, -3 }, /* (160) table_options ::= table_options DELAY NK_INTEGER */ + { 245, -1 }, /* (161) alter_table_options ::= alter_table_option */ + { 245, -2 }, /* (162) alter_table_options ::= alter_table_options alter_table_option */ + { 256, -2 }, /* (163) alter_table_option ::= COMMENT NK_STRING */ + { 256, -2 }, /* (164) alter_table_option ::= KEEP integer_list */ + { 256, -2 }, /* (165) alter_table_option ::= KEEP variable_list */ + { 256, -2 }, /* (166) alter_table_option ::= TTL NK_INTEGER */ + { 252, -1 }, /* (167) col_name_list ::= col_name */ + { 252, -3 }, /* (168) col_name_list ::= col_name_list NK_COMMA col_name */ + { 257, -1 }, /* (169) col_name ::= column_name */ + { 219, -2 }, /* (170) cmd ::= SHOW DNODES */ + { 219, -2 }, /* (171) cmd ::= SHOW USERS */ + { 219, -2 }, /* (172) cmd ::= SHOW DATABASES */ + { 219, -4 }, /* (173) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ + { 219, -4 }, /* (174) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ + { 219, -3 }, /* (175) cmd ::= SHOW db_name_cond_opt VGROUPS */ + { 219, -2 }, /* (176) cmd ::= SHOW MNODES */ + { 219, -2 }, /* (177) cmd ::= SHOW MODULES */ + { 219, -2 }, /* (178) cmd ::= SHOW QNODES */ + { 219, -2 }, /* (179) cmd ::= SHOW FUNCTIONS */ + { 219, -5 }, /* (180) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ + { 219, -2 }, /* (181) cmd ::= SHOW STREAMS */ + { 219, -2 }, /* (182) cmd ::= SHOW ACCOUNTS */ + { 219, -2 }, /* (183) cmd ::= SHOW APPS */ + { 219, -2 }, /* (184) cmd ::= SHOW CONNECTIONS */ + { 219, -2 }, /* (185) cmd ::= SHOW LICENCE */ + { 219, -2 }, /* (186) cmd ::= SHOW GRANTS */ + { 219, -4 }, /* (187) cmd ::= SHOW CREATE DATABASE db_name */ + { 219, -4 }, /* (188) cmd ::= SHOW CREATE TABLE full_table_name */ + { 219, -4 }, /* (189) cmd ::= SHOW CREATE STABLE full_table_name */ + { 219, -2 }, /* (190) cmd ::= SHOW QUERIES */ + { 219, -2 }, /* (191) cmd ::= SHOW SCORES */ + { 219, -2 }, /* (192) cmd ::= SHOW TOPICS */ + { 219, -2 }, /* (193) cmd ::= SHOW VARIABLES */ + { 219, -2 }, /* (194) cmd ::= SHOW BNODES */ + { 219, -2 }, /* (195) cmd ::= SHOW SNODES */ + { 258, 0 }, /* (196) db_name_cond_opt ::= */ + { 258, -2 }, /* (197) db_name_cond_opt ::= db_name NK_DOT */ + { 259, 0 }, /* (198) like_pattern_opt ::= */ + { 259, -2 }, /* (199) like_pattern_opt ::= LIKE NK_STRING */ + { 260, -1 }, /* (200) table_name_cond ::= table_name */ + { 261, 0 }, /* (201) from_db_opt ::= */ + { 261, -2 }, /* (202) from_db_opt ::= FROM db_name */ + { 255, -1 }, /* (203) func_name_list ::= func_name */ + { 255, -3 }, /* (204) func_name_list ::= func_name_list NK_COMMA col_name */ + { 262, -1 }, /* (205) func_name ::= function_name */ + { 219, -8 }, /* (206) cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ + { 219, -10 }, /* (207) cmd ::= CREATE FULLTEXT INDEX not_exists_opt index_name ON table_name NK_LP col_name_list NK_RP */ + { 219, -6 }, /* (208) cmd ::= DROP INDEX exists_opt index_name ON table_name */ + { 265, 0 }, /* (209) index_options ::= */ + { 265, -9 }, /* (210) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt */ + { 265, -11 }, /* (211) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt */ + { 266, -1 }, /* (212) func_list ::= func */ + { 266, -3 }, /* (213) func_list ::= func_list NK_COMMA func */ + { 269, -4 }, /* (214) func ::= function_name NK_LP expression_list NK_RP */ + { 219, -6 }, /* (215) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ + { 219, -6 }, /* (216) cmd ::= CREATE TOPIC not_exists_opt topic_name AS db_name */ + { 219, -4 }, /* (217) cmd ::= DROP TOPIC exists_opt topic_name */ + { 219, -2 }, /* (218) cmd ::= DESC full_table_name */ + { 219, -2 }, /* (219) cmd ::= DESCRIBE full_table_name */ + { 219, -3 }, /* (220) cmd ::= RESET QUERY CACHE */ + { 219, -4 }, /* (221) cmd ::= EXPLAIN analyze_opt explain_options query_expression */ + { 273, 0 }, /* (222) analyze_opt ::= */ + { 273, -1 }, /* (223) analyze_opt ::= ANALYZE */ + { 274, 0 }, /* (224) explain_options ::= */ + { 274, -3 }, /* (225) explain_options ::= explain_options VERBOSE NK_BOOL */ + { 274, -3 }, /* (226) explain_options ::= explain_options RATIO NK_FLOAT */ + { 219, -6 }, /* (227) cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP */ + { 219, -9 }, /* (228) cmd ::= CREATE agg_func_opt FUNCTION function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ + { 219, -3 }, /* (229) cmd ::= DROP FUNCTION function_name */ + { 275, 0 }, /* (230) agg_func_opt ::= */ + { 275, -1 }, /* (231) agg_func_opt ::= AGGREGATE */ + { 276, 0 }, /* (232) bufsize_opt ::= */ + { 276, -2 }, /* (233) bufsize_opt ::= BUFSIZE NK_INTEGER */ + { 219, -8 }, /* (234) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options into_opt AS query_expression */ + { 219, -4 }, /* (235) cmd ::= DROP STREAM exists_opt stream_name */ + { 279, 0 }, /* (236) into_opt ::= */ + { 279, -2 }, /* (237) into_opt ::= INTO full_table_name */ + { 278, 0 }, /* (238) stream_options ::= */ + { 278, -3 }, /* (239) stream_options ::= stream_options TRIGGER AT_ONCE */ + { 278, -3 }, /* (240) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ + { 278, -3 }, /* (241) stream_options ::= stream_options WATERMARK duration_literal */ + { 219, -3 }, /* (242) cmd ::= KILL CONNECTION NK_INTEGER */ + { 219, -3 }, /* (243) cmd ::= KILL QUERY NK_INTEGER */ + { 219, -4 }, /* (244) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + { 219, -4 }, /* (245) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ + { 219, -3 }, /* (246) cmd ::= SPLIT VGROUP NK_INTEGER */ + { 280, -2 }, /* (247) dnode_list ::= DNODE NK_INTEGER */ + { 280, -3 }, /* (248) dnode_list ::= dnode_list DNODE NK_INTEGER */ + { 219, -3 }, /* (249) cmd ::= SYNCDB db_name REPLICA */ + { 219, -1 }, /* (250) cmd ::= query_expression */ + { 222, -1 }, /* (251) literal ::= NK_INTEGER */ + { 222, -1 }, /* (252) literal ::= NK_FLOAT */ + { 222, -1 }, /* (253) literal ::= NK_STRING */ + { 222, -1 }, /* (254) literal ::= NK_BOOL */ + { 222, -2 }, /* (255) literal ::= TIMESTAMP NK_STRING */ + { 222, -1 }, /* (256) literal ::= duration_literal */ + { 222, -1 }, /* (257) literal ::= NULL */ + { 222, -1 }, /* (258) literal ::= NK_QUESTION */ + { 267, -1 }, /* (259) duration_literal ::= NK_VARIABLE */ + { 281, -1 }, /* (260) signed ::= NK_INTEGER */ + { 281, -2 }, /* (261) signed ::= NK_PLUS NK_INTEGER */ + { 281, -2 }, /* (262) signed ::= NK_MINUS NK_INTEGER */ + { 281, -1 }, /* (263) signed ::= NK_FLOAT */ + { 281, -2 }, /* (264) signed ::= NK_PLUS NK_FLOAT */ + { 281, -2 }, /* (265) signed ::= NK_MINUS NK_FLOAT */ + { 282, -1 }, /* (266) signed_literal ::= signed */ + { 282, -1 }, /* (267) signed_literal ::= NK_STRING */ + { 282, -1 }, /* (268) signed_literal ::= NK_BOOL */ + { 282, -2 }, /* (269) signed_literal ::= TIMESTAMP NK_STRING */ + { 282, -1 }, /* (270) signed_literal ::= duration_literal */ + { 282, -1 }, /* (271) signed_literal ::= NULL */ + { 250, -1 }, /* (272) literal_list ::= signed_literal */ + { 250, -3 }, /* (273) literal_list ::= literal_list NK_COMMA signed_literal */ + { 228, -1 }, /* (274) db_name ::= NK_ID */ + { 253, -1 }, /* (275) table_name ::= NK_ID */ + { 246, -1 }, /* (276) column_name ::= NK_ID */ + { 263, -1 }, /* (277) function_name ::= NK_ID */ + { 283, -1 }, /* (278) table_alias ::= NK_ID */ + { 284, -1 }, /* (279) column_alias ::= NK_ID */ + { 224, -1 }, /* (280) user_name ::= NK_ID */ + { 264, -1 }, /* (281) index_name ::= NK_ID */ + { 271, -1 }, /* (282) topic_name ::= NK_ID */ + { 277, -1 }, /* (283) stream_name ::= NK_ID */ + { 285, -1 }, /* (284) expression ::= literal */ + { 285, -1 }, /* (285) expression ::= pseudo_column */ + { 285, -1 }, /* (286) expression ::= column_reference */ + { 285, -1 }, /* (287) expression ::= function_expression */ + { 285, -1 }, /* (288) expression ::= subquery */ + { 285, -3 }, /* (289) expression ::= NK_LP expression NK_RP */ + { 285, -2 }, /* (290) expression ::= NK_PLUS expression */ + { 285, -2 }, /* (291) expression ::= NK_MINUS expression */ + { 285, -3 }, /* (292) expression ::= expression NK_PLUS expression */ + { 285, -3 }, /* (293) expression ::= expression NK_MINUS expression */ + { 285, -3 }, /* (294) expression ::= expression NK_STAR expression */ + { 285, -3 }, /* (295) expression ::= expression NK_SLASH expression */ + { 285, -3 }, /* (296) expression ::= expression NK_REM expression */ + { 285, -3 }, /* (297) expression ::= column_reference NK_ARROW NK_STRING */ + { 270, -1 }, /* (298) expression_list ::= expression */ + { 270, -3 }, /* (299) expression_list ::= expression_list NK_COMMA expression */ + { 287, -1 }, /* (300) column_reference ::= column_name */ + { 287, -3 }, /* (301) column_reference ::= table_name NK_DOT column_name */ + { 286, -1 }, /* (302) pseudo_column ::= NOW */ + { 286, -1 }, /* (303) pseudo_column ::= TODAY */ + { 286, -1 }, /* (304) pseudo_column ::= ROWTS */ + { 286, -1 }, /* (305) pseudo_column ::= TBNAME */ + { 286, -1 }, /* (306) pseudo_column ::= QSTARTTS */ + { 286, -1 }, /* (307) pseudo_column ::= QENDTS */ + { 286, -1 }, /* (308) pseudo_column ::= WSTARTTS */ + { 286, -1 }, /* (309) pseudo_column ::= WENDTS */ + { 286, -1 }, /* (310) pseudo_column ::= WDURATION */ + { 288, -4 }, /* (311) function_expression ::= function_name NK_LP expression_list NK_RP */ + { 288, -4 }, /* (312) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ + { 288, -6 }, /* (313) function_expression ::= CAST NK_LP expression AS type_name NK_RP */ + { 290, -1 }, /* (314) star_func ::= COUNT */ + { 290, -1 }, /* (315) star_func ::= FIRST */ + { 290, -1 }, /* (316) star_func ::= LAST */ + { 290, -1 }, /* (317) star_func ::= LAST_ROW */ + { 291, -1 }, /* (318) star_func_para_list ::= NK_STAR */ + { 291, -1 }, /* (319) star_func_para_list ::= other_para_list */ + { 292, -1 }, /* (320) other_para_list ::= star_func_para */ + { 292, -3 }, /* (321) other_para_list ::= other_para_list NK_COMMA star_func_para */ + { 293, -1 }, /* (322) star_func_para ::= expression */ + { 293, -3 }, /* (323) star_func_para ::= table_name NK_DOT NK_STAR */ + { 294, -3 }, /* (324) predicate ::= expression compare_op expression */ + { 294, -5 }, /* (325) predicate ::= expression BETWEEN expression AND expression */ + { 294, -6 }, /* (326) predicate ::= expression NOT BETWEEN expression AND expression */ + { 294, -3 }, /* (327) predicate ::= expression IS NULL */ + { 294, -4 }, /* (328) predicate ::= expression IS NOT NULL */ + { 294, -3 }, /* (329) predicate ::= expression in_op in_predicate_value */ + { 295, -1 }, /* (330) compare_op ::= NK_LT */ + { 295, -1 }, /* (331) compare_op ::= NK_GT */ + { 295, -1 }, /* (332) compare_op ::= NK_LE */ + { 295, -1 }, /* (333) compare_op ::= NK_GE */ + { 295, -1 }, /* (334) compare_op ::= NK_NE */ + { 295, -1 }, /* (335) compare_op ::= NK_EQ */ + { 295, -1 }, /* (336) compare_op ::= LIKE */ + { 295, -2 }, /* (337) compare_op ::= NOT LIKE */ + { 295, -1 }, /* (338) compare_op ::= MATCH */ + { 295, -1 }, /* (339) compare_op ::= NMATCH */ + { 295, -1 }, /* (340) compare_op ::= CONTAINS */ + { 296, -1 }, /* (341) in_op ::= IN */ + { 296, -2 }, /* (342) in_op ::= NOT IN */ + { 297, -3 }, /* (343) in_predicate_value ::= NK_LP expression_list NK_RP */ + { 298, -1 }, /* (344) boolean_value_expression ::= boolean_primary */ + { 298, -2 }, /* (345) boolean_value_expression ::= NOT boolean_primary */ + { 298, -3 }, /* (346) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + { 298, -3 }, /* (347) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + { 299, -1 }, /* (348) boolean_primary ::= predicate */ + { 299, -3 }, /* (349) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + { 300, -1 }, /* (350) common_expression ::= expression */ + { 300, -1 }, /* (351) common_expression ::= boolean_value_expression */ + { 301, -2 }, /* (352) from_clause ::= FROM table_reference_list */ + { 302, -1 }, /* (353) table_reference_list ::= table_reference */ + { 302, -3 }, /* (354) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + { 303, -1 }, /* (355) table_reference ::= table_primary */ + { 303, -1 }, /* (356) table_reference ::= joined_table */ + { 304, -2 }, /* (357) table_primary ::= table_name alias_opt */ + { 304, -4 }, /* (358) table_primary ::= db_name NK_DOT table_name alias_opt */ + { 304, -2 }, /* (359) table_primary ::= subquery alias_opt */ + { 304, -1 }, /* (360) table_primary ::= parenthesized_joined_table */ + { 306, 0 }, /* (361) alias_opt ::= */ + { 306, -1 }, /* (362) alias_opt ::= table_alias */ + { 306, -2 }, /* (363) alias_opt ::= AS table_alias */ + { 307, -3 }, /* (364) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + { 307, -3 }, /* (365) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + { 305, -6 }, /* (366) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ + { 308, 0 }, /* (367) join_type ::= */ + { 308, -1 }, /* (368) join_type ::= INNER */ + { 310, -9 }, /* (369) 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 */ + { 311, 0 }, /* (370) set_quantifier_opt ::= */ + { 311, -1 }, /* (371) set_quantifier_opt ::= DISTINCT */ + { 311, -1 }, /* (372) set_quantifier_opt ::= ALL */ + { 312, -1 }, /* (373) select_list ::= NK_STAR */ + { 312, -1 }, /* (374) select_list ::= select_sublist */ + { 318, -1 }, /* (375) select_sublist ::= select_item */ + { 318, -3 }, /* (376) select_sublist ::= select_sublist NK_COMMA select_item */ + { 319, -1 }, /* (377) select_item ::= common_expression */ + { 319, -2 }, /* (378) select_item ::= common_expression column_alias */ + { 319, -3 }, /* (379) select_item ::= common_expression AS column_alias */ + { 319, -3 }, /* (380) select_item ::= table_name NK_DOT NK_STAR */ + { 313, 0 }, /* (381) where_clause_opt ::= */ + { 313, -2 }, /* (382) where_clause_opt ::= WHERE search_condition */ + { 314, 0 }, /* (383) partition_by_clause_opt ::= */ + { 314, -3 }, /* (384) partition_by_clause_opt ::= PARTITION BY expression_list */ + { 315, 0 }, /* (385) twindow_clause_opt ::= */ + { 315, -6 }, /* (386) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ + { 315, -4 }, /* (387) twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ + { 315, -6 }, /* (388) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ + { 315, -8 }, /* (389) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ + { 268, 0 }, /* (390) sliding_opt ::= */ + { 268, -4 }, /* (391) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ + { 320, 0 }, /* (392) fill_opt ::= */ + { 320, -4 }, /* (393) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + { 320, -6 }, /* (394) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ + { 321, -1 }, /* (395) fill_mode ::= NONE */ + { 321, -1 }, /* (396) fill_mode ::= PREV */ + { 321, -1 }, /* (397) fill_mode ::= NULL */ + { 321, -1 }, /* (398) fill_mode ::= LINEAR */ + { 321, -1 }, /* (399) fill_mode ::= NEXT */ + { 316, 0 }, /* (400) group_by_clause_opt ::= */ + { 316, -3 }, /* (401) group_by_clause_opt ::= GROUP BY group_by_list */ + { 322, -1 }, /* (402) group_by_list ::= expression */ + { 322, -3 }, /* (403) group_by_list ::= group_by_list NK_COMMA expression */ + { 317, 0 }, /* (404) having_clause_opt ::= */ + { 317, -2 }, /* (405) having_clause_opt ::= HAVING search_condition */ + { 272, -4 }, /* (406) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ + { 323, -1 }, /* (407) query_expression_body ::= query_primary */ + { 323, -4 }, /* (408) query_expression_body ::= query_expression_body UNION ALL query_expression_body */ + { 327, -1 }, /* (409) query_primary ::= query_specification */ + { 324, 0 }, /* (410) order_by_clause_opt ::= */ + { 324, -3 }, /* (411) order_by_clause_opt ::= ORDER BY sort_specification_list */ + { 325, 0 }, /* (412) slimit_clause_opt ::= */ + { 325, -2 }, /* (413) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + { 325, -4 }, /* (414) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + { 325, -4 }, /* (415) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 326, 0 }, /* (416) limit_clause_opt ::= */ + { 326, -2 }, /* (417) limit_clause_opt ::= LIMIT NK_INTEGER */ + { 326, -4 }, /* (418) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + { 326, -4 }, /* (419) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 289, -3 }, /* (420) subquery ::= NK_LP query_expression NK_RP */ + { 309, -1 }, /* (421) search_condition ::= common_expression */ + { 328, -1 }, /* (422) sort_specification_list ::= sort_specification */ + { 328, -3 }, /* (423) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + { 329, -3 }, /* (424) sort_specification ::= expression ordering_specification_opt null_ordering_opt */ + { 330, 0 }, /* (425) ordering_specification_opt ::= */ + { 330, -1 }, /* (426) ordering_specification_opt ::= ASC */ + { 330, -1 }, /* (427) ordering_specification_opt ::= DESC */ + { 331, 0 }, /* (428) null_ordering_opt ::= */ + { 331, -2 }, /* (429) null_ordering_opt ::= NULLS FIRST */ + { 331, -2 }, /* (430) null_ordering_opt ::= NULLS LAST */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -2603,11 +2720,11 @@ static YYACTIONTYPE yy_reduce( YYMINORTYPE yylhsminor; case 0: /* cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ { pCxt->valid = false; generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } - yy_destructor(yypParser,211,&yymsp[0].minor); + yy_destructor(yypParser,220,&yymsp[0].minor); break; case 1: /* cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ { pCxt->valid = false; generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } - yy_destructor(yypParser,212,&yymsp[0].minor); + yy_destructor(yypParser,221,&yymsp[0].minor); break; case 2: /* account_options ::= */ { } @@ -2621,20 +2738,20 @@ static YYACTIONTYPE yy_reduce( case 9: /* account_options ::= account_options USERS literal */ yytestcase(yyruleno==9); case 10: /* account_options ::= account_options CONNS literal */ yytestcase(yyruleno==10); case 11: /* account_options ::= account_options STATE literal */ yytestcase(yyruleno==11); -{ yy_destructor(yypParser,211,&yymsp[-2].minor); +{ yy_destructor(yypParser,220,&yymsp[-2].minor); { } - yy_destructor(yypParser,213,&yymsp[0].minor); + yy_destructor(yypParser,222,&yymsp[0].minor); } break; case 12: /* alter_account_options ::= alter_account_option */ -{ yy_destructor(yypParser,214,&yymsp[0].minor); +{ yy_destructor(yypParser,223,&yymsp[0].minor); { } } break; case 13: /* alter_account_options ::= alter_account_options alter_account_option */ -{ yy_destructor(yypParser,212,&yymsp[-1].minor); +{ yy_destructor(yypParser,221,&yymsp[-1].minor); { } - yy_destructor(yypParser,214,&yymsp[0].minor); + yy_destructor(yypParser,223,&yymsp[0].minor); } break; case 14: /* alter_account_option ::= PASS literal */ @@ -2648,31 +2765,31 @@ static YYACTIONTYPE yy_reduce( case 22: /* alter_account_option ::= CONNS literal */ yytestcase(yyruleno==22); case 23: /* alter_account_option ::= STATE literal */ yytestcase(yyruleno==23); { } - yy_destructor(yypParser,213,&yymsp[0].minor); + yy_destructor(yypParser,222,&yymsp[0].minor); break; case 24: /* cmd ::= CREATE USER user_name PASS NK_STRING */ -{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-2].minor.yy409, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-2].minor.yy353, &yymsp[0].minor.yy0); } break; case 25: /* cmd ::= ALTER USER user_name PASS NK_STRING */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy409, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy353, 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.yy409, TSDB_ALTER_USER_PRIVILEGES, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy353, TSDB_ALTER_USER_PRIVILEGES, &yymsp[0].minor.yy0); } break; case 27: /* cmd ::= DROP USER user_name */ -{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy409); } +{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy353); } break; case 28: /* cmd ::= CREATE DNODE dnode_endpoint */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy409, NULL); } +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy353, NULL); } break; case 29: /* cmd ::= CREATE DNODE dnode_host_name PORT NK_INTEGER */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy409, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy353, &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.yy409); } +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy353); } break; case 32: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); } @@ -2689,20 +2806,22 @@ 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 265: /* db_name ::= NK_ID */ yytestcase(yyruleno==265); - case 266: /* table_name ::= NK_ID */ yytestcase(yyruleno==266); - case 267: /* column_name ::= NK_ID */ yytestcase(yyruleno==267); - case 268: /* function_name ::= NK_ID */ yytestcase(yyruleno==268); - case 269: /* function_name ::= FIRST */ yytestcase(yyruleno==269); - case 270: /* function_name ::= LAST */ yytestcase(yyruleno==270); - case 271: /* table_alias ::= NK_ID */ yytestcase(yyruleno==271); - case 272: /* column_alias ::= NK_ID */ yytestcase(yyruleno==272); - case 273: /* user_name ::= NK_ID */ yytestcase(yyruleno==273); - case 274: /* index_name ::= NK_ID */ yytestcase(yyruleno==274); - case 275: /* topic_name ::= NK_ID */ yytestcase(yyruleno==275); - case 276: /* stream_name ::= NK_ID */ yytestcase(yyruleno==276); -{ yylhsminor.yy409 = yymsp[0].minor.yy0; } - yymsp[0].minor.yy409 = yylhsminor.yy409; + case 274: /* db_name ::= NK_ID */ yytestcase(yyruleno==274); + case 275: /* table_name ::= NK_ID */ yytestcase(yyruleno==275); + case 276: /* column_name ::= NK_ID */ yytestcase(yyruleno==276); + case 277: /* function_name ::= NK_ID */ yytestcase(yyruleno==277); + case 278: /* table_alias ::= NK_ID */ yytestcase(yyruleno==278); + case 279: /* column_alias ::= NK_ID */ yytestcase(yyruleno==279); + case 280: /* user_name ::= NK_ID */ yytestcase(yyruleno==280); + case 281: /* index_name ::= NK_ID */ yytestcase(yyruleno==281); + case 282: /* topic_name ::= NK_ID */ yytestcase(yyruleno==282); + case 283: /* stream_name ::= NK_ID */ yytestcase(yyruleno==283); + case 314: /* star_func ::= COUNT */ yytestcase(yyruleno==314); + case 315: /* star_func ::= FIRST */ yytestcase(yyruleno==315); + case 316: /* star_func ::= LAST */ yytestcase(yyruleno==316); + case 317: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==317); +{ yylhsminor.yy353 = yymsp[0].minor.yy0; } + yymsp[0].minor.yy353 = yylhsminor.yy353; break; case 39: /* cmd ::= ALTER LOCAL NK_STRING */ { pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[0].minor.yy0, NULL); } @@ -2735,1083 +2854,1123 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_MNODE_STMT, &yymsp[0].minor.yy0); } break; case 49: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ -{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy121, &yymsp[-1].minor.yy409, yymsp[0].minor.yy504); } +{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy273, &yymsp[-1].minor.yy353, yymsp[0].minor.yy192); } break; case 50: /* cmd ::= DROP DATABASE exists_opt db_name */ -{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy121, &yymsp[0].minor.yy409); } +{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy273, &yymsp[0].minor.yy353); } break; case 51: /* cmd ::= USE db_name */ -{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy409); } +{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy353); } break; case 52: /* cmd ::= ALTER DATABASE db_name alter_db_options */ -{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy409, yymsp[0].minor.yy504); } +{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy353, yymsp[0].minor.yy192); } break; case 53: /* not_exists_opt ::= IF NOT EXISTS */ -{ yymsp[-2].minor.yy121 = true; } +{ yymsp[-2].minor.yy273 = true; } break; case 54: /* not_exists_opt ::= */ case 56: /* exists_opt ::= */ yytestcase(yyruleno==56); - case 220: /* analyze_opt ::= */ yytestcase(yyruleno==220); - case 228: /* agg_func_opt ::= */ yytestcase(yyruleno==228); - case 350: /* set_quantifier_opt ::= */ yytestcase(yyruleno==350); -{ yymsp[1].minor.yy121 = false; } + case 222: /* analyze_opt ::= */ yytestcase(yyruleno==222); + case 230: /* agg_func_opt ::= */ yytestcase(yyruleno==230); + case 370: /* set_quantifier_opt ::= */ yytestcase(yyruleno==370); +{ yymsp[1].minor.yy273 = false; } break; case 55: /* exists_opt ::= IF EXISTS */ -{ yymsp[-1].minor.yy121 = true; } +{ yymsp[-1].minor.yy273 = true; } break; case 57: /* db_options ::= */ -{ yymsp[1].minor.yy504 = createDatabaseOptions(pCxt); } +{ yymsp[1].minor.yy192 = createDatabaseOptions(pCxt); } break; case 58: /* db_options ::= db_options BLOCKS NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pNumOfBlocks = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy192)->pNumOfBlocks = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy192 = yymsp[-2].minor.yy192; } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; case 59: /* db_options ::= db_options CACHE NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pCacheBlockSize = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy192)->pCacheBlockSize = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy192 = yymsp[-2].minor.yy192; } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; case 60: /* db_options ::= db_options CACHELAST NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pCachelast = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy192)->pCachelast = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy192 = yymsp[-2].minor.yy192; } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; case 61: /* db_options ::= db_options COMP NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pCompressionLevel = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy192)->pCompressionLevel = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy192 = yymsp[-2].minor.yy192; } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; case 62: /* db_options ::= db_options DAYS NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pDaysPerFile = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy192)->pDaysPerFile = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy192 = yymsp[-2].minor.yy192; } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; case 63: /* db_options ::= db_options DAYS NK_VARIABLE */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pDaysPerFile = (SValueNode*)createDurationValueNode(pCxt, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy192)->pDaysPerFile = (SValueNode*)createDurationValueNode(pCxt, &yymsp[0].minor.yy0); yylhsminor.yy192 = yymsp[-2].minor.yy192; } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; case 64: /* db_options ::= db_options FSYNC NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pFsyncPeriod = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy192)->pFsyncPeriod = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy192 = yymsp[-2].minor.yy192; } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; case 65: /* db_options ::= db_options MAXROWS NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pMaxRowsPerBlock = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy192)->pMaxRowsPerBlock = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy192 = yymsp[-2].minor.yy192; } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; case 66: /* db_options ::= db_options MINROWS NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pMinRowsPerBlock = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy192)->pMinRowsPerBlock = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy192 = yymsp[-2].minor.yy192; } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; case 67: /* db_options ::= db_options KEEP integer_list */ case 68: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==68); -{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pKeep = yymsp[0].minor.yy488; yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy192)->pKeep = yymsp[0].minor.yy64; yylhsminor.yy192 = yymsp[-2].minor.yy192; } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; case 69: /* db_options ::= db_options PRECISION NK_STRING */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pPrecision = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy192)->pPrecision = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); yylhsminor.yy192 = yymsp[-2].minor.yy192; } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; case 70: /* db_options ::= db_options QUORUM NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pQuorum = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy192)->pQuorum = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy192 = yymsp[-2].minor.yy192; } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; case 71: /* db_options ::= db_options REPLICA NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pReplica = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy192)->pReplica = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy192 = yymsp[-2].minor.yy192; } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; case 72: /* db_options ::= db_options TTL NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pTtl = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy192)->pTtl = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy192 = yymsp[-2].minor.yy192; } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; case 73: /* db_options ::= db_options WAL NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pWalLevel = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy192)->pWalLevel = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy192 = yymsp[-2].minor.yy192; } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; case 74: /* db_options ::= db_options VGROUPS NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pNumOfVgroups = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy192)->pNumOfVgroups = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy192 = yymsp[-2].minor.yy192; } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; case 75: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pSingleStable = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy192)->pSingleStable = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy192 = yymsp[-2].minor.yy192; } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; case 76: /* db_options ::= db_options STREAM_MODE NK_INTEGER */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pStreamMode = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy192)->pStreamMode = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy192 = yymsp[-2].minor.yy192; } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; case 77: /* db_options ::= db_options RETENTIONS retention_list */ -{ ((SDatabaseOptions*)yymsp[-2].minor.yy504)->pRetentions = yymsp[0].minor.yy488; yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy192)->pRetentions = yymsp[0].minor.yy64; yylhsminor.yy192 = yymsp[-2].minor.yy192; } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; case 78: /* alter_db_options ::= alter_db_option */ -{ yylhsminor.yy504 = createDatabaseOptions(pCxt); yylhsminor.yy504 = setDatabaseAlterOption(pCxt, yylhsminor.yy504, &yymsp[0].minor.yy21); } - yymsp[0].minor.yy504 = yylhsminor.yy504; +{ yylhsminor.yy192 = createDatabaseOptions(pCxt); yylhsminor.yy192 = setDatabaseAlterOption(pCxt, yylhsminor.yy192, &yymsp[0].minor.yy277); } + yymsp[0].minor.yy192 = yylhsminor.yy192; break; case 79: /* alter_db_options ::= alter_db_options alter_db_option */ -{ yylhsminor.yy504 = setDatabaseAlterOption(pCxt, yymsp[-1].minor.yy504, &yymsp[0].minor.yy21); } - yymsp[-1].minor.yy504 = yylhsminor.yy504; +{ yylhsminor.yy192 = setDatabaseAlterOption(pCxt, yymsp[-1].minor.yy192, &yymsp[0].minor.yy277); } + yymsp[-1].minor.yy192 = yylhsminor.yy192; break; case 80: /* alter_db_option ::= BLOCKS NK_INTEGER */ -{ yymsp[-1].minor.yy21.type = DB_OPTION_BLOCKS; yymsp[-1].minor.yy21.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } +{ yymsp[-1].minor.yy277.type = DB_OPTION_BLOCKS; yymsp[-1].minor.yy277.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } break; case 81: /* alter_db_option ::= FSYNC NK_INTEGER */ -{ yymsp[-1].minor.yy21.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy21.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } +{ yymsp[-1].minor.yy277.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy277.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } break; case 82: /* alter_db_option ::= KEEP integer_list */ case 83: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==83); -{ yymsp[-1].minor.yy21.type = DB_OPTION_KEEP; yymsp[-1].minor.yy21.pList = yymsp[0].minor.yy488; } +{ yymsp[-1].minor.yy277.type = DB_OPTION_KEEP; yymsp[-1].minor.yy277.pList = yymsp[0].minor.yy64; } break; case 84: /* alter_db_option ::= WAL NK_INTEGER */ -{ yymsp[-1].minor.yy21.type = DB_OPTION_WAL; yymsp[-1].minor.yy21.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } +{ yymsp[-1].minor.yy277.type = DB_OPTION_WAL; yymsp[-1].minor.yy277.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } break; case 85: /* alter_db_option ::= QUORUM NK_INTEGER */ -{ yymsp[-1].minor.yy21.type = DB_OPTION_QUORUM; yymsp[-1].minor.yy21.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } +{ yymsp[-1].minor.yy277.type = DB_OPTION_QUORUM; yymsp[-1].minor.yy277.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } break; case 86: /* alter_db_option ::= CACHELAST NK_INTEGER */ -{ yymsp[-1].minor.yy21.type = DB_OPTION_CACHELAST; yymsp[-1].minor.yy21.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } +{ yymsp[-1].minor.yy277.type = DB_OPTION_CACHELAST; yymsp[-1].minor.yy277.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } break; case 87: /* alter_db_option ::= REPLICA NK_INTEGER */ -{ yymsp[-1].minor.yy21.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy21.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } +{ yymsp[-1].minor.yy277.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy277.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } break; case 88: /* integer_list ::= NK_INTEGER */ -{ yylhsminor.yy488 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy488 = yylhsminor.yy488; +{ yylhsminor.yy64 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy64 = yylhsminor.yy64; break; case 89: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */ - case 240: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==240); -{ yylhsminor.yy488 = addNodeToList(pCxt, yymsp[-2].minor.yy488, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy488 = yylhsminor.yy488; + case 248: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==248); +{ yylhsminor.yy64 = addNodeToList(pCxt, yymsp[-2].minor.yy64, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy64 = yylhsminor.yy64; break; case 90: /* variable_list ::= NK_VARIABLE */ -{ yylhsminor.yy488 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy488 = yylhsminor.yy488; +{ yylhsminor.yy64 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy64 = yylhsminor.yy64; break; case 91: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */ -{ yylhsminor.yy488 = addNodeToList(pCxt, yymsp[-2].minor.yy488, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy488 = yylhsminor.yy488; +{ yylhsminor.yy64 = addNodeToList(pCxt, yymsp[-2].minor.yy64, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy64 = yylhsminor.yy64; break; case 92: /* retention_list ::= retention */ case 112: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==112); case 115: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==115); case 122: /* column_def_list ::= column_def */ yytestcase(yyruleno==122); - case 165: /* col_name_list ::= col_name */ yytestcase(yyruleno==165); - case 201: /* func_name_list ::= func_name */ yytestcase(yyruleno==201); - case 210: /* func_list ::= func */ yytestcase(yyruleno==210); - case 263: /* literal_list ::= signed_literal */ yytestcase(yyruleno==263); - case 355: /* select_sublist ::= select_item */ yytestcase(yyruleno==355); - case 402: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==402); -{ yylhsminor.yy488 = createNodeList(pCxt, yymsp[0].minor.yy504); } - yymsp[0].minor.yy488 = yylhsminor.yy488; + case 167: /* col_name_list ::= col_name */ yytestcase(yyruleno==167); + case 203: /* func_name_list ::= func_name */ yytestcase(yyruleno==203); + case 212: /* func_list ::= func */ yytestcase(yyruleno==212); + case 272: /* literal_list ::= signed_literal */ yytestcase(yyruleno==272); + case 320: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==320); + case 375: /* select_sublist ::= select_item */ yytestcase(yyruleno==375); + case 422: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==422); +{ yylhsminor.yy64 = createNodeList(pCxt, yymsp[0].minor.yy192); } + yymsp[0].minor.yy64 = yylhsminor.yy64; break; case 93: /* retention_list ::= retention_list NK_COMMA retention */ case 123: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==123); - case 166: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==166); - case 202: /* func_name_list ::= func_name_list NK_COMMA col_name */ yytestcase(yyruleno==202); - case 211: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==211); - case 264: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==264); - case 356: /* select_sublist ::= select_sublist NK_COMMA select_item */ yytestcase(yyruleno==356); - case 403: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==403); -{ yylhsminor.yy488 = addNodeToList(pCxt, yymsp[-2].minor.yy488, yymsp[0].minor.yy504); } - yymsp[-2].minor.yy488 = yylhsminor.yy488; + case 168: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==168); + case 204: /* func_name_list ::= func_name_list NK_COMMA col_name */ yytestcase(yyruleno==204); + case 213: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==213); + case 273: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==273); + case 321: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==321); + case 376: /* select_sublist ::= select_sublist NK_COMMA select_item */ yytestcase(yyruleno==376); + case 423: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==423); +{ yylhsminor.yy64 = addNodeToList(pCxt, yymsp[-2].minor.yy64, yymsp[0].minor.yy192); } + yymsp[-2].minor.yy64 = yylhsminor.yy64; break; case 94: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ -{ yylhsminor.yy504 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ yylhsminor.yy192 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; case 95: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ case 97: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==97); -{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy121, yymsp[-5].minor.yy504, yymsp[-3].minor.yy488, yymsp[-1].minor.yy488, yymsp[0].minor.yy504); } +{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy273, yymsp[-5].minor.yy192, yymsp[-3].minor.yy64, yymsp[-1].minor.yy64, yymsp[0].minor.yy192); } break; case 96: /* cmd ::= CREATE TABLE multi_create_clause */ -{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy488); } +{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy64); } break; case 98: /* cmd ::= DROP TABLE multi_drop_clause */ -{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy488); } +{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy64); } break; case 99: /* cmd ::= DROP STABLE exists_opt full_table_name */ -{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy121, yymsp[0].minor.yy504); } +{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy273, yymsp[0].minor.yy192); } break; case 100: /* cmd ::= ALTER TABLE alter_table_clause */ case 101: /* cmd ::= ALTER STABLE alter_table_clause */ yytestcase(yyruleno==101); - case 242: /* cmd ::= query_expression */ yytestcase(yyruleno==242); -{ pCxt->pRootNode = yymsp[0].minor.yy504; } + case 250: /* cmd ::= query_expression */ yytestcase(yyruleno==250); +{ pCxt->pRootNode = yymsp[0].minor.yy192; } break; case 102: /* alter_table_clause ::= full_table_name alter_table_options */ -{ yylhsminor.yy504 = createAlterTableOption(pCxt, yymsp[-1].minor.yy504, yymsp[0].minor.yy504); } - yymsp[-1].minor.yy504 = yylhsminor.yy504; +{ yylhsminor.yy192 = createAlterTableOption(pCxt, yymsp[-1].minor.yy192, yymsp[0].minor.yy192); } + yymsp[-1].minor.yy192 = yylhsminor.yy192; break; case 103: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ -{ yylhsminor.yy504 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy504, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy409, yymsp[0].minor.yy160); } - yymsp[-4].minor.yy504 = yylhsminor.yy504; +{ yylhsminor.yy192 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy192, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy353, yymsp[0].minor.yy536); } + yymsp[-4].minor.yy192 = yylhsminor.yy192; break; case 104: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ -{ yylhsminor.yy504 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy504, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy409); } - yymsp[-3].minor.yy504 = yylhsminor.yy504; +{ yylhsminor.yy192 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy192, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy353); } + yymsp[-3].minor.yy192 = yylhsminor.yy192; break; case 105: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ -{ yylhsminor.yy504 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy504, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy409, yymsp[0].minor.yy160); } - yymsp[-4].minor.yy504 = yylhsminor.yy504; +{ yylhsminor.yy192 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy192, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy353, yymsp[0].minor.yy536); } + yymsp[-4].minor.yy192 = yylhsminor.yy192; break; case 106: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ -{ yylhsminor.yy504 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy504, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy409, &yymsp[0].minor.yy409); } - yymsp[-4].minor.yy504 = yylhsminor.yy504; +{ yylhsminor.yy192 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy192, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy353, &yymsp[0].minor.yy353); } + yymsp[-4].minor.yy192 = yylhsminor.yy192; break; case 107: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ -{ yylhsminor.yy504 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy504, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy409, yymsp[0].minor.yy160); } - yymsp[-4].minor.yy504 = yylhsminor.yy504; +{ yylhsminor.yy192 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy192, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy353, yymsp[0].minor.yy536); } + yymsp[-4].minor.yy192 = yylhsminor.yy192; break; case 108: /* alter_table_clause ::= full_table_name DROP TAG column_name */ -{ yylhsminor.yy504 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy504, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy409); } - yymsp[-3].minor.yy504 = yylhsminor.yy504; +{ yylhsminor.yy192 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy192, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy353); } + yymsp[-3].minor.yy192 = yylhsminor.yy192; break; case 109: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ -{ yylhsminor.yy504 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy504, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy409, yymsp[0].minor.yy160); } - yymsp[-4].minor.yy504 = yylhsminor.yy504; +{ yylhsminor.yy192 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy192, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy353, yymsp[0].minor.yy536); } + yymsp[-4].minor.yy192 = yylhsminor.yy192; break; case 110: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ -{ yylhsminor.yy504 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy504, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy409, &yymsp[0].minor.yy409); } - yymsp[-4].minor.yy504 = yylhsminor.yy504; +{ yylhsminor.yy192 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy192, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy353, &yymsp[0].minor.yy353); } + yymsp[-4].minor.yy192 = yylhsminor.yy192; break; case 111: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ literal */ -{ yylhsminor.yy504 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy504, &yymsp[-2].minor.yy409, yymsp[0].minor.yy504); } - yymsp[-5].minor.yy504 = yylhsminor.yy504; +{ yylhsminor.yy192 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy192, &yymsp[-2].minor.yy353, yymsp[0].minor.yy192); } + yymsp[-5].minor.yy192 = yylhsminor.yy192; break; case 113: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ case 116: /* multi_drop_clause ::= multi_drop_clause drop_table_clause */ yytestcase(yyruleno==116); -{ yylhsminor.yy488 = addNodeToList(pCxt, yymsp[-1].minor.yy488, yymsp[0].minor.yy504); } - yymsp[-1].minor.yy488 = yylhsminor.yy488; +{ yylhsminor.yy64 = addNodeToList(pCxt, yymsp[-1].minor.yy64, yymsp[0].minor.yy192); } + yymsp[-1].minor.yy64 = yylhsminor.yy64; break; case 114: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP */ -{ yylhsminor.yy504 = createCreateSubTableClause(pCxt, yymsp[-8].minor.yy121, yymsp[-7].minor.yy504, yymsp[-5].minor.yy504, yymsp[-4].minor.yy488, yymsp[-1].minor.yy488); } - yymsp[-8].minor.yy504 = yylhsminor.yy504; +{ yylhsminor.yy192 = createCreateSubTableClause(pCxt, yymsp[-8].minor.yy273, yymsp[-7].minor.yy192, yymsp[-5].minor.yy192, yymsp[-4].minor.yy64, yymsp[-1].minor.yy64); } + yymsp[-8].minor.yy192 = yylhsminor.yy192; break; case 117: /* drop_table_clause ::= exists_opt full_table_name */ -{ yylhsminor.yy504 = createDropTableClause(pCxt, yymsp[-1].minor.yy121, yymsp[0].minor.yy504); } - yymsp[-1].minor.yy504 = yylhsminor.yy504; +{ yylhsminor.yy192 = createDropTableClause(pCxt, yymsp[-1].minor.yy273, yymsp[0].minor.yy192); } + yymsp[-1].minor.yy192 = yylhsminor.yy192; break; case 118: /* specific_tags_opt ::= */ case 149: /* tags_def_opt ::= */ yytestcase(yyruleno==149); - case 363: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==363); - case 380: /* group_by_clause_opt ::= */ yytestcase(yyruleno==380); - case 390: /* order_by_clause_opt ::= */ yytestcase(yyruleno==390); -{ yymsp[1].minor.yy488 = NULL; } + case 383: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==383); + case 400: /* group_by_clause_opt ::= */ yytestcase(yyruleno==400); + case 410: /* order_by_clause_opt ::= */ yytestcase(yyruleno==410); +{ yymsp[1].minor.yy64 = NULL; } break; case 119: /* specific_tags_opt ::= NK_LP col_name_list NK_RP */ -{ yymsp[-2].minor.yy488 = yymsp[-1].minor.yy488; } +{ yymsp[-2].minor.yy64 = yymsp[-1].minor.yy64; } break; case 120: /* full_table_name ::= table_name */ -{ yylhsminor.yy504 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy409, NULL); } - yymsp[0].minor.yy504 = yylhsminor.yy504; +{ yylhsminor.yy192 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy353, NULL); } + yymsp[0].minor.yy192 = yylhsminor.yy192; break; case 121: /* full_table_name ::= db_name NK_DOT table_name */ -{ yylhsminor.yy504 = createRealTableNode(pCxt, &yymsp[-2].minor.yy409, &yymsp[0].minor.yy409, NULL); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ yylhsminor.yy192 = createRealTableNode(pCxt, &yymsp[-2].minor.yy353, &yymsp[0].minor.yy353, NULL); } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; case 124: /* column_def ::= column_name type_name */ -{ yylhsminor.yy504 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy409, yymsp[0].minor.yy160, NULL); } - yymsp[-1].minor.yy504 = yylhsminor.yy504; +{ yylhsminor.yy192 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy353, yymsp[0].minor.yy536, NULL); } + yymsp[-1].minor.yy192 = yylhsminor.yy192; break; case 125: /* column_def ::= column_name type_name COMMENT NK_STRING */ -{ yylhsminor.yy504 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy409, yymsp[-2].minor.yy160, &yymsp[0].minor.yy0); } - yymsp[-3].minor.yy504 = yylhsminor.yy504; +{ yylhsminor.yy192 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy353, yymsp[-2].minor.yy536, &yymsp[0].minor.yy0); } + yymsp[-3].minor.yy192 = yylhsminor.yy192; break; case 126: /* type_name ::= BOOL */ -{ yymsp[0].minor.yy160 = createDataType(TSDB_DATA_TYPE_BOOL); } +{ yymsp[0].minor.yy536 = createDataType(TSDB_DATA_TYPE_BOOL); } break; case 127: /* type_name ::= TINYINT */ -{ yymsp[0].minor.yy160 = createDataType(TSDB_DATA_TYPE_TINYINT); } +{ yymsp[0].minor.yy536 = createDataType(TSDB_DATA_TYPE_TINYINT); } break; case 128: /* type_name ::= SMALLINT */ -{ yymsp[0].minor.yy160 = createDataType(TSDB_DATA_TYPE_SMALLINT); } +{ yymsp[0].minor.yy536 = createDataType(TSDB_DATA_TYPE_SMALLINT); } break; case 129: /* type_name ::= INT */ case 130: /* type_name ::= INTEGER */ yytestcase(yyruleno==130); -{ yymsp[0].minor.yy160 = createDataType(TSDB_DATA_TYPE_INT); } +{ yymsp[0].minor.yy536 = createDataType(TSDB_DATA_TYPE_INT); } break; case 131: /* type_name ::= BIGINT */ -{ yymsp[0].minor.yy160 = createDataType(TSDB_DATA_TYPE_BIGINT); } +{ yymsp[0].minor.yy536 = createDataType(TSDB_DATA_TYPE_BIGINT); } break; case 132: /* type_name ::= FLOAT */ -{ yymsp[0].minor.yy160 = createDataType(TSDB_DATA_TYPE_FLOAT); } +{ yymsp[0].minor.yy536 = createDataType(TSDB_DATA_TYPE_FLOAT); } break; case 133: /* type_name ::= DOUBLE */ -{ yymsp[0].minor.yy160 = createDataType(TSDB_DATA_TYPE_DOUBLE); } +{ yymsp[0].minor.yy536 = createDataType(TSDB_DATA_TYPE_DOUBLE); } break; case 134: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy160 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy536 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } break; case 135: /* type_name ::= TIMESTAMP */ -{ yymsp[0].minor.yy160 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } +{ yymsp[0].minor.yy536 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } break; case 136: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy160 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy536 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } break; case 137: /* type_name ::= TINYINT UNSIGNED */ -{ yymsp[-1].minor.yy160 = createDataType(TSDB_DATA_TYPE_UTINYINT); } +{ yymsp[-1].minor.yy536 = createDataType(TSDB_DATA_TYPE_UTINYINT); } break; case 138: /* type_name ::= SMALLINT UNSIGNED */ -{ yymsp[-1].minor.yy160 = createDataType(TSDB_DATA_TYPE_USMALLINT); } +{ yymsp[-1].minor.yy536 = createDataType(TSDB_DATA_TYPE_USMALLINT); } break; case 139: /* type_name ::= INT UNSIGNED */ -{ yymsp[-1].minor.yy160 = createDataType(TSDB_DATA_TYPE_UINT); } +{ yymsp[-1].minor.yy536 = createDataType(TSDB_DATA_TYPE_UINT); } break; case 140: /* type_name ::= BIGINT UNSIGNED */ -{ yymsp[-1].minor.yy160 = createDataType(TSDB_DATA_TYPE_UBIGINT); } +{ yymsp[-1].minor.yy536 = createDataType(TSDB_DATA_TYPE_UBIGINT); } break; case 141: /* type_name ::= JSON */ -{ yymsp[0].minor.yy160 = createDataType(TSDB_DATA_TYPE_JSON); } +{ yymsp[0].minor.yy536 = createDataType(TSDB_DATA_TYPE_JSON); } break; case 142: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy160 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy536 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } break; case 143: /* type_name ::= MEDIUMBLOB */ -{ yymsp[0].minor.yy160 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } +{ yymsp[0].minor.yy536 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } break; case 144: /* type_name ::= BLOB */ -{ yymsp[0].minor.yy160 = createDataType(TSDB_DATA_TYPE_BLOB); } +{ yymsp[0].minor.yy536 = createDataType(TSDB_DATA_TYPE_BLOB); } break; case 145: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy160 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy536 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } break; case 146: /* type_name ::= DECIMAL */ -{ yymsp[0].minor.yy160 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +{ yymsp[0].minor.yy536 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 147: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy160 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +{ yymsp[-3].minor.yy536 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 148: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ -{ yymsp[-5].minor.yy160 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +{ yymsp[-5].minor.yy536 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 150: /* tags_def_opt ::= tags_def */ - case 354: /* select_list ::= select_sublist */ yytestcase(yyruleno==354); -{ yylhsminor.yy488 = yymsp[0].minor.yy488; } - yymsp[0].minor.yy488 = yylhsminor.yy488; + case 319: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==319); + case 374: /* select_list ::= select_sublist */ yytestcase(yyruleno==374); +{ yylhsminor.yy64 = yymsp[0].minor.yy64; } + yymsp[0].minor.yy64 = yylhsminor.yy64; break; case 151: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */ -{ yymsp[-3].minor.yy488 = yymsp[-1].minor.yy488; } +{ yymsp[-3].minor.yy64 = yymsp[-1].minor.yy64; } break; case 152: /* table_options ::= */ -{ yymsp[1].minor.yy504 = createTableOptions(pCxt); } +{ yymsp[1].minor.yy192 = createTableOptions(pCxt); } break; case 153: /* table_options ::= table_options COMMENT NK_STRING */ -{ ((STableOptions*)yymsp[-2].minor.yy504)->pComments = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; +{ ((STableOptions*)yymsp[-2].minor.yy192)->pComments = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); yylhsminor.yy192 = yymsp[-2].minor.yy192; } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; case 154: /* table_options ::= table_options KEEP integer_list */ -{ ((STableOptions*)yymsp[-2].minor.yy504)->pKeep = yymsp[0].minor.yy488; yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + case 155: /* table_options ::= table_options KEEP variable_list */ yytestcase(yyruleno==155); +{ ((STableOptions*)yymsp[-2].minor.yy192)->pKeep = yymsp[0].minor.yy64; yylhsminor.yy192 = yymsp[-2].minor.yy192; } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; - case 155: /* table_options ::= table_options TTL NK_INTEGER */ -{ ((STableOptions*)yymsp[-2].minor.yy504)->pTtl = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + case 156: /* table_options ::= table_options TTL NK_INTEGER */ +{ ((STableOptions*)yymsp[-2].minor.yy192)->pTtl = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy192 = yymsp[-2].minor.yy192; } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; - case 156: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ -{ ((STableOptions*)yymsp[-4].minor.yy504)->pSma = yymsp[-1].minor.yy488; yylhsminor.yy504 = yymsp[-4].minor.yy504; } - yymsp[-4].minor.yy504 = yylhsminor.yy504; + case 157: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ +{ ((STableOptions*)yymsp[-4].minor.yy192)->pSma = yymsp[-1].minor.yy64; yylhsminor.yy192 = yymsp[-4].minor.yy192; } + yymsp[-4].minor.yy192 = yylhsminor.yy192; break; - case 157: /* table_options ::= table_options ROLLUP NK_LP func_name_list NK_RP */ -{ ((STableOptions*)yymsp[-4].minor.yy504)->pFuncs = yymsp[-1].minor.yy488; yylhsminor.yy504 = yymsp[-4].minor.yy504; } - yymsp[-4].minor.yy504 = yylhsminor.yy504; + case 158: /* table_options ::= table_options ROLLUP NK_LP func_name_list NK_RP */ +{ ((STableOptions*)yymsp[-4].minor.yy192)->pFuncs = yymsp[-1].minor.yy64; yylhsminor.yy192 = yymsp[-4].minor.yy192; } + yymsp[-4].minor.yy192 = yylhsminor.yy192; break; - case 158: /* table_options ::= table_options FILE_FACTOR NK_FLOAT */ -{ ((STableOptions*)yymsp[-2].minor.yy504)->pFilesFactor = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + case 159: /* table_options ::= table_options FILE_FACTOR NK_FLOAT */ +{ ((STableOptions*)yymsp[-2].minor.yy192)->pFilesFactor = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); yylhsminor.yy192 = yymsp[-2].minor.yy192; } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; - case 159: /* table_options ::= table_options DELAY NK_INTEGER */ -{ ((STableOptions*)yymsp[-2].minor.yy504)->pDelay = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy504 = yymsp[-2].minor.yy504; } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + case 160: /* table_options ::= table_options DELAY NK_INTEGER */ +{ ((STableOptions*)yymsp[-2].minor.yy192)->pDelay = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy192 = yymsp[-2].minor.yy192; } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; - case 160: /* alter_table_options ::= alter_table_option */ -{ yylhsminor.yy504 = createTableOptions(pCxt); yylhsminor.yy504 = setTableAlterOption(pCxt, yylhsminor.yy504, &yymsp[0].minor.yy21); } - yymsp[0].minor.yy504 = yylhsminor.yy504; + case 161: /* alter_table_options ::= alter_table_option */ +{ yylhsminor.yy192 = createTableOptions(pCxt); yylhsminor.yy192 = setTableAlterOption(pCxt, yylhsminor.yy192, &yymsp[0].minor.yy277); } + yymsp[0].minor.yy192 = yylhsminor.yy192; break; - case 161: /* alter_table_options ::= alter_table_options alter_table_option */ -{ yylhsminor.yy504 = setTableAlterOption(pCxt, yymsp[-1].minor.yy504, &yymsp[0].minor.yy21); } - yymsp[-1].minor.yy504 = yylhsminor.yy504; + case 162: /* alter_table_options ::= alter_table_options alter_table_option */ +{ yylhsminor.yy192 = setTableAlterOption(pCxt, yymsp[-1].minor.yy192, &yymsp[0].minor.yy277); } + yymsp[-1].minor.yy192 = yylhsminor.yy192; break; - case 162: /* alter_table_option ::= COMMENT NK_STRING */ -{ yymsp[-1].minor.yy21.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy21.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } + case 163: /* alter_table_option ::= COMMENT NK_STRING */ +{ yymsp[-1].minor.yy277.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy277.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } break; - case 163: /* alter_table_option ::= KEEP integer_list */ -{ yymsp[-1].minor.yy21.type = TABLE_OPTION_KEEP; yymsp[-1].minor.yy21.pList = yymsp[0].minor.yy488; } + case 164: /* alter_table_option ::= KEEP integer_list */ + case 165: /* alter_table_option ::= KEEP variable_list */ yytestcase(yyruleno==165); +{ yymsp[-1].minor.yy277.type = TABLE_OPTION_KEEP; yymsp[-1].minor.yy277.pList = yymsp[0].minor.yy64; } break; - case 164: /* alter_table_option ::= TTL NK_INTEGER */ -{ yymsp[-1].minor.yy21.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy21.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } + case 166: /* alter_table_option ::= TTL NK_INTEGER */ +{ yymsp[-1].minor.yy277.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy277.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } break; - case 167: /* col_name ::= column_name */ -{ yylhsminor.yy504 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy409); } - yymsp[0].minor.yy504 = yylhsminor.yy504; + case 169: /* col_name ::= column_name */ +{ yylhsminor.yy192 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy353); } + yymsp[0].minor.yy192 = yylhsminor.yy192; break; - case 168: /* cmd ::= SHOW DNODES */ + case 170: /* cmd ::= SHOW DNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT, NULL, NULL); } break; - case 169: /* cmd ::= SHOW USERS */ + case 171: /* cmd ::= SHOW USERS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USERS_STMT, NULL, NULL); } break; - case 170: /* cmd ::= SHOW DATABASES */ + case 172: /* cmd ::= SHOW DATABASES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT, NULL, NULL); } break; - case 171: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy504, yymsp[0].minor.yy504); } + case 173: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy192, yymsp[0].minor.yy192); } break; - case 172: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy504, yymsp[0].minor.yy504); } + case 174: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy192, yymsp[0].minor.yy192); } break; - case 173: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy504, NULL); } + case 175: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy192, NULL); } break; - case 174: /* cmd ::= SHOW MNODES */ + case 176: /* cmd ::= SHOW MNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT, NULL, NULL); } break; - case 175: /* cmd ::= SHOW MODULES */ + case 177: /* cmd ::= SHOW MODULES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MODULES_STMT, NULL, NULL); } break; - case 176: /* cmd ::= SHOW QNODES */ + case 178: /* cmd ::= SHOW QNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QNODES_STMT, NULL, NULL); } break; - case 177: /* cmd ::= SHOW FUNCTIONS */ + case 179: /* cmd ::= SHOW FUNCTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT, NULL, NULL); } break; - case 178: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[-1].minor.yy504, yymsp[0].minor.yy504); } + case 180: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[-1].minor.yy192, yymsp[0].minor.yy192); } break; - case 179: /* cmd ::= SHOW STREAMS */ + case 181: /* cmd ::= SHOW STREAMS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT, NULL, NULL); } break; - case 180: /* cmd ::= SHOW ACCOUNTS */ + case 182: /* cmd ::= SHOW ACCOUNTS */ { pCxt->valid = false; generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } break; - case 181: /* cmd ::= SHOW APPS */ -// { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_APPS_STMT, NULL, NULL); } + case 183: /* cmd ::= SHOW APPS */ +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_APPS_STMT, NULL, NULL); } break; - case 182: /* cmd ::= SHOW CONNECTIONS */ + case 184: /* cmd ::= SHOW CONNECTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONNECTIONS_STMT, NULL, NULL); } break; - case 183: /* cmd ::= SHOW LICENCE */ - case 184: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==184); + case 185: /* cmd ::= SHOW LICENCE */ + case 186: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==186); { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCE_STMT, NULL, NULL); } break; - case 185: /* cmd ::= SHOW CREATE DATABASE db_name */ -// { pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy29); } + case 187: /* cmd ::= SHOW CREATE DATABASE db_name */ +{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy353); } break; - case 186: /* cmd ::= SHOW CREATE TABLE full_table_name */ -// { pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy182); } + case 188: /* cmd ::= SHOW CREATE TABLE full_table_name */ +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy192); } break; - case 187: /* cmd ::= SHOW CREATE STABLE full_table_name */ -// { pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy182); } + case 189: /* cmd ::= SHOW CREATE STABLE full_table_name */ +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy192); } break; - case 188: /* cmd ::= SHOW QUERIES */ + case 190: /* cmd ::= SHOW QUERIES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT, NULL, NULL); } break; - case 189: /* cmd ::= SHOW SCORES */ -// { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SCORES_STMT, NULL, NULL); } + case 191: /* cmd ::= SHOW SCORES */ +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SCORES_STMT, NULL, NULL); } break; - case 190: /* cmd ::= SHOW TOPICS */ + case 192: /* cmd ::= SHOW TOPICS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TOPICS_STMT, NULL, NULL); } break; - case 191: /* cmd ::= SHOW VARIABLES */ -// { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VARIABLE_STMT, NULL, NULL); } + case 193: /* cmd ::= SHOW VARIABLES */ +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VARIABLE_STMT, NULL, NULL); } break; - case 192: /* cmd ::= SHOW BNODES */ + case 194: /* cmd ::= SHOW BNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_BNODES_STMT, NULL, NULL); } break; - case 193: /* cmd ::= SHOW SNODES */ + case 195: /* cmd ::= SHOW SNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SNODES_STMT, NULL, NULL); } break; - case 194: /* db_name_cond_opt ::= */ - case 199: /* from_db_opt ::= */ yytestcase(yyruleno==199); -{ yymsp[1].minor.yy504 = createDefaultDatabaseCondValue(pCxt); } + case 196: /* db_name_cond_opt ::= */ + case 201: /* from_db_opt ::= */ yytestcase(yyruleno==201); +{ yymsp[1].minor.yy192 = createDefaultDatabaseCondValue(pCxt); } break; - case 195: /* db_name_cond_opt ::= db_name NK_DOT */ -{ yylhsminor.yy504 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy409); } - yymsp[-1].minor.yy504 = yylhsminor.yy504; + case 197: /* db_name_cond_opt ::= db_name NK_DOT */ +{ yylhsminor.yy192 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy353); } + yymsp[-1].minor.yy192 = yylhsminor.yy192; break; - case 196: /* like_pattern_opt ::= */ - case 207: /* index_options ::= */ yytestcase(yyruleno==207); - case 361: /* where_clause_opt ::= */ yytestcase(yyruleno==361); - case 365: /* twindow_clause_opt ::= */ yytestcase(yyruleno==365); - case 370: /* sliding_opt ::= */ yytestcase(yyruleno==370); - case 372: /* fill_opt ::= */ yytestcase(yyruleno==372); - case 384: /* having_clause_opt ::= */ yytestcase(yyruleno==384); - case 392: /* slimit_clause_opt ::= */ yytestcase(yyruleno==392); - case 396: /* limit_clause_opt ::= */ yytestcase(yyruleno==396); -{ yymsp[1].minor.yy504 = NULL; } + case 198: /* like_pattern_opt ::= */ + case 209: /* index_options ::= */ yytestcase(yyruleno==209); + case 236: /* into_opt ::= */ yytestcase(yyruleno==236); + case 381: /* where_clause_opt ::= */ yytestcase(yyruleno==381); + case 385: /* twindow_clause_opt ::= */ yytestcase(yyruleno==385); + case 390: /* sliding_opt ::= */ yytestcase(yyruleno==390); + case 392: /* fill_opt ::= */ yytestcase(yyruleno==392); + case 404: /* having_clause_opt ::= */ yytestcase(yyruleno==404); + case 412: /* slimit_clause_opt ::= */ yytestcase(yyruleno==412); + case 416: /* limit_clause_opt ::= */ yytestcase(yyruleno==416); +{ yymsp[1].minor.yy192 = NULL; } break; - case 197: /* like_pattern_opt ::= LIKE NK_STRING */ -{ yymsp[-1].minor.yy504 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } + case 199: /* like_pattern_opt ::= LIKE NK_STRING */ +{ yymsp[-1].minor.yy192 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } break; - case 198: /* table_name_cond ::= table_name */ -{ yylhsminor.yy504 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy409); } - yymsp[0].minor.yy504 = yylhsminor.yy504; + case 200: /* table_name_cond ::= table_name */ +{ yylhsminor.yy192 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy353); } + yymsp[0].minor.yy192 = yylhsminor.yy192; break; - case 200: /* from_db_opt ::= FROM db_name */ -{ yymsp[-1].minor.yy504 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy409); } + case 202: /* from_db_opt ::= FROM db_name */ +{ yymsp[-1].minor.yy192 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy353); } break; - case 203: /* func_name ::= function_name */ -{ yylhsminor.yy504 = createFunctionNode(pCxt, &yymsp[0].minor.yy409, NULL); } - yymsp[0].minor.yy504 = yylhsminor.yy504; + case 205: /* func_name ::= function_name */ +{ yylhsminor.yy192 = createFunctionNode(pCxt, &yymsp[0].minor.yy353, NULL); } + yymsp[0].minor.yy192 = yylhsminor.yy192; break; - case 204: /* cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ -{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy121, &yymsp[-3].minor.yy409, &yymsp[-1].minor.yy409, NULL, yymsp[0].minor.yy504); } + case 206: /* cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ +{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy273, &yymsp[-3].minor.yy353, &yymsp[-1].minor.yy353, NULL, yymsp[0].minor.yy192); } break; - case 205: /* 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.yy121, &yymsp[-5].minor.yy409, &yymsp[-3].minor.yy409, yymsp[-1].minor.yy488, NULL); } + case 207: /* 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.yy273, &yymsp[-5].minor.yy353, &yymsp[-3].minor.yy353, yymsp[-1].minor.yy64, NULL); } break; - case 206: /* cmd ::= DROP INDEX exists_opt index_name ON table_name */ -{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-3].minor.yy121, &yymsp[-2].minor.yy409, &yymsp[0].minor.yy409); } + case 208: /* cmd ::= DROP INDEX exists_opt index_name ON table_name */ +{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-3].minor.yy273, &yymsp[-2].minor.yy353, &yymsp[0].minor.yy353); } break; - case 208: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt */ -{ yymsp[-8].minor.yy504 = createIndexOption(pCxt, yymsp[-6].minor.yy488, releaseRawExprNode(pCxt, yymsp[-2].minor.yy504), NULL, yymsp[0].minor.yy504); } + case 210: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt */ +{ yymsp[-8].minor.yy192 = createIndexOption(pCxt, yymsp[-6].minor.yy64, releaseRawExprNode(pCxt, yymsp[-2].minor.yy192), NULL, yymsp[0].minor.yy192); } break; - case 209: /* 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.yy504 = createIndexOption(pCxt, yymsp[-8].minor.yy488, releaseRawExprNode(pCxt, yymsp[-4].minor.yy504), releaseRawExprNode(pCxt, yymsp[-2].minor.yy504), yymsp[0].minor.yy504); } + case 211: /* 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.yy192 = createIndexOption(pCxt, yymsp[-8].minor.yy64, releaseRawExprNode(pCxt, yymsp[-4].minor.yy192), releaseRawExprNode(pCxt, yymsp[-2].minor.yy192), yymsp[0].minor.yy192); } break; - case 212: /* func ::= function_name NK_LP expression_list NK_RP */ -{ yylhsminor.yy504 = createFunctionNode(pCxt, &yymsp[-3].minor.yy409, yymsp[-1].minor.yy488); } - yymsp[-3].minor.yy504 = yylhsminor.yy504; + case 214: /* func ::= function_name NK_LP expression_list NK_RP */ +{ yylhsminor.yy192 = createFunctionNode(pCxt, &yymsp[-3].minor.yy353, yymsp[-1].minor.yy64); } + yymsp[-3].minor.yy192 = yylhsminor.yy192; break; - case 213: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ -{ pCxt->pRootNode = createCreateTopicStmt(pCxt, yymsp[-3].minor.yy121, &yymsp[-2].minor.yy409, yymsp[0].minor.yy504, NULL); } + case 215: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ +{ pCxt->pRootNode = createCreateTopicStmt(pCxt, yymsp[-3].minor.yy273, &yymsp[-2].minor.yy353, yymsp[0].minor.yy192, NULL); } break; - case 214: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS db_name */ -{ pCxt->pRootNode = createCreateTopicStmt(pCxt, yymsp[-3].minor.yy121, &yymsp[-2].minor.yy409, NULL, &yymsp[0].minor.yy409); } + case 216: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS db_name */ +{ pCxt->pRootNode = createCreateTopicStmt(pCxt, yymsp[-3].minor.yy273, &yymsp[-2].minor.yy353, NULL, &yymsp[0].minor.yy353); } break; - case 215: /* cmd ::= DROP TOPIC exists_opt topic_name */ -{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy121, &yymsp[0].minor.yy409); } + case 217: /* cmd ::= DROP TOPIC exists_opt topic_name */ +{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy273, &yymsp[0].minor.yy353); } break; - case 216: /* cmd ::= DESC full_table_name */ - case 217: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==217); -{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy504); } + case 218: /* cmd ::= DESC full_table_name */ + case 219: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==219); +{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy192); } break; - case 218: /* cmd ::= RESET QUERY CACHE */ + case 220: /* cmd ::= RESET QUERY CACHE */ { pCxt->pRootNode = createResetQueryCacheStmt(pCxt); } break; - case 219: /* cmd ::= EXPLAIN analyze_opt explain_options query_expression */ -{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy121, yymsp[-1].minor.yy504, yymsp[0].minor.yy504); } + case 221: /* cmd ::= EXPLAIN analyze_opt explain_options query_expression */ +{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy273, yymsp[-1].minor.yy192, yymsp[0].minor.yy192); } break; - case 221: /* analyze_opt ::= ANALYZE */ - case 229: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==229); - case 351: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==351); -{ yymsp[0].minor.yy121 = true; } + case 223: /* analyze_opt ::= ANALYZE */ + case 231: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==231); + case 371: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==371); +{ yymsp[0].minor.yy273 = true; } break; - case 222: /* explain_options ::= */ -{ yymsp[1].minor.yy504 = createDefaultExplainOptions(pCxt); } + case 224: /* explain_options ::= */ +{ yymsp[1].minor.yy192 = createDefaultExplainOptions(pCxt); } break; - case 223: /* explain_options ::= explain_options VERBOSE NK_BOOL */ -{ yylhsminor.yy504 = setExplainVerbose(pCxt, yymsp[-2].minor.yy504, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + case 225: /* explain_options ::= explain_options VERBOSE NK_BOOL */ +{ yylhsminor.yy192 = setExplainVerbose(pCxt, yymsp[-2].minor.yy192, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; - case 224: /* explain_options ::= explain_options RATIO NK_FLOAT */ -{ yylhsminor.yy504 = setExplainRatio(pCxt, yymsp[-2].minor.yy504, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + case 226: /* explain_options ::= explain_options RATIO NK_FLOAT */ +{ yylhsminor.yy192 = setExplainRatio(pCxt, yymsp[-2].minor.yy192, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; - case 225: /* cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP */ -{ pCxt->pRootNode = createCompactStmt(pCxt, yymsp[-1].minor.yy488); } + case 227: /* cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP */ +{ pCxt->pRootNode = createCompactStmt(pCxt, yymsp[-1].minor.yy64); } break; - case 226: /* cmd ::= CREATE agg_func_opt FUNCTION function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ -{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-7].minor.yy121, &yymsp[-5].minor.yy409, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy160, yymsp[0].minor.yy452); } + case 228: /* cmd ::= CREATE agg_func_opt FUNCTION function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ +{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-7].minor.yy273, &yymsp[-5].minor.yy353, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy536, yymsp[0].minor.yy116); } break; - case 227: /* cmd ::= DROP FUNCTION function_name */ -{ pCxt->pRootNode = createDropFunctionStmt(pCxt, &yymsp[0].minor.yy409); } + case 229: /* cmd ::= DROP FUNCTION function_name */ +{ pCxt->pRootNode = createDropFunctionStmt(pCxt, &yymsp[0].minor.yy353); } break; - case 230: /* bufsize_opt ::= */ -{ yymsp[1].minor.yy452 = 0; } + case 232: /* bufsize_opt ::= */ +{ yymsp[1].minor.yy116 = 0; } break; - case 231: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ -{ yymsp[-1].minor.yy452 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + case 233: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ +{ yymsp[-1].minor.yy116 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } break; - case 232: /* cmd ::= CREATE STREAM stream_name INTO table_name AS query_expression */ -{ pCxt->pRootNode = createCreateStreamStmt(pCxt, &yymsp[-4].minor.yy409, &yymsp[-2].minor.yy409, yymsp[0].minor.yy504); } + case 234: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options into_opt AS query_expression */ +{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-5].minor.yy273, &yymsp[-4].minor.yy353, yymsp[-3].minor.yy192, yymsp[-2].minor.yy192, yymsp[0].minor.yy192); } break; - case 233: /* cmd ::= DROP STREAM stream_name */ -{ pCxt->pRootNode = createDropStreamStmt(pCxt, &yymsp[0].minor.yy409); } + case 235: /* cmd ::= DROP STREAM exists_opt stream_name */ +{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy273, &yymsp[0].minor.yy353); } break; - case 234: /* cmd ::= KILL CONNECTION NK_INTEGER */ + case 237: /* into_opt ::= INTO full_table_name */ + case 352: /* from_clause ::= FROM table_reference_list */ yytestcase(yyruleno==352); + case 382: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==382); + case 405: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==405); +{ yymsp[-1].minor.yy192 = yymsp[0].minor.yy192; } + break; + case 238: /* stream_options ::= */ +{ yymsp[1].minor.yy192 = createStreamOptions(pCxt); } + break; + case 239: /* stream_options ::= stream_options TRIGGER AT_ONCE */ +{ ((SStreamOptions*)yymsp[-2].minor.yy192)->triggerType = STREAM_TRIGGER_AT_ONCE; yylhsminor.yy192 = yymsp[-2].minor.yy192; } + yymsp[-2].minor.yy192 = yylhsminor.yy192; + break; + case 240: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ +{ ((SStreamOptions*)yymsp[-2].minor.yy192)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; yylhsminor.yy192 = yymsp[-2].minor.yy192; } + yymsp[-2].minor.yy192 = yylhsminor.yy192; + break; + case 241: /* stream_options ::= stream_options WATERMARK duration_literal */ +{ ((SStreamOptions*)yymsp[-2].minor.yy192)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy192); yylhsminor.yy192 = yymsp[-2].minor.yy192; } + yymsp[-2].minor.yy192 = yylhsminor.yy192; + break; + case 242: /* cmd ::= KILL CONNECTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); } break; - case 235: /* cmd ::= KILL QUERY NK_INTEGER */ + case 243: /* cmd ::= KILL QUERY NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_QUERY_STMT, &yymsp[0].minor.yy0); } break; - case 236: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + case 244: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ { pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } break; - case 237: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ -{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy488); } + case 245: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ +{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy64); } break; - case 238: /* cmd ::= SPLIT VGROUP NK_INTEGER */ + case 246: /* cmd ::= SPLIT VGROUP NK_INTEGER */ { pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); } break; - case 239: /* dnode_list ::= DNODE NK_INTEGER */ -{ yymsp[-1].minor.yy488 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + case 247: /* dnode_list ::= DNODE NK_INTEGER */ +{ yymsp[-1].minor.yy64 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } break; - case 241: /* cmd ::= SYNCDB db_name REPLICA */ -{ pCxt->pRootNode = createSyncdbStmt(pCxt, &yymsp[-1].minor.yy409); } + case 249: /* cmd ::= SYNCDB db_name REPLICA */ +{ pCxt->pRootNode = createSyncdbStmt(pCxt, &yymsp[-1].minor.yy353); } break; - case 243: /* literal ::= NK_INTEGER */ -{ yylhsminor.yy504 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy504 = yylhsminor.yy504; + case 251: /* literal ::= NK_INTEGER */ +{ yylhsminor.yy192 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy192 = yylhsminor.yy192; break; - case 244: /* literal ::= NK_FLOAT */ -{ yylhsminor.yy504 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy504 = yylhsminor.yy504; + case 252: /* literal ::= NK_FLOAT */ +{ yylhsminor.yy192 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy192 = yylhsminor.yy192; break; - case 245: /* literal ::= NK_STRING */ -{ yylhsminor.yy504 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy504 = yylhsminor.yy504; + case 253: /* literal ::= NK_STRING */ +{ yylhsminor.yy192 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy192 = yylhsminor.yy192; break; - case 246: /* literal ::= NK_BOOL */ -{ yylhsminor.yy504 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy504 = yylhsminor.yy504; + case 254: /* literal ::= NK_BOOL */ +{ yylhsminor.yy192 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy192 = yylhsminor.yy192; break; - case 247: /* literal ::= TIMESTAMP NK_STRING */ -{ yylhsminor.yy504 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } - yymsp[-1].minor.yy504 = yylhsminor.yy504; + case 255: /* literal ::= TIMESTAMP NK_STRING */ +{ yylhsminor.yy192 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } + yymsp[-1].minor.yy192 = yylhsminor.yy192; break; - case 248: /* literal ::= duration_literal */ - case 257: /* signed_literal ::= signed */ yytestcase(yyruleno==257); - case 277: /* expression ::= literal */ yytestcase(yyruleno==277); - case 278: /* expression ::= pseudo_column */ yytestcase(yyruleno==278); - case 279: /* expression ::= column_reference */ yytestcase(yyruleno==279); - case 283: /* expression ::= subquery */ yytestcase(yyruleno==283); - case 324: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==324); - case 328: /* boolean_primary ::= predicate */ yytestcase(yyruleno==328); - case 330: /* common_expression ::= expression */ yytestcase(yyruleno==330); - case 331: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==331); - case 333: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==333); - case 335: /* table_reference ::= table_primary */ yytestcase(yyruleno==335); - case 336: /* table_reference ::= joined_table */ yytestcase(yyruleno==336); - case 340: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==340); - case 387: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==387); - case 389: /* query_primary ::= query_specification */ yytestcase(yyruleno==389); -{ yylhsminor.yy504 = yymsp[0].minor.yy504; } - yymsp[0].minor.yy504 = yylhsminor.yy504; + case 256: /* literal ::= duration_literal */ + case 266: /* signed_literal ::= signed */ yytestcase(yyruleno==266); + case 284: /* expression ::= literal */ yytestcase(yyruleno==284); + case 285: /* expression ::= pseudo_column */ yytestcase(yyruleno==285); + case 286: /* expression ::= column_reference */ yytestcase(yyruleno==286); + case 287: /* expression ::= function_expression */ yytestcase(yyruleno==287); + case 288: /* expression ::= subquery */ yytestcase(yyruleno==288); + case 344: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==344); + case 348: /* boolean_primary ::= predicate */ yytestcase(yyruleno==348); + case 350: /* common_expression ::= expression */ yytestcase(yyruleno==350); + case 351: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==351); + case 353: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==353); + case 355: /* table_reference ::= table_primary */ yytestcase(yyruleno==355); + case 356: /* table_reference ::= joined_table */ yytestcase(yyruleno==356); + case 360: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==360); + case 407: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==407); + case 409: /* query_primary ::= query_specification */ yytestcase(yyruleno==409); +{ yylhsminor.yy192 = yymsp[0].minor.yy192; } + yymsp[0].minor.yy192 = yylhsminor.yy192; break; - case 249: /* literal ::= NULL */ -{ yylhsminor.yy504 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, NULL)); } - yymsp[0].minor.yy504 = yylhsminor.yy504; + case 257: /* literal ::= NULL */ +{ yylhsminor.yy192 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, NULL)); } + yymsp[0].minor.yy192 = yylhsminor.yy192; break; - case 250: /* duration_literal ::= NK_VARIABLE */ -{ yylhsminor.yy504 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy504 = yylhsminor.yy504; + case 258: /* literal ::= NK_QUESTION */ +{ yylhsminor.yy192 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt)); } + yymsp[0].minor.yy192 = yylhsminor.yy192; break; - case 251: /* signed ::= NK_INTEGER */ -{ yylhsminor.yy504 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy504 = yylhsminor.yy504; + case 259: /* duration_literal ::= NK_VARIABLE */ +{ yylhsminor.yy192 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy192 = yylhsminor.yy192; break; - case 252: /* signed ::= NK_PLUS NK_INTEGER */ -{ yymsp[-1].minor.yy504 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } + case 260: /* signed ::= NK_INTEGER */ +{ yylhsminor.yy192 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy192 = yylhsminor.yy192; break; - case 253: /* signed ::= NK_MINUS NK_INTEGER */ + case 261: /* signed ::= NK_PLUS NK_INTEGER */ +{ yymsp[-1].minor.yy192 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } + break; + case 262: /* 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.yy504 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); + yylhsminor.yy192 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); } - yymsp[-1].minor.yy504 = yylhsminor.yy504; + yymsp[-1].minor.yy192 = yylhsminor.yy192; break; - case 254: /* signed ::= NK_FLOAT */ -{ yylhsminor.yy504 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy504 = yylhsminor.yy504; + case 263: /* signed ::= NK_FLOAT */ +{ yylhsminor.yy192 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy192 = yylhsminor.yy192; break; - case 255: /* signed ::= NK_PLUS NK_FLOAT */ -{ yymsp[-1].minor.yy504 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + case 264: /* signed ::= NK_PLUS NK_FLOAT */ +{ yymsp[-1].minor.yy192 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } break; - case 256: /* signed ::= NK_MINUS NK_FLOAT */ + case 265: /* 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.yy504 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); + yylhsminor.yy192 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); } - yymsp[-1].minor.yy504 = yylhsminor.yy504; + yymsp[-1].minor.yy192 = yylhsminor.yy192; break; - case 258: /* signed_literal ::= NK_STRING */ -{ yylhsminor.yy504 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy504 = yylhsminor.yy504; + case 267: /* signed_literal ::= NK_STRING */ +{ yylhsminor.yy192 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy192 = yylhsminor.yy192; break; - case 259: /* signed_literal ::= NK_BOOL */ -{ yylhsminor.yy504 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy504 = yylhsminor.yy504; + case 268: /* signed_literal ::= NK_BOOL */ +{ yylhsminor.yy192 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy192 = yylhsminor.yy192; break; - case 260: /* signed_literal ::= TIMESTAMP NK_STRING */ -{ yymsp[-1].minor.yy504 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } + case 269: /* signed_literal ::= TIMESTAMP NK_STRING */ +{ yymsp[-1].minor.yy192 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } break; - case 261: /* signed_literal ::= duration_literal */ - case 357: /* select_item ::= common_expression */ yytestcase(yyruleno==357); - case 401: /* search_condition ::= common_expression */ yytestcase(yyruleno==401); -{ yylhsminor.yy504 = releaseRawExprNode(pCxt, yymsp[0].minor.yy504); } - yymsp[0].minor.yy504 = yylhsminor.yy504; + case 270: /* signed_literal ::= duration_literal */ + case 322: /* star_func_para ::= expression */ yytestcase(yyruleno==322); + case 377: /* select_item ::= common_expression */ yytestcase(yyruleno==377); + case 421: /* search_condition ::= common_expression */ yytestcase(yyruleno==421); +{ yylhsminor.yy192 = releaseRawExprNode(pCxt, yymsp[0].minor.yy192); } + yymsp[0].minor.yy192 = yylhsminor.yy192; break; - case 262: /* signed_literal ::= NULL */ -{ yymsp[0].minor.yy504 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, NULL); } + case 271: /* signed_literal ::= NULL */ +{ yymsp[0].minor.yy192 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, NULL); } break; - case 280: /* expression ::= function_name NK_LP expression_list NK_RP */ -{ yylhsminor.yy504 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy409, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy409, yymsp[-1].minor.yy488)); } - yymsp[-3].minor.yy504 = yylhsminor.yy504; + case 289: /* expression ::= NK_LP expression NK_RP */ + case 349: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==349); +{ yylhsminor.yy192 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy192)); } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; - case 281: /* expression ::= function_name NK_LP NK_STAR NK_RP */ -{ yylhsminor.yy504 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy409, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy409, createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy0)))); } - yymsp[-3].minor.yy504 = yylhsminor.yy504; - break; - case 282: /* expression ::= CAST NK_LP expression AS type_name NK_RP */ -{ yylhsminor.yy504 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy504), yymsp[-1].minor.yy160)); } - yymsp[-5].minor.yy504 = yylhsminor.yy504; - break; - case 284: /* expression ::= NK_LP expression NK_RP */ - case 329: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==329); -{ yylhsminor.yy504 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy504)); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; - break; - case 285: /* expression ::= NK_PLUS expression */ + case 290: /* expression ::= NK_PLUS expression */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy504); - yylhsminor.yy504 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy504)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy192); + yylhsminor.yy192 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy192)); } - yymsp[-1].minor.yy504 = yylhsminor.yy504; + yymsp[-1].minor.yy192 = yylhsminor.yy192; break; - case 286: /* expression ::= NK_MINUS expression */ + case 291: /* expression ::= NK_MINUS expression */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy504); - yylhsminor.yy504 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy504), NULL)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy192); + yylhsminor.yy192 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy192), NULL)); } - yymsp[-1].minor.yy504 = yylhsminor.yy504; + yymsp[-1].minor.yy192 = yylhsminor.yy192; break; - case 287: /* expression ::= expression NK_PLUS expression */ + case 292: /* expression ::= expression NK_PLUS expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy504); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy504); - yylhsminor.yy504 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy504), releaseRawExprNode(pCxt, yymsp[0].minor.yy504))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy192); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy192); + yylhsminor.yy192 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy192), releaseRawExprNode(pCxt, yymsp[0].minor.yy192))); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; - case 288: /* expression ::= expression NK_MINUS expression */ + case 293: /* expression ::= expression NK_MINUS expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy504); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy504); - yylhsminor.yy504 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy504), releaseRawExprNode(pCxt, yymsp[0].minor.yy504))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy192); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy192); + yylhsminor.yy192 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy192), releaseRawExprNode(pCxt, yymsp[0].minor.yy192))); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; - case 289: /* expression ::= expression NK_STAR expression */ + case 294: /* expression ::= expression NK_STAR expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy504); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy504); - yylhsminor.yy504 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy504), releaseRawExprNode(pCxt, yymsp[0].minor.yy504))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy192); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy192); + yylhsminor.yy192 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy192), releaseRawExprNode(pCxt, yymsp[0].minor.yy192))); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; - case 290: /* expression ::= expression NK_SLASH expression */ + case 295: /* expression ::= expression NK_SLASH expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy504); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy504); - yylhsminor.yy504 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy504), releaseRawExprNode(pCxt, yymsp[0].minor.yy504))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy192); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy192); + yylhsminor.yy192 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy192), releaseRawExprNode(pCxt, yymsp[0].minor.yy192))); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; - case 291: /* expression ::= expression NK_REM expression */ + case 296: /* expression ::= expression NK_REM expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy504); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy504); - yylhsminor.yy504 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MOD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy504), releaseRawExprNode(pCxt, yymsp[0].minor.yy504))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy192); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy192); + yylhsminor.yy192 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MOD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy192), releaseRawExprNode(pCxt, yymsp[0].minor.yy192))); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; - case 292: /* expression_list ::= expression */ -{ yylhsminor.yy488 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy504)); } - yymsp[0].minor.yy488 = yylhsminor.yy488; - break; - case 293: /* expression_list ::= expression_list NK_COMMA expression */ -{ yylhsminor.yy488 = addNodeToList(pCxt, yymsp[-2].minor.yy488, releaseRawExprNode(pCxt, yymsp[0].minor.yy504)); } - yymsp[-2].minor.yy488 = yylhsminor.yy488; - break; - case 294: /* column_reference ::= column_name */ -{ yylhsminor.yy504 = createRawExprNode(pCxt, &yymsp[0].minor.yy409, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy409)); } - yymsp[0].minor.yy504 = yylhsminor.yy504; - break; - case 295: /* column_reference ::= table_name NK_DOT column_name */ -{ yylhsminor.yy504 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy409, &yymsp[0].minor.yy409, createColumnNode(pCxt, &yymsp[-2].minor.yy409, &yymsp[0].minor.yy409)); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; - break; - case 296: /* pseudo_column ::= NOW */ - case 297: /* pseudo_column ::= TODAY */ yytestcase(yyruleno==297); - case 298: /* pseudo_column ::= ROWTS */ yytestcase(yyruleno==298); - case 299: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==299); - case 300: /* pseudo_column ::= QSTARTTS */ yytestcase(yyruleno==300); - case 301: /* pseudo_column ::= QENDTS */ yytestcase(yyruleno==301); - case 302: /* pseudo_column ::= WSTARTTS */ yytestcase(yyruleno==302); - case 303: /* pseudo_column ::= WENDTS */ yytestcase(yyruleno==303); - case 304: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==304); -{ yylhsminor.yy504 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } - yymsp[0].minor.yy504 = yylhsminor.yy504; - break; - case 305: /* predicate ::= expression compare_op expression */ - case 310: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==310); + case 297: /* expression ::= column_reference NK_ARROW NK_STRING */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy504); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy504); - yylhsminor.yy504 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy84, releaseRawExprNode(pCxt, yymsp[-2].minor.yy504), releaseRawExprNode(pCxt, yymsp[0].minor.yy504))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy192); + yylhsminor.yy192 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy192), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; - case 306: /* predicate ::= expression BETWEEN expression AND expression */ + case 298: /* expression_list ::= expression */ +{ yylhsminor.yy64 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy192)); } + yymsp[0].minor.yy64 = yylhsminor.yy64; + break; + case 299: /* expression_list ::= expression_list NK_COMMA expression */ +{ yylhsminor.yy64 = addNodeToList(pCxt, yymsp[-2].minor.yy64, releaseRawExprNode(pCxt, yymsp[0].minor.yy192)); } + yymsp[-2].minor.yy64 = yylhsminor.yy64; + break; + case 300: /* column_reference ::= column_name */ +{ yylhsminor.yy192 = createRawExprNode(pCxt, &yymsp[0].minor.yy353, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy353)); } + yymsp[0].minor.yy192 = yylhsminor.yy192; + break; + case 301: /* column_reference ::= table_name NK_DOT column_name */ +{ yylhsminor.yy192 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy353, &yymsp[0].minor.yy353, createColumnNode(pCxt, &yymsp[-2].minor.yy353, &yymsp[0].minor.yy353)); } + yymsp[-2].minor.yy192 = yylhsminor.yy192; + break; + case 302: /* pseudo_column ::= NOW */ + case 303: /* pseudo_column ::= TODAY */ yytestcase(yyruleno==303); + case 304: /* pseudo_column ::= ROWTS */ yytestcase(yyruleno==304); + case 305: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==305); + case 306: /* pseudo_column ::= QSTARTTS */ yytestcase(yyruleno==306); + case 307: /* pseudo_column ::= QENDTS */ yytestcase(yyruleno==307); + case 308: /* pseudo_column ::= WSTARTTS */ yytestcase(yyruleno==308); + case 309: /* pseudo_column ::= WENDTS */ yytestcase(yyruleno==309); + case 310: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==310); +{ yylhsminor.yy192 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } + yymsp[0].minor.yy192 = yylhsminor.yy192; + break; + case 311: /* function_expression ::= function_name NK_LP expression_list NK_RP */ + case 312: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==312); +{ yylhsminor.yy192 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy353, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy353, yymsp[-1].minor.yy64)); } + yymsp[-3].minor.yy192 = yylhsminor.yy192; + break; + case 313: /* function_expression ::= CAST NK_LP expression AS type_name NK_RP */ +{ yylhsminor.yy192 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy192), yymsp[-1].minor.yy536)); } + yymsp[-5].minor.yy192 = yylhsminor.yy192; + break; + case 318: /* star_func_para_list ::= NK_STAR */ +{ yylhsminor.yy64 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy64 = yylhsminor.yy64; + break; + case 323: /* star_func_para ::= table_name NK_DOT NK_STAR */ + case 380: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==380); +{ yylhsminor.yy192 = createColumnNode(pCxt, &yymsp[-2].minor.yy353, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy192 = yylhsminor.yy192; + break; + case 324: /* predicate ::= expression compare_op expression */ + case 329: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==329); { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy504); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy504); - yylhsminor.yy504 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy504), releaseRawExprNode(pCxt, yymsp[-2].minor.yy504), releaseRawExprNode(pCxt, yymsp[0].minor.yy504))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy192); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy192); + yylhsminor.yy192 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy412, releaseRawExprNode(pCxt, yymsp[-2].minor.yy192), releaseRawExprNode(pCxt, yymsp[0].minor.yy192))); } - yymsp[-4].minor.yy504 = yylhsminor.yy504; + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; - case 307: /* predicate ::= expression NOT BETWEEN expression AND expression */ + case 325: /* predicate ::= expression BETWEEN expression AND expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy504); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy504); - yylhsminor.yy504 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy504), releaseRawExprNode(pCxt, yymsp[-5].minor.yy504), releaseRawExprNode(pCxt, yymsp[0].minor.yy504))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy192); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy192); + yylhsminor.yy192 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy192), releaseRawExprNode(pCxt, yymsp[-2].minor.yy192), releaseRawExprNode(pCxt, yymsp[0].minor.yy192))); } - yymsp[-5].minor.yy504 = yylhsminor.yy504; + yymsp[-4].minor.yy192 = yylhsminor.yy192; break; - case 308: /* predicate ::= expression IS NULL */ + case 326: /* predicate ::= expression NOT BETWEEN expression AND expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy504); - yylhsminor.yy504 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy504), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy192); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy192); + yylhsminor.yy192 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy192), releaseRawExprNode(pCxt, yymsp[-5].minor.yy192), releaseRawExprNode(pCxt, yymsp[0].minor.yy192))); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + yymsp[-5].minor.yy192 = yylhsminor.yy192; break; - case 309: /* predicate ::= expression IS NOT NULL */ + case 327: /* predicate ::= expression IS NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy504); - yylhsminor.yy504 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy504), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy192); + yylhsminor.yy192 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy192), NULL)); } - yymsp[-3].minor.yy504 = yylhsminor.yy504; + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; - case 311: /* compare_op ::= NK_LT */ -{ yymsp[0].minor.yy84 = OP_TYPE_LOWER_THAN; } - break; - case 312: /* compare_op ::= NK_GT */ -{ yymsp[0].minor.yy84 = OP_TYPE_GREATER_THAN; } - break; - case 313: /* compare_op ::= NK_LE */ -{ yymsp[0].minor.yy84 = OP_TYPE_LOWER_EQUAL; } - break; - case 314: /* compare_op ::= NK_GE */ -{ yymsp[0].minor.yy84 = OP_TYPE_GREATER_EQUAL; } - break; - case 315: /* compare_op ::= NK_NE */ -{ yymsp[0].minor.yy84 = OP_TYPE_NOT_EQUAL; } - break; - case 316: /* compare_op ::= NK_EQ */ -{ yymsp[0].minor.yy84 = OP_TYPE_EQUAL; } - break; - case 317: /* compare_op ::= LIKE */ -{ yymsp[0].minor.yy84 = OP_TYPE_LIKE; } - break; - case 318: /* compare_op ::= NOT LIKE */ -{ yymsp[-1].minor.yy84 = OP_TYPE_NOT_LIKE; } - break; - case 319: /* compare_op ::= MATCH */ -{ yymsp[0].minor.yy84 = OP_TYPE_MATCH; } - break; - case 320: /* compare_op ::= NMATCH */ -{ yymsp[0].minor.yy84 = OP_TYPE_NMATCH; } - break; - case 321: /* in_op ::= IN */ -{ yymsp[0].minor.yy84 = OP_TYPE_IN; } - break; - case 322: /* in_op ::= NOT IN */ -{ yymsp[-1].minor.yy84 = OP_TYPE_NOT_IN; } - break; - case 323: /* in_predicate_value ::= NK_LP expression_list NK_RP */ -{ yylhsminor.yy504 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy488)); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; - break; - case 325: /* boolean_value_expression ::= NOT boolean_primary */ + case 328: /* predicate ::= expression IS NOT NULL */ { - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy504); - yylhsminor.yy504 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy504), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy192); + yylhsminor.yy192 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy192), NULL)); } - yymsp[-1].minor.yy504 = yylhsminor.yy504; + yymsp[-3].minor.yy192 = yylhsminor.yy192; break; - case 326: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + case 330: /* compare_op ::= NK_LT */ +{ yymsp[0].minor.yy412 = OP_TYPE_LOWER_THAN; } + break; + case 331: /* compare_op ::= NK_GT */ +{ yymsp[0].minor.yy412 = OP_TYPE_GREATER_THAN; } + break; + case 332: /* compare_op ::= NK_LE */ +{ yymsp[0].minor.yy412 = OP_TYPE_LOWER_EQUAL; } + break; + case 333: /* compare_op ::= NK_GE */ +{ yymsp[0].minor.yy412 = OP_TYPE_GREATER_EQUAL; } + break; + case 334: /* compare_op ::= NK_NE */ +{ yymsp[0].minor.yy412 = OP_TYPE_NOT_EQUAL; } + break; + case 335: /* compare_op ::= NK_EQ */ +{ yymsp[0].minor.yy412 = OP_TYPE_EQUAL; } + break; + case 336: /* compare_op ::= LIKE */ +{ yymsp[0].minor.yy412 = OP_TYPE_LIKE; } + break; + case 337: /* compare_op ::= NOT LIKE */ +{ yymsp[-1].minor.yy412 = OP_TYPE_NOT_LIKE; } + break; + case 338: /* compare_op ::= MATCH */ +{ yymsp[0].minor.yy412 = OP_TYPE_MATCH; } + break; + case 339: /* compare_op ::= NMATCH */ +{ yymsp[0].minor.yy412 = OP_TYPE_NMATCH; } + break; + case 340: /* compare_op ::= CONTAINS */ +{ yymsp[0].minor.yy412 = OP_TYPE_JSON_CONTAINS; } + break; + case 341: /* in_op ::= IN */ +{ yymsp[0].minor.yy412 = OP_TYPE_IN; } + break; + case 342: /* in_op ::= NOT IN */ +{ yymsp[-1].minor.yy412 = OP_TYPE_NOT_IN; } + break; + case 343: /* in_predicate_value ::= NK_LP expression_list NK_RP */ +{ yylhsminor.yy192 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy64)); } + yymsp[-2].minor.yy192 = yylhsminor.yy192; + break; + case 345: /* boolean_value_expression ::= NOT boolean_primary */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy504); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy504); - yylhsminor.yy504 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy504), releaseRawExprNode(pCxt, yymsp[0].minor.yy504))); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy192); + yylhsminor.yy192 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy192), NULL)); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + yymsp[-1].minor.yy192 = yylhsminor.yy192; break; - case 327: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + case 346: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy504); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy504); - yylhsminor.yy504 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy504), releaseRawExprNode(pCxt, yymsp[0].minor.yy504))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy192); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy192); + yylhsminor.yy192 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy192), releaseRawExprNode(pCxt, yymsp[0].minor.yy192))); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; - case 332: /* from_clause ::= FROM table_reference_list */ - case 362: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==362); - case 385: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==385); -{ yymsp[-1].minor.yy504 = yymsp[0].minor.yy504; } + case 347: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ +{ + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy192); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy192); + yylhsminor.yy192 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy192), releaseRawExprNode(pCxt, yymsp[0].minor.yy192))); + } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; - case 334: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ -{ yylhsminor.yy504 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy504, yymsp[0].minor.yy504, NULL); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + case 354: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ +{ yylhsminor.yy192 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy192, yymsp[0].minor.yy192, NULL); } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; - case 337: /* table_primary ::= table_name alias_opt */ -{ yylhsminor.yy504 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy409, &yymsp[0].minor.yy409); } - yymsp[-1].minor.yy504 = yylhsminor.yy504; + case 357: /* table_primary ::= table_name alias_opt */ +{ yylhsminor.yy192 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy353, &yymsp[0].minor.yy353); } + yymsp[-1].minor.yy192 = yylhsminor.yy192; break; - case 338: /* table_primary ::= db_name NK_DOT table_name alias_opt */ -{ yylhsminor.yy504 = createRealTableNode(pCxt, &yymsp[-3].minor.yy409, &yymsp[-1].minor.yy409, &yymsp[0].minor.yy409); } - yymsp[-3].minor.yy504 = yylhsminor.yy504; + case 358: /* table_primary ::= db_name NK_DOT table_name alias_opt */ +{ yylhsminor.yy192 = createRealTableNode(pCxt, &yymsp[-3].minor.yy353, &yymsp[-1].minor.yy353, &yymsp[0].minor.yy353); } + yymsp[-3].minor.yy192 = yylhsminor.yy192; break; - case 339: /* table_primary ::= subquery alias_opt */ -{ yylhsminor.yy504 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy504), &yymsp[0].minor.yy409); } - yymsp[-1].minor.yy504 = yylhsminor.yy504; + case 359: /* table_primary ::= subquery alias_opt */ +{ yylhsminor.yy192 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy192), &yymsp[0].minor.yy353); } + yymsp[-1].minor.yy192 = yylhsminor.yy192; break; - case 341: /* alias_opt ::= */ -{ yymsp[1].minor.yy409 = nil_token; } + case 361: /* alias_opt ::= */ +{ yymsp[1].minor.yy353 = nil_token; } break; - case 342: /* alias_opt ::= table_alias */ -{ yylhsminor.yy409 = yymsp[0].minor.yy409; } - yymsp[0].minor.yy409 = yylhsminor.yy409; + case 362: /* alias_opt ::= table_alias */ +{ yylhsminor.yy353 = yymsp[0].minor.yy353; } + yymsp[0].minor.yy353 = yylhsminor.yy353; break; - case 343: /* alias_opt ::= AS table_alias */ -{ yymsp[-1].minor.yy409 = yymsp[0].minor.yy409; } + case 363: /* alias_opt ::= AS table_alias */ +{ yymsp[-1].minor.yy353 = yymsp[0].minor.yy353; } break; - case 344: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - case 345: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==345); -{ yymsp[-2].minor.yy504 = yymsp[-1].minor.yy504; } + case 364: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + case 365: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==365); +{ yymsp[-2].minor.yy192 = yymsp[-1].minor.yy192; } break; - case 346: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ -{ yylhsminor.yy504 = createJoinTableNode(pCxt, yymsp[-4].minor.yy556, yymsp[-5].minor.yy504, yymsp[-2].minor.yy504, yymsp[0].minor.yy504); } - yymsp[-5].minor.yy504 = yylhsminor.yy504; + case 366: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ +{ yylhsminor.yy192 = createJoinTableNode(pCxt, yymsp[-4].minor.yy372, yymsp[-5].minor.yy192, yymsp[-2].minor.yy192, yymsp[0].minor.yy192); } + yymsp[-5].minor.yy192 = yylhsminor.yy192; break; - case 347: /* join_type ::= */ -{ yymsp[1].minor.yy556 = JOIN_TYPE_INNER; } + case 367: /* join_type ::= */ +{ yymsp[1].minor.yy372 = JOIN_TYPE_INNER; } break; - case 348: /* join_type ::= INNER */ -{ yymsp[0].minor.yy556 = JOIN_TYPE_INNER; } + case 368: /* join_type ::= INNER */ +{ yymsp[0].minor.yy372 = JOIN_TYPE_INNER; } break; - case 349: /* 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 369: /* 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.yy504 = createSelectStmt(pCxt, yymsp[-7].minor.yy121, yymsp[-6].minor.yy488, yymsp[-5].minor.yy504); - yymsp[-8].minor.yy504 = addWhereClause(pCxt, yymsp[-8].minor.yy504, yymsp[-4].minor.yy504); - yymsp[-8].minor.yy504 = addPartitionByClause(pCxt, yymsp[-8].minor.yy504, yymsp[-3].minor.yy488); - yymsp[-8].minor.yy504 = addWindowClauseClause(pCxt, yymsp[-8].minor.yy504, yymsp[-2].minor.yy504); - yymsp[-8].minor.yy504 = addGroupByClause(pCxt, yymsp[-8].minor.yy504, yymsp[-1].minor.yy488); - yymsp[-8].minor.yy504 = addHavingClause(pCxt, yymsp[-8].minor.yy504, yymsp[0].minor.yy504); + yymsp[-8].minor.yy192 = createSelectStmt(pCxt, yymsp[-7].minor.yy273, yymsp[-6].minor.yy64, yymsp[-5].minor.yy192); + yymsp[-8].minor.yy192 = addWhereClause(pCxt, yymsp[-8].minor.yy192, yymsp[-4].minor.yy192); + yymsp[-8].minor.yy192 = addPartitionByClause(pCxt, yymsp[-8].minor.yy192, yymsp[-3].minor.yy64); + yymsp[-8].minor.yy192 = addWindowClauseClause(pCxt, yymsp[-8].minor.yy192, yymsp[-2].minor.yy192); + yymsp[-8].minor.yy192 = addGroupByClause(pCxt, yymsp[-8].minor.yy192, yymsp[-1].minor.yy64); + yymsp[-8].minor.yy192 = addHavingClause(pCxt, yymsp[-8].minor.yy192, yymsp[0].minor.yy192); } break; - case 352: /* set_quantifier_opt ::= ALL */ -{ yymsp[0].minor.yy121 = false; } + case 372: /* set_quantifier_opt ::= ALL */ +{ yymsp[0].minor.yy273 = false; } break; - case 353: /* select_list ::= NK_STAR */ -{ yymsp[0].minor.yy488 = NULL; } + case 373: /* select_list ::= NK_STAR */ +{ yymsp[0].minor.yy64 = NULL; } break; - case 358: /* select_item ::= common_expression column_alias */ -{ yylhsminor.yy504 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy504), &yymsp[0].minor.yy409); } - yymsp[-1].minor.yy504 = yylhsminor.yy504; + case 378: /* select_item ::= common_expression column_alias */ +{ yylhsminor.yy192 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy192), &yymsp[0].minor.yy353); } + yymsp[-1].minor.yy192 = yylhsminor.yy192; break; - case 359: /* select_item ::= common_expression AS column_alias */ -{ yylhsminor.yy504 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy504), &yymsp[0].minor.yy409); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + case 379: /* select_item ::= common_expression AS column_alias */ +{ yylhsminor.yy192 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy192), &yymsp[0].minor.yy353); } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; - case 360: /* select_item ::= table_name NK_DOT NK_STAR */ -{ yylhsminor.yy504 = createColumnNode(pCxt, &yymsp[-2].minor.yy409, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + case 384: /* partition_by_clause_opt ::= PARTITION BY expression_list */ + case 401: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==401); + case 411: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==411); +{ yymsp[-2].minor.yy64 = yymsp[0].minor.yy64; } break; - case 364: /* partition_by_clause_opt ::= PARTITION BY expression_list */ - case 381: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==381); - case 391: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==391); -{ yymsp[-2].minor.yy488 = yymsp[0].minor.yy488; } + case 386: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ +{ yymsp[-5].minor.yy192 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy192), releaseRawExprNode(pCxt, yymsp[-1].minor.yy192)); } break; - case 366: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ -{ yymsp[-5].minor.yy504 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy504), releaseRawExprNode(pCxt, yymsp[-1].minor.yy504)); } + case 387: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ +{ yymsp[-3].minor.yy192 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy192)); } break; - case 367: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ -{ yymsp[-3].minor.yy504 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy504)); } + case 388: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-5].minor.yy192 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy192), NULL, yymsp[-1].minor.yy192, yymsp[0].minor.yy192); } break; - case 368: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-5].minor.yy504 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy504), NULL, yymsp[-1].minor.yy504, yymsp[0].minor.yy504); } + case 389: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-7].minor.yy192 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy192), releaseRawExprNode(pCxt, yymsp[-3].minor.yy192), yymsp[-1].minor.yy192, yymsp[0].minor.yy192); } break; - case 369: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-7].minor.yy504 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy504), releaseRawExprNode(pCxt, yymsp[-3].minor.yy504), yymsp[-1].minor.yy504, yymsp[0].minor.yy504); } + case 391: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ +{ yymsp[-3].minor.yy192 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy192); } break; - case 371: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ -{ yymsp[-3].minor.yy504 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy504); } + case 393: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ +{ yymsp[-3].minor.yy192 = createFillNode(pCxt, yymsp[-1].minor.yy358, NULL); } break; - case 373: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ -{ yymsp[-3].minor.yy504 = createFillNode(pCxt, yymsp[-1].minor.yy22, NULL); } + case 394: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ +{ yymsp[-5].minor.yy192 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy64)); } break; - case 374: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ -{ yymsp[-5].minor.yy504 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy488)); } + case 395: /* fill_mode ::= NONE */ +{ yymsp[0].minor.yy358 = FILL_MODE_NONE; } break; - case 375: /* fill_mode ::= NONE */ -{ yymsp[0].minor.yy22 = FILL_MODE_NONE; } + case 396: /* fill_mode ::= PREV */ +{ yymsp[0].minor.yy358 = FILL_MODE_PREV; } break; - case 376: /* fill_mode ::= PREV */ -{ yymsp[0].minor.yy22 = FILL_MODE_PREV; } + case 397: /* fill_mode ::= NULL */ +{ yymsp[0].minor.yy358 = FILL_MODE_NULL; } break; - case 377: /* fill_mode ::= NULL */ -{ yymsp[0].minor.yy22 = FILL_MODE_NULL; } + case 398: /* fill_mode ::= LINEAR */ +{ yymsp[0].minor.yy358 = FILL_MODE_LINEAR; } break; - case 378: /* fill_mode ::= LINEAR */ -{ yymsp[0].minor.yy22 = FILL_MODE_LINEAR; } + case 399: /* fill_mode ::= NEXT */ +{ yymsp[0].minor.yy358 = FILL_MODE_NEXT; } break; - case 379: /* fill_mode ::= NEXT */ -{ yymsp[0].minor.yy22 = FILL_MODE_NEXT; } + case 402: /* group_by_list ::= expression */ +{ yylhsminor.yy64 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy192))); } + yymsp[0].minor.yy64 = yylhsminor.yy64; break; - case 382: /* group_by_list ::= expression */ -{ yylhsminor.yy488 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy504))); } - yymsp[0].minor.yy488 = yylhsminor.yy488; + case 403: /* group_by_list ::= group_by_list NK_COMMA expression */ +{ yylhsminor.yy64 = addNodeToList(pCxt, yymsp[-2].minor.yy64, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy192))); } + yymsp[-2].minor.yy64 = yylhsminor.yy64; break; - case 383: /* group_by_list ::= group_by_list NK_COMMA expression */ -{ yylhsminor.yy488 = addNodeToList(pCxt, yymsp[-2].minor.yy488, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy504))); } - yymsp[-2].minor.yy488 = yylhsminor.yy488; - break; - case 386: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ + case 406: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ { - yylhsminor.yy504 = addOrderByClause(pCxt, yymsp[-3].minor.yy504, yymsp[-2].minor.yy488); - yylhsminor.yy504 = addSlimitClause(pCxt, yylhsminor.yy504, yymsp[-1].minor.yy504); - yylhsminor.yy504 = addLimitClause(pCxt, yylhsminor.yy504, yymsp[0].minor.yy504); + yylhsminor.yy192 = addOrderByClause(pCxt, yymsp[-3].minor.yy192, yymsp[-2].minor.yy64); + yylhsminor.yy192 = addSlimitClause(pCxt, yylhsminor.yy192, yymsp[-1].minor.yy192); + yylhsminor.yy192 = addLimitClause(pCxt, yylhsminor.yy192, yymsp[0].minor.yy192); } - yymsp[-3].minor.yy504 = yylhsminor.yy504; + yymsp[-3].minor.yy192 = yylhsminor.yy192; break; - case 388: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */ -{ yylhsminor.yy504 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy504, yymsp[0].minor.yy504); } - yymsp[-3].minor.yy504 = yylhsminor.yy504; + case 408: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */ +{ yylhsminor.yy192 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy192, yymsp[0].minor.yy192); } + yymsp[-3].minor.yy192 = yylhsminor.yy192; break; - case 393: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ - case 397: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==397); -{ yymsp[-1].minor.yy504 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } + case 413: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ + case 417: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==417); +{ yymsp[-1].minor.yy192 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } break; - case 394: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - case 398: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==398); -{ yymsp[-3].minor.yy504 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } + case 414: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + case 418: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==418); +{ yymsp[-3].minor.yy192 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } break; - case 395: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - case 399: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==399); -{ yymsp[-3].minor.yy504 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } + case 415: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + case 419: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==419); +{ yymsp[-3].minor.yy192 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } break; - case 400: /* subquery ::= NK_LP query_expression NK_RP */ -{ yylhsminor.yy504 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy504); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + case 420: /* subquery ::= NK_LP query_expression NK_RP */ +{ yylhsminor.yy192 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy192); } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; - case 404: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */ -{ yylhsminor.yy504 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy504), yymsp[-1].minor.yy522, yymsp[0].minor.yy281); } - yymsp[-2].minor.yy504 = yylhsminor.yy504; + case 424: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */ +{ yylhsminor.yy192 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy192), yymsp[-1].minor.yy530, yymsp[0].minor.yy225); } + yymsp[-2].minor.yy192 = yylhsminor.yy192; break; - case 405: /* ordering_specification_opt ::= */ -{ yymsp[1].minor.yy522 = ORDER_ASC; } + case 425: /* ordering_specification_opt ::= */ +{ yymsp[1].minor.yy530 = ORDER_ASC; } break; - case 406: /* ordering_specification_opt ::= ASC */ -{ yymsp[0].minor.yy522 = ORDER_ASC; } + case 426: /* ordering_specification_opt ::= ASC */ +{ yymsp[0].minor.yy530 = ORDER_ASC; } break; - case 407: /* ordering_specification_opt ::= DESC */ -{ yymsp[0].minor.yy522 = ORDER_DESC; } + case 427: /* ordering_specification_opt ::= DESC */ +{ yymsp[0].minor.yy530 = ORDER_DESC; } break; - case 408: /* null_ordering_opt ::= */ -{ yymsp[1].minor.yy281 = NULL_ORDER_DEFAULT; } + case 428: /* null_ordering_opt ::= */ +{ yymsp[1].minor.yy225 = NULL_ORDER_DEFAULT; } break; - case 409: /* null_ordering_opt ::= NULLS FIRST */ -{ yymsp[-1].minor.yy281 = NULL_ORDER_FIRST; } + case 429: /* null_ordering_opt ::= NULLS FIRST */ +{ yymsp[-1].minor.yy225 = NULL_ORDER_FIRST; } break; - case 410: /* null_ordering_opt ::= NULLS LAST */ -{ yymsp[-1].minor.yy281 = NULL_ORDER_LAST; } + case 430: /* null_ordering_opt ::= NULLS LAST */ +{ yymsp[-1].minor.yy225 = NULL_ORDER_LAST; } break; default: break; diff --git a/source/libs/parser/test/parserAstTest.cpp b/source/libs/parser/test/parserAstTest.cpp index 149c317bd4..5fc4e777c1 100644 --- a/source/libs/parser/test/parserAstTest.cpp +++ b/source/libs/parser/test/parserAstTest.cpp @@ -18,6 +18,7 @@ #include +#include "parserTestUtil.h" #include "parInt.h" using namespace std; @@ -44,7 +45,7 @@ protected: query_ = nullptr; bool res = runImpl(parseCode, translateCode); qDestroyQuery(query_); - if (1/*!res*/) { + if (!res || g_isDump) { dump(); } return res; @@ -57,7 +58,7 @@ private: int32_t code = parse(&cxt_, &query_); if (code != TSDB_CODE_SUCCESS) { parseErrStr_ = string("code:") + tstrerror(code) + string(", msg:") + errMagBuf_; - return (terrno == parseCode); + return (code == parseCode); } if (TSDB_CODE_SUCCESS != parseCode) { return false; @@ -66,7 +67,7 @@ private: code = translate(&cxt_, query_); if (code != TSDB_CODE_SUCCESS) { translateErrStr_ = string("code:") + tstrerror(code) + string(", msg:") + errMagBuf_; - return (terrno == translateCode); + return (code == translateCode); } translatedAstStr_ = toString(query_->pRoot); code = calculateConstant(&cxt_, query_); @@ -243,6 +244,19 @@ TEST_F(ParserTest, selectPseudoColumn) { ASSERT_TRUE(run()); } +TEST_F(ParserTest, selectMultiResFunc) { + setDatabase("root", "test"); + + // bind("SELECT last(*), first(*), last_row(*) FROM t1"); + // ASSERT_TRUE(run()); + + bind("SELECT last(c1, c2), first(t1.*), last_row(c3) FROM t1"); + ASSERT_TRUE(run()); + + bind("SELECT last(t2.*), first(t1.c1, t2.*), last_row(t1.*, t2.*) FROM st1s1 t1, st1s2 t2 where t1.ts = t2.ts"); + ASSERT_TRUE(run()); +} + TEST_F(ParserTest, selectClause) { setDatabase("root", "test"); @@ -726,6 +740,22 @@ TEST_F(ParserTest, dropTopic) { ASSERT_TRUE(run()); } +TEST_F(ParserTest, createStream) { + setDatabase("root", "test"); + + bind("create stream s1 as select * from t1"); + ASSERT_TRUE(run()); + + bind("create stream if not exists s1 as select * from t1"); + ASSERT_TRUE(run()); + + bind("create stream s1 into st1 as select * from t1"); + ASSERT_TRUE(run()); + + bind("create stream if not exists s1 trigger window_close watermark 10s into st1 as select * from t1"); + ASSERT_TRUE(run()); +} + TEST_F(ParserTest, explain) { setDatabase("root", "test"); diff --git a/source/libs/parser/test/parserTestMain.cpp b/source/libs/parser/test/parserTestMain.cpp index 9a9711ca96..8cd69418b9 100644 --- a/source/libs/parser/test/parserTestMain.cpp +++ b/source/libs/parser/test/parserTestMain.cpp @@ -15,12 +15,16 @@ #include +#include #include #include "mockCatalog.h" +#include "parserTestUtil.h" #include "parToken.h" #include "functionMgt.h" +bool g_isDump = false; + class ParserEnv : public testing::Environment { public: virtual void SetUp() { @@ -38,8 +42,27 @@ public: virtual ~ParserEnv() {} }; +static void parseArg(int argc, char* argv[]) { + int opt = 0; + const char *optstring = ""; + static struct option long_options[] = { + {"dump", no_argument, NULL, 'd'}, + {0, 0, 0, 0} + }; + while ((opt = getopt_long(argc, argv, optstring, long_options, NULL)) != -1) { + switch (opt) { + case 'd': + g_isDump = true; + break; + default: + break; + } + } +} + int main(int argc, char* argv[]) { testing::AddGlobalTestEnvironment(new ParserEnv()); testing::InitGoogleTest(&argc, argv); + parseArg(argc, argv); return RUN_ALL_TESTS(); } diff --git a/source/libs/parser/test/parserTestUtil.h b/source/libs/parser/test/parserTestUtil.h new file mode 100644 index 0000000000..f5efed50a8 --- /dev/null +++ b/source/libs/parser/test/parserTestUtil.h @@ -0,0 +1,16 @@ +/* + * 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 . + */ + +extern bool g_isDump; \ No newline at end of file From 34c9947a531e89c304e48e44824e1ed9ea7c2bef Mon Sep 17 00:00:00 2001 From: Cary Xu Date: Fri, 15 Apr 2022 18:38:41 +0800 Subject: [PATCH 29/37] feat(tsdb): set bitmap len 0 for primary TS column --- source/dnode/vnode/src/tsdb/tsdbReadImpl.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbReadImpl.c b/source/dnode/vnode/src/tsdb/tsdbReadImpl.c index e31ede09cc..064086b442 100644 --- a/source/dnode/vnode/src/tsdb/tsdbReadImpl.c +++ b/source/dnode/vnode/src/tsdb/tsdbReadImpl.c @@ -606,9 +606,10 @@ static int tsdbLoadBlockDataImpl(SReadH *pReadh, SBlock *pBlock, SDataCols *pDat if (tsdbMakeRoom((void **)(&TSDB_READ_COMP_BUF(pReadh)), zsize) < 0) return -1; } - if (tsdbCheckAndDecodeColumnData(pDataCol, POINTER_SHIFT(pBlockData, tsize + toffset), tlen, pBlockCol->blen, - pBlock->algorithm, pBlock->numOfRows, tLenBitmap, pDataCols->maxPoints, - TSDB_READ_COMP_BUF(pReadh), (int)taosTSizeof(TSDB_READ_COMP_BUF(pReadh))) < 0) { + if (tsdbCheckAndDecodeColumnData(pDataCol, POINTER_SHIFT(pBlockData, tsize + toffset), tlen, + pBlockCol ? pBlockCol->blen : 0, pBlock->algorithm, pBlock->numOfRows, + 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; @@ -747,6 +748,7 @@ static int tsdbLoadBlockDataColsImpl(SReadH *pReadh, SBlock *pBlock, SDataCols * if (colId == PRIMARYKEY_TIMESTAMP_COL_ID) { // load the key row blockCol.colId = colId; TD_SET_COL_ROWS_NORM(&blockCol); // default is NORM for the primary key column + blockCol.blen = 0; blockCol.len = pBlock->keyLen; blockCol.type = pDataCol->type; blockCol.offset = TSDB_KEY_COL_OFFSET; From 01ea38586d6154171f9af5766868848f0ab18386 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Fri, 15 Apr 2022 19:22:11 +0800 Subject: [PATCH 30/37] feat: CREATE STREAM statement implement, and syntax of JSON data type implement. --- source/libs/parser/inc/sql.y | 18 +++--- source/libs/parser/src/parTokenizer.c | 1 + source/libs/parser/src/parTranslater.c | 60 +++++++++++++------ .../libs/parser/test/mockCatalogService.cpp | 2 +- source/libs/planner/src/planOptimizer.c | 2 +- source/libs/planner/test/plannerTest.cpp | 12 ++-- 6 files changed, 60 insertions(+), 35 deletions(-) diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index 132a746828..e1d5597e3b 100644 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -592,15 +592,15 @@ expression_list(A) ::= expression_list(B) NK_COMMA expression(C). column_reference(A) ::= column_name(B). { A = createRawExprNode(pCxt, &B, createColumnNode(pCxt, NULL, &B)); } column_reference(A) ::= table_name(B) NK_DOT column_name(C). { A = createRawExprNodeExt(pCxt, &B, &C, createColumnNode(pCxt, &B, &C)); } -pseudo_column(A) ::= NOW(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } -pseudo_column(A) ::= TODAY(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } -pseudo_column(A) ::= ROWTS(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } -pseudo_column(A) ::= TBNAME(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } -pseudo_column(A) ::= QSTARTTS(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } -pseudo_column(A) ::= QENDTS(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } -pseudo_column(A) ::= WSTARTTS(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } -pseudo_column(A) ::= WENDTS(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } -pseudo_column(A) ::= WDURATION(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } +pseudo_column(A) ::= NOW(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } +pseudo_column(A) ::= TODAY(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } +pseudo_column(A) ::= ROWTS(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } +pseudo_column(A) ::= TBNAME(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } +pseudo_column(A) ::= QSTARTTS(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } +pseudo_column(A) ::= QENDTS(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } +pseudo_column(A) ::= WSTARTTS(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } +pseudo_column(A) ::= WENDTS(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } +pseudo_column(A) ::= WDURATION(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); } function_expression(A) ::= function_name(B) NK_LP expression_list(C) NK_RP(D). { A = createRawExprNodeExt(pCxt, &B, &D, createFunctionNode(pCxt, &B, C)); } function_expression(A) ::= star_func(B) NK_LP star_func_para_list(C) NK_RP(D). { A = createRawExprNodeExt(pCxt, &B, &D, createFunctionNode(pCxt, &B, C)); } diff --git a/source/libs/parser/src/parTokenizer.c b/source/libs/parser/src/parTokenizer.c index 618d5ccf48..af2b831b93 100644 --- a/source/libs/parser/src/parTokenizer.c +++ b/source/libs/parser/src/parTokenizer.c @@ -51,6 +51,7 @@ static SKeyword keywordTable[] = { {"BY", TK_BY}, {"CACHE", TK_CACHE}, {"CACHELAST", TK_CACHELAST}, + {"CAST", TK_CAST}, {"COLUMN", TK_COLUMN}, {"COMMENT", TK_COMMENT}, {"COMP", TK_COMP}, diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 90a4e4e40e..f1f2f591a8 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -807,31 +807,32 @@ static SNode* createMultiResFunc(SFunctionNode* pSrcFunc, SExprNode* pExpr) { return (SNode*)pFunc; } -static int32_t createTableAllCols(STranslateContext* pCxt, SColumnNode* pCol, SNodeList** pOutput) { - if (NULL == *pOutput) { - *pOutput = nodesMakeList(); - } - if (NULL == *pOutput) { - return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_OUT_OF_MEMORY); - } - bool foundTable = false; +static int32_t findTable(STranslateContext* pCxt, const char* pTableAlias, STableNode** pOutput) { SArray* pTables = taosArrayGetP(pCxt->pNsLevel, pCxt->currLevel); size_t nums = taosArrayGetSize(pTables); for (size_t i = 0; i < nums; ++i) { STableNode* pTable = taosArrayGetP(pTables, i); - if (0 == strcmp(pTable->tableAlias, pCol->tableAlias)) { - int32_t code = createColumnNodeByTable(pCxt, pTable, *pOutput); - if (TSDB_CODE_SUCCESS != code) { - return code; - } - foundTable = true; - break; + if (NULL == pTableAlias || 0 == strcmp(pTable->tableAlias, pTableAlias)) { + *pOutput = pTable; + return TSDB_CODE_SUCCESS; } } - if (!foundTable) { - return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_TABLE_NOT_EXIST, pCol->tableAlias); + return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_TABLE_NOT_EXIST, pTableAlias); +} + +static int32_t createTableAllCols(STranslateContext* pCxt, SColumnNode* pCol, SNodeList** pOutput) { + STableNode* pTable = NULL; + int32_t code = findTable(pCxt, pCol->tableAlias, &pTable); + if (TSDB_CODE_SUCCESS == code && NULL == *pOutput) { + *pOutput = nodesMakeList(); + if (NULL == *pOutput) { + code = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_OUT_OF_MEMORY); + } } - return TSDB_CODE_SUCCESS; + if (TSDB_CODE_SUCCESS == code) { + code = createColumnNodeByTable(pCxt, pTable, *pOutput); + } + return code; } static bool isStar(SNode* pNode) { @@ -909,6 +910,24 @@ static int32_t createMultiResFuncsFromStar(STranslateContext* pCxt, SFunctionNod return code; } +static bool isCountStar(SNode* pNode) { + if (QUERY_NODE_FUNCTION != nodeType(pNode)) { + return false; + } + SNode* pPara = nodesListGetNode(((SFunctionNode*)pNode)->pParameterList, 0); + return (QUERY_NODE_COLUMN == nodeType(pPara) && 0 == strcmp(((SColumnNode*)pPara)->colName, "*")); +} + +static int32_t rewriteCountStar(STranslateContext* pCxt, SFunctionNode* pCount) { + SColumnNode* pCol = nodesListGetNode(pCount->pParameterList, 0); + STableNode* pTable = NULL; + int32_t code = findTable(pCxt, ('\0' == pCol->tableAlias[0] ? NULL : pCol->tableAlias), &pTable); + if (TSDB_CODE_SUCCESS == code && QUERY_NODE_REAL_TABLE == nodeType(pTable)) { + setColumnInfoBySchema((SRealTableNode*)pTable, ((SRealTableNode*)pTable)->pMeta->schema, false, pCol); + } + return code; +} + static int32_t translateStar(STranslateContext* pCxt, SSelectStmt* pSelect) { if (NULL == pSelect->pProjectionList) { // select * ... return createAllColumns(pCxt, &pSelect->pProjectionList); @@ -931,6 +950,11 @@ static int32_t translateStar(STranslateContext* pCxt, SSelectStmt* pSelect) { INSERT_LIST(pSelect->pProjectionList, pCols); ERASE_NODE(pSelect->pProjectionList); continue; + } else if (isCountStar(pNode)) { + int32_t code = rewriteCountStar(pCxt, (SFunctionNode*)pNode); + if (TSDB_CODE_SUCCESS != code) { + return code; + } } WHERE_NEXT; } diff --git a/source/libs/parser/test/mockCatalogService.cpp b/source/libs/parser/test/mockCatalogService.cpp index 3da3678563..3ef0eaed42 100644 --- a/source/libs/parser/test/mockCatalogService.cpp +++ b/source/libs/parser/test/mockCatalogService.cpp @@ -264,7 +264,7 @@ private: } std::string ftToString(int16_t colid, int16_t numOfColumns) const { - return (0 == colid ? "column" : (colid <= numOfColumns ? "tag" : "column")); + return (0 == colid ? "column" : (colid < numOfColumns ? "column" : "tag")); } STableMeta* getTableSchemaMeta(const std::string& db, const std::string& tbname) const { diff --git a/source/libs/planner/src/planOptimizer.c b/source/libs/planner/src/planOptimizer.c index 19e6718fe8..0be7c42467 100644 --- a/source/libs/planner/src/planOptimizer.c +++ b/source/libs/planner/src/planOptimizer.c @@ -64,7 +64,7 @@ static bool osdMayBeOptimized(SLogicNode* pNode) { return false; } if (NULL == pNode->pParent || - (QUERY_NODE_LOGIC_PLAN_WINDOW != nodeType(pNode->pParent) && QUERY_NODE_LOGIC_PLAN_AGG == nodeType(pNode->pParent))) { + (QUERY_NODE_LOGIC_PLAN_WINDOW != nodeType(pNode->pParent) && QUERY_NODE_LOGIC_PLAN_AGG != nodeType(pNode->pParent))) { return false; } return true; diff --git a/source/libs/planner/test/plannerTest.cpp b/source/libs/planner/test/plannerTest.cpp index 48aa89eae6..14fa36a958 100644 --- a/source/libs/planner/test/plannerTest.cpp +++ b/source/libs/planner/test/plannerTest.cpp @@ -196,14 +196,14 @@ TEST_F(PlannerTest, selectGroupBy) { bind("SELECT count(*) FROM t1"); ASSERT_TRUE(run()); - // bind("SELECT c1, max(c3), min(c2), count(*) FROM t1 GROUP BY c1"); - // ASSERT_TRUE(run()); + bind("SELECT c1, max(c3), min(c3), count(*) FROM t1 GROUP BY c1"); + ASSERT_TRUE(run()); - // bind("SELECT c1 + c3, c1 + count(*) FROM t1 where c2 = 'abc' GROUP BY c1, c3"); - // ASSERT_TRUE(run()); + bind("SELECT c1 + c3, c1 + count(*) FROM t1 where c2 = 'abc' GROUP BY c1, c3"); + ASSERT_TRUE(run()); - // bind("SELECT c1 + c3, sum(c4 * c5) FROM t1 where concat(c2, 'wwww') = 'abcwww' GROUP BY c1 + c3"); - // ASSERT_TRUE(run()); + bind("SELECT c1 + c3, sum(c4 * c5) FROM t1 where concat(c2, 'wwww') = 'abcwww' GROUP BY c1 + c3"); + ASSERT_TRUE(run()); } TEST_F(PlannerTest, selectSubquery) { From 3e1c4cc268633823d01e8f16e37d1a345b4ff07c Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Fri, 15 Apr 2022 20:07:35 +0800 Subject: [PATCH 31/37] complie error --- source/libs/parser/src/parTranslater.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 2d1535e439..4fe3d24b8a 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -799,9 +799,9 @@ static SNode* createMultiResFunc(SFunctionNode* pSrcFunc, SExprNode* pExpr) { strcpy(pFunc->functionName, pSrcFunc->functionName); if (QUERY_NODE_COLUMN == nodeType(pExpr)) { SColumnNode* pCol = (SColumnNode*)pExpr; - snprintf(pFunc->node.aliasName, sizeof(pFunc->node.aliasName) - 1, "%s(%s.%s)", pSrcFunc->functionName, pCol->tableAlias, pCol->colName); + snprintf(pFunc->node.aliasName, sizeof(pFunc->node.aliasName), "%s(%s.%s)", pSrcFunc->functionName, pCol->tableAlias, pCol->colName); } else { - snprintf(pFunc->node.aliasName, sizeof(pFunc->node.aliasName) - 1, "%s(%s)", pSrcFunc->functionName, pExpr->aliasName); + snprintf(pFunc->node.aliasName, sizeof(pFunc->node.aliasName), "%s(%s)", pSrcFunc->functionName, pExpr->aliasName); } return (SNode*)pFunc; From 7b35c455d0f1ff810d79b9f90b58ea1fb94cf9c6 Mon Sep 17 00:00:00 2001 From: afwerar <1296468573@qq.com> Date: Fri, 15 Apr 2022 20:12:34 +0800 Subject: [PATCH 32/37] fix(grant): change dongle lib. --- cmake/cmake.define | 6 ------ source/dnode/mgmt/implement/CMakeLists.txt | 10 +--------- source/dnode/mnode/impl/CMakeLists.txt | 4 ++-- 3 files changed, 3 insertions(+), 17 deletions(-) diff --git a/cmake/cmake.define b/cmake/cmake.define index 53d25e1097..e875a0d306 100644 --- a/cmake/cmake.define +++ b/cmake/cmake.define @@ -3,12 +3,6 @@ cmake_minimum_required(VERSION 3.16) if (NOT DEFINED TD_GRANT) SET(TD_GRANT FALSE) endif() -if (NOT DEFINED TD_USB_DONGLE) - SET(TD_USB_DONGLE FALSE) -endif() -IF (TD_GRANT) - ADD_DEFINITIONS(-D_GRANT) -ENDIF () IF ("${BUILD_TOOLS}" STREQUAL "") IF (TD_LINUX) diff --git a/source/dnode/mgmt/implement/CMakeLists.txt b/source/dnode/mgmt/implement/CMakeLists.txt index 26c14edc77..fbe7530395 100644 --- a/source/dnode/mgmt/implement/CMakeLists.txt +++ b/source/dnode/mgmt/implement/CMakeLists.txt @@ -6,12 +6,4 @@ target_link_libraries( target_include_directories( dnode PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc" -) - -IF (TD_GRANT) - TARGET_LINK_LIBRARIES(dnode grant) -ENDIF () -IF (TD_USB_DONGLE) - TARGET_LINK_LIBRARIES(dnode usb_dongle) -else() -ENDIF () \ No newline at end of file +) \ No newline at end of file diff --git a/source/dnode/mnode/impl/CMakeLists.txt b/source/dnode/mnode/impl/CMakeLists.txt index 8cb5e2a528..a4bd12a7f7 100644 --- a/source/dnode/mnode/impl/CMakeLists.txt +++ b/source/dnode/mnode/impl/CMakeLists.txt @@ -12,8 +12,8 @@ target_link_libraries( IF (TD_GRANT) TARGET_LINK_LIBRARIES(mnode grant) ENDIF () -IF (TD_USB_DONGLE) - TARGET_LINK_LIBRARIES(mnode usb_dongle) +IF (TD_GRANT) + ADD_DEFINITIONS(-D_GRANT) ENDIF () if(${BUILD_TEST}) From acb4a0445956590c61c4141e2d9a1ad2d69d8e3b Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Fri, 15 Apr 2022 20:17:56 +0800 Subject: [PATCH 33/37] complie error --- source/libs/parser/src/parTranslater.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 4fe3d24b8a..c51ec31b81 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -797,12 +797,15 @@ static SNode* createMultiResFunc(SFunctionNode* pSrcFunc, SExprNode* pExpr) { pFunc->funcId = pSrcFunc->funcId; pFunc->funcType = pSrcFunc->funcType; strcpy(pFunc->functionName, pSrcFunc->functionName); + char buf[TSDB_FUNC_NAME_LEN + TSDB_TABLE_NAME_LEN + TSDB_COL_NAME_LEN]; + int32_t len = 0; if (QUERY_NODE_COLUMN == nodeType(pExpr)) { SColumnNode* pCol = (SColumnNode*)pExpr; - snprintf(pFunc->node.aliasName, sizeof(pFunc->node.aliasName), "%s(%s.%s)", pSrcFunc->functionName, pCol->tableAlias, pCol->colName); + len = snprintf(buf, sizeof(buf), "%s(%s.%s)", pSrcFunc->functionName, pCol->tableAlias, pCol->colName); } else { - snprintf(pFunc->node.aliasName, sizeof(pFunc->node.aliasName), "%s(%s)", pSrcFunc->functionName, pExpr->aliasName); + len = snprintf(buf, sizeof(buf), "%s(%s)", pSrcFunc->functionName, pExpr->aliasName); } + strncpy(pFunc->node.aliasName, buf, TMIN(len, sizeof(pFunc->node.aliasName) - 1)); return (SNode*)pFunc; } From f406c4e31d806981e08a726f3a4b42233c3bc288 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Fri, 15 Apr 2022 20:31:21 +0800 Subject: [PATCH 34/37] complie error --- source/libs/parser/src/parTranslater.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index c51ec31b81..dc1338be68 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -914,7 +914,7 @@ static int32_t createMultiResFuncsFromStar(STranslateContext* pCxt, SFunctionNod } static bool isCountStar(SNode* pNode) { - if (QUERY_NODE_FUNCTION != nodeType(pNode)) { + if (QUERY_NODE_FUNCTION != nodeType(pNode) || 1 != LIST_LENGTH(((SFunctionNode*)pNode)->pParameterList)) { return false; } SNode* pPara = nodesListGetNode(((SFunctionNode*)pNode)->pParameterList, 0); From fa6e18e283c1a4a3a77319b41eaf2adda41e2819 Mon Sep 17 00:00:00 2001 From: plum-lihui Date: Fri, 15 Apr 2022 20:32:52 +0800 Subject: [PATCH 35/37] [test: support valgrind run all sim cases, and save valgrind log file] --- tests/script/runAllSimCases.sh | 66 +++++++++++++++++++++++++++-- tests/script/sh/exec.sh | 9 ++-- tests/script/test.sh | 2 +- tests/script/tsim/insert/basic0.sim | 2 +- 4 files changed, 70 insertions(+), 9 deletions(-) diff --git a/tests/script/runAllSimCases.sh b/tests/script/runAllSimCases.sh index e1eea1cc38..70f2f86115 100755 --- a/tests/script/runAllSimCases.sh +++ b/tests/script/runAllSimCases.sh @@ -1,4 +1,4 @@ -#!/bin/bash +!/bin/bash ################################################## # @@ -8,13 +8,73 @@ set -e #set -x +VALGRIND=0 +LOG_BK_DIR=/data/valgrind_log_backup # 192.168.0.203 +while getopts "v:r" arg +do + case $arg in + v) + VALGRIND=1 + ;; + r) + LOG_BK_DIR=$(echo $OPTARG) + ;; + ?) #unknow option + echo "unkonw argument" + exit 1 + ;; + esac +done + +echo "VALGRIND: $VALGRIND, LOG_BK_DIR: $LOG_BK_DIR" + +CURRENT_DIR=`pwd` +TSIM_LOG_DIR=$CURRENT_DIR/../../sim/tsim/log +TAOSD_LOG_DIR=$CURRENT_DIR/../../sim + +echo "tsim log dir: $TSIM_LOG_DIR" +echo "taosd log dir: $TAOSD_LOG_DIR" + +if [[ $VALGRIND -eq 1 ]]; then + if [ -d ${LOG_BK_DIR} ]; then + rm -rf ${LOG_BK_DIR}/* + else + mkdir -p $LOG_BK_DIR/ + fi +fi while read line do firstChar=`echo ${line:0:1}` if [[ -n "$line" ]] && [[ $firstChar != "#" ]]; then - echo "======== $line ========" - $line + if [[ $VALGRIND -eq 1 ]]; then + echo "======== $line -v ========" + $line -v + + # move all valgrind log files of the sim case to valgrind back dir + # get current sim case name for + result=`echo ${line%sim*}` + result=`echo ${result#*/}` + result=`echo ${result#*/}` + result=`echo ${result////-}` + tsimLogFile=valgrind-${result}sim.log + + echo "cp ${TSIM_LOG_DIR}/valgrind-tsim.log ${LOG_BK_DIR}/${tsimLogFile} " + cp ${TSIM_LOG_DIR}/valgrind-tsim.log ${LOG_BK_DIR}/${tsimLogFile} + cp ${TAOSD_LOG_DIR}/dnode1/log/valgrind*.log ${LOG_BK_DIR}/ ||: + cp ${TAOSD_LOG_DIR}/dnode2/log/valgrind*.log ${LOG_BK_DIR}/ ||: + cp ${TAOSD_LOG_DIR}/dnode3/log/valgrind*.log ${LOG_BK_DIR}/ ||: + cp ${TAOSD_LOG_DIR}/dnode4/log/valgrind*.log ${LOG_BK_DIR}/ ||: + cp ${TAOSD_LOG_DIR}/dnode5/log/valgrind*.log ${LOG_BK_DIR}/ ||: + cp ${TAOSD_LOG_DIR}/dnode6/log/valgrind*.log ${LOG_BK_DIR}/ ||: + cp ${TAOSD_LOG_DIR}/dnode7/log/valgrind*.log ${LOG_BK_DIR}/ ||: + cp ${TAOSD_LOG_DIR}/dnode8/log/valgrind*.log ${LOG_BK_DIR}/ ||: + cp ${TAOSD_LOG_DIR}/dnode9/log/valgrind*.log ${LOG_BK_DIR}/ ||: + + else + echo "======== $line ========" + $line + fi fi done < ./jenkins/basic.txt diff --git a/tests/script/sh/exec.sh b/tests/script/sh/exec.sh index 50ded73555..606f778920 100755 --- a/tests/script/sh/exec.sh +++ b/tests/script/sh/exec.sh @@ -97,13 +97,14 @@ if [ "$CLEAR_OPTION" = "clear" ]; then fi if [ "$EXEC_OPTON" = "start" ]; then - echo "ExcuteCmd:" $EXE_DIR/taosd -c $CFG_DIR - + #echo "ExcuteCmd:" $EXE_DIR/taosd -c $CFG_DIR if [ "$VALGRIND_OPTION" = "true" ]; then TT=`date +%s` - mkdir ${LOG_DIR}/${TT} - nohup valgrind --log-file=${LOG_DIR}/${TT}/valgrind.log --tool=memcheck --leak-check=full --show-reachable=no --track-origins=yes --show-leak-kinds=all -v --workaround-gcc296-bugs=yes $EXE_DIR/taosd -c $CFG_DIR > /dev/null 2>&1 & + #mkdir ${LOG_DIR}/${TT} + echo "nohup valgrind --log-file=${LOG_DIR}/valgrind-taosd-${TT}.log --tool=memcheck --leak-check=full --show-reachable=no --track-origins=yes --show-leak-kinds=all -v --workaround-gcc296-bugs=yes $EXE_DIR/taosd -c $CFG_DIR > /dev/null 2>&1 &" + nohup valgrind --log-file=${LOG_DIR}/valgrind-taosd-${TT}.log --tool=memcheck --leak-check=full --show-reachable=no --track-origins=yes --show-leak-kinds=all -v --workaround-gcc296-bugs=yes $EXE_DIR/taosd -c $CFG_DIR > /dev/null 2>&1 & else + echo "nohup $EXE_DIR/taosd -c $CFG_DIR > /dev/null 2>&1 &" nohup $EXE_DIR/taosd -c $CFG_DIR > /dev/null 2>&1 & fi diff --git a/tests/script/test.sh b/tests/script/test.sh index f5a9e4187b..27fa4933e0 100755 --- a/tests/script/test.sh +++ b/tests/script/test.sh @@ -126,7 +126,7 @@ if [ -n "$FILE_NAME" ]; then echo "------------------------------------------------------------------------" if [ $VALGRIND -eq 1 ]; then echo valgrind --tool=memcheck --leak-check=full --show-reachable=no --track-origins=yes --show-leak-kinds=all -v --workaround-gcc296-bugs=yes --log-file=${CODE_DIR}/../script/valgrind.log $PROGRAM -c $CFG_DIR -f $FILE_NAME -v - valgrind --tool=memcheck --leak-check=full --show-reachable=no --track-origins=yes --show-leak-kinds=all -v --workaround-gcc296-bugs=yes --log-file=${CODE_DIR}/../script/valgrind.log $PROGRAM -c $CFG_DIR -f $FILE_NAME -v + valgrind --tool=memcheck --leak-check=full --show-reachable=no --track-origins=yes --show-leak-kinds=all -v --workaround-gcc296-bugs=yes --log-file=${LOG_DIR}/valgrind-tsim.log $PROGRAM -c $CFG_DIR -f $FILE_NAME -v else if [[ $MULTIPROCESS -eq 1 ]];then echo "ExcuteCmd(multiprocess):" $PROGRAM -m -c $CFG_DIR -f $FILE_NAME diff --git a/tests/script/tsim/insert/basic0.sim b/tests/script/tsim/insert/basic0.sim index 1ae8b372dc..94bd0f1ecf 100644 --- a/tests/script/tsim/insert/basic0.sim +++ b/tests/script/tsim/insert/basic0.sim @@ -537,4 +537,4 @@ endi #endi -#system sh/exec.sh -n dnode1 -s stop -x SIGINT +system sh/exec.sh -n dnode1 -s stop -x SIGINT From a172f11e2409c392295fd1768a3de76111b90795 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Fri, 15 Apr 2022 21:38:56 +0800 Subject: [PATCH 36/37] add tag index filter --- source/libs/executor/src/indexoperator.c | 162 ++++++++++++++++++++++- 1 file changed, 160 insertions(+), 2 deletions(-) diff --git a/source/libs/executor/src/indexoperator.c b/source/libs/executor/src/indexoperator.c index b733ecdc6b..6c87d585e3 100644 --- a/source/libs/executor/src/indexoperator.c +++ b/source/libs/executor/src/indexoperator.c @@ -15,18 +15,176 @@ #include "indexoperator.h" #include "executorimpl.h" +#include "nodes.h" + +typedef struct SIFCtx { + int32_t code; + SHashObj *pRes; /* element is SScalarParam */ +} SIFCtx; + +typedef struct SIFParam { + SArray * result; + SHashObj *pFilter; +} SIFParam; // construct tag filter operator later static void destroyTagFilterOperatorInfo(void *param) { STagFilterOperatorInfo *pInfo = (STagFilterOperatorInfo *)param; } -int32_t doFilterTag(const SNode *pFilterNode, SArray *resutl) { + +static void sifFreeParam(SIFParam *param) { + if (param == NULL) return; + taosArrayDestroy(param->result); +} + +int32_t sifInitOperParams(SIFParam *params, SOperatorNode *node, SIFCtx *ctx) { + int32_t code = 0; + return code; +} +static int32_t sifExecFunction(SFunctionNode *node, SIFCtx *ctx, SIFParam *output) { + qError("index-filter not support buildin function"); + return TSDB_CODE_SUCCESS; +} +static int32_t sifExecOper(SOperatorNode *node, SIFCtx *ctx, SIFParam *output) { + SIFParam *params = NULL; + + return TSDB_CODE_SUCCESS; +} + +static int32_t sifExecLogic(SLogicConditionNode *node, SIFCtx *ctx, SIFParam *output) { return TSDB_CODE_SUCCESS; } + +static EDealRes sifWalkFunction(SNode *pNode, void *context) { + // impl later + SFunctionNode *node = (SFunctionNode *)pNode; + SIFParam output = {0}; + + SIFCtx *ctx = context; + ctx->code = sifExecFunction(node, ctx, &output); + if (ctx->code != TSDB_CODE_SUCCESS) { + return DEAL_RES_ERROR; + } + + if (taosHashPut(ctx->pRes, &pNode, POINTER_BYTES, &output, sizeof(output))) { + ctx->code = TSDB_CODE_QRY_OUT_OF_MEMORY; + return DEAL_RES_ERROR; + } + return DEAL_RES_CONTINUE; +} +static EDealRes sifWalkLogic(SNode *pNode, void *context) { + SLogicConditionNode *node = (SLogicConditionNode *)pNode; + SIFParam output = {0}; + + SIFCtx *ctx = context; + ctx->code = sifExecLogic(node, ctx, &output); + if (ctx->code) { + return DEAL_RES_ERROR; + } + + if (taosHashPut(ctx->pRes, &pNode, POINTER_BYTES, &output, sizeof(output))) { + ctx->code = TSDB_CODE_QRY_OUT_OF_MEMORY; + return DEAL_RES_ERROR; + } + return DEAL_RES_CONTINUE; +} +static EDealRes sifWalkOper(SNode *pNode, void *context) { + SOperatorNode *node = (SOperatorNode *)pNode; + SIFParam output = {0}; + + SIFCtx *ctx = context; + ctx->code = sifExecOper(node, ctx, &output); + if (ctx->code) { + return DEAL_RES_ERROR; + } + + if (taosHashPut(ctx->pRes, &pNode, POINTER_BYTES, &output, sizeof(output))) { + ctx->code = TSDB_CODE_QRY_OUT_OF_MEMORY; + return DEAL_RES_ERROR; + } + + return DEAL_RES_CONTINUE; +} + +EDealRes sifCalcWalker(SNode *node, void *context) { + if (QUERY_NODE_VALUE == nodeType(node) || QUERY_NODE_NODE_LIST == nodeType(node) || + QUERY_NODE_COLUMN == nodeType(node)) { + return DEAL_RES_CONTINUE; + } + SIFCtx *ctx = (SIFCtx *)context; + if (QUERY_NODE_FUNCTION == nodeType(node)) { + return sifWalkFunction(node, ctx); + } + if (QUERY_NODE_LOGIC_CONDITION == nodeType(node)) { + return sifWalkLogic(node, ctx); + } + if (QUERY_NODE_OPERATOR == nodeType(node)) { + return sifWalkOper(node, ctx); + } + + qError("invalid node type for index filter calculating, type:%d", nodeType(node)); + ctx->code = TSDB_CODE_QRY_INVALID_INPUT; + return DEAL_RES_ERROR; +} + +void sifFreeRes(SHashObj *res) { + void *pIter = taosHashIterate(res, NULL); + while (pIter) { + SIFParam *p = pIter; + if (p) { + sifFreeParam(p); + } + pIter = taosHashIterate(res, pIter); + } + taosHashCleanup(res); +} +static int32_t sifCalculate(SNode *pNode, SIFParam *pDst) { + if (pNode == NULL || pDst == NULL) { + return TSDB_CODE_QRY_INVALID_INPUT; + } + int32_t code = 0; + SIFCtx ctx = {.code = 0}; + ctx.pRes = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_NO_LOCK); + if (NULL == ctx.pRes) { + qError("index-filter failed to taosHashInit"); + return TSDB_CODE_QRY_OUT_OF_MEMORY; + } + nodesWalkExprPostOrder(pNode, sifCalcWalker, &ctx); + if (ctx.code != TSDB_CODE_SUCCESS) { + return ctx.code; + } + if (pDst) { + SIFParam *res = (SIFParam *)taosHashGet(ctx.pRes, (void *)&pNode, POINTER_BYTES); + if (res == NULL) { + qError("no valid res in hash, node:(%p), type(%d)", (void *)&pNode, nodeType(pNode)); + return TSDB_CODE_QRY_APP_ERROR; + } + taosArrayAddAll(pDst->result, res->result); + + sifFreeParam(res); + taosHashRemove(ctx.pRes, (void *)&pNode, POINTER_BYTES); + } + return TSDB_CODE_SUCCESS; +} + +int32_t doFilterTag(const SNode *pFilterNode, SArray *result) { if (pFilterNode == NULL) { return TSDB_CODE_SUCCESS; } SFilterInfo *filter = NULL; - // todo move to the initialization function int32_t code = filterInitFromNode((SNode *)pFilterNode, &filter, 0); + if (code != TSDB_CODE_SUCCESS) { + return code; + } + + SIFParam param = {0}; + code = sifCalculate((SNode *)pFilterNode, ¶m); + + if (code != TSDB_CODE_SUCCESS) { + return code; + } + + taosArrayAddAll(result, param.result); + sifFreeParam(¶m); + return code; } From acc12943b8116b1377fe4610066057adfa8f4e04 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Fri, 15 Apr 2022 22:17:22 +0800 Subject: [PATCH 37/37] validate tag filter status --- source/libs/executor/inc/indexoperator.h | 3 +++ source/libs/executor/src/indexoperator.c | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/source/libs/executor/inc/indexoperator.h b/source/libs/executor/inc/indexoperator.h index 3113945c13..9e67ac7f41 100644 --- a/source/libs/executor/inc/indexoperator.h +++ b/source/libs/executor/inc/indexoperator.h @@ -16,5 +16,8 @@ #include "filter.h" #include "tglobal.h" +typedef enum { SFLT_NOT_INDEX, SFLT_COARSE_INDEX, SFLT_ACCURATE_INDEX } SIdxFltStatus; + +SIdxFltStatus idxGetFltStatus(SNode *pFilterNode); // construct tag filter operator later int32_t doFilterTag(const SNode *pFilterNode, SArray *resutl); diff --git a/source/libs/executor/src/indexoperator.c b/source/libs/executor/src/indexoperator.c index 6c87d585e3..b5b9cdb740 100644 --- a/source/libs/executor/src/indexoperator.c +++ b/source/libs/executor/src/indexoperator.c @@ -188,3 +188,11 @@ int32_t doFilterTag(const SNode *pFilterNode, SArray *result) { return code; } + +SIdxFltStatus idxGetFltStatus(SNode *pFilterNode) { + if (pFilterNode == NULL) { + return SFLT_NOT_INDEX; + } + // impl later + return SFLT_ACCURATE_INDEX; +}