diff --git a/include/common/cos_cp.h b/include/common/cos_cp.h index fd778b1a1d..29532c0265 100644 --- a/include/common/cos_cp.h +++ b/include/common/cos_cp.h @@ -60,8 +60,8 @@ typedef struct { } SCheckpoint; int32_t cos_cp_open(char const* cp_path, SCheckpoint* checkpoint); -void cos_cp_close(TdFilePtr fd); -void cos_cp_remove(char const* filepath); +int32_t cos_cp_close(TdFilePtr fd); +int32_t cos_cp_remove(char const* filepath); int32_t cos_cp_load(char const* filepath, SCheckpoint* checkpoint); int32_t cos_cp_dump(SCheckpoint* checkpoint); diff --git a/include/common/tdataformat.h b/include/common/tdataformat.h index 7aec39817a..04e13fbdb3 100644 --- a/include/common/tdataformat.h +++ b/include/common/tdataformat.h @@ -136,7 +136,7 @@ int32_t tRowMerge(SArray *aRowP, STSchema *pTSchema, int8_t flag); int32_t tRowUpsertColData(SRow *pRow, STSchema *pTSchema, SColData *aColData, int32_t nColData, int32_t flag); void tRowGetPrimaryKey(SRow *pRow, SRowKey *key); int32_t tRowKeyCompare(const SRowKey *key1, const SRowKey *key2); -int32_t tRowKeyAssign(SRowKey *pDst, SRowKey *pSrc); +void tRowKeyAssign(SRowKey *pDst, SRowKey *pSrc); // SRowIter ================================ int32_t tRowIterOpen(SRow *pRow, STSchema *pTSchema, SRowIter **ppIter); diff --git a/include/common/tmisce.h b/include/common/tmisce.h index 267ca814d4..39274e807c 100644 --- a/include/common/tmisce.h +++ b/include/common/tmisce.h @@ -31,7 +31,7 @@ typedef struct SCorEpSet { int32_t epsetToStr(const SEpSet* pEpSet, char* pBuf, int32_t len); int32_t taosGetFqdnPortFromEp(const char* ep, SEp* pEp); -void addEpIntoEpSet(SEpSet* pEpSet, const char* fqdn, uint16_t port); +int32_t addEpIntoEpSet(SEpSet* pEpSet, const char* fqdn, uint16_t port); bool isEpsetEqual(const SEpSet* s1, const SEpSet* s2); void epsetAssign(SEpSet* dst, const SEpSet* pSrc); diff --git a/include/common/tmsgcb.h b/include/common/tmsgcb.h index 03bf8da707..0c61aa5a51 100644 --- a/include/common/tmsgcb.h +++ b/include/common/tmsgcb.h @@ -17,13 +17,13 @@ #define _TD_COMMON_MSG_CB_H_ #include "os.h" +#include "tmsg.h" #ifdef __cplusplus extern "C" { #endif typedef struct SRpcMsg SRpcMsg; -typedef struct SEpSet SEpSet; typedef struct SMgmtWrapper SMgmtWrapper; typedef struct SRpcHandleInfo SRpcHandleInfo; @@ -46,7 +46,7 @@ typedef int32_t (*PutToQueueFp)(void* pMgmt, EQueueType qtype, SRpcMsg* pMsg); typedef int32_t (*GetQueueSizeFp)(void* pMgmt, int32_t vgId, EQueueType qtype); typedef int32_t (*SendReqFp)(const SEpSet* pEpSet, SRpcMsg* pMsg); typedef void (*SendRspFp)(SRpcMsg* pMsg); -typedef void (*RegisterBrokenLinkArgFp)(SRpcMsg* pMsg); +typedef void (*RegisterBrokenLinkArgFp)(struct SRpcMsg* pMsg); typedef void (*ReleaseHandleFp)(SRpcHandleInfo* pHandle, int8_t type); typedef void (*ReportStartup)(const char* name, const char* desc); diff --git a/include/common/tname.h b/include/common/tname.h index 6a89d2a6be..f0a68f28c4 100644 --- a/include/common/tname.h +++ b/include/common/tname.h @@ -81,7 +81,7 @@ typedef struct { // uint64_t uid; // child table uid, may be useful } RandTableName; -void buildChildTableName(RandTableName* rName); +int32_t buildChildTableName(RandTableName* rName); #ifdef __cplusplus } diff --git a/include/common/ttokendef.h b/include/common/ttokendef.h index 81c494223c..41802d5400 100644 --- a/include/common/ttokendef.h +++ b/include/common/ttokendef.h @@ -132,16 +132,16 @@ #define TK_TABLE 114 #define TK_NK_LP 115 #define TK_NK_RP 116 -#define TK_STABLE 117 -#define TK_COLUMN 118 -#define TK_MODIFY 119 -#define TK_RENAME 120 -#define TK_TAG 121 -#define TK_SET 122 -#define TK_NK_EQ 123 -#define TK_USING 124 -#define TK_TAGS 125 -#define TK_FILE 126 +#define TK_USING 117 +#define TK_FILE 118 +#define TK_STABLE 119 +#define TK_COLUMN 120 +#define TK_MODIFY 121 +#define TK_RENAME 122 +#define TK_TAG 123 +#define TK_SET 124 +#define TK_NK_EQ 125 +#define TK_TAGS 126 #define TK_BOOL 127 #define TK_TINYINT 128 #define TK_SMALLINT 129 diff --git a/include/libs/audit/audit.h b/include/libs/audit/audit.h index dd3df27866..4fa69f1b4f 100644 --- a/include/libs/audit/audit.h +++ b/include/libs/audit/audit.h @@ -50,7 +50,7 @@ typedef struct { int32_t auditInit(const SAuditCfg *pCfg); void auditCleanup(); -void auditSend(SJson *pJson); +int32_t auditSend(SJson *pJson); void auditRecord(SRpcMsg *pReq, int64_t clusterId, char *operation, char *target1, char *target2, char *detail, int32_t len); void auditAddRecord(SRpcMsg *pReq, int64_t clusterId, char *operation, char *target1, char *target2, diff --git a/include/libs/executor/executor.h b/include/libs/executor/executor.h index a461ceef2a..082e824e5a 100644 --- a/include/libs/executor/executor.h +++ b/include/libs/executor/executor.h @@ -152,7 +152,7 @@ int32_t qCreateExecTask(SReadHandle* readHandle, int32_t vgId, uint64_t taskId, * @return */ int32_t qGetQueryTableSchemaVersion(qTaskInfo_t tinfo, char* dbName, char* tableName, int32_t* sversion, - int32_t* tversion, int32_t idx); + int32_t* tversion, int32_t idx, bool* tbGet); /** * The main task execution function, including query on both table and multiple tables, diff --git a/include/libs/executor/storageapi.h b/include/libs/executor/storageapi.h index 45f9f73fb1..0a33798f0c 100644 --- a/include/libs/executor/storageapi.h +++ b/include/libs/executor/storageapi.h @@ -105,7 +105,7 @@ typedef struct SMTbCursor { } SMTbCursor; typedef struct SMCtbCursor { - SMeta* pMeta; + struct SMeta* pMeta; void* pCur; tb_uid_t suid; void* pKey; @@ -134,7 +134,7 @@ typedef struct SMetaTableInfo { } SMetaTableInfo; typedef struct SSnapContext { - SMeta* pMeta; + struct SMeta* pMeta; int64_t snapVersion; void* pCur; int64_t suid; @@ -178,7 +178,7 @@ typedef struct TsdReader { int32_t (*tsdNextDataBlock)(); int32_t (*tsdReaderRetrieveBlockSMAInfo)(); - SSDataBlock *(*tsdReaderRetrieveDataBlock)(); + int32_t (*tsdReaderRetrieveDataBlock)(); void (*tsdReaderReleaseDataBlock)(); @@ -381,7 +381,7 @@ typedef struct SStateStore { void** ppVal, int32_t* pVLen); int32_t (*streamStateCountWinAdd)(SStreamState* pState, SSessionKey* pKey, void** pVal, int32_t* pVLen); - SUpdateInfo* (*updateInfoInit)(int64_t interval, int32_t precision, int64_t watermark, bool igUp, int8_t pkType, int32_t pkLen); + int32_t (*updateInfoInit)(int64_t interval, int32_t precision, int64_t watermark, bool igUp, int8_t pkType, int32_t pkLen, SUpdateInfo** ppInfo); TSKEY (*updateInfoFillBlockData)(SUpdateInfo* pInfo, SSDataBlock* pBlock, int32_t primaryTsCol, int32_t primaryKeyCol); bool (*updateInfoIsUpdated)(SUpdateInfo* pInfo, uint64_t tableId, TSKEY ts, void* pPkVal, int32_t len); bool (*updateInfoIsTableInserted)(SUpdateInfo* pInfo, int64_t tbUid); @@ -389,12 +389,12 @@ typedef struct SStateStore { void (*updateInfoDestroy)(SUpdateInfo* pInfo); void (*windowSBfDelete)(SUpdateInfo* pInfo, uint64_t count); - void (*windowSBfAdd)(SUpdateInfo* pInfo, uint64_t count); + int32_t (*windowSBfAdd)(SUpdateInfo* pInfo, uint64_t count); - SUpdateInfo* (*updateInfoInitP)(SInterval* pInterval, int64_t watermark, bool igUp, int8_t pkType, int32_t pkLen); + int32_t (*updateInfoInitP)(SInterval* pInterval, int64_t watermark, bool igUp, int8_t pkType, int32_t pkLen, SUpdateInfo** ppInfo); void (*updateInfoAddCloseWindowSBF)(SUpdateInfo* pInfo); void (*updateInfoDestoryColseWinSBF)(SUpdateInfo* pInfo); - int32_t (*updateInfoSerialize)(void* buf, int32_t bufLen, const SUpdateInfo* pInfo); + int32_t (*updateInfoSerialize)(void* buf, int32_t bufLen, const SUpdateInfo* pInfo, int32_t* pLen); int32_t (*updateInfoDeserialize)(void* buf, int32_t bufLen, SUpdateInfo* pInfo); SStreamStateCur* (*streamStateSessionSeekKeyNext)(SStreamState* pState, const SSessionKey* key); diff --git a/include/libs/nodes/cmdnodes.h b/include/libs/nodes/cmdnodes.h index f98ecee5c5..21de2eff9a 100644 --- a/include/libs/nodes/cmdnodes.h +++ b/include/libs/nodes/cmdnodes.h @@ -221,9 +221,6 @@ typedef struct SCreateSubTableFromFileClause { bool ignoreExists; SNodeList* pSpecificTags; char filePath[PATH_MAX]; - TdFilePtr fp; - SArray* aCreateTbData; - SArray* aTagIndexs; } SCreateSubTableFromFileClause; typedef struct SCreateMultiTablesStmt { diff --git a/include/libs/nodes/querynodes.h b/include/libs/nodes/querynodes.h index 34b42fd9e1..08b4c8fccb 100644 --- a/include/libs/nodes/querynodes.h +++ b/include/libs/nodes/querynodes.h @@ -233,7 +233,7 @@ typedef struct SViewNode { #define IS_WINDOW_JOIN(_stype) ((_stype) == JOIN_STYPE_WIN) #define IS_ASOF_JOIN(_stype) ((_stype) == JOIN_STYPE_ASOF) -typedef enum EJoinType { +typedef enum EJoinType { JOIN_TYPE_INNER = 0, JOIN_TYPE_LEFT, JOIN_TYPE_RIGHT, @@ -251,7 +251,7 @@ typedef enum EJoinSubType { JOIN_STYPE_MAX_VALUE } EJoinSubType; -typedef enum EJoinAlgorithm { +typedef enum EJoinAlgorithm { JOIN_ALGO_UNKNOWN = 0, JOIN_ALGO_MERGE, JOIN_ALGO_HASH, @@ -454,7 +454,7 @@ typedef struct SSetOperator { SNode* pLimit; char stmtName[TSDB_TABLE_NAME_LEN]; uint8_t precision; - ETimeLineMode timeLineResMode; + ETimeLineMode timeLineResMode; bool timeLineFromOrderBy; bool joinContains; } SSetOperator; @@ -504,6 +504,10 @@ typedef void (*FFreeTableBlockHash)(SHashObj*); typedef void (*FFreeVgourpBlockArray)(SArray*); struct SStbRowsDataContext; typedef void (*FFreeStbRowsDataContext)(struct SStbRowsDataContext*); +struct SCreateTbInfo; +struct SParseFileContext; +typedef void (*FDestroyParseFileContext)(struct SParseFileContext**); + typedef struct SVnodeModifyOpStmt { ENodeType nodeType; ENodeType sqlNodeType; @@ -524,7 +528,7 @@ typedef struct SVnodeModifyOpStmt { SHashObj* pTableNameHashObj; // set of table names for refreshing meta, sync mode SHashObj* pDbFNameHashObj; // set of db names for refreshing meta, sync mode SHashObj* pTableCxtHashObj; // temp SHashObj for single request - SArray* pVgDataBlocks; // SArray + SArray* pVgDataBlocks; // SArray SVCreateTbReq* pCreateTblReq; TdFilePtr fp; FFreeTableBlockHash freeHashFunc; @@ -532,9 +536,13 @@ typedef struct SVnodeModifyOpStmt { bool usingTableProcessing; bool fileProcessing; - bool stbSyntax; - struct SStbRowsDataContext* pStbRowsCxt; + bool stbSyntax; + struct SStbRowsDataContext* pStbRowsCxt; FFreeStbRowsDataContext freeStbRowsCxtFunc; + + struct SCreateTbInfo* pCreateTbInfo; + struct SParseFileContext* pParFileCxt; + FDestroyParseFileContext destroyParseFileCxt; } SVnodeModifyOpStmt; typedef struct SExplainOptions { @@ -602,7 +610,7 @@ typedef enum ECollectColType { COLLECT_COL_TYPE_COL = 1, COLLECT_COL_TYPE_TAG, C int32_t nodesCollectColumns(SSelectStmt* pSelect, ESqlClause clause, const char* pTableAlias, ECollectColType type, SNodeList** pCols); int32_t nodesCollectColumnsExt(SSelectStmt* pSelect, ESqlClause clause, SSHashObj* pMultiTableAlias, ECollectColType type, - SNodeList** pCols); + SNodeList** pCols); int32_t nodesCollectColumnsFromNode(SNode* node, const char* pTableAlias, ECollectColType type, SNodeList** pCols); typedef bool (*FFuncClassifier)(int32_t funcId); @@ -618,6 +626,7 @@ bool nodesIsArithmeticOp(const SOperatorNode* pOp); bool nodesIsComparisonOp(const SOperatorNode* pOp); bool nodesIsJsonOp(const SOperatorNode* pOp); bool nodesIsRegularOp(const SOperatorNode* pOp); +bool nodesIsMatchRegularOp(const SOperatorNode* pOp); bool nodesIsBitwiseOp(const SOperatorNode* pOp); bool nodesExprHasColumn(SNode* pNode); diff --git a/include/libs/parser/parser.h b/include/libs/parser/parser.h index 3ac357055e..4ad24fe91d 100644 --- a/include/libs/parser/parser.h +++ b/include/libs/parser/parser.h @@ -149,10 +149,10 @@ int32_t qCreateSName(SName* pName, const char* pTableName, int32_t acctId, char* void qDestroyBoundColInfo(void* pInfo); -SQuery* smlInitHandle(); +int32_t smlInitHandle(SQuery** query); int32_t smlBuildRow(STableDataCxt* pTableCxt); int32_t smlBuildCol(STableDataCxt* pTableCxt, SSchema* schema, void* kv, int32_t index); -STableDataCxt* smlInitTableDataCtx(SQuery* query, STableMeta* pTableMeta); +int32_t smlInitTableDataCtx(SQuery* query, STableMeta* pTableMeta, STableDataCxt** cxt); void clearColValArraySml(SArray* pCols); int32_t smlBindData(SQuery* handle, bool dataFormat, SArray* tags, SArray* colsSchema, SArray* cols, diff --git a/include/libs/scheduler/scheduler.h b/include/libs/scheduler/scheduler.h index 1e2ccf8705..8ab3b898ca 100644 --- a/include/libs/scheduler/scheduler.h +++ b/include/libs/scheduler/scheduler.h @@ -23,8 +23,6 @@ extern "C" { #include "catalog.h" #include "planner.h" -extern tsem_t schdRspSem; - typedef struct SQueryProfileSummary { int64_t startTs; // Object created and added into the message queue int64_t endTs; // the timestamp when the task is completed @@ -101,8 +99,6 @@ void schedulerFreeJob(int64_t* job, int32_t errCode); void schedulerDestroy(void); -void schdExecCallback(SExecResult* pResult, void* param, int32_t code); - #ifdef __cplusplus } #endif diff --git a/include/libs/stream/tstreamUpdate.h b/include/libs/stream/tstreamUpdate.h index 632a82743f..e1b33de429 100644 --- a/include/libs/stream/tstreamUpdate.h +++ b/include/libs/stream/tstreamUpdate.h @@ -15,29 +15,29 @@ #ifndef _TSTREAMUPDATE_H_ #define _TSTREAMUPDATE_H_ +#include "storageapi.h" #include "taosdef.h" #include "tarray.h" #include "tcommon.h" #include "tmsg.h" -#include "storageapi.h" #ifdef __cplusplus extern "C" { #endif -SUpdateInfo *updateInfoInitP(SInterval *pInterval, int64_t watermark, bool igUp, int8_t pkType, int32_t pkLen); -SUpdateInfo *updateInfoInit(int64_t interval, int32_t precision, int64_t watermark, bool igUp, int8_t pkType, int32_t pkLen); -TSKEY updateInfoFillBlockData(SUpdateInfo *pInfo, SSDataBlock *pBlock, int32_t primaryTsCol, int32_t primaryKeyCol); -bool updateInfoIsUpdated(SUpdateInfo *pInfo, uint64_t tableId, TSKEY ts, void* pPkVal, int32_t len); -bool updateInfoIsTableInserted(SUpdateInfo *pInfo, int64_t tbUid); -void updateInfoDestroy(SUpdateInfo *pInfo); -void updateInfoAddCloseWindowSBF(SUpdateInfo *pInfo); -void updateInfoDestoryColseWinSBF(SUpdateInfo *pInfo); -int32_t updateInfoSerialize(void *buf, int32_t bufLen, const SUpdateInfo *pInfo); -int32_t updateInfoDeserialize(void *buf, int32_t bufLen, SUpdateInfo *pInfo); -void windowSBfDelete(SUpdateInfo *pInfo, uint64_t count); -void windowSBfAdd(SUpdateInfo *pInfo, uint64_t count); -bool isIncrementalTimeStamp(SUpdateInfo *pInfo, uint64_t tableId, TSKEY ts, void* pPkVal, int32_t len); +int32_t updateInfoInitP(SInterval* pInterval, int64_t watermark, bool igUp, int8_t pkType, int32_t pkLen, SUpdateInfo** ppInfo); +int32_t updateInfoInit(int64_t interval, int32_t precision, int64_t watermark, bool igUp, int8_t pkType, int32_t pkLen, SUpdateInfo** ppInfo); +TSKEY updateInfoFillBlockData(SUpdateInfo* pInfo, SSDataBlock* pBlock, int32_t primaryTsCol, int32_t primaryKeyCol); +bool updateInfoIsUpdated(SUpdateInfo* pInfo, uint64_t tableId, TSKEY ts, void* pPkVal, int32_t len); +bool updateInfoIsTableInserted(SUpdateInfo* pInfo, int64_t tbUid); +void updateInfoDestroy(SUpdateInfo* pInfo); +void updateInfoAddCloseWindowSBF(SUpdateInfo* pInfo); +void updateInfoDestoryColseWinSBF(SUpdateInfo* pInfo); +int32_t updateInfoSerialize(void* buf, int32_t bufLen, const SUpdateInfo* pInfo, int32_t* pLen); +int32_t updateInfoDeserialize(void* buf, int32_t bufLen, SUpdateInfo* pInfo); +void windowSBfDelete(SUpdateInfo* pInfo, uint64_t count); +int32_t windowSBfAdd(SUpdateInfo* pInfo, uint64_t count); +bool isIncrementalTimeStamp(SUpdateInfo* pInfo, uint64_t tableId, TSKEY ts, void* pPkVal, int32_t len); #ifdef __cplusplus } diff --git a/include/libs/sync/sync.h b/include/libs/sync/sync.h index 0be03b82f3..1fb077e3ca 100644 --- a/include/libs/sync/sync.h +++ b/include/libs/sync/sync.h @@ -70,7 +70,6 @@ typedef int64_t SyncIndex; typedef int64_t SyncTerm; typedef struct SSyncNode SSyncNode; -typedef struct SWal SWal; typedef struct SSyncRaftEntry SSyncRaftEntry; typedef enum { @@ -238,7 +237,7 @@ typedef struct SSyncInfo { int32_t batchSize; SSyncCfg syncCfg; char path[TSDB_FILENAME_LEN]; - SWal* pWal; + struct SWal* pWal; SSyncFSM* pFsm; SMsgCb* msgcb; int32_t pingMs; diff --git a/include/libs/transport/thttp.h b/include/libs/transport/thttp.h index f6f1f7f027..a2f6b5ac8b 100644 --- a/include/libs/transport/thttp.h +++ b/include/libs/transport/thttp.h @@ -28,6 +28,11 @@ typedef enum { HTTP_GZIP, HTTP_FLAT } EHttpCompFlag; int32_t taosSendHttpReport(const char* server, const char* uri, uint16_t port, char* pCont, int32_t contLen, EHttpCompFlag flag); +int64_t taosInitHttpChan(); +int32_t taosSendHttpReportByChan(const char* server, const char* uri, uint16_t port, char* pCont, int32_t contLen, + EHttpCompFlag flag, int64_t chanId); +void taosDestroyHttpChan(int64_t chanId); + #ifdef __cplusplus } #endif diff --git a/include/os/osMemory.h b/include/os/osMemory.h index 683d10e926..6166f1dc07 100644 --- a/include/os/osMemory.h +++ b/include/os/osMemory.h @@ -53,6 +53,8 @@ void taosPrintBackTrace(); void taosMemoryTrim(int32_t size); void *taosMemoryMallocAlign(uint32_t alignment, int64_t size); +#define TAOS_MEMSET(_s, _c, _n) ((void)memset(_s, _c, _n)) + #define taosMemoryFreeClear(ptr) \ do { \ if (ptr) { \ diff --git a/include/os/osString.h b/include/os/osString.h index ac7dd7eda8..c834eb8e65 100644 --- a/include/os/osString.h +++ b/include/os/osString.h @@ -55,10 +55,12 @@ typedef enum { M2C = 0, C2M } ConvType; #define tstrncpy(dst, src, size) \ do { \ - strncpy((dst), (src), (size)); \ + (void)strncpy((dst), (src), (size)); \ (dst)[(size)-1] = 0; \ } while (0) +#define TAOS_STRCPY(_dst, _src) ((void)strcpy(_dst, _src)) + char *tstrdup(const char *src); int32_t taosUcs4len(TdUcs4 *ucs4); int64_t taosStr2int64(const char *str); diff --git a/include/util/talgo.h b/include/util/talgo.h index 29c51cc16b..dda213ae5a 100644 --- a/include/util/talgo.h +++ b/include/util/talgo.h @@ -52,7 +52,7 @@ typedef int32_t (*__ext_compar_fn_t)(const void *p1, const void *p2, const void * @param param * @param comparFn */ -void taosqsort(void *src, int64_t numOfElem, int64_t size, const void *param, __ext_compar_fn_t comparFn); +int32_t taosqsort(void *src, int64_t numOfElem, int64_t size, const void *param, __ext_compar_fn_t comparFn); /** * Non-recursive quick sort. @@ -98,8 +98,8 @@ void *taosbsearch(const void *key, const void *base, int32_t nmemb, int32_t size * @param maxroot: if heap is max root heap * @return */ -void taosheapadjust(void *base, int32_t size, int32_t start, int32_t end, const void *parcompar, - __ext_compar_fn_t compar, char *buf, bool maxroot); +int32_t taosheapadjust(void *base, int32_t size, int32_t start, int32_t end, const void *parcompar, + __ext_compar_fn_t compar, char *buf, bool maxroot); /** * sort heap to make sure it is a max/min root heap @@ -114,7 +114,8 @@ void taosheapadjust(void *base, int32_t size, int32_t start, int32_t end, const * @param maxroot: if heap is max root heap * @return */ -void taosheapsort(void *base, int32_t size, int32_t len, const void *parcompar, __ext_compar_fn_t compar, bool maxroot); +int32_t taosheapsort(void *base, int32_t size, int32_t len, const void *parcompar, __ext_compar_fn_t compar, + bool maxroot); #ifdef __cplusplus } diff --git a/include/util/taoserror.h b/include/util/taoserror.h index 24f9d041fc..053bb20e2a 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -89,6 +89,7 @@ int32_t taosGetErrSize(); #define TSDB_CODE_RPC_MAX_SESSIONS TAOS_DEF_ERROR_CODE(0, 0x0022) // #define TSDB_CODE_RPC_NETWORK_ERROR TAOS_DEF_ERROR_CODE(0, 0x0023) #define TSDB_CODE_RPC_NETWORK_BUSY TAOS_DEF_ERROR_CODE(0, 0x0024) +#define TSDB_CODE_HTTP_MODULE_QUIT TAOS_DEF_ERROR_CODE(0, 0x0025) @@ -836,6 +837,7 @@ int32_t taosGetErrSize(); #define TSDB_CODE_PAR_TBNAME_DUPLICATED TAOS_DEF_ERROR_CODE(0, 0x267E) #define TSDB_CODE_PAR_TAG_NAME_DUPLICATED TAOS_DEF_ERROR_CODE(0, 0x267F) #define TSDB_CODE_PAR_NOT_ALLOWED_DIFFERENT_BY_ROW_FUNC TAOS_DEF_ERROR_CODE(0, 0x2680) +#define TSDB_CODE_PAR_REGULAR_EXPRESSION_ERROR TAOS_DEF_ERROR_CODE(0, 0x2681) #define TSDB_CODE_PAR_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x26FF) //planner @@ -940,6 +942,11 @@ int32_t taosGetErrSize(); // UTIL #define TSDB_CODE_UTIL_QUEUE_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x6000) +// AUDIT +#define TSDB_CODE_AUDIT_NOT_FORMAT_TO_JSON TAOS_DEF_ERROR_CODE(0, 0x6100) +#define TSDB_CODE_AUDIT_FAIL_SEND_AUDIT_RECORD TAOS_DEF_ERROR_CODE(0, 0x6101) +#define TSDB_CODE_AUDIT_FAIL_GENERATE_JSON TAOS_DEF_ERROR_CODE(0, 0x6102) + #ifdef __cplusplus } #endif diff --git a/include/util/tarray.h b/include/util/tarray.h index e494f78f48..0d01c9248f 100644 --- a/include/util/tarray.h +++ b/include/util/tarray.h @@ -205,7 +205,7 @@ void taosArrayClearEx(SArray* pArray, void (*fp)(void*)); void taosArrayClearP(SArray* pArray, void (*fp)(void*)); -void* taosArrayDestroy(SArray* pArray); +void taosArrayDestroy(SArray* pArray); void taosArrayDestroyP(SArray* pArray, FDelete fp); @@ -251,7 +251,7 @@ int32_t taosArraySearchIdx(const SArray* pArray, const void* key, __compar_fn_t * @return */ -void taosArraySortPWithExt(SArray* pArray, __ext_compar_fn_t fn, const void* param); +int32_t taosArraySortPWithExt(SArray* pArray, __ext_compar_fn_t fn, const void* param); int32_t taosEncodeArray(void** buf, const SArray* pArray, FEncode encode); void* taosDecodeArray(const void* buf, SArray** pArray, FDecode decode, int32_t dataSz, int8_t sver); diff --git a/include/util/tbloomfilter.h b/include/util/tbloomfilter.h index 23bf5aaafb..f0450cb862 100644 --- a/include/util/tbloomfilter.h +++ b/include/util/tbloomfilter.h @@ -19,6 +19,8 @@ #include "os.h" #include "tencode.h" #include "thash.h" +#include "tlog.h" +#include "tutil.h" #ifdef __cplusplus extern "C" { @@ -35,19 +37,19 @@ typedef struct SBloomFilter { uint64_t size; _hash_fn_t hashFn1; _hash_fn_t hashFn2; - void *buffer; + void* buffer; double errorRate; } SBloomFilter; -SBloomFilter *tBloomFilterInit(uint64_t expectedEntries, double errorRate); -int32_t tBloomFilterPutHash(SBloomFilter *pBF, uint64_t hash1, uint64_t hash2); -int32_t tBloomFilterPut(SBloomFilter *pBF, const void *keyBuf, uint32_t len); -int32_t tBloomFilterNoContain(const SBloomFilter *pBF, uint64_t h1, uint64_t h2); -void tBloomFilterDestroy(SBloomFilter *pBF); -void tBloomFilterDump(const SBloomFilter *pBF); -bool tBloomFilterIsFull(const SBloomFilter *pBF); -int32_t tBloomFilterEncode(const SBloomFilter *pBF, SEncoder *pEncoder); -SBloomFilter *tBloomFilterDecode(SDecoder *pDecoder); +int32_t tBloomFilterInit(uint64_t expectedEntries, double errorRate, SBloomFilter** ppBF); +int32_t tBloomFilterPutHash(SBloomFilter* pBF, uint64_t hash1, uint64_t hash2); +int32_t tBloomFilterPut(SBloomFilter* pBF, const void* keyBuf, uint32_t len); +int32_t tBloomFilterNoContain(const SBloomFilter* pBF, uint64_t h1, uint64_t h2); +void tBloomFilterDestroy(SBloomFilter* pBF); +void tBloomFilterDump(const SBloomFilter* pBF); +bool tBloomFilterIsFull(const SBloomFilter* pBF); +int32_t tBloomFilterEncode(const SBloomFilter* pBF, SEncoder* pEncoder); +int32_t tBloomFilterDecode(SDecoder* pDecoder, SBloomFilter** ppBF); #ifdef __cplusplus } diff --git a/include/util/tcompare.h b/include/util/tcompare.h index 9694bee92d..80f992f646 100644 --- a/include/util/tcompare.h +++ b/include/util/tcompare.h @@ -45,7 +45,10 @@ typedef struct SPatternCompareInfo { TdUcs4 umatchOne; // unicode version matchOne } SPatternCompareInfo; +int32_t InitRegexCache(); +void DestroyRegexCache(); int32_t patternMatch(const char *pattern, size_t psize, const char *str, size_t ssize, const SPatternCompareInfo *pInfo); +int32_t checkRegexPattern(const char *pPattern); int32_t wcsPatternMatch(const TdUcs4 *pattern, size_t psize, const TdUcs4 *str, size_t ssize, const SPatternCompareInfo *pInfo); @@ -83,7 +86,6 @@ int32_t compareLenBinaryVal(const void *pLeft, const void *pRight); int32_t comparestrRegexMatch(const void *pLeft, const void *pRight); int32_t comparestrRegexNMatch(const void *pLeft, const void *pRight); -void DestoryThreadLocalRegComp(); int32_t comparewcsRegexMatch(const void *pLeft, const void *pRight); int32_t comparewcsRegexNMatch(const void *pLeft, const void *pRight); diff --git a/include/util/tencode.h b/include/util/tencode.h index b8da040689..9b9f8af1b6 100644 --- a/include/util/tencode.h +++ b/include/util/tencode.h @@ -18,6 +18,7 @@ #include "tcoding.h" #include "tlist.h" +#include "tutil.h" #ifdef __cplusplus extern "C" { @@ -46,38 +47,8 @@ typedef struct { SDecoderNode* dStack; } SDecoder; -#define tPut(TYPE, BUF, VAL) ((TYPE*)(BUF))[0] = (VAL) -#define tGet(TYPE, BUF, VAL) (VAL) = ((TYPE*)(BUF))[0] - -#define tRPut16(PDEST, PSRC) \ - ((uint8_t*)(PDEST))[0] = ((uint8_t*)(PSRC))[1]; \ - ((uint8_t*)(PDEST))[1] = ((uint8_t*)(PSRC))[0]; - -#define tRPut32(PDEST, PSRC) \ - ((uint8_t*)(PDEST))[0] = ((uint8_t*)(PSRC))[3]; \ - ((uint8_t*)(PDEST))[1] = ((uint8_t*)(PSRC))[2]; \ - ((uint8_t*)(PDEST))[2] = ((uint8_t*)(PSRC))[1]; \ - ((uint8_t*)(PDEST))[3] = ((uint8_t*)(PSRC))[0]; - -#define tRPut64(PDEST, PSRC) \ - ((uint8_t*)(PDEST))[0] = ((uint8_t*)(PSRC))[7]; \ - ((uint8_t*)(PDEST))[1] = ((uint8_t*)(PSRC))[6]; \ - ((uint8_t*)(PDEST))[2] = ((uint8_t*)(PSRC))[5]; \ - ((uint8_t*)(PDEST))[3] = ((uint8_t*)(PSRC))[4]; \ - ((uint8_t*)(PDEST))[4] = ((uint8_t*)(PSRC))[3]; \ - ((uint8_t*)(PDEST))[5] = ((uint8_t*)(PSRC))[2]; \ - ((uint8_t*)(PDEST))[6] = ((uint8_t*)(PSRC))[1]; \ - ((uint8_t*)(PDEST))[7] = ((uint8_t*)(PSRC))[0]; - -#define tRGet16 tRPut16 -#define tRGet32 tRPut32 -#define tRGet64 tRPut64 - -#define TD_CODER_POS(CODER) ((CODER)->pos) -#define TD_CODER_CURRENT(CODER) ((CODER)->data + (CODER)->pos) -#define TD_CODER_MOVE_POS(CODER, MOVE) ((CODER)->pos += (MOVE)) -#define TD_CODER_CHECK_CAPACITY_FAILED(CODER, EXPSIZE) (((CODER)->size - (CODER)->pos) < (EXPSIZE)) -#define TD_CODER_REMAIN_CAPACITY(CODER) ((CODER)->size - (CODER)->pos) +#define TD_CODER_CURRENT(CODER) ((CODER)->data + (CODER)->pos) +#define TD_CODER_REMAIN_CAPACITY(CODER) ((CODER)->size - (CODER)->pos) #define tEncodeSize(E, S, SIZE, RET) \ do { \ @@ -100,6 +71,7 @@ void tEncoderInit(SEncoder* pCoder, uint8_t* data, uint32_t size); void tEncoderClear(SEncoder* pCoder); int32_t tStartEncode(SEncoder* pCoder); void tEndEncode(SEncoder* pCoder); +static int32_t tEncodeFixed(SEncoder* pCoder, const void* val, uint32_t size); static int32_t tEncodeU8(SEncoder* pCoder, uint8_t val); static int32_t tEncodeI8(SEncoder* pCoder, int8_t val); static int32_t tEncodeU16(SEncoder* pCoder, uint16_t val); @@ -127,6 +99,7 @@ void tDecoderClear(SDecoder* SDecoder); int32_t tStartDecode(SDecoder* pCoder); void tEndDecode(SDecoder* pCoder); static bool tDecodeIsEnd(SDecoder* pCoder); +static int32_t tDecodeFixed(SDecoder* pCoder, void* val, uint32_t size); static int32_t tDecodeU8(SDecoder* pCoder, uint8_t* val); static int32_t tDecodeI8(SDecoder* pCoder, int8_t* val); static int32_t tDecodeU16(SDecoder* pCoder, uint16_t* val); @@ -149,97 +122,65 @@ static int32_t tDecodeCStr(SDecoder* pCoder, char** val); static int32_t tDecodeCStrTo(SDecoder* pCoder, char* val); /* ------------------------ IMPL ------------------------ */ -#define TD_ENCODE_MACRO(CODER, VAL, TYPE, BITS) \ - if ((CODER)->data) { \ - if (TD_CODER_CHECK_CAPACITY_FAILED(CODER, sizeof(VAL))) return -1; \ - tPut(TYPE, TD_CODER_CURRENT(CODER), (VAL)); \ - } \ - TD_CODER_MOVE_POS(CODER, sizeof(VAL)); \ - return 0; - -#define TD_ENCODE_VARIANT_MACRO(CODER, VAL) \ - while ((VAL) >= ENCODE_LIMIT) { \ - if ((CODER)->data) { \ - if (TD_CODER_CHECK_CAPACITY_FAILED(CODER, 1)) return -1; \ - TD_CODER_CURRENT(CODER)[0] = ((VAL) | ENCODE_LIMIT) & 0xff; \ - } \ - \ - (VAL) >>= 7; \ - TD_CODER_MOVE_POS(CODER, 1); \ - } \ - \ - if ((CODER)->data) { \ - if (TD_CODER_CHECK_CAPACITY_FAILED(CODER, 1)) return -1; \ - TD_CODER_CURRENT(CODER)[0] = (uint8_t)(VAL); \ - } \ - TD_CODER_MOVE_POS(CODER, 1); \ - return 0; - -#define TD_DECODE_MACRO(CODER, PVAL, TYPE, BITS) \ - if (TD_CODER_CHECK_CAPACITY_FAILED(CODER, sizeof(*(PVAL)))) return -1; \ - tGet(TYPE, TD_CODER_CURRENT(CODER), *(PVAL)); \ - TD_CODER_MOVE_POS(CODER, sizeof(*(PVAL))); \ - return 0; - -#define TD_DECODE_VARIANT_MACRO(CODER, PVAL, TYPE) \ - int32_t i = 0; \ - *(PVAL) = 0; \ - for (;;) { \ - if (TD_CODER_CHECK_CAPACITY_FAILED(CODER, 1)) return -1; \ - TYPE tval = TD_CODER_CURRENT(CODER)[0]; \ - if (tval < ENCODE_LIMIT) { \ - *(PVAL) |= (tval << (7 * i)); \ - TD_CODER_MOVE_POS(pCoder, 1); \ - break; \ - } else { \ - *(PVAL) |= (((tval) & (ENCODE_LIMIT - 1)) << (7 * i)); \ - i++; \ - TD_CODER_MOVE_POS(pCoder, 1); \ - } \ - } \ - \ - return 0; - -// 8 -static FORCE_INLINE int32_t tEncodeU8(SEncoder* pCoder, uint8_t val) { +static FORCE_INLINE int32_t tEncodeFixed(SEncoder* pCoder, const void* val, uint32_t size) { if (pCoder->data) { - if (TD_CODER_CHECK_CAPACITY_FAILED(pCoder, sizeof(val))) return -1; - tPut(uint8_t, TD_CODER_CURRENT(pCoder), val); + if (pCoder->pos + size > pCoder->size) { + TAOS_RETURN(TSDB_CODE_OUT_OF_RANGE); + } + memcpy(pCoder->data + pCoder->pos, val, size); } - TD_CODER_MOVE_POS(pCoder, sizeof(val)); + + pCoder->pos += size; return 0; } -static FORCE_INLINE int32_t tEncodeI8(SEncoder* pCoder, int8_t val) { - if (pCoder->data) { - if (TD_CODER_CHECK_CAPACITY_FAILED(pCoder, sizeof(val))) return -1; - tPut(int8_t, TD_CODER_CURRENT(pCoder), val); - } - TD_CODER_MOVE_POS(pCoder, sizeof(val)); - return 0; +static FORCE_INLINE int32_t tEncodeU8(SEncoder* pCoder, uint8_t val) { return tEncodeFixed(pCoder, &val, sizeof(val)); } +static FORCE_INLINE int32_t tEncodeI8(SEncoder* pCoder, int8_t val) { return tEncodeFixed(pCoder, &val, sizeof(val)); } +static FORCE_INLINE int32_t tEncodeU16(SEncoder* pCoder, uint16_t val) { + return tEncodeFixed(pCoder, &val, sizeof(val)); +} +static FORCE_INLINE int32_t tEncodeI16(SEncoder* pCoder, int16_t val) { + return tEncodeFixed(pCoder, &val, sizeof(val)); +} +static FORCE_INLINE int32_t tEncodeU32(SEncoder* pCoder, uint32_t val) { + return tEncodeFixed(pCoder, &val, sizeof(val)); +} +static FORCE_INLINE int32_t tEncodeI32(SEncoder* pCoder, int32_t val) { + return tEncodeFixed(pCoder, &val, sizeof(val)); +} +static FORCE_INLINE int32_t tEncodeU64(SEncoder* pCoder, uint64_t val) { + return tEncodeFixed(pCoder, &val, sizeof(val)); +} +static FORCE_INLINE int32_t tEncodeI64(SEncoder* pCoder, int64_t val) { + return tEncodeFixed(pCoder, &val, sizeof(val)); +} +static FORCE_INLINE int32_t tEncodeU16v(SEncoder* pCoder, uint16_t val) { + while (val >= ENCODE_LIMIT) { + TAOS_CHECK_RETURN(tEncodeU8(pCoder, (val | ENCODE_LIMIT) & 0xff)); + val >>= 7; + } + return tEncodeU8(pCoder, val); } - -// 16 -static FORCE_INLINE int32_t tEncodeU16(SEncoder* pCoder, uint16_t val) { TD_ENCODE_MACRO(pCoder, val, uint16_t, 16); } -static FORCE_INLINE int32_t tEncodeI16(SEncoder* pCoder, int16_t val) { TD_ENCODE_MACRO(pCoder, val, int16_t, 16); } -// 32 -static FORCE_INLINE int32_t tEncodeU32(SEncoder* pCoder, uint32_t val) { TD_ENCODE_MACRO(pCoder, val, uint32_t, 32); } -static FORCE_INLINE int32_t tEncodeI32(SEncoder* pCoder, int32_t val) { TD_ENCODE_MACRO(pCoder, val, int32_t, 32); } -// 64 -static FORCE_INLINE int32_t tEncodeU64(SEncoder* pCoder, uint64_t val) { TD_ENCODE_MACRO(pCoder, val, uint64_t, 64); } -static FORCE_INLINE int32_t tEncodeI64(SEncoder* pCoder, int64_t val) { TD_ENCODE_MACRO(pCoder, val, int64_t, 64); } -// 16v -static FORCE_INLINE int32_t tEncodeU16v(SEncoder* pCoder, uint16_t val) { TD_ENCODE_VARIANT_MACRO(pCoder, val); } static FORCE_INLINE int32_t tEncodeI16v(SEncoder* pCoder, int16_t val) { return tEncodeU16v(pCoder, ZIGZAGE(int16_t, val)); } -// 32v -static FORCE_INLINE int32_t tEncodeU32v(SEncoder* pCoder, uint32_t val) { TD_ENCODE_VARIANT_MACRO(pCoder, val); } +static FORCE_INLINE int32_t tEncodeU32v(SEncoder* pCoder, uint32_t val) { + while (val >= ENCODE_LIMIT) { + TAOS_CHECK_RETURN(tEncodeU8(pCoder, (val | ENCODE_LIMIT) & 0xff)); + val >>= 7; + } + return tEncodeU8(pCoder, val); +} static FORCE_INLINE int32_t tEncodeI32v(SEncoder* pCoder, int32_t val) { return tEncodeU32v(pCoder, ZIGZAGE(int32_t, val)); } -// 64v -static FORCE_INLINE int32_t tEncodeU64v(SEncoder* pCoder, uint64_t val) { TD_ENCODE_VARIANT_MACRO(pCoder, val); } +static FORCE_INLINE int32_t tEncodeU64v(SEncoder* pCoder, uint64_t val) { + while (val >= ENCODE_LIMIT) { + TAOS_CHECK_RETURN(tEncodeU8(pCoder, (val | ENCODE_LIMIT) & 0xff)); + val >>= 7; + } + return tEncodeU8(pCoder, val); +} static FORCE_INLINE int32_t tEncodeI64v(SEncoder* pCoder, int64_t val) { return tEncodeU64v(pCoder, ZIGZAGE(int64_t, val)); } @@ -265,14 +206,16 @@ static FORCE_INLINE int32_t tEncodeDouble(SEncoder* pCoder, double val) { } static FORCE_INLINE int32_t tEncodeBinary(SEncoder* pCoder, const uint8_t* val, uint32_t len) { - if (tEncodeU32v(pCoder, len) < 0) return -1; + TAOS_CHECK_RETURN(tEncodeU32v(pCoder, len)); if (len) { if (pCoder->data) { - if (TD_CODER_CHECK_CAPACITY_FAILED(pCoder, len)) return -1; - memcpy(TD_CODER_CURRENT(pCoder), val, len); + if (pCoder->pos + len > pCoder->size) { + TAOS_RETURN(TSDB_CODE_OUT_OF_RANGE); + } + memcpy(pCoder->data + pCoder->pos, val, len); } - TD_CODER_MOVE_POS(pCoder, len); + pCoder->pos += len; } return 0; } @@ -286,70 +229,137 @@ static FORCE_INLINE int32_t tEncodeCStr(SEncoder* pCoder, const char* val) { } /* ------------------------ FOR DECODER ------------------------ */ -// 8 -static FORCE_INLINE int32_t tDecodeU8(SDecoder* pCoder, uint8_t* val) { - if (TD_CODER_CHECK_CAPACITY_FAILED(pCoder, sizeof(*val))) return -1; - tGet(uint8_t, TD_CODER_CURRENT(pCoder), *val); - TD_CODER_MOVE_POS(pCoder, sizeof(*val)); +static int32_t tDecodeFixed(SDecoder* pCoder, void* val, uint32_t size) { + if (pCoder->pos + size > pCoder->size) { + TAOS_RETURN(TSDB_CODE_OUT_OF_RANGE); + } else if (val) { + memcpy(val, pCoder->data + pCoder->pos, size); + } + pCoder->pos += size; return 0; } -static FORCE_INLINE int32_t tDecodeI8(SDecoder* pCoder, int8_t* val) { - if (TD_CODER_CHECK_CAPACITY_FAILED(pCoder, sizeof(*val))) return -1; - tGet(int8_t, TD_CODER_CURRENT(pCoder), *val); - TD_CODER_MOVE_POS(pCoder, sizeof(*val)); - return 0; +static FORCE_INLINE int32_t tDecodeU8(SDecoder* pCoder, uint8_t* val) { + return tDecodeFixed(pCoder, val, sizeof(*val)); } +static FORCE_INLINE int32_t tDecodeI8(SDecoder* pCoder, int8_t* val) { return tDecodeFixed(pCoder, val, sizeof(*val)); } + // 16 -static FORCE_INLINE int32_t tDecodeU16(SDecoder* pCoder, uint16_t* val) { TD_DECODE_MACRO(pCoder, val, uint16_t, 16); } -static FORCE_INLINE int32_t tDecodeI16(SDecoder* pCoder, int16_t* val) { TD_DECODE_MACRO(pCoder, val, int16_t, 16); } +static FORCE_INLINE int32_t tDecodeU16(SDecoder* pCoder, uint16_t* val) { + return tDecodeFixed(pCoder, val, sizeof(*val)); +} +static FORCE_INLINE int32_t tDecodeI16(SDecoder* pCoder, int16_t* val) { + return tDecodeFixed(pCoder, val, sizeof(*val)); +} // 32 -static FORCE_INLINE int32_t tDecodeU32(SDecoder* pCoder, uint32_t* val) { TD_DECODE_MACRO(pCoder, val, uint32_t, 32); } -static FORCE_INLINE int32_t tDecodeI32(SDecoder* pCoder, int32_t* val) { TD_DECODE_MACRO(pCoder, val, int32_t, 32); } +static FORCE_INLINE int32_t tDecodeU32(SDecoder* pCoder, uint32_t* val) { + return tDecodeFixed(pCoder, val, sizeof(*val)); +} +static FORCE_INLINE int32_t tDecodeI32(SDecoder* pCoder, int32_t* val) { + return tDecodeFixed(pCoder, val, sizeof(*val)); +} // 64 -static FORCE_INLINE int32_t tDecodeU64(SDecoder* pCoder, uint64_t* val) { TD_DECODE_MACRO(pCoder, val, uint64_t, 64); } -static FORCE_INLINE int32_t tDecodeI64(SDecoder* pCoder, int64_t* val) { TD_DECODE_MACRO(pCoder, val, int64_t, 64); } +static FORCE_INLINE int32_t tDecodeU64(SDecoder* pCoder, uint64_t* val) { + return tDecodeFixed(pCoder, val, sizeof(*val)); +} +static FORCE_INLINE int32_t tDecodeI64(SDecoder* pCoder, int64_t* val) { + return tDecodeFixed(pCoder, val, sizeof(*val)); +} // 16v static FORCE_INLINE int32_t tDecodeU16v(SDecoder* pCoder, uint16_t* val) { - TD_DECODE_VARIANT_MACRO(pCoder, val, uint16_t); + uint8_t byte; + uint16_t tval = 0; + for (int32_t i = 0;; i++) { + TAOS_CHECK_RETURN(tDecodeU8(pCoder, &byte)); + if (byte < ENCODE_LIMIT) { + tval |= (((uint16_t)byte) << (7 * i)); + break; + } else { + tval |= ((((uint16_t)byte) & (ENCODE_LIMIT - 1)) << (7 * i)); + } + } + + if (val) { + *val = tval; + } + + return 0; } static FORCE_INLINE int32_t tDecodeI16v(SDecoder* pCoder, int16_t* val) { uint16_t tval; - if (tDecodeU16v(pCoder, &tval) < 0) { - return -1; + TAOS_CHECK_RETURN(tDecodeU16v(pCoder, &tval)); + + if (val) { + *val = ZIGZAGD(int16_t, tval); } - if (val) *val = ZIGZAGD(int16_t, tval); + return 0; } // 32v static FORCE_INLINE int32_t tDecodeU32v(SDecoder* pCoder, uint32_t* val) { - TD_DECODE_VARIANT_MACRO(pCoder, val, uint32_t); + uint8_t byte; + uint32_t tval = 0; + for (int32_t i = 0;; i++) { + TAOS_CHECK_RETURN(tDecodeU8(pCoder, &byte)); + if (byte < ENCODE_LIMIT) { + tval |= (((uint32_t)byte) << (7 * i)); + break; + } else { + tval |= ((((uint32_t)byte) & (ENCODE_LIMIT - 1)) << (7 * i)); + } + } + + if (val) { + *val = tval; + } + + return 0; } static FORCE_INLINE int32_t tDecodeI32v(SDecoder* pCoder, int32_t* val) { uint32_t tval; - if (tDecodeU32v(pCoder, &tval) < 0) { - return -1; + TAOS_CHECK_RETURN(tDecodeU32v(pCoder, &tval)); + + if (val) { + *val = ZIGZAGD(int32_t, tval); } - if (val) *val = ZIGZAGD(int32_t, tval); + return 0; } // 64v static FORCE_INLINE int32_t tDecodeU64v(SDecoder* pCoder, uint64_t* val) { - TD_DECODE_VARIANT_MACRO(pCoder, val, uint64_t); + uint8_t byte; + uint64_t tval = 0; + for (int32_t i = 0;; i++) { + TAOS_CHECK_RETURN(tDecodeU8(pCoder, &byte)); + if (byte < ENCODE_LIMIT) { + tval |= (((uint64_t)byte) << (7 * i)); + break; + } else { + tval |= ((((uint64_t)byte) & (ENCODE_LIMIT - 1)) << (7 * i)); + } + } + + if (val) { + *val = tval; + } + + return 0; } static FORCE_INLINE int32_t tDecodeI64v(SDecoder* pCoder, int64_t* val) { uint64_t tval; - if (tDecodeU64v(pCoder, &tval) < 0) { - return -1; + TAOS_CHECK_RETURN(tDecodeU64v(pCoder, &tval)); + + if (val) { + *val = ZIGZAGD(int64_t, tval); } - if (val) *val = ZIGZAGD(int64_t, tval); + return 0; } @@ -359,11 +369,11 @@ static FORCE_INLINE int32_t tDecodeFloat(SDecoder* pCoder, float* val) { float f; } v; - if (tDecodeU32(pCoder, &(v.ui)) < 0) { - return -1; - } + TAOS_CHECK_RETURN(tDecodeU32(pCoder, &(v.ui))); - *val = v.f; + if (val) { + *val = v.f; + } return 0; } @@ -373,30 +383,36 @@ static FORCE_INLINE int32_t tDecodeDouble(SDecoder* pCoder, double* val) { double d; } v; - if (tDecodeU64(pCoder, &(v.ui)) < 0) { - return -1; - } + TAOS_CHECK_RETURN(tDecodeU64(pCoder, &(v.ui))); - *val = v.d; + if (val) { + *val = v.d; + } return 0; } static FORCE_INLINE int32_t tDecodeBinary(SDecoder* pCoder, uint8_t** val, uint32_t* len) { uint32_t length = 0; - if (tDecodeU32v(pCoder, &length) < 0) return -1; - if (len) *len = length; - if (TD_CODER_CHECK_CAPACITY_FAILED(pCoder, length)) return -1; - if (val) { - *val = (uint8_t*)TD_CODER_CURRENT(pCoder); + TAOS_CHECK_RETURN(tDecodeU32v(pCoder, &length)); + if (len) { + *len = length; } - TD_CODER_MOVE_POS(pCoder, length); + if (pCoder->pos + length > pCoder->size) { + TAOS_RETURN(TSDB_CODE_OUT_OF_RANGE); + } + + if (val) { + *val = pCoder->data + pCoder->pos; + } + + pCoder->pos += length; return 0; } static FORCE_INLINE int32_t tDecodeCStrAndLen(SDecoder* pCoder, char** val, uint32_t* len) { - if (tDecodeBinary(pCoder, (uint8_t**)val, len) < 0) return -1; + TAOS_CHECK_RETURN(tDecodeBinary(pCoder, (uint8_t**)val, len)); (*len) -= 1; return 0; } @@ -409,7 +425,7 @@ static FORCE_INLINE int32_t tDecodeCStr(SDecoder* pCoder, char** val) { static int32_t tDecodeCStrTo(SDecoder* pCoder, char* val) { char* pStr; uint32_t len; - if (tDecodeCStrAndLen(pCoder, &pStr, &len) < 0) return -1; + TAOS_CHECK_RETURN(tDecodeCStrAndLen(pCoder, &pStr, &len)); memcpy(val, pStr, len + 1); return 0; @@ -417,16 +433,22 @@ static int32_t tDecodeCStrTo(SDecoder* pCoder, char* val) { static FORCE_INLINE int32_t tDecodeBinaryAlloc(SDecoder* pCoder, void** val, uint64_t* len) { uint64_t length = 0; - if (tDecodeU64v(pCoder, &length) < 0) return -1; + TAOS_CHECK_RETURN(tDecodeU64v(pCoder, &length)); if (length) { if (len) *len = length; - if (TD_CODER_CHECK_CAPACITY_FAILED(pCoder, length)) return -1; - *val = taosMemoryMalloc(length); - if (*val == NULL) return -1; - memcpy(*val, TD_CODER_CURRENT(pCoder), length); + if (pCoder->pos + length > pCoder->size) { + TAOS_RETURN(TSDB_CODE_OUT_OF_RANGE); + } - TD_CODER_MOVE_POS(pCoder, length); + *val = taosMemoryMalloc(length); + if (*val == NULL) { + TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY); + } + + memcpy(*val, pCoder->data + pCoder->pos, length); + + pCoder->pos += length; } else { *val = NULL; } @@ -435,16 +457,20 @@ static FORCE_INLINE int32_t tDecodeBinaryAlloc(SDecoder* pCoder, void** val, uin static FORCE_INLINE int32_t tDecodeBinaryAlloc32(SDecoder* pCoder, void** val, uint32_t* len) { uint32_t length = 0; - if (tDecodeU32v(pCoder, &length) < 0) return -1; + TAOS_CHECK_RETURN(tDecodeU32v(pCoder, &length)); if (length) { if (len) *len = length; - if (TD_CODER_CHECK_CAPACITY_FAILED(pCoder, length)) return -1; + if (pCoder->pos + length > pCoder->size) { + TAOS_RETURN(TSDB_CODE_OUT_OF_RANGE); + } *val = taosMemoryMalloc(length); - if (*val == NULL) return -1; - memcpy(*val, TD_CODER_CURRENT(pCoder), length); + if (*val == NULL) { + TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY); + } + memcpy(*val, pCoder->data + pCoder->pos, length); - TD_CODER_MOVE_POS(pCoder, length); + pCoder->pos += length; } else { *val = NULL; } @@ -452,7 +478,7 @@ static FORCE_INLINE int32_t tDecodeBinaryAlloc32(SDecoder* pCoder, void** val, u } static FORCE_INLINE int32_t tDecodeCStrAndLenAlloc(SDecoder* pCoder, char** val, uint64_t* len) { - if (tDecodeBinaryAlloc(pCoder, (void**)val, len) < 0) return -1; + TAOS_CHECK_RETURN(tDecodeBinaryAlloc(pCoder, (void**)val, len)); (*len) -= 1; return 0; } diff --git a/include/util/tscalablebf.h b/include/util/tscalablebf.h index d3ce2eb23b..f82493aca2 100644 --- a/include/util/tscalablebf.h +++ b/include/util/tscalablebf.h @@ -23,22 +23,22 @@ extern "C" { #endif typedef struct SScalableBf { - SArray *bfArray; // array of bloom filters - uint32_t growth; - uint64_t numBits; - uint32_t maxBloomFilters; - int8_t status; + SArray* bfArray; // array of bloom filters + uint32_t growth; + uint64_t numBits; + uint32_t maxBloomFilters; + int8_t status; _hash_fn_t hashFn1; _hash_fn_t hashFn2; } SScalableBf; -SScalableBf *tScalableBfInit(uint64_t expectedEntries, double errorRate); -int32_t tScalableBfPutNoCheck(SScalableBf *pSBf, const void *keyBuf, uint32_t len); -int32_t tScalableBfPut(SScalableBf *pSBf, const void *keyBuf, uint32_t len); -int32_t tScalableBfNoContain(const SScalableBf *pSBf, const void *keyBuf, uint32_t len); -void tScalableBfDestroy(SScalableBf *pSBf); -int32_t tScalableBfEncode(const SScalableBf *pSBf, SEncoder *pEncoder); -SScalableBf *tScalableBfDecode(SDecoder *pDecoder); +int32_t tScalableBfInit(uint64_t expectedEntries, double errorRate, SScalableBf** ppSBf); +int32_t tScalableBfPutNoCheck(SScalableBf* pSBf, const void* keyBuf, uint32_t len); +int32_t tScalableBfPut(SScalableBf* pSBf, const void* keyBuf, uint32_t len); +int32_t tScalableBfNoContain(const SScalableBf* pSBf, const void* keyBuf, uint32_t len); +void tScalableBfDestroy(SScalableBf* pSBf); +int32_t tScalableBfEncode(const SScalableBf* pSBf, SEncoder* pEncoder); +int32_t tScalableBfDecode(SDecoder* pDecoder, SScalableBf** ppSBf); #ifdef __cplusplus } diff --git a/include/util/tutil.h b/include/util/tutil.h index d1a18dc3e8..31ce34f667 100644 --- a/include/util/tutil.h +++ b/include/util/tutil.h @@ -21,6 +21,7 @@ #include "tdef.h" #include "thash.h" #include "tmd5.h" +#include "tutil.h" #ifdef __cplusplus extern "C" { @@ -56,7 +57,7 @@ void taosIpPort2String(uint32_t ip, uint16_t port, char *str); void *tmemmem(const char *haystack, int hlen, const char *needle, int nlen); -int32_t parseCfgReal(const char* str, double* out); +int32_t parseCfgReal(const char *str, double *out); static FORCE_INLINE void taosEncryptPass(uint8_t *inBuf, size_t inLen, char *target) { T_MD5_CTX context; @@ -84,9 +85,9 @@ static FORCE_INLINE void taosEncryptPass_c(uint8_t *inBuf, size_t len, char *tar static FORCE_INLINE int32_t taosCreateMD5Hash(char *pBuf, int32_t len) { T_MD5_CTX ctx; tMD5Init(&ctx); - tMD5Update(&ctx, (uint8_t*)pBuf, len); + tMD5Update(&ctx, (uint8_t *)pBuf, len); tMD5Final(&ctx); - char* p = pBuf; + char *p = pBuf; int32_t resLen = 0; for (uint8_t i = 0; i < tListLen(ctx.digest); ++i) { resLen += snprintf(p, 3, "%02x", ctx.digest[i]); @@ -147,6 +148,30 @@ static FORCE_INLINE int32_t taosGetTbHashVal(const char *tbname, int32_t tblen, #define TCONTAINER_OF(ptr, type, member) ((type *)((char *)(ptr)-offsetof(type, member))) +#define TAOS_RETURN(code) \ + do { \ + return (terrno = (code)); \ + } while (0) + +#define TAOS_CHECK_RETURN(CMD) \ + do { \ + int32_t code = (CMD); \ + if (code != TSDB_CODE_SUCCESS) { \ + TAOS_RETURN(code); \ + } \ + } while (0) + +#define TAOS_CHECK_GOTO(CMD, LINO, LABEL) \ + do { \ + code = (CMD); \ + if (code != TSDB_CODE_SUCCESS) { \ + if (LINO) { \ + *((int32_t *)(LINO)) = __LINE__; \ + } \ + goto LABEL; \ + } \ + } while (0) + #ifdef __cplusplus } #endif diff --git a/source/client/inc/clientSml.h b/source/client/inc/clientSml.h index 122914fd34..e901f86b41 100644 --- a/source/client/inc/clientSml.h +++ b/source/client/inc/clientSml.h @@ -82,7 +82,7 @@ extern "C" { #define IS_SLASH_LETTER_IN_MEASUREMENT(sql) \ (*((sql)-1) == SLASH && (*(sql) == COMMA || *(sql) == SPACE || *(sql) == SLASH)) -#define MOVE_FORWARD_ONE(sql, len) (memmove((void *)((sql)-1), (sql), len)) +#define MOVE_FORWARD_ONE(sql, len) ((void)memmove((void *)((sql)-1), (sql), len)) #define PROCESS_SLASH_IN_MEASUREMENT(key, keyLen) \ for (int i = 1; i < keyLen; ++i) { \ @@ -211,19 +211,19 @@ extern int64_t smlFactorS[]; typedef int32_t (*_equal_fn_sml)(const void *, const void *); -SSmlHandle *smlBuildSmlInfo(TAOS *taos); +int32_t smlBuildSmlInfo(TAOS *taos, SSmlHandle **handle); void smlDestroyInfo(SSmlHandle *info); int smlJsonParseObjFirst(char **start, SSmlLineInfo *element, int8_t *offset); int smlJsonParseObj(char **start, SSmlLineInfo *element, int8_t *offset); bool smlParseNumberOld(SSmlKv *kvVal, SSmlMsgBuf *msg); -int32_t smlBuildInvalidDataMsg(SSmlMsgBuf *pBuf, const char *msg1, const char *msg2); -bool smlParseNumber(SSmlKv *kvVal, SSmlMsgBuf *msg); +void smlBuildInvalidDataMsg(SSmlMsgBuf *pBuf, const char *msg1, const char *msg2); +int32_t smlParseNumber(SSmlKv *kvVal, SSmlMsgBuf *msg); int64_t smlGetTimeValue(const char *value, int32_t len, uint8_t fromPrecision, uint8_t toPrecision); -SSmlTableInfo* smlBuildTableInfo(int numRows, const char* measure, int32_t measureLen); -SSmlSTableMeta* smlBuildSTableMeta(bool isDataFormat); +int32_t smlBuildTableInfo(int numRows, const char* measure, int32_t measureLen, SSmlTableInfo** tInfo); +int32_t smlBuildSTableMeta(bool isDataFormat, SSmlSTableMeta** sMeta); int32_t smlSetCTableName(SSmlTableInfo *oneTable); -void getTableUid(SSmlHandle *info, SSmlLineInfo *currElement, SSmlTableInfo *tinfo); -STableMeta* smlGetMeta(SSmlHandle *info, const void* measure, int32_t measureLen); +int32_t getTableUid(SSmlHandle *info, SSmlLineInfo *currElement, SSmlTableInfo *tinfo); +int32_t smlGetMeta(SSmlHandle *info, const void* measure, int32_t measureLen, STableMeta **pTableMeta); int32_t is_same_child_table_telnet(const void *a, const void *b); int64_t smlParseOpenTsdbTime(SSmlHandle *info, const char *data, int32_t len); int32_t smlClearForRerun(SSmlHandle *info); @@ -236,7 +236,7 @@ int32_t smlParseInfluxString(SSmlHandle *info, char *sql, char *sqlEnd, SSmlLine int32_t smlParseTelnetString(SSmlHandle *info, char *sql, char *sqlEnd, SSmlLineInfo *elements); int32_t smlParseJSON(SSmlHandle *info, char *payload); -SSmlSTableMeta* smlBuildSuperTableInfo(SSmlHandle *info, SSmlLineInfo *currElement); +int32_t smlBuildSuperTableInfo(SSmlHandle *info, SSmlLineInfo *currElement, SSmlSTableMeta** sMeta); bool isSmlTagAligned(SSmlHandle *info, int cnt, SSmlKv *kv); bool isSmlColAligned(SSmlHandle *info, int cnt, SSmlKv *kv); int32_t smlProcessChildTable(SSmlHandle *info, SSmlLineInfo *elements); diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c index ecfa1e3392..18907ede5d 100644 --- a/source/client/src/clientEnv.c +++ b/source/client/src/clientEnv.c @@ -127,7 +127,7 @@ static void generateWriteSlowLog(STscObj *pTscObj, SRequestObj *pRequest, int32_ cJSON_AddItemToObject(json, "error_info", cJSON_CreateString(tstrerror(pRequest->code))); cJSON_AddItemToObject(json, "type", cJSON_CreateNumber(reqType)); cJSON_AddItemToObject(json, "rows_num", cJSON_CreateNumber(pRequest->body.resInfo.numOfRows + pRequest->body.resInfo.totalRows)); - if(strlen(pRequest->sqlstr) > pTscObj->pAppInfo->monitorParas.tsSlowLogMaxLen){ + if(pRequest->sqlstr != NULL && strlen(pRequest->sqlstr) > pTscObj->pAppInfo->monitorParas.tsSlowLogMaxLen){ char tmp = pRequest->sqlstr[pTscObj->pAppInfo->monitorParas.tsSlowLogMaxLen]; pRequest->sqlstr[pTscObj->pAppInfo->monitorParas.tsSlowLogMaxLen] = '\0'; cJSON_AddItemToObject(json, "sql", cJSON_CreateString(pRequest->sqlstr)); diff --git a/source/client/src/clientHb.c b/source/client/src/clientHb.c index 1b7b9263a5..a7d459ff31 100644 --- a/source/client/src/clientHb.c +++ b/source/client/src/clientHb.c @@ -1398,7 +1398,8 @@ void hbMgrCleanUp() { taosThreadMutexLock(&clientHbMgr.lock); appHbMgrCleanup(); - clientHbMgr.appHbMgrs = taosArrayDestroy(clientHbMgr.appHbMgrs); + taosArrayDestroy(clientHbMgr.appHbMgrs); + clientHbMgr.appHbMgrs = NULL; taosThreadMutexUnlock(&clientHbMgr.lock); } diff --git a/source/client/src/clientRawBlockWrite.c b/source/client/src/clientRawBlockWrite.c index ce404092b0..fe12850e14 100644 --- a/source/client/src/clientRawBlockWrite.c +++ b/source/client/src/clientRawBlockWrite.c @@ -1572,9 +1572,8 @@ int taos_write_raw_block_with_fields_with_reqid(TAOS* taos, int rows, char* pDat } // uError("td23101 0vgId:%d, vgId:%d, name:%s, uid:%"PRIu64, vgData.vgId, pTableMeta->vgId, tbname, pTableMeta->uid); - pQuery = smlInitHandle(); - if (pQuery == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = smlInitHandle(&pQuery); + if (code != TSDB_CODE_SUCCESS) { goto end; } pVgHash = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, HASH_NO_LOCK); @@ -1656,9 +1655,9 @@ int taos_write_raw_block_with_reqid(TAOS* taos, int rows, char* pData, const cha if (code != TSDB_CODE_SUCCESS) { goto end; } - pQuery = smlInitHandle(); - if (pQuery == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + + code = smlInitHandle(&pQuery); + if (code != TSDB_CODE_SUCCESS) { goto end; } pVgHash = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, HASH_NO_LOCK); @@ -1755,12 +1754,12 @@ static int32_t tmqWriteRawDataImpl(TAOS* taos, void* data, int32_t dataLen) { conn.requestObjRefId = pRequest->self; conn.mgmtEps = getEpSet_s(&pRequest->pTscObj->pAppInfo->mgmtEp); - pQuery = smlInitHandle(); - if (pQuery == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = smlInitHandle(&pQuery); + if (code != TSDB_CODE_SUCCESS) { SET_ERROR_MSG("init sml handle failed"); goto end; } + pVgHash = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, HASH_NO_LOCK); while (++rspObj.common.resIter < rspObj.rsp.common.blockNum) { void* pRetrieve = taosArrayGetP(rspObj.rsp.common.blockData, rspObj.common.resIter); @@ -1903,12 +1902,12 @@ static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen) conn.requestObjRefId = pRequest->self; conn.mgmtEps = getEpSet_s(&pRequest->pTscObj->pAppInfo->mgmtEp); - pQuery = smlInitHandle(); - if (pQuery == NULL) { + code = smlInitHandle(&pQuery); + if (code != TSDB_CODE_SUCCESS) { SET_ERROR_MSG("init sml handle failed"); - code = TSDB_CODE_OUT_OF_MEMORY; goto end; } + pVgHash = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, HASH_NO_LOCK); uDebug(LOG_ID_TAG " write raw metadata block num:%d", LOG_ID_VALUE, rspObj.rsp.common.blockNum); diff --git a/source/client/src/clientSml.c b/source/client/src/clientSml.c index 7e63dcd36a..00445b4d12 100644 --- a/source/client/src/clientSml.c +++ b/source/client/src/clientSml.c @@ -110,11 +110,13 @@ int64_t smlFactorS[] = {1000LL, 1000000LL, 1000000000LL}; static int32_t smlCheckAuth(SSmlHandle *info, SRequestConnInfo *conn, const char *pTabName, AUTH_TYPE type) { SUserAuthInfo pAuth = {0}; - snprintf(pAuth.user, sizeof(pAuth.user), "%s", info->taos->user); + (void)snprintf(pAuth.user, sizeof(pAuth.user), "%s", info->taos->user); if (NULL == pTabName) { - tNameSetDbName(&pAuth.tbName, info->taos->acctId, info->pRequest->pDb, strlen(info->pRequest->pDb)); + if (tNameSetDbName(&pAuth.tbName, info->taos->acctId, info->pRequest->pDb, strlen(info->pRequest->pDb)) != 0){ + return TSDB_CODE_SML_INVALID_DATA; + } } else { - toName(info->taos->acctId, info->pRequest->pDb, pTabName, &pAuth.tbName); + (void)toName(info->taos->acctId, info->pRequest->pDb, pTabName, &pAuth.tbName); //ignore } pAuth.type = type; @@ -129,17 +131,19 @@ static int32_t smlCheckAuth(SSmlHandle *info, SRequestConnInfo *conn, const char : code; } -int32_t smlBuildInvalidDataMsg(SSmlMsgBuf *pBuf, const char *msg1, const char *msg2) { - if (pBuf->buf) { - memset(pBuf->buf, 0, pBuf->len); - if (msg1) strncat(pBuf->buf, msg1, pBuf->len); - int32_t left = pBuf->len - strlen(pBuf->buf); - if (left > 2 && msg2) { - strncat(pBuf->buf, ":", left - 1); - strncat(pBuf->buf, msg2, left - 2); - } +void smlBuildInvalidDataMsg(SSmlMsgBuf *pBuf, const char *msg1, const char *msg2) { + if (pBuf->buf == NULL) { + return; + } + (void)memset(pBuf->buf, 0, pBuf->len); + if (msg1) { + (void)strncat(pBuf->buf, msg1, pBuf->len); + } + int32_t left = pBuf->len - strlen(pBuf->buf); + if (left > 2 && msg2) { + (void)strncat(pBuf->buf, ":", left - 1); + (void)strncat(pBuf->buf, msg2, left - 2); } - return TSDB_CODE_SML_INVALID_DATA; } int64_t smlGetTimeValue(const char *value, int32_t len, uint8_t fromPrecision, uint8_t toPrecision) { @@ -161,10 +165,10 @@ int64_t smlGetTimeValue(const char *value, int32_t len, uint8_t fromPrecision, u return convertTimePrecision(tsInt64, fromPrecision, toPrecision); } -SSmlTableInfo *smlBuildTableInfo(int numRows, const char *measure, int32_t measureLen) { +int32_t smlBuildTableInfo(int numRows, const char *measure, int32_t measureLen, SSmlTableInfo** tInfo) { SSmlTableInfo *tag = (SSmlTableInfo *)taosMemoryCalloc(sizeof(SSmlTableInfo), 1); if (!tag) { - return NULL; + return TSDB_CODE_OUT_OF_MEMORY; } tag->sTableName = measure; @@ -173,14 +177,12 @@ SSmlTableInfo *smlBuildTableInfo(int numRows, const char *measure, int32_t measu tag->cols = taosArrayInit(numRows, POINTER_BYTES); if (tag->cols == NULL) { uError("SML:smlBuildTableInfo failed to allocate memory"); - goto cleanup; + taosMemoryFree(tag); + return TSDB_CODE_OUT_OF_MEMORY; } - return tag; - -cleanup: - taosMemoryFree(tag); - return NULL; + *tInfo = tag; + return TSDB_CODE_SUCCESS; } void smlBuildTsKv(SSmlKv *kv, int64_t ts) { @@ -191,34 +193,50 @@ void smlBuildTsKv(SSmlKv *kv, int64_t ts) { kv->length = (size_t)tDataTypes[TSDB_DATA_TYPE_TIMESTAMP].bytes; } -SSmlSTableMeta *smlBuildSuperTableInfo(SSmlHandle *info, SSmlLineInfo *currElement) { - SSmlSTableMeta *sMeta = NULL; +static void smlDestroySTableMeta(void *para) { + SSmlSTableMeta *meta = *(SSmlSTableMeta **)para; + taosHashCleanup(meta->tagHash); + taosHashCleanup(meta->colHash); + (void)taosArrayDestroy(meta->tags); + (void)taosArrayDestroy(meta->cols); + taosMemoryFreeClear(meta->tableMeta); + taosMemoryFree(meta); +} + +int32_t smlBuildSuperTableInfo(SSmlHandle *info, SSmlLineInfo *currElement, SSmlSTableMeta** sMeta) { + int32_t code = TSDB_CODE_SUCCESS; char *measure = currElement->measure; int measureLen = currElement->measureLen; if (currElement->measureEscaped) { measure = (char *)taosMemoryMalloc(measureLen); - memcpy(measure, currElement->measure, measureLen); + if (measure == NULL){ + return TSDB_CODE_OUT_OF_MEMORY; + } + (void)memcpy(measure, currElement->measure, measureLen); PROCESS_SLASH_IN_MEASUREMENT(measure, measureLen); smlStrReplace(measure, measureLen); } - STableMeta *pTableMeta = smlGetMeta(info, measure, measureLen); + STableMeta *pTableMeta = NULL; + code = smlGetMeta(info, measure, measureLen, &pTableMeta); if (currElement->measureEscaped) { taosMemoryFree(measure); } - if (pTableMeta == NULL) { + if (code != TSDB_CODE_SUCCESS) { info->dataFormat = false; info->reRun = true; - terrno = TSDB_CODE_SUCCESS; - return sMeta; + return code; } - sMeta = smlBuildSTableMeta(info->dataFormat); - if (sMeta == NULL) { + code = smlBuildSTableMeta(info->dataFormat, sMeta); + if (code != TSDB_CODE_SUCCESS) { taosMemoryFreeClear(pTableMeta); - terrno = TSDB_CODE_OUT_OF_MEMORY; - return sMeta; + return code; + } + (*sMeta)->tableMeta = pTableMeta; + code = taosHashPut(info->superTables, currElement->measure, currElement->measureLen, sMeta, POINTER_BYTES); + if (code != TSDB_CODE_SUCCESS){ + smlDestroySTableMeta(*sMeta); + return code; } - sMeta->tableMeta = pTableMeta; - taosHashPut(info->superTables, currElement->measure, currElement->measureLen, &sMeta, POINTER_BYTES); for (int i = 1; i < pTableMeta->tableInfo.numOfTags + pTableMeta->tableInfo.numOfColumns; i++) { SSchema *col = pTableMeta->schema + i; SSmlKv kv = {.key = col->name, .keyLen = strlen(col->name), .type = col->type}; @@ -232,40 +250,38 @@ SSmlSTableMeta *smlBuildSuperTableInfo(SSmlHandle *info, SSmlLineInfo *currEleme } if (i < pTableMeta->tableInfo.numOfColumns) { - taosArrayPush(sMeta->cols, &kv); + if(taosArrayPush((*sMeta)->cols, &kv) == NULL){ + return TSDB_CODE_OUT_OF_MEMORY; + } } else { - taosArrayPush(sMeta->tags, &kv); + if(taosArrayPush((*sMeta)->tags, &kv) == NULL){ + return TSDB_CODE_OUT_OF_MEMORY; + } } } - return sMeta; + return TSDB_CODE_SUCCESS; } bool isSmlColAligned(SSmlHandle *info, int cnt, SSmlKv *kv) { // cnt begin 0, add ts so + 2 if (unlikely(cnt + 2 > info->currSTableMeta->tableInfo.numOfColumns)) { - info->dataFormat = false; - info->reRun = true; - return false; + goto END; } // bind data int32_t ret = smlBuildCol(info->currTableDataCtx, info->currSTableMeta->schema, kv, cnt + 1); if (unlikely(ret != TSDB_CODE_SUCCESS)) { uDebug("smlBuildCol error, retry"); - info->dataFormat = false; - info->reRun = true; - return false; + goto END; } if (cnt >= taosArrayGetSize(info->maxColKVs)) { - info->dataFormat = false; - info->reRun = true; - return false; + goto END; } SSmlKv *maxKV = (SSmlKv *)taosArrayGet(info->maxColKVs, cnt); - + if (maxKV == NULL){ + goto END; + } if (unlikely(!IS_SAME_KEY)) { - info->dataFormat = false; - info->reRun = true; - return false; + goto END; } if (unlikely(IS_VAR_DATA_TYPE(kv->type) && kv->length > maxKV->length)) { @@ -273,6 +289,11 @@ bool isSmlColAligned(SSmlHandle *info, int cnt, SSmlKv *kv) { info->needModifySchema = true; } return true; + +END: + info->dataFormat = false; + info->reRun = true; + return false; } bool isSmlTagAligned(SSmlHandle *info, int cnt, SSmlKv *kv) { @@ -285,6 +306,9 @@ bool isSmlTagAligned(SSmlHandle *info, int cnt, SSmlKv *kv) { } SSmlKv *maxKV = (SSmlKv *)taosArrayGet(info->maxTagKVs, cnt); + if (maxKV == NULL) { + goto END; + } if (unlikely(!IS_SAME_KEY)) { goto END; } @@ -306,8 +330,8 @@ int32_t smlJoinMeasureTag(SSmlLineInfo *elements) { if (elements->measureTag == NULL) { return TSDB_CODE_OUT_OF_MEMORY; } - memcpy(elements->measureTag, elements->measure, elements->measureLen); - memcpy(elements->measureTag + elements->measureLen, elements->tags, elements->tagsLen); + (void)memcpy(elements->measureTag, elements->measure, elements->measureLen); + (void)memcpy(elements->measureTag + elements->measureLen, elements->tags, elements->tagsLen); elements->measureTagsLen = elements->measureLen + elements->tagsLen; return TSDB_CODE_SUCCESS; } @@ -325,14 +349,14 @@ static bool smlIsPKTable(STableMeta *pTableMeta){ int32_t smlProcessSuperTable(SSmlHandle *info, SSmlLineInfo *elements) { bool isSameMeasure = IS_SAME_SUPER_TABLE; if (isSameMeasure) { - return 0; + return TSDB_CODE_SUCCESS; } SSmlSTableMeta **tmp = (SSmlSTableMeta **)taosHashGet(info->superTables, elements->measure, elements->measureLen); SSmlSTableMeta *sMeta = NULL; if (unlikely(tmp == NULL)) { - sMeta = smlBuildSuperTableInfo(info, elements); - if (sMeta == NULL) return -1; + int32_t code = smlBuildSuperTableInfo(info, elements, &sMeta); + if (code != 0) return code; } else { sMeta = *tmp; } @@ -342,39 +366,59 @@ int32_t smlProcessSuperTable(SSmlHandle *info, SSmlLineInfo *elements) { info->maxColKVs = sMeta->cols; if(smlIsPKTable(sMeta->tableMeta)){ - terrno = TSDB_CODE_SML_NOT_SUPPORT_PK; - return -1; + return TSDB_CODE_SML_NOT_SUPPORT_PK; } return 0; } int32_t smlProcessChildTable(SSmlHandle *info, SSmlLineInfo *elements) { + int32_t code = TSDB_CODE_SUCCESS; SSmlTableInfo **oneTable = (SSmlTableInfo **)taosHashGet(info->childTables, elements->measureTag, elements->measureTagsLen); SSmlTableInfo *tinfo = NULL; if (unlikely(oneTable == NULL)) { - tinfo = smlBuildTableInfo(1, elements->measure, elements->measureLen); - if (unlikely(!tinfo)) { - return TSDB_CODE_OUT_OF_MEMORY; + code = smlBuildTableInfo(1, elements->measure, elements->measureLen, &tinfo); + if (code != TSDB_CODE_SUCCESS) { + return code; + } + code = taosHashPut(info->childTables, elements->measureTag, elements->measureTagsLen, &tinfo, POINTER_BYTES); + if(code != 0){ + smlDestroyTableInfo(&tinfo); + return code; } - taosHashPut(info->childTables, elements->measureTag, elements->measureTagsLen, &tinfo, POINTER_BYTES); tinfo->tags = taosArrayDup(info->preLineTagKV, NULL); + if(tinfo->tags == NULL){ + smlDestroyTableInfo(&tinfo); + return TSDB_CODE_OUT_OF_MEMORY; + } for (size_t i = 0; i < taosArrayGetSize(info->preLineTagKV); i++) { SSmlKv *kv = (SSmlKv *)taosArrayGet(info->preLineTagKV, i); + if(kv == NULL){ + smlDestroyTableInfo(&tinfo); + return TSDB_CODE_SML_INVALID_DATA; + } if (kv->keyEscaped) kv->key = NULL; if (kv->valueEscaped) kv->value = NULL; } - smlSetCTableName(tinfo); - getTableUid(info, elements, tinfo); + code = smlSetCTableName(tinfo); + if (code != TSDB_CODE_SUCCESS){ + smlDestroyTableInfo(&tinfo); + return code; + } + code = getTableUid(info, elements, tinfo); + if (code != TSDB_CODE_SUCCESS){ + smlDestroyTableInfo(&tinfo); + return code; + } if (info->dataFormat) { info->currSTableMeta->uid = tinfo->uid; - tinfo->tableDataCtx = smlInitTableDataCtx(info->pQuery, info->currSTableMeta); - if (tinfo->tableDataCtx == NULL) { + code = smlInitTableDataCtx(info->pQuery, info->currSTableMeta, &tinfo->tableDataCtx); + if (code != TSDB_CODE_SUCCESS) { smlBuildInvalidDataMsg(&info->msgBuf, "smlInitTableDataCtx error", NULL); smlDestroyTableInfo(&tinfo); - return TSDB_CODE_SML_INVALID_DATA; + return code; } } } else { @@ -404,9 +448,16 @@ int32_t smlParseEndTelnetJson(SSmlHandle *info, SSmlLineInfo *elements, SSmlKv * uDebug("SML:0x%" PRIx64 " smlParseEndTelnetJson format false, ts:%" PRId64, info->id, kvTs->i); if (elements->colArray == NULL) { elements->colArray = taosArrayInit(16, sizeof(SSmlKv)); + if (elements->colArray == NULL) { + return TSDB_CODE_OUT_OF_MEMORY; + } + } + if (taosArrayPush(elements->colArray, kvTs) == NULL){ + return TSDB_CODE_OUT_OF_MEMORY; + } + if (taosArrayPush(elements->colArray, kv) == NULL){ + return TSDB_CODE_OUT_OF_MEMORY; } - taosArrayPush(elements->colArray, kvTs); - taosArrayPush(elements->colArray, kv); } info->preLine = *elements; @@ -442,6 +493,9 @@ static int32_t smlParseTableName(SArray *tags, char *childTableName) { size_t totalNameLen = delimiter * (taosArrayGetSize(tags) - 1); for (int i = 0; i < taosArrayGetSize(tags); i++) { SSmlKv *tag = (SSmlKv *)taosArrayGet(tags, i); + if(tag == NULL){ + return TSDB_CODE_SML_INVALID_DATA; + } totalNameLen += tag->length; } if (totalNameLen < TSDB_TABLE_NAME_LEN) { @@ -449,12 +503,15 @@ static int32_t smlParseTableName(SArray *tags, char *childTableName) { } } if (autoChildName) { - memset(childTableName, 0, TSDB_TABLE_NAME_LEN); + (void)memset(childTableName, 0, TSDB_TABLE_NAME_LEN); for (int i = 0; i < taosArrayGetSize(tags); i++) { SSmlKv *tag = (SSmlKv *)taosArrayGet(tags, i); - strncat(childTableName, tag->value, tag->length); + if(tag == NULL){ + return TSDB_CODE_SML_INVALID_DATA; + } + (void)strncat(childTableName, tag->value, tag->length); if (i != taosArrayGetSize(tags) - 1) { - strcat(childTableName, tsSmlAutoChildTableNameDelimiter); + (void)strcat(childTableName, tsSmlAutoChildTableNameDelimiter); } } if (tsSmlDot2Underline) { @@ -466,10 +523,13 @@ static int32_t smlParseTableName(SArray *tags, char *childTableName) { for (int i = 0; i < taosArrayGetSize(tags); i++) { SSmlKv *tag = (SSmlKv *)taosArrayGet(tags, i); + if(tag == NULL){ + return TSDB_CODE_SML_INVALID_DATA; + } // handle child table name if (childTableNameLen == tag->keyLen && strncmp(tag->key, tsSmlChildTableName, tag->keyLen) == 0) { - memset(childTableName, 0, TSDB_TABLE_NAME_LEN); - strncpy(childTableName, tag->value, (tag->length < TSDB_TABLE_NAME_LEN ? tag->length : TSDB_TABLE_NAME_LEN)); + (void)memset(childTableName, 0, TSDB_TABLE_NAME_LEN); + (void)strncpy(childTableName, tag->value, (tag->length < TSDB_TABLE_NAME_LEN ? tag->length : TSDB_TABLE_NAME_LEN)); if (tsSmlDot2Underline) { smlStrReplace(childTableName, strlen(childTableName)); } @@ -483,60 +543,60 @@ static int32_t smlParseTableName(SArray *tags, char *childTableName) { } int32_t smlSetCTableName(SSmlTableInfo *oneTable) { - smlParseTableName(oneTable->tags, oneTable->childTableName); + int32_t code = smlParseTableName(oneTable->tags, oneTable->childTableName); + if(code != TSDB_CODE_SUCCESS){ + return code; + } if (strlen(oneTable->childTableName) == 0) { SArray *dst = taosArrayDup(oneTable->tags, NULL); + if (dst == NULL) { + return TSDB_CODE_OUT_OF_MEMORY; + } ASSERT(oneTable->sTableNameLen < TSDB_TABLE_NAME_LEN); char superName[TSDB_TABLE_NAME_LEN] = {0}; RandTableName rName = {dst, NULL, (uint8_t)oneTable->sTableNameLen, oneTable->childTableName}; if (tsSmlDot2Underline) { - memcpy(superName, oneTable->sTableName, oneTable->sTableNameLen); + (void)memcpy(superName, oneTable->sTableName, oneTable->sTableNameLen); smlStrReplace(superName, oneTable->sTableNameLen); rName.stbFullName = superName; } else { rName.stbFullName = oneTable->sTableName; } - buildChildTableName(&rName); - taosArrayDestroy(dst); + code = buildChildTableName(&rName); + if (code != TSDB_CODE_SUCCESS){ + return code; + } + (void)taosArrayDestroy(dst); } return TSDB_CODE_SUCCESS; } -void getTableUid(SSmlHandle *info, SSmlLineInfo *currElement, SSmlTableInfo *tinfo) { +int32_t getTableUid(SSmlHandle *info, SSmlLineInfo *currElement, SSmlTableInfo *tinfo) { char key[TSDB_TABLE_NAME_LEN * 2 + 1] = {0}; size_t nLen = strlen(tinfo->childTableName); - memcpy(key, currElement->measure, currElement->measureLen); + (void)memcpy(key, currElement->measure, currElement->measureLen); if (tsSmlDot2Underline) { smlStrReplace(key, currElement->measureLen); } - memcpy(key + currElement->measureLen + 1, tinfo->childTableName, nLen); + (void)memcpy(key + currElement->measureLen + 1, tinfo->childTableName, nLen); void *uid = taosHashGet(info->tableUids, key, currElement->measureLen + 1 + nLen); // use \0 as separator for stable name and child table name if (uid == NULL) { tinfo->uid = info->uid++; - taosHashPut(info->tableUids, key, currElement->measureLen + 1 + nLen, &tinfo->uid, sizeof(uint64_t)); + return taosHashPut(info->tableUids, key, currElement->measureLen + 1 + nLen, &tinfo->uid, sizeof(uint64_t)); } else { tinfo->uid = *(uint64_t *)uid; } + return TSDB_CODE_SUCCESS; } -static void smlDestroySTableMeta(void *para) { - SSmlSTableMeta *meta = *(SSmlSTableMeta **)para; - taosHashCleanup(meta->tagHash); - taosHashCleanup(meta->colHash); - taosArrayDestroy(meta->tags); - taosArrayDestroy(meta->cols); - taosMemoryFreeClear(meta->tableMeta); - taosMemoryFree(meta); -} - -SSmlSTableMeta *smlBuildSTableMeta(bool isDataFormat) { +int32_t smlBuildSTableMeta(bool isDataFormat, SSmlSTableMeta **sMeta) { SSmlSTableMeta *meta = (SSmlSTableMeta *)taosMemoryCalloc(sizeof(SSmlSTableMeta), 1); if (!meta) { - return NULL; + return TSDB_CODE_OUT_OF_MEMORY; } if (unlikely(!isDataFormat)) { @@ -564,14 +624,15 @@ SSmlSTableMeta *smlBuildSTableMeta(bool isDataFormat) { uError("SML:smlBuildSTableMeta failed to allocate memory"); goto cleanup; } - return meta; + *sMeta = meta; + return TSDB_CODE_SUCCESS; cleanup: smlDestroySTableMeta(meta); - return NULL; + return TSDB_CODE_OUT_OF_MEMORY; } -bool smlParseNumber(SSmlKv *kvVal, SSmlMsgBuf *msg) { +int32_t smlParseNumber(SSmlKv *kvVal, SSmlMsgBuf *msg) { const char *pVal = kvVal->value; int32_t len = kvVal->length; char *endptr = NULL; @@ -743,8 +804,8 @@ bool smlParseNumberOld(SSmlKv *kvVal, SSmlMsgBuf *msg) { return true; } -STableMeta *smlGetMeta(SSmlHandle *info, const void *measure, int32_t measureLen) { - STableMeta *pTableMeta = NULL; +int32_t smlGetMeta(SSmlHandle *info, const void *measure, int32_t measureLen, STableMeta **pTableMeta) { + *pTableMeta = NULL; SName pName = {TSDB_TABLE_NAME_T, info->taos->acctId, {0}, {0}}; tstrncpy(pName.dbname, info->pRequest->pDb, sizeof(pName.dbname)); @@ -754,14 +815,14 @@ STableMeta *smlGetMeta(SSmlHandle *info, const void *measure, int32_t measureLen conn.requestId = info->pRequest->requestId; conn.requestObjRefId = info->pRequest->self; conn.mgmtEps = getEpSet_s(&info->taos->pAppInfo->mgmtEp); - memset(pName.tname, 0, TSDB_TABLE_NAME_LEN); - memcpy(pName.tname, measure, measureLen); + (void)memset(pName.tname, 0, TSDB_TABLE_NAME_LEN); + (void)memcpy(pName.tname, measure, measureLen); - int32_t code = catalogGetSTableMeta(info->pCatalog, &conn, &pName, &pTableMeta); + int32_t code = catalogGetSTableMeta(info->pCatalog, &conn, &pName, pTableMeta); if (code != TSDB_CODE_SUCCESS) { - return NULL; + return code; } - return pTableMeta; + return TSDB_CODE_SUCCESS; } static int64_t smlGenId() { @@ -803,7 +864,7 @@ static int32_t smlGenerateSchemaAction(SSchema *colField, SHashObj *colHash, SSm *action = SCHEMA_ACTION_ADD_COLUMN; } } - return 0; + return TSDB_CODE_SUCCESS; } #define BOUNDARY 1024 @@ -838,6 +899,9 @@ static int32_t smlProcessSchemaAction(SSmlHandle *info, SSchema *schemaField, SH for (int j = 0; j < taosArrayGetSize(cols); ++j) { if (j == 0 && !isTag) continue; SSmlKv *kv = (SSmlKv *)taosArrayGet(cols, j); + if (kv == NULL){ + return TSDB_CODE_SML_INVALID_DATA; + } code = smlGenerateSchemaAction(schemaField, schemaHash, kv, isTag, action, info); if (code != TSDB_CODE_SUCCESS) { return code; @@ -846,6 +910,9 @@ static int32_t smlProcessSchemaAction(SSmlHandle *info, SSchema *schemaField, SH for (int j = 0; j < taosArrayGetSize(checkDumplicateCols); ++j) { SSmlKv *kv = (SSmlKv *)taosArrayGet(checkDumplicateCols, j); + if (kv == NULL){ + return TSDB_CODE_SML_INVALID_DATA; + } if(taosHashGet(schemaHash, kv->key, kv->keyLen) != NULL){ return TSDB_CODE_PAR_DUPLICATED_COLUMN; } @@ -854,10 +921,18 @@ static int32_t smlProcessSchemaAction(SSmlHandle *info, SSchema *schemaField, SH } static int32_t smlCheckMeta(SSchema *schema, int32_t length, SArray *cols, bool isTag) { + int32_t code = TSDB_CODE_SUCCESS; SHashObj *hashTmp = taosHashInit(length, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK); + if (hashTmp == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + goto END; + } int32_t i = 0; for (; i < length; i++) { - taosHashPut(hashTmp, schema[i].name, strlen(schema[i].name), &i, SHORT_BYTES); + code = taosHashPut(hashTmp, schema[i].name, strlen(schema[i].name), &i, SHORT_BYTES); + if (code != 0){ + goto END; + } } if (isTag) { @@ -867,13 +942,19 @@ static int32_t smlCheckMeta(SSchema *schema, int32_t length, SArray *cols, bool } for (; i < taosArrayGetSize(cols); i++) { SSmlKv *kv = (SSmlKv *)taosArrayGet(cols, i); + if (kv == NULL){ + code = TSDB_CODE_SML_INVALID_DATA; + goto END; + } if (taosHashGet(hashTmp, kv->key, kv->keyLen) == NULL) { - taosHashCleanup(hashTmp); - return TSDB_CODE_SML_INVALID_DATA; + code = TSDB_CODE_SML_INVALID_DATA; + goto END; } } + +END: taosHashCleanup(hashTmp); - return 0; + return code; } static int32_t getBytes(uint8_t type, int32_t length) { @@ -889,6 +970,9 @@ static int32_t smlBuildFieldsList(SSmlHandle *info, SSchema *schemaField, SHashO SArray *results, int32_t numOfCols, bool isTag) { for (int j = 0; j < taosArrayGetSize(cols); ++j) { SSmlKv *kv = (SSmlKv *)taosArrayGet(cols, j); + if (kv == NULL){ + return TSDB_CODE_SML_INVALID_DATA; + } ESchemaAction action = SCHEMA_ACTION_NULL; int code = smlGenerateSchemaAction(schemaField, schemaHash, kv, isTag, &action, info); if (code != 0) { @@ -898,8 +982,10 @@ static int32_t smlBuildFieldsList(SSmlHandle *info, SSchema *schemaField, SHashO SField field = {0}; field.type = kv->type; field.bytes = getBytes(kv->type, kv->length); - memcpy(field.name, kv->key, kv->keyLen); - taosArrayPush(results, &field); + (void)memcpy(field.name, kv->key, kv->keyLen); + if (taosArrayPush(results, &field) == NULL){ + return TSDB_CODE_OUT_OF_MEMORY; + } } else if (action == SCHEMA_ACTION_CHANGE_COLUMN_SIZE || action == SCHEMA_ACTION_CHANGE_TAG_SIZE) { uint16_t *index = (uint16_t *)taosHashGet(schemaHash, kv->key, kv->keyLen); if (index == NULL) { @@ -909,6 +995,9 @@ static int32_t smlBuildFieldsList(SSmlHandle *info, SSchema *schemaField, SHashO uint16_t newIndex = *index; if (isTag) newIndex -= numOfCols; SField *field = (SField *)taosArrayGet(results, newIndex); + if (field == NULL){ + return TSDB_CODE_SML_INVALID_DATA; + } field->bytes = getBytes(kv->type, kv->length); } } @@ -917,6 +1006,9 @@ static int32_t smlBuildFieldsList(SSmlHandle *info, SSchema *schemaField, SHashO int32_t len = 0; for (int j = 0; j < taosArrayGetSize(results); ++j) { SField *field = taosArrayGet(results, j); + if (field == NULL){ + return TSDB_CODE_SML_INVALID_DATA; + } len += field->bytes; } if (len > maxLen) { @@ -936,18 +1028,29 @@ static int32_t smlSendMetaMsg(SSmlHandle *info, SName *pName, SArray *pColumns, // put front for free pReq.numOfColumns = taosArrayGetSize(pColumns); + pReq.pTags = pTags; + pReq.numOfTags = taosArrayGetSize(pTags); + pReq.pColumns = taosArrayInit(pReq.numOfColumns, sizeof(SFieldWithOptions)); + if (pReq.pColumns == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + goto end; + } for (int32_t i = 0; i < pReq.numOfColumns; ++i) { - SField *pField = taosArrayGet(pColumns, i); + SField *pField = taosArrayGet(pColumns, i); + if (pField == NULL){ + code = TSDB_CODE_SML_INVALID_DATA; + goto end; + } SFieldWithOptions fieldWithOption = {0}; setFieldWithOptions(&fieldWithOption, pField); setDefaultOptionsForField(&fieldWithOption); - taosArrayPush(pReq.pColumns, &fieldWithOption); + if (taosArrayPush(pReq.pColumns, &fieldWithOption) == NULL){ + code = TSDB_CODE_OUT_OF_MEMORY; + goto end; + } } - pReq.numOfTags = taosArrayGetSize(pTags); - pReq.pTags = pTags; - if (action == SCHEMA_ACTION_CREATE_STABLE) { pReq.colVer = 1; pReq.tagVer = 1; @@ -968,6 +1071,7 @@ static int32_t smlSendMetaMsg(SSmlHandle *info, SName *pName, SArray *pColumns, pSql = (action == SCHEMA_ACTION_ADD_COLUMN) ? "sml_add_column" : "sml_modify_column_size"; } else { uError("SML:0x%" PRIx64 " invalid action:%d", info->id, action); + code = TSDB_CODE_SML_INVALID_DATA; goto end; } @@ -987,38 +1091,52 @@ static int32_t smlSendMetaMsg(SSmlHandle *info, SName *pName, SArray *pColumns, SField field = {0}; field.type = TSDB_DATA_TYPE_NCHAR; field.bytes = TSDB_NCHAR_SIZE + VARSTR_HEADER_SIZE; - strcpy(field.name, tsSmlTagName); - taosArrayPush(pReq.pTags, &field); + tstrncpy(field.name, tsSmlTagName, sizeof(field.name)); + if (taosArrayPush(pReq.pTags, &field) == NULL){ + code = TSDB_CODE_OUT_OF_MEMORY; + goto end; + } } pReq.commentLen = -1; pReq.igExists = true; - tNameExtractFullName(pName, pReq.name); + (void)tNameExtractFullName(pName, pReq.name); pCmdMsg.epSet = getEpSet_s(&info->taos->pAppInfo->mgmtEp); pCmdMsg.msgType = TDMT_MND_CREATE_STB; pCmdMsg.msgLen = tSerializeSMCreateStbReq(NULL, 0, &pReq); + if (pCmdMsg.msgLen < 0){ + code = TSDB_CODE_OUT_OF_MEMORY; + goto end; + } pCmdMsg.pMsg = taosMemoryMalloc(pCmdMsg.msgLen); if (NULL == pCmdMsg.pMsg) { code = TSDB_CODE_OUT_OF_MEMORY; goto end; } - tSerializeSMCreateStbReq(pCmdMsg.pMsg, pCmdMsg.msgLen, &pReq); - SQuery pQuery; - memset(&pQuery, 0, sizeof(pQuery)); + if (tSerializeSMCreateStbReq(pCmdMsg.pMsg, pCmdMsg.msgLen, &pReq) < 0){ + code = TSDB_CODE_OUT_OF_MEMORY; + taosMemoryFree(pCmdMsg.pMsg); + goto end; + } + + SQuery pQuery = {0}; + (void)memset(&pQuery, 0, sizeof(pQuery)); pQuery.execMode = QUERY_EXEC_MODE_RPC; pQuery.pCmdMsg = &pCmdMsg; pQuery.msgType = pQuery.pCmdMsg->msgType; pQuery.stableQuery = true; - launchQueryImpl(pRequest, &pQuery, true, NULL); + (void)launchQueryImpl(pRequest, &pQuery, true, NULL); // no need to check return value if (pRequest->code == TSDB_CODE_SUCCESS) { - catalogRemoveTableMeta(info->pCatalog, pName); + code = catalogRemoveTableMeta(info->pCatalog, pName); + if (code != TSDB_CODE_SUCCESS){ + goto end; + } } code = pRequest->code; - taosMemoryFree(pCmdMsg.pMsg); end: destroyRequest(pRequest); @@ -1053,11 +1171,15 @@ static int32_t smlModifyDBSchemas(SSmlHandle *info) { size_t superTableLen = 0; void *superTable = taosHashGetKey(tmp, &superTableLen); char *measure = taosMemoryMalloc(superTableLen); - memcpy(measure, superTable, superTableLen); + if (measure == NULL){ + code = TSDB_CODE_OUT_OF_MEMORY; + goto end; + } + (void)memcpy(measure, superTable, superTableLen); PROCESS_SLASH_IN_MEASUREMENT(measure, superTableLen); smlStrReplace(measure, superTableLen); - memset(pName.tname, 0, TSDB_TABLE_NAME_LEN); - memcpy(pName.tname, measure, superTableLen); + (void)memset(pName.tname, 0, TSDB_TABLE_NAME_LEN); + (void)memcpy(pName.tname, measure, superTableLen); taosMemoryFree(measure); code = catalogGetSTableMeta(info->pCatalog, &conn, &pName, &pTableMeta); @@ -1069,23 +1191,32 @@ static int32_t smlModifyDBSchemas(SSmlHandle *info) { } uDebug("SML:0x%" PRIx64 " smlModifyDBSchemas create table:%s", info->id, pName.tname); SArray *pColumns = taosArrayInit(taosArrayGetSize(sTableData->cols), sizeof(SField)); + if (pColumns == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + goto end; + } SArray *pTags = taosArrayInit(taosArrayGetSize(sTableData->tags), sizeof(SField)); + if (pTags == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + (void)taosArrayDestroy(pColumns); + goto end; + } code = smlBuildFieldsList(info, NULL, NULL, sTableData->tags, pTags, 0, true); if (code != TSDB_CODE_SUCCESS) { uError("SML:0x%" PRIx64 " smlBuildFieldsList tag1 failed. %s", info->id, pName.tname); - taosArrayDestroy(pColumns); - taosArrayDestroy(pTags); + (void)taosArrayDestroy(pColumns); + (void)taosArrayDestroy(pTags); goto end; } code = smlBuildFieldsList(info, NULL, NULL, sTableData->cols, pColumns, 0, false); if (code != TSDB_CODE_SUCCESS) { uError("SML:0x%" PRIx64 " smlBuildFieldsList col1 failed. %s", info->id, pName.tname); - taosArrayDestroy(pColumns); - taosArrayDestroy(pTags); + (void)taosArrayDestroy(pColumns); + (void)taosArrayDestroy(pTags); goto end; } code = smlSendMetaMsg(info, &pName, pColumns, pTags, NULL, SCHEMA_ACTION_CREATE_STABLE); - taosArrayDestroy(pColumns); + (void)taosArrayDestroy(pColumns); if (code != TSDB_CODE_SUCCESS) { uError("SML:0x%" PRIx64 " smlSendMetaMsg failed. can not create %s", info->id, pName.tname); goto end; @@ -1107,9 +1238,16 @@ static int32_t smlModifyDBSchemas(SSmlHandle *info) { hashTmp = taosHashInit(pTableMeta->tableInfo.numOfTags, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK); + if (hashTmp == NULL){ + code = TSDB_CODE_OUT_OF_MEMORY; + goto end; + } for (uint16_t i = pTableMeta->tableInfo.numOfColumns; i < pTableMeta->tableInfo.numOfColumns + pTableMeta->tableInfo.numOfTags; i++) { - taosHashPut(hashTmp, pTableMeta->schema[i].name, strlen(pTableMeta->schema[i].name), &i, SHORT_BYTES); + code = taosHashPut(hashTmp, pTableMeta->schema[i].name, strlen(pTableMeta->schema[i].name), &i, SHORT_BYTES); + if (code != 0){ + goto end; + } } ESchemaAction action = SCHEMA_ACTION_NULL; @@ -1126,46 +1264,64 @@ static int32_t smlModifyDBSchemas(SSmlHandle *info) { action); SArray *pColumns = taosArrayInit(taosArrayGetSize(sTableData->cols) + pTableMeta->tableInfo.numOfColumns, sizeof(SField)); + if (pColumns == NULL){ + code = TSDB_CODE_OUT_OF_MEMORY; + goto end; + } SArray *pTags = taosArrayInit(taosArrayGetSize(sTableData->tags) + pTableMeta->tableInfo.numOfTags, sizeof(SField)); - + if (pTags == NULL){ + (void)taosArrayDestroy(pColumns); + code = TSDB_CODE_OUT_OF_MEMORY; + goto end; + } for (uint16_t i = 0; i < pTableMeta->tableInfo.numOfColumns + pTableMeta->tableInfo.numOfTags; i++) { SField field = {0}; field.type = pTableMeta->schema[i].type; field.bytes = pTableMeta->schema[i].bytes; - strcpy(field.name, pTableMeta->schema[i].name); + tstrncpy(field.name, pTableMeta->schema[i].name, sizeof(field.name)); if (i < pTableMeta->tableInfo.numOfColumns) { - taosArrayPush(pColumns, &field); + if (taosArrayPush(pColumns, &field) == NULL){ + (void)taosArrayDestroy(pColumns); + (void)taosArrayDestroy(pTags); + code = TSDB_CODE_OUT_OF_MEMORY; + goto end; + } } else { - taosArrayPush(pTags, &field); + if (taosArrayPush(pTags, &field) == NULL){ + (void)taosArrayDestroy(pColumns); + (void)taosArrayDestroy(pTags); + code = TSDB_CODE_OUT_OF_MEMORY; + goto end; + } } } code = smlBuildFieldsList(info, pTableMeta->schema, hashTmp, sTableData->tags, pTags, pTableMeta->tableInfo.numOfColumns, true); if (code != TSDB_CODE_SUCCESS) { uError("SML:0x%" PRIx64 " smlBuildFieldsList tag2 failed. %s", info->id, pName.tname); - taosArrayDestroy(pColumns); - taosArrayDestroy(pTags); + (void)taosArrayDestroy(pColumns); + (void)taosArrayDestroy(pTags); goto end; } if (taosArrayGetSize(pTags) + pTableMeta->tableInfo.numOfColumns > TSDB_MAX_COLUMNS) { uError("SML:0x%" PRIx64 " too many columns than 4096", info->id); code = TSDB_CODE_PAR_TOO_MANY_COLUMNS; - taosArrayDestroy(pColumns); - taosArrayDestroy(pTags); + (void)taosArrayDestroy(pColumns); + (void)taosArrayDestroy(pTags); goto end; } if (taosArrayGetSize(pTags) > TSDB_MAX_TAGS) { uError("SML:0x%" PRIx64 " too many tags than 128", info->id); code = TSDB_CODE_PAR_INVALID_TAGS_NUM; - taosArrayDestroy(pColumns); - taosArrayDestroy(pTags); + (void)taosArrayDestroy(pColumns); + (void)taosArrayDestroy(pTags); goto end; } code = smlSendMetaMsg(info, &pName, pColumns, pTags, pTableMeta, action); - taosArrayDestroy(pColumns); + (void)taosArrayDestroy(pColumns); if (code != TSDB_CODE_SUCCESS) { uError("SML:0x%" PRIx64 " smlSendMetaMsg failed. can not create %s", info->id, pName.tname); goto end; @@ -1185,7 +1341,10 @@ static int32_t smlModifyDBSchemas(SSmlHandle *info) { taosHashClear(hashTmp); for (uint16_t i = 0; i < pTableMeta->tableInfo.numOfColumns; i++) { - taosHashPut(hashTmp, pTableMeta->schema[i].name, strlen(pTableMeta->schema[i].name), &i, SHORT_BYTES); + code = taosHashPut(hashTmp, pTableMeta->schema[i].name, strlen(pTableMeta->schema[i].name), &i, SHORT_BYTES); + if (code != TSDB_CODE_SUCCESS) { + goto end; + } } action = SCHEMA_ACTION_NULL; code = smlProcessSchemaAction(info, pTableMeta->schema, hashTmp, sTableData->cols, sTableData->tags, &action, false); @@ -1201,18 +1360,36 @@ static int32_t smlModifyDBSchemas(SSmlHandle *info) { action); SArray *pColumns = taosArrayInit(taosArrayGetSize(sTableData->cols) + pTableMeta->tableInfo.numOfColumns, sizeof(SField)); + if (pColumns == NULL){ + code = TSDB_CODE_OUT_OF_MEMORY; + goto end; + } SArray *pTags = taosArrayInit(taosArrayGetSize(sTableData->tags) + pTableMeta->tableInfo.numOfTags, sizeof(SField)); - + if (pTags == NULL){ + (void)taosArrayDestroy(pColumns); + code = TSDB_CODE_OUT_OF_MEMORY; + goto end; + } for (uint16_t i = 0; i < pTableMeta->tableInfo.numOfColumns + pTableMeta->tableInfo.numOfTags; i++) { SField field = {0}; field.type = pTableMeta->schema[i].type; field.bytes = pTableMeta->schema[i].bytes; - strcpy(field.name, pTableMeta->schema[i].name); + tstrncpy(field.name, pTableMeta->schema[i].name, sizeof(field.name)); if (i < pTableMeta->tableInfo.numOfColumns) { - taosArrayPush(pColumns, &field); + if (taosArrayPush(pColumns, &field) == NULL){ + (void)taosArrayDestroy(pColumns); + (void)taosArrayDestroy(pTags); + code = TSDB_CODE_OUT_OF_MEMORY; + goto end; + } } else { - taosArrayPush(pTags, &field); + if (taosArrayPush(pTags, &field) == NULL){ + (void)taosArrayDestroy(pColumns); + (void)taosArrayDestroy(pTags); + code = TSDB_CODE_OUT_OF_MEMORY; + goto end; + } } } @@ -1220,21 +1397,21 @@ static int32_t smlModifyDBSchemas(SSmlHandle *info) { pTableMeta->tableInfo.numOfColumns, false); if (code != TSDB_CODE_SUCCESS) { uError("SML:0x%" PRIx64 " smlBuildFieldsList col2 failed. %s", info->id, pName.tname); - taosArrayDestroy(pColumns); - taosArrayDestroy(pTags); + (void)taosArrayDestroy(pColumns); + (void)taosArrayDestroy(pTags); goto end; } if (taosArrayGetSize(pColumns) + pTableMeta->tableInfo.numOfTags > TSDB_MAX_COLUMNS) { uError("SML:0x%" PRIx64 " too many columns than 4096", info->id); code = TSDB_CODE_PAR_TOO_MANY_COLUMNS; - taosArrayDestroy(pColumns); - taosArrayDestroy(pTags); + (void)taosArrayDestroy(pColumns); + (void)taosArrayDestroy(pTags); goto end; } code = smlSendMetaMsg(info, &pName, pColumns, pTags, pTableMeta, action); - taosArrayDestroy(pColumns); + (void)taosArrayDestroy(pColumns); if (code != TSDB_CODE_SUCCESS) { uError("SML:0x%" PRIx64 " smlSendMetaMsg failed. can not create %s", info->id, pName.tname); goto end; @@ -1284,13 +1461,13 @@ static int32_t smlModifyDBSchemas(SSmlHandle *info) { uDebug("SML:0x%" PRIx64 " smlModifyDBSchemas end success, format:%d, needModifySchema:%d", info->id, info->dataFormat, info->needModifySchema); - return 0; + return TSDB_CODE_SUCCESS; end: taosHashCancelIterate(info->superTables, tmp); taosHashCleanup(hashTmp); taosMemoryFreeClear(pTableMeta); - catalogRefreshTableMeta(info->pCatalog, &conn, &pName, 1); + (void)catalogRefreshTableMeta(info->pCatalog, &conn, &pName, 1); // ignore refresh meta code if there is an error uError("SML:0x%" PRIx64 " smlModifyDBSchemas end failed:%d:%s, format:%d, needModifySchema:%d", info->id, code, tstrerror(code), info->dataFormat, info->needModifySchema); @@ -1301,9 +1478,14 @@ static int32_t smlInsertMeta(SHashObj *metaHash, SArray *metaArray, SArray *cols terrno = 0; for (int16_t i = 0; i < taosArrayGetSize(cols); ++i) { SSmlKv *kv = (SSmlKv *)taosArrayGet(cols, i); + if (kv == NULL){ + return TSDB_CODE_SML_INVALID_DATA; + } int ret = taosHashPut(metaHash, kv->key, kv->keyLen, &i, SHORT_BYTES); if (ret == 0) { - taosArrayPush(metaArray, kv); + if (taosArrayPush(metaArray, kv) == NULL){ + return TSDB_CODE_OUT_OF_MEMORY; + } if(taosHashGet(checkDuplicate, kv->key, kv->keyLen) != NULL) { return TSDB_CODE_PAR_DUPLICATED_COLUMN; } @@ -1317,10 +1499,16 @@ static int32_t smlInsertMeta(SHashObj *metaHash, SArray *metaArray, SArray *cols static int32_t smlUpdateMeta(SHashObj *metaHash, SArray *metaArray, SArray *cols, bool isTag, SSmlMsgBuf *msg, SHashObj* checkDuplicate) { for (int i = 0; i < taosArrayGetSize(cols); ++i) { SSmlKv *kv = (SSmlKv *)taosArrayGet(cols, i); - + if (kv == NULL){ + return TSDB_CODE_SML_INVALID_DATA; + } int16_t *index = (int16_t *)taosHashGet(metaHash, kv->key, kv->keyLen); if (index) { SSmlKv *value = (SSmlKv *)taosArrayGet(metaArray, *index); + if (value == NULL){ + return TSDB_CODE_SML_INVALID_DATA; + } + if (isTag) { if (kv->length > value->length) { value->length = kv->length; @@ -1345,7 +1533,9 @@ static int32_t smlUpdateMeta(SHashObj *metaHash, SArray *metaArray, SArray *cols int16_t size = tmp; int ret = taosHashPut(metaHash, kv->key, kv->keyLen, &size, SHORT_BYTES); if (ret == 0) { - taosArrayPush(metaArray, kv); + if(taosArrayPush(metaArray, kv) == NULL){ + return TSDB_CODE_OUT_OF_MEMORY; + } if(taosHashGet(checkDuplicate, kv->key, kv->keyLen) != NULL) { return TSDB_CODE_PAR_DUPLICATED_COLUMN; } @@ -1365,7 +1555,7 @@ void smlDestroyTableInfo(void *para) { taosHashCleanup(kvHash); } - taosArrayDestroy(tag->cols); + (void)taosArrayDestroy(tag->cols); taosArrayDestroyEx(tag->tags, freeSSmlKv); taosMemoryFree(tag); } @@ -1391,13 +1581,13 @@ void smlDestroyInfo(SSmlHandle *info) { cJSON *tags = (cJSON *)taosArrayGetP(info->tagJsonArray, i); cJSON_Delete(tags); } - taosArrayDestroy(info->tagJsonArray); + (void)taosArrayDestroy(info->tagJsonArray); for (int i = 0; i < taosArrayGetSize(info->valueJsonArray); i++) { cJSON *value = (cJSON *)taosArrayGetP(info->valueJsonArray, i); cJSON_Delete(value); } - taosArrayDestroy(info->valueJsonArray); + (void)taosArrayDestroy(info->valueJsonArray); taosArrayDestroyEx(info->preLineTagKV, freeSSmlKv); @@ -1418,21 +1608,22 @@ void smlDestroyInfo(SSmlHandle *info) { taosMemoryFreeClear(info); } -SSmlHandle *smlBuildSmlInfo(TAOS *taos) { +int32_t smlBuildSmlInfo(TAOS *taos, SSmlHandle **handle) { int32_t code = TSDB_CODE_SUCCESS; SSmlHandle *info = (SSmlHandle *)taosMemoryCalloc(1, sizeof(SSmlHandle)); if (NULL == info) { - return NULL; + return TSDB_CODE_OUT_OF_MEMORY; } if (taos != NULL) { info->taos = acquireTscObj(*(int64_t *)taos); if (info->taos == NULL) { - goto cleanup; + code = TSDB_CODE_TSC_DISCONNECTED; + goto FAILED; } code = catalogGetHandle(info->taos->pAppInfo->clusterId, &info->pCatalog); if (code != TSDB_CODE_SUCCESS) { uError("SML:0x%" PRIx64 " get catalog error %d", info->id, code); - goto cleanup; + goto FAILED; } } @@ -1440,27 +1631,37 @@ SSmlHandle *smlBuildSmlInfo(TAOS *taos) { info->childTables = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK); info->tableUids = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK); info->superTables = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK); + if (info->pVgHash == NULL || info->childTables == NULL || info->superTables == NULL || info->tableUids == NULL) { + uError("create SSmlHandle hash obj failed"); + code = TSDB_CODE_OUT_OF_MEMORY; + goto FAILED; + } taosHashSetFreeFp(info->superTables, smlDestroySTableMeta); taosHashSetFreeFp(info->childTables, smlDestroyTableInfo); info->id = smlGenId(); - info->pQuery = smlInitHandle(); + code = smlInitHandle(&info->pQuery); + if (code != TSDB_CODE_SUCCESS){ + goto FAILED; + } info->dataFormat = true; info->tagJsonArray = taosArrayInit(8, POINTER_BYTES); info->valueJsonArray = taosArrayInit(8, POINTER_BYTES); info->preLineTagKV = taosArrayInit(8, sizeof(SSmlKv)); - if (NULL == info->pVgHash || NULL == info->childTables || NULL == info->superTables || NULL == info->tableUids) { - uError("create SSmlHandle failed"); - goto cleanup; + if (info->tagJsonArray == NULL || info->valueJsonArray == NULL || info->preLineTagKV == NULL) { + uError("SML:0x%" PRIx64 " failed to allocate memory", info->id); + code = TSDB_CODE_OUT_OF_MEMORY; + goto FAILED; } - return info; + *handle = info; + return code; -cleanup: +FAILED: smlDestroyInfo(info); - return NULL; + return code; } static int32_t smlPushCols(SArray *colsArray, SArray *cols) { @@ -1471,15 +1672,26 @@ static int32_t smlPushCols(SArray *colsArray, SArray *cols) { } for (size_t i = 0; i < taosArrayGetSize(cols); i++) { SSmlKv *kv = (SSmlKv *)taosArrayGet(cols, i); + if (kv == NULL){ + taosHashCleanup(kvHash); + return TSDB_CODE_SML_INVALID_DATA; + } terrno = 0; - taosHashPut(kvHash, kv->key, kv->keyLen, &kv, POINTER_BYTES); + int32_t code = taosHashPut(kvHash, kv->key, kv->keyLen, &kv, POINTER_BYTES); if (terrno == TSDB_CODE_DUP_KEY) { taosHashCleanup(kvHash); return TSDB_CODE_PAR_DUPLICATED_COLUMN; } + if (code != TSDB_CODE_SUCCESS){ + taosHashCleanup(kvHash); + return code; + } } - taosArrayPush(colsArray, &kvHash); + if (taosArrayPush(colsArray, &kvHash) == NULL) { + taosHashCleanup(kvHash); + return TSDB_CODE_OUT_OF_MEMORY; + } return TSDB_CODE_SUCCESS; } @@ -1542,9 +1754,10 @@ static int32_t smlParseLineBottom(SSmlHandle *info) { } else { uDebug("SML:0x%" PRIx64 " smlParseLineBottom add meta, format:%d, linenum:%d", info->id, info->dataFormat, info->lineNum); - SSmlSTableMeta *meta = smlBuildSTableMeta(info->dataFormat); - if (meta == NULL) { - return TSDB_CODE_OUT_OF_MEMORY; + SSmlSTableMeta *meta = NULL; + ret = smlBuildSTableMeta(info->dataFormat, &meta); + if (ret != TSDB_CODE_SUCCESS) { + return ret; } ret = taosHashPut(info->superTables, elements->measure, elements->measureLen, &meta, POINTER_BYTES); if (ret != TSDB_CODE_SUCCESS) { @@ -1572,11 +1785,17 @@ static int32_t smlInsertData(SSmlHandle *info) { if (info->pRequest->dbList == NULL) { info->pRequest->dbList = taosArrayInit(1, TSDB_DB_FNAME_LEN); + if (info->pRequest->dbList == NULL){ + return TSDB_CODE_OUT_OF_MEMORY; + } } char *data = (char *)taosArrayReserve(info->pRequest->dbList, 1); + if (data == NULL){ + return TSDB_CODE_OUT_OF_MEMORY; + } SName pName = {TSDB_TABLE_NAME_T, info->taos->acctId, {0}, {0}}; tstrncpy(pName.dbname, info->pRequest->pDb, sizeof(pName.dbname)); - tNameGetFullDbName(&pName, data); + (void)tNameGetFullDbName(&pName, data); //ignore SSmlTableInfo **oneTable = (SSmlTableInfo **)taosHashIterate(info->childTables, NULL); while (oneTable) { @@ -1584,18 +1803,26 @@ static int32_t smlInsertData(SSmlHandle *info) { int measureLen = tableData->sTableNameLen; char *measure = (char *)taosMemoryMalloc(tableData->sTableNameLen); - memcpy(measure, tableData->sTableName, tableData->sTableNameLen); + if (measure == NULL){ + return TSDB_CODE_OUT_OF_MEMORY; + } + (void)memcpy(measure, tableData->sTableName, tableData->sTableNameLen); PROCESS_SLASH_IN_MEASUREMENT(measure, measureLen); smlStrReplace(measure, measureLen); - memset(pName.tname, 0, TSDB_TABLE_NAME_LEN); - memcpy(pName.tname, measure, measureLen); + (void)memset(pName.tname, 0, TSDB_TABLE_NAME_LEN); + (void)memcpy(pName.tname, measure, measureLen); if (info->pRequest->tableList == NULL) { info->pRequest->tableList = taosArrayInit(1, sizeof(SName)); + if (info->pRequest->tableList == NULL){ + return TSDB_CODE_OUT_OF_MEMORY; + } + } + if (taosArrayPush(info->pRequest->tableList, &pName) == NULL){ + return TSDB_CODE_OUT_OF_MEMORY; } - taosArrayPush(info->pRequest->tableList, &pName); - strcpy(pName.tname, tableData->childTableName); + tstrncpy(pName.tname, tableData->childTableName, sizeof(pName.tname)); SRequestConnInfo conn = {0}; conn.pTrans = info->taos->pAppInfo->pTransporter; @@ -1618,7 +1845,13 @@ static int32_t smlInsertData(SSmlHandle *info) { taosHashCancelIterate(info->childTables, oneTable); return code; } - taosHashPut(info->pVgHash, (const char *)&vg.vgId, sizeof(vg.vgId), (char *)&vg, sizeof(vg)); + code = taosHashPut(info->pVgHash, (const char *)&vg.vgId, sizeof(vg.vgId), (char *)&vg, sizeof(vg)); + if (code != TSDB_CODE_SUCCESS){ + uError("SML:0x%" PRIx64 " taosHashPut failed. table name: %s", info->id, tableData->childTableName); + taosMemoryFree(measure); + taosHashCancelIterate(info->childTables, oneTable); + return code; + } SSmlSTableMeta **pMeta = (SSmlSTableMeta **)taosHashGet(info->superTables, tableData->sTableName, tableData->sTableNameLen); @@ -1655,9 +1888,10 @@ static int32_t smlInsertData(SSmlHandle *info) { info->cost.insertRpcTime = taosGetTimestampUs(); SAppClusterSummary *pActivity = &info->taos->pAppInfo->summary; - atomic_add_fetch_64((int64_t *)&pActivity->numOfInsertsReq, 1); + (void)atomic_add_fetch_64((int64_t *)&pActivity->numOfInsertsReq, 1); // no need to check return code + + (void)launchQueryImpl(info->pRequest, info->pQuery, true, NULL); // no need to check return code - launchQueryImpl(info->pRequest, info->pQuery, true, NULL); uDebug("SML:0x%" PRIx64 " smlInsertData end, format:%d, code:%d,%s", info->id, info->dataFormat, info->pRequest->code, tstrerror(info->pRequest->code)); @@ -1691,7 +1925,7 @@ int32_t smlClearForRerun(SSmlHandle *info) { info->lines = (SSmlLineInfo *)taosMemoryCalloc(info->lineNum, sizeof(SSmlLineInfo)); } - memset(&info->preLine, 0, sizeof(SSmlLineInfo)); + (void)memset(&info->preLine, 0, sizeof(SSmlLineInfo)); info->currSTableMeta = NULL; info->currTableDataCtx = NULL; @@ -1721,7 +1955,7 @@ static bool getLine(SSmlHandle *info, char *lines[], char **rawLine, char *rawLi if (*rawLine != NULL && (uDebugFlag & DEBUG_DEBUG)) { char *print = taosMemoryCalloc(*len + 1, 1); - memcpy(print, *tmp, *len); + (void)memcpy(print, *tmp, *len); uDebug("SML:0x%" PRIx64 " smlParseLine is raw, numLines:%d, protocol:%d, len:%d, data:%s", info->id, numLines, info->protocol, *len, print); taosMemoryFree(print); @@ -1777,7 +2011,11 @@ static int32_t smlParseLine(SSmlHandle *info, char *lines[], char *rawLine, char if (code != TSDB_CODE_SUCCESS) { if (rawLine != NULL) { char *print = taosMemoryCalloc(len + 1, 1); - memcpy(print, tmp, len); + if (print == NULL) { + uError("SML:0x%" PRIx64 " smlParseLine failed. out of memory", info->id); + return code; + } + (void)memcpy(print, tmp, len); uError("SML:0x%" PRIx64 " smlParseLine failed. line %d : %s", info->id, i, print); taosMemoryFree(print); } else { @@ -1880,7 +2118,7 @@ void smlSetReqSQL(SRequestObj *request, char *lines[], char *rawLine, char *rawL uError("malloc %d for sml sql failed", rlen + 1); return; } - memcpy(sql, p, rlen); + (void)memcpy(sql, p, rlen); sql[rlen] = 0; request->sqlstr = sql; @@ -1892,7 +2130,7 @@ TAOS_RES *taos_schemaless_insert_inner(TAOS *taos, char *lines[], char *rawLine, int protocol, int precision, int32_t ttl, int64_t reqid) { int32_t code = TSDB_CODE_SUCCESS; if (NULL == taos) { - terrno = TSDB_CODE_TSC_DISCONNECTED; + uError("SML:taos_schemaless_insert error taos is null"); return NULL; } SRequestObj *request = NULL; @@ -1905,11 +2143,13 @@ TAOS_RES *taos_schemaless_insert_inner(TAOS *taos, char *lines[], char *rawLine, return NULL; } - info = smlBuildSmlInfo(taos); - if (info == NULL) { - request->code = TSDB_CODE_OUT_OF_MEMORY; - uError("SML:taos_schemaless_insert error SSmlHandle is null"); - return (TAOS_RES *)request; + SSmlMsgBuf msg = {ERROR_MSG_BUF_DEFAULT_SIZE, request->msgBuf}; + code = smlBuildSmlInfo(taos, &info); + if (code != TSDB_CODE_SUCCESS) { + request->code = code; + smlBuildInvalidDataMsg(&msg, "init SSmlHandle failed", NULL); + uError("SML:taos_schemaless_insert error SSmlHandle is null, err msg:%s", tstrerror(code)); + goto end; } info->pRequest = request; info->pRequest->pQuery = info->pQuery; @@ -1922,7 +2162,6 @@ TAOS_RES *taos_schemaless_insert_inner(TAOS *taos, char *lines[], char *rawLine, smlSetReqSQL(request, lines, rawLine, rawLineEnd); - SSmlMsgBuf msg = {ERROR_MSG_BUF_DEFAULT_SIZE, request->msgBuf}; if (request->pDb == NULL) { request->code = TSDB_CODE_PAR_DB_NOT_SPECIFIED; smlBuildInvalidDataMsg(&msg, "Database not specified", NULL); @@ -1961,7 +2200,7 @@ TAOS_RES *taos_schemaless_insert_inner(TAOS *taos, char *lines[], char *rawLine, break; } taosMsleep(100); - refreshMeta(request->pTscObj, request); + (void)refreshMeta(request->pTscObj, request); //ignore return code,try again uInfo("SML:%" PRIx64 " retry:%d/10,ver is old retry or object is creating code:%d, msg:%s", info->id, cnt, code, tstrerror(code)); smlDestroyInfo(info); diff --git a/source/client/src/clientSmlJson.c b/source/client/src/clientSmlJson.c index 845884d5ac..14d6a95e22 100644 --- a/source/client/src/clientSmlJson.c +++ b/source/client/src/clientSmlJson.c @@ -29,29 +29,29 @@ (start)++; \ } -static char *smlJsonGetObj(char *payload) { +static int32_t smlJsonGetObj(char **payload) { int leftBracketCnt = 0; bool isInQuote = false; - while (*payload) { - if (*payload == '"' && *(payload - 1) != '\\') { + while (**payload) { + if (**payload == '"' && *((*payload) - 1) != '\\') { isInQuote = !isInQuote; - } else if (!isInQuote && unlikely(*payload == '{')) { + } else if (!isInQuote && unlikely(**payload == '{')) { leftBracketCnt++; - payload++; + (*payload)++; continue; - } else if (!isInQuote && unlikely(*payload == '}')) { + } else if (!isInQuote && unlikely(**payload == '}')) { leftBracketCnt--; - payload++; + (*payload)++; if (leftBracketCnt == 0) { - return payload; + return 0; } else if (leftBracketCnt < 0) { - return NULL; + return -1; } continue; } - payload++; + (*payload)++; } - return NULL; + return -1; } int smlJsonParseObjFirst(char **start, SSmlLineInfo *element, int8_t *offset) { @@ -99,8 +99,9 @@ int smlJsonParseObjFirst(char **start, SSmlLineInfo *element, int8_t *offset) { offset[index++] = *start - sTmp; element->timestamp = (*start); if (*(*start) == '{') { - char *tmp = smlJsonGetObj((*start)); - if (tmp) { + char *tmp = *start; + int32_t code = smlJsonGetObj(&tmp); + if (code == 0) { element->timestampLen = tmp - (*start); *start = tmp; } @@ -127,8 +128,9 @@ int smlJsonParseObjFirst(char **start, SSmlLineInfo *element, int8_t *offset) { offset[index++] = *start - sTmp; element->cols = (*start); if (*(*start) == '{') { - char *tmp = smlJsonGetObj((*start)); - if (tmp) { + char *tmp = *start; + int32_t code = smlJsonGetObj(&tmp); + if (code == 0) { element->colsLen = tmp - (*start); *start = tmp; } @@ -153,8 +155,9 @@ int smlJsonParseObjFirst(char **start, SSmlLineInfo *element, int8_t *offset) { JUMP_JSON_SPACE((*start)) offset[index++] = *start - sTmp; element->tags = (*start); - char *tmp = smlJsonGetObj((*start)); - if (tmp) { + char *tmp = *start; + int32_t code = smlJsonGetObj(&tmp); + if (code == 0) { element->tagsLen = tmp - (*start); *start = tmp; } @@ -209,8 +212,9 @@ int smlJsonParseObj(char **start, SSmlLineInfo *element, int8_t *offset) { (*start) += offset[index++]; element->timestamp = *start; if (*(*start) == '{') { - char *tmp = smlJsonGetObj((*start)); - if (tmp) { + char *tmp = *start; + int32_t code = smlJsonGetObj(&tmp); + if (code == 0) { element->timestampLen = tmp - (*start); *start = tmp; } @@ -227,8 +231,9 @@ int smlJsonParseObj(char **start, SSmlLineInfo *element, int8_t *offset) { (*start) += offset[index++]; element->cols = *start; if (*(*start) == '{') { - char *tmp = smlJsonGetObj((*start)); - if (tmp) { + char *tmp = *start; + int32_t code = smlJsonGetObj(&tmp); + if (code == 0) { element->colsLen = tmp - (*start); *start = tmp; } @@ -244,8 +249,9 @@ int smlJsonParseObj(char **start, SSmlLineInfo *element, int8_t *offset) { } else if ((*start)[1] == 't' && (*start)[2] == 'a') { (*start) += offset[index++]; element->tags = (*start); - char *tmp = smlJsonGetObj((*start)); - if (tmp) { + char *tmp = *start; + int32_t code = smlJsonGetObj(&tmp); + if (code == 0) { element->tagsLen = tmp - (*start); *start = tmp; } @@ -261,7 +267,7 @@ int smlJsonParseObj(char **start, SSmlLineInfo *element, int8_t *offset) { uError("elements != %d", OTD_JSON_FIELDS_NUM); return TSDB_CODE_TSC_INVALID_JSON; } - return 0; + return TSDB_CODE_SUCCESS; } static inline int32_t smlParseMetricFromJSON(SSmlHandle *info, cJSON *metric, SSmlLineInfo *elements) { @@ -466,7 +472,11 @@ static int32_t smlParseValueFromJSON(cJSON *root, SSmlKv *kv) { break; } case cJSON_String: { - smlConvertJSONString(kv, "binary", root); + int32_t ret = smlConvertJSONString(kv, "binary", root); + if (ret != TSDB_CODE_SUCCESS) { + uError("OTD:Failed to parse binary value from JSON Obj"); + return ret; + } break; } case cJSON_Object: { @@ -492,20 +502,17 @@ static int32_t smlProcessTagJson(SSmlHandle *info, cJSON *tags){ int32_t tagNum = cJSON_GetArraySize(tags); if (unlikely(tagNum == 0)) { uError("SML:Tag should not be empty"); - terrno = TSDB_CODE_TSC_INVALID_JSON; - return -1; + return TSDB_CODE_TSC_INVALID_JSON; } for (int32_t i = 0; i < tagNum; ++i) { cJSON *tag = cJSON_GetArrayItem(tags, i); if (unlikely(tag == NULL)) { - terrno = TSDB_CODE_TSC_INVALID_JSON; - return -1; + return TSDB_CODE_TSC_INVALID_JSON; } size_t keyLen = strlen(tag->string); if (unlikely(IS_INVALID_COL_LEN(keyLen))) { uError("OTD:Tag key length is 0 or too large than 64"); - terrno = TSDB_CODE_TSC_INVALID_COLUMN_LENGTH; - return -1; + return TSDB_CODE_TSC_INVALID_COLUMN_LENGTH; } // add kv to SSmlKv @@ -516,19 +523,19 @@ static int32_t smlProcessTagJson(SSmlHandle *info, cJSON *tags){ // value int32_t ret = smlParseValueFromJSON(tag, &kv); if (unlikely(ret != TSDB_CODE_SUCCESS)) { - terrno = ret; - return -1; + return ret; + } + if (taosArrayPush(preLineKV, &kv) == NULL) { + return TSDB_CODE_OUT_OF_MEMORY; } - taosArrayPush(preLineKV, &kv); if (info->dataFormat && !isSmlTagAligned(info, cnt, &kv)) { - terrno = TSDB_CODE_SUCCESS; - return -1; + return TSDB_CODE_TSC_INVALID_JSON; } cnt++; } - return 0; + return TSDB_CODE_SUCCESS; } static int32_t smlParseTagsFromJSON(SSmlHandle *info, cJSON *tags, SSmlLineInfo *elements) { @@ -536,12 +543,18 @@ static int32_t smlParseTagsFromJSON(SSmlHandle *info, cJSON *tags, SSmlLineInfo if(info->dataFormat){ ret = smlProcessSuperTable(info, elements); if(ret != 0){ - return terrno; + if(info->reRun){ + return TSDB_CODE_SUCCESS; + } + return ret; } } ret = smlProcessTagJson(info, tags); if(ret != 0){ - return terrno; + if(info->reRun){ + return TSDB_CODE_SUCCESS; + } + return ret; } ret = smlJoinMeasureTag(elements); if(ret != 0){ @@ -703,6 +716,9 @@ static int32_t smlParseJSONStringExt(SSmlHandle *info, cJSON *root, SSmlLineInfo // Parse tags bool needFree = info->dataFormat; elements->tags = cJSON_PrintUnformatted(tagsJson); + if (elements->tags == NULL){ + return TSDB_CODE_OUT_OF_MEMORY; + } elements->tagsLen = strlen(elements->tags); if (is_same_child_table_telnet(elements, &info->preLine) != 0) { ret = smlParseTagsFromJSON(info, tagsJson, elements); @@ -729,7 +745,8 @@ static int32_t smlParseJSONStringExt(SSmlHandle *info, cJSON *root, SSmlLineInfo // notice!!! put ts back to tag to ensure get meta->precision int64_t ts = smlParseTSFromJSON(info, tsJson); if (unlikely(ts < 0)) { - uError("OTD:0x%" PRIx64 " Unable to parse timestamp from JSON payload", info->id); + char* tmp = cJSON_PrintUnformatted(tsJson); + uError("OTD:0x%" PRIx64 " Unable to parse timestamp from JSON payload %s %s %" PRId64, info->id, info->msgBuf.buf,tmp, ts); return TSDB_CODE_INVALID_TIMESTAMP; } SSmlKv kvTs = {0}; @@ -823,7 +840,7 @@ static int32_t smlParseJSONString(SSmlHandle *info, char **start, SSmlLineInfo * } if (ret != TSDB_CODE_SUCCESS) { - return TSDB_CODE_TSC_INVALID_VALUE; + return ret; } if (unlikely(**start == '\0' && elements->measure == NULL)) return TSDB_CODE_SUCCESS; @@ -844,18 +861,23 @@ static int32_t smlParseJSONString(SSmlHandle *info, char **start, SSmlLineInfo * cJSON *valueJson = cJSON_Parse(elements->cols); if (unlikely(valueJson == NULL)) { uError("SML:0x%" PRIx64 " parse json cols failed:%s", info->id, elements->cols); + elements->cols[elements->colsLen] = tmp; return TSDB_CODE_TSC_INVALID_JSON; } - taosArrayPush(info->tagJsonArray, &valueJson); + if (taosArrayPush(info->tagJsonArray, &valueJson) == NULL){ + cJSON_Delete(valueJson); + elements->cols[elements->colsLen] = tmp; + return TSDB_CODE_OUT_OF_MEMORY; + } ret = smlParseValueFromJSONObj(valueJson, &kv); if (ret != TSDB_CODE_SUCCESS) { - uError("SML:Failed to parse value from JSON Obj:%s", elements->cols); + uError("SML:0x%" PRIx64 " Failed to parse value from JSON Obj:%s", info->id, elements->cols); elements->cols[elements->colsLen] = tmp; return TSDB_CODE_TSC_INVALID_VALUE; } elements->cols[elements->colsLen] = tmp; } else if (smlParseValue(&kv, &info->msgBuf) != TSDB_CODE_SUCCESS) { - uError("SML:cols invalidate:%s", elements->cols); + uError("SML:0x%" PRIx64 " cols invalidate:%s", info->id, elements->cols); return TSDB_CODE_TSC_INVALID_VALUE; } @@ -870,7 +892,11 @@ static int32_t smlParseJSONString(SSmlHandle *info, char **start, SSmlLineInfo * return TSDB_CODE_TSC_INVALID_JSON; } - taosArrayPush(info->tagJsonArray, &tagsJson); + if (taosArrayPush(info->tagJsonArray, &tagsJson) == NULL){ + cJSON_Delete(tagsJson); + uError("SML:0x%" PRIx64 " taosArrayPush failed", info->id); + return TSDB_CODE_OUT_OF_MEMORY; + } ret = smlParseTagsFromJSON(info, tagsJson, elements); if (unlikely(ret)) { uError("OTD:0x%" PRIx64 " Unable to parse tags from JSON payload", info->id); @@ -937,7 +963,7 @@ int32_t smlParseJSON(SSmlHandle *info, char *payload) { return ret; } info->lines = (SSmlLineInfo *)tmp; - memset(info->lines + cnt, 0, (payloadNum - cnt) * sizeof(SSmlLineInfo)); + (void)memset(info->lines + cnt, 0, (payloadNum - cnt) * sizeof(SSmlLineInfo)); } ret = smlParseJSONString(info, &dataPointStart, info->lines + cnt); if ((info->lines + cnt)->measure == NULL) break; diff --git a/source/client/src/clientSmlLine.c b/source/client/src/clientSmlLine.c index 7535cbfd0c..3456b7df17 100644 --- a/source/client/src/clientSmlLine.c +++ b/source/client/src/clientSmlLine.c @@ -103,7 +103,10 @@ int32_t smlParseValue(SSmlKv *pVal, SSmlMsgBuf *msg) { return code; } char* tmp = taosMemoryCalloc(pVal->length, 1); - memcpy(tmp, pVal->value + NCHAR_ADD_LEN - 1, pVal->length - NCHAR_ADD_LEN); + if (tmp == NULL){ + return TSDB_CODE_OUT_OF_MEMORY; + } + (void)memcpy(tmp, pVal->value + NCHAR_ADD_LEN - 1, pVal->length - NCHAR_ADD_LEN); code = doGeomFromText(tmp, (unsigned char **)&pVal->value, &pVal->length); taosMemoryFree(tmp); if (code != TSDB_CODE_SUCCESS) { @@ -149,7 +152,7 @@ int32_t smlParseValue(SSmlKv *pVal, SSmlMsgBuf *msg) { if(data == NULL){ return TSDB_CODE_OUT_OF_MEMORY; } - memcpy(data, pVal->value + (NCHAR_ADD_LEN - 1), pVal->length); + (void)memcpy(data, pVal->value + (NCHAR_ADD_LEN - 1), pVal->length); pVal->value = data; } @@ -212,8 +215,7 @@ static int32_t smlProcessTagLine(SSmlHandle *info, char **sql, char *sqlEnd){ while (*sql < sqlEnd) { if (unlikely(IS_SPACE(*sql,escapeChar) || IS_COMMA(*sql,escapeChar))) { smlBuildInvalidDataMsg(&info->msgBuf, "invalid data", *sql); - terrno = TSDB_CODE_SML_INVALID_DATA; - return -1; + return TSDB_CODE_SML_INVALID_DATA; } if (unlikely(IS_EQUAL(*sql,escapeChar))) { keyLen = *sql - key; @@ -230,8 +232,7 @@ static int32_t smlProcessTagLine(SSmlHandle *info, char **sql, char *sqlEnd){ if (unlikely(IS_INVALID_COL_LEN(keyLen - keyLenEscaped))) { smlBuildInvalidDataMsg(&info->msgBuf, "invalid key or key is too long than 64", key); - terrno = TSDB_CODE_TSC_INVALID_COLUMN_LENGTH; - return -1; + return TSDB_CODE_TSC_INVALID_COLUMN_LENGTH; } // parse value @@ -245,8 +246,7 @@ static int32_t smlProcessTagLine(SSmlHandle *info, char **sql, char *sqlEnd){ break; } else if (unlikely(IS_EQUAL(*sql,escapeChar))) { smlBuildInvalidDataMsg(&info->msgBuf, "invalid data", *sql); - terrno = TSDB_CODE_SML_INVALID_DATA; - return -1; + return TSDB_CODE_SML_INVALID_DATA; } if (IS_SLASH_LETTER_IN_TAG_FIELD_KEY(*sql)) { @@ -261,24 +261,28 @@ static int32_t smlProcessTagLine(SSmlHandle *info, char **sql, char *sqlEnd){ if (unlikely(valueLen == 0)) { smlBuildInvalidDataMsg(&info->msgBuf, "invalid value", value); - terrno = TSDB_CODE_SML_INVALID_DATA; - return -1; + return TSDB_CODE_SML_INVALID_DATA; } if (unlikely(valueLen - valueLenEscaped > (TSDB_MAX_NCHAR_LEN - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE)) { - terrno = TSDB_CODE_PAR_INVALID_VAR_COLUMN_LEN; - return -1; + return TSDB_CODE_PAR_INVALID_VAR_COLUMN_LEN; } if (keyEscaped) { char *tmp = (char *)taosMemoryMalloc(keyLen); - memcpy(tmp, key, keyLen); + if (tmp == NULL){ + return TSDB_CODE_OUT_OF_MEMORY; + } + (void)memcpy(tmp, key, keyLen); PROCESS_SLASH_IN_TAG_FIELD_KEY(tmp, keyLen); key = tmp; } if (valueEscaped) { char *tmp = (char *)taosMemoryMalloc(valueLen); - memcpy(tmp, value, valueLen); + if (tmp == NULL){ + return TSDB_CODE_OUT_OF_MEMORY; + } + (void)memcpy(tmp, value, valueLen); PROCESS_SLASH_IN_TAG_FIELD_KEY(tmp, valueLen); value = tmp; } @@ -289,11 +293,12 @@ static int32_t smlProcessTagLine(SSmlHandle *info, char **sql, char *sqlEnd){ .length = valueLen, .keyEscaped = keyEscaped, .valueEscaped = valueEscaped}; - taosArrayPush(preLineKV, &kv); + if(taosArrayPush(preLineKV, &kv) == NULL){ + return TSDB_CODE_OUT_OF_MEMORY; + } if (info->dataFormat && !isSmlTagAligned(info, cnt, &kv)) { - terrno = TSDB_CODE_SUCCESS; - return -1; + return TSDB_CODE_TSC_INVALID_JSON; } cnt++; @@ -302,7 +307,7 @@ static int32_t smlProcessTagLine(SSmlHandle *info, char **sql, char *sqlEnd){ } (*sql)++; } - return 0; + return TSDB_CODE_SUCCESS; } static int32_t smlParseTagLine(SSmlHandle *info, char **sql, char *sqlEnd, SSmlLineInfo *elements) { @@ -315,13 +320,19 @@ static int32_t smlParseTagLine(SSmlHandle *info, char **sql, char *sqlEnd, SSmlL if(info->dataFormat){ ret = smlProcessSuperTable(info, elements); if(ret != 0){ - return terrno; + if(info->reRun){ + return TSDB_CODE_SUCCESS; + } + return ret; } } ret = smlProcessTagLine(info, sql, sqlEnd); if(ret != 0){ - return terrno; + if (info->reRun){ + return TSDB_CODE_SUCCESS; + } + return ret; } return smlProcessChildTable(info, elements); @@ -410,7 +421,10 @@ static int32_t smlParseColLine(SSmlHandle *info, char **sql, char *sqlEnd, SSmlL if (keyEscaped) { char *tmp = (char *)taosMemoryMalloc(kv.keyLen); - memcpy(tmp, key, kv.keyLen); + if (tmp == NULL){ + return TSDB_CODE_OUT_OF_MEMORY; + } + (void)memcpy(tmp, key, kv.keyLen); PROCESS_SLASH_IN_TAG_FIELD_KEY(tmp, kv.keyLen); kv.key = tmp; kv.keyEscaped = keyEscaped; @@ -418,7 +432,10 @@ static int32_t smlParseColLine(SSmlHandle *info, char **sql, char *sqlEnd, SSmlL if (valueEscaped) { char *tmp = (char *)taosMemoryMalloc(kv.length); - memcpy(tmp, kv.value, kv.length); + if (tmp == NULL){ + return TSDB_CODE_OUT_OF_MEMORY; + } + (void)memcpy(tmp, kv.value, kv.length); PROCESS_SLASH_IN_FIELD_VALUE(tmp, kv.length); ASSERT(kv.type != TSDB_DATA_TYPE_GEOMETRY); if(kv.type == TSDB_DATA_TYPE_VARBINARY){ @@ -437,8 +454,13 @@ static int32_t smlParseColLine(SSmlHandle *info, char **sql, char *sqlEnd, SSmlL } else { if (currElement->colArray == NULL) { currElement->colArray = taosArrayInit_s(sizeof(SSmlKv), 1); + if (currElement->colArray == NULL) { + return TSDB_CODE_OUT_OF_MEMORY; + } + } + if (taosArrayPush(currElement->colArray, &kv) == NULL){ // reserve for timestamp + return TSDB_CODE_OUT_OF_MEMORY; } - taosArrayPush(currElement->colArray, &kv); // reserve for timestamp } cnt++; diff --git a/source/client/src/clientSmlTelnet.c b/source/client/src/clientSmlTelnet.c index bc0e560178..a25ef4ec95 100644 --- a/source/client/src/clientSmlTelnet.c +++ b/source/client/src/clientSmlTelnet.c @@ -84,8 +84,7 @@ static int32_t smlProcessTagTelnet(SSmlHandle *info, char *data, char *sqlEnd){ while (sql < sqlEnd) { if (unlikely(*sql == SPACE)) { smlBuildInvalidDataMsg(&info->msgBuf, "invalid data", sql); - terrno = TSDB_CODE_SML_INVALID_DATA; - return -1; + return TSDB_CODE_SML_INVALID_DATA; } if (unlikely(*sql == EQUAL)) { keyLen = sql - key; @@ -97,8 +96,7 @@ static int32_t smlProcessTagTelnet(SSmlHandle *info, char *data, char *sqlEnd){ if (unlikely(IS_INVALID_COL_LEN(keyLen))) { smlBuildInvalidDataMsg(&info->msgBuf, "invalid key or key is too long than 64", key); - terrno = TSDB_CODE_TSC_INVALID_COLUMN_LENGTH; - return -1; + return TSDB_CODE_TSC_INVALID_COLUMN_LENGTH; } // parse value @@ -111,8 +109,7 @@ static int32_t smlProcessTagTelnet(SSmlHandle *info, char *data, char *sqlEnd){ } if (unlikely(*sql == EQUAL)) { smlBuildInvalidDataMsg(&info->msgBuf, "invalid data", sql); - terrno = TSDB_CODE_SML_INVALID_DATA; - return -1; + return TSDB_CODE_SML_INVALID_DATA; } sql++; } @@ -120,13 +117,11 @@ static int32_t smlProcessTagTelnet(SSmlHandle *info, char *data, char *sqlEnd){ if (unlikely(valueLen == 0)) { smlBuildInvalidDataMsg(&info->msgBuf, "invalid value", value); - terrno = TSDB_CODE_TSC_INVALID_VALUE; - return -1; + return TSDB_CODE_TSC_INVALID_VALUE; } if (unlikely(valueLen > (TSDB_MAX_TAGS_LEN - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE)) { - terrno = TSDB_CODE_PAR_INVALID_VAR_COLUMN_LEN; - return -1; + return TSDB_CODE_PAR_INVALID_VAR_COLUMN_LEN; } SSmlKv kv = {.key = key, @@ -136,14 +131,15 @@ static int32_t smlProcessTagTelnet(SSmlHandle *info, char *data, char *sqlEnd){ .length = valueLen, .keyEscaped = false, .valueEscaped = false}; - taosArrayPush(preLineKV, &kv); + if (taosArrayPush(preLineKV, &kv) == NULL){ + return TSDB_CODE_OUT_OF_MEMORY; + } if (info->dataFormat && !isSmlTagAligned(info, cnt, &kv)) { - terrno = TSDB_CODE_SUCCESS; - return -1; + return TSDB_CODE_SML_INVALID_DATA; } cnt++; } - return 0; + return TSDB_CODE_SUCCESS; } static int32_t smlParseTelnetTags(SSmlHandle *info, char *data, char *sqlEnd, SSmlLineInfo *elements) { @@ -156,13 +152,19 @@ static int32_t smlParseTelnetTags(SSmlHandle *info, char *data, char *sqlEnd, SS if(info->dataFormat){ ret = smlProcessSuperTable(info, elements); if(ret != 0){ - return terrno; + if(info->reRun){ + return TSDB_CODE_SUCCESS; + } + return ret; } } ret = smlProcessTagTelnet(info, data, sqlEnd); if(ret != 0){ - return terrno; + if (info->reRun){ + return TSDB_CODE_SUCCESS; + } + return ret; } ret = smlJoinMeasureTag(elements); diff --git a/source/client/test/smlTest.cpp b/source/client/test/smlTest.cpp index 054698fff0..77079ed863 100644 --- a/source/client/test/smlTest.cpp +++ b/source/client/test/smlTest.cpp @@ -40,13 +40,16 @@ TEST(testCase, smlParseInfluxString_Test) { msgBuf.len = 256; SSmlLineInfo elements = {0}; - SSmlHandle *info = smlBuildSmlInfo(NULL); + SSmlHandle *info = nullptr; + int32_t code = smlBuildSmlInfo(nullptr, &info); + ASSERT_EQ(code, 0); info->protocol = TSDB_SML_LINE_PROTOCOL; info->dataFormat = false; // case 1 char *tmp = "\\,st,t1=3,t2=4,t3=t3 c1=3i64,c3=\"passit hello,c1=2\",c2=false,c4=4f64 1626006833639000000 ,32,c=3"; char *sql = (char *)taosMemoryCalloc(256, 1); - memcpy(sql, tmp, strlen(tmp) + 1); + ASSERT_NE(sql, nullptr); + (void)memcpy(sql, tmp, strlen(tmp) + 1); int ret = smlParseInfluxString(info, sql, sql + strlen(sql), &elements); ASSERT_EQ(ret, 0); ASSERT_EQ(elements.measure, sql); @@ -62,22 +65,22 @@ TEST(testCase, smlParseInfluxString_Test) { ASSERT_EQ(elements.timestamp, sql + elements.measureTagsLen + 1 + elements.colsLen + 1); ASSERT_EQ(elements.timestampLen, strlen("1626006833639000000")); - taosArrayDestroy(elements.colArray); - elements.colArray = NULL; + (void)taosArrayDestroy(elements.colArray); + elements.colArray = nullptr; // case 2 false tmp = "st,t1=3,t2=4,t3=t3 c1=3i64,c3=\"passit hello,c1=2,c2=false,c4=4f64 1626006833639000000"; - memcpy(sql, tmp, strlen(tmp) + 1); - memset(&elements, 0, sizeof(SSmlLineInfo)); + (void)memcpy(sql, tmp, strlen(tmp) + 1); + (void)memset(&elements, 0, sizeof(SSmlLineInfo)); ret = smlParseInfluxString(info, sql, sql + strlen(sql), &elements); ASSERT_NE(ret, 0); - taosArrayDestroy(elements.colArray); - elements.colArray = NULL; + (void)taosArrayDestroy(elements.colArray); + elements.colArray = nullptr; // case 4 tag is null tmp = "st, c1=3i64,c3=\"passit hello,c1=2\",c2=false,c4=4f64 1626006833639000000"; - memcpy(sql, tmp, strlen(tmp) + 1); - memset(&elements, 0, sizeof(SSmlLineInfo)); + (void)memcpy(sql, tmp, strlen(tmp) + 1); + (void)memset(&elements, 0, sizeof(SSmlLineInfo)); ret = smlParseInfluxString(info, sql, sql + strlen(sql), &elements); ASSERT_EQ(ret, 0); ASSERT_EQ(elements.measure, sql); @@ -92,13 +95,13 @@ TEST(testCase, smlParseInfluxString_Test) { ASSERT_EQ(elements.timestamp, sql + elements.measureTagsLen + 1 + elements.colsLen + 1); ASSERT_EQ(elements.timestampLen, strlen("1626006833639000000")); - taosArrayDestroy(elements.colArray); - elements.colArray = NULL; + (void)taosArrayDestroy(elements.colArray); + elements.colArray = nullptr; // case 5 tag is null tmp = " st c1=3i64,c3=\"passit hello,c1=2\",c2=false,c4=4f64 1626006833639000000 "; - memcpy(sql, tmp, strlen(tmp) + 1); - memset(&elements, 0, sizeof(SSmlLineInfo)); + (void)memcpy(sql, tmp, strlen(tmp) + 1); + (void)memset(&elements, 0, sizeof(SSmlLineInfo)); ret = smlParseInfluxString(info, sql, sql + strlen(sql), &elements); ASSERT_EQ(ret, 0); ASSERT_EQ(elements.measure, sql + 1); @@ -112,36 +115,36 @@ TEST(testCase, smlParseInfluxString_Test) { ASSERT_EQ(elements.timestamp, sql + 1 + elements.measureTagsLen + 3 + elements.colsLen + 2); ASSERT_EQ(elements.timestampLen, strlen("1626006833639000000")); - taosArrayDestroy(elements.colArray); - elements.colArray = NULL; + (void)taosArrayDestroy(elements.colArray); + elements.colArray = nullptr; // case 6 tmp = " st c1=3i64,c3=\"passit hello,c1=2\",c2=false,c4=4f64 "; - memcpy(sql, tmp, strlen(tmp) + 1); - memset(&elements, 0, sizeof(SSmlLineInfo)); + (void)memcpy(sql, tmp, strlen(tmp) + 1); + (void)memset(&elements, 0, sizeof(SSmlLineInfo)); ret = smlParseInfluxString(info, sql, sql + strlen(sql), &elements); ASSERT_EQ(ret, 0); - taosArrayDestroy(elements.colArray); - elements.colArray = NULL; - smlClearForRerun(info); + (void)taosArrayDestroy(elements.colArray); + elements.colArray = nullptr; + ASSERT_EQ(smlClearForRerun(info), 0); // case 7 tmp = " st , "; - memcpy(sql, tmp, strlen(tmp) + 1); - memset(&elements, 0, sizeof(SSmlLineInfo)); + (void)memcpy(sql, tmp, strlen(tmp) + 1); + (void)memset(&elements, 0, sizeof(SSmlLineInfo)); ret = smlParseInfluxString(info, sql, sql + strlen(sql), &elements); ASSERT_NE(ret, 0); - taosArrayDestroy(elements.colArray); - elements.colArray = NULL; + (void)taosArrayDestroy(elements.colArray); + elements.colArray = nullptr; // case 8 false tmp = ", st , "; - memcpy(sql, tmp, strlen(tmp) + 1); - memset(&elements, 0, sizeof(SSmlLineInfo)); + (void)memcpy(sql, tmp, strlen(tmp) + 1); + (void)memset(&elements, 0, sizeof(SSmlLineInfo)); ret = smlParseInfluxString(info, sql, sql + strlen(sql), &elements); ASSERT_NE(ret, 0); - taosArrayDestroy(elements.colArray); - elements.colArray = NULL; + (void)taosArrayDestroy(elements.colArray); + elements.colArray = nullptr; taosMemoryFree(sql); smlDestroyInfo(info); @@ -228,7 +231,9 @@ TEST(testCase, smlParseCols_Error_Test) { "escape_test,tag1=\"tag1_value\",tag2=\"tag2_value\" col0=\"co\"l\"0_value\",col1=\"col1_value\" 1680918783010000000" }; - SSmlHandle *info = smlBuildSmlInfo(NULL); + SSmlHandle *info = nullptr; + int32_t code = smlBuildSmlInfo(nullptr, &info); + ASSERT_EQ(code, TSDB_CODE_SUCCESS); info->protocol = TSDB_SML_LINE_PROTOCOL; info->dataFormat = false; for (int i = 0; i < sizeof(data) / sizeof(data[0]); i++) { @@ -238,13 +243,14 @@ TEST(testCase, smlParseCols_Error_Test) { msgBuf.len = 256; int32_t len = strlen(data[i]); char *sql = (char *)taosMemoryCalloc(256, 1); - memcpy(sql, data[i], len + 1); + ASSERT_NE(sql, nullptr); + (void)memcpy(sql, data[i], len + 1); SSmlLineInfo elements = {0}; int32_t ret = smlParseInfluxString(info, sql, sql + len, &elements); // printf("i:%d\n", i); ASSERT_NE(ret, TSDB_CODE_SUCCESS); taosMemoryFree(sql); - taosArrayDestroy(elements.colArray); + (void)taosArrayDestroy(elements.colArray); } smlDestroyInfo(info); } @@ -254,7 +260,9 @@ TEST(testCase, smlParseCols_Test) { SSmlMsgBuf msgBuf; msgBuf.buf = msg; msgBuf.len = 256; - SSmlHandle *info = smlBuildSmlInfo(NULL); + SSmlHandle *info = nullptr; + int32_t code = smlBuildSmlInfo(nullptr, &info); + ASSERT_EQ(code, TSDB_CODE_SUCCESS); info->protocol = TSDB_SML_LINE_PROTOCOL; info->dataFormat = false; SSmlLineInfo elements = {0}; @@ -267,7 +275,8 @@ TEST(testCase, smlParseCols_Test) { "cboolf=f,cnch_=l\"iuwq\" 1626006833639000000"; int32_t len = strlen(data); char *sql = (char *)taosMemoryCalloc(1024, 1); - memcpy(sql, data, len + 1); + ASSERT_NE(sql, nullptr); + (void)memcpy(sql, data, len + 1); int32_t ret = smlParseInfluxString(info, sql, sql + len, &elements); ASSERT_EQ(ret, TSDB_CODE_SUCCESS); int32_t size = taosArrayGetSize(elements.colArray); @@ -275,6 +284,7 @@ TEST(testCase, smlParseCols_Test) { // binary SSmlKv *kv = (SSmlKv *)taosArrayGet(elements.colArray, 1); + ASSERT_NE(kv, nullptr); ASSERT_EQ(strncasecmp(kv->key, "cb=in", 5), 0); ASSERT_EQ(kv->keyLen, 5); ASSERT_EQ(kv->type, TSDB_DATA_TYPE_BINARY); @@ -285,6 +295,7 @@ TEST(testCase, smlParseCols_Test) { // nchar kv = (SSmlKv *)taosArrayGet(elements.colArray, 2); + ASSERT_NE(kv, nullptr); ASSERT_EQ(strncasecmp(kv->key, "cnch", 4), 0); ASSERT_EQ(kv->keyLen, 4); ASSERT_EQ(kv->type, TSDB_DATA_TYPE_NCHAR); @@ -293,6 +304,7 @@ TEST(testCase, smlParseCols_Test) { // bool kv = (SSmlKv *)taosArrayGet(elements.colArray, 3); + ASSERT_NE(kv, nullptr); ASSERT_EQ(strncasecmp(kv->key, "cbool", 5), 0); ASSERT_EQ(kv->keyLen, 5); ASSERT_EQ(kv->type, TSDB_DATA_TYPE_BOOL); @@ -301,6 +313,7 @@ TEST(testCase, smlParseCols_Test) { // double kv = (SSmlKv *)taosArrayGet(elements.colArray, 4); + ASSERT_NE(kv, nullptr); ASSERT_EQ(strncasecmp(kv->key, "cf64", 4), 0); ASSERT_EQ(kv->keyLen, 4); ASSERT_EQ(kv->type, TSDB_DATA_TYPE_DOUBLE); @@ -310,6 +323,7 @@ TEST(testCase, smlParseCols_Test) { // float kv = (SSmlKv *)taosArrayGet(elements.colArray, 5); + ASSERT_NE(kv, nullptr); ASSERT_EQ(strncasecmp(kv->key, "cf64_", 5), 0); ASSERT_EQ(kv->keyLen, 5); ASSERT_EQ(kv->type, TSDB_DATA_TYPE_DOUBLE); @@ -319,6 +333,7 @@ TEST(testCase, smlParseCols_Test) { // float kv = (SSmlKv *)taosArrayGet(elements.colArray, 6); + ASSERT_NE(kv, nullptr); ASSERT_EQ(strncasecmp(kv->key, "cf32", 4), 0); ASSERT_EQ(kv->keyLen, 4); ASSERT_EQ(kv->type, TSDB_DATA_TYPE_FLOAT); @@ -328,6 +343,7 @@ TEST(testCase, smlParseCols_Test) { // tiny int kv = (SSmlKv *)taosArrayGet(elements.colArray, 7); + ASSERT_NE(kv, nullptr); ASSERT_EQ(strncasecmp(kv->key, "ci8", 3), 0); ASSERT_EQ(kv->keyLen, 3); ASSERT_EQ(kv->type, TSDB_DATA_TYPE_TINYINT); @@ -336,6 +352,7 @@ TEST(testCase, smlParseCols_Test) { // unsigned tiny int kv = (SSmlKv *)taosArrayGet(elements.colArray, 8); + ASSERT_NE(kv, nullptr); ASSERT_EQ(strncasecmp(kv->key, "cu8", 3), 0); ASSERT_EQ(kv->keyLen, 3); ASSERT_EQ(kv->type, TSDB_DATA_TYPE_UTINYINT); @@ -344,6 +361,7 @@ TEST(testCase, smlParseCols_Test) { // small int kv = (SSmlKv *)taosArrayGet(elements.colArray, 9); + ASSERT_NE(kv, nullptr); ASSERT_EQ(strncasecmp(kv->key, "ci16", 4), 0); ASSERT_EQ(kv->keyLen, 4); ASSERT_EQ(kv->type, TSDB_DATA_TYPE_SMALLINT); @@ -352,6 +370,7 @@ TEST(testCase, smlParseCols_Test) { // unsigned smallint kv = (SSmlKv *)taosArrayGet(elements.colArray, 10); + ASSERT_NE(kv, nullptr); ASSERT_EQ(strncasecmp(kv->key, "cu16", 4), 0); ASSERT_EQ(kv->keyLen, 4); ASSERT_EQ(kv->type, TSDB_DATA_TYPE_USMALLINT); @@ -360,6 +379,7 @@ TEST(testCase, smlParseCols_Test) { // int kv = (SSmlKv *)taosArrayGet(elements.colArray, 11); + ASSERT_NE(kv, nullptr); ASSERT_EQ(strncasecmp(kv->key, "ci32", 4), 0); ASSERT_EQ(kv->keyLen, 4); ASSERT_EQ(kv->type, TSDB_DATA_TYPE_INT); @@ -368,6 +388,7 @@ TEST(testCase, smlParseCols_Test) { // unsigned int kv = (SSmlKv *)taosArrayGet(elements.colArray, 12); + ASSERT_NE(kv, nullptr); ASSERT_EQ(strncasecmp(kv->key, "cu32", 4), 0); ASSERT_EQ(kv->keyLen, 4); ASSERT_EQ(kv->type, TSDB_DATA_TYPE_UINT); @@ -376,6 +397,7 @@ TEST(testCase, smlParseCols_Test) { // bigint kv = (SSmlKv *)taosArrayGet(elements.colArray, 13); + ASSERT_NE(kv, nullptr); ASSERT_EQ(strncasecmp(kv->key, "ci64", 4), 0); ASSERT_EQ(kv->keyLen, 4); ASSERT_EQ(kv->type, TSDB_DATA_TYPE_BIGINT); @@ -384,6 +406,7 @@ TEST(testCase, smlParseCols_Test) { // bigint kv = (SSmlKv *)taosArrayGet(elements.colArray, 14); + ASSERT_NE(kv, nullptr); ASSERT_EQ(strncasecmp(kv->key, "ci", 2), 0); ASSERT_EQ(kv->keyLen, 2); ASSERT_EQ(kv->type, TSDB_DATA_TYPE_BIGINT); @@ -392,6 +415,7 @@ TEST(testCase, smlParseCols_Test) { // unsigned bigint kv = (SSmlKv *)taosArrayGet(elements.colArray, 15); + ASSERT_NE(kv, nullptr); ASSERT_EQ(strncasecmp(kv->key, "cu64", 4), 0); ASSERT_EQ(kv->keyLen, 4); ASSERT_EQ(kv->type, TSDB_DATA_TYPE_UBIGINT); @@ -400,6 +424,7 @@ TEST(testCase, smlParseCols_Test) { // bool kv = (SSmlKv *)taosArrayGet(elements.colArray, 16); + ASSERT_NE(kv, nullptr); ASSERT_EQ(strncasecmp(kv->key, "cbooltrue", 9), 0); ASSERT_EQ(kv->keyLen, 9); ASSERT_EQ(kv->type, TSDB_DATA_TYPE_BOOL); @@ -408,6 +433,7 @@ TEST(testCase, smlParseCols_Test) { // bool kv = (SSmlKv *)taosArrayGet(elements.colArray, 17); + ASSERT_NE(kv, nullptr); ASSERT_EQ(strncasecmp(kv->key, "cboolt", 6), 0); ASSERT_EQ(kv->keyLen, 6); ASSERT_EQ(kv->type, TSDB_DATA_TYPE_BOOL); @@ -416,6 +442,7 @@ TEST(testCase, smlParseCols_Test) { // bool kv = (SSmlKv *)taosArrayGet(elements.colArray, 18); + ASSERT_NE(kv, nullptr); ASSERT_EQ(strncasecmp(kv->key, "cboolf", 6), 0); ASSERT_EQ(kv->keyLen, 6); ASSERT_EQ(kv->type, TSDB_DATA_TYPE_BOOL); @@ -424,13 +451,14 @@ TEST(testCase, smlParseCols_Test) { // nchar kv = (SSmlKv *)taosArrayGet(elements.colArray, 19); + ASSERT_NE(kv, nullptr); ASSERT_EQ(strncasecmp(kv->key, "cnch_", 5), 0); ASSERT_EQ(kv->keyLen, 5); ASSERT_EQ(kv->type, TSDB_DATA_TYPE_NCHAR); ASSERT_EQ(kv->length, 4); ASSERT_EQ(strncasecmp(kv->value, "iuwq", 4), 0); - taosArrayDestroy(elements.colArray); + (void)taosArrayDestroy(elements.colArray); taosMemoryFree(sql); smlDestroyInfo(info); } @@ -471,7 +499,9 @@ TEST(testCase, smlParseNumber_Test) { } TEST(testCase, smlParseTelnetLine_error_Test) { - SSmlHandle *info = smlBuildSmlInfo(NULL); + SSmlHandle *info = nullptr; + int32_t code = smlBuildSmlInfo(nullptr, &info); + ASSERT_EQ(code, TSDB_CODE_SUCCESS); info->dataFormat = false; info->protocol = TSDB_SML_TELNET_PROTOCOL; ASSERT_NE(info, nullptr); @@ -509,7 +539,9 @@ TEST(testCase, smlParseTelnetLine_error_Test) { } TEST(testCase, smlParseTelnetLine_Test) { - SSmlHandle *info = smlBuildSmlInfo(NULL); + SSmlHandle *info = nullptr; + int32_t code = smlBuildSmlInfo(nullptr, &info); + ASSERT_EQ(code, TSDB_CODE_SUCCESS); info->dataFormat = false; info->protocol = TSDB_SML_TELNET_PROTOCOL; ASSERT_NE(info, nullptr); @@ -528,7 +560,9 @@ TEST(testCase, smlParseTelnetLine_Test) { } //TEST(testCase, smlParseTelnetLine_diff_json_type2_Test) { -// SSmlHandle *info = smlBuildSmlInfo(NULL); +// SSmlHandle *info = nullptr; +// int32_t code = smlBuildSmlInfo(nullptr, &info); +// ASSERT_EQ(code, TSDB_CODE_SUCCESS); // info->protocol = TSDB_SML_JSON_PROTOCOL; // ASSERT_NE(info, nullptr); // @@ -568,7 +602,7 @@ TEST(testCase, smlParseNumber_performance_Test) { for (int j = 0; j < 10000000; ++j) { kv.value = str[i]; kv.length = strlen(str[i]); - smlParseNumber(&kv, &msgBuf); + (void)smlParseNumber(&kv, &msgBuf); //ignore result } printf("smlParseNumber:%s cost:%" PRId64, str[i], taosGetTimestampUs() - t1); printf("\n"); @@ -576,7 +610,7 @@ TEST(testCase, smlParseNumber_performance_Test) { for (int j = 0; j < 10000000; ++j) { kv.value = str[i]; kv.length = strlen(str[i]); - smlParseNumberOld(&kv, &msgBuf); + (void)smlParseNumberOld(&kv, &msgBuf); //ignore result } printf("smlParseNumberOld:%s cost:%" PRId64, str[i], taosGetTimestampUs() - t2); printf("\n\n"); diff --git a/source/common/src/cos.c b/source/common/src/cos.c index fe6e20c47f..2d3eb3f92b 100644 --- a/source/common/src/cos.c +++ b/source/common/src/cos.c @@ -3,6 +3,7 @@ #include "cos.h" #include "cos_cp.h" #include "tdef.h" +#include "tutil.h" extern char tsS3Endpoint[]; extern char tsS3AccessKeyId[]; @@ -40,7 +41,7 @@ int32_t s3Begin() { if ((status = S3_initialize("s3", verifyPeerG | S3_INIT_ALL, hostname)) != S3StatusOK) { uError("Failed to initialize libs3: %s\n", S3_get_status_name(status)); - return -1; + TAOS_RETURN(TSDB_CODE_FAILED); } protocolG = !tsS3Https; @@ -48,12 +49,12 @@ int32_t s3Begin() { uriStyleG = S3UriStyleVirtualHost; } - return 0; + TAOS_RETURN(TSDB_CODE_SUCCESS); } void s3End() { S3_deinitialize(); } -int32_t s3Init() { return 0; /*s3Begin();*/ } +int32_t s3Init() { TAOS_RETURN(TSDB_CODE_SUCCESS); /*s3Begin();*/ } void s3CleanUp() { /*s3End();*/ } @@ -61,7 +62,7 @@ void s3CleanUp() { /*s3End();*/ static int32_t s3ListBucket(char const *bucketname); int32_t s3CheckCfg() { - int32_t code = 0; + int32_t code = 0, lino = 0; if (!tsS3Enabled) { fprintf(stderr, "s3 not configured.\n"); @@ -71,7 +72,7 @@ int32_t s3CheckCfg() { code = s3Begin(); if (code != 0) { fprintf(stderr, "failed to initialize s3.\n"); - goto _exit; + TAOS_CHECK_GOTO(code, &lino, _exit); } // test put @@ -91,20 +92,17 @@ int32_t s3CheckCfg() { TdFilePtr fp = taosOpenFile(path, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_READ | TD_FILE_TRUNC); if (!fp) { - code = TAOS_SYSTEM_ERROR(errno); fprintf(stderr, "failed to open test file: %s.\n", path); // uError("ERROR: %s Failed to open %s", __func__, path); - goto _exit; + TAOS_CHECK_GOTO(TAOS_SYSTEM_ERROR(errno), &lino, _exit); } if (taosWriteFile(fp, testdata, strlen(testdata)) < 0) { - code = TAOS_SYSTEM_ERROR(errno); fprintf(stderr, "failed to write test file: %s.\n", path); - goto _exit; + TAOS_CHECK_GOTO(TAOS_SYSTEM_ERROR(errno), &lino, _exit); } if (taosFsyncFile(fp) < 0) { - code = TAOS_SYSTEM_ERROR(errno); fprintf(stderr, "failed to fsync test file: %s.\n", path); - goto _exit; + TAOS_CHECK_GOTO(TAOS_SYSTEM_ERROR(errno), &lino, _exit); } taosCloseFile(&fp); @@ -112,7 +110,7 @@ int32_t s3CheckCfg() { code = s3PutObjectFromFileOffset(path, objectname[0], 0, 16); if (code != 0) { fprintf(stderr, "put object %s : failed.\n", objectname[0]); - goto _exit; + TAOS_CHECK_GOTO(code, &lino, _exit); } fprintf(stderr, "put object %s: success.\n\n", objectname[0]); @@ -121,7 +119,7 @@ int32_t s3CheckCfg() { code = s3ListBucket(tsS3BucketName); if (code != 0) { fprintf(stderr, "listing bucket %s : failed.\n", tsS3BucketName); - goto _exit; + TAOS_CHECK_GOTO(code, &lino, _exit); } fprintf(stderr, "listing bucket %s: success.\n\n", tsS3BucketName); @@ -134,7 +132,7 @@ int32_t s3CheckCfg() { code = s3GetObjectBlock(objectname[0], c_offset, c_len, true, &pBlock); if (code != 0) { fprintf(stderr, "get object %s : failed.\n", objectname[0]); - goto _exit; + TAOS_CHECK_GOTO(code, &lino, _exit); } char buf[7] = {0}; memcpy(buf, pBlock, c_len); @@ -147,14 +145,14 @@ int32_t s3CheckCfg() { code = s3DeleteObjects(objectname, 1); if (code != 0) { fprintf(stderr, "delete object %s : failed.\n", objectname[0]); - goto _exit; + TAOS_CHECK_GOTO(code, &lino, _exit); } fprintf(stderr, "delete object %s: success.\n\n", objectname[0]); s3End(); _exit: - return code; + TAOS_RETURN(code); } static int should_retry() { @@ -169,7 +167,7 @@ static int should_retry() { } */ - return 0; + TAOS_RETURN(TSDB_CODE_SUCCESS); } static void s3PrintError(const char *filename, int lineno, const char *funcname, S3Status status, @@ -202,7 +200,6 @@ static S3Status responsePropertiesCallbackNull(const S3ResponseProperties *prope } static S3Status responsePropertiesCallback(const S3ResponseProperties *properties, void *callbackData) { - //(void)callbackData; TS3SizeCBD *cbd = callbackData; if (properties->contentLength > 0) { cbd->content_length = properties->contentLength; @@ -249,7 +246,7 @@ static int32_t s3ListBucket(char const *bucketname) { SArray *objectArray = getListByPrefix("s3"); if (objectArray == NULL) { - return -1; + TAOS_RETURN(TSDB_CODE_FAILED); } const char **object_name = TARRAY_DATA(objectArray); @@ -262,7 +259,7 @@ static int32_t s3ListBucket(char const *bucketname) { taosArrayDestroyEx(objectArray, s3FreeObjectKey); - return code; + TAOS_RETURN(code); } typedef struct growbuffer { @@ -607,13 +604,13 @@ static int32_t s3PutObjectFromFileSimple(S3BucketContext *bucket_context, char c code = TAOS_SYSTEM_ERROR(EIO); } - return code; + TAOS_RETURN(code); } static int32_t s3PutObjectFromFileWithoutCp(S3BucketContext *bucket_context, char const *object_name, int64_t contentLength, S3PutProperties *put_prop, put_object_callback_data *data) { - int32_t code = 0; + int32_t code = 0, lino = 0; uint64_t totalContentLength = contentLength; uint64_t todoContentLength = contentLength; UploadManager manager = {0}; @@ -640,6 +637,9 @@ static int32_t s3PutObjectFromFileWithoutCp(S3BucketContext *bucket_context, cha {&responsePropertiesCallbackNull, &responseCompleteCallback}, &multipartPutXmlCallback, 0}; manager.etags = (char **)taosMemoryCalloc(totalSeq, sizeof(char *)); + if (!manager.etags) { + TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit); + } manager.next_etags_pos = 0; do { S3_initiate_multipart(bucket_context, object_name, 0, &handler, 0, timeoutMsG, &manager); @@ -647,8 +647,7 @@ static int32_t s3PutObjectFromFileWithoutCp(S3BucketContext *bucket_context, cha if (manager.upload_id == 0 || manager.status != S3StatusOK) { s3PrintError(__FILE__, __LINE__, __func__, manager.status, manager.err_msg); - code = TAOS_SYSTEM_ERROR(EIO); - goto clean; + TAOS_CHECK_GOTO(TAOS_SYSTEM_ERROR(EIO), &lino, _exit); } upload: @@ -672,8 +671,7 @@ upload: } while (S3_status_is_retryable(partData.put_object_data.status) && should_retry()); if (partData.put_object_data.status != S3StatusOK) { s3PrintError(__FILE__, __LINE__, __func__, partData.put_object_data.status, partData.put_object_data.err_msg); - code = TAOS_SYSTEM_ERROR(EIO); - goto clean; + TAOS_CHECK_GOTO(TAOS_SYSTEM_ERROR(EIO), &lino, _exit); } contentLength -= chunk_size; todoContentLength -= chunk_size; @@ -686,8 +684,7 @@ upload: int n; for (i = 0; i < totalSeq; i++) { if (!manager.etags[i]) { - code = TAOS_SYSTEM_ERROR(EIO); - goto clean; + TAOS_CHECK_GOTO(TAOS_SYSTEM_ERROR(EIO), &lino, _exit); } n = snprintf(buf, sizeof(buf), "%d" @@ -704,11 +701,13 @@ upload: } while (S3_status_is_retryable(manager.status) && should_retry()); if (manager.status != S3StatusOK) { s3PrintError(__FILE__, __LINE__, __func__, manager.status, manager.err_msg); - code = TAOS_SYSTEM_ERROR(EIO); - goto clean; + TAOS_CHECK_GOTO(TAOS_SYSTEM_ERROR(EIO), &lino, _exit); } -clean: +_exit: + if (code) { + uError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } if (manager.upload_id) { taosMemoryFree(manager.upload_id); } @@ -718,13 +717,13 @@ clean: growbuffer_destroy(manager.gb); taosMemoryFree(manager.etags); - return code; + TAOS_RETURN(code); } static int32_t s3PutObjectFromFileWithCp(S3BucketContext *bucket_context, const char *file, int32_t lmtime, char const *object_name, int64_t contentLength, S3PutProperties *put_prop, put_object_callback_data *data) { - int32_t code = 0; + int32_t code = 0, lino = 0; uint64_t totalContentLength = contentLength; // uint64_t todoContentLength = contentLength; @@ -744,13 +743,16 @@ static int32_t s3PutObjectFromFileWithCp(S3BucketContext *bucket_context, const SCheckpoint cp = {0}; cp.parts = taosMemoryCalloc(max_part_num, sizeof(SCheckpointPart)); + if (!cp.parts) { + TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit); + } if (taosCheckExistFile(file_cp_path)) { if (!cos_cp_load(file_cp_path, &cp) && cos_cp_is_valid_upload(&cp, contentLength, lmtime)) { manager.upload_id = strdup(cp.upload_id); need_init_upload = false; } else { - cos_cp_remove(file_cp_path); + TAOS_CHECK_GOTO(cos_cp_remove(file_cp_path), &lino, _exit); } } @@ -763,16 +765,14 @@ static int32_t s3PutObjectFromFileWithCp(S3BucketContext *bucket_context, const if (manager.upload_id == 0 || manager.status != S3StatusOK) { s3PrintError(__FILE__, __LINE__, __func__, manager.status, manager.err_msg); - code = TAOS_SYSTEM_ERROR(EIO); - goto clean; + TAOS_CHECK_GOTO(TAOS_SYSTEM_ERROR(EIO), &lino, _exit); } cos_cp_build_upload(&cp, file, contentLength, lmtime, manager.upload_id, chunk_size); } if (cos_cp_open(file_cp_path, &cp)) { - code = TAOS_SYSTEM_ERROR(EIO); - goto clean; + TAOS_CHECK_GOTO(TAOS_SYSTEM_ERROR(EIO), &lino, _exit); } int part_num = 0; @@ -791,6 +791,10 @@ static int32_t s3PutObjectFromFileWithCp(S3BucketContext *bucket_context, const {&responsePropertiesCallbackNull, &responseCompleteCallback}, &multipartPutXmlCallback, 0}; manager.etags = (char **)taosMemoryCalloc(totalSeq, sizeof(char *)); + if (!manager.etags) { + TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit); + } + manager.next_etags_pos = 0; upload: @@ -802,8 +806,7 @@ upload: if (i > 0 && cp.parts[i - 1].completed) { if (taosLSeekFile(data->infileFD, cp.parts[i].offset, SEEK_SET) < 0) { - code = TAOS_SYSTEM_ERROR(errno); - goto clean; + TAOS_CHECK_GOTO(TAOS_SYSTEM_ERROR(errno), &lino, _exit); } } @@ -827,25 +830,23 @@ upload: } while (S3_status_is_retryable(partData.put_object_data.status) && should_retry()); if (partData.put_object_data.status != S3StatusOK) { s3PrintError(__FILE__, __LINE__, __func__, partData.put_object_data.status, partData.put_object_data.err_msg); - code = TAOS_SYSTEM_ERROR(EIO); + TAOS_CHECK_GOTO(TAOS_SYSTEM_ERROR(EIO), &lino, _exit); //(void)cos_cp_dump(&cp); - goto clean; } if (!manager.etags[seq - 1]) { - code = TAOS_SYSTEM_ERROR(EIO); - goto clean; + TAOS_CHECK_GOTO(TAOS_SYSTEM_ERROR(EIO), &lino, _exit); } cos_cp_update(&cp, cp.parts[seq - 1].index, manager.etags[seq - 1], 0); - (void)cos_cp_dump(&cp); + TAOS_CHECK_GOTO(cos_cp_dump(&cp), &lino, _exit); contentLength -= chunk_size; // todoContentLength -= chunk_size; } - cos_cp_close(cp.thefile); + TAOS_CHECK_GOTO(cos_cp_close(cp.thefile), &lino, _exit); cp.thefile = 0; int size = 0; @@ -869,20 +870,23 @@ upload: } while (S3_status_is_retryable(manager.status) && should_retry()); if (manager.status != S3StatusOK) { s3PrintError(__FILE__, __LINE__, __func__, manager.status, manager.err_msg); - code = TAOS_SYSTEM_ERROR(EIO); - goto clean; + TAOS_CHECK_GOTO(TAOS_SYSTEM_ERROR(EIO), &lino, _exit); } - cos_cp_remove(file_cp_path); + TAOS_CHECK_GOTO(cos_cp_remove(file_cp_path), &lino, _exit); -clean: +_exit: /* if (parts) { taosMemoryFree(parts); } */ + if (code) { + uError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } + if (cp.thefile) { - cos_cp_close(cp.thefile); + (void)cos_cp_close(cp.thefile); } if (cp.parts) { taosMemoryFree(cp.parts); @@ -899,7 +903,7 @@ clean: taosMemoryFree(manager.etags); growbuffer_destroy(manager.gb); - return code; + TAOS_RETURN(code); } int32_t s3PutObjectFromFile2(const char *file, const char *object_name, int8_t withcp) { @@ -917,15 +921,13 @@ int32_t s3PutObjectFromFile2(const char *file, const char *object_name, int8_t w put_object_callback_data data = {0}; if (taosStatFile(file, &contentLength, &lmtime, NULL) < 0) { - code = TAOS_SYSTEM_ERROR(errno); uError("ERROR: %s Failed to stat file %s: ", __func__, file); - return code; + TAOS_RETURN(TAOS_SYSTEM_ERROR(errno)); } if (!(data.infileFD = taosOpenFile(file, TD_FILE_READ))) { - code = TAOS_SYSTEM_ERROR(errno); uError("ERROR: %s Failed to open file %s: ", __func__, file); - return code; + TAOS_RETURN(TAOS_SYSTEM_ERROR(errno)); } data.totalContentLength = data.totalOriginalContentLength = data.contentLength = data.originalContentLength = @@ -956,7 +958,7 @@ int32_t s3PutObjectFromFile2(const char *file, const char *object_name, int8_t w growbuffer_destroy(data.gb); } - return code; + TAOS_RETURN(code); } int32_t s3PutObjectFromFileOffset(const char *file, const char *object_name, int64_t offset, int64_t size) { @@ -974,22 +976,19 @@ int32_t s3PutObjectFromFileOffset(const char *file, const char *object_name, int put_object_callback_data data = {0}; if (taosStatFile(file, &contentLength, &lmtime, NULL) < 0) { - code = TAOS_SYSTEM_ERROR(errno); uError("ERROR: %s Failed to stat file %s: ", __func__, file); - return code; + TAOS_RETURN(TAOS_SYSTEM_ERROR(errno)); } contentLength = size; if (!(data.infileFD = taosOpenFile(file, TD_FILE_READ))) { - code = TAOS_SYSTEM_ERROR(errno); uError("ERROR: %s Failed to open file %s: ", __func__, file); - return code; + TAOS_RETURN(TAOS_SYSTEM_ERROR(errno)); } if (taosLSeekFile(data.infileFD, offset, SEEK_SET) < 0) { taosCloseFile(&data.infileFD); - code = TAOS_SYSTEM_ERROR(errno); - return code; + TAOS_RETURN(TAOS_SYSTEM_ERROR(errno)); } data.totalContentLength = data.totalOriginalContentLength = data.contentLength = data.originalContentLength = @@ -1016,7 +1015,7 @@ int32_t s3PutObjectFromFileOffset(const char *file, const char *object_name, int growbuffer_destroy(data.gb); } - return code; + TAOS_RETURN(code); } typedef struct list_bucket_callback_data { @@ -1130,11 +1129,11 @@ int32_t s3DeleteObjects(const char *object_name[], int nobject) { if ((cbd.status != S3StatusOK) && (cbd.status != S3StatusErrorPreconditionFailed)) { s3PrintError(__FILE__, __LINE__, __func__, cbd.status, cbd.err_msg); - code = -1; + code = TSDB_CODE_FAILED; } } - return code; + TAOS_RETURN(code); } void s3DeleteObjectsByPrefix(const char *prefix) { @@ -1187,17 +1186,19 @@ int32_t s3GetObjectBlock(const char *object_name, int64_t offset, int64_t size, if (cbd.status != S3StatusOK) { uError("%s: %d/%s(%s)", __func__, cbd.status, S3_get_status_name(cbd.status), cbd.err_msg); - return TAOS_SYSTEM_ERROR(EIO); + + TAOS_RETURN(TAOS_SYSTEM_ERROR(EIO)); } if (check && cbd.buf_pos != size) { uError("%s: %d/%s(%s)", __func__, cbd.status, S3_get_status_name(cbd.status), cbd.err_msg); - return TAOS_SYSTEM_ERROR(EIO); + + TAOS_RETURN(TAOS_SYSTEM_ERROR(EIO)); } *ppBlock = cbd.buf; - return 0; + TAOS_RETURN(TSDB_CODE_SUCCESS); } static S3Status getObjectCallback(int bufferSize, const char *buffer, void *callbackData) { @@ -1218,9 +1219,8 @@ int32_t s3GetObjectToFile(const char *object_name, const char *fileName) { TdFilePtr pFile = taosOpenFile(fileName, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC); if (pFile == NULL) { - terrno = TAOS_SYSTEM_ERROR(errno); - uError("[s3] open file error, errno:%d, fileName:%s", terrno, fileName); - return -1; + uError("[s3] open file error, errno:%d, fileName:%s", TAOS_SYSTEM_ERROR(errno), fileName); + TAOS_RETURN(TAOS_SYSTEM_ERROR(errno)); } TS3GetData cbd = {0}; @@ -1232,16 +1232,17 @@ int32_t s3GetObjectToFile(const char *object_name, const char *fileName) { if (cbd.status != S3StatusOK) { uError("%s: %d(%s)", __func__, cbd.status, cbd.err_msg); taosCloseFile(&pFile); - return TAOS_SYSTEM_ERROR(EIO); + TAOS_RETURN(TAOS_SYSTEM_ERROR(EIO)); } taosCloseFile(&pFile); - return 0; + + TAOS_RETURN(TSDB_CODE_SUCCESS); } int32_t s3GetObjectsByPrefix(const char *prefix, const char *path) { SArray *objectArray = getListByPrefix(prefix); - if (objectArray == NULL) return -1; + if (objectArray == NULL) TAOS_RETURN(TSDB_CODE_FAILED); for (size_t i = 0; i < taosArrayGetSize(objectArray); i++) { char *object = taosArrayGetP(objectArray, i); @@ -1255,7 +1256,7 @@ int32_t s3GetObjectsByPrefix(const char *prefix, const char *path) { } if (s3GetObjectToFile(object, fileName) != 0) { taosArrayDestroyEx(objectArray, s3FreeObjectKey); - return -1; + TAOS_RETURN(TSDB_CODE_FAILED); } } taosArrayDestroyEx(objectArray, s3FreeObjectKey); @@ -1279,7 +1280,7 @@ long s3Size(const char *object_name) { if ((cbd.status != S3StatusOK) && (cbd.status != S3StatusErrorPreconditionFailed)) { s3PrintError(__FILE__, __LINE__, __func__, cbd.status, cbd.err_msg); - return -1; + TAOS_RETURN(TSDB_CODE_FAILED); } size = cbd.content_length; @@ -1306,7 +1307,7 @@ int32_t s3Init() { // set log output, default stderr cos_log_set_output(NULL); - return 0; + TAOS_RETURN(TSDB_CODE_SUCCESS); } void s3CleanUp() { cos_http_io_deinitialize(); } @@ -1363,10 +1364,10 @@ int32_t s3PutObjectFromFile(const char *file_str, const char *object_str) { cos_pool_destroy(p); if (s->code != 200) { - return code = s->code; + TAOS_RETURN(s->code); } - return code; + TAOS_RETURN(code); } int32_t s3PutObjectFromFile2(const char *file_str, const char *object_str, int8_t withcp) { @@ -1405,10 +1406,10 @@ int32_t s3PutObjectFromFile2(const char *file_str, const char *object_str, int8_ cos_pool_destroy(p); if (s->code != 200) { - return code = s->code; + TAOS_RETURN(s->code); } - return code; + TAOS_RETURN(code); } void s3DeleteObjectsByPrefix(const char *prefix_str) { @@ -1465,7 +1466,7 @@ int32_t s3DeleteObjects(const char *object_name[], int nobject) { cos_warn_log("delete objects failed\n"); } - return 0; + TAOS_RETURN(TSDB_CODE_SUCCESS); } bool s3Exists(const char *object_name) { @@ -1547,7 +1548,7 @@ bool s3Get(const char *object_name, const char *path) { int32_t s3GetObjectBlock(const char *object_name, int64_t offset, int64_t block_size, bool check, uint8_t **ppBlock) { (void)check; - int32_t code = 0; + int32_t code = 0, lino = 0; cos_pool_t *p = NULL; int is_cname = 0; cos_status_t *s = NULL; @@ -1588,10 +1589,9 @@ int32_t s3GetObjectBlock(const char *object_name, int64_t offset, int64_t block_ s = cos_get_object_to_buffer(options, &bucket, &object, headers, NULL, &download_buffer, &resp_headers); log_status(s); if (!cos_status_is_ok(s)) { - vError("s3: %d(%s)", s->code, s->error_msg); - vError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(terrno)); - code = TAOS_SYSTEM_ERROR(EIO); - return code; + uError("s3: %d(%s)", s->code, s->error_msg); + uError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(terrno)); + TAOS_RETURN(TAOS_SYSTEM_ERROR(EIO)); } // print_headers(resp_headers); @@ -1601,6 +1601,10 @@ int32_t s3GetObjectBlock(const char *object_name, int64_t offset, int64_t block_ cos_list_for_each_entry(cos_buf_t, content, &download_buffer, node) { len += cos_buf_size(content); } // char *buf = cos_pcalloc(p, (apr_size_t)(len + 1)); char *buf = taosMemoryCalloc(1, (apr_size_t)(len)); + if (!buf) { + TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit); + } + // buf[len] = '\0'; cos_list_for_each_entry(cos_buf_t, content, &download_buffer, node) { size = cos_buf_size(content); @@ -1609,12 +1613,13 @@ int32_t s3GetObjectBlock(const char *object_name, int64_t offset, int64_t block_ } // cos_warn_log("Download data=%s", buf); +_exit: //销毁内存池 cos_pool_destroy(p); *ppBlock = buf; - return code; + TAOS_RETURN(code); } typedef struct { diff --git a/source/common/src/cos_cp.c b/source/common/src/cos_cp.c index 509f0a3a1c..d7be47ce45 100644 --- a/source/common/src/cos_cp.c +++ b/source/common/src/cos_cp.c @@ -9,42 +9,35 @@ int32_t cos_cp_open(char const* cp_path, SCheckpoint* checkpoint) { TdFilePtr fd = taosOpenFile(cp_path, TD_FILE_WRITE | TD_FILE_CREATE /* | TD_FILE_TRUNC*/ | TD_FILE_WRITE_THROUGH); if (!fd) { - code = TAOS_SYSTEM_ERROR(errno); - uError("ERROR: %s Failed to open %s", __func__, cp_path); - return code; + uError("%s Failed to open %s", __func__, cp_path); + TAOS_CHECK_RETURN(TAOS_SYSTEM_ERROR(errno)); } checkpoint->thefile = fd; - return code; + TAOS_RETURN(code); } -void cos_cp_close(TdFilePtr fd) { taosCloseFile(&fd); } -void cos_cp_remove(char const* filepath) { (void)taosRemoveFile(filepath); } +int32_t cos_cp_close(TdFilePtr fd) { return taosCloseFile(&fd); } +int32_t cos_cp_remove(char const* filepath) { return taosRemoveFile(filepath); } static int32_t cos_cp_parse_body(char* cp_body, SCheckpoint* cp) { - int32_t code = 0; + int32_t code = 0, lino = 0; cJSON const* item2 = NULL; cJSON* json = cJSON_Parse(cp_body); if (NULL == json) { - code = TSDB_CODE_FILE_CORRUPTED; - uError("ERROR: %s Failed to parse json", __func__); - goto _exit; + TAOS_CHECK_GOTO(TSDB_CODE_FILE_CORRUPTED, &lino, _exit); } cJSON const* item = cJSON_GetObjectItem(json, "ver"); if (!cJSON_IsNumber(item) || item->valuedouble != 1) { - code = TSDB_CODE_FILE_CORRUPTED; - uError("ERROR: %s Failed to parse json ver: %f", __func__, item->valuedouble); - goto _exit; + TAOS_CHECK_GOTO(TSDB_CODE_FILE_CORRUPTED, &lino, _exit); } item = cJSON_GetObjectItem(json, "type"); if (!cJSON_IsNumber(item)) { - code = TSDB_CODE_FILE_CORRUPTED; - uError("ERROR: %s Failed to parse json", __func__); - goto _exit; + TAOS_CHECK_GOTO(TSDB_CODE_FILE_CORRUPTED, &lino, _exit); } cp->cp_type = item->valuedouble; @@ -155,40 +148,36 @@ static int32_t cos_cp_parse_body(char* cp_body, SCheckpoint* cp) { } _exit: + if (code) { + uError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } if (json) cJSON_Delete(json); if (cp_body) taosMemoryFree(cp_body); - - return code; + TAOS_RETURN(code); } int32_t cos_cp_load(char const* filepath, SCheckpoint* checkpoint) { - int32_t code = 0; + int32_t code = 0, lino = 0; + char* cp_body = NULL; TdFilePtr fd = taosOpenFile(filepath, TD_FILE_READ); if (!fd) { - code = TAOS_SYSTEM_ERROR(errno); - uError("ERROR: %s Failed to open %s", __func__, filepath); - goto _exit; + TAOS_CHECK_GOTO(TAOS_SYSTEM_ERROR(errno), &lino, _exit); } int64_t size = -1; - code = taosStatFile(filepath, &size, NULL, NULL); - if (code) { - uError("ERROR: %s Failed to stat %s", __func__, filepath); - goto _exit; - } + TAOS_CHECK_GOTO(taosStatFile(filepath, &size, NULL, NULL), &lino, _exit); - char* cp_body = taosMemoryMalloc(size + 1); + cp_body = taosMemoryMalloc(size + 1); + if (!cp_body) { + TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit); + } int64_t n = taosReadFile(fd, cp_body, size); if (n < 0) { - code = TAOS_SYSTEM_ERROR(errno); - uError("ERROR: %s Failed to read %s", __func__, filepath); - goto _exit; + TAOS_CHECK_GOTO(TAOS_SYSTEM_ERROR(errno), &lino, _exit); } else if (n != size) { - code = TSDB_CODE_FILE_CORRUPTED; - uError("ERROR: %s Failed to read %s %" PRId64 "/%" PRId64, __func__, filepath, n, size); - goto _exit; + TAOS_CHECK_GOTO(TSDB_CODE_FILE_CORRUPTED, &lino, _exit); } taosCloseFile(&fd); cp_body[size] = '\0'; @@ -196,184 +185,161 @@ int32_t cos_cp_load(char const* filepath, SCheckpoint* checkpoint) { return cos_cp_parse_body(cp_body, checkpoint); _exit: + if (code) { + uError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } if (fd) { taosCloseFile(&fd); } if (cp_body) { taosMemoryFree(cp_body); } - - return code; + TAOS_RETURN(code); } static int32_t cos_cp_save_json(cJSON const* json, SCheckpoint* checkpoint) { - int32_t code = 0; + int32_t code = 0, lino = 0; char* data = cJSON_PrintUnformatted(json); - if (NULL == data) { - return TSDB_CODE_OUT_OF_MEMORY; + if (!data) { + TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY); } TdFilePtr fp = checkpoint->thefile; if (taosFtruncateFile(fp, 0) < 0) { - code = TAOS_SYSTEM_ERROR(errno); - goto _exit; + TAOS_CHECK_GOTO(TAOS_SYSTEM_ERROR(errno), &lino, _exit); } if (taosLSeekFile(fp, 0, SEEK_SET) < 0) { - code = TAOS_SYSTEM_ERROR(errno); - goto _exit; + TAOS_CHECK_GOTO(TAOS_SYSTEM_ERROR(errno), &lino, _exit); } if (taosWriteFile(fp, data, strlen(data)) < 0) { - code = TAOS_SYSTEM_ERROR(errno); - goto _exit; + TAOS_CHECK_GOTO(TAOS_SYSTEM_ERROR(errno), &lino, _exit); } if (taosFsyncFile(fp) < 0) { - code = TAOS_SYSTEM_ERROR(errno); - goto _exit; + TAOS_CHECK_GOTO(TAOS_SYSTEM_ERROR(errno), &lino, _exit); } _exit: + if (code) { + uError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } taosMemoryFree(data); - return code; + TAOS_RETURN(code); } int32_t cos_cp_dump(SCheckpoint* cp) { - int32_t code = 0; - int32_t lino = 0; + int32_t code = 0, lino = 0; cJSON* ojson = NULL; cJSON* json = cJSON_CreateObject(); - if (!json) return TSDB_CODE_OUT_OF_MEMORY; + if (!json) { + TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY); + } if (NULL == cJSON_AddNumberToObject(json, "ver", 1)) { - code = TSDB_CODE_OUT_OF_MEMORY; - TSDB_CHECK_CODE(code, lino, _exit); + TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit); } if (NULL == cJSON_AddNumberToObject(json, "type", cp->cp_type)) { - code = TSDB_CODE_OUT_OF_MEMORY; - TSDB_CHECK_CODE(code, lino, _exit); + TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit); } if (NULL == cJSON_AddStringToObject(json, "md5", cp->md5)) { - code = TSDB_CODE_OUT_OF_MEMORY; - TSDB_CHECK_CODE(code, lino, _exit); + TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit); } if (NULL == cJSON_AddStringToObject(json, "upload_id", cp->upload_id)) { - code = TSDB_CODE_OUT_OF_MEMORY; - TSDB_CHECK_CODE(code, lino, _exit); + TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit); } if (COS_CP_TYPE_UPLOAD == cp->cp_type) { ojson = cJSON_AddObjectToObject(json, "file"); if (!ojson) { - code = TSDB_CODE_OUT_OF_MEMORY; - TSDB_CHECK_CODE(code, lino, _exit); + TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit); } if (NULL == cJSON_AddNumberToObject(ojson, "size", cp->file_size)) { - code = TSDB_CODE_OUT_OF_MEMORY; - TSDB_CHECK_CODE(code, lino, _exit); + TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit); } if (NULL == cJSON_AddNumberToObject(ojson, "lastmodified", cp->file_last_modified)) { - code = TSDB_CODE_OUT_OF_MEMORY; - TSDB_CHECK_CODE(code, lino, _exit); + TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit); } if (NULL == cJSON_AddStringToObject(ojson, "path", cp->file_path)) { - code = TSDB_CODE_OUT_OF_MEMORY; - TSDB_CHECK_CODE(code, lino, _exit); + TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit); } if (NULL == cJSON_AddStringToObject(ojson, "file_md5", cp->file_md5)) { - code = TSDB_CODE_OUT_OF_MEMORY; - TSDB_CHECK_CODE(code, lino, _exit); + TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit); } } else if (COS_CP_TYPE_DOWNLOAD == cp->cp_type) { ojson = cJSON_AddObjectToObject(json, "object"); if (!ojson) { - code = TSDB_CODE_OUT_OF_MEMORY; - TSDB_CHECK_CODE(code, lino, _exit); + TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit); } if (NULL == cJSON_AddNumberToObject(ojson, "object_size", cp->object_size)) { - code = TSDB_CODE_OUT_OF_MEMORY; - TSDB_CHECK_CODE(code, lino, _exit); + TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit); } if (NULL == cJSON_AddStringToObject(ojson, "object_name", cp->object_name)) { - code = TSDB_CODE_OUT_OF_MEMORY; - TSDB_CHECK_CODE(code, lino, _exit); + TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit); } if (NULL == cJSON_AddStringToObject(ojson, "object_last_modified", cp->object_last_modified)) { - code = TSDB_CODE_OUT_OF_MEMORY; - TSDB_CHECK_CODE(code, lino, _exit); + TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit); } if (NULL == cJSON_AddStringToObject(ojson, "object_etag", cp->object_etag)) { - code = TSDB_CODE_OUT_OF_MEMORY; - TSDB_CHECK_CODE(code, lino, _exit); + TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit); } } ojson = cJSON_AddObjectToObject(json, "cpparts"); if (!ojson) { - code = TSDB_CODE_OUT_OF_MEMORY; - TSDB_CHECK_CODE(code, lino, _exit); + TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit); } if (NULL == cJSON_AddNumberToObject(ojson, "number", cp->part_num)) { - code = TSDB_CODE_OUT_OF_MEMORY; - TSDB_CHECK_CODE(code, lino, _exit); + TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit); } if (NULL == cJSON_AddNumberToObject(ojson, "size", cp->part_size)) { - code = TSDB_CODE_OUT_OF_MEMORY; - TSDB_CHECK_CODE(code, lino, _exit); + TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit); } cJSON* ajson = cJSON_AddArrayToObject(ojson, "parts"); if (!ajson) { - code = TSDB_CODE_OUT_OF_MEMORY; - TSDB_CHECK_CODE(code, lino, _exit); + TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit); } for (int i = 0; i < cp->part_num; ++i) { cJSON* item = cJSON_CreateObject(); if (!item) { - code = TSDB_CODE_OUT_OF_MEMORY; - TSDB_CHECK_CODE(code, lino, _exit); + TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit); } cJSON_AddItemToArray(ajson, item); if (NULL == cJSON_AddNumberToObject(item, "index", cp->parts[i].index)) { - code = TSDB_CODE_OUT_OF_MEMORY; - TSDB_CHECK_CODE(code, lino, _exit); + TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit); } if (NULL == cJSON_AddNumberToObject(item, "offset", cp->parts[i].offset)) { - code = TSDB_CODE_OUT_OF_MEMORY; - TSDB_CHECK_CODE(code, lino, _exit); + TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit); } if (NULL == cJSON_AddNumberToObject(item, "size", cp->parts[i].size)) { - code = TSDB_CODE_OUT_OF_MEMORY; - TSDB_CHECK_CODE(code, lino, _exit); + TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit); } if (NULL == cJSON_AddNumberToObject(item, "completed", cp->parts[i].completed)) { - code = TSDB_CODE_OUT_OF_MEMORY; - TSDB_CHECK_CODE(code, lino, _exit); + TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit); } if (NULL == cJSON_AddNumberToObject(item, "crc64", cp->parts[i].crc64)) { - code = TSDB_CODE_OUT_OF_MEMORY; - TSDB_CHECK_CODE(code, lino, _exit); + TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit); } if (NULL == cJSON_AddStringToObject(item, "etag", cp->parts[i].etag)) { - code = TSDB_CODE_OUT_OF_MEMORY; - TSDB_CHECK_CODE(code, lino, _exit); + TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit); } } code = cos_cp_save_json(json, cp); - TSDB_CHECK_CODE(code, lino, _exit); + TAOS_CHECK_GOTO(code, &lino, _exit); _exit: if (code) { uError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); } cJSON_Delete(json); - return code; + TAOS_RETURN(code); } void cos_cp_get_undo_parts(SCheckpoint* checkpoint, int* part_num, SCheckpointPart* parts, int64_t* consume_bytes) {} diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c index 809721d606..965246326a 100644 --- a/source/common/src/tdatablock.c +++ b/source/common/src/tdatablock.c @@ -615,6 +615,10 @@ int32_t blockDataUpdateTsWindow(SSDataBlock* pDataBlock, int32_t tsColumnIndex) int32_t index = (tsColumnIndex == -1) ? 0 : tsColumnIndex; SColumnInfoData* pColInfoData = taosArrayGet(pDataBlock->pDataBlock, index); + if (pColInfoData == NULL) { + return 0; + } + if (pColInfoData->info.type != TSDB_DATA_TYPE_TIMESTAMP) { return 0; } @@ -1512,7 +1516,9 @@ void blockDataFreeRes(SSDataBlock* pBlock) { colDataDestroy(pColInfoData); } - pBlock->pDataBlock = taosArrayDestroy(pBlock->pDataBlock); + taosArrayDestroy(pBlock->pDataBlock); + pBlock->pDataBlock = NULL; + taosMemoryFreeClear(pBlock->pBlockAgg); memset(&pBlock->info, 0, sizeof(SDataBlockInfo)); } @@ -2486,7 +2492,10 @@ int32_t buildCtbNameByGroupIdImpl(const char* stbFullName, uint64_t groupId, cha RandTableName rname = { .tags = tags, .stbFullName = stbFullName, .stbFullNameLen = strlen(stbFullName), .ctbShortName = cname}; - buildChildTableName(&rname); + int32_t code = buildChildTableName(&rname); + if(code != TSDB_CODE_SUCCESS){ + return code; + } taosArrayDestroy(tags); if ((rname.ctbShortName && rname.ctbShortName[0]) == 0) { diff --git a/source/common/src/tdataformat.c b/source/common/src/tdataformat.c index 61af2f6aae..27f865353e 100644 --- a/source/common/src/tdataformat.c +++ b/source/common/src/tdataformat.c @@ -305,11 +305,11 @@ static int32_t tRowBuildTupleRow(SArray *aColVal, const SRowBuildScanInfo *sinfo *(int32_t *)(fixed + schema->columns[i].offset) = varlen - fixed - sinfo->tupleFixedSize; varlen += tPutU32v(varlen, colValArray[colValIndex].value.nData); if (colValArray[colValIndex].value.nData) { - memcpy(varlen, colValArray[colValIndex].value.pData, colValArray[colValIndex].value.nData); + (void)memcpy(varlen, colValArray[colValIndex].value.pData, colValArray[colValIndex].value.nData); varlen += colValArray[colValIndex].value.nData; } } else { - memcpy(fixed + schema->columns[i].offset, &colValArray[colValIndex].value.val, + (void)memcpy(fixed + schema->columns[i].offset, &colValArray[colValIndex].value.val, tDataTypes[schema->columns[i].type].bytes); } } else if (COL_VAL_IS_NULL(&colValArray[colValIndex])) { // NULL @@ -384,12 +384,12 @@ static int32_t tRowBuildKVRow(SArray *aColVal, const SRowBuildScanInfo *sinfo, c payloadSize += tPutI16v(payload + payloadSize, colValArray[colValIndex].cid); payloadSize += tPutU32v(payload + payloadSize, colValArray[colValIndex].value.nData); if (colValArray[colValIndex].value.nData > 0) { - memcpy(payload + payloadSize, colValArray[colValIndex].value.pData, colValArray[colValIndex].value.nData); + (void)memcpy(payload + payloadSize, colValArray[colValIndex].value.pData, colValArray[colValIndex].value.nData); } payloadSize += colValArray[colValIndex].value.nData; } else { payloadSize += tPutI16v(payload + payloadSize, colValArray[colValIndex].cid); - memcpy(payload + payloadSize, &colValArray[colValIndex].value.val, + (void)memcpy(payload + payloadSize, &colValArray[colValIndex].value.val, tDataTypes[schema->columns[i].type].bytes); payloadSize += tDataTypes[schema->columns[i].type].bytes; } @@ -475,7 +475,7 @@ int32_t tRowBuildFromBind(SBindInfo *infos, int32_t numOfInfos, bool infoSorted, value.nData = infos[iInfo].bind->length[iRow]; value.pData = (uint8_t *)infos[iInfo].bind->buffer + infos[iInfo].bind->buffer_length * iRow; } else { - memcpy(&value.val, (uint8_t *)infos[iInfo].bind->buffer + infos[iInfo].bind->buffer_length * iRow, + (void)memcpy(&value.val, (uint8_t *)infos[iInfo].bind->buffer + infos[iInfo].bind->buffer_length * iRow, infos[iInfo].bind->buffer_length); } colVal = COL_VAL_VALUE(infos[iInfo].columnId, value); @@ -509,7 +509,7 @@ int32_t tRowGet(SRow *pRow, STSchema *pTSchema, int32_t iCol, SColVal *pColVal) pColVal->cid = pTColumn->colId; pColVal->value.type = pTColumn->type; pColVal->flag = CV_FLAG_VALUE; - memcpy(&pColVal->value.val, &pRow->ts, sizeof(TSKEY)); + (void)memcpy(&pColVal->value.val, &pRow->ts, sizeof(TSKEY)); return 0; } @@ -573,7 +573,7 @@ int32_t tRowGet(SRow *pRow, STSchema *pTSchema, int32_t iCol, SColVal *pColVal) pColVal->value.pData = NULL; } } else { - memcpy(&pColVal->value.val, pData, pTColumn->bytes); + (void)memcpy(&pColVal->value.val, pData, pTColumn->bytes); } } return 0; @@ -624,7 +624,7 @@ int32_t tRowGet(SRow *pRow, STSchema *pTSchema, int32_t iCol, SColVal *pColVal) pColVal->value.pData = varlen + *(int32_t *)(fixed + pTColumn->offset); pColVal->value.pData += tGetU32v(pColVal->value.pData, &pColVal->value.nData); } else { - memcpy(&pColVal->value.val, fixed + pTColumn->offset, TYPE_BYTES[pTColumn->type]); + (void)memcpy(&pColVal->value.val, fixed + pTColumn->offset, TYPE_BYTES[pTColumn->type]); } } @@ -861,7 +861,7 @@ SColVal *tRowIterNext(SRowIter *pIter) { pIter->cv.cid = pTColumn->colId; pIter->cv.value.type = pTColumn->type; pIter->cv.flag = CV_FLAG_VALUE; - memcpy(&pIter->cv.value.val, &pIter->pRow->ts, sizeof(TSKEY)); + (void)memcpy(&pIter->cv.value.val, &pIter->pRow->ts, sizeof(TSKEY)); goto _exit; } @@ -906,7 +906,7 @@ SColVal *tRowIterNext(SRowIter *pIter) { pIter->cv.value.pData = NULL; } } else { - memcpy(&pIter->cv.value.val, pData, pTColumn->bytes); + (void)memcpy(&pIter->cv.value.val, pData, pTColumn->bytes); } } @@ -965,7 +965,7 @@ SColVal *tRowIterNext(SRowIter *pIter) { pIter->cv.value.pData = NULL; } } else { - memcpy(&pIter->cv.value.val, pIter->pf + pTColumn->offset, TYPE_BYTES[pTColumn->type]); + (void)memcpy(&pIter->cv.value.val, pIter->pf + pTColumn->offset, TYPE_BYTES[pTColumn->type]); } goto _exit; } @@ -1288,7 +1288,7 @@ void tRowGetPrimaryKey(SRow *row, SRowKey *key) { key->pks[i].pData = tdata; key->pks[i].pData += tGetU32v(key->pks[i].pData, &key->pks[i].nData); } else { - memcpy(&key->pks[i].val, tdata, tDataTypes[indices[i].type].bytes); + (void)memcpy(&key->pks[i].val, tdata, tDataTypes[indices[i].type].bytes); } } } @@ -1378,7 +1378,7 @@ FORCE_INLINE int32_t tRowKeyCompare(const SRowKey *key1, const SRowKey *key2) { return 0; } -int32_t tRowKeyAssign(SRowKey *pDst, SRowKey *pSrc) { +void tRowKeyAssign(SRowKey *pDst, SRowKey *pSrc) { pDst->ts = pSrc->ts; pDst->numOfPKs = pSrc->numOfPKs; @@ -1392,12 +1392,10 @@ int32_t tRowKeyAssign(SRowKey *pDst, SRowKey *pSrc) { } else { pVal->nData = pSrc->pks[i].nData; ASSERT(pSrc->pks[i].pData != NULL); - memcpy(pVal->pData, pSrc->pks[i].pData, pVal->nData); + (void)memcpy(pVal->pData, pSrc->pks[i].pData, pVal->nData); } } } - - return TSDB_CODE_SUCCESS; } // STag ======================================== @@ -1528,7 +1526,7 @@ static int32_t tPutTagVal(uint8_t *p, STagVal *pTagVal, int8_t isJson) { } else { p = p ? p + n : p; n += tDataTypes[pTagVal->type].bytes; - if (p) memcpy(p, &(pTagVal->i64), tDataTypes[pTagVal->type].bytes); + if (p) (void)memcpy(p, &(pTagVal->i64), tDataTypes[pTagVal->type].bytes); } return n; @@ -1550,7 +1548,7 @@ static int32_t tGetTagVal(uint8_t *p, STagVal *pTagVal, int8_t isJson) { if (IS_VAR_DATA_TYPE(pTagVal->type)) { n += tGetBinary(p + n, &pTagVal->pData, &pTagVal->nData); } else { - memcpy(&(pTagVal->i64), p + n, tDataTypes[pTagVal->type].bytes); + (void)memcpy(&(pTagVal->i64), p + n, tDataTypes[pTagVal->type].bytes); n += tDataTypes[pTagVal->type].bytes; } @@ -1661,7 +1659,7 @@ char *tTagValToData(const STagVal *value, bool isJson) { } varDataLen(data + typeBytes) = value->nData; - memcpy(varDataVal(data + typeBytes), value->pData, value->nData); + (void)memcpy(varDataVal(data + typeBytes), value->pData, value->nData); } else { data = ((char *)&(value->i64)) - typeBytes; // json with type } @@ -1713,7 +1711,7 @@ bool tTagGet(const STag *pTag, STagVal *pTagVal) { } else if (c > 0) { lidx = midx + 1; } else { - memcpy(pTagVal, &tv, sizeof(tv)); + (void)memcpy(pTagVal, &tv, sizeof(tv)); return true; } } @@ -1892,7 +1890,7 @@ static FORCE_INLINE int32_t tColDataPutValue(SColData *pColData, uint8_t *pData, if (nData) { code = tRealloc(&pColData->pData, pColData->nData + nData); if (code) goto _exit; - memcpy(pColData->pData + pColData->nData, pData, nData); + (void)memcpy(pColData->pData + pColData->nData, pData, nData); pColData->nData += nData; } } else { @@ -1900,7 +1898,7 @@ static FORCE_INLINE int32_t tColDataPutValue(SColData *pColData, uint8_t *pData, code = tRealloc(&pColData->pData, pColData->nData + tDataTypes[pColData->type].bytes); if (code) goto _exit; if (pData) { - memcpy(pColData->pData + pColData->nData, pData, TYPE_BYTES[pColData->type]); + (void)memcpy(pColData->pData + pColData->nData, pData, TYPE_BYTES[pColData->type]); } else { memset(pColData->pData + pColData->nData, 0, TYPE_BYTES[pColData->type]); } @@ -2594,7 +2592,7 @@ static FORCE_INLINE void tColDataGetValue4(SColData *pColData, int32_t iVal, SCo } value.pData = pColData->pData + pColData->aOffset[iVal]; } else { - memcpy(&value.val, pColData->pData + tDataTypes[pColData->type].bytes * iVal, tDataTypes[pColData->type].bytes); + (void)memcpy(&value.val, pColData->pData + tDataTypes[pColData->type].bytes * iVal, tDataTypes[pColData->type].bytes); } *pColVal = COL_VAL_VALUE(pColData->cid, value); } @@ -2692,7 +2690,7 @@ int32_t tColDataCopy(SColData *pColDataFrom, SColData *pColData, xMallocFn xMall code = TSDB_CODE_OUT_OF_MEMORY; goto _exit; } - memcpy(pColData->pBitMap, pColDataFrom->pBitMap, BIT1_SIZE(pColData->nVal)); + (void)memcpy(pColData->pBitMap, pColDataFrom->pBitMap, BIT1_SIZE(pColData->nVal)); break; case (HAS_VALUE | HAS_NULL | HAS_NONE): pColData->pBitMap = xMalloc(arg, BIT2_SIZE(pColData->nVal)); @@ -2700,7 +2698,7 @@ int32_t tColDataCopy(SColData *pColDataFrom, SColData *pColData, xMallocFn xMall code = TSDB_CODE_OUT_OF_MEMORY; goto _exit; } - memcpy(pColData->pBitMap, pColDataFrom->pBitMap, BIT2_SIZE(pColData->nVal)); + (void)memcpy(pColData->pBitMap, pColDataFrom->pBitMap, BIT2_SIZE(pColData->nVal)); break; default: pColData->pBitMap = NULL; @@ -2714,7 +2712,7 @@ int32_t tColDataCopy(SColData *pColDataFrom, SColData *pColData, xMallocFn xMall code = TSDB_CODE_OUT_OF_MEMORY; goto _exit; } - memcpy(pColData->aOffset, pColDataFrom->aOffset, pColData->nVal << 2); + (void)memcpy(pColData->aOffset, pColDataFrom->aOffset, pColData->nVal << 2); } else { pColData->aOffset = NULL; } @@ -2727,7 +2725,7 @@ int32_t tColDataCopy(SColData *pColDataFrom, SColData *pColData, xMallocFn xMall goto _exit; } - memcpy(pColData->pData, pColDataFrom->pData, pColData->nData); + (void)memcpy(pColData->pData, pColDataFrom->pData, pColData->nData); } else { pColData->pData = NULL; } @@ -3119,10 +3117,10 @@ static int32_t tColDataCopyRowCell(SColData *pFromColData, int32_t iFromRow, SCo pToColData->aOffset[iToRow + 1] = pToColData->aOffset[iToRow] + nData; } - memcpy(pToColData->pData + pToColData->aOffset[iToRow], pFromColData->pData + pFromColData->aOffset[iFromRow], + (void)memcpy(pToColData->pData + pToColData->aOffset[iToRow], pFromColData->pData + pFromColData->aOffset[iFromRow], nData); } else { - memcpy(&pToColData->pData[TYPE_BYTES[pToColData->type] * iToRow], + (void)memcpy(&pToColData->pData[TYPE_BYTES[pToColData->type] * iToRow], &pFromColData->pData[TYPE_BYTES[pToColData->type] * iFromRow], TYPE_BYTES[pToColData->type]); } return code; @@ -3361,7 +3359,7 @@ static void tColDataMergeImpl(SColData *pColData, int32_t iStart, int32_t iEnd / ASSERT(0); } else { if (iv != iStart) { - memcpy(&pColData->pData[TYPE_BYTES[pColData->type] * iStart], + (void)memcpy(&pColData->pData[TYPE_BYTES[pColData->type] * iStart], &pColData->pData[TYPE_BYTES[pColData->type] * iv], TYPE_BYTES[pColData->type]); } memmove(&pColData->pData[TYPE_BYTES[pColData->type] * (iStart + 1)], @@ -3579,11 +3577,11 @@ static int32_t tPutColDataVersion0(uint8_t *pBuf, SColData *pColData) { case (HAS_NULL | HAS_NONE): case (HAS_VALUE | HAS_NONE): case (HAS_VALUE | HAS_NULL): - if (pBuf) memcpy(pBuf + n, pColData->pBitMap, BIT1_SIZE(pColData->nVal)); + if (pBuf) (void)memcpy(pBuf + n, pColData->pBitMap, BIT1_SIZE(pColData->nVal)); n += BIT1_SIZE(pColData->nVal); break; case (HAS_VALUE | HAS_NULL | HAS_NONE): - if (pBuf) memcpy(pBuf + n, pColData->pBitMap, BIT2_SIZE(pColData->nVal)); + if (pBuf) (void)memcpy(pBuf + n, pColData->pBitMap, BIT2_SIZE(pColData->nVal)); n += BIT2_SIZE(pColData->nVal); break; default: @@ -3593,14 +3591,14 @@ static int32_t tPutColDataVersion0(uint8_t *pBuf, SColData *pColData) { // value if (pColData->flag & HAS_VALUE) { if (IS_VAR_DATA_TYPE(pColData->type)) { - if (pBuf) memcpy(pBuf + n, pColData->aOffset, pColData->nVal << 2); + if (pBuf) (void)memcpy(pBuf + n, pColData->aOffset, pColData->nVal << 2); n += (pColData->nVal << 2); n += tPutI32v(pBuf ? pBuf + n : NULL, pColData->nData); - if (pBuf) memcpy(pBuf + n, pColData->pData, pColData->nData); + if (pBuf) (void)memcpy(pBuf + n, pColData->pData, pColData->nData); n += pColData->nData; } else { - if (pBuf) memcpy(pBuf + n, pColData->pData, pColData->nData); + if (pBuf) (void)memcpy(pBuf + n, pColData->pData, pColData->nData); n += pColData->nData; } } @@ -4348,7 +4346,7 @@ int32_t tCompressData(void *input, // input ASSERT(outputSize >= extraSizeNeeded); if (info->cmprAlg == NO_COMPRESSION) { - memcpy(output, input, info->originalSize); + (void)memcpy(output, input, info->originalSize); info->compressedSize = info->originalSize; } else if (info->cmprAlg == ONE_STAGE_COMP || info->cmprAlg == TWO_STAGE_COMP) { SBuffer local; @@ -4385,7 +4383,7 @@ int32_t tCompressData(void *input, // input } else { DEFINE_VAR(info->cmprAlg) if ((l1 == L1_UNKNOWN && l2 == L2_UNKNOWN) || (l1 == L1_DISABLED && l2 == L2_DISABLED)) { - memcpy(output, input, info->originalSize); + (void)memcpy(output, input, info->originalSize); info->compressedSize = info->originalSize; return 0; } @@ -4431,7 +4429,7 @@ int32_t tDecompressData(void *input, // input if (info->cmprAlg == NO_COMPRESSION) { ASSERT(info->compressedSize == info->originalSize); - memcpy(output, input, info->compressedSize); + (void)memcpy(output, input, info->compressedSize); } else if (info->cmprAlg == ONE_STAGE_COMP || info->cmprAlg == TWO_STAGE_COMP) { SBuffer local; @@ -4468,7 +4466,7 @@ int32_t tDecompressData(void *input, // input } else { DEFINE_VAR(info->cmprAlg); if (l1 == L1_DISABLED && l2 == L2_DISABLED) { - memcpy(output, input, info->compressedSize); + (void)memcpy(output, input, info->compressedSize); return 0; } SBuffer local; diff --git a/source/common/src/tmisce.c b/source/common/src/tmisce.c index d2b52b201e..7b349e91b0 100644 --- a/source/common/src/tmisce.c +++ b/source/common/src/tmisce.c @@ -15,9 +15,9 @@ #define _DEFAULT_SOURCE #include "tmisce.h" +#include "tdatablock.h" #include "tglobal.h" #include "tjson.h" -#include "tdatablock.h" int32_t taosGetFqdnPortFromEp(const char* ep, SEp* pEp) { pEp->port = 0; @@ -34,18 +34,26 @@ int32_t taosGetFqdnPortFromEp(const char* ep, SEp* pEp) { pEp->port = tsServerPort; } + if (pEp->port <= 0) { + return TSDB_CODE_INVALID_PARA; + } + return 0; } -void addEpIntoEpSet(SEpSet* pEpSet, const char* fqdn, uint16_t port) { +int32_t addEpIntoEpSet(SEpSet* pEpSet, const char* fqdn, uint16_t port) { if (pEpSet == NULL || fqdn == NULL || strlen(fqdn) == 0) { - return; + return TSDB_CODE_INVALID_PARA; } int32_t index = pEpSet->numOfEps; + if (index >= sizeof(pEpSet->eps) / sizeof(pEpSet->eps[0])) { + return TSDB_CODE_OUT_OF_RANGE; + } tstrncpy(pEpSet->eps[index].fqdn, fqdn, tListLen(pEpSet->eps[index].fqdn)); pEpSet->eps[index].port = port; pEpSet->numOfEps += 1; + return 0; } bool isEpsetEqual(const SEpSet* s1, const SEpSet* s2) { @@ -131,75 +139,96 @@ SEpSet getEpSet_s(SCorEpSet* pEpSet) { return ep; } -int32_t epsetToStr(const SEpSet* pEpSet, char* pBuf, int32_t bufLen) { - int len = snprintf(pBuf, bufLen, "epset:{"); - if (len < 0) { - return -1; - } +int32_t epsetToStr(const SEpSet* pEpSet, char* pBuf, int32_t cap) { + int32_t ret = 0; + int32_t nwrite = 0; - for (int _i = 0; (_i < pEpSet->numOfEps) && (bufLen > len); _i++) { + nwrite = snprintf(pBuf + nwrite, cap, "epset:{"); + if (nwrite <= 0 || nwrite >= cap) { + return TSDB_CODE_OUT_OF_BUFFER; + } + cap -= nwrite; + + for (int _i = 0; (_i < pEpSet->numOfEps) && (cap > 0); _i++) { int32_t ret = 0; if (_i == pEpSet->numOfEps - 1) { - ret = snprintf(pBuf + len, bufLen - len, "%d. %s:%d", _i, pEpSet->eps[_i].fqdn, pEpSet->eps[_i].port); + ret = snprintf(pBuf + nwrite, cap, "%d. %s:%d", _i, pEpSet->eps[_i].fqdn, pEpSet->eps[_i].port); } else { - ret = snprintf(pBuf + len, bufLen - len, "%d. %s:%d, ", _i, pEpSet->eps[_i].fqdn, pEpSet->eps[_i].port); + ret = snprintf(pBuf + nwrite, cap, "%d. %s:%d, ", _i, pEpSet->eps[_i].fqdn, pEpSet->eps[_i].port); } - if (ret < 0) { - return -1; + if (ret <= 0 || ret >= cap) { + return TSDB_CODE_OUT_OF_BUFFER; } - len += ret; + nwrite += ret; + cap -= ret; } - if (len < bufLen) { - /*len += */snprintf(pBuf + len, bufLen - len, "}, inUse:%d", pEpSet->inUse); + if (cap <= 0) { + return TSDB_CODE_OUT_OF_BUFFER; } + ret = snprintf(pBuf + nwrite, cap, "}, inUse:%d", pEpSet->inUse); + if (ret <= 0 || ret >= cap) { + return TSDB_CODE_OUT_OF_BUFFER; + } return TSDB_CODE_SUCCESS; } int32_t taosGenCrashJsonMsg(int signum, char** pMsg, int64_t clusterId, int64_t startTime) { - SJson* pJson = tjsonCreateObject(); - if (pJson == NULL) return -1; + int32_t code = 0; + SJson* pJson = tjsonCreateObject(); + if (pJson == NULL) return TSDB_CODE_OUT_OF_MEMORY; + char tmp[4096] = {0}; - tjsonAddDoubleToObject(pJson, "reportVersion", 1); + TAOS_CHECK_GOTO(tjsonAddDoubleToObject(pJson, "reportVersion", 1), NULL, _exit); - tjsonAddIntegerToObject(pJson, "clusterId", clusterId); - tjsonAddIntegerToObject(pJson, "startTime", startTime); + TAOS_CHECK_GOTO(tjsonAddIntegerToObject(pJson, "clusterId", clusterId), NULL, _exit); + TAOS_CHECK_GOTO(tjsonAddIntegerToObject(pJson, "startTime", startTime), NULL, _exit); // Do NOT invoke the taosGetFqdn here. // this function may be invoked when memory exception occurs,so we should assume that it is running in a memory locked // environment. The lock operation by taosGetFqdn may cause this program deadlock. - tjsonAddStringToObject(pJson, "fqdn", tsLocalFqdn); + TAOS_CHECK_GOTO(tjsonAddStringToObject(pJson, "fqdn", tsLocalFqdn), NULL, _exit); - tjsonAddIntegerToObject(pJson, "pid", taosGetPId()); + TAOS_CHECK_GOTO(tjsonAddIntegerToObject(pJson, "pid", taosGetPId()), NULL, _exit); - taosGetAppName(tmp, NULL); - tjsonAddStringToObject(pJson, "appName", tmp); + code = taosGetAppName(tmp, NULL); + if (code != 0) { + code = TAOS_SYSTEM_ERROR(errno); + TAOS_CHECK_GOTO(code, NULL, _exit); + } + TAOS_CHECK_GOTO(tjsonAddStringToObject(pJson, "appName", tmp), NULL, _exit); if (taosGetOsReleaseName(tmp, NULL, NULL, sizeof(tmp)) == 0) { - tjsonAddStringToObject(pJson, "os", tmp); + TAOS_CHECK_GOTO(tjsonAddStringToObject(pJson, "os", tmp), NULL, _exit); + } else { + // do nothing } float numOfCores = 0; if (taosGetCpuInfo(tmp, sizeof(tmp), &numOfCores) == 0) { - tjsonAddStringToObject(pJson, "cpuModel", tmp); - tjsonAddDoubleToObject(pJson, "numOfCpu", numOfCores); + TAOS_CHECK_GOTO(tjsonAddStringToObject(pJson, "cpuModel", tmp), NULL, _exit); + TAOS_CHECK_GOTO(tjsonAddDoubleToObject(pJson, "numOfCpu", numOfCores), NULL, _exit); } else { - tjsonAddDoubleToObject(pJson, "numOfCpu", tsNumOfCores); + TAOS_CHECK_GOTO(tjsonAddDoubleToObject(pJson, "numOfCpu", tsNumOfCores), NULL, _exit); } - snprintf(tmp, sizeof(tmp), "%" PRId64 " kB", tsTotalMemoryKB); - tjsonAddStringToObject(pJson, "memory", tmp); + int32_t nBytes = snprintf(tmp, sizeof(tmp), "%" PRId64 " kB", tsTotalMemoryKB); + if (nBytes <= 9 || nBytes >= sizeof(tmp)) { + TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_RANGE, NULL, _exit); + } + TAOS_CHECK_GOTO(tjsonAddStringToObject(pJson, "memory", tmp), NULL, _exit); - tjsonAddStringToObject(pJson, "version", version); - tjsonAddStringToObject(pJson, "buildInfo", buildinfo); - tjsonAddStringToObject(pJson, "gitInfo", gitinfo); + TAOS_CHECK_GOTO(tjsonAddStringToObject(pJson, "version", version), NULL, _exit); + TAOS_CHECK_GOTO(tjsonAddStringToObject(pJson, "buildInfo", buildinfo), NULL, _exit); - tjsonAddIntegerToObject(pJson, "crashSig", signum); - tjsonAddIntegerToObject(pJson, "crashTs", taosGetTimestampUs()); + TAOS_CHECK_GOTO(tjsonAddStringToObject(pJson, "gitInfo", gitinfo), NULL, _exit); + + TAOS_CHECK_GOTO(tjsonAddIntegerToObject(pJson, "crashSig", signum), NULL, _exit); + TAOS_CHECK_GOTO(tjsonAddIntegerToObject(pJson, "crashTs", taosGetTimestampUs()), NULL, _exit); #ifdef _TD_DARWIN_64 taosLogTraceToBuf(tmp, sizeof(tmp), 4); @@ -209,26 +238,47 @@ int32_t taosGenCrashJsonMsg(int signum, char** pMsg, int64_t clusterId, int64_t taosLogTraceToBuf(tmp, sizeof(tmp), 8); #endif - tjsonAddStringToObject(pJson, "stackInfo", tmp); + TAOS_CHECK_GOTO(tjsonAddStringToObject(pJson, "stackInfo", tmp), NULL, _exit); char* pCont = tjsonToString(pJson); + if (pCont == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + TAOS_CHECK_GOTO(code, NULL, _exit); + goto _exit; + } + tjsonDelete(pJson); - *pMsg = pCont; - - return TSDB_CODE_SUCCESS; + pJson = NULL; +_exit: + tjsonDelete(pJson); + TAOS_RETURN(code); } int32_t dumpConfToDataBlock(SSDataBlock* pBlock, int32_t startCol) { - SConfig* pConf = taosGetCfg(); + int32_t code = 0; + SConfig* pConf = taosGetCfg(); + if (pConf == NULL) { + return TSDB_CODE_INVALID_CFG; + } + int32_t numOfRows = 0; int32_t col = startCol; SConfigItem* pItem = NULL; + SConfigIter* pIter = NULL; - blockDataEnsureCapacity(pBlock, cfgGetSize(pConf)); - SConfigIter* pIter = cfgCreateIter(pConf); + int8_t locked = 0; + + TAOS_CHECK_GOTO(blockDataEnsureCapacity(pBlock, cfgGetSize(pConf)), NULL, _exit); + + pIter = cfgCreateIter(pConf); + if (pIter == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + TAOS_CHECK_GOTO(code, NULL, _exit); + } cfgLock(pConf); + locked = 1; while ((pItem = cfgNextIter(pIter)) != NULL) { col = startCol; @@ -236,29 +286,44 @@ int32_t dumpConfToDataBlock(SSDataBlock* pBlock, int32_t startCol) { // GRANT_CFG_SKIP; char name[TSDB_CONFIG_OPTION_LEN + VARSTR_HEADER_SIZE] = {0}; STR_WITH_MAXSIZE_TO_VARSTR(name, pItem->name, TSDB_CONFIG_OPTION_LEN + VARSTR_HEADER_SIZE); + SColumnInfoData* pColInfo = taosArrayGet(pBlock->pDataBlock, col++); - colDataSetVal(pColInfo, numOfRows, name, false); + if (pColInfo == NULL) { + code = TSDB_CODE_OUT_OF_RANGE; + TAOS_CHECK_GOTO(code, NULL, _exit); + } + + TAOS_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, name, false), NULL, _exit); char value[TSDB_CONFIG_VALUE_LEN + VARSTR_HEADER_SIZE] = {0}; int32_t valueLen = 0; cfgDumpItemValue(pItem, &value[VARSTR_HEADER_SIZE], TSDB_CONFIG_VALUE_LEN, &valueLen); varDataSetLen(value, valueLen); + pColInfo = taosArrayGet(pBlock->pDataBlock, col++); - colDataSetVal(pColInfo, numOfRows, value, false); + if (pColInfo == NULL) { + code = TSDB_CODE_OUT_OF_RANGE; + TAOS_CHECK_GOTO(code, NULL, _exit); + } + + TAOS_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, value, false), NULL, _exit); char scope[TSDB_CONFIG_SCOPE_LEN + VARSTR_HEADER_SIZE] = {0}; cfgDumpItemScope(pItem, &scope[VARSTR_HEADER_SIZE], TSDB_CONFIG_SCOPE_LEN, &valueLen); varDataSetLen(scope, valueLen); + pColInfo = taosArrayGet(pBlock->pDataBlock, col++); - colDataSetVal(pColInfo, numOfRows, scope, false); + if (pColInfo == NULL) { + code = TSDB_CODE_OUT_OF_RANGE; + TAOS_CHECK_GOTO(code, NULL, _exit); + } + TAOS_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, scope, false), NULL, _exit); numOfRows++; } - - cfgUnLock(pConf); - pBlock->info.rows = numOfRows; - +_exit: + if (locked) cfgUnLock(pConf); cfgDestroyIter(pIter); - return TSDB_CODE_SUCCESS; + TAOS_RETURN(code); } diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index 7e89753241..fa79d16970 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -9505,7 +9505,8 @@ int32_t tDecodeMqDataRsp(SDecoder *pDecoder, void *pRsp) { static void tDeleteMqDataRspCommon(void *rsp) { SMqDataRspCommon *pRsp = rsp; - pRsp->blockDataLen = taosArrayDestroy(pRsp->blockDataLen); + taosArrayDestroy(pRsp->blockDataLen); + pRsp->blockDataLen = NULL; taosArrayDestroyP(pRsp->blockData, (FDelete)taosMemoryFree); pRsp->blockData = NULL; taosArrayDestroyP(pRsp->blockSchema, (FDelete)tDeleteSchemaWrapper); @@ -9558,7 +9559,8 @@ void tDeleteSTaosxRsp(void *rsp) { tDeleteMqDataRspCommon(rsp); STaosxRsp *pRsp = (STaosxRsp *)rsp; - pRsp->createTableLen = taosArrayDestroy(pRsp->createTableLen); + taosArrayDestroy(pRsp->createTableLen); + pRsp->createTableLen = NULL; taosArrayDestroyP(pRsp->createTableReq, (FDelete)taosMemoryFree); pRsp->createTableReq = NULL; } diff --git a/source/common/src/tname.c b/source/common/src/tname.c index 4fe2beb6aa..e4604c6bab 100644 --- a/source/common/src/tname.c +++ b/source/common/src/tname.c @@ -293,17 +293,19 @@ static int compareKv(const void* p1, const void* p2) { /* * use stable name and tags to grearate child table name */ -void buildChildTableName(RandTableName* rName) { +int32_t buildChildTableName(RandTableName* rName) { SStringBuilder sb = {0}; taosStringBuilderAppendStringLen(&sb, rName->stbFullName, rName->stbFullNameLen); if (sb.buf == NULL) { - terrno = TSDB_CODE_OUT_OF_MEMORY; - return; + return TSDB_CODE_OUT_OF_MEMORY; } taosArraySort(rName->tags, compareKv); for (int j = 0; j < taosArrayGetSize(rName->tags); ++j) { taosStringBuilderAppendChar(&sb, ','); SSmlKv* tagKv = taosArrayGet(rName->tags, j); + if(tagKv == NULL) { + return TSDB_CODE_SML_INVALID_DATA; + } taosStringBuilderAppendStringLen(&sb, tagKv->key, tagKv->keyLen); taosStringBuilderAppendChar(&sb, '='); if (IS_VAR_DATA_TYPE(tagKv->type)) { @@ -323,8 +325,9 @@ void buildChildTableName(RandTableName* rName) { rName->ctbShortName[0] = 't'; rName->ctbShortName[1] = '_'; for (int i = 0; i < 16; i++) { - sprintf(temp, "%02x", context.digest[i]); - strcat(rName->ctbShortName, temp); + (void)sprintf(temp, "%02x", context.digest[i]); + (void)strcat(rName->ctbShortName, temp); } taosStringBuilderDestroy(&sb); + return TSDB_CODE_SUCCESS; } diff --git a/source/dnode/mgmt/mgmt_vnode/inc/vmInt.h b/source/dnode/mgmt/mgmt_vnode/inc/vmInt.h index 85712d2797..c3b4bc0710 100644 --- a/source/dnode/mgmt/mgmt_vnode/inc/vmInt.h +++ b/source/dnode/mgmt/mgmt_vnode/inc/vmInt.h @@ -34,12 +34,14 @@ typedef struct SVnodeMgmt { SAutoQWorkerPool streamPool; SWWorkerPool fetchPool; SSingleWorker mgmtWorker; + SSingleWorker mgmtMultiWorker; SHashObj *hash; TdThreadRwlock lock; SVnodesStat state; STfs *pTfs; TdThread thread; bool stop; + TdThreadMutex createLock; } SVnodeMgmt; typedef struct { @@ -69,6 +71,7 @@ typedef struct { STaosQueue *pQueryQ; STaosQueue *pStreamQ; STaosQueue *pFetchQ; + STaosQueue *pMultiMgmQ; } SVnodeObj; typedef struct { @@ -125,6 +128,7 @@ int32_t vmPutMsgToFetchQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg); int32_t vmPutMsgToStreamQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg); int32_t vmPutMsgToMergeQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg); int32_t vmPutMsgToMgmtQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg); +int32_t vmPutMsgToMultiMgmtQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg); #ifdef __cplusplus } diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c index fbe1925e3f..0669956fb8 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c @@ -377,11 +377,14 @@ int32_t vmProcessCreateVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) { goto _OVER; } + taosThreadMutexLock(&pMgmt->createLock); code = vmWriteVnodeListToFile(pMgmt); if (code != 0) { code = terrno != 0 ? terrno : code; + taosThreadMutexUnlock(&pMgmt->createLock); goto _OVER; } + taosThreadMutexUnlock(&pMgmt->createLock); _OVER: if (code != 0) { @@ -985,7 +988,7 @@ SArray *vmGetMsgHandles() { if (dmSetMgmtHandle(pArray, TDMT_VND_COMPACT, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_TRIM, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_S3MIGRATE, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER; - if (dmSetMgmtHandle(pArray, TDMT_DND_CREATE_VNODE, vmPutMsgToMgmtQueue, 0) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_DND_CREATE_VNODE, vmPutMsgToMultiMgmtQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_DND_DROP_VNODE, vmPutMsgToMgmtQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_DND_ALTER_VNODE_TYPE, vmPutMsgToMgmtQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_DND_CHECK_VNODE_LEARNER_CATCHUP, vmPutMsgToMgmtQueue, 0) == NULL) goto _OVER; diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmInt.c b/source/dnode/mgmt/mgmt_vnode/src/vmInt.c index 296372a955..aa9b009761 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmInt.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmInt.c @@ -439,6 +439,8 @@ static void vmCloseVnodes(SVnodeMgmt *pMgmt) { dInfo("start to close all vnodes"); tSingleWorkerCleanup(&pMgmt->mgmtWorker); dInfo("vnodes mgmt worker is stopped"); + tSingleWorkerCleanup(&pMgmt->mgmtMultiWorker); + dInfo("vnodes multiple mgmt worker is stopped"); int32_t numOfVnodes = 0; SVnodeObj **ppVnodes = vmGetVnodeListFromHash(pMgmt, &numOfVnodes); @@ -506,6 +508,7 @@ static void vmCleanup(SVnodeMgmt *pMgmt) { vmStopWorker(pMgmt); vnodeCleanup(); taosThreadRwlockDestroy(&pMgmt->lock); + taosThreadMutexDestroy(&pMgmt->createLock); taosMemoryFree(pMgmt); } @@ -580,6 +583,7 @@ static int32_t vmInit(SMgmtInputOpt *pInput, SMgmtOutputOpt *pOutput) { pMgmt->msgCb.qsizeFp = (GetQueueSizeFp)vmGetQueueSize; pMgmt->msgCb.mgmt = pMgmt; taosThreadRwlockInit(&pMgmt->lock, NULL); + taosThreadMutexInit(&pMgmt->createLock, NULL); pMgmt->pTfs = pInput->pTfs; if (pMgmt->pTfs == NULL) { diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c b/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c index 8c1b33cb14..0415340be9 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c @@ -28,6 +28,31 @@ static inline void vmSendRsp(SRpcMsg *pMsg, int32_t code) { tmsgSendRsp(&rsp); } +static void vmProcessMultiMgmtQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) { + SVnodeMgmt *pMgmt = pInfo->ahandle; + int32_t code = -1; + const STraceId *trace = &pMsg->info.traceId; + + dGTrace("msg:%p, get from vnode-multi-mgmt queue", pMsg); + switch (pMsg->msgType) { + case TDMT_DND_CREATE_VNODE: + code = vmProcessCreateVnodeReq(pMgmt, pMsg); + break; + } + + if (IsReq(pMsg)) { + if (code != 0) { + if (terrno != 0) code = terrno; + dGError("msg:%p, failed to process since %s, type:%s", pMsg, tstrerror(code), TMSG_INFO(pMsg->msgType)); + } + vmSendRsp(pMsg, code); + } + + dGTrace("msg:%p, is freed, code:0x%x", pMsg, code); + rpcFreeCont(pMsg->pCont); + taosFreeQitem(pMsg); +} + static void vmProcessMgmtQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) { SVnodeMgmt *pMgmt = pInfo->ahandle; int32_t code = -1; @@ -271,6 +296,13 @@ int32_t vmPutMsgToFetchQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) { return vmPutMsg int32_t vmPutMsgToStreamQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) { return vmPutMsgToQueue(pMgmt, pMsg, STREAM_QUEUE); } +int32_t vmPutMsgToMultiMgmtQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) { + const STraceId *trace = &pMsg->info.traceId; + dGTrace("msg:%p, put into vnode-multi-mgmt queue", pMsg); + taosWriteQitem(pMgmt->mgmtMultiWorker.queue, pMsg); + return 0; +} + int32_t vmPutMsgToMgmtQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) { const STraceId *trace = &pMsg->info.traceId; dGTrace("msg:%p, put into vnode-mgmt queue", pMsg); @@ -415,6 +447,20 @@ int32_t vmStartWorker(SVnodeMgmt *pMgmt) { if (tSingleWorkerInit(&pMgmt->mgmtWorker, &mgmtCfg) != 0) return -1; + int32_t threadNum = 0; + if (tsNumOfCores == 1) { + threadNum = 2; + } else { + threadNum = tsNumOfCores; + } + SSingleWorkerCfg multiMgmtCfg = {.min = threadNum, + .max = threadNum, + .name = "vnode-multi-mgmt", + .fp = (FItem)vmProcessMultiMgmtQueue, + .param = pMgmt}; + + if (tSingleWorkerInit(&pMgmt->mgmtMultiWorker, &multiMgmtCfg) != 0) return -1; + dDebug("vnode workers are initialized"); return 0; } diff --git a/source/dnode/mgmt/node_mgmt/src/dmEnv.c b/source/dnode/mgmt/node_mgmt/src/dmEnv.c index 4be1af30b5..f636629b3a 100644 --- a/source/dnode/mgmt/node_mgmt/src/dmEnv.c +++ b/source/dnode/mgmt/node_mgmt/src/dmEnv.c @@ -18,6 +18,7 @@ #include "audit.h" #include "libs/function/tudf.h" #include "tgrant.h" +#include "tcompare.h" #define DM_INIT_AUDIT() \ do { \ @@ -163,6 +164,7 @@ int32_t dmInit() { if (dmInitMonitor() != 0) return -1; if (dmInitAudit() != 0) return -1; if (dmInitDnode(dmInstance()) != 0) return -1; + if (InitRegexCache() != 0) return -1; #if defined(USE_S3) if (s3Begin() != 0) return -1; #endif @@ -192,6 +194,7 @@ void dmCleanup() { udfStopUdfd(); taosStopCacheRefreshWorker(); dmDiskClose(); + DestroyRegexCache(); #if defined(USE_S3) s3End(); @@ -310,7 +313,7 @@ static int32_t dmProcessAlterNodeTypeReq(EDndNodeType ntype, SRpcMsg *pMsg) { pWrapper = &pDnode->wrappers[ntype]; if (taosMkDir(pWrapper->path) != 0) { - dmReleaseWrapper(pWrapper); + taosThreadMutexUnlock(&pDnode->mutex); terrno = TAOS_SYSTEM_ERROR(errno); dError("failed to create dir:%s since %s", pWrapper->path, terrstr()); return -1; diff --git a/source/dnode/mnode/impl/src/mndDef.c b/source/dnode/mnode/impl/src/mndDef.c index 5164557184..9dc5f920ad 100644 --- a/source/dnode/mnode/impl/src/mndDef.c +++ b/source/dnode/mnode/impl/src/mndDef.c @@ -195,7 +195,9 @@ void *freeStreamTasks(SArray *pTaskLevel) { taosArrayDestroy(pLevel); } - return taosArrayDestroy(pTaskLevel); + taosArrayDestroy(pTaskLevel); + + return NULL; } void tFreeStreamObj(SStreamObj *pStream) { diff --git a/source/dnode/mnode/impl/src/mndStreamUtil.c b/source/dnode/mnode/impl/src/mndStreamUtil.c index c4adbd0fc3..e4e30bdf10 100644 --- a/source/dnode/mnode/impl/src/mndStreamUtil.c +++ b/source/dnode/mnode/impl/src/mndStreamUtil.c @@ -978,7 +978,8 @@ void mndAddConsensusTasks(SCheckpointConsensusInfo *pInfo, const SRestoreCheckpo } void mndClearConsensusRspEntry(SCheckpointConsensusInfo* pInfo) { - pInfo->pTaskList = taosArrayDestroy(pInfo->pTaskList); + taosArrayDestroy(pInfo->pTaskList); + pInfo->pTaskList = NULL; } int64_t mndClearConsensusCheckpointId(SHashObj* pHash, int64_t streamId) { diff --git a/source/dnode/vnode/inc/vnode.h b/source/dnode/vnode/inc/vnode.h index e35c152e9b..990d03f940 100644 --- a/source/dnode/vnode/inc/vnode.h +++ b/source/dnode/vnode/inc/vnode.h @@ -167,7 +167,7 @@ void tsdbReaderClose2(STsdbReader *pReader); int32_t tsdbNextDataBlock2(STsdbReader *pReader, bool *hasNext); int32_t tsdbRetrieveDatablockSMA2(STsdbReader *pReader, SSDataBlock *pDataBlock, bool *allHave, bool *hasNullSMA); void tsdbReleaseDataBlock2(STsdbReader *pReader); -SSDataBlock *tsdbRetrieveDataBlock2(STsdbReader *pTsdbReadHandle, SArray *pColumnIdList); +int32_t tsdbRetrieveDataBlock2(STsdbReader *pReader, SSDataBlock **pBlock, SArray *pIdList); int32_t tsdbReaderReset2(STsdbReader *pReader, SQueryTableDataCond *pCond); int32_t tsdbGetFileBlocksDistInfo2(STsdbReader *pReader, STableBlockDistInfo *pTableBlockInfo); int64_t tsdbGetNumOfRowsInMemTable2(STsdbReader *pHandle); diff --git a/source/dnode/vnode/src/inc/tsdb.h b/source/dnode/vnode/src/inc/tsdb.h index 84e1996f2c..943ba099f6 100644 --- a/source/dnode/vnode/src/inc/tsdb.h +++ b/source/dnode/vnode/src/inc/tsdb.h @@ -909,9 +909,9 @@ void tMergeTreeUnpinSttBlock(SMergeTree *pMTree); bool tMergeTreeIgnoreEarlierTs(SMergeTree *pMTree); void tMergeTreeClose(SMergeTree *pMTree); -SSttBlockLoadInfo *tCreateSttBlockLoadInfo(STSchema *pSchema, int16_t *colList, int32_t numOfCols); -void * destroySttBlockLoadInfo(SSttBlockLoadInfo *pLoadInfo); -void * destroySttBlockReader(SArray *pLDataIterArray, SSttBlockLoadCostInfo *pLoadCost); +int32_t tCreateSttBlockLoadInfo(STSchema *pSchema, int16_t *colList, int32_t numOfCols, SSttBlockLoadInfo **pInfo); +void destroySttBlockLoadInfo(SSttBlockLoadInfo *pLoadInfo); +void destroySttBlockReader(SArray *pLDataIterArray, SSttBlockLoadCostInfo *pLoadCost); // tsdbCache ============================================================================================== typedef enum { diff --git a/source/dnode/vnode/src/inc/vnodeInt.h b/source/dnode/vnode/src/inc/vnodeInt.h index 4b16a076cc..15259f0e91 100644 --- a/source/dnode/vnode/src/inc/vnodeInt.h +++ b/source/dnode/vnode/src/inc/vnodeInt.h @@ -54,7 +54,6 @@ extern "C" { #endif typedef struct SVnodeInfo SVnodeInfo; -typedef struct SMeta SMeta; typedef struct SSma SSma; typedef struct STsdb STsdb; typedef struct STQ STQ; @@ -153,7 +152,6 @@ int32_t vnodeBufPoolRegisterQuery(SVBufPool* pPool, SQueryNode* pQNode); void vnodeBufPoolDeregisterQuery(SVBufPool* pPool, SQueryNode* pQNode, bool proactive); // meta -typedef struct SMCtbCursor SMCtbCursor; typedef struct SMStbCursor SMStbCursor; typedef struct STbUidStore STbUidStore; diff --git a/source/dnode/vnode/src/tq/tqSink.c b/source/dnode/vnode/src/tq/tqSink.c index 34bd39f6e7..9b1e8075da 100644 --- a/source/dnode/vnode/src/tq/tqSink.c +++ b/source/dnode/vnode/src/tq/tqSink.c @@ -250,7 +250,8 @@ static int32_t doBuildAndSendCreateTableMsg(SVnode* pVnode, char* stbFullName, S } tTagNew(tagArray, 1, false, (STag**)&pCreateTbReq->ctb.pTag); - tagArray = taosArrayDestroy(tagArray); + taosArrayDestroy(tagArray); + tagArray = NULL; if (pCreateTbReq->ctb.pTag == NULL) { tdDestroySVCreateTbReq(pCreateTbReq); code = TSDB_CODE_OUT_OF_MEMORY; @@ -514,7 +515,8 @@ int32_t doConvertRows(SSubmitTbData* pTableData, const STSchema* pTSchema, SSDat pTableData->aRowP = taosArrayInit(numOfRows, sizeof(SRow*)); if (pTableData->aRowP == NULL || pVals == NULL) { - pTableData->aRowP = taosArrayDestroy(pTableData->aRowP); + taosArrayDestroy(pTableData->aRowP); + pTableData->aRowP = NULL; taosArrayDestroy(pVals); code = TSDB_CODE_OUT_OF_MEMORY; tqError("s-task:%s failed to prepare write stream res blocks, code:%s", id, tstrerror(code)); @@ -539,7 +541,8 @@ int32_t doConvertRows(SSubmitTbData* pTableData, const STSchema* pTSchema, SSDat if (ts < earlyTs) { tqError("s-task:%s ts:%" PRId64 " of generated results out of valid time range %" PRId64 " , discarded", id, ts, earlyTs); - pTableData->aRowP = taosArrayDestroy(pTableData->aRowP); + taosArrayDestroy(pTableData->aRowP); + pTableData->aRowP = NULL; taosArrayDestroy(pVals); return TSDB_CODE_SUCCESS; } diff --git a/source/dnode/vnode/src/tq/tqUtil.c b/source/dnode/vnode/src/tq/tqUtil.c index 5290c39d42..eb1da51b45 100644 --- a/source/dnode/vnode/src/tq/tqUtil.c +++ b/source/dnode/vnode/src/tq/tqUtil.c @@ -54,19 +54,23 @@ static int32_t tqInitTaosxRsp(SMqDataRspCommon* pRsp, STqOffsetVal pOffset) { if (pRsp->blockData == NULL || pRsp->blockDataLen == NULL || pRsp->blockTbName == NULL || pRsp->blockSchema == NULL) { if (pRsp->blockData != NULL) { - pRsp->blockData = taosArrayDestroy(pRsp->blockData); + taosArrayDestroy(pRsp->blockData); + pRsp->blockData = NULL; } if (pRsp->blockDataLen != NULL) { - pRsp->blockDataLen = taosArrayDestroy(pRsp->blockDataLen); + taosArrayDestroy(pRsp->blockDataLen); + pRsp->blockDataLen = NULL; } if (pRsp->blockTbName != NULL) { - pRsp->blockTbName = taosArrayDestroy(pRsp->blockTbName); + taosArrayDestroy(pRsp->blockTbName); + pRsp->blockTbName = NULL; } if (pRsp->blockSchema != NULL) { - pRsp->blockSchema = taosArrayDestroy(pRsp->blockSchema); + taosArrayDestroy(pRsp->blockSchema); + pRsp->blockSchema = NULL; } return -1; } diff --git a/source/dnode/vnode/src/tsdb/tsdbCache.c b/source/dnode/vnode/src/tsdb/tsdbCache.c index 4597a44845..ed09ca821b 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCache.c +++ b/source/dnode/vnode/src/tsdb/tsdbCache.c @@ -2579,7 +2579,7 @@ typedef struct { static int32_t lastIterOpen(SFSLastIter *iter, STFileSet *pFileSet, STsdb *pTsdb, STSchema *pTSchema, tb_uid_t suid, tb_uid_t uid, SCacheRowsReader *pr, int64_t lastTs, int16_t *aCols, int nCols) { int32_t code = 0; - pr->pLDataIterArray = destroySttBlockReader(pr->pLDataIterArray, NULL); + destroySttBlockReader(pr->pLDataIterArray, NULL); pr->pLDataIterArray = taosArrayInit(4, POINTER_BYTES); SMergeTreeConf conf = { @@ -3187,7 +3187,8 @@ static void clearLastFileSet(SFSNextRowIter *state) { int32_t iter = 0; while ((pe = tSimpleHashIterate(state->pr->pTableMap, pe, &iter)) != NULL) { STableLoadInfo *pInfo = *(STableLoadInfo **)pe; - pInfo->pTombData = taosArrayDestroy(pInfo->pTombData); + taosArrayDestroy(pInfo->pTombData); + pInfo->pTombData = NULL; } } } @@ -3211,7 +3212,10 @@ static int32_t nextRowIterOpen(CacheNextRowIter *pIter, tb_uid_t uid, STsdb *pTs pIter->pMemDelData = NULL; - loadMemTombData(&pIter->pMemDelData, pMem, pIMem, pr->info.verRange.maxVer); + code = loadMemTombData(&pIter->pMemDelData, pMem, pIMem, pr->info.verRange.maxVer); + if (code != TSDB_CODE_SUCCESS) { + goto _err; + } pIter->idx = (SBlockIdx){.suid = suid, .uid = uid}; diff --git a/source/dnode/vnode/src/tsdb/tsdbCacheRead.c b/source/dnode/vnode/src/tsdb/tsdbCacheRead.c index 4d6ebf721e..46c3ba4785 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCacheRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbCacheRead.c @@ -203,7 +203,7 @@ int32_t tsdbReuseCacherowsReader(void* reader, void* pTableIdList, int32_t numOf pReader->pTableList = pTableIdList; pReader->numOfTables = numOfTables; pReader->lastTs = INT64_MIN; - pReader->pLDataIterArray = destroySttBlockReader(pReader->pLDataIterArray, NULL); + destroySttBlockReader(pReader->pLDataIterArray, NULL); pReader->pLDataIterArray = taosArrayInit(4, POINTER_BYTES); return TSDB_CODE_SUCCESS; @@ -311,7 +311,8 @@ void* tsdbCacherowsReaderClose(void* pReader) { int32_t iter = 0; while ((pe = tSimpleHashIterate(p->pTableMap, pe, &iter)) != NULL) { STableLoadInfo* pInfo = *(STableLoadInfo**)pe; - pInfo->pTombData = taosArrayDestroy(pInfo->pTombData); + taosArrayDestroy(pInfo->pTombData); + pInfo->pTombData = NULL; } tSimpleHashCleanup(p->pTableMap); diff --git a/source/dnode/vnode/src/tsdb/tsdbMergeTree.c b/source/dnode/vnode/src/tsdb/tsdbMergeTree.c index 57b8a99fb1..2c03603d73 100644 --- a/source/dnode/vnode/src/tsdb/tsdbMergeTree.c +++ b/source/dnode/vnode/src/tsdb/tsdbMergeTree.c @@ -23,11 +23,12 @@ static void tLDataIterClose2(SLDataIter *pIter); // SLDataIter ================================================= -SSttBlockLoadInfo *tCreateSttBlockLoadInfo(STSchema *pSchema, int16_t *colList, int32_t numOfCols) { +int32_t tCreateSttBlockLoadInfo(STSchema *pSchema, int16_t *colList, int32_t numOfCols, SSttBlockLoadInfo **pInfo) { + *pInfo = NULL; + SSttBlockLoadInfo *pLoadInfo = taosMemoryCalloc(1, sizeof(SSttBlockLoadInfo)); if (pLoadInfo == NULL) { - terrno = TSDB_CODE_OUT_OF_MEMORY; - return NULL; + return TSDB_CODE_OUT_OF_MEMORY; } pLoadInfo->blockData[0].sttBlockIndex = -1; @@ -37,26 +38,29 @@ SSttBlockLoadInfo *tCreateSttBlockLoadInfo(STSchema *pSchema, int16_t *colList, int32_t code = tBlockDataCreate(&pLoadInfo->blockData[0].data); if (code) { - terrno = code; + taosMemoryFreeClear(pLoadInfo); + return code; } code = tBlockDataCreate(&pLoadInfo->blockData[1].data); if (code) { - terrno = code; + taosMemoryFreeClear(pLoadInfo); + return code; } pLoadInfo->aSttBlk = taosArrayInit(4, sizeof(SSttBlk)); if (pLoadInfo->aSttBlk == NULL) { - terrno = TSDB_CODE_OUT_OF_MEMORY; + code = TSDB_CODE_OUT_OF_MEMORY; taosMemoryFreeClear(pLoadInfo); - return NULL; + return code; } pLoadInfo->pSchema = pSchema; pLoadInfo->colIds = colList; pLoadInfo->numOfCols = numOfCols; - return pLoadInfo; + *pInfo = pLoadInfo; + return code; } static void freeItem(void* pValue) { @@ -66,9 +70,9 @@ static void freeItem(void* pValue) { } } -void *destroySttBlockLoadInfo(SSttBlockLoadInfo *pLoadInfo) { +void destroySttBlockLoadInfo(SSttBlockLoadInfo *pLoadInfo) { if (pLoadInfo == NULL) { - return NULL; + return; } pLoadInfo->currentLoadBlockIndex = 1; @@ -94,7 +98,6 @@ void *destroySttBlockLoadInfo(SSttBlockLoadInfo *pLoadInfo) { taosArrayDestroy(pLoadInfo->aSttBlk); taosMemoryFree(pLoadInfo); - return NULL; } void destroyLDataIter(SLDataIter *pIter) { @@ -103,9 +106,9 @@ void destroyLDataIter(SLDataIter *pIter) { taosMemoryFree(pIter); } -void *destroySttBlockReader(SArray *pLDataIterArray, SSttBlockLoadCostInfo *pLoadCost) { +void destroySttBlockReader(SArray *pLDataIterArray, SSttBlockLoadCostInfo *pLoadCost) { if (pLDataIterArray == NULL) { - return NULL; + return; } int32_t numOfLevel = taosArrayGetSize(pLDataIterArray); @@ -132,7 +135,6 @@ void *destroySttBlockReader(SArray *pLDataIterArray, SSttBlockLoadCostInfo *pLoa } taosArrayDestroy(pLDataIterArray); - return NULL; } // choose the unpinned slot to load next data block @@ -914,9 +916,8 @@ int32_t tMergeTreeOpen2(SMergeTree *pMTree, SMergeTreeConf *pConf, SSttDataInfoF } if (pLoadInfo == NULL) { - pLoadInfo = tCreateSttBlockLoadInfo(pConf->pSchema, pConf->pCols, pConf->numOfCols); - if (pLoadInfo == NULL) { - code = terrno; + code = tCreateSttBlockLoadInfo(pConf->pSchema, pConf->pCols, pConf->numOfCols, &pLoadInfo); + if (code != TSDB_CODE_SUCCESS) { goto _end; } } diff --git a/source/dnode/vnode/src/tsdb/tsdbRead2.c b/source/dnode/vnode/src/tsdb/tsdbRead2.c index 272c0762d8..cf2d23cfc8 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead2.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead2.c @@ -45,7 +45,7 @@ typedef struct { bool moreThanCapcity; } SDataBlockToLoadInfo; -static SFileDataBlockInfo* getCurrentBlockInfo(SDataBlockIter* pBlockIter); +static int32_t getCurrentBlockInfo(SDataBlockIter* pBlockIter, SFileDataBlockInfo** pInfo); static int32_t buildDataBlockFromBufImpl(STableBlockScanInfo* pBlockScanInfo, int64_t endKey, int32_t capacity, STsdbReader* pReader); static TSDBROW* getValidMemRow(SIterInfo* pIter, const SArray* pDelList, STsdbReader* pReader); @@ -123,7 +123,7 @@ static void tColRowGetPriamyKeyDeepCopy(SBlockData* pBlock, int32_t irow, int32_ pKey->pks[0].val = cv.value.val; } else { pKey->pks[0].nData = cv.value.nData; - memcpy(pKey->pks[0].pData, cv.value.pData, cv.value.nData); + (void)(void)memcpy(pKey->pks[0].pData, cv.value.pData, cv.value.nData); } } @@ -155,9 +155,9 @@ static void tRowGetPrimaryKeyDeepCopy(SRow* pRow, SRowKey* pKey) { if (IS_VAR_DATA_TYPE(indices[i].type)) { tdata += tGetU32v(tdata, &pKey->pks[i].nData); - memcpy(pKey->pks[i].pData, tdata, pKey->pks[i].nData); + (void)memcpy(pKey->pks[i].pData, tdata, pKey->pks[i].nData); } else { - memcpy(&pKey->pks[i].val, data + indices[i].offset, tDataTypes[pKey->pks[i].type].bytes); + (void)memcpy(&pKey->pks[i].val, data + indices[i].offset, tDataTypes[pKey->pks[i].type].bytes); } } } @@ -185,6 +185,10 @@ static int32_t setColumnIdSlotList(SBlockLoadSuppInfo* pSupInfo, SColumnInfo* pC if (IS_VAR_DATA_TYPE(pCols[i].type)) { pSupInfo->buildBuf[i] = taosMemoryMalloc(pCols[i].bytes); + if (pSupInfo->buildBuf[i] == NULL) { + tsdbError("failed to prepare memory for set columnId slot list, size:%d, code:out of memory", pCols[i].bytes); + return TSDB_CODE_OUT_OF_MEMORY; + } } else { pSupInfo->buildBuf[i] = NULL; } @@ -242,6 +246,7 @@ static int32_t initFilesetIterator(SFilesetIter* pIter, TFileSetArray* pFileSetA SBlockLoadSuppInfo* pInfo = &pReader->suppInfo; size_t numOfFileset = TARRAY2_SIZE(pFileSetArray); bool asc = ASCENDING_TRAVERSE(pReader->info.order); + int32_t code = TSDB_CODE_SUCCESS; pIter->index = asc ? -1 : numOfFileset; pIter->order = pReader->info.order; @@ -251,7 +256,7 @@ static int32_t initFilesetIterator(SFilesetIter* pIter, TFileSetArray* pFileSetA if (pIter->pSttBlockReader == NULL) { pIter->pSttBlockReader = taosMemoryCalloc(1, sizeof(struct SSttBlockReader)); if (pIter->pSttBlockReader == NULL) { - int32_t code = TSDB_CODE_OUT_OF_MEMORY; + code = TSDB_CODE_OUT_OF_MEMORY; tsdbError("failed to prepare the last block iterator, since:%s %s", tstrerror(code), pReader->idStr); return code; } @@ -265,10 +270,14 @@ static int32_t initFilesetIterator(SFilesetIter* pIter, TFileSetArray* pFileSetA pSttReader->uid = 0; tMergeTreeClose(&pSttReader->mergeTree); - initRowKey(&pSttReader->currentKey, INT64_MIN, pInfo->numOfPks, pInfo->pk.type, pInfo->pk.bytes, asc); + code = initRowKey(&pSttReader->currentKey, INT64_MIN, pInfo->numOfPks, pInfo->pk.type, pInfo->pk.bytes, asc); + if (code != TSDB_CODE_SUCCESS) { + tsdbError("failed init row key, %s", pReader->idStr); + } else { + tsdbDebug("init fileset iterator, total files:%d %s", pIter->numOfFiles, pReader->idStr); + } - tsdbDebug("init fileset iterator, total files:%d %s", pIter->numOfFiles, pReader->idStr); - return TSDB_CODE_SUCCESS; + return code; } static int32_t filesetIteratorNext(SFilesetIter* pIter, STsdbReader* pReader, bool* hasNext) { @@ -286,7 +295,8 @@ static int32_t filesetIteratorNext(SFilesetIter* pIter, STsdbReader* pReader, bo pIter->pSttBlockReader->uid = 0; tMergeTreeClose(&pIter->pSttBlockReader->mergeTree); - pReader->status.pLDataIterArray = destroySttBlockReader(pReader->status.pLDataIterArray, &pCost->sttCost); + destroySttBlockReader(pReader->status.pLDataIterArray, &pCost->sttCost); + pReader->status.pLDataIterArray = NULL; pReader->status.pLDataIterArray = taosArrayInit(4, POINTER_BYTES); // check file the time range of coverage @@ -294,7 +304,7 @@ static int32_t filesetIteratorNext(SFilesetIter* pIter, STsdbReader* pReader, bo while (1) { if (pReader->pFileReader != NULL) { - tsdbDataFileReaderClose(&pReader->pFileReader); + (void) tsdbDataFileReaderClose(&pReader->pFileReader); } pReader->status.pCurrentFileset = pIter->pFilesetList->data[pIter->index]; @@ -367,15 +377,20 @@ _err: bool shouldFreePkBuf(SBlockLoadSuppInfo* pSupp) { return (pSupp->numOfPks > 0) && IS_VAR_DATA_TYPE(pSupp->pk.type); } -void resetDataBlockIterator(SDataBlockIter* pIter, int32_t order, bool needFree) { +int32_t resetDataBlockIterator(SDataBlockIter* pIter, int32_t order, bool needFree) { pIter->order = order; pIter->index = -1; pIter->numOfBlocks = 0; if (pIter->blockList == NULL) { pIter->blockList = taosArrayInit(4, sizeof(SFileDataBlockInfo)); + if (pIter->blockList == NULL) { + return TSDB_CODE_OUT_OF_MEMORY; + } } else { clearDataBlockIterator(pIter, needFree); } + + return TSDB_CODE_SUCCESS; } static void initReaderStatus(SReaderStatus* pStatus) { @@ -383,75 +398,85 @@ static void initReaderStatus(SReaderStatus* pStatus) { pStatus->loadFromFile = true; } -static SSDataBlock* createResBlock(SQueryTableDataCond* pCond, int32_t capacity) { - SSDataBlock* pResBlock = createDataBlock(); - if (pResBlock == NULL) { - terrno = TSDB_CODE_OUT_OF_MEMORY; - return NULL; +static int32_t createResBlock(SQueryTableDataCond* pCond, int32_t capacity, SSDataBlock** pResBlock) { + *pResBlock = createDataBlock(); + if (*pResBlock == NULL) { + return TSDB_CODE_OUT_OF_MEMORY; } for (int32_t i = 0; i < pCond->numOfCols; ++i) { SColumnInfoData colInfo = {0}; colInfo.info = pCond->colList[i]; - blockDataAppendColInfo(pResBlock, &colInfo); + int32_t code = blockDataAppendColInfo(*pResBlock, &colInfo); + if (code != TSDB_CODE_SUCCESS) { + taosMemoryFree(*pResBlock); + *pResBlock = NULL; + return code; + } } - int32_t code = blockDataEnsureCapacity(pResBlock, capacity); + int32_t code = blockDataEnsureCapacity(*pResBlock, capacity); if (code != TSDB_CODE_SUCCESS) { - terrno = code; - taosMemoryFree(pResBlock); - return NULL; + taosMemoryFree(*pResBlock); + *pResBlock = NULL; } - return pResBlock; + + return code; } static int32_t tsdbInitReaderLock(STsdbReader* pReader) { int32_t code = taosThreadMutexInit(&pReader->readerMutex, NULL); - qTrace("tsdb/read: %p, post-init read mutex: %p, code: %d", pReader, &pReader->readerMutex, code); + tsdbTrace("tsdb/read: %p, post-init read mutex: %p, code: %d", pReader, &pReader->readerMutex, code); return code; } static int32_t tsdbUninitReaderLock(STsdbReader* pReader) { - int32_t code = -1; - qTrace("tsdb/read: %p, pre-uninit read mutex: %p, code: %d", pReader, &pReader->readerMutex, code); + int32_t code = TSDB_CODE_SUCCESS; + tsdbTrace("tsdb/read: %p, pre-uninit read mutex: %p, code: %d", pReader, &pReader->readerMutex, code); code = taosThreadMutexDestroy(&pReader->readerMutex); - qTrace("tsdb/read: %p, post-uninit read mutex: %p, code: %d", pReader, &pReader->readerMutex, code); + tsdbTrace("tsdb/read: %p, post-uninit read mutex: %p, code: %d", pReader, &pReader->readerMutex, code); return code; } static int32_t tsdbAcquireReader(STsdbReader* pReader) { int32_t code = -1; - qTrace("tsdb/read: %p, pre-take read mutex: %p, code: %d", pReader, &pReader->readerMutex, code); + tsdbTrace("tsdb/read: %p, pre-take read mutex: %p, code: %d", pReader, &pReader->readerMutex, code); code = taosThreadMutexLock(&pReader->readerMutex); - qTrace("tsdb/read: %p, post-take read mutex: %p, code: %d", pReader, &pReader->readerMutex, code); + tsdbTrace("tsdb/read: %p, post-take read mutex: %p, code: %d", pReader, &pReader->readerMutex, code); return code; } static int32_t tsdbTryAcquireReader(STsdbReader* pReader) { int32_t code = taosThreadMutexTryLock(&pReader->readerMutex); - qTrace("tsdb/read: %p, post-trytake read mutex: %p, code: %d", pReader, &pReader->readerMutex, code); - + if (code != TSDB_CODE_SUCCESS) { + tsdbError("tsdb/read: %p, post-trytake read mutex: %p, code: %d", pReader, &pReader->readerMutex, code); + } else { + tsdbTrace("tsdb/read: %p, post-trytask read mutex: %p", pReader, &pReader->readerMutex); + } return code; } static int32_t tsdbReleaseReader(STsdbReader* pReader) { int32_t code = taosThreadMutexUnlock(&pReader->readerMutex); - qTrace("tsdb/read: %p, post-untake read mutex: %p, code: %d", pReader, &pReader->readerMutex, code); - + if (code != TSDB_CODE_SUCCESS) { + tsdbError("tsdb/read: %p post-untake read mutex:%p failed, code:%d", pReader, &pReader->readerMutex, code); + } else { + tsdbTrace("tsdb/read: %p, post-untake read mutex: %p", pReader, &pReader->readerMutex); + } return code; } void tsdbReleaseDataBlock2(STsdbReader* pReader) { SReaderStatus* pStatus = &pReader->status; if (!pStatus->composedDataBlock) { - tsdbReleaseReader(pReader); + (void) tsdbReleaseReader(pReader); } } @@ -459,11 +484,16 @@ static int32_t initResBlockInfo(SResultBlockInfo* pResBlockInfo, int64_t capacit SQueryTableDataCond* pCond, SBlockLoadSuppInfo* pSup) { pResBlockInfo->capacity = capacity; pResBlockInfo->pResBlock = pResBlock; - terrno = 0; + int32_t code = 0; if (pResBlockInfo->pResBlock == NULL) { pResBlockInfo->freeBlock = true; - pResBlockInfo->pResBlock = createResBlock(pCond, pResBlockInfo->capacity); + pResBlockInfo->pResBlock = NULL; + + code = createResBlock(pCond, pResBlockInfo->capacity, &pResBlockInfo->pResBlock); + if (code != TSDB_CODE_SUCCESS) { + return code; + } if (pSup->numOfPks > 0) { SSDataBlock* p = pResBlockInfo->pResBlock; @@ -490,7 +520,7 @@ static int32_t initResBlockInfo(SResultBlockInfo* pResBlockInfo, int64_t capacit pResBlockInfo->freeBlock = false; } - return terrno; + return code; } static int32_t tsdbReaderCreate(SVnode* pVnode, SQueryTableDataCond* pCond, void** ppReader, int32_t capacity, @@ -530,7 +560,10 @@ static int32_t tsdbReaderCreate(SVnode* pVnode, SQueryTableDataCond* pCond, void // allocate buffer in order to load data blocks from file SBlockLoadSuppInfo* pSup = &pReader->suppInfo; pSup->tsColAgg.colId = PRIMARYKEY_TIMESTAMP_COL_ID; - setColumnIdSlotList(pSup, pCond->colList, pCond->pSlotList, pCond->numOfCols); + code = setColumnIdSlotList(pSup, pCond->colList, pCond->pSlotList, pCond->numOfCols); + if (code != TSDB_CODE_SUCCESS) { + goto _end; + } code = initResBlockInfo(&pReader->resBlockInfo, capacity, pResBlock, pCond, pSup); if (code != TSDB_CODE_SUCCESS) { @@ -558,8 +591,15 @@ static int32_t tsdbReaderCreate(SVnode* pVnode, SQueryTableDataCond* pCond, void goto _end; } - tsdbInitReaderLock(pReader); - tsem_init(&pReader->resumeAfterSuspend, 0, 0); + code = tsdbInitReaderLock(pReader); + if (code != TSDB_CODE_SUCCESS) { + goto _end; + } + + code = tsem_init(&pReader->resumeAfterSuspend, 0, 0); + if (code != TSDB_CODE_SUCCESS) { + goto _end; + } *ppReader = pReader; return code; @@ -630,7 +670,11 @@ static int32_t doLoadBlockIndex(STsdbReader* pReader, SDataFileReader* pFileRead break; } - taosArrayPush(pIndexList, pBrinBlk); + void* p1 = taosArrayPush(pIndexList, pBrinBlk); + if (p1 == NULL) { + return TSDB_CODE_OUT_OF_MEMORY; + } + i += 1; } @@ -661,7 +705,12 @@ static int32_t loadFileBlockBrinInfo(STsdbReader* pReader, SArray* pIndexList, S cleanupInfoForNextFileset(pReader->status.pTableMap); initBrinRecordIter(&iter, pReader->pFileReader, pIndexList); - while (((pRecord = getNextBrinRecord(&iter)) != NULL)) { + while (1) { + int32_t code = getNextBrinRecord(&iter, &pRecord); + if (code != TSDB_CODE_SUCCESS) { + break; + } + if (pRecord->suid > pReader->info.suid) { break; } @@ -689,7 +738,11 @@ static int32_t loadFileBlockBrinInfo(STsdbReader* pReader, SArray* pIndexList, S ASSERT(pRecord->suid == pReader->info.suid && uid == pRecord->uid); - STableBlockScanInfo* pScanInfo = getTableBlockScanInfo(pReader->status.pTableMap, uid, pReader->idStr); + STableBlockScanInfo* pScanInfo = NULL; + code = getTableBlockScanInfo(pReader->status.pTableMap, uid, &pScanInfo, pReader->idStr); + if (code != TSDB_CODE_SUCCESS) { + return code; + } // here we should find the first timestamp that is greater than the lastProcKey // the window is an open interval NOW. @@ -761,13 +814,17 @@ static int32_t loadFileBlockBrinInfo(STsdbReader* pReader, SArray* pIndexList, S pBlockNum->numOfBlocks += 1; if (taosArrayGetSize(pTableScanInfoList) == 0) { - taosArrayPush(pTableScanInfoList, &pScanInfo); + p1 = taosArrayPush(pTableScanInfoList, &pScanInfo); } else { STableBlockScanInfo** p = taosArrayGetLast(pTableScanInfoList); if ((*p)->uid != uid) { - taosArrayPush(pTableScanInfoList, &pScanInfo); + p1 = taosArrayPush(pTableScanInfoList, &pScanInfo); } } + + if (p1 == NULL) { + return TSDB_CODE_OUT_OF_MEMORY; + } } clearBrinBlockIter(&iter); @@ -805,12 +862,14 @@ static void updateLastKeyInfo(SRowKey* pKey, SFileDataBlockInfo* pBlockInfo, SDa } else { uint8_t* p = asc ? pBlockInfo->lastPk.pData : pBlockInfo->firstPk.pData; pKey->pks[0].nData = asc ? varDataLen(pBlockInfo->lastPk.pData) : varDataLen(pBlockInfo->firstPk.pData); - memcpy(pKey->pks[0].pData, p, pKey->pks[0].nData); + (void)memcpy(pKey->pks[0].pData, p, pKey->pks[0].nData); } } static int32_t doCopyColVal(SColumnInfoData* pColInfoData, int32_t rowIndex, int32_t colIndex, SColVal* pColVal, SBlockLoadSuppInfo* pSup) { + int32_t code = 0; + if (IS_VAR_DATA_TYPE(pColVal->value.type)) { if (!COL_VAL_IS_VALUE(pColVal)) { colDataSetNULL(pColInfoData, rowIndex); @@ -823,31 +882,33 @@ static int32_t doCopyColVal(SColumnInfoData* pColInfoData, int32_t rowIndex, int } if (pColVal->value.nData > 0) { // pData may be null, if nData is 0 - memcpy(varDataVal(pSup->buildBuf[colIndex]), pColVal->value.pData, pColVal->value.nData); + (void)memcpy(varDataVal(pSup->buildBuf[colIndex]), pColVal->value.pData, pColVal->value.nData); } - colDataSetVal(pColInfoData, rowIndex, pSup->buildBuf[colIndex], false); + code = colDataSetVal(pColInfoData, rowIndex, pSup->buildBuf[colIndex], false); } } else { - colDataSetVal(pColInfoData, rowIndex, (const char*)&pColVal->value.val, !COL_VAL_IS_VALUE(pColVal)); + code = colDataSetVal(pColInfoData, rowIndex, (const char*)&pColVal->value.val, !COL_VAL_IS_VALUE(pColVal)); } - return TSDB_CODE_SUCCESS; + return code; } -static SFileDataBlockInfo* getCurrentBlockInfo(SDataBlockIter* pBlockIter) { +static int32_t getCurrentBlockInfo(SDataBlockIter* pBlockIter, SFileDataBlockInfo** pInfo) { + *pInfo = NULL; + if (pBlockIter->blockList == NULL) { - return NULL; + return TSDB_CODE_FAILED; } size_t num = TARRAY_SIZE(pBlockIter->blockList); if (num == 0) { ASSERT(pBlockIter->numOfBlocks == num); - return NULL; + return TSDB_CODE_FAILED; } - SFileDataBlockInfo* pBlockInfo = taosArrayGet(pBlockIter->blockList, pBlockIter->index); - return pBlockInfo; + *pInfo = taosArrayGet(pBlockIter->blockList, pBlockIter->index); + return (*pInfo) != NULL? TSDB_CODE_SUCCESS:TSDB_CODE_FAILED; } static int doBinarySearchKey(const TSKEY* keyList, int num, int pos, TSKEY key, int order) { @@ -961,10 +1022,10 @@ static int32_t getEndPosInDataBlock(STsdbReader* pReader, SBlockData* pBlockData static void copyPrimaryTsCol(const SBlockData* pBlockData, SFileBlockDumpInfo* pDumpInfo, SColumnInfoData* pColData, int32_t dumpedRows, bool asc) { if (asc) { - memcpy(pColData->pData, &pBlockData->aTSKEY[pDumpInfo->rowIndex], dumpedRows * sizeof(int64_t)); + (void)memcpy(pColData->pData, &pBlockData->aTSKEY[pDumpInfo->rowIndex], dumpedRows * sizeof(int64_t)); } else { int32_t startIndex = pDumpInfo->rowIndex - dumpedRows + 1; - memcpy(pColData->pData, &pBlockData->aTSKEY[startIndex], dumpedRows * sizeof(int64_t)); + (void)memcpy(pColData->pData, &pBlockData->aTSKEY[startIndex], dumpedRows * sizeof(int64_t)); // todo: opt perf by extract the loop // reverse the array list @@ -995,7 +1056,7 @@ static void copyNumericCols(const SColData* pData, SFileBlockDumpInfo* pDumpInfo // ASSERT((((uint64_t)pColData->pData) & (0x8 - 1)) == 0); // 1. copy data in a batch model - memcpy(pColData->pData, p, dumpedRows * tDataTypes[pData->type].bytes); + (void)memcpy(pColData->pData, p, dumpedRows * tDataTypes[pData->type].bytes); // 2. reverse the array list in case of descending order scan data block if (!asc) { @@ -1110,7 +1171,7 @@ static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader, SRowKey* pLastPro SFileBlockDumpInfo* pDumpInfo = &pReader->status.fBlockDumpInfo; SBlockData* pBlockData = &pStatus->fileBlockData; - SFileDataBlockInfo* pBlockInfo = getCurrentBlockInfo(pBlockIter); + SFileDataBlockInfo* pBlockInfo = NULL; SSDataBlock* pResBlock = pReader->resBlockInfo.pResBlock; int32_t numOfOutputCols = pSupInfo->numOfCols; int32_t code = TSDB_CODE_SUCCESS; @@ -1118,6 +1179,11 @@ static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader, SRowKey* pLastPro bool asc = ASCENDING_TRAVERSE(pReader->info.order); int32_t step = asc ? 1 : -1; + code = getCurrentBlockInfo(pBlockIter, &pBlockInfo); + if (code != TSDB_CODE_SUCCESS) { + return code; + } + SColVal cv = {0}; SBrinRecord tmp; blockInfoToRecord(&tmp, pBlockInfo, pSupInfo); @@ -1301,9 +1367,11 @@ static FORCE_INLINE STSchema* getTableSchemaImpl(STsdbReader* pReader, uint64_t static int32_t doLoadFileBlockData(STsdbReader* pReader, SDataBlockIter* pBlockIter, SBlockData* pBlockData, uint64_t uid) { - int32_t code = 0; - STSchema* pSchema = pReader->info.pSchema; - int64_t st = taosGetTimestampUs(); + int32_t code = 0; + STSchema* pSchema = pReader->info.pSchema; + int64_t st = taosGetTimestampUs(); + SFileDataBlockInfo* pBlockInfo = NULL; + SBlockLoadSuppInfo* pSup = &pReader->suppInfo; tBlockDataReset(pBlockData); @@ -1315,8 +1383,11 @@ static int32_t doLoadFileBlockData(STsdbReader* pReader, SDataBlockIter* pBlockI } } - SBlockLoadSuppInfo* pSup = &pReader->suppInfo; - SFileDataBlockInfo* pBlockInfo = getCurrentBlockInfo(pBlockIter); + code = getCurrentBlockInfo(pBlockIter, &pBlockInfo); + if (code != TSDB_CODE_SUCCESS) { + return code; + } + SFileBlockDumpInfo* pDumpInfo = &pReader->status.fBlockDumpInfo; SBrinRecord tmp; @@ -1379,8 +1450,9 @@ static bool getNeighborBlockOfTable(SDataBlockIter* pBlockIter, SFileDataBlockIn static int32_t setFileBlockActiveInBlockIter(STsdbReader* pReader, SDataBlockIter* pBlockIter, int32_t index, int32_t step) { + int32_t code = TSDB_CODE_SUCCESS; if (index < 0 || index >= pBlockIter->numOfBlocks) { - return -1; + return TSDB_CODE_FAILED; } SFileDataBlockInfo fblock = *(SFileDataBlockInfo*)taosArrayGet(pBlockIter->blockList, index); @@ -1391,8 +1463,12 @@ static int32_t setFileBlockActiveInBlockIter(STsdbReader* pReader, SDataBlockIte for (int32_t i = index - 1; i >= pBlockIter->index; --i) { SFileDataBlockInfo* pBlockInfo = taosArrayGet(pBlockIter->blockList, i); - STableBlockScanInfo* pBlockScanInfo = - getTableBlockScanInfo(pReader->status.pTableMap, pBlockInfo->uid, pReader->idStr); + STableBlockScanInfo* pBlockScanInfo = NULL; + code = getTableBlockScanInfo(pReader->status.pTableMap, pBlockInfo->uid, &pBlockScanInfo, pReader->idStr); + if (code != TSDB_CODE_SUCCESS) { + return code; + } + STableDataBlockIdx* pTableDataBlockIdx = taosArrayGet(pBlockScanInfo->pBlockIdxList, pBlockInfo->tbBlockIdx); pTableDataBlockIdx->globalIndex = i + 1; @@ -1402,8 +1478,12 @@ static int32_t setFileBlockActiveInBlockIter(STsdbReader* pReader, SDataBlockIte for (int32_t i = index + 1; i <= pBlockIter->index; ++i) { SFileDataBlockInfo* pBlockInfo = taosArrayGet(pBlockIter->blockList, i); - STableBlockScanInfo* pBlockScanInfo = - getTableBlockScanInfo(pReader->status.pTableMap, pBlockInfo->uid, pReader->idStr); + STableBlockScanInfo* pBlockScanInfo = NULL; + code = getTableBlockScanInfo(pReader->status.pTableMap, pBlockInfo->uid, &pBlockScanInfo, pReader->idStr); + if (code != TSDB_CODE_SUCCESS) { + return code; + } + STableDataBlockIdx* pTableDataBlockIdx = taosArrayGet(pBlockScanInfo->pBlockIdxList, pBlockInfo->tbBlockIdx); pTableDataBlockIdx->globalIndex = i - 1; @@ -1412,7 +1492,12 @@ static int32_t setFileBlockActiveInBlockIter(STsdbReader* pReader, SDataBlockIte } taosArraySet(pBlockIter->blockList, pBlockIter->index, &fblock); - STableBlockScanInfo* pBlockScanInfo = getTableBlockScanInfo(pReader->status.pTableMap, fblock.uid, pReader->idStr); + STableBlockScanInfo* pBlockScanInfo = NULL; + code = getTableBlockScanInfo(pReader->status.pTableMap, fblock.uid, &pBlockScanInfo, pReader->idStr); + if (code != TSDB_CODE_SUCCESS) { + return code; + } + STableDataBlockIdx* pTableDataBlockIdx = taosArrayGet(pBlockScanInfo->pBlockIdxList, fblock.tbBlockIdx); pTableDataBlockIdx->globalIndex = pBlockIter->index; } @@ -1759,7 +1844,10 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo* if (ps == NULL) { return terrno; } - tsdbRowMergerInit(pMerger, ps); + int32_t code = tsdbRowMergerInit(pMerger, ps); + if (code != TSDB_CODE_SUCCESS) { + return code; + } } SRowKey minKey = k; @@ -1792,7 +1880,10 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo* return code; } - doMergeRowsInFileBlocks(pBlockData, pBlockScanInfo, pfKey, pReader); + code = doMergeRowsInFileBlocks(pBlockData, pBlockScanInfo, pfKey, pReader); + if (code != TSDB_CODE_SUCCESS) { + return code; + } } if (pkCompEx(&minKey, pSttKey) == 0) { @@ -1801,7 +1892,10 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo* if (code != TSDB_CODE_SUCCESS) { return code; } - doMergeRowsInSttBlock(pSttBlockReader, pBlockScanInfo, pMerger, pkSrcSlot, &pReader->info.verRange, pReader->idStr); + code = doMergeRowsInSttBlock(pSttBlockReader, pBlockScanInfo, pMerger, pkSrcSlot, &pReader->info.verRange, pReader->idStr); + if (code != TSDB_CODE_SUCCESS) { + return code; + } } if (pkCompEx(&minKey, &k) == 0) { @@ -1843,7 +1937,10 @@ static int32_t mergeFileBlockAndSttBlock(STsdbReader* pReader, SSttBlockReader* if (ps == NULL) { return terrno; } - tsdbRowMergerInit(pMerger, ps); + code = tsdbRowMergerInit(pMerger, ps); + if (code != TSDB_CODE_SUCCESS) { + return code; + } } bool dataInDataFile = hasDataInFileBlock(pBlockData, pDumpInfo); @@ -1890,7 +1987,10 @@ static int32_t mergeFileBlockAndSttBlock(STsdbReader* pReader, SSttBlockReader* return code; } - doMergeRowsInFileBlocks(pBlockData, pBlockScanInfo, pKey, pReader); + code = doMergeRowsInFileBlocks(pBlockData, pBlockScanInfo, pKey, pReader); + if (code != TSDB_CODE_SUCCESS) { + return code; + } TSDBROW* pRow1 = tMergeTreeGetRow(&pSttBlockReader->mergeTree); code = tsdbRowMergerAdd(pMerger, pRow1, NULL); @@ -1899,7 +1999,10 @@ static int32_t mergeFileBlockAndSttBlock(STsdbReader* pReader, SSttBlockReader* } // pSttKey will be changed when sttBlockReader iterates to the next row, so use pKey instead. - doMergeRowsInSttBlock(pSttBlockReader, pBlockScanInfo, pMerger, pkSrcSlot, &pReader->info.verRange, pReader->idStr); + code = doMergeRowsInSttBlock(pSttBlockReader, pBlockScanInfo, pMerger, pkSrcSlot, &pReader->info.verRange, pReader->idStr); + if (code != TSDB_CODE_SUCCESS) { + return code; + } code = tsdbRowMergerGetRow(pMerger, &pTSRow); if (code != TSDB_CODE_SUCCESS) { @@ -1965,7 +2068,11 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo* if (ps == NULL) { return terrno; } - tsdbRowMergerInit(pMerger, ps); + + code = tsdbRowMergerInit(pMerger, ps); + if (code != TSDB_CODE_SUCCESS) { + return code; + } } SRowKey minKey = k; @@ -2005,7 +2112,10 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo* return code; } - doMergeRowsInFileBlocks(pBlockData, pBlockScanInfo, pfKey, pReader); + code = doMergeRowsInFileBlocks(pBlockData, pBlockScanInfo, pfKey, pReader); + if (code != TSDB_CODE_SUCCESS) { + return code; + } } if (pkCompEx(&minKey, pSttKey) == 0) { @@ -2015,7 +2125,10 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo* return code; } - doMergeRowsInSttBlock(pSttBlockReader, pBlockScanInfo, pMerger, pkSrcSlot, &pReader->info.verRange, pReader->idStr); + code = doMergeRowsInSttBlock(pSttBlockReader, pBlockScanInfo, pMerger, pkSrcSlot, &pReader->info.verRange, pReader->idStr); + if (code != TSDB_CODE_SUCCESS) { + return code; + } } if (pkCompEx(&minKey, &ik) == 0) { @@ -2106,10 +2219,9 @@ static void doForwardDataIter(SRowKey* pKey, SIterInfo* pIter, STableBlockScanIn } // handle the open interval issue. Find the first row key that is greater than the given one. -static int32_t forwardDataIter(SRowKey* pKey, STableBlockScanInfo* pBlockScanInfo, STsdbReader* pReader) { +static void forwardDataIter(SRowKey* pKey, STableBlockScanInfo* pBlockScanInfo, STsdbReader* pReader) { doForwardDataIter(pKey, &pBlockScanInfo->iter, pBlockScanInfo, pReader); doForwardDataIter(pKey, &pBlockScanInfo->iiter, pBlockScanInfo, pReader); - return TSDB_CODE_SUCCESS; } static int32_t initMemDataIterator(STableBlockScanInfo* pBlockScanInfo, STsdbReader* pReader) { @@ -2142,7 +2254,10 @@ static int32_t initMemDataIterator(STableBlockScanInfo* pBlockScanInfo, STsdbRea return code; } - loadMemTombData(&pBlockScanInfo->pMemDelData, d, di, pReader->info.verRange.maxVer); + code = loadMemTombData(&pBlockScanInfo->pMemDelData, d, di, pReader->info.verRange.maxVer); + if (code != TSDB_CODE_SUCCESS) { + return code; + } if (forward) { forwardDataIter(&startKey.key, pBlockScanInfo, pReader); @@ -2255,8 +2370,15 @@ static bool initSttBlockReader(SSttBlockReader* pSttBlockReader, STableBlockScan return false; } - initMemDataIterator(pScanInfo, pReader); - initDelSkylineIterator(pScanInfo, pReader->info.order, &pReader->cost); + code = initMemDataIterator(pScanInfo, pReader); + if (code != TSDB_CODE_SUCCESS) { + return false; + } + + code = initDelSkylineIterator(pScanInfo, pReader->info.order, &pReader->cost); + if (code != TSDB_CODE_SUCCESS) { + return code; + } if (conf.rspRows) { pScanInfo->cleanSttBlocks = isCleanSttBlock(info.pKeyRangeList, &pReader->info.window, pScanInfo, order); @@ -2329,7 +2451,11 @@ int32_t mergeRowsInFileBlocks(SBlockData* pBlockData, STableBlockScanInfo* pBloc if (ps == NULL) { return terrno; } - tsdbRowMergerInit(pMerger, ps); + + code = tsdbRowMergerInit(pMerger, ps); + if (code != TSDB_CODE_SUCCESS) { + return code; + } } tRowKeyAssign(&pBlockScanInfo->lastProcKey, pKey); @@ -2345,7 +2471,11 @@ int32_t mergeRowsInFileBlocks(SBlockData* pBlockData, STableBlockScanInfo* pBloc return code; } - doMergeRowsInFileBlocks(pBlockData, pBlockScanInfo, pKey, pReader); + code = doMergeRowsInFileBlocks(pBlockData, pBlockScanInfo, pKey, pReader); + if (code != TSDB_CODE_SUCCESS) { + return code; + } + code = tsdbRowMergerGetRow(pMerger, &pTSRow); if (code != TSDB_CODE_SUCCESS) { return code; @@ -2392,8 +2522,16 @@ int32_t mergeRowsInSttBlocks(SSttBlockReader* pSttBlockReader, STableBlockScanIn } TSDBROW* pRow1 = tMergeTreeGetRow(&pSttBlockReader->mergeTree); - tsdbRowMergerAdd(pMerger, pRow1, NULL); - doMergeRowsInSttBlock(pSttBlockReader, pScanInfo, pMerger, pkSrcSlot, &pReader->info.verRange, pReader->idStr); + code = tsdbRowMergerAdd(pMerger, pRow1, NULL); + if (code != TSDB_CODE_SUCCESS) { + return code; + } + + code = doMergeRowsInSttBlock(pSttBlockReader, pScanInfo, pMerger, pkSrcSlot, &pReader->info.verRange, pReader->idStr); + if (code != TSDB_CODE_SUCCESS) { + return code; + } + code = tsdbRowMergerGetRow(pMerger, &pTSRow); if (code != TSDB_CODE_SUCCESS) { return code; @@ -2473,7 +2611,10 @@ static int32_t loadNeighborIfOverlap(SFileDataBlockInfo* pBlockInfo, STableBlock // 2. remove it from the scan block list int32_t neighborIndex = tableDataBlockIdx->globalIndex; - setFileBlockActiveInBlockIter(pReader, pBlockIter, neighborIndex, step); + code = setFileBlockActiveInBlockIter(pReader, pBlockIter, neighborIndex, step); + if (code != TSDB_CODE_SUCCESS) { + return code; + } // 3. load the neighbor block, and set it to be the currently accessed file data block code = doLoadFileBlockData(pReader, pBlockIter, &pStatus->fileBlockData, pBlockInfo->uid); @@ -2496,8 +2637,8 @@ void updateComposedBlockInfo(STsdbReader* pReader, double el, STableBlockScanInf pResBlock->info.dataLoad = 1; pResBlock->info.version = pReader->info.verRange.maxVer; - blockDataUpdateTsWindow(pResBlock, pReader->suppInfo.slotId[0]); - blockDataUpdatePkRange(pResBlock, pReader->suppInfo.pkDstSlot, ASCENDING_TRAVERSE(pReader->info.order)); + int32_t code = blockDataUpdateTsWindow(pResBlock, pReader->suppInfo.slotId[0]); + code = blockDataUpdatePkRange(pResBlock, pReader->suppInfo.pkDstSlot, ASCENDING_TRAVERSE(pReader->info.order)); setComposedBlockFlag(pReader, true); pReader->cost.composedBlocks += 1; @@ -2511,11 +2652,12 @@ static int32_t buildComposedDataBlock(STsdbReader* pReader) { int32_t step = asc ? 1 : -1; double el = 0; SSDataBlock* pResBlock = pReader->resBlockInfo.pResBlock; - SFileDataBlockInfo* pBlockInfo = getCurrentBlockInfo(&pReader->status.blockIter); + SFileDataBlockInfo* pBlockInfo = NULL; SSttBlockReader* pSttBlockReader = pReader->status.fileIter.pSttBlockReader; SFileBlockDumpInfo* pDumpInfo = &pReader->status.fBlockDumpInfo; - if (pBlockInfo == NULL) { + code = getCurrentBlockInfo(&pReader->status.blockIter, &pBlockInfo); + if (code != TSDB_CODE_SUCCESS) { return 0; } @@ -2524,9 +2666,9 @@ static int32_t buildComposedDataBlock(STsdbReader* pReader) { return code; } - STableBlockScanInfo* pBlockScanInfo = - getTableBlockScanInfo(pReader->status.pTableMap, pBlockInfo->uid, pReader->idStr); - if (pBlockScanInfo == NULL) { + STableBlockScanInfo* pBlockScanInfo = NULL; + code = getTableBlockScanInfo(pReader->status.pTableMap, pBlockInfo->uid, &pBlockScanInfo, pReader->idStr); + if (code != TSDB_CODE_SUCCESS) { goto _end; } @@ -2544,7 +2686,7 @@ static int32_t buildComposedDataBlock(STsdbReader* pReader) { } SBlockData* pBlockData = &pReader->status.fileBlockData; - initSttBlockReader(pSttBlockReader, pBlockScanInfo, pReader); + (void) initSttBlockReader(pSttBlockReader, pBlockScanInfo, pReader); while (1) { bool hasBlockData = false; @@ -2559,7 +2701,10 @@ static int32_t buildComposedDataBlock(STsdbReader* pReader) { pDumpInfo->rowIndex += step; if (pDumpInfo->rowIndex >= pBlockData->nRow || pDumpInfo->rowIndex < 0) { - pBlockInfo = getCurrentBlockInfo(&pReader->status.blockIter); // NOTE: get the new block info + code = getCurrentBlockInfo(&pReader->status.blockIter, &pBlockInfo); // NOTE: get the new block info + if (code != TSDB_CODE_SUCCESS) { + goto _end; + } // continue check for the next file block if the last ts in the current block // is overlapped with the next neighbor block @@ -2638,7 +2783,10 @@ int32_t initDelSkylineIterator(STableBlockScanInfo* pBlockScanInfo, int32_t orde if (pSource == NULL) { pSource = pBlockScanInfo->pMemDelData; } else { - taosArrayAddAll(pSource, pBlockScanInfo->pMemDelData); + void* p1 = taosArrayAddAll(pSource, pBlockScanInfo->pMemDelData); + if (p1 == NULL) { + return TSDB_CODE_OUT_OF_MEMORY; + } } code = tsdbBuildDeleteSkyline(pSource, 0, taosArrayGetSize(pSource) - 1, pBlockScanInfo->delSkyline); @@ -2736,6 +2884,9 @@ static int32_t moveToNextFile(STsdbReader* pReader, SBlockNumber* pBlockNum, SAr size_t numOfTables = tSimpleHashGetSize(pReader->status.pTableMap); SArray* pIndexList = taosArrayInit(numOfTables, sizeof(SBrinBlk)); + if (pIndexList == NULL) { + return TSDB_CODE_OUT_OF_MEMORY; + } while (1) { // only check here, since the iterate data in memory is very fast. @@ -2784,6 +2935,7 @@ static int32_t moveToNextFile(STsdbReader* pReader, SBlockNumber* pBlockNum, SAr return loadDataFileTombDataForAll(pReader); } +// pTableIter can be NULL, no need to handle the return value static void resetTableListIndex(SReaderStatus* pStatus) { STableUidList* pList = &pStatus->uidList; @@ -2825,7 +2977,7 @@ static bool moveToNextTableForPreFileSetMem(SReaderStatus* pStatus) { return (pStatus->pProcMemTableIter != NULL); } -static void buildCleanBlockFromSttFiles(STsdbReader* pReader, STableBlockScanInfo* pScanInfo) { +static int32_t buildCleanBlockFromSttFiles(STsdbReader* pReader, STableBlockScanInfo* pScanInfo) { SReaderStatus* pStatus = &pReader->status; SSttBlockReader* pSttBlockReader = pStatus->fileIter.pSttBlockReader; SSDataBlock* pResBlock = pReader->resBlockInfo.pResBlock; @@ -2833,7 +2985,10 @@ static void buildCleanBlockFromSttFiles(STsdbReader* pReader, STableBlockScanInf bool asc = ASCENDING_TRAVERSE(pReader->info.order); SDataBlockInfo* pInfo = &pResBlock->info; - blockDataEnsureCapacity(pResBlock, pScanInfo->numOfRowsInStt); + int32_t code = blockDataEnsureCapacity(pResBlock, pScanInfo->numOfRowsInStt); + if (code != TSDB_CODE_SUCCESS) { + return code; + } pInfo->rows = pScanInfo->numOfRowsInStt; pInfo->id.uid = pScanInfo->uid; @@ -2858,6 +3013,7 @@ static void buildCleanBlockFromSttFiles(STsdbReader* pReader, STableBlockScanInf tsdbDebug("%p uid:%" PRId64 " return clean stt block as one, brange:%" PRId64 "-%" PRId64 " rows:%" PRId64 " %s", pReader, pResBlock->info.id.uid, pResBlock->info.window.skey, pResBlock->info.window.ekey, pResBlock->info.rows, pReader->idStr); + return code; } static void buildCleanBlockFromDataFiles(STsdbReader* pReader, STableBlockScanInfo* pScanInfo, @@ -2878,8 +3034,8 @@ static void buildCleanBlockFromDataFiles(STsdbReader* pReader, STableBlockScanIn pInfo->pks[0].val = pBlockInfo->firstPk.val; pInfo->pks[1].val = pBlockInfo->lastPk.val; } else { - memcpy(pInfo->pks[0].pData, varDataVal(pBlockInfo->firstPk.pData), varDataLen(pBlockInfo->firstPk.pData)); - memcpy(pInfo->pks[1].pData, varDataVal(pBlockInfo->lastPk.pData), varDataLen(pBlockInfo->lastPk.pData)); + (void)memcpy(pInfo->pks[0].pData, varDataVal(pBlockInfo->firstPk.pData), varDataLen(pBlockInfo->firstPk.pData)); + (void)memcpy(pInfo->pks[1].pData, varDataVal(pBlockInfo->lastPk.pData), varDataLen(pBlockInfo->lastPk.pData)); pInfo->pks[0].nData = varDataLen(pBlockInfo->firstPk.pData); pInfo->pks[1].nData = varDataLen(pBlockInfo->lastPk.pData); @@ -2950,8 +3106,8 @@ static int32_t doLoadSttBlockSequentially(STsdbReader* pReader) { // if only require the total rows, no need to load data from stt file if it is clean stt blocks if (pReader->info.execMode == READER_EXEC_ROWS && pScanInfo->cleanSttBlocks) { - buildCleanBlockFromSttFiles(pReader, pScanInfo); - return TSDB_CODE_SUCCESS; + code = buildCleanBlockFromSttFiles(pReader, pScanInfo); + return code; } int64_t st = taosGetTimestampUs(); @@ -3006,11 +3162,16 @@ static int32_t doBuildDataBlock(STsdbReader* pReader) { SReaderStatus* pStatus = &pReader->status; SDataBlockIter* pBlockIter = &pStatus->blockIter; STableBlockScanInfo* pScanInfo = NULL; - SFileDataBlockInfo* pBlockInfo = getCurrentBlockInfo(pBlockIter); + SFileDataBlockInfo* pBlockInfo = NULL; SSttBlockReader* pSttBlockReader = pReader->status.fileIter.pSttBlockReader; bool asc = ASCENDING_TRAVERSE(pReader->info.order); int32_t code = TSDB_CODE_SUCCESS; + code = getCurrentBlockInfo(pBlockIter, &pBlockInfo); + if (code != TSDB_CODE_SUCCESS) { + return code; + } + if (pReader->pIgnoreTables && taosHashGet(*pReader->pIgnoreTables, &pBlockInfo->uid, sizeof(pBlockInfo->uid))) { setBlockAllDumped(&pStatus->fBlockDumpInfo, pBlockInfo->lastKey, pReader->info.order); return code; @@ -3020,13 +3181,13 @@ static int32_t doBuildDataBlock(STsdbReader* pReader) { return pReader->code; } - pScanInfo = getTableBlockScanInfo(pReader->status.pTableMap, pBlockInfo->uid, pReader->idStr); - if (pScanInfo == NULL) { - return terrno; + code = getTableBlockScanInfo(pReader->status.pTableMap, pBlockInfo->uid, &pScanInfo, pReader->idStr); + if (code != TSDB_CODE_SUCCESS) { + return code; } if (pScanInfo->sttKeyInfo.status == STT_FILE_READER_UNINIT) { - initSttBlockReader(pSttBlockReader, pScanInfo, pReader); + (void) initSttBlockReader(pSttBlockReader, pScanInfo, pReader); } TSDBKEY keyInBuf = getCurrentKeyInBuf(pScanInfo, pReader); @@ -3067,8 +3228,8 @@ static int32_t doBuildDataBlock(STsdbReader* pReader) { // return the stt file block ASSERT(pReader->info.execMode == READER_EXEC_ROWS && pSttBlockReader->mergeTree.pIter == NULL); - buildCleanBlockFromSttFiles(pReader, pScanInfo); - return TSDB_CODE_SUCCESS; + code = buildCleanBlockFromSttFiles(pReader, pScanInfo); + return code; } } else { SBlockData* pBData = &pReader->status.fileBlockData; @@ -3080,7 +3241,7 @@ static int32_t doBuildDataBlock(STsdbReader* pReader) { int64_t st = taosGetTimestampUs(); // let's load data from stt files, make sure clear the cleanStt block flag before load the data from stt files - initSttBlockReader(pSttBlockReader, pScanInfo, pReader); + (void) initSttBlockReader(pSttBlockReader, pScanInfo, pReader); // no data in stt block, no need to proceed. while (hasDataInSttBlock(pScanInfo)) { @@ -3141,10 +3302,17 @@ static int32_t buildBlockFromBufferSeqForPreFileset(STsdbReader* pReader, int64_ continue; } - initMemDataIterator(*pBlockScanInfo, pReader); - initDelSkylineIterator(*pBlockScanInfo, pReader->info.order, &pReader->cost); + int32_t code = initMemDataIterator(*pBlockScanInfo, pReader); + if (code != TSDB_CODE_SUCCESS) { + return code; + } - int32_t code = buildDataBlockFromBuf(pReader, *pBlockScanInfo, endKey); + code = initDelSkylineIterator(*pBlockScanInfo, pReader->info.order, &pReader->cost); + if (code != TSDB_CODE_SUCCESS) { + return code; + } + + code = buildDataBlockFromBuf(pReader, *pBlockScanInfo, endKey); if (code != TSDB_CODE_SUCCESS) { return code; } @@ -3183,10 +3351,17 @@ static int32_t buildBlockFromBufferSequentially(STsdbReader* pReader, int64_t en continue; } - initMemDataIterator(*pBlockScanInfo, pReader); - initDelSkylineIterator(*pBlockScanInfo, pReader->info.order, &pReader->cost); + int32_t code = initMemDataIterator(*pBlockScanInfo, pReader); + if (code != TSDB_CODE_SUCCESS) { + return code; + } - int32_t code = buildDataBlockFromBuf(pReader, *pBlockScanInfo, endKey); + code = initDelSkylineIterator(*pBlockScanInfo, pReader->info.order, &pReader->cost); + if (code != TSDB_CODE_SUCCESS) { + return code; + } + + code = buildDataBlockFromBuf(pReader, *pBlockScanInfo, endKey); if (code != TSDB_CODE_SUCCESS) { return code; } @@ -3205,12 +3380,12 @@ static int32_t buildBlockFromBufferSequentially(STsdbReader* pReader, int64_t en // set the correct start position in case of the first/last file block, according to the query time window static void initBlockDumpInfo(STsdbReader* pReader, SDataBlockIter* pBlockIter) { - int64_t lastKey = ASCENDING_TRAVERSE(pReader->info.order) ? INT64_MIN : INT64_MAX; - SFileDataBlockInfo* pBlockInfo = getCurrentBlockInfo(pBlockIter); + SFileDataBlockInfo* pBlockInfo = NULL; SReaderStatus* pStatus = &pReader->status; SFileBlockDumpInfo* pDumpInfo = &pStatus->fBlockDumpInfo; - if (pBlockInfo) { + int32_t code = getCurrentBlockInfo(pBlockIter, &pBlockInfo); + if (code == TSDB_CODE_SUCCESS) { pDumpInfo->totalRows = pBlockInfo->numRow; pDumpInfo->rowIndex = ASCENDING_TRAVERSE(pReader->info.order) ? 0 : pBlockInfo->numRow - 1; } else { @@ -3243,7 +3418,7 @@ static int32_t initForFirstBlockInFile(STsdbReader* pReader, SDataBlockIter* pBl code = initBlockIterator(pReader, pBlockIter, num.numOfBlocks, pTableList); } else { // no block data, only last block exists tBlockDataReset(&pReader->status.fileBlockData); - resetDataBlockIterator(pBlockIter, pReader->info.order, shouldFreePkBuf(&pReader->suppInfo)); + code = resetDataBlockIterator(pBlockIter, pReader->info.order, shouldFreePkBuf(&pReader->suppInfo)); resetTableListIndex(&pReader->status); } @@ -3353,7 +3528,10 @@ static int32_t buildBlockFromFiles(STsdbReader* pReader) { } tBlockDataReset(pBlockData); - resetDataBlockIterator(pBlockIter, pReader->info.order, shouldFreePkBuf(&pReader->suppInfo)); + code = resetDataBlockIterator(pBlockIter, pReader->info.order, shouldFreePkBuf(&pReader->suppInfo)); + if (code != TSDB_CODE_SUCCESS) { + return code; + } resetTableListIndex(&pReader->status); ERetrieveType type = doReadDataFromSttFiles(pReader); @@ -3622,6 +3800,7 @@ FORCE_INLINE TSDBROW* getValidMemRow(SIterInfo* pIter, const SArray* pDelList, S int32_t doMergeRowsInBuf(SIterInfo* pIter, uint64_t uid, SRowKey* pCurKey, SArray* pDelList, STsdbReader* pReader) { SRowMerger* pMerger = &pReader->status.merger; + int32_t code = 0; while (1) { pIter->hasVal = tsdbTbDataIterNext(pIter->iter); @@ -3656,10 +3835,13 @@ int32_t doMergeRowsInBuf(SIterInfo* pIter, uint64_t uid, SRowKey* pCurKey, SArra } } - tsdbRowMergerAdd(pMerger, pRow, pTSchema); + code = tsdbRowMergerAdd(pMerger, pRow, pTSchema); + if (code != TSDB_CODE_SUCCESS) { + return code; + } } - return TSDB_CODE_SUCCESS; + return code; } static int32_t doMergeRowsInFileBlockImpl(SBlockData* pBlockData, int32_t rowIndex, SRowKey* pKey, SRowMerger* pMerger, @@ -3677,7 +3859,7 @@ static int32_t doMergeRowsInFileBlockImpl(SBlockData* pBlockData, int32_t rowInd } TSDBROW fRow = tsdbRowFromBlockData(pBlockData, rowIndex); - tsdbRowMergerAdd(pMerger, &fRow, NULL); + int32_t code = tsdbRowMergerAdd(pMerger, &fRow, NULL); rowIndex += step; } @@ -3719,6 +3901,7 @@ int32_t doMergeRowsInFileBlocks(SBlockData* pBlockData, STableBlockScanInfo* pSc bool asc = ASCENDING_TRAVERSE(pReader->info.order); int32_t step = asc ? 1 : -1; SVersionRange* pRange = &pReader->info.verRange; + int32_t code = 0; pDumpInfo->rowIndex += step; if ((pDumpInfo->rowIndex <= pBlockData->nRow - 1 && asc) || (pDumpInfo->rowIndex >= 0 && !asc)) { @@ -3730,25 +3913,31 @@ int32_t doMergeRowsInFileBlocks(SBlockData* pBlockData, STableBlockScanInfo* pSc while (1) { CHECK_FILEBLOCK_STATE st; - SFileDataBlockInfo* pFileBlockInfo = getCurrentBlockInfo(&pReader->status.blockIter); + SFileDataBlockInfo* pFileBlockInfo = NULL; + code = getCurrentBlockInfo(&pReader->status.blockIter, &pFileBlockInfo); + if (code != TSDB_CODE_SUCCESS) { + return code; + } + if (pFileBlockInfo == NULL) { st = CHECK_FILEBLOCK_QUIT; break; } - checkForNeighborFileBlock(pReader, pScanInfo, pFileBlockInfo, pMerger, pKey, &st); - if (st == CHECK_FILEBLOCK_QUIT) { + code = checkForNeighborFileBlock(pReader, pScanInfo, pFileBlockInfo, pMerger, pKey, &st); + if (st == CHECK_FILEBLOCK_QUIT || code != TSDB_CODE_SUCCESS) { break; } } } - return TSDB_CODE_SUCCESS; + return code; } int32_t doMergeRowsInSttBlock(SSttBlockReader* pSttBlockReader, STableBlockScanInfo* pScanInfo, SRowMerger* pMerger, int32_t pkSrcSlot, SVersionRange* pVerRange, const char* idStr) { SRowKey* pRowKey = &pScanInfo->lastProcKey; + int32_t code = TSDB_CODE_SUCCESS; while (nextRowFromSttBlocks(pSttBlockReader, pScanInfo, pkSrcSlot, pVerRange)) { SRowKey* pNextKey = getCurrentKeyInSttBlock(pSttBlockReader); @@ -3756,7 +3945,10 @@ int32_t doMergeRowsInSttBlock(SSttBlockReader* pSttBlockReader, STableBlockScanI int32_t ret = pkCompEx(pRowKey, pNextKey); if (ret == 0) { TSDBROW* pRow1 = tMergeTreeGetRow(&pSttBlockReader->mergeTree); - tsdbRowMergerAdd(pMerger, pRow1, NULL); + code = tsdbRowMergerAdd(pMerger, pRow1, NULL); + if (code != TSDB_CODE_SUCCESS) { + break; + } } else { tsdbTrace("uid:%" PRIu64 " last del index:%d, del range:%d, lastKeyInStt:%" PRId64 ", %s", pScanInfo->uid, pScanInfo->sttBlockDelIndex, (int32_t)taosArrayGetSize(pScanInfo->delSkyline), @@ -3765,7 +3957,7 @@ int32_t doMergeRowsInSttBlock(SSttBlockReader* pSttBlockReader, STableBlockScanI } } - return TSDB_CODE_SUCCESS; + return code; } int32_t doMergeMemTableMultiRows(TSDBROW* pRow, SRowKey* pKey, uint64_t uid, SIterInfo* pIter, SArray* pDelList, @@ -4024,7 +4216,11 @@ int32_t doAppendRowFromTSRow(SSDataBlock* pBlock, STsdbReader* pReader, SRow* pT if (colId == pSchema->columns[j].colId) { SColumnInfoData* pColInfoData = taosArrayGet(pBlock->pDataBlock, pSupInfo->slotId[i]); - tRowGet(pTSRow, pSchema, j, &colVal); + code = tRowGet(pTSRow, pSchema, j, &colVal); + if (code) { + return code; + } + code = doCopyColVal(pColInfoData, outputRowIndex, i, &colVal, pSupInfo); if (code) { return code; @@ -4109,7 +4305,11 @@ int32_t buildDataBlockFromBufImpl(STableBlockScanInfo* pBlockScanInfo, int64_t e do { TSDBROW row = {.type = -1}; bool freeTSRow = false; - tsdbGetNextRowInMem(pBlockScanInfo, pReader, &row, endKey, &freeTSRow); + code = tsdbGetNextRowInMem(pBlockScanInfo, pReader, &row, endKey, &freeTSRow); + if (code != TSDB_CODE_SUCCESS) { + return code; + } + if (row.type == -1) { break; } @@ -4155,6 +4355,7 @@ int32_t buildDataBlockFromBufImpl(STableBlockScanInfo* pBlockScanInfo, int64_t e // TODO refactor: with createDataBlockScanInfo int32_t tsdbSetTableList2(STsdbReader* pReader, const void* pTableList, int32_t num) { + int32_t code = TSDB_CODE_SUCCESS; int32_t size = tSimpleHashGetSize(pReader->status.pTableMap); STableBlockScanInfo** p = NULL; @@ -4165,7 +4366,7 @@ int32_t tsdbSetTableList2(STsdbReader* pReader, const void* pTableList, int32_t } if (size < num) { - int32_t code = ensureBlockScanInfoBuf(&pReader->blockInfoBuf, num); + code = ensureBlockScanInfoBuf(&pReader->blockInfoBuf, num); if (code) { return code; } @@ -4186,42 +4387,43 @@ int32_t tsdbSetTableList2(STsdbReader* pReader, const void* pTableList, int32_t for (int32_t i = 0; i < num; ++i) { pUidList->tableUidList[i] = pList[i].uid; - STableBlockScanInfo* pInfo = getPosInBlockInfoBuf(&pReader->blockInfoBuf, i); - initTableBlockScanInfo(pInfo, pList[i].uid, pReader->status.pTableMap, pReader); + STableBlockScanInfo* pInfo = NULL; + code = getPosInBlockInfoBuf(&pReader->blockInfoBuf, i, &pInfo); + if (code != TSDB_CODE_SUCCESS) { + return code; + } + + code = initTableBlockScanInfo(pInfo, pList[i].uid, pReader->status.pTableMap, pReader); + if (code != TSDB_CODE_SUCCESS) { + return code; + } } return TDB_CODE_SUCCESS; } -void* tsdbGetIdx2(SMeta* pMeta) { - if (pMeta == NULL) { - return NULL; - } - return metaGetIdx(pMeta); -} - -void* tsdbGetIvtIdx2(SMeta* pMeta) { - if (pMeta == NULL) { - return NULL; - } - return metaGetIvtIdx(pMeta); -} - uint64_t tsdbGetReaderMaxVersion2(STsdbReader* pReader) { return pReader->info.verRange.maxVer; } static int32_t doOpenReaderImpl(STsdbReader* pReader) { SReaderStatus* pStatus = &pReader->status; SDataBlockIter* pBlockIter = &pStatus->blockIter; + int32_t code = TSDB_CODE_SUCCESS; if (pReader->bFilesetDelimited) { getMemTableTimeRange(pReader, &pReader->status.memTableMaxKey, &pReader->status.memTableMinKey); pReader->status.bProcMemFirstFileset = true; } - initFilesetIterator(&pStatus->fileIter, pReader->pReadSnap->pfSetArray, pReader); - resetDataBlockIterator(&pStatus->blockIter, pReader->info.order, shouldFreePkBuf(&pReader->suppInfo)); + code = initFilesetIterator(&pStatus->fileIter, pReader->pReadSnap->pfSetArray, pReader); + if (code != TSDB_CODE_SUCCESS) { + return code; + } + + code = resetDataBlockIterator(&pStatus->blockIter, pReader->info.order, shouldFreePkBuf(&pReader->suppInfo)); + if (code != TSDB_CODE_SUCCESS) { + return code; + } - int32_t code = TSDB_CODE_SUCCESS; if (pStatus->fileIter.numOfFiles == 0) { pStatus->loadFromFile = false; } else { @@ -4248,7 +4450,7 @@ static void clearSharedPtr(STsdbReader* p) { p->pSchemaMap = NULL; } -static void setSharedPtr(STsdbReader* pDst, const STsdbReader* pSrc) { +static int32_t setSharedPtr(STsdbReader* pDst, const STsdbReader* pSrc) { pDst->status.pTableMap = pSrc->status.pTableMap; pDst->status.uidList = pSrc->status.uidList; pDst->info.pSchema = pSrc->info.pSchema; @@ -4257,8 +4459,10 @@ static void setSharedPtr(STsdbReader* pDst, const STsdbReader* pSrc) { pDst->pReadSnap->pfSetArray = pSrc->pReadSnap->pfSetArray; if (pDst->info.pSchema) { - tsdbRowMergerInit(&pDst->status.merger, pDst->info.pSchema); + return tsdbRowMergerInit(&pDst->status.merger, pDst->info.pSchema); } + + return TSDB_CODE_SUCCESS; } // ====================================== EXPOSED APIs ====================================== @@ -4266,13 +4470,17 @@ int32_t tsdbReaderOpen2(void* pVnode, SQueryTableDataCond* pCond, void* pTableLi SSDataBlock* pResBlock, void** ppReader, const char* idstr, SHashObj** pIgnoreTables) { STimeWindow window = pCond->twindows; SVnodeCfg* pConf = &(((SVnode*)pVnode)->config); + int32_t code = 0; int32_t capacity = pConf->tsdbCfg.maxRows; if (pResBlock != NULL) { - blockDataEnsureCapacity(pResBlock, capacity); + code = blockDataEnsureCapacity(pResBlock, capacity); + if (code != TSDB_CODE_SUCCESS) { + goto _err; + } } - int32_t code = tsdbReaderCreate(pVnode, pCond, ppReader, capacity, pResBlock, idstr); + code = tsdbReaderCreate(pVnode, pCond, ppReader, capacity, pResBlock, idstr); if (code != TSDB_CODE_SUCCESS) { goto _err; } @@ -4335,7 +4543,10 @@ int32_t tsdbReaderOpen2(void* pVnode, SQueryTableDataCond* pCond, void* pTableLi } if (pReader->info.pSchema != NULL) { - tsdbRowMergerInit(&pReader->status.merger, pReader->info.pSchema); + code = tsdbRowMergerInit(&pReader->status.merger, pReader->info.pSchema); + if (code != TSDB_CODE_SUCCESS) { + return code; + } } pReader->pSchemaMap = tSimpleHashInit(8, taosFastHash); @@ -4354,11 +4565,10 @@ int32_t tsdbReaderOpen2(void* pVnode, SQueryTableDataCond* pCond, void* pTableLi } STsdbReader* p = (pReader->innerReader[0] != NULL) ? pReader->innerReader[0] : pReader; - pReader->status.pTableMap = - createDataBlockScanInfo(p, &pReader->blockInfoBuf, pTableList, &pReader->status.uidList, numOfTables); - if (pReader->status.pTableMap == NULL) { + + code = createDataBlockScanInfo(p, &pReader->blockInfoBuf, pTableList, &pReader->status.uidList, numOfTables, &pReader->status.pTableMap); + if (code != TSDB_CODE_SUCCESS) { *ppReader = NULL; - code = TSDB_CODE_OUT_OF_MEMORY; goto _err; } @@ -4391,7 +4601,7 @@ void tsdbReaderClose2(STsdbReader* pReader) { return; } - tsdbAcquireReader(pReader); + (void)tsdbAcquireReader(pReader); { if (pReader->innerReader[0] != NULL || pReader->innerReader[1] != NULL) { @@ -4430,7 +4640,7 @@ void tsdbReaderClose2(STsdbReader* pReader) { clearBlockScanInfoBuf(&pReader->blockInfoBuf); if (pReader->pFileReader != NULL) { - tsdbDataFileReaderClose(&pReader->pFileReader); + (void) tsdbDataFileReaderClose(&pReader->pFileReader); } SReadCostSummary* pCost = &pReader->cost; @@ -4446,15 +4656,15 @@ void tsdbReaderClose2(STsdbReader* pReader) { destroySttBlockReader(pReader->status.pLDataIterArray, &pCost->sttCost); taosMemoryFreeClear(pReader->status.uidList.tableUidList); - qTrace("tsdb/reader-close: %p, untake snapshot", pReader); + tsdbTrace("tsdb/reader-close: %p, untake snapshot", pReader); void* p = pReader->pReadSnap; if ((p == atomic_val_compare_exchange_ptr((void**)&pReader->pReadSnap, p, NULL)) && (p != NULL)) { tsdbUntakeReadSnap2(pReader, p, true); } - tsem_destroy(&pReader->resumeAfterSuspend); - tsdbReleaseReader(pReader); - tsdbUninitReaderLock(pReader); + (void) tsem_destroy(&pReader->resumeAfterSuspend); + (void) tsdbReleaseReader(pReader); + (void) tsdbUninitReaderLock(pReader); tsdbDebug( "%p :io-cost summary: head-file:%" PRIu64 ", head-file time:%.2f ms, SMA:%" PRId64 @@ -4483,11 +4693,14 @@ static int32_t doSuspendCurrentReader(STsdbReader* pCurrentReader) { SReaderStatus* pStatus = &pCurrentReader->status; if (pStatus->loadFromFile) { - tsdbDataFileReaderClose(&pCurrentReader->pFileReader); + (void) tsdbDataFileReaderClose(&pCurrentReader->pFileReader); SReadCostSummary* pCost = &pCurrentReader->cost; - pStatus->pLDataIterArray = destroySttBlockReader(pStatus->pLDataIterArray, &pCost->sttCost); + destroySttBlockReader(pStatus->pLDataIterArray, &pCost->sttCost); pStatus->pLDataIterArray = taosArrayInit(4, POINTER_BYTES); + if (pStatus->pLDataIterArray == NULL) { + return TSDB_CODE_OUT_OF_MEMORY; + } } // resetDataBlockScanInfo excluding lastKey @@ -4515,14 +4728,14 @@ int32_t tsdbReaderSuspend2(STsdbReader* pReader) { if (pReader->type == TIMEWINDOW_RANGE_EXTERNAL) { if (pReader->step == EXTERNAL_ROWS_PREV) { - doSuspendCurrentReader(pReader->innerReader[0]); + code = doSuspendCurrentReader(pReader->innerReader[0]); } else if (pReader->step == EXTERNAL_ROWS_MAIN) { - doSuspendCurrentReader(pReader); + code = doSuspendCurrentReader(pReader); } else { - doSuspendCurrentReader(pReader->innerReader[1]); + code = doSuspendCurrentReader(pReader->innerReader[1]); } } else { - doSuspendCurrentReader(pReader); + code = doSuspendCurrentReader(pReader); } // make sure only release once @@ -4557,13 +4770,12 @@ static int32_t tsdbSetQueryReseek(void* pQHandle) { code = tsdbTryAcquireReader(pReader); if (code == 0) { if (pReader->flag == READER_STATUS_SUSPEND) { - tsdbReleaseReader(pReader); + code = tsdbReleaseReader(pReader); return code; } - tsdbReaderSuspend2(pReader); - tsdbReleaseReader(pReader); - + code = tsdbReaderSuspend2(pReader); + (void) tsdbReleaseReader(pReader); return code; } else if (code == EBUSY) { return TSDB_CODE_VND_QUERY_BUSY; @@ -4580,7 +4792,7 @@ int32_t tsdbReaderResume2(STsdbReader* pReader) { // restore reader's state, task snapshot int32_t numOfTables = tSimpleHashGetSize(pReader->status.pTableMap); if (numOfTables > 0) { - qTrace("tsdb/reader: %p, take snapshot", pReader); + tsdbTrace("tsdb/reader: %p, take snapshot", pReader); code = tsdbTakeReadSnap2(pReader, tsdbSetQueryReseek, &pReader->pReadSnap); if (code != TSDB_CODE_SUCCESS) { goto _err; @@ -4601,10 +4813,16 @@ int32_t tsdbReaderResume2(STsdbReader* pReader) { // we need only one row pPrevReader->resBlockInfo.capacity = 1; - setSharedPtr(pPrevReader, pReader); + code = setSharedPtr(pPrevReader, pReader); + if (code != TSDB_CODE_SUCCESS) { + return code; + } pNextReader->resBlockInfo.capacity = 1; - setSharedPtr(pNextReader, pReader); + code = setSharedPtr(pNextReader, pReader); + if (code != TSDB_CODE_SUCCESS) { + return code; + } if (pReader->step == 0 || pReader->step == EXTERNAL_ROWS_PREV) { code = doOpenReaderImpl(pPrevReader); @@ -4773,12 +4991,17 @@ int32_t tsdbNextDataBlock2(STsdbReader* pReader, bool* hasNext) { #endif code = tsdbAcquireReader(pReader); - qTrace("tsdb/read: %p, take read mutex, code: %d", pReader, code); + if (code != TSDB_CODE_SUCCESS) { + return code; + } + + tsdbTrace("tsdb/read: %p, take read mutex, code: %d", pReader, code); if (pReader->flag == READER_STATUS_SUSPEND) { code = tsdbReaderResume2(pReader); if (code != TSDB_CODE_SUCCESS) { - tsdbReleaseReader(pReader); + // release reader failure should be suppressed here, to avoid over-write the original error code + (void) tsdbReleaseReader(pReader); return code; } } @@ -4786,7 +5009,7 @@ int32_t tsdbNextDataBlock2(STsdbReader* pReader, bool* hasNext) { if (pReader->innerReader[0] != NULL && pReader->step == 0) { code = doTsdbNextDataBlock2(pReader->innerReader[0], hasNext); if (code) { - tsdbReleaseReader(pReader); + (void) tsdbReleaseReader(pReader); return code; } @@ -4794,8 +5017,8 @@ int32_t tsdbNextDataBlock2(STsdbReader* pReader, bool* hasNext) { if (*hasNext) { pStatus = &pReader->innerReader[0]->status; if (pStatus->composedDataBlock) { - qTrace("tsdb/read: %p, unlock read mutex", pReader); - tsdbReleaseReader(pReader); + tsdbTrace("tsdb/read: %p, unlock read mutex", pReader); + code = tsdbReleaseReader(pReader); } return code; @@ -4817,14 +5040,14 @@ int32_t tsdbNextDataBlock2(STsdbReader* pReader, bool* hasNext) { code = doTsdbNextDataBlock2(pReader, hasNext); if (code != TSDB_CODE_SUCCESS) { - tsdbReleaseReader(pReader); + (void) tsdbReleaseReader(pReader); return code; } if (*hasNext) { if (pStatus->composedDataBlock) { - qTrace("tsdb/read: %p, unlock read mutex", pReader); - tsdbReleaseReader(pReader); + tsdbTrace("tsdb/read: %p, unlock read mutex", pReader); + code = tsdbReleaseReader(pReader); } return code; } @@ -4840,7 +5063,7 @@ int32_t tsdbNextDataBlock2(STsdbReader* pReader, bool* hasNext) { code = doTsdbNextDataBlock2(pReader->innerReader[1], hasNext); if (code != TSDB_CODE_SUCCESS) { - tsdbReleaseReader(pReader); + (void) tsdbReleaseReader(pReader); return code; } @@ -4848,17 +5071,16 @@ int32_t tsdbNextDataBlock2(STsdbReader* pReader, bool* hasNext) { if (*hasNext) { pStatus = &pReader->innerReader[1]->status; if (pStatus->composedDataBlock) { - qTrace("tsdb/read: %p, unlock read mutex", pReader); - tsdbReleaseReader(pReader); + tsdbTrace("tsdb/read: %p, unlock read mutex", pReader); + code = tsdbReleaseReader(pReader); } return code; } } - qTrace("tsdb/read: %p, unlock read mutex", pReader); - tsdbReleaseReader(pReader); - + tsdbTrace("tsdb/read: %p, unlock read mutex", pReader); + code = tsdbReleaseReader(pReader); return code; } @@ -4910,9 +5132,9 @@ static void doFillNullColSMA(SBlockLoadSuppInfo* pSup, int32_t numOfRows, int32_ } int32_t tsdbRetrieveDatablockSMA2(STsdbReader* pReader, SSDataBlock* pDataBlock, bool* allHave, bool* hasNullSMA) { - SColumnDataAgg** pBlockSMA = &pDataBlock->pBlockAgg; - - int32_t code = 0; + SColumnDataAgg** pBlockSMA = &pDataBlock->pBlockAgg; + SFileDataBlockInfo* pBlockInfo = NULL; + int32_t code = 0; *allHave = false; *pBlockSMA = NULL; @@ -4925,7 +5147,11 @@ int32_t tsdbRetrieveDatablockSMA2(STsdbReader* pReader, SSDataBlock* pDataBlock, return TSDB_CODE_SUCCESS; } - SFileDataBlockInfo* pBlockInfo = getCurrentBlockInfo(&pReader->status.blockIter); + code = getCurrentBlockInfo(&pReader->status.blockIter, &pBlockInfo); + if (code != TSDB_CODE_SUCCESS) { + return code; + } + SBlockLoadSuppInfo* pSup = &pReader->suppInfo; SSDataBlock* pResBlock = pReader->resBlockInfo.pResBlock; @@ -5005,38 +5231,45 @@ int32_t tsdbRetrieveDatablockSMA2(STsdbReader* pReader, SSDataBlock* pDataBlock, return code; } -static SSDataBlock* doRetrieveDataBlock(STsdbReader* pReader) { +static int32_t doRetrieveDataBlock(STsdbReader* pReader, SSDataBlock** pBlock) { SReaderStatus* pStatus = &pReader->status; int32_t code = TSDB_CODE_SUCCESS; - SFileDataBlockInfo* pBlockInfo = getCurrentBlockInfo(&pStatus->blockIter); + SFileDataBlockInfo* pBlockInfo = NULL; + *pBlock = NULL; - if (pReader->code != TSDB_CODE_SUCCESS) { - return NULL; + code = getCurrentBlockInfo(&pStatus->blockIter, &pBlockInfo); + if (code != TSDB_CODE_SUCCESS) { + return code; } - STableBlockScanInfo* pBlockScanInfo = getTableBlockScanInfo(pStatus->pTableMap, pBlockInfo->uid, pReader->idStr); - if (pBlockScanInfo == NULL) { - return NULL; + if (pReader->code != TSDB_CODE_SUCCESS) { + return pReader->code; + } + + STableBlockScanInfo* pBlockScanInfo = NULL; + code = getTableBlockScanInfo(pStatus->pTableMap, pBlockInfo->uid, &pBlockScanInfo, pReader->idStr); + if (code != TSDB_CODE_SUCCESS) { + return code; } code = doLoadFileBlockData(pReader, &pStatus->blockIter, &pStatus->fileBlockData, pBlockScanInfo->uid); if (code != TSDB_CODE_SUCCESS) { tBlockDataReset(&pStatus->fileBlockData); - terrno = code; - return NULL; + return code; } code = copyBlockDataToSDataBlock(pReader, &pBlockScanInfo->lastProcKey); if (code != TSDB_CODE_SUCCESS) { tBlockDataReset(&pStatus->fileBlockData); - terrno = code; - return NULL; } - return pReader->resBlockInfo.pResBlock; + *pBlock = pReader->resBlockInfo.pResBlock; + return code; } -SSDataBlock* tsdbRetrieveDataBlock2(STsdbReader* pReader, SArray* pIdList) { +int32_t tsdbRetrieveDataBlock2(STsdbReader* pReader, SSDataBlock** pBlock, SArray* pIdList) { + *pBlock = NULL; + STsdbReader* pTReader = pReader; if (pReader->type == TIMEWINDOW_RANGE_EXTERNAL) { if (pReader->step == EXTERNAL_ROWS_PREV) { @@ -5050,39 +5283,40 @@ SSDataBlock* tsdbRetrieveDataBlock2(STsdbReader* pReader, SArray* pIdList) { if (pStatus->composedDataBlock || pReader->info.execMode == READER_EXEC_ROWS) { // tsdbReaderSuspend2(pReader); // tsdbReaderResume2(pReader); - - return pTReader->resBlockInfo.pResBlock; + *pBlock = pTReader->resBlockInfo.pResBlock; + return TSDB_CODE_SUCCESS; } - SSDataBlock* ret = doRetrieveDataBlock(pTReader); + int32_t code = doRetrieveDataBlock(pTReader, pBlock); - qTrace("tsdb/read-retrieve: %p, unlock read mutex", pReader); - tsdbReleaseReader(pReader); + tsdbTrace("tsdb/read-retrieve: %p, unlock read mutex", pReader); + (void) tsdbReleaseReader(pReader); // tsdbReaderSuspend2(pReader); // tsdbReaderResume2(pReader); - - return ret; + return code; } int32_t tsdbReaderReset2(STsdbReader* pReader, SQueryTableDataCond* pCond) { int32_t code = TSDB_CODE_SUCCESS; - qTrace("tsdb/reader-reset: %p, take read mutex", pReader); - tsdbAcquireReader(pReader); + tsdbTrace("tsdb/reader-reset: %p, take read mutex", pReader); + code = tsdbAcquireReader(pReader); + if (code != TSDB_CODE_SUCCESS) { + return code; + } if (pReader->flag == READER_STATUS_SUSPEND) { code = tsdbReaderResume2(pReader); if (code != TSDB_CODE_SUCCESS) { - tsdbReleaseReader(pReader); + (void) tsdbReleaseReader(pReader); return code; } } if (isEmptyQueryTimeWindow(&pReader->info.window) || pReader->pReadSnap == NULL) { tsdbDebug("tsdb reader reset return %p, %s", pReader->pReadSnap, pReader->idStr); - tsdbReleaseReader(pReader); - return TSDB_CODE_SUCCESS; + return tsdbReleaseReader(pReader); } SReaderStatus* pStatus = &pReader->status; @@ -5098,12 +5332,21 @@ int32_t tsdbReaderReset2(STsdbReader* pReader, SQueryTableDataCond* pCond) { memset(&pReader->suppInfo.tsColAgg, 0, sizeof(SColumnDataAgg)); pReader->suppInfo.tsColAgg.colId = PRIMARYKEY_TIMESTAMP_COL_ID; - tsdbDataFileReaderClose(&pReader->pFileReader); + (void) tsdbDataFileReaderClose(&pReader->pFileReader); int32_t numOfTables = tSimpleHashGetSize(pStatus->pTableMap); - initFilesetIterator(&pStatus->fileIter, pReader->pReadSnap->pfSetArray, pReader); - resetDataBlockIterator(pBlockIter, pReader->info.order, shouldFreePkBuf(&pReader->suppInfo)); + code = initFilesetIterator(&pStatus->fileIter, pReader->pReadSnap->pfSetArray, pReader); + if (code != TSDB_CODE_SUCCESS) { + return code; + } + + code = resetDataBlockIterator(pBlockIter, pReader->info.order, shouldFreePkBuf(&pReader->suppInfo)); + if (code != TSDB_CODE_SUCCESS) { + (void) tsdbReleaseReader(pReader); + return code; + } + resetTableListIndex(&pReader->status); bool asc = ASCENDING_TRAVERSE(pReader->info.order); @@ -5126,7 +5369,7 @@ int32_t tsdbReaderReset2(STsdbReader* pReader, SQueryTableDataCond* pCond) { tsdbError("%p reset reader failed, numOfTables:%d, query range:%" PRId64 " - %" PRId64 " in query %s", pReader, numOfTables, pReader->info.window.skey, pReader->info.window.ekey, pReader->idStr); - tsdbReleaseReader(pReader); + (void) tsdbReleaseReader(pReader); return code; } } @@ -5136,8 +5379,7 @@ int32_t tsdbReaderReset2(STsdbReader* pReader, SQueryTableDataCond* pCond) { pReader, pReader->info.suid, numOfTables, pCond->twindows.skey, pReader->info.window.skey, pReader->info.window.ekey, pReader->idStr); - tsdbReleaseReader(pReader); - + code = tsdbReleaseReader(pReader); return code; } @@ -5161,12 +5403,15 @@ int32_t tsdbGetFileBlocksDistInfo2(STsdbReader* pReader, STableBlockDistInfo* pT pTableBlockInfo->numOfVgroups = 1; // find the start data block in file - tsdbAcquireReader(pReader); + code = tsdbAcquireReader(pReader); + if (code != TSDB_CODE_SUCCESS) { + return code; + } + if (pReader->flag == READER_STATUS_SUSPEND) { code = tsdbReaderResume2(pReader); if (code != TSDB_CODE_SUCCESS) { - tsdbReleaseReader(pReader); - return code; + return tsdbReleaseReader(pReader); } } @@ -5206,8 +5451,13 @@ int32_t tsdbGetFileBlocksDistInfo2(STsdbReader* pReader, STableBlockDistInfo* pT while (true) { if (hasNext) { - SFileDataBlockInfo* pBlockInfo = getCurrentBlockInfo(pBlockIter); - int32_t numOfRows = pBlockInfo->numRow; + SFileDataBlockInfo* pBlockInfo = NULL; + code = getCurrentBlockInfo(pBlockIter, &pBlockInfo); + if (code != TSDB_CODE_SUCCESS) { + break; + } + + int32_t numOfRows = pBlockInfo->numRow; pTableBlockInfo->totalRows += numOfRows; @@ -5243,7 +5493,7 @@ int32_t tsdbGetFileBlocksDistInfo2(STsdbReader* pReader, STableBlockDistInfo* pT } // record the data in stt files - tsdbReleaseReader(pReader); + (void) tsdbReleaseReader(pReader); return code; } @@ -5300,11 +5550,15 @@ int64_t tsdbGetNumOfRowsInMemTable2(STsdbReader* pReader) { int64_t rows = 0; SReaderStatus* pStatus = &pReader->status; - tsdbAcquireReader(pReader); + code = tsdbAcquireReader(pReader); + if (code != TSDB_CODE_SUCCESS) { + return code; + } + if (pReader->flag == READER_STATUS_SUSPEND) { code = tsdbReaderResume2(pReader); if (code != TSDB_CODE_SUCCESS) { - tsdbReleaseReader(pReader); + (void) tsdbReleaseReader(pReader); return code; } } @@ -5335,7 +5589,7 @@ int64_t tsdbGetNumOfRowsInMemTable2(STsdbReader* pReader) { pStatus->pTableIter = tSimpleHashIterate(pStatus->pTableMap, pStatus->pTableIter, &iter); } - tsdbReleaseReader(pReader); + (void) tsdbReleaseReader(pReader); return rows; } @@ -5382,12 +5636,16 @@ int32_t tsdbTakeReadSnap2(STsdbReader* pReader, _query_reseek_func_t reseek, STs SVersionRange* pRange = &pReader->info.verRange; // lock - taosThreadMutexLock(&pTsdb->mutex); + code = taosThreadMutexLock(&pTsdb->mutex); + if (code != TSDB_CODE_SUCCESS) { + tsdbError("failed to lock tsdb, code:%s", tstrerror(code)); + return code; + } // alloc STsdbReadSnap* pSnap = (STsdbReadSnap*)taosMemoryCalloc(1, sizeof(STsdbReadSnap)); if (pSnap == NULL) { - taosThreadMutexUnlock(&pTsdb->mutex); + (void) taosThreadMutexUnlock(&pTsdb->mutex); code = TSDB_CODE_OUT_OF_MEMORY; goto _exit; } @@ -5397,7 +5655,7 @@ int32_t tsdbTakeReadSnap2(STsdbReader* pReader, _query_reseek_func_t reseek, STs pSnap->pMem = pTsdb->mem; pSnap->pNode = taosMemoryMalloc(sizeof(*pSnap->pNode)); if (pSnap->pNode == NULL) { - taosThreadMutexUnlock(&pTsdb->mutex); + (void) taosThreadMutexUnlock(&pTsdb->mutex); code = TSDB_CODE_OUT_OF_MEMORY; goto _exit; } @@ -5405,14 +5663,14 @@ int32_t tsdbTakeReadSnap2(STsdbReader* pReader, _query_reseek_func_t reseek, STs pSnap->pNode->pQHandle = pReader; pSnap->pNode->reseek = reseek; - tsdbRefMemTable(pTsdb->mem, pSnap->pNode); + (void)tsdbRefMemTable(pTsdb->mem, pSnap->pNode); } if (pTsdb->imem && (pRange->minVer <= pTsdb->imem->maxVer && pRange->maxVer >= pTsdb->imem->minVer)) { pSnap->pIMem = pTsdb->imem; pSnap->pINode = taosMemoryMalloc(sizeof(*pSnap->pINode)); if (pSnap->pINode == NULL) { - taosThreadMutexUnlock(&pTsdb->mutex); + (void) taosThreadMutexUnlock(&pTsdb->mutex); code = TSDB_CODE_OUT_OF_MEMORY; goto _exit; } @@ -5420,14 +5678,14 @@ int32_t tsdbTakeReadSnap2(STsdbReader* pReader, _query_reseek_func_t reseek, STs pSnap->pINode->pQHandle = pReader; pSnap->pINode->reseek = reseek; - tsdbRefMemTable(pTsdb->imem, pSnap->pINode); + (void)tsdbRefMemTable(pTsdb->imem, pSnap->pINode); } // fs code = tsdbFSCreateRefSnapshotWithoutLock(pTsdb->pFS, &pSnap->pfSetArray); // unlock - taosThreadMutexUnlock(&pTsdb->mutex); + (void) taosThreadMutexUnlock(&pTsdb->mutex); if (code == TSDB_CODE_SUCCESS) { tsdbTrace("vgId:%d, take read snapshot", TD_VID(pTsdb->pVnode)); @@ -5455,17 +5713,17 @@ void tsdbUntakeReadSnap2(STsdbReader* pReader, STsdbReadSnap* pSnap, bool proact if (pSnap) { if (pSnap->pMem) { - tsdbUnrefMemTable(pSnap->pMem, pSnap->pNode, proactive); + (void) tsdbUnrefMemTable(pSnap->pMem, pSnap->pNode, proactive); } if (pSnap->pIMem) { - tsdbUnrefMemTable(pSnap->pIMem, pSnap->pINode, proactive); + (void) tsdbUnrefMemTable(pSnap->pIMem, pSnap->pINode, proactive); } if (pSnap->pNode) taosMemoryFree(pSnap->pNode); if (pSnap->pINode) taosMemoryFree(pSnap->pINode); - tsdbFSDestroyRefSnapshot(&pSnap->pfSetArray); + (void) tsdbFSDestroyRefSnapshot(&pSnap->pfSetArray); taosMemoryFree(pSnap); } @@ -5476,6 +5734,9 @@ void tsdbUntakeReadSnap2(STsdbReader* pReader, STsdbReadSnap* pSnap, bool proact void tsdbReaderSetId2(STsdbReader* pReader, const char* idstr) { taosMemoryFreeClear(pReader->idStr); pReader->idStr = taosStrdup(idstr); + if (pReader->idStr == NULL) { + // no need to do anything + } pReader->status.fileIter.pSttBlockReader->mergeTree.idStr = pReader->idStr; } diff --git a/source/dnode/vnode/src/tsdb/tsdbReadUtil.c b/source/dnode/vnode/src/tsdb/tsdbReadUtil.c index 273ec6d797..84f235ab25 100644 --- a/source/dnode/vnode/src/tsdb/tsdbReadUtil.c +++ b/source/dnode/vnode/src/tsdb/tsdbReadUtil.c @@ -112,22 +112,28 @@ void clearBlockScanInfoBuf(SBlockInfoBuf* pBuf) { taosArrayDestroy(pBuf->pData); } -void* getPosInBlockInfoBuf(SBlockInfoBuf* pBuf, int32_t index) { +int32_t getPosInBlockInfoBuf(SBlockInfoBuf* pBuf, int32_t index, STableBlockScanInfo** pInfo) { + *pInfo = NULL; + int32_t bucketIndex = index / pBuf->numPerBucket; char** pBucket = taosArrayGet(pBuf->pData, bucketIndex); - return (*pBucket) + (index % pBuf->numPerBucket) * sizeof(STableBlockScanInfo); -} - -STableBlockScanInfo* getTableBlockScanInfo(SSHashObj* pTableMap, uint64_t uid, const char* id) { - STableBlockScanInfo** p = tSimpleHashGet(pTableMap, &uid, sizeof(uid)); - if (p == NULL || *p == NULL) { - terrno = TSDB_CODE_INVALID_PARA; - int32_t size = tSimpleHashGetSize(pTableMap); - tsdbError("failed to locate the uid:%" PRIu64 " in query table uid list, total tables:%d, %s", uid, size, id); - return NULL; + if (pBucket == NULL) { + return TSDB_CODE_FAILED; } - return *p; + *pInfo = (STableBlockScanInfo*)((*pBucket) + (index % pBuf->numPerBucket) * sizeof(STableBlockScanInfo)); + return TSDB_CODE_SUCCESS; +} + +int32_t getTableBlockScanInfo(SSHashObj* pTableMap, uint64_t uid, STableBlockScanInfo** pInfo, const char* id) { + *pInfo = *(STableBlockScanInfo**)tSimpleHashGet(pTableMap, &uid, sizeof(uid)); + if (pInfo == NULL) { + int32_t size = tSimpleHashGetSize(pTableMap); + tsdbError("failed to locate the uid:%" PRIu64 " in query table uid list, total tables:%d, %s", uid, size, id); + return TSDB_CODE_INVALID_PARA; + } + + return TSDB_CODE_SUCCESS; } int32_t initRowKey(SRowKey* pKey, int64_t ts, int32_t numOfPks, int32_t type, int32_t len, bool asc) { @@ -146,17 +152,17 @@ int32_t initRowKey(SRowKey* pKey, int64_t ts, int32_t numOfPks, int32_t type, in } case TSDB_DATA_TYPE_INT:{ int32_t min = INT32_MIN; - memcpy(&pKey->pks[0].val, &min, tDataTypes[type].bytes); + (void)memcpy(&pKey->pks[0].val, &min, tDataTypes[type].bytes); break; } case TSDB_DATA_TYPE_SMALLINT:{ int16_t min = INT16_MIN; - memcpy(&pKey->pks[0].val, &min, tDataTypes[type].bytes); + (void)memcpy(&pKey->pks[0].val, &min, tDataTypes[type].bytes); break; } case TSDB_DATA_TYPE_TINYINT:{ int8_t min = INT8_MIN; - memcpy(&pKey->pks[0].val, &min, tDataTypes[type].bytes); + (void)memcpy(&pKey->pks[0].val, &min, tDataTypes[type].bytes); break; } case TSDB_DATA_TYPE_UTINYINT: @@ -245,20 +251,27 @@ int32_t initTableBlockScanInfo(STableBlockScanInfo* pScanInfo, uint64_t uid, SSH initLastProcKey(pScanInfo, pReader); pScanInfo->sttKeyInfo.status = STT_FILE_READER_UNINIT; - tSimpleHashPut(pTableMap, &pScanInfo->uid, sizeof(uint64_t), &pScanInfo, POINTER_BYTES); + int32_t code = tSimpleHashPut(pTableMap, &pScanInfo->uid, sizeof(uint64_t), &pScanInfo, POINTER_BYTES); + if (code != TSDB_CODE_SUCCESS) { + return code; + } + tsdbTrace("%p check table uid:%" PRId64 " from lastKey:%" PRId64 " %s", pReader, pScanInfo->uid, pScanInfo->lastProcKey.ts, pReader->idStr); - return TSDB_CODE_SUCCESS; + return code; } // NOTE: speedup the whole processing by preparing the buffer for STableBlockScanInfo in batch model -SSHashObj* createDataBlockScanInfo(STsdbReader* pTsdbReader, SBlockInfoBuf* pBuf, const STableKeyInfo* idList, - STableUidList* pUidList, int32_t numOfTables) { +int32_t createDataBlockScanInfo(STsdbReader* pTsdbReader, SBlockInfoBuf* pBuf, const STableKeyInfo* idList, + STableUidList* pUidList, int32_t numOfTables, SSHashObj** pHashObj) { + int32_t code = 0; + *pHashObj = NULL; + // allocate buffer in order to load data blocks from file // todo use simple hash instead, optimize the memory consumption SSHashObj* pTableMap = tSimpleHashInit(numOfTables, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT)); if (pTableMap == NULL) { - return NULL; + return terrno; } int64_t st = taosGetTimestampUs(); @@ -267,7 +280,7 @@ SSHashObj* createDataBlockScanInfo(STsdbReader* pTsdbReader, SBlockInfoBuf* pBuf pUidList->tableUidList = taosMemoryMalloc(numOfTables * sizeof(uint64_t)); if (pUidList->tableUidList == NULL) { tSimpleHashCleanup(pTableMap); - return NULL; + return TSDB_CODE_OUT_OF_MEMORY; } pUidList->currentIndex = 0; @@ -275,8 +288,16 @@ SSHashObj* createDataBlockScanInfo(STsdbReader* pTsdbReader, SBlockInfoBuf* pBuf for (int32_t j = 0; j < numOfTables; ++j) { pUidList->tableUidList[j] = idList[j].uid; - STableBlockScanInfo* pScanInfo = getPosInBlockInfoBuf(pBuf, j); - initTableBlockScanInfo(pScanInfo, idList[j].uid, pTableMap, pTsdbReader); + STableBlockScanInfo* pScanInfo = NULL; + code = getPosInBlockInfoBuf(pBuf, j, &pScanInfo); + if (code != TSDB_CODE_SUCCESS) { + break; + } + + code = initTableBlockScanInfo(pScanInfo, idList[j].uid, pTableMap, pTsdbReader); + if (code != TSDB_CODE_SUCCESS) { + break; + } } taosSort(pUidList->tableUidList, numOfTables, sizeof(uint64_t), uidComparFunc); @@ -286,7 +307,8 @@ SSHashObj* createDataBlockScanInfo(STsdbReader* pTsdbReader, SBlockInfoBuf* pBuf (sizeof(STableBlockScanInfo) * numOfTables) / 1024.0, pTsdbReader->cost.createScanInfoList, pTsdbReader->idStr); - return pTableMap; + *pHashObj = pTableMap; + return code; } void resetAllDataBlockScanInfo(SSHashObj* pTableMap, int64_t ts, int32_t step) { @@ -308,7 +330,8 @@ void resetAllDataBlockScanInfo(SSHashObj* pTableMap, int64_t ts, int32_t step) { pInfo->iiter.iter = tsdbTbDataIterDestroy(pInfo->iiter.iter); } - pInfo->delSkyline = taosArrayDestroy(pInfo->delSkyline); + taosArrayDestroy(pInfo->delSkyline); + pInfo->delSkyline = NULL; pInfo->lastProcKey.ts = ts; // todo check the nextProcKey info pInfo->sttKeyInfo.nextProcKey.ts = ts + step; @@ -329,11 +352,16 @@ void clearBlockScanInfo(STableBlockScanInfo* p) { p->iiter.iter = tsdbTbDataIterDestroy(p->iiter.iter); } - p->delSkyline = taosArrayDestroy(p->delSkyline); - p->pBlockList = taosArrayDestroy(p->pBlockList); - p->pBlockIdxList = taosArrayDestroy(p->pBlockIdxList); - p->pMemDelData = taosArrayDestroy(p->pMemDelData); - p->pFileDelData = taosArrayDestroy(p->pFileDelData); + taosArrayDestroy(p->delSkyline); + p->delSkyline = NULL; + taosArrayDestroy(p->pBlockList); + p->pBlockList = NULL; + taosArrayDestroy(p->pBlockIdxList); + p->pBlockIdxList = NULL; + taosArrayDestroy(p->pMemDelData); + p->pMemDelData = NULL; + taosArrayDestroy(p->pFileDelData); + p->pFileDelData = NULL; clearRowKey(&p->lastProcKey); clearRowKey(&p->sttRange.skey); @@ -385,11 +413,13 @@ void initBrinRecordIter(SBrinRecordIter* pIter, SDataFileReader* pReader, SArray pIter->pBrinBlockList = pList; } -SBrinRecord* getNextBrinRecord(SBrinRecordIter* pIter) { +int32_t getNextBrinRecord(SBrinRecordIter* pIter, SBrinRecord** pRecord) { + *pRecord = NULL; + if (pIter->blockIndex == -1 || (pIter->recordIndex + 1) >= pIter->block.numOfRecords) { pIter->blockIndex += 1; if (pIter->blockIndex >= taosArrayGetSize(pIter->pBrinBlockList)) { - return NULL; + return TSDB_CODE_FAILED; } pIter->pCurrentBlk = taosArrayGet(pIter->pBrinBlockList, pIter->blockIndex); @@ -398,7 +428,7 @@ SBrinRecord* getNextBrinRecord(SBrinRecordIter* pIter) { int32_t code = tsdbDataFileReadBrinBlock(pIter->pReader, pIter->pCurrentBlk, &pIter->block); if (code != TSDB_CODE_SUCCESS) { tsdbError("failed to read brinBlock from file, code:%s", tstrerror(code)); - return NULL; + return TSDB_CODE_FAILED; } pIter->recordIndex = -1; @@ -406,7 +436,9 @@ SBrinRecord* getNextBrinRecord(SBrinRecordIter* pIter) { pIter->recordIndex += 1; tBrinBlockGet(&pIter->block, pIter->recordIndex, &pIter->record); - return &pIter->record; + *pRecord = &pIter->record; + + return TSDB_CODE_SUCCESS; } void clearBrinBlockIter(SBrinRecordIter* pIter) { tBrinBlockDestroy(&pIter->block); } @@ -579,7 +611,8 @@ int32_t initBlockIterator(STsdbReader* pReader, SDataBlockIter* pBlockIter, int3 } taosArrayAddAll(pBlockIter->blockList, pTableScanInfo->pBlockList); - pTableScanInfo->pBlockList = taosArrayDestroy(pTableScanInfo->pBlockList); + taosArrayDestroy(pTableScanInfo->pBlockList); + pTableScanInfo->pBlockList = NULL; int64_t et = taosGetTimestampUs(); tsdbDebug("%p create blocks info struct completed for one table, %d blocks not sorted, elapsed time:%.2f ms %s", @@ -624,7 +657,8 @@ int32_t initBlockIterator(STsdbReader* pReader, SDataBlockIter* pBlockIter, int3 for (int32_t i = 0; i < numOfTables; ++i) { STableBlockScanInfo* pTableScanInfo = taosArrayGetP(pTableList, i); - pTableScanInfo->pBlockList = taosArrayDestroy(pTableScanInfo->pBlockList); + taosArrayDestroy(pTableScanInfo->pBlockList); + pTableScanInfo->pBlockList = NULL; } int64_t et = taosGetTimestampUs(); @@ -662,7 +696,13 @@ static int32_t doCheckTombBlock(STombBlock* pBlock, STsdbReader* pReader, int32_ STombRecord record = {0}; uint64_t uid = pReader->status.uidList.tableUidList[*j]; - STableBlockScanInfo* pScanInfo = getTableBlockScanInfo(pReader->status.pTableMap, uid, pReader->idStr); + STableBlockScanInfo* pScanInfo = NULL; + + code = getTableBlockScanInfo(pReader->status.pTableMap, uid, &pScanInfo, pReader->idStr); + if (code != TSDB_CODE_SUCCESS) { + return code; + } + if (pScanInfo->pFileDelData == NULL) { pScanInfo->pFileDelData = taosArrayInit(4, sizeof(SDelData)); } @@ -694,7 +734,11 @@ static int32_t doCheckTombBlock(STombBlock* pBlock, STsdbReader* pReader, int32_ } uid = pReader->status.uidList.tableUidList[*j]; - pScanInfo = getTableBlockScanInfo(pReader->status.pTableMap, uid, pReader->idStr); + code = getTableBlockScanInfo(pReader->status.pTableMap, uid, &pScanInfo, pReader->idStr); + if (code != TSDB_CODE_SUCCESS) { + return code; + } + if (pScanInfo->pFileDelData == NULL) { pScanInfo->pFileDelData = taosArrayInit(4, sizeof(SDelData)); } @@ -798,9 +842,12 @@ int32_t loadSttTombDataForAll(STsdbReader* pReader, SSttFileReader* pSttFileRead return doLoadTombDataFromTombBlk(pBlkArray, pReader, pSttFileReader, false); } -void loadMemTombData(SArray** ppMemDelData, STbData* pMemTbData, STbData* piMemTbData, int64_t ver) { +int32_t loadMemTombData(SArray** ppMemDelData, STbData* pMemTbData, STbData* piMemTbData, int64_t ver) { if (*ppMemDelData == NULL) { *ppMemDelData = taosArrayInit(4, sizeof(SDelData)); + if (*ppMemDelData == NULL) { + return TSDB_CODE_SUCCESS; + } } SArray* pMemDelData = *ppMemDelData; @@ -828,6 +875,8 @@ void loadMemTombData(SArray** ppMemDelData, STbData* pMemTbData, STbData* piMemT p = p->pNext; } } + + return TSDB_CODE_SUCCESS; } int32_t getNumOfRowsInSttBlock(SSttFileReader* pSttFileReader, SSttBlockLoadInfo* pBlockLoadInfo, @@ -952,6 +1001,7 @@ int32_t adjustSttDataIters(SArray* pSttFileBlockIterArray, STFileSet* pFileSet) int32_t tsdbGetRowsInSttFiles(STFileSet* pFileSet, SArray* pSttFileBlockIterArray, STsdb* pTsdb, SMergeTreeConf* pConf, const char* pstr) { int32_t numOfRows = 0; + int32_t code = 0; // no data exists, go to end int32_t numOfLevels = pFileSet->lvlArr->size; @@ -976,7 +1026,7 @@ int32_t tsdbGetRowsInSttFiles(STFileSet* pFileSet, SArray* pSttFileBlockIterArra conf.file[0] = *pSttLevel->fobjArr->data[i]->f; const char* pName = pSttLevel->fobjArr->data[i]->fname; - int32_t code = tsdbSttFileReaderOpen(pName, &conf, &pIter->pReader); + code = tsdbSttFileReaderOpen(pName, &conf, &pIter->pReader); if (code != TSDB_CODE_SUCCESS) { tsdbError("open stt file reader error. file:%s, code %s, %s", pName, tstrerror(code), pstr); continue; @@ -984,8 +1034,8 @@ int32_t tsdbGetRowsInSttFiles(STFileSet* pFileSet, SArray* pSttFileBlockIterArra } if (pIter->pBlockLoadInfo == NULL) { - pIter->pBlockLoadInfo = tCreateSttBlockLoadInfo(pConf->pSchema, pConf->pCols, pConf->numOfCols); - if (pIter->pBlockLoadInfo == NULL) { + code = tCreateSttBlockLoadInfo(pConf->pSchema, pConf->pCols, pConf->numOfCols, &pIter->pBlockLoadInfo); + if (code != TSDB_CODE_SUCCESS) { tsdbError("failed to create block load info, code: out of memory, %s", pstr); continue; } @@ -993,7 +1043,7 @@ int32_t tsdbGetRowsInSttFiles(STFileSet* pFileSet, SArray* pSttFileBlockIterArra // load stt blocks statis for all stt-blocks, to decide if the data of queried table exists in current stt file TStatisBlkArray* pStatisBlkArray = NULL; - int32_t code = tsdbSttFileReadStatisBlk(pIter->pReader, (const TStatisBlkArray**)&pStatisBlkArray); + code = tsdbSttFileReadStatisBlk(pIter->pReader, (const TStatisBlkArray**)&pStatisBlkArray); if (code != TSDB_CODE_SUCCESS) { tsdbError("failed to load stt block statistics, code:%s, %s", tstrerror(code), pstr); continue; diff --git a/source/dnode/vnode/src/tsdb/tsdbReadUtil.h b/source/dnode/vnode/src/tsdb/tsdbReadUtil.h index 6c76f8c372..45a2384b65 100644 --- a/source/dnode/vnode/src/tsdb/tsdbReadUtil.h +++ b/source/dnode/vnode/src/tsdb/tsdbReadUtil.h @@ -315,32 +315,31 @@ typedef struct SBrinRecordIter { } SBrinRecordIter; int32_t uidComparFunc(const void* p1, const void* p2); +int32_t getTableBlockScanInfo(SSHashObj* pTableMap, uint64_t uid, STableBlockScanInfo** pInfo, const char* id); -STableBlockScanInfo* getTableBlockScanInfo(SSHashObj* pTableMap, uint64_t uid, const char* id); - -SSHashObj* createDataBlockScanInfo(STsdbReader* pReader, SBlockInfoBuf* pBuf, const STableKeyInfo* idList, - STableUidList* pUidList, int32_t numOfTables); -int32_t initTableBlockScanInfo(STableBlockScanInfo* pScanInfo, uint64_t uid, SSHashObj* pTableMap, - STsdbReader* pReader); -void clearBlockScanInfo(STableBlockScanInfo* p); -void destroyAllBlockScanInfo(SSHashObj* pTableMap); -void resetAllDataBlockScanInfo(SSHashObj* pTableMap, int64_t ts, int32_t step); -void cleanupInfoForNextFileset(SSHashObj* pTableMap); -int32_t ensureBlockScanInfoBuf(SBlockInfoBuf* pBuf, int32_t numOfTables); -void clearBlockScanInfoBuf(SBlockInfoBuf* pBuf); -void* getPosInBlockInfoBuf(SBlockInfoBuf* pBuf, int32_t index); +int32_t createDataBlockScanInfo(STsdbReader* pTsdbReader, SBlockInfoBuf* pBuf, const STableKeyInfo* idList, + STableUidList* pUidList, int32_t numOfTables, SSHashObj** pHashObj); +int32_t initTableBlockScanInfo(STableBlockScanInfo* pScanInfo, uint64_t uid, SSHashObj* pTableMap, + STsdbReader* pReader); +void clearBlockScanInfo(STableBlockScanInfo* p); +void destroyAllBlockScanInfo(SSHashObj* pTableMap); +void resetAllDataBlockScanInfo(SSHashObj* pTableMap, int64_t ts, int32_t step); +void cleanupInfoForNextFileset(SSHashObj* pTableMap); +int32_t ensureBlockScanInfoBuf(SBlockInfoBuf* pBuf, int32_t numOfTables); +void clearBlockScanInfoBuf(SBlockInfoBuf* pBuf); +int32_t getPosInBlockInfoBuf(SBlockInfoBuf* pBuf, int32_t index, STableBlockScanInfo** pRes); // brin records iterator -void initBrinRecordIter(SBrinRecordIter* pIter, SDataFileReader* pReader, SArray* pList); -SBrinRecord* getNextBrinRecord(SBrinRecordIter* pIter); -void clearBrinBlockIter(SBrinRecordIter* pIter); +void initBrinRecordIter(SBrinRecordIter* pIter, SDataFileReader* pReader, SArray* pList); +int32_t getNextBrinRecord(SBrinRecordIter* pIter, SBrinRecord** pRecord); +void clearBrinBlockIter(SBrinRecordIter* pIter); // initialize block iterator API int32_t initBlockIterator(STsdbReader* pReader, SDataBlockIter* pBlockIter, int32_t numOfBlocks, SArray* pTableList); bool blockIteratorNext(SDataBlockIter* pBlockIter, const char* idStr); // load tomb data API (stt/mem only for one table each, tomb data from data files are load for all tables at one time) -void loadMemTombData(SArray** ppMemDelData, STbData* pMemTbData, STbData* piMemTbData, int64_t ver); +int32_t loadMemTombData(SArray** ppMemDelData, STbData* pMemTbData, STbData* piMemTbData, int64_t ver); int32_t loadDataFileTombDataForAll(STsdbReader* pReader); int32_t loadSttTombDataForAll(STsdbReader* pReader, SSttFileReader* pSttFileReader, SSttBlockLoadInfo* pLoadInfo); int32_t getNumOfRowsInSttBlock(SSttFileReader* pSttFileReader, SSttBlockLoadInfo* pBlockLoadInfo, @@ -358,10 +357,10 @@ int32_t pkCompEx(SRowKey* p1, SRowKey* p2); int32_t initRowKey(SRowKey* pKey, int64_t ts, int32_t numOfPks, int32_t type, int32_t len, bool asc); void clearRowKey(SRowKey* pKey); -bool shouldFreePkBuf(SBlockLoadSuppInfo *pSupp); -void resetDataBlockIterator(SDataBlockIter* pIter, int32_t order, bool hasPk); -void clearDataBlockIterator(SDataBlockIter* pIter, bool needFree); -void cleanupDataBlockIterator(SDataBlockIter* pIter, bool hasPk); +bool shouldFreePkBuf(SBlockLoadSuppInfo* pSupp); +int32_t resetDataBlockIterator(SDataBlockIter* pIter, int32_t order, bool hasPk); +void clearDataBlockIterator(SDataBlockIter* pIter, bool needFree); +void cleanupDataBlockIterator(SDataBlockIter* pIter, bool hasPk); typedef struct { SArray* pTombData; diff --git a/source/libs/audit/src/auditMain.c b/source/libs/audit/src/auditMain.c index aa3b669c1b..7a8de49abe 100644 --- a/source/libs/audit/src/auditMain.c +++ b/source/libs/audit/src/auditMain.c @@ -32,8 +32,8 @@ char* tsAuditBatchUri = "/audit-batch"; int32_t auditInit(const SAuditCfg *pCfg) { tsAudit.cfg = *pCfg; tsAudit.records = taosArrayInit(0, sizeof(SAuditRecord *)); - taosThreadMutexInit(&tsAudit.lock, NULL); - return 0; + if(tsAudit.records == NULL) return TSDB_CODE_OUT_OF_MEMORY; + return taosThreadMutexInit(&tsAudit.lock, NULL); } static FORCE_INLINE void auditDeleteRecord(SAuditRecord * record) { diff --git a/source/libs/executor/inc/executorInt.h b/source/libs/executor/inc/executorInt.h index 9547fa12f3..6db3c780e2 100644 --- a/source/libs/executor/inc/executorInt.h +++ b/source/libs/executor/inc/executorInt.h @@ -929,7 +929,7 @@ int32_t initStreamAggSupporter(SStreamAggSupporter* pSup, SExprSupp* pExpSup, i SStreamState* pState, int32_t keySize, int16_t keyType, SStateStore* pStore, SReadHandle* pHandle, STimeWindowAggSupp* pTwAggSup, const char* taskIdStr, SStorageAPI* pApi, int32_t tsIndex); -void initDownStream(struct SOperatorInfo* downstream, SStreamAggSupporter* pAggSup, uint16_t type, int32_t tsColIndex, +int32_t initDownStream(struct SOperatorInfo* downstream, SStreamAggSupporter* pAggSup, uint16_t type, int32_t tsColIndex, STimeWindowAggSupp* pTwSup, struct SSteamOpBasicInfo* pBasic); void getMaxTsWins(const SArray* pAllWins, SArray* pMaxWins); void initGroupResInfoFromArrayList(SGroupResInfo* pGroupResInfo, SArray* pArrayList); diff --git a/source/libs/executor/inc/streamexecutorInt.h b/source/libs/executor/inc/streamexecutorInt.h index 8b61b93601..c6053cc96e 100644 --- a/source/libs/executor/inc/streamexecutorInt.h +++ b/source/libs/executor/inc/streamexecutorInt.h @@ -20,6 +20,7 @@ extern "C" { #endif #include "executorInt.h" +#include "tutil.h" void setStreamOperatorState(SSteamOpBasicInfo* pBasicInfo, EStreamType type); bool needSaveStreamOperatorInfo(SSteamOpBasicInfo* pBasicInfo); diff --git a/source/libs/executor/src/executil.c b/source/libs/executor/src/executil.c index 173ef0b829..c623e94a12 100644 --- a/source/libs/executor/src/executil.c +++ b/source/libs/executor/src/executil.c @@ -96,7 +96,8 @@ void cleanupGroupResInfo(SGroupResInfo* pGroupResInfo) { pGroupResInfo->freeItem = false; pGroupResInfo->pRows = NULL; } else { - pGroupResInfo->pRows = taosArrayDestroy(pGroupResInfo->pRows); + taosArrayDestroy(pGroupResInfo->pRows); + pGroupResInfo->pRows = NULL; } pGroupResInfo->index = 0; } @@ -2102,7 +2103,8 @@ void* tableListDestroy(STableListInfo* pTableListInfo) { return NULL; } - pTableListInfo->pTableList = taosArrayDestroy(pTableListInfo->pTableList); + taosArrayDestroy(pTableListInfo->pTableList); + pTableListInfo->pTableList = NULL; taosMemoryFreeClear(pTableListInfo->groupOffset); taosHashCleanup(pTableListInfo->map); diff --git a/source/libs/executor/src/executor.c b/source/libs/executor/src/executor.c index c0d089e7c2..4aff0e69a3 100644 --- a/source/libs/executor/src/executor.c +++ b/source/libs/executor/src/executor.c @@ -479,12 +479,14 @@ int32_t qUpdateTableListForStreamScanner(qTaskInfo_t tinfo, const SArray* tableI } int32_t qGetQueryTableSchemaVersion(qTaskInfo_t tinfo, char* dbName, char* tableName, int32_t* sversion, - int32_t* tversion, int32_t idx) { + int32_t* tversion, int32_t idx, bool* tbGet) { + *tbGet = false; + ASSERT(tinfo != NULL && dbName != NULL && tableName != NULL); SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo; if (taosArrayGetSize(pTaskInfo->schemaInfos) <= idx) { - return -1; + return TSDB_CODE_SUCCESS; } SSchemaInfo* pSchemaInfo = taosArrayGet(pTaskInfo->schemaInfos, idx); @@ -502,6 +504,8 @@ int32_t qGetQueryTableSchemaVersion(qTaskInfo_t tinfo, char* dbName, char* table tableName[0] = 0; } + *tbGet = true; + return TSDB_CODE_SUCCESS; } diff --git a/source/libs/executor/src/groupoperator.c b/source/libs/executor/src/groupoperator.c index f0fddc28fc..c7236a88e8 100644 --- a/source/libs/executor/src/groupoperator.c +++ b/source/libs/executor/src/groupoperator.c @@ -17,6 +17,7 @@ #include "function.h" #include "os.h" #include "tname.h" +#include "tutil.h" #include "tdatablock.h" #include "tmsg.h" @@ -1357,11 +1358,13 @@ static void destroyStreamPartitionOperatorInfo(void* param) { taosMemoryFreeClear(param); } -void initParDownStream(SOperatorInfo* downstream, SPartitionBySupporter* pParSup, SExprSupp* pExpr, SExprSupp* pTbnameExpr) { +int32_t initParDownStream(SOperatorInfo* downstream, SPartitionBySupporter* pParSup, SExprSupp* pExpr, SExprSupp* pTbnameExpr) { + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; SStorageAPI* pAPI = &downstream->pTaskInfo->storageAPI; if (downstream->operatorType != QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) { - return; + return code; } SStreamScanInfo* pScanInfo = downstream->info; @@ -1369,8 +1372,9 @@ void initParDownStream(SOperatorInfo* downstream, SPartitionBySupporter* pParSup pScanInfo->pPartScalarSup = pExpr; pScanInfo->pPartTbnameSup = pTbnameExpr; if (!pScanInfo->pUpdateInfo) { - pScanInfo->pUpdateInfo = pAPI->stateStore.updateInfoInit(60000, TSDB_TIME_PRECISION_MILLI, 0, pScanInfo->igCheckUpdate, pScanInfo->pkColType, pScanInfo->pkColLen); + code = pAPI->stateStore.updateInfoInit(60000, TSDB_TIME_PRECISION_MILLI, 0, pScanInfo->igCheckUpdate, pScanInfo->pkColType, pScanInfo->pkColLen, &pScanInfo->pUpdateInfo); } + return code; } SSDataBlock* buildCreateTableBlock(SExprSupp* tbName, SExprSupp* tag) { @@ -1421,6 +1425,7 @@ void freePartItem(void* ptr) { SOperatorInfo* createStreamPartitionOperatorInfo(SOperatorInfo* downstream, SStreamPartitionPhysiNode* pPartNode, SExecTaskInfo* pTaskInfo) { int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; SStreamPartitionOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SStreamPartitionOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); if (pInfo == NULL || pOperator == NULL) { @@ -1511,14 +1516,19 @@ SOperatorInfo* createStreamPartitionOperatorInfo(SOperatorInfo* downstream, SStr destroyStreamPartitionOperatorInfo, optrDefaultBufFn, NULL, optrDefaultGetNextExtFn, NULL); setOperatorStreamStateFn(pOperator, streamOpReleaseState, streamOpReloadState); - initParDownStream(downstream, &pInfo->partitionSup, &pInfo->scalarSup, &pInfo->tbnameCalSup); + code = initParDownStream(downstream, &pInfo->partitionSup, &pInfo->scalarSup, &pInfo->tbnameCalSup); + TSDB_CHECK_CODE(code, lino, _error); + code = appendDownstream(pOperator, &downstream, 1); + TSDB_CHECK_CODE(code, lino, _error); + return pOperator; _error: pTaskInfo->code = code; destroyStreamPartitionOperatorInfo(pInfo); taosMemoryFreeClear(pOperator); + qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); return NULL; } diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index ce4915ca4d..678d8d569e 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -388,9 +388,10 @@ static int32_t loadDataBlock(SOperatorInfo* pOperator, STableScanBase* pTableSca pCost->totalCheckedRows += pBlock->info.rows; pCost->loadBlocks += 1; - SSDataBlock* p = pAPI->tsdReader.tsdReaderRetrieveDataBlock(pTableScanInfo->dataReader, NULL); - if (p == NULL) { - return terrno; + SSDataBlock* p = NULL; + int32_t code = pAPI->tsdReader.tsdReaderRetrieveDataBlock(pTableScanInfo->dataReader, &p, NULL); + if (p == NULL || code != TSDB_CODE_SUCCESS) { + return code; } ASSERT(p == pBlock); @@ -1351,7 +1352,12 @@ static SSDataBlock* readPreVersionData(SOperatorInfo* pTableScanOp, uint64_t tbU } if (hasNext) { - /*SSDataBlock* p = */ pAPI->tsdReader.tsdReaderRetrieveDataBlock(pReader, NULL); + SSDataBlock* p = NULL; + code = pAPI->tsdReader.tsdReaderRetrieveDataBlock(pReader, &p, NULL); + if (code != TSDB_CODE_SUCCESS) { + return NULL; + } + doSetTagColumnData(&pTableScanInfo->base, pBlock, pTaskInfo, pBlock->info.rows); pBlock->info.id.groupId = tableListGetTableGroupId(pTableScanInfo->base.pTableListInfo, pBlock->info.id.uid); } @@ -2477,27 +2483,54 @@ static void doCheckUpdate(SStreamScanInfo* pInfo, TSKEY endKey, SSDataBlock* pBl } } -int32_t streamScanOperatorEncode(SStreamScanInfo* pInfo, void** pBuff) { - int32_t len = pInfo->stateStore.updateInfoSerialize(NULL, 0, pInfo->pUpdateInfo); - len += encodeSTimeWindowAggSupp(NULL, &pInfo->twAggSup); - *pBuff = taosMemoryCalloc(1, len); - void* buf = *pBuff; - encodeSTimeWindowAggSupp(&buf, &pInfo->twAggSup); - pInfo->stateStore.updateInfoSerialize(buf, len, pInfo->pUpdateInfo); - return len; +int32_t streamScanOperatorEncode(SStreamScanInfo* pInfo, void** pBuff, int32_t* pLen) { + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; + int32_t len = 0; + code = pInfo->stateStore.updateInfoSerialize(NULL, 0, pInfo->pUpdateInfo, &len); + TSDB_CHECK_CODE(code, lino, _end); + + len += encodeSTimeWindowAggSupp(NULL, &pInfo->twAggSup); + *pBuff = taosMemoryCalloc(1, len); + if (!(*pBuff)) { + code = TSDB_CODE_OUT_OF_MEMORY; + TSDB_CHECK_CODE(code, lino, _end); + } + void* buf = *pBuff; + encodeSTimeWindowAggSupp(&buf, &pInfo->twAggSup); + int32_t tmp = 0; + code = pInfo->stateStore.updateInfoSerialize(buf, len, pInfo->pUpdateInfo, &tmp); + TSDB_CHECK_CODE(code, lino, _end); + + *pLen = len; + +_end: + if (code != TSDB_CODE_SUCCESS) { + qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } + return code; } void streamScanOperatorSaveCheckpoint(SStreamScanInfo* pInfo) { + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; if (!pInfo->pState) { return; } if (needSaveStreamOperatorInfo(&pInfo->basic)) { void* pBuf = NULL; - int32_t len = streamScanOperatorEncode(pInfo, &pBuf); + int32_t len = 0; + code = streamScanOperatorEncode(pInfo, &pBuf, &len); + TSDB_CHECK_CODE(code, lino, _end); pInfo->stateStore.streamStateSaveInfo(pInfo->pState, STREAM_SCAN_OP_CHECKPOINT_NAME, strlen(STREAM_SCAN_OP_CHECKPOINT_NAME), pBuf, len); taosMemoryFree(pBuf); saveStreamOperatorStateComplete(&pInfo->basic); } + +_end: + if (code != TSDB_CODE_SUCCESS) { + qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } } // other properties are recovered from the execution plan @@ -2929,8 +2962,9 @@ static SSDataBlock* doRawScan(SOperatorInfo* pOperator) { T_LONG_JMP(pTaskInfo->env, pTaskInfo->code); } - SSDataBlock* pBlock = pAPI->tsdReader.tsdReaderRetrieveDataBlock(pInfo->dataReader, NULL); - if (pBlock == NULL) { + SSDataBlock* pBlock = NULL; + code = pAPI->tsdReader.tsdReaderRetrieveDataBlock(pInfo->dataReader, &pBlock, NULL); + if (pBlock == NULL || code != TSDB_CODE_SUCCESS) { T_LONG_JMP(pTaskInfo->env, terrno); } @@ -3094,17 +3128,35 @@ static void destroyStreamScanOperatorInfo(void* param) { } void streamScanReleaseState(SOperatorInfo* pOperator) { + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; SStreamScanInfo* pInfo = pOperator->info; + void* pBuff = NULL; if (!pInfo->pState) { return; } if (!pInfo->pUpdateInfo) { return; } - int32_t len = pInfo->stateStore.updateInfoSerialize(NULL, 0, pInfo->pUpdateInfo); - void* pBuff = taosMemoryCalloc(1, len); - pInfo->stateStore.updateInfoSerialize(pBuff, len, pInfo->pUpdateInfo); + int32_t len = 0; + code = pInfo->stateStore.updateInfoSerialize(NULL, 0, pInfo->pUpdateInfo, &len); + TSDB_CHECK_CODE(code, lino, _end); + + pBuff = taosMemoryCalloc(1, len); + if (!pBuff) { + code = TSDB_CODE_OUT_OF_MEMORY; +TSDB_CHECK_CODE(code, lino, _end); + } + + int32_t tmp = 0; + code = pInfo->stateStore.updateInfoSerialize(pBuff, len, pInfo->pUpdateInfo, &tmp); + TSDB_CHECK_CODE(code, lino, _end); + pInfo->stateStore.streamStateSaveInfo(pInfo->pState, STREAM_SCAN_OP_STATE_NAME, strlen(STREAM_SCAN_OP_STATE_NAME), pBuff, len); +_end: + if (code != TSDB_CODE_SUCCESS) { + qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } taosMemoryFree(pBuff); } diff --git a/source/libs/executor/src/streamcountwindowoperator.c b/source/libs/executor/src/streamcountwindowoperator.c index 857d048457..14f2dfbada 100644 --- a/source/libs/executor/src/streamcountwindowoperator.c +++ b/source/libs/executor/src/streamcountwindowoperator.c @@ -68,9 +68,7 @@ void destroyStreamCountAggOperatorInfo(void* param) { taosMemoryFreeClear(param); } -bool isSlidingCountWindow(SStreamAggSupporter* pAggSup) { - return pAggSup->windowCount != pAggSup->windowSliding; -} +bool isSlidingCountWindow(SStreamAggSupporter* pAggSup) { return pAggSup->windowCount != pAggSup->windowSliding; } void setCountOutputBuf(SStreamAggSupporter* pAggSup, TSKEY ts, uint64_t groupId, SCountWindowInfo* pCurWin, SBuffInfo* pBuffInfo) { @@ -89,13 +87,14 @@ void setCountOutputBuf(SStreamAggSupporter* pAggSup, TSKEY ts, uint64_t groupId, ASSERT(pBuffInfo->pCur); pAggSup->stateStore.streamStateCurNext(pAggSup->pState, pBuffInfo->pCur); code = pAggSup->stateStore.streamStateSessionGetKVByCur(pBuffInfo->pCur, &pCurWin->winInfo.sessionWin, - (void**)&pCurWin->winInfo.pStatePos, &size); + (void**)&pCurWin->winInfo.pStatePos, &size); if (code == TSDB_CODE_FAILED) { pAggSup->stateStore.streamStateCountWinAdd(pAggSup->pState, &pCurWin->winInfo.sessionWin, (void**)&pCurWin->winInfo.pStatePos, &size); } } else { - pBuffInfo->pCur = pAggSup->stateStore.streamStateCountSeekKeyPrev(pAggSup->pState, &pCurWin->winInfo.sessionWin, pAggSup->windowCount); + pBuffInfo->pCur = pAggSup->stateStore.streamStateCountSeekKeyPrev(pAggSup->pState, &pCurWin->winInfo.sessionWin, + pAggSup->windowCount); code = pAggSup->stateStore.streamStateSessionGetKVByCur(pBuffInfo->pCur, &pCurWin->winInfo.sessionWin, (void**)&pCurWin->winInfo.pStatePos, &size); if (code == TSDB_CODE_FAILED) { @@ -107,15 +106,16 @@ void setCountOutputBuf(SStreamAggSupporter* pAggSup, TSKEY ts, uint64_t groupId, pBuffInfo->rebuildWindow = true; } } else { - code = pAggSup->stateStore.streamStateCountWinAddIfNotExist( - pAggSup->pState, &pCurWin->winInfo.sessionWin, pAggSup->windowCount, (void**)&pCurWin->winInfo.pStatePos, &size); + code = pAggSup->stateStore.streamStateCountWinAddIfNotExist(pAggSup->pState, &pCurWin->winInfo.sessionWin, + pAggSup->windowCount, + (void**)&pCurWin->winInfo.pStatePos, &size); } if (code == TSDB_CODE_SUCCESS) { pCurWin->winInfo.isOutput = true; } - pCurWin->pWindowCount= - (COUNT_TYPE*) ((char*)pCurWin->winInfo.pStatePos->pRowBuff + (pAggSup->resultRowSize - sizeof(COUNT_TYPE))); + pCurWin->pWindowCount = + (COUNT_TYPE*)((char*)pCurWin->winInfo.pStatePos->pRowBuff + (pAggSup->resultRowSize - sizeof(COUNT_TYPE))); if (*pCurWin->pWindowCount == pAggSup->windowCount) { pBuffInfo->rebuildWindow = true; @@ -133,7 +133,7 @@ static int32_t updateCountWindowInfo(SStreamAggSupporter* pAggSup, SCountWindowI int32_t start, int32_t rows, int32_t maxRows, SSHashObj* pStUpdated, SSHashObj* pStDeleted, bool* pRebuild) { SSessionKey sWinKey = pWinInfo->winInfo.sessionWin; - int32_t num = 0; + int32_t num = 0; for (int32_t i = start; i < rows; i++) { if (pTs[i] < pWinInfo->winInfo.sessionWin.win.ekey) { num++; @@ -181,7 +181,7 @@ void getCountWinRange(SStreamAggSupporter* pAggSup, const SSessionKey* pKey, ESt pCur = pAggSup->stateStore.streamStateSessionSeekKeyCurrentNext(pAggSup->pState, pKey); } SSessionKey tmpKey = {.groupId = pKey->groupId, .win.ekey = INT64_MIN, .win.skey = INT64_MIN}; - int32_t code = pAggSup->stateStore.streamStateSessionGetKVByCur(pCur, &tmpKey, NULL, 0); + int32_t code = pAggSup->stateStore.streamStateSessionGetKVByCur(pCur, &tmpKey, NULL, 0); if (code != TSDB_CODE_SUCCESS) { pAggSup->stateStore.streamStateFreeCur(pCur); return; @@ -239,7 +239,7 @@ static void doStreamCountAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSDataBl TSKEY* startTsCols = (int64_t*)pStartTsCol->pData; blockDataEnsureCapacity(pAggSup->pScanBlock, rows * 2); SStreamStateCur* pCur = NULL; - COUNT_TYPE slidingRows = 0; + COUNT_TYPE slidingRows = 0; for (int32_t i = 0; i < rows;) { if (pInfo->ignoreExpiredData && @@ -269,7 +269,7 @@ static void doStreamCountAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSDataBl } getCountWinRange(pAggSup, &curWin.winInfo.sessionWin, STREAM_DELETE_DATA, &range); range.win.skey = TMIN(startTsCols[i], range.win.skey); - range.win.ekey = TMAX(startTsCols[rows-1], range.win.ekey); + range.win.ekey = TMAX(startTsCols[rows - 1], range.win.ekey); uint64_t uid = 0; appendDataToSpecialBlock(pAggSup->pScanBlock, &range.win.skey, &range.win.ekey, &uid, &range.groupId, NULL); break; @@ -289,8 +289,7 @@ static void doStreamCountAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSDataBl if (pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE && pStUpdated) { code = saveResult(curWin.winInfo, pStUpdated); if (code != TSDB_CODE_SUCCESS) { - qError("%s do stream count aggregate impl, set result error, code %s", GET_TASKID(pTaskInfo), - tstrerror(code)); + qError("%s do stream count aggregate impl, set result error, code %s", GET_TASKID(pTaskInfo), tstrerror(code)); break; } } @@ -397,13 +396,14 @@ void* doStreamCountDecodeOpState(void* buf, int32_t len, SOperatorInfo* pOperato int32_t mapSize = 0; buf = taosDecodeFixedI32(buf, &mapSize); for (int32_t i = 0; i < mapSize; i++) { - SSessionKey key = {0}; + SSessionKey key = {0}; SCountWindowInfo curWin = {0}; buf = decodeSSessionKey(buf, &key); SBuffInfo buffInfo = {.rebuildWindow = false, .winBuffOp = NONE_WINDOW, .pCur = NULL}; setCountOutputBuf(&pInfo->streamAggSup, key.win.skey, key.groupId, &curWin, &buffInfo); buf = decodeSResultWindowInfo(buf, &curWin.winInfo, pInfo->streamAggSup.resultRowSize); - tSimpleHashPut(pInfo->streamAggSup.pResultRows, &key, sizeof(SSessionKey), &curWin.winInfo, sizeof(SResultWindowInfo)); + tSimpleHashPut(pInfo->streamAggSup.pResultRows, &key, sizeof(SSessionKey), &curWin.winInfo, + sizeof(SResultWindowInfo)); } // 2.twAggSup @@ -441,9 +441,9 @@ void doResetCountWindows(SStreamAggSupporter* pAggSup, SSDataBlock* pBlock) { uint64_t* gpDatas = (uint64_t*)pGroupCol->pData; SRowBuffPos* pPos = NULL; - int32_t size = 0; + int32_t size = 0; for (int32_t i = 0; i < pBlock->info.rows; i++) { - SSessionKey key = {.groupId = gpDatas[i], .win.skey = startDatas[i], .win.ekey = endDatas[i]}; + SSessionKey key = {.groupId = gpDatas[i], .win.skey = startDatas[i], .win.ekey = endDatas[i]}; SStreamStateCur* pCur = NULL; if (isSlidingCountWindow(pAggSup)) { pCur = pAggSup->stateStore.streamStateCountSeekKeyPrev(pAggSup->pState, &key, pAggSup->windowCount); @@ -452,7 +452,7 @@ void doResetCountWindows(SStreamAggSupporter* pAggSup, SSDataBlock* pBlock) { } while (1) { SSessionKey tmpKey = {.groupId = gpDatas[i], .win.skey = INT64_MIN, .win.ekey = INT64_MIN}; - int32_t code = pAggSup->stateStore.streamStateSessionGetKVByCur(pCur, &tmpKey, (void **)&pPos, &size); + int32_t code = pAggSup->stateStore.streamStateSessionGetKVByCur(pCur, &tmpKey, (void**)&pPos, &size); if (code != TSDB_CODE_SUCCESS || tmpKey.win.skey > endDatas[i]) { pAggSup->stateStore.streamStateFreeCur(pCur); break; @@ -482,7 +482,7 @@ void doDeleteCountWindows(SStreamAggSupporter* pAggSup, SSDataBlock* pBlock, SAr SSessionKey key = {.win.skey = startDatas[i], .win.ekey = endDatas[i], .groupId = gpDatas[i]}; while (1) { SSessionKey curWin = {0}; - int32_t code = pAggSup->stateStore.streamStateCountGetKeyByRange(pAggSup->pState, &key, &curWin); + int32_t code = pAggSup->stateStore.streamStateCountGetKeyByRange(pAggSup->pState, &key, &curWin); if (code == TSDB_CODE_FAILED) { break; } @@ -511,11 +511,11 @@ void deleteCountWinState(SStreamAggSupporter* pAggSup, SSDataBlock* pBlock, SSHa } static SSDataBlock* doStreamCountAgg(SOperatorInfo* pOperator) { - SExprSupp* pSup = &pOperator->exprSupp; - SStreamCountAggOperatorInfo* pInfo = pOperator->info; - SOptrBasicInfo* pBInfo = &pInfo->binfo; - SStreamAggSupporter* pAggSup = &pInfo->streamAggSup; - SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; + SExprSupp* pSup = &pOperator->exprSupp; + SStreamCountAggOperatorInfo* pInfo = pOperator->info; + SOptrBasicInfo* pBInfo = &pInfo->binfo; + SStreamAggSupporter* pAggSup = &pInfo->streamAggSup; + SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; qDebug("stask:%s %s status: %d", GET_TASKID(pTaskInfo), getStreamOpName(pOperator->operatorType), pOperator->status); if (pOperator->status == OP_EXEC_DONE) { return NULL; @@ -635,7 +635,7 @@ void streamCountReloadState(SOperatorInfo* pOperator) { int32_t code = pAggSup->stateStore.streamStateGetInfo(pAggSup->pState, STREAM_COUNT_OP_STATE_NAME, strlen(STREAM_COUNT_OP_STATE_NAME), &pBuf, &size); - TSKEY ts = *(TSKEY*)pBuf; + TSKEY ts = *(TSKEY*)pBuf; pInfo->twAggSup.maxTs = TMAX(pInfo->twAggSup.maxTs, ts); taosMemoryFree(pBuf); @@ -650,11 +650,13 @@ SOperatorInfo* createStreamCountAggOperatorInfo(SOperatorInfo* downstream, SPhys SExecTaskInfo* pTaskInfo, SReadHandle* pHandle) { SCountWinodwPhysiNode* pCountNode = (SCountWinodwPhysiNode*)pPhyNode; int32_t numOfCols = 0; - int32_t code = TSDB_CODE_OUT_OF_MEMORY; + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; SStreamCountAggOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SStreamCountAggOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); if (pInfo == NULL || pOperator == NULL) { - goto _error; + code = TSDB_CODE_OUT_OF_MEMORY; + TSDB_CHECK_CODE(code, lino, _error); } pOperator->pTaskInfo = pTaskInfo; @@ -664,18 +666,14 @@ SOperatorInfo* createStreamCountAggOperatorInfo(SOperatorInfo* downstream, SPhys int32_t numOfScalar = 0; SExprInfo* pScalarExprInfo = createExprInfo(pCountNode->window.pExprs, NULL, &numOfScalar); code = initExprSupp(&pInfo->scalarSupp, pScalarExprInfo, numOfScalar, &pTaskInfo->storageAPI.functionStore); - if (code != TSDB_CODE_SUCCESS) { - goto _error; - } + TSDB_CHECK_CODE(code, lino, _error); } SExprSupp* pExpSup = &pOperator->exprSupp; SExprInfo* pExprInfo = createExprInfo(pCountNode->window.pFuncs, NULL, &numOfCols); SSDataBlock* pResBlock = createDataBlockFromDescNode(pPhyNode->pOutputDataBlockDesc); code = initBasicInfoEx(&pInfo->binfo, pExpSup, pExprInfo, numOfCols, pResBlock, &pTaskInfo->storageAPI.functionStore); - if (code != TSDB_CODE_SUCCESS) { - goto _error; - } + TSDB_CHECK_CODE(code, lino, _error); pInfo->twAggSup = (STimeWindowAggSupp){ .waterMark = pCountNode->window.watermark, @@ -686,12 +684,11 @@ SOperatorInfo* createStreamCountAggOperatorInfo(SOperatorInfo* downstream, SPhys }; pInfo->primaryTsIndex = ((SColumnNode*)pCountNode->window.pTspk)->slotId; - code = initStreamAggSupporter(&pInfo->streamAggSup, pExpSup, numOfCols, 0, - pTaskInfo->streamInfo.pState, sizeof(COUNT_TYPE), 0, &pTaskInfo->storageAPI.stateStore, pHandle, - &pInfo->twAggSup, GET_TASKID(pTaskInfo), &pTaskInfo->storageAPI, pInfo->primaryTsIndex); - if (code != TSDB_CODE_SUCCESS) { - goto _error; - } + code = initStreamAggSupporter(&pInfo->streamAggSup, pExpSup, numOfCols, 0, pTaskInfo->streamInfo.pState, + sizeof(COUNT_TYPE), 0, &pTaskInfo->storageAPI.stateStore, pHandle, &pInfo->twAggSup, + GET_TASKID(pTaskInfo), &pTaskInfo->storageAPI, pInfo->primaryTsIndex); + TSDB_CHECK_CODE(code, lino, _error); + pInfo->streamAggSup.windowCount = pCountNode->windowCount; pInfo->streamAggSup.windowSliding = pCountNode->windowSliding; @@ -709,7 +706,8 @@ SOperatorInfo* createStreamCountAggOperatorInfo(SOperatorInfo* downstream, SPhys pInfo->dataVersion = 0; pInfo->historyWins = taosArrayInit(4, sizeof(SSessionKey)); if (!pInfo->historyWins) { - goto _error; + code = TSDB_CODE_OUT_OF_MEMORY; + TSDB_CHECK_CODE(code, lino, _error); } pInfo->pCheckpointRes = createSpecialDataBlock(STREAM_CHECKPOINT); @@ -735,8 +733,12 @@ SOperatorInfo* createStreamCountAggOperatorInfo(SOperatorInfo* downstream, SPhys setOperatorStreamStateFn(pOperator, streamCountReleaseState, streamCountReloadState); if (downstream) { - initDownStream(downstream, &pInfo->streamAggSup, pOperator->operatorType, pInfo->primaryTsIndex, &pInfo->twAggSup, &pInfo->basic); + code = initDownStream(downstream, &pInfo->streamAggSup, pOperator->operatorType, pInfo->primaryTsIndex, + &pInfo->twAggSup, &pInfo->basic); + TSDB_CHECK_CODE(code, lino, _error); + code = appendDownstream(pOperator, &downstream, 1); + TSDB_CHECK_CODE(code, lino, _error); } return pOperator; @@ -747,6 +749,6 @@ _error: taosMemoryFreeClear(pOperator); pTaskInfo->code = code; + qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); return NULL; } - diff --git a/source/libs/executor/src/streameventwindowoperator.c b/source/libs/executor/src/streameventwindowoperator.c index 1809d0cc67..e6ff4fe242 100644 --- a/source/libs/executor/src/streameventwindowoperator.c +++ b/source/libs/executor/src/streameventwindowoperator.c @@ -28,9 +28,9 @@ #include "tlog.h" #include "ttime.h" -#define IS_NORMAL_EVENT_OP(op) ((op)->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_EVENT) -#define STREAM_EVENT_OP_STATE_NAME "StreamEventHistoryState" -#define STREAM_EVENT_OP_CHECKPOINT_NAME "StreamEventOperator_Checkpoint" +#define IS_NORMAL_EVENT_OP(op) ((op)->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_EVENT) +#define STREAM_EVENT_OP_STATE_NAME "StreamEventHistoryState" +#define STREAM_EVENT_OP_CHECKPOINT_NAME "StreamEventOperator_Checkpoint" typedef struct SEventWinfowFlag { bool startFlag; @@ -86,10 +86,11 @@ void destroyStreamEventOperatorInfo(void* param) { void setEventWindowFlag(SStreamAggSupporter* pAggSup, SEventWindowInfo* pWinInfo) { char* pFlagInfo = (char*)pWinInfo->winInfo.pStatePos->pRowBuff + (pAggSup->resultRowSize - pAggSup->stateKeySize); - pWinInfo->pWinFlag = (SEventWinfowFlag*) pFlagInfo; + pWinInfo->pWinFlag = (SEventWinfowFlag*)pFlagInfo; } -void setEventWindowInfo(SStreamAggSupporter* pAggSup, SSessionKey* pKey, SRowBuffPos* pPos, SEventWindowInfo* pWinInfo) { +void setEventWindowInfo(SStreamAggSupporter* pAggSup, SSessionKey* pKey, SRowBuffPos* pPos, + SEventWindowInfo* pWinInfo) { pWinInfo->winInfo.sessionWin = *pKey; pWinInfo->winInfo.pStatePos = pPos; setEventWindowFlag(pAggSup, pWinInfo); @@ -122,22 +123,23 @@ void setEventOutputBuf(SStreamAggSupporter* pAggSup, TSKEY* pTs, uint64_t groupI pCurWin->winInfo.sessionWin.groupId = groupId; pCurWin->winInfo.sessionWin.win.skey = ts; pCurWin->winInfo.sessionWin.win.ekey = ts; - SStreamStateCur* pCur = pAggSup->stateStore.streamStateSessionSeekKeyCurrentPrev(pAggSup->pState, &pCurWin->winInfo.sessionWin); - SSessionKey leftWinKey = {.groupId = groupId}; - void* pVal = NULL; - int32_t len = 0; + SStreamStateCur* pCur = + pAggSup->stateStore.streamStateSessionSeekKeyCurrentPrev(pAggSup->pState, &pCurWin->winInfo.sessionWin); + SSessionKey leftWinKey = {.groupId = groupId}; + void* pVal = NULL; + int32_t len = 0; code = pAggSup->stateStore.streamStateSessionGetKVByCur(pCur, &leftWinKey, &pVal, &len); - if (code == TSDB_CODE_SUCCESS && inWinRange(&pAggSup->winRange, &leftWinKey.win) ) { + if (code == TSDB_CODE_SUCCESS && inWinRange(&pAggSup->winRange, &leftWinKey.win)) { bool inWin = isInTimeWindow(&leftWinKey.win, ts, 0); setEventWindowInfo(pAggSup, &leftWinKey, pVal, pCurWin); - if(inWin || (pCurWin->pWinFlag->startFlag && !pCurWin->pWinFlag->endFlag) ) { + if (inWin || (pCurWin->pWinFlag->startFlag && !pCurWin->pWinFlag->endFlag)) { pCurWin->winInfo.isOutput = !isWindowIncomplete(pCurWin); goto _end; } } pAggSup->stateStore.streamStateFreeCur(pCur); pCur = pAggSup->stateStore.streamStateSessionSeekKeyNext(pAggSup->pState, &pCurWin->winInfo.sessionWin); - SSessionKey rightWinKey = {.groupId = groupId}; + SSessionKey rightWinKey = {.groupId = groupId}; code = pAggSup->stateStore.streamStateSessionGetKVByCur(pCur, &rightWinKey, &pVal, &len); bool inWin = isInTimeWindow(&rightWinKey.win, ts, 0); if (code == TSDB_CODE_SUCCESS && inWinRange(&pAggSup->winRange, &rightWinKey.win) && (inWin || (start && !end))) { @@ -149,7 +151,7 @@ void setEventOutputBuf(SStreamAggSupporter* pAggSup, TSKEY* pTs, uint64_t groupI } } - SSessionKey winKey = {.win.skey = ts, .win.ekey = ts, .groupId = groupId}; + SSessionKey winKey = {.win.skey = ts, .win.ekey = ts, .groupId = groupId}; pAggSup->stateStore.streamStateSessionAllocWinBuffByNextPosition(pAggSup->pState, pCur, &winKey, &pVal, &len); setEventWindowInfo(pAggSup, &winKey, pVal, pCurWin); pCurWin->pWinFlag->startFlag = start; @@ -164,7 +166,7 @@ _end: if (code != TSDB_CODE_SUCCESS) { SET_SESSION_WIN_KEY_INVALID(pNextWinKey); } - if(pCurWin->winInfo.pStatePos->needFree) { + if (pCurWin->winInfo.pStatePos->needFree) { pAggSup->stateStore.streamStateSessionDel(pAggSup->pState, &pCurWin->winInfo.sessionWin); } pAggSup->stateStore.streamStateFreeCur(pCur); @@ -173,14 +175,14 @@ _end: } int32_t updateEventWindowInfo(SStreamAggSupporter* pAggSup, SEventWindowInfo* pWinInfo, SSessionKey* pNextWinKey, - TSKEY* pTsData, bool* starts, bool* ends, int32_t rows, int32_t start, SSHashObj* pResultRows, - SSHashObj* pStUpdated, SSHashObj* pStDeleted, bool* pRebuild) { + TSKEY* pTsData, bool* starts, bool* ends, int32_t rows, int32_t start, + SSHashObj* pResultRows, SSHashObj* pStUpdated, SSHashObj* pStDeleted, bool* pRebuild) { *pRebuild = false; - if (!pWinInfo->pWinFlag->startFlag && !(starts[start]) ) { + if (!pWinInfo->pWinFlag->startFlag && !(starts[start])) { return 1; } - TSKEY maxTs = INT64_MAX; + TSKEY maxTs = INT64_MAX; STimeWindow* pWin = &pWinInfo->winInfo.sessionWin.win; if (pWinInfo->pWinFlag->endFlag) { maxTs = pWin->ekey + 1; @@ -219,7 +221,7 @@ int32_t updateEventWindowInfo(SStreamAggSupporter* pAggSup, SEventWindowInfo* pW memcpy(pWinInfo->winInfo.pStatePos->pKey, &pWinInfo->winInfo.sessionWin, sizeof(SSessionKey)); if (ends[i]) { - if (pWinInfo->pWinFlag->endFlag && pWin->skey <= pTsData[i] && pTsData[i] < pWin->ekey ) { + if (pWinInfo->pWinFlag->endFlag && pWin->skey <= pTsData[i] && pTsData[i] < pWin->ekey) { *pRebuild = true; } return i + 1 - start; @@ -230,26 +232,28 @@ int32_t updateEventWindowInfo(SStreamAggSupporter* pAggSup, SEventWindowInfo* pW static int32_t compactEventWindow(SOperatorInfo* pOperator, SEventWindowInfo* pCurWin, SSHashObj* pStUpdated, SSHashObj* pStDeleted, bool addGap) { - SExprSupp* pSup = &pOperator->exprSupp; - SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; - SStorageAPI* pAPI = &pOperator->pTaskInfo->storageAPI; - int32_t winNum = 0; - SStreamEventAggOperatorInfo* pInfo = pOperator->info; - SResultRow* pCurResult = NULL; - int32_t numOfOutput = pOperator->exprSupp.numOfExprs; - SStreamAggSupporter* pAggSup = &pInfo->streamAggSup; + SExprSupp* pSup = &pOperator->exprSupp; + SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; + SStorageAPI* pAPI = &pOperator->pTaskInfo->storageAPI; + int32_t winNum = 0; + SStreamEventAggOperatorInfo* pInfo = pOperator->info; + SResultRow* pCurResult = NULL; + int32_t numOfOutput = pOperator->exprSupp.numOfExprs; + SStreamAggSupporter* pAggSup = &pInfo->streamAggSup; while (1) { if (!pCurWin->pWinFlag->startFlag || pCurWin->pWinFlag->endFlag) { break; } SEventWindowInfo nextWinInfo = {0}; getNextSessionWinInfo(pAggSup, pStUpdated, &pCurWin->winInfo, &nextWinInfo.winInfo); - if (!IS_VALID_SESSION_WIN(nextWinInfo.winInfo) || !inWinRange(&pAggSup->winRange, &nextWinInfo.winInfo.sessionWin.win)) { + if (!IS_VALID_SESSION_WIN(nextWinInfo.winInfo) || + !inWinRange(&pAggSup->winRange, &nextWinInfo.winInfo.sessionWin.win)) { releaseOutputBuf(pAggSup->pState, nextWinInfo.winInfo.pStatePos, &pAggSup->pSessionAPI->stateStore); break; } setEventWindowFlag(pAggSup, &nextWinInfo); - compactTimeWindow(pSup, pAggSup, &pInfo->twAggSup, pTaskInfo, &pCurWin->winInfo, &nextWinInfo.winInfo, pStUpdated, pStDeleted, false); + compactTimeWindow(pSup, pAggSup, &pInfo->twAggSup, pTaskInfo, &pCurWin->winInfo, &nextWinInfo.winInfo, pStUpdated, + pStDeleted, false); pCurWin->pWinFlag->endFlag = nextWinInfo.pWinFlag->endFlag; winNum++; } @@ -275,7 +279,7 @@ static void doStreamEventAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSDataBl int32_t winRows = 0; SStreamAggSupporter* pAggSup = &pInfo->streamAggSup; SColumnInfoData* pColStart = NULL; - SColumnInfoData* pColEnd = NULL; + SColumnInfoData* pColEnd = NULL; pInfo->dataVersion = TMAX(pInfo->dataVersion, pSDataBlock->info.version); pAggSup->winRange = pTaskInfo->streamInfo.fillHistoryWindow; @@ -290,7 +294,8 @@ static void doStreamEventAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSDataBl return; } - SFilterColumnParam paramStart = {.numOfCols = taosArrayGetSize(pSDataBlock->pDataBlock), .pDataBlock = pSDataBlock->pDataBlock}; + SFilterColumnParam paramStart = {.numOfCols = taosArrayGetSize(pSDataBlock->pDataBlock), + .pDataBlock = pSDataBlock->pDataBlock}; code = filterSetDataFromSlotId(pInfo->pStartCondInfo, ¶mStart); if (code != TSDB_CODE_SUCCESS) { qError("set data from start slotId error."); @@ -299,7 +304,8 @@ static void doStreamEventAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSDataBl int32_t statusStart = 0; filterExecute(pInfo->pStartCondInfo, pSDataBlock, &pColStart, NULL, paramStart.numOfCols, &statusStart); - SFilterColumnParam paramEnd = {.numOfCols = taosArrayGetSize(pSDataBlock->pDataBlock), .pDataBlock = pSDataBlock->pDataBlock}; + SFilterColumnParam paramEnd = {.numOfCols = taosArrayGetSize(pSDataBlock->pDataBlock), + .pDataBlock = pSDataBlock->pDataBlock}; code = filterSetDataFromSlotId(pInfo->pEndCondInfo, ¶mEnd); if (code != TSDB_CODE_SUCCESS) { qError("set data from end slotId error."); @@ -320,20 +326,23 @@ static void doStreamEventAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSDataBl int32_t winIndex = 0; bool allEqual = true; SEventWindowInfo curWin = {0}; - SSessionKey nextWinKey = {0}; - setEventOutputBuf(pAggSup, tsCols, groupId, (bool*)pColStart->pData, (bool*)pColEnd->pData, i, rows, &curWin, &nextWinKey); + SSessionKey nextWinKey = {0}; + setEventOutputBuf(pAggSup, tsCols, groupId, (bool*)pColStart->pData, (bool*)pColEnd->pData, i, rows, &curWin, + &nextWinKey); setSessionWinOutputInfo(pSeUpdated, &curWin.winInfo); bool rebuild = false; - winRows = updateEventWindowInfo(pAggSup, &curWin, &nextWinKey, tsCols, (bool*)pColStart->pData, (bool*)pColEnd->pData, rows, i, - pAggSup->pResultRows, pSeUpdated, pStDeleted, &rebuild); + winRows = + updateEventWindowInfo(pAggSup, &curWin, &nextWinKey, tsCols, (bool*)pColStart->pData, (bool*)pColEnd->pData, + rows, i, pAggSup->pResultRows, pSeUpdated, pStDeleted, &rebuild); ASSERT(winRows >= 1); if (rebuild) { uint64_t uid = 0; appendDataToSpecialBlock(pAggSup->pScanBlock, &curWin.winInfo.sessionWin.win.skey, - &curWin.winInfo.sessionWin.win.ekey, &uid, &groupId, NULL); + &curWin.winInfo.sessionWin.win.ekey, &uid, &groupId, NULL); tSimpleHashRemove(pSeUpdated, &curWin.winInfo.sessionWin, sizeof(SSessionKey)); doDeleteEventWindow(pAggSup, pSeUpdated, &curWin.winInfo.sessionWin); - if (pInfo->destHasPrimaryKey && curWin.winInfo.isOutput && IS_NORMAL_EVENT_OP(pOperator) && !isWindowIncomplete(&curWin)) { + if (pInfo->destHasPrimaryKey && curWin.winInfo.isOutput && IS_NORMAL_EVENT_OP(pOperator) && + !isWindowIncomplete(&curWin)) { saveDeleteRes(pInfo->pPkDeleted, curWin.winInfo.sessionWin); } releaseOutputBuf(pAggSup->pState, curWin.winInfo.pStatePos, &pAPI->stateStore); @@ -603,7 +612,8 @@ void streamEventReleaseState(SOperatorInfo* pOperator) { char* pBuff = taosMemoryCalloc(1, resSize); memcpy(pBuff, pInfo->historyWins->pData, winSize); memcpy(pBuff + winSize, &pInfo->twAggSup.maxTs, sizeof(TSKEY)); - qDebug("===stream=== event window operator relase state. save result count:%d", (int32_t)taosArrayGetSize(pInfo->historyWins)); + qDebug("===stream=== event window operator relase state. save result count:%d", + (int32_t)taosArrayGetSize(pInfo->historyWins)); pInfo->streamAggSup.stateStore.streamStateSaveInfo(pInfo->streamAggSup.pState, STREAM_EVENT_OP_STATE_NAME, strlen(STREAM_EVENT_OP_STATE_NAME), pBuff, resSize); pInfo->streamAggSup.stateStore.streamStateCommit(pInfo->streamAggSup.pState); @@ -647,7 +657,7 @@ void streamEventReloadState(SOperatorInfo* pOperator) { qDebug("===stream=== reload state. try process result %" PRId64 ", %" PRIu64 ", index:%d", pSeKeyBuf[i].win.skey, pSeKeyBuf[i].groupId, i); getSessionWindowInfoByKey(pAggSup, pSeKeyBuf + i, &curInfo.winInfo); - //event window has been deleted + // event window has been deleted if (!IS_VALID_SESSION_WIN(curInfo.winInfo)) { continue; } @@ -659,7 +669,7 @@ void streamEventReloadState(SOperatorInfo* pOperator) { compactEventWindow(pOperator, &curInfo, pInfo->pSeUpdated, pInfo->pSeDeleted, false); qDebug("===stream=== reload state. save result %" PRId64 ", %" PRIu64, curInfo.winInfo.sessionWin.win.skey, - curInfo.winInfo.sessionWin.groupId); + curInfo.winInfo.sessionWin.groupId); if (IS_VALID_SESSION_WIN(curInfo.winInfo)) { saveSessionOutputBuf(pAggSup, &curInfo.winInfo); } @@ -693,6 +703,7 @@ SOperatorInfo* createStreamEventAggOperatorInfo(SOperatorInfo* downstream, SPhys SStreamEventWinodwPhysiNode* pEventNode = (SStreamEventWinodwPhysiNode*)pPhyNode; int32_t tsSlotId = ((SColumnNode*)pEventNode->window.pTspk)->slotId; int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; SStreamEventAggOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SStreamEventAggOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); if (pInfo == NULL || pOperator == NULL) { @@ -783,20 +794,18 @@ SOperatorInfo* createStreamEventAggOperatorInfo(SOperatorInfo* downstream, SPhys pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, doStreamEventAgg, NULL, destroyStreamEventOperatorInfo, optrDefaultBufFn, NULL, optrDefaultGetNextExtFn, NULL); setOperatorStreamStateFn(pOperator, streamEventReleaseState, streamEventReloadState); - initDownStream(downstream, &pInfo->streamAggSup, pOperator->operatorType, pInfo->primaryTsIndex, &pInfo->twAggSup, &pInfo->basic); + code = initDownStream(downstream, &pInfo->streamAggSup, pOperator->operatorType, pInfo->primaryTsIndex, + &pInfo->twAggSup, &pInfo->basic); + TSDB_CHECK_CODE(code, lino, _error); + code = appendDownstream(pOperator, &downstream, 1); - if (code != TSDB_CODE_SUCCESS) { - goto _error; - } + TSDB_CHECK_CODE(code, lino, _error); code = filterInitFromNode((SNode*)pEventNode->pStartCond, &pInfo->pStartCondInfo, 0); - if (code != TSDB_CODE_SUCCESS) { - goto _error; - } + TSDB_CHECK_CODE(code, lino, _error); + code = filterInitFromNode((SNode*)pEventNode->pEndCond, &pInfo->pEndCondInfo, 0); - if (code != TSDB_CODE_SUCCESS) { - goto _error; - } + TSDB_CHECK_CODE(code, lino, _error); return pOperator; @@ -804,5 +813,6 @@ _error: destroyStreamEventOperatorInfo(pInfo); taosMemoryFreeClear(pOperator); pTaskInfo->code = code; + qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); return NULL; } diff --git a/source/libs/executor/src/streamfilloperator.c b/source/libs/executor/src/streamfilloperator.c index c1a38b66ba..5f188c2c8a 100644 --- a/source/libs/executor/src/streamfilloperator.c +++ b/source/libs/executor/src/streamfilloperator.c @@ -129,7 +129,8 @@ static void destroyStreamFillOperatorInfo(void* param) { pInfo->pRes = blockDataDestroy(pInfo->pRes); pInfo->pSrcBlock = blockDataDestroy(pInfo->pSrcBlock); pInfo->pDelRes = blockDataDestroy(pInfo->pDelRes); - pInfo->matchInfo.pList = taosArrayDestroy(pInfo->matchInfo.pList); + taosArrayDestroy(pInfo->matchInfo.pList); + pInfo->matchInfo.pList = NULL; taosMemoryFree(pInfo); } diff --git a/source/libs/executor/src/streamtimewindowoperator.c b/source/libs/executor/src/streamtimewindowoperator.c index d68108b9a5..96c6712866 100644 --- a/source/libs/executor/src/streamtimewindowoperator.c +++ b/source/libs/executor/src/streamtimewindowoperator.c @@ -28,14 +28,18 @@ #include "tlog.h" #include "ttime.h" -#define IS_FINAL_INTERVAL_OP(op) ((op)->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL) -#define IS_MID_INTERVAL_OP(op) ((op)->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_MID_INTERVAL) -#define IS_NORMAL_INTERVAL_OP(op) ((op)->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL || (op)->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL) +#define IS_FINAL_INTERVAL_OP(op) ((op)->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL) +#define IS_MID_INTERVAL_OP(op) ((op)->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_MID_INTERVAL) +#define IS_NORMAL_INTERVAL_OP(op) \ + ((op)->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL || \ + (op)->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL) -#define IS_FINAL_SESSION_OP(op) ((op)->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_SESSION) -#define IS_NORMAL_SESSION_OP(op) ((op)->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_SESSION || (op)->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_SESSION) +#define IS_FINAL_SESSION_OP(op) ((op)->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_SESSION) +#define IS_NORMAL_SESSION_OP(op) \ + ((op)->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_SESSION || \ + (op)->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_SESSION) -#define IS_NORMAL_STATE_OP(op) ((op)->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_STATE) +#define IS_NORMAL_STATE_OP(op) ((op)->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_STATE) #define DEAULT_DELETE_MARK INT64_MAX #define STREAM_INTERVAL_OP_STATE_NAME "StreamIntervalHistoryState" @@ -263,14 +267,16 @@ static void doDeleteWindows(SOperatorInfo* pOperator, SInterval* pInterval, SSDa if (chIds) { int32_t childId = getChildIndex(pBlock); if (pInvalidWins) { - qDebug("===stream===save invalid delete window:%" PRId64 ",groupId:%" PRId64 ",chId:%d", winRes.ts, winRes.groupId, childId); + qDebug("===stream===save invalid delete window:%" PRId64 ",groupId:%" PRId64 ",chId:%d", winRes.ts, + winRes.groupId, childId); taosHashPut(pInvalidWins, &winRes, sizeof(SWinKey), NULL, 0); } SArray* chArray = *(void**)chIds; int32_t index = taosArraySearchIdx(chArray, &childId, compareInt32Val, TD_EQ); if (index != -1) { - qDebug("===stream===try push delete window:%" PRId64 ",groupId:%" PRId64 ",chId:%d ,continue", win.skey, winGpId, childId); + qDebug("===stream===try push delete window:%" PRId64 ",groupId:%" PRId64 ",chId:%d ,continue", win.skey, + winGpId, childId); getNextTimeWindow(pInterval, &win, TSDB_ORDER_ASC); continue; } @@ -390,7 +396,7 @@ static void doBuildDeleteResult(SStreamIntervalOperatorInfo* pInfo, SArray* pWin } void destroyFlusedPos(void* pRes) { - SRowBuffPos* pPos = (SRowBuffPos*) pRes; + SRowBuffPos* pPos = (SRowBuffPos*)pRes; if (!pPos->needFree && !pPos->pRowBuff) { taosMemoryFreeClear(pPos->pKey); taosMemoryFree(pPos); @@ -406,7 +412,8 @@ void clearGroupResInfo(SGroupResInfo* pGroupResInfo) { } pGroupResInfo->freeItem = false; } - pGroupResInfo->pRows = taosArrayDestroy(pGroupResInfo->pRows); + taosArrayDestroy(pGroupResInfo->pRows); + pGroupResInfo->pRows = NULL; pGroupResInfo->index = 0; } @@ -487,8 +494,11 @@ void initIntervalDownStream(SOperatorInfo* downstream, uint16_t type, SStreamInt pScanInfo->windowSup.parentType = type; pScanInfo->windowSup.pIntervalAggSup = &pInfo->aggSup; if (!pScanInfo->pUpdateInfo) { - pScanInfo->pUpdateInfo = - pAPI->updateInfoInitP(&pInfo->interval, pInfo->twAggSup.waterMark, pScanInfo->igCheckUpdate, pScanInfo->pkColType, pScanInfo->pkColLen); + int32_t code = pAPI->updateInfoInitP(&pInfo->interval, pInfo->twAggSup.waterMark, pScanInfo->igCheckUpdate, + pScanInfo->pkColType, pScanInfo->pkColLen, &pScanInfo->pUpdateInfo); + if (code != TSDB_CODE_SUCCESS) { + qError("%s failed at %d since %s", __func__, __LINE__, tstrerror(code)); + } } pScanInfo->interval = pInfo->interval; @@ -623,17 +633,17 @@ static void doBuildPullDataBlock(SArray* array, int32_t* pIndex, SSDataBlock* pB blockDataUpdateTsWindow(pBlock, 0); } -static bool processPullOver(SSDataBlock* pBlock, SHashObj* pMap, SHashObj* pFinalMap, SInterval* pInterval, SArray* pPullWins, - int32_t numOfCh, SOperatorInfo* pOperator) { +static bool processPullOver(SSDataBlock* pBlock, SHashObj* pMap, SHashObj* pFinalMap, SInterval* pInterval, + SArray* pPullWins, int32_t numOfCh, SOperatorInfo* pOperator) { SStreamIntervalOperatorInfo* pInfo = pOperator->info; - SColumnInfoData* pStartCol = taosArrayGet(pBlock->pDataBlock, CALCULATE_START_TS_COLUMN_INDEX); - TSKEY* tsData = (TSKEY*)pStartCol->pData; - SColumnInfoData* pEndCol = taosArrayGet(pBlock->pDataBlock, CALCULATE_END_TS_COLUMN_INDEX); - TSKEY* tsEndData = (TSKEY*)pEndCol->pData; - SColumnInfoData* pGroupCol = taosArrayGet(pBlock->pDataBlock, GROUPID_COLUMN_INDEX); - uint64_t* groupIdData = (uint64_t*)pGroupCol->pData; - int32_t chId = getChildIndex(pBlock); - bool res = false; + SColumnInfoData* pStartCol = taosArrayGet(pBlock->pDataBlock, CALCULATE_START_TS_COLUMN_INDEX); + TSKEY* tsData = (TSKEY*)pStartCol->pData; + SColumnInfoData* pEndCol = taosArrayGet(pBlock->pDataBlock, CALCULATE_END_TS_COLUMN_INDEX); + TSKEY* tsEndData = (TSKEY*)pEndCol->pData; + SColumnInfoData* pGroupCol = taosArrayGet(pBlock->pDataBlock, GROUPID_COLUMN_INDEX); + uint64_t* groupIdData = (uint64_t*)pGroupCol->pData; + int32_t chId = getChildIndex(pBlock); + bool res = false; for (int32_t i = 0; i < pBlock->info.rows; i++) { TSKEY winTs = tsData[i]; while (winTs <= tsEndData[i]) { @@ -649,7 +659,7 @@ static bool processPullOver(SSDataBlock* pBlock, SHashObj* pMap, SHashObj* pFina // pull data is over taosArrayDestroy(chArray); taosHashRemove(pMap, &winRes, sizeof(SWinKey)); - res =true; + res = true; qDebug("===stream===retrive pull data over.window %" PRId64, winRes.ts); void* pFinalCh = taosHashGet(pFinalMap, &winRes, sizeof(SWinKey)); @@ -662,7 +672,8 @@ static bool processPullOver(SSDataBlock* pBlock, SHashObj* pMap, SHashObj* pFina .calWin.skey = nextWin.skey, .calWin.ekey = nextWin.skey}; // add pull data request - qDebug("===stream===prepare final retrive for delete window:%" PRId64 ",groupId:%" PRId64 ", size:%d", winRes.ts, winRes.groupId, numOfCh); + qDebug("===stream===prepare final retrive for delete window:%" PRId64 ",groupId:%" PRId64 ", size:%d", + winRes.ts, winRes.groupId, numOfCh); if (IS_MID_INTERVAL_OP(pOperator)) { SStreamIntervalOperatorInfo* pInfo = (SStreamIntervalOperatorInfo*)pOperator->info; taosArrayPush(pInfo->pMidPullDatas, &winRes); @@ -670,7 +681,7 @@ static bool processPullOver(SSDataBlock* pBlock, SHashObj* pMap, SHashObj* pFina taosArrayPush(pInfo->pDelWins, &winRes); addPullWindow(pMap, &winRes, numOfCh); if (pInfo->destHasPrimaryKey) { - tSimpleHashPut(pInfo->pDeletedMap,&winRes, sizeof(SWinKey), NULL, 0); + tSimpleHashPut(pInfo->pDeletedMap, &winRes, sizeof(SWinKey), NULL, 0); } qDebug("===stream===prepare final retrive for delete %" PRId64 ", size:%d", winRes.ts, numOfCh); } @@ -689,7 +700,7 @@ static void addRetriveWindow(SArray* wins, SStreamIntervalOperatorInfo* pInfo, i for (int32_t i = 0; i < size; i++) { SWinKey* winKey = taosArrayGet(wins, i); STimeWindow nextWin = getFinalTimeWindow(winKey->ts, &pInfo->interval); - void* chIds = taosHashGet(pInfo->pPullDataMap, winKey, sizeof(SWinKey)); + void* chIds = taosHashGet(pInfo->pPullDataMap, winKey, sizeof(SWinKey)); if (!chIds) { SPullWindowInfo pull = { .window = nextWin, .groupId = winKey->groupId, .calWin.skey = nextWin.skey, .calWin.ekey = nextWin.skey}; @@ -697,7 +708,7 @@ static void addRetriveWindow(SArray* wins, SStreamIntervalOperatorInfo* pInfo, i if (savePullWindow(&pull, pInfo->pPullWins) == TSDB_CODE_SUCCESS) { addPullWindow(pInfo->pPullDataMap, winKey, pInfo->numOfChild); if (pInfo->destHasPrimaryKey) { - tSimpleHashPut(pInfo->pDeletedMap,winKey, sizeof(SWinKey), NULL, 0); + tSimpleHashPut(pInfo->pDeletedMap, winKey, sizeof(SWinKey), NULL, 0); } qDebug("===stream===prepare retrive for delete %" PRId64 ", size:%d", winKey->ts, pInfo->numOfChild); } @@ -750,7 +761,8 @@ int32_t buildDataBlockFromGroupRes(SOperatorInfo* pOperator, void* pState, SSDat if (pBlock->info.id.groupId == 0) { pBlock->info.id.groupId = groupId; void* tbname = NULL; - if (pAPI->stateStore.streamStateGetParName(pTaskInfo->streamInfo.pState, pBlock->info.id.groupId, &tbname, false) < 0) { + if (pAPI->stateStore.streamStateGetParName(pTaskInfo->streamInfo.pState, pBlock->info.id.groupId, &tbname, + false) < 0) { pBlock->info.parTbName[0] = 0; } else { memcpy(pBlock->info.parTbName, tbname, TSDB_TABLE_NAME_LEN); @@ -828,9 +840,7 @@ static int32_t getNextQualifiedFinalWindow(SInterval* pInterval, STimeWindow* pN return startPos; } -bool hasSrcPrimaryKeyCol(SSteamOpBasicInfo* pInfo) { - return pInfo->primaryPkIndex != -1; -} +bool hasSrcPrimaryKeyCol(SSteamOpBasicInfo* pInfo) { return pInfo->primaryPkIndex != -1; } static void doStreamIntervalAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSDataBlock, uint64_t groupId, SSHashObj* pUpdatedMap, SSHashObj* pDeletedMap) { @@ -851,23 +861,22 @@ static void doStreamIntervalAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSDat SColumnInfoData* pColDataInfo = taosArrayGet(pSDataBlock->pDataBlock, pInfo->primaryTsIndex); tsCols = (int64_t*)pColDataInfo->pData; - void* pPkVal = NULL; - int32_t pkLen = 0; + void* pPkVal = NULL; + int32_t pkLen = 0; SColumnInfoData* pPkColDataInfo = NULL; if (hasSrcPrimaryKeyCol(&pInfo->basic)) { pPkColDataInfo = taosArrayGet(pSDataBlock->pDataBlock, pInfo->basic.primaryPkIndex); } if (pSDataBlock->info.window.skey != tsCols[0] || pSDataBlock->info.window.ekey != tsCols[endRowId]) { - qError("table uid %" PRIu64 " data block timestamp range may not be calculated! minKey %" PRId64 - ",maxKey %" PRId64, - pSDataBlock->info.id.uid, pSDataBlock->info.window.skey, pSDataBlock->info.window.ekey); + qError("table uid %" PRIu64 " data block timestamp range may not be calculated! minKey %" PRId64 ",maxKey %" PRId64, + pSDataBlock->info.id.uid, pSDataBlock->info.window.skey, pSDataBlock->info.window.ekey); blockDataUpdateTsWindow(pSDataBlock, pInfo->primaryTsIndex); // timestamp of the data is incorrect if (pSDataBlock->info.window.skey <= 0 || pSDataBlock->info.window.ekey <= 0) { qError("table uid %" PRIu64 " data block timestamp is out of range! minKey %" PRId64 ",maxKey %" PRId64, - pSDataBlock->info.id.uid, pSDataBlock->info.window.skey, pSDataBlock->info.window.ekey); + pSDataBlock->info.id.uid, pSDataBlock->info.window.skey, pSDataBlock->info.window.ekey); } } @@ -915,7 +924,7 @@ static void doStreamIntervalAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSDat if (savePullWindow(&pull, pInfo->pPullWins) == TSDB_CODE_SUCCESS) { addPullWindow(pInfo->pPullDataMap, &winRes, pInfo->numOfChild); if (pInfo->destHasPrimaryKey) { - tSimpleHashPut(pInfo->pDeletedMap,&winRes, sizeof(SWinKey), NULL, 0); + tSimpleHashPut(pInfo->pDeletedMap, &winRes, sizeof(SWinKey), NULL, 0); } } } else { @@ -961,7 +970,7 @@ static void doStreamIntervalAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSDat }; if (pInfo->destHasPrimaryKey && code == TSDB_CODE_SUCCESS && IS_NORMAL_INTERVAL_OP(pOperator)) { - tSimpleHashPut(pDeletedMap,&key, sizeof(SWinKey), NULL, 0); + tSimpleHashPut(pDeletedMap, &key, sizeof(SWinKey), NULL, 0); } if (pInfo->twAggSup.calTrigger == STREAM_TRIGGER_AT_ONCE && pUpdatedMap) { @@ -1364,7 +1373,7 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) { pInfo->binfo.pRes->info.type = pBlock->info.type; } else if (pBlock->info.type == STREAM_DELETE_DATA || pBlock->info.type == STREAM_DELETE_RESULT || pBlock->info.type == STREAM_CLEAR) { - SArray* delWins = taosArrayInit(8, sizeof(SWinKey)); + SArray* delWins = taosArrayInit(8, sizeof(SWinKey)); SHashObj* finalMap = IS_FINAL_INTERVAL_OP(pOperator) ? pInfo->pFinalPullDataMap : NULL; doDeleteWindows(pOperator, &pInfo->interval, pBlock, delWins, pInfo->pUpdatedMap, finalMap); if (IS_FINAL_INTERVAL_OP(pOperator)) { @@ -1398,7 +1407,7 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) { getAllIntervalWindow(pInfo->aggSup.pResultRowHashTable, pInfo->pUpdatedMap); continue; } else if (pBlock->info.type == STREAM_RETRIEVE) { - if(!IS_FINAL_INTERVAL_OP(pOperator)) { + if (!IS_FINAL_INTERVAL_OP(pOperator)) { pInfo->recvRetrive = true; copyDataBlock(pInfo->pMidRetriveRes, pBlock); pInfo->pMidRetriveRes->info.type = STREAM_MID_RETRIEVE; @@ -1524,8 +1533,8 @@ void streamIntervalReloadState(SOperatorInfo* pOperator) { SStreamIntervalOperatorInfo* pInfo = pOperator->info; if (pOperator->operatorType != QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL && pOperator->operatorType != QUERY_NODE_PHYSICAL_PLAN_STREAM_MID_INTERVAL) { - int32_t size = 0; - void* pBuf = NULL; + int32_t size = 0; + void* pBuf = NULL; int32_t code = pInfo->stateStore.streamStateGetInfo(pInfo->pState, STREAM_INTERVAL_OP_STATE_NAME, strlen(STREAM_INTERVAL_OP_STATE_NAME), &pBuf, &size); if (code == 0) { @@ -1599,7 +1608,7 @@ SOperatorInfo* createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream, pAPI->stateStore.streamStateSetNumber(pInfo->pState, -1, pInfo->primaryTsIndex); code = initAggSup(&pOperator->exprSupp, &pInfo->aggSup, pExprInfo, numOfCols, keyBufSize, pTaskInfo->id.str, - pInfo->pState, &pTaskInfo->storageAPI.functionStore); + pInfo->pState, &pTaskInfo->storageAPI.functionStore); if (code != TSDB_CODE_SUCCESS) { goto _error; } @@ -1754,27 +1763,37 @@ void initDummyFunction(SqlFunctionCtx* pDummy, SqlFunctionCtx* pCtx, int32_t num } } -void initDownStream(SOperatorInfo* downstream, SStreamAggSupporter* pAggSup, uint16_t type, int32_t tsColIndex, - STimeWindowAggSupp* pTwSup, struct SSteamOpBasicInfo* pBasic) { +int32_t initDownStream(SOperatorInfo* downstream, SStreamAggSupporter* pAggSup, uint16_t type, int32_t tsColIndex, + STimeWindowAggSupp* pTwSup, struct SSteamOpBasicInfo* pBasic) { + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; if (downstream->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_PARTITION) { SStreamPartitionOperatorInfo* pScanInfo = downstream->info; pScanInfo->tsColIndex = tsColIndex; } if (downstream->operatorType != QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) { - initDownStream(downstream->pDownstream[0], pAggSup, type, tsColIndex, pTwSup, pBasic); - return; + code = initDownStream(downstream->pDownstream[0], pAggSup, type, tsColIndex, pTwSup, pBasic); + return code; } SStreamScanInfo* pScanInfo = downstream->info; pScanInfo->windowSup = (SWindowSupporter){.pStreamAggSup = pAggSup, .gap = pAggSup->gap, .parentType = type}; pScanInfo->pState = pAggSup->pState; if (!pScanInfo->pUpdateInfo) { - pScanInfo->pUpdateInfo = pAggSup->stateStore.updateInfoInit(60000, TSDB_TIME_PRECISION_MILLI, pTwSup->waterMark, - pScanInfo->igCheckUpdate, pScanInfo->pkColType, pScanInfo->pkColLen); + code = pAggSup->stateStore.updateInfoInit(60000, TSDB_TIME_PRECISION_MILLI, pTwSup->waterMark, + pScanInfo->igCheckUpdate, pScanInfo->pkColType, pScanInfo->pkColLen, + &pScanInfo->pUpdateInfo); + TSDB_CHECK_CODE(code, lino, _end); } pScanInfo->twAggSup = *pTwSup; pAggSup->pUpdateInfo = pScanInfo->pUpdateInfo; pBasic->primaryPkIndex = pScanInfo->primaryKeyIndex; + +_end: + if (code != TSDB_CODE_SUCCESS) { + qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } + return code; } static TSKEY sesionTs(void* pKey) { @@ -2147,8 +2166,8 @@ static void doStreamSessionAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSData TSKEY* endTsCols = (int64_t*)pEndTsCol->pData; - void* pPkVal = NULL; - int32_t pkLen = 0; + void* pPkVal = NULL; + int32_t pkLen = 0; SColumnInfoData* pPkColDataInfo = NULL; if (hasSrcPrimaryKeyCol(&pInfo->basic)) { pPkColDataInfo = taosArrayGet(pSDataBlock->pDataBlock, pInfo->basic.primaryPkIndex); @@ -2453,8 +2472,8 @@ int32_t buildSessionResultDataBlock(SOperatorInfo* pOperator, void* pState, SSDa pBlock->info.id.groupId = pKey->groupId; void* tbname = NULL; - if (pAPI->stateStore.streamStateGetParName((void*)pTaskInfo->streamInfo.pState, pBlock->info.id.groupId, - &tbname, false) < 0) { + if (pAPI->stateStore.streamStateGetParName((void*)pTaskInfo->streamInfo.pState, pBlock->info.id.groupId, &tbname, + false) < 0) { pBlock->info.parTbName[0] = 0; } else { memcpy(pBlock->info.parTbName, tbname, TSDB_TABLE_NAME_LEN); @@ -2934,7 +2953,7 @@ void streamSessionSemiReloadState(SOperatorInfo* pOperator) { int32_t size = 0; void* pBuf = NULL; int32_t code = pAggSup->stateStore.streamStateGetInfo(pAggSup->pState, STREAM_SESSION_OP_STATE_NAME, - strlen(STREAM_SESSION_OP_STATE_NAME), &pBuf, &size); + strlen(STREAM_SESSION_OP_STATE_NAME), &pBuf, &size); int32_t num = (size - sizeof(TSKEY)) / sizeof(SSessionKey); SSessionKey* pSeKeyBuf = (SSessionKey*)pBuf; ASSERT(size == num * sizeof(SSessionKey) + sizeof(TSKEY)); @@ -2967,7 +2986,7 @@ void streamSessionReloadState(SOperatorInfo* pOperator) { int32_t size = 0; void* pBuf = NULL; int32_t code = pAggSup->stateStore.streamStateGetInfo(pAggSup->pState, STREAM_SESSION_OP_STATE_NAME, - strlen(STREAM_SESSION_OP_STATE_NAME), &pBuf, &size); + strlen(STREAM_SESSION_OP_STATE_NAME), &pBuf, &size); int32_t num = (size - sizeof(TSKEY)) / sizeof(SSessionKey); SSessionKey* pSeKeyBuf = (SSessionKey*)pBuf; ASSERT(size == num * sizeof(SSessionKey) + sizeof(TSKEY)); @@ -3017,6 +3036,7 @@ SOperatorInfo* createStreamSessionAggOperatorInfo(SOperatorInfo* downstream, SPh SSessionWinodwPhysiNode* pSessionNode = (SSessionWinodwPhysiNode*)pPhyNode; int32_t numOfCols = 0; int32_t code = TSDB_CODE_OUT_OF_MEMORY; + int32_t lino = 0; SStreamSessionAggOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SStreamSessionAggOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); if (pInfo == NULL || pOperator == NULL) { @@ -3111,8 +3131,12 @@ SOperatorInfo* createStreamSessionAggOperatorInfo(SOperatorInfo* downstream, SPh setOperatorStreamStateFn(pOperator, streamSessionReleaseState, streamSessionReloadState); if (downstream) { - initDownStream(downstream, &pInfo->streamAggSup, pOperator->operatorType, pInfo->primaryTsIndex, &pInfo->twAggSup, &pInfo->basic); + code = initDownStream(downstream, &pInfo->streamAggSup, pOperator->operatorType, pInfo->primaryTsIndex, + &pInfo->twAggSup, &pInfo->basic); + TSDB_CHECK_CODE(code, lino, _error); + code = appendDownstream(pOperator, &downstream, 1); + TSDB_CHECK_CODE(code, lino, _error); } return pOperator; @@ -3123,6 +3147,7 @@ _error: taosMemoryFreeClear(pOperator); pTaskInfo->code = code; + qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); return NULL; } @@ -3573,7 +3598,7 @@ static void doStreamStateAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSDataBl if (!allEqual) { uint64_t uid = 0; appendDataToSpecialBlock(pAggSup->pScanBlock, &curWin.winInfo.sessionWin.win.skey, - &curWin.winInfo.sessionWin.win.ekey, &uid, &groupId, NULL); + &curWin.winInfo.sessionWin.win.ekey, &uid, &groupId, NULL); tSimpleHashRemove(pSeUpdated, &curWin.winInfo.sessionWin, sizeof(SSessionKey)); doDeleteSessionWindow(pAggSup, &curWin.winInfo.sessionWin); releaseOutputBuf(pAggSup->pState, curWin.winInfo.pStatePos, &pAPI->stateStore); @@ -3680,9 +3705,9 @@ void* doStreamStateDecodeOpState(void* buf, int32_t len, SOperatorInfo* pOperato SSessionKey key = {0}; SResultWindowInfo winfo = {0}; buf = decodeSSessionKey(buf, &key); - pAggSup->stateStore.streamStateStateAddIfNotExist(pAggSup->pState, &winfo.sessionWin, NULL, - pAggSup->stateKeySize, compareStateKey, - (void**)&winfo.pStatePos, &pAggSup->resultRowSize); + pAggSup->stateStore.streamStateStateAddIfNotExist(pAggSup->pState, &winfo.sessionWin, NULL, pAggSup->stateKeySize, + compareStateKey, (void**)&winfo.pStatePos, + &pAggSup->resultRowSize); buf = decodeSResultWindowInfo(buf, &winfo, pInfo->streamAggSup.resultRowSize); tSimpleHashPut(pInfo->streamAggSup.pResultRows, &key, sizeof(SSessionKey), &winfo, sizeof(SResultWindowInfo)); } @@ -3876,7 +3901,7 @@ void streamStateReloadState(SOperatorInfo* pOperator) { int32_t size = 0; void* pBuf = NULL; int32_t code = pAggSup->stateStore.streamStateGetInfo(pAggSup->pState, STREAM_STATE_OP_STATE_NAME, - strlen(STREAM_STATE_OP_STATE_NAME), &pBuf, &size); + strlen(STREAM_STATE_OP_STATE_NAME), &pBuf, &size); int32_t num = (size - sizeof(TSKEY)) / sizeof(SSessionKey); qDebug("===stream=== reload state. get result count:%d", num); SSessionKey* pSeKeyBuf = (SSessionKey*)pBuf; @@ -3940,12 +3965,13 @@ SOperatorInfo* createStreamStateAggOperatorInfo(SOperatorInfo* downstream, SPhys int32_t tsSlotId = ((SColumnNode*)pStateNode->window.pTspk)->slotId; SColumnNode* pColNode = (SColumnNode*)(pStateNode->pStateKey); int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; SStreamStateAggOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SStreamStateAggOperatorInfo)); SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo)); if (pInfo == NULL || pOperator == NULL) { code = TSDB_CODE_OUT_OF_MEMORY; - goto _error; + TSDB_CHECK_CODE(code, lino, _error); } pInfo->stateCol = extractColumnFromColumnNode(pColNode); @@ -3954,9 +3980,7 @@ SOperatorInfo* createStreamStateAggOperatorInfo(SOperatorInfo* downstream, SPhys int32_t numOfScalar = 0; SExprInfo* pScalarExprInfo = createExprInfo(pStateNode->window.pExprs, NULL, &numOfScalar); code = initExprSupp(&pInfo->scalarSupp, pScalarExprInfo, numOfScalar, &pTaskInfo->storageAPI.functionStore); - if (code != TSDB_CODE_SUCCESS) { - goto _error; - } + TSDB_CHECK_CODE(code, lino, _error); } pInfo->twAggSup = (STimeWindowAggSupp){ @@ -3983,9 +4007,8 @@ SOperatorInfo* createStreamStateAggOperatorInfo(SOperatorInfo* downstream, SPhys code = initStreamAggSupporter(&pInfo->streamAggSup, pExpSup, numOfCols, 0, pTaskInfo->streamInfo.pState, keySize, type, &pTaskInfo->storageAPI.stateStore, pHandle, &pInfo->twAggSup, GET_TASKID(pTaskInfo), &pTaskInfo->storageAPI, pInfo->primaryTsIndex); - if (code != TSDB_CODE_SUCCESS) { - goto _error; - } + TSDB_CHECK_CODE(code, lino, _error); + _hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY); pInfo->pSeDeleted = tSimpleHashInit(64, hashFn); pInfo->pDelIterator = NULL; @@ -3998,7 +4021,8 @@ SOperatorInfo* createStreamStateAggOperatorInfo(SOperatorInfo* downstream, SPhys pInfo->dataVersion = 0; pInfo->historyWins = taosArrayInit(4, sizeof(SSessionKey)); if (!pInfo->historyWins) { - goto _error; + code = TSDB_CODE_OUT_OF_MEMORY; + TSDB_CHECK_CODE(code, lino, _error); } if (pHandle) { pInfo->isHistoryOp = pHandle->fillHistory; @@ -4025,17 +4049,20 @@ SOperatorInfo* createStreamStateAggOperatorInfo(SOperatorInfo* downstream, SPhys pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, doStreamStateAgg, NULL, destroyStreamStateOperatorInfo, optrDefaultBufFn, NULL, optrDefaultGetNextExtFn, NULL); setOperatorStreamStateFn(pOperator, streamStateReleaseState, streamStateReloadState); - initDownStream(downstream, &pInfo->streamAggSup, pOperator->operatorType, pInfo->primaryTsIndex, &pInfo->twAggSup, &pInfo->basic); + code = initDownStream(downstream, &pInfo->streamAggSup, pOperator->operatorType, pInfo->primaryTsIndex, + &pInfo->twAggSup, &pInfo->basic); + TSDB_CHECK_CODE(code, lino, _error); + code = appendDownstream(pOperator, &downstream, 1); - if (code != TSDB_CODE_SUCCESS) { - goto _error; - } + TSDB_CHECK_CODE(code, lino, _error); + return pOperator; _error: destroyStreamStateOperatorInfo(pInfo); taosMemoryFreeClear(pOperator); pTaskInfo->code = code; + qError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); return NULL; } @@ -4202,11 +4229,12 @@ SOperatorInfo* createStreamIntervalOperatorInfo(SOperatorInfo* downstream, SPhys .precision = ((SColumnNode*)pIntervalPhyNode->window.pTspk)->node.resType.precision, }; - pInfo->twAggSup = (STimeWindowAggSupp){.waterMark = pIntervalPhyNode->window.watermark, - .calTrigger = pIntervalPhyNode->window.triggerType, - .maxTs = INT64_MIN, - .minTs = INT64_MAX, - .deleteMark = getDeleteMark(&pIntervalPhyNode->window, pIntervalPhyNode->interval)}; + pInfo->twAggSup = + (STimeWindowAggSupp){.waterMark = pIntervalPhyNode->window.watermark, + .calTrigger = pIntervalPhyNode->window.triggerType, + .maxTs = INT64_MIN, + .minTs = INT64_MAX, + .deleteMark = getDeleteMark(&pIntervalPhyNode->window, pIntervalPhyNode->interval)}; ASSERTS(pInfo->twAggSup.calTrigger != STREAM_TRIGGER_MAX_DELAY, "trigger type should not be max delay"); @@ -4334,7 +4362,7 @@ static void doStreamMidIntervalAggImpl(SOperatorInfo* pOperator, SSDataBlock* pS .ts = nextWin.skey, .groupId = groupId, }; - void* chIds = taosHashGet(pInfo->pPullDataMap, &key, sizeof(SWinKey)); + void* chIds = taosHashGet(pInfo->pPullDataMap, &key, sizeof(SWinKey)); int32_t index = -1; SArray* chArray = NULL; int32_t chId = 0; @@ -4406,8 +4434,8 @@ static void doStreamMidIntervalAggImpl(SOperatorInfo* pOperator, SSDataBlock* pS static void addMidRetriveWindow(SArray* wins, SHashObj* pMidPullMap, int32_t numOfChild) { int32_t size = taosArrayGetSize(wins); for (int32_t i = 0; i < size; i++) { - SWinKey* winKey = taosArrayGet(wins, i); - void* chIds = taosHashGet(pMidPullMap, winKey, sizeof(SWinKey)); + SWinKey* winKey = taosArrayGet(wins, i); + void* chIds = taosHashGet(pMidPullMap, winKey, sizeof(SWinKey)); if (!chIds) { addPullWindow(pMidPullMap, winKey, numOfChild); qDebug("===stream===prepare mid operator retrive for delete %" PRId64 ", size:%d", winKey->ts, numOfChild); @@ -4610,5 +4638,6 @@ static SSDataBlock* doStreamMidIntervalAgg(SOperatorInfo* pOperator) { void setStreamOperatorCompleted(SOperatorInfo* pOperator) { setOperatorCompleted(pOperator); - qDebug("stask:%s %s status: %d. set completed", GET_TASKID(pOperator->pTaskInfo), getStreamOpName(pOperator->operatorType), pOperator->status); + qDebug("stask:%s %s status: %d. set completed", GET_TASKID(pOperator->pTaskInfo), + getStreamOpName(pOperator->operatorType), pOperator->status); } diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c index bad15d1834..41d398888e 100644 --- a/source/libs/executor/src/timewindowoperator.c +++ b/source/libs/executor/src/timewindowoperator.c @@ -1136,9 +1136,9 @@ void destroyIntervalOperatorInfo(void* param) { tdListFree(pInfo->binfo.resultRowInfo.openWindow); - pInfo->pInterpCols = taosArrayDestroy(pInfo->pInterpCols); + taosArrayDestroy(pInfo->pInterpCols); + pInfo->pInterpCols = NULL; taosArrayDestroyEx(pInfo->pPrevValues, freeItem); - pInfo->pPrevValues = NULL; cleanupGroupResInfo(&pInfo->groupResInfo); diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index d5117e0eec..aab5a52776 100644 --- a/source/libs/function/src/builtinsimpl.c +++ b/source/libs/function/src/builtinsimpl.c @@ -1441,6 +1441,9 @@ _stddev_over: } static void stddevTransferInfo(SStddevRes* pInput, SStddevRes* pOutput) { + if (IS_NULL_TYPE(pInput->type)) { + return; + } pOutput->type = pInput->type; if (IS_SIGNED_NUMERIC_TYPE(pOutput->type)) { pOutput->quadraticISum += pInput->quadraticISum; diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index f118c15b7a..c306cf2c7a 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -1061,6 +1061,13 @@ void nodesDestroyNode(SNode* pNode) { pStmt->freeStbRowsCxtFunc(pStmt->pStbRowsCxt); } taosMemoryFreeClear(pStmt->pStbRowsCxt); + + taosMemoryFreeClear(pStmt->pCreateTbInfo); + + if (pStmt->destroyParseFileCxt) { + pStmt->destroyParseFileCxt(&pStmt->pParFileCxt); + } + taosCloseFile(&pStmt->fp); break; } @@ -1093,15 +1100,6 @@ void nodesDestroyNode(SNode* pNode) { } case QUERY_NODE_CREATE_SUBTABLE_FROM_FILE_CLAUSE: { SCreateSubTableFromFileClause* pStmt = (SCreateSubTableFromFileClause*)pNode; - if (pStmt->aCreateTbData) { - taosArrayDestroy(pStmt->aCreateTbData); - } - if (pStmt->aTagIndexs) { - taosArrayDestroy(pStmt->aTagIndexs); - } - if (pStmt->fp) { - taosCloseFile(&pStmt->fp); - } nodesDestroyList(pStmt->pSpecificTags); break; } @@ -2205,6 +2203,17 @@ bool nodesIsRegularOp(const SOperatorNode* pOp) { return false; } +bool nodesIsMatchRegularOp(const SOperatorNode* pOp) { + switch (pOp->opType) { + case OP_TYPE_MATCH: + case OP_TYPE_NMATCH: + return true; + default: + break; + } + return false; +} + bool nodesIsBitwiseOp(const SOperatorNode* pOp) { switch (pOp->opType) { case OP_TYPE_BIT_AND: diff --git a/source/libs/parser/inc/parInt.h b/source/libs/parser/inc/parInt.h index d58e9bd86a..c231de653c 100644 --- a/source/libs/parser/inc/parInt.h +++ b/source/libs/parser/inc/parInt.h @@ -29,6 +29,7 @@ extern "C" { #define QUERY_SMA_OPTIMIZE_ENABLE 1 int32_t parseInsertSql(SParseContext* pCxt, SQuery** pQuery, SCatalogReq* pCatalogReq, const SMetaData* pMetaData); +int32_t continueCreateTbFromFile(SParseContext* pCxt, SQuery** pQuery); int32_t parse(SParseContext* pParseCxt, SQuery** pQuery); int32_t collectMetaKey(SParseContext* pParseCxt, SQuery* pQuery, SParseMetaCache* pMetaCache); int32_t authenticate(SParseContext* pParseCxt, SQuery* pQuery, SParseMetaCache* pMetaCache); diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index f9bf9b8bb1..149e02ad3d 100644 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -353,6 +353,8 @@ end_opt(A) ::= END WITH TIMESTAMP NK_STRING(B). cmd ::= CREATE TABLE not_exists_opt(A) full_table_name(B) NK_LP column_def_list(C) NK_RP tags_def_opt(D) table_options(E). { pCxt->pRootNode = createCreateTableStmt(pCxt, A, B, C, D, E); } cmd ::= CREATE TABLE multi_create_clause(A). { pCxt->pRootNode = createCreateMultiTableStmt(pCxt, A); } +cmd ::= CREATE TABLE not_exists_opt(B) USING full_table_name(C) + NK_LP tag_list_opt(D) NK_RP FILE NK_STRING(E). { pCxt->pRootNode = createCreateSubTableFromFileClause(pCxt, B, C, D, &E); } cmd ::= CREATE STABLE not_exists_opt(A) full_table_name(B) NK_LP column_def_list(C) NK_RP tags_def(D) table_options(E). { pCxt->pRootNode = createCreateTableStmt(pCxt, A, B, C, D, E); } cmd ::= DROP TABLE multi_drop_clause(A). { pCxt->pRootNode = createDropTableStmt(pCxt, A); } @@ -385,15 +387,11 @@ alter_table_clause(A) ::= %destructor multi_create_clause { nodesDestroyList($$); } multi_create_clause(A) ::= create_subtable_clause(B). { A = createNodeList(pCxt, B); } multi_create_clause(A) ::= multi_create_clause(B) create_subtable_clause(C). { A = addNodeToList(pCxt, B, C); } -multi_create_clause(A) ::= create_from_file_clause(B). { A = createNodeList(pCxt, B); } create_subtable_clause(A) ::= not_exists_opt(B) full_table_name(C) USING full_table_name(D) specific_cols_opt(E) TAGS NK_LP tags_literal_list(F) NK_RP table_options(G). { A = createCreateSubTableClause(pCxt, B, C, D, E, F, G); } -create_from_file_clause(A) ::= not_exists_opt(B) USING full_table_name(C) - NK_LP tag_list_opt(D) NK_RP FILE NK_STRING(E). { A = createCreateSubTableFromFileClause(pCxt, B, C, D, &E); } - %type multi_drop_clause { SNodeList* } %destructor multi_drop_clause { nodesDestroyList($$); } multi_drop_clause(A) ::= drop_table_clause(B). { A = createNodeList(pCxt, B); } diff --git a/source/libs/parser/src/parAstParser.c b/source/libs/parser/src/parAstParser.c index 02f262cfb1..fa4b57c2b4 100644 --- a/source/libs/parser/src/parAstParser.c +++ b/source/libs/parser/src/parAstParser.c @@ -310,6 +310,24 @@ static int32_t collectMetaKeyFromCreateMultiTable(SCollectMetaKeyCxt* pCxt, SCre return code; } +static int32_t collectMetaKeyFromCreateSubTableFromFile(SCollectMetaKeyCxt* pCxt, + SCreateSubTableFromFileClause* pClause) { + int32_t code = TSDB_CODE_SUCCESS; + SNode* pNode = NULL; + + code = reserveDbCfgInCache(pCxt->pParseCxt->acctId, pClause->useDbName, pCxt->pMetaCache); + if (TSDB_CODE_SUCCESS == code) { + code = + reserveTableMetaInCache(pCxt->pParseCxt->acctId, pClause->useDbName, pClause->useTableName, pCxt->pMetaCache); + } + if (TSDB_CODE_SUCCESS == code) { + code = reserveUserAuthInCache(pCxt->pParseCxt->acctId, pCxt->pParseCxt->pUser, pClause->useDbName, NULL, + AUTH_TYPE_WRITE, pCxt->pMetaCache); + } + + return code; +} + static int32_t collectMetaKeyFromDropTable(SCollectMetaKeyCxt* pCxt, SDropTableStmt* pStmt) { int32_t code = TSDB_CODE_SUCCESS; SNode* pNode = NULL; @@ -866,6 +884,8 @@ static int32_t collectMetaKeyFromQuery(SCollectMetaKeyCxt* pCxt, SNode* pStmt) { return collectMetaKeyFromCreateTable(pCxt, (SCreateTableStmt*)pStmt); case QUERY_NODE_CREATE_MULTI_TABLES_STMT: return collectMetaKeyFromCreateMultiTable(pCxt, (SCreateMultiTablesStmt*)pStmt); + case QUERY_NODE_CREATE_SUBTABLE_FROM_FILE_CLAUSE: + return collectMetaKeyFromCreateSubTableFromFile(pCxt, (SCreateSubTableFromFileClause*)pStmt); case QUERY_NODE_DROP_TABLE_STMT: return collectMetaKeyFromDropTable(pCxt, (SDropTableStmt*)pStmt); case QUERY_NODE_DROP_SUPER_TABLE_STMT: diff --git a/source/libs/parser/src/parInsertSml.c b/source/libs/parser/src/parInsertSml.c index db2d34b844..89eaf14f75 100644 --- a/source/libs/parser/src/parInsertSml.c +++ b/source/libs/parser/src/parInsertSml.c @@ -112,7 +112,11 @@ static int32_t smlBuildTagRow(SArray* cols, SBoundColInfo* tags, SSchema* pSchem for (int i = 0; i < tags->numOfBound; ++i) { SSchema* pTagSchema = &pSchema[tags->pColIndex[i]]; SSmlKv* kv = taosArrayGet(cols, i); - + if (kv == NULL){ + code = TSDB_CODE_SML_INVALID_DATA; + uError("SML smlBuildTagRow error kv is null"); + goto end; + } if (kv->keyLen != strlen(pTagSchema->name) || memcmp(kv->key, pTagSchema->name, kv->keyLen) != 0 || kv->type != pTagSchema->type) { code = TSDB_CODE_SML_INVALID_DATA; @@ -120,7 +124,11 @@ static int32_t smlBuildTagRow(SArray* cols, SBoundColInfo* tags, SSchema* pSchem goto end; } - taosArrayPush(*tagName, pTagSchema->name); + if (taosArrayPush(*tagName, pTagSchema->name) == NULL){ + code = TSDB_CODE_OUT_OF_MEMORY; + uError("SML smlBuildTagRow error push tag name"); + goto end; + } STagVal val = {.cid = pTagSchema->colId, .type = pTagSchema->type}; // strcpy(val.colName, pTagSchema->name); if (pTagSchema->type == TSDB_DATA_TYPE_BINARY || pTagSchema->type == TSDB_DATA_TYPE_VARBINARY || @@ -141,7 +149,7 @@ static int32_t smlBuildTagRow(SArray* cols, SBoundColInfo* tags, SSchema* pSchem goto end; } char buf[512] = {0}; - snprintf(buf, tListLen(buf), " taosMbsToUcs4 error:%s", strerror(errno)); + (void)snprintf(buf, tListLen(buf), " taosMbsToUcs4 error:%s", strerror(errno)); taosMemoryFree(p); code = buildSyntaxErrMsg(msg, buf, kv->value); goto end; @@ -149,9 +157,13 @@ static int32_t smlBuildTagRow(SArray* cols, SBoundColInfo* tags, SSchema* pSchem val.pData = p; val.nData = output; } else { - memcpy(&val.i64, &(kv->value), kv->length); + (void)memcpy(&val.i64, &(kv->value), kv->length); + } + if (taosArrayPush(pTagArray, &val) == NULL){ + code = TSDB_CODE_OUT_OF_MEMORY; + uError("SML smlBuildTagRow error push tag array"); + goto end; } - taosArrayPush(pTagArray, &val); } code = tTagNew(pTagArray, 1, false, ppTag); @@ -166,20 +178,19 @@ end: return code; } -STableDataCxt* smlInitTableDataCtx(SQuery* query, STableMeta* pTableMeta) { - STableDataCxt* pTableCxt = NULL; +int32_t smlInitTableDataCtx(SQuery* query, STableMeta* pTableMeta, STableDataCxt** cxt) { SVCreateTbReq* pCreateTbReq = NULL; int ret = insGetTableDataCxt(((SVnodeModifyOpStmt*)(query->pRoot))->pTableBlockHashObj, &pTableMeta->uid, - sizeof(pTableMeta->uid), pTableMeta, &pCreateTbReq, &pTableCxt, false, false); + sizeof(pTableMeta->uid), pTableMeta, &pCreateTbReq, cxt, false, false); if (ret != TSDB_CODE_SUCCESS) { - return NULL; + return ret; } - ret = initTableColSubmitData(pTableCxt); + ret = initTableColSubmitData(*cxt); if (ret != TSDB_CODE_SUCCESS) { - return NULL; + return ret; } - return pTableCxt; + return TSDB_CODE_SUCCESS; } void clearColValArraySml(SArray* pCols) { @@ -197,6 +208,9 @@ void clearColValArraySml(SArray* pCols) { int32_t smlBuildRow(STableDataCxt* pTableCxt) { SRow** pRow = taosArrayReserve(pTableCxt->pData->aRowP, 1); + if (pRow == NULL){ + return TSDB_CODE_OUT_OF_MEMORY; + } int ret = tRowBuild(pTableCxt->pValues, pTableCxt->pSchema, pRow); if (TSDB_CODE_SUCCESS != ret) { return ret; @@ -211,18 +225,22 @@ int32_t smlBuildCol(STableDataCxt* pTableCxt, SSchema* schema, void* data, int32 int ret = TSDB_CODE_SUCCESS; SSchema* pColSchema = schema + index; SColVal* pVal = taosArrayGet(pTableCxt->pValues, index); + if (pVal == NULL) { + return TSDB_CODE_SUCCESS; + } SSmlKv* kv = (SSmlKv*)data; if (kv->keyLen != strlen(pColSchema->name) || memcmp(kv->key, pColSchema->name, kv->keyLen) != 0 || kv->type != pColSchema->type) { ret = TSDB_CODE_SML_INVALID_DATA; char* tmp = taosMemoryCalloc(kv->keyLen + 1, 1); if (tmp) { - memcpy(tmp, kv->key, kv->keyLen); + (void)memcpy(tmp, kv->key, kv->keyLen); uInfo("SML data(name:%s type:%s) is not same like the db data(name:%s type:%s)", tmp, tDataTypes[kv->type].name, pColSchema->name, tDataTypes[pColSchema->type].name); taosMemoryFree(tmp); } else { uError("SML smlBuildCol out of memory"); + ret = TSDB_CODE_OUT_OF_MEMORY; } goto end; } @@ -256,9 +274,9 @@ int32_t smlBuildCol(STableDataCxt* pTableCxt, SSchema* schema, void* data, int32 } else if (kv->type == TSDB_DATA_TYPE_GEOMETRY || kv->type == TSDB_DATA_TYPE_VARBINARY) { pVal->value.nData = kv->length; pVal->value.pData = taosMemoryMalloc(kv->length); - memcpy(pVal->value.pData, (uint8_t*)kv->value, kv->length); + (void)memcpy(pVal->value.pData, (uint8_t*)kv->value, kv->length); } else { - memcpy(&pVal->value.val, &(kv->value), kv->length); + (void)memcpy(&pVal->value.val, &(kv->value), kv->length); } pVal->flag = CV_FLAG_VALUE; @@ -276,8 +294,13 @@ int32_t smlBindData(SQuery* query, bool dataFormat, SArray* tags, SArray* colsSc SVCreateTbReq* pCreateTblReq = NULL; SArray* tagName = NULL; - insInitBoundColsInfo(getNumOfTags(pTableMeta), &bindTags); - int ret = smlBoundColumnData(tags, &bindTags, pTagsSchema, true); + int ret = insInitBoundColsInfo(getNumOfTags(pTableMeta), &bindTags); + if (ret != TSDB_CODE_SUCCESS) { + buildInvalidOperationMsg(&pBuf, "init bound cols error"); + goto end; + } + + ret = smlBoundColumnData(tags, &bindTags, pTagsSchema, true); if (ret != TSDB_CODE_SUCCESS) { buildInvalidOperationMsg(&pBuf, "bound tags error"); goto end; @@ -299,7 +322,11 @@ int32_t smlBindData(SQuery* query, bool dataFormat, SArray* tags, SArray* colsSc ttl); pCreateTblReq->ctb.stbName = taosMemoryCalloc(1, sTableNameLen + 1); - memcpy(pCreateTblReq->ctb.stbName, sTableName, sTableNameLen); + if (pCreateTblReq->ctb.stbName == NULL){ + ret = TSDB_CODE_OUT_OF_MEMORY; + goto end; + } + (void)memcpy(pCreateTblReq->ctb.stbName, sTableName, sTableNameLen); if (dataFormat) { STableDataCxt** pTableCxt = (STableDataCxt**)taosHashGet(((SVnodeModifyOpStmt*)(query->pRoot))->pTableBlockHashObj, @@ -345,11 +372,18 @@ int32_t smlBindData(SQuery* query, bool dataFormat, SArray* tags, SArray* colsSc for (int32_t r = 0; r < rowNum; ++r) { void* rowData = taosArrayGetP(cols, r); - + if (rowData == NULL) { + ret = TSDB_CODE_SML_INVALID_DATA; + goto end; + } // 1. set the parsed value from sql string for (int c = 0; c < pTableCxt->boundColsInfo.numOfBound; ++c) { SSchema* pColSchema = &pSchema[pTableCxt->boundColsInfo.pColIndex[c]]; SColVal* pVal = taosArrayGet(pTableCxt->pValues, pTableCxt->boundColsInfo.pColIndex[c]); + if (pVal == NULL) { + ret = TSDB_CODE_SML_INVALID_DATA; + goto end; + } void** p = taosHashGet(rowData, pColSchema->name, strlen(pColSchema->name)); if (p == NULL) { continue; @@ -388,14 +422,22 @@ int32_t smlBindData(SQuery* query, bool dataFormat, SArray* tags, SArray* colsSc } else if (kv->type == TSDB_DATA_TYPE_GEOMETRY || kv->type == TSDB_DATA_TYPE_VARBINARY) { pVal->value.nData = kv->length; pVal->value.pData = taosMemoryMalloc(kv->length); - memcpy(pVal->value.pData, (uint8_t*)kv->value, kv->length); + if (NULL == pVal->value.pData) { + ret = TSDB_CODE_OUT_OF_MEMORY; + goto end; + } + (void)memcpy(pVal->value.pData, (uint8_t*)kv->value, kv->length); } else { - memcpy(&pVal->value.val, &(kv->value), kv->length); + (void)memcpy(&pVal->value.val, &(kv->value), kv->length); } pVal->flag = CV_FLAG_VALUE; } SRow** pRow = taosArrayReserve(pTableCxt->pData->aRowP, 1); + if (NULL == pRow) { + ret = TSDB_CODE_OUT_OF_MEMORY; + goto end; + } ret = tRowBuild(pTableCxt->pValues, pTableCxt->pSchema, pRow); if (TSDB_CODE_SUCCESS != ret) { buildInvalidOperationMsg(&pBuf, "tRowBuild error"); @@ -415,11 +457,12 @@ end: return ret; } -SQuery* smlInitHandle() { +int32_t smlInitHandle(SQuery** query) { + *query = NULL; SQuery* pQuery = (SQuery*)nodesMakeNode(QUERY_NODE_QUERY); if (NULL == pQuery) { uError("create pQuery error"); - return NULL; + return TSDB_CODE_OUT_OF_MEMORY; } pQuery->execMode = QUERY_EXEC_MODE_SCHEDULE; pQuery->haveResultSet = false; @@ -428,14 +471,22 @@ SQuery* smlInitHandle() { if (NULL == stmt) { uError("create SVnodeModifyOpStmt error"); qDestroyQuery(pQuery); - return NULL; + return TSDB_CODE_OUT_OF_MEMORY; } stmt->pTableBlockHashObj = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), true, HASH_NO_LOCK); + if (stmt->pTableBlockHashObj == NULL){ + uError("create pTableBlockHashObj error"); + qDestroyQuery(pQuery); + nodesDestroyNode((SNode*)stmt); + return TSDB_CODE_OUT_OF_MEMORY; + } stmt->freeHashFunc = insDestroyTableDataCxtHashMap; stmt->freeArrayFunc = insDestroyVgroupDataCxtList; pQuery->pRoot = (SNode*)stmt; - return pQuery; + *query = pQuery; + + return TSDB_CODE_SUCCESS; } int32_t smlBuildOutput(SQuery* handle, SHashObj* pVgHash) { diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 8d585245e0..9b1c8096aa 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -11889,7 +11889,8 @@ static int32_t createOperatorNode(EOperatorType opType, const char* pColName, SN return TSDB_CODE_SUCCESS; } -static int32_t createParOperatorNode(EOperatorType opType, const char* pLeftCol, const char* pRightCol, SNode** ppResOp) { +static int32_t createParOperatorNode(EOperatorType opType, const char* pLeftCol, const char* pRightCol, + SNode** ppResOp) { SOperatorNode* pOper = (SOperatorNode*)nodesMakeNode(QUERY_NODE_OPERATOR); CHECK_POINTER_OUT_OF_MEM(pOper); @@ -12694,7 +12695,7 @@ static int32_t rewriteCreateSubTable(STranslateContext* pCxt, SCreateSubTableCla } static int32_t buildTagIndexForBindTags(SMsgBuf* pMsgBuf, SCreateSubTableFromFileClause* pStmt, - STableMeta* pSuperTableMeta) { + STableMeta* pSuperTableMeta, SArray* aTagIndexs) { int32_t code = TSDB_CODE_SUCCESS; int32_t numOfTags = getNumOfTags(pSuperTableMeta); @@ -12705,7 +12706,7 @@ static int32_t buildTagIndexForBindTags(SMsgBuf* pMsgBuf, SCreateSubTableFromFil return TSDB_CODE_OUT_OF_MEMORY; } - bool tbnameFound = false; + bool tbnameFound = false; SNode* pTagNode; FOREACH(pTagNode, pStmt->pSpecificTags) { @@ -12757,14 +12758,14 @@ static int32_t buildTagIndexForBindTags(SMsgBuf* pMsgBuf, SCreateSubTableFromFil goto _OUT; } - if (NULL == taosArrayPush(pStmt->aTagIndexs, &idx)) { + if (NULL == taosArrayPush(aTagIndexs, &idx)) { code = TSDB_CODE_OUT_OF_MEMORY; goto _OUT; } } if (TSDB_CODE_SUCCESS == code && !tbnameFound) { - code = generateSyntaxErrMsg(pMsgBuf, TSDB_CODE_PAR_TBNAME_ERROR); + code = generateSyntaxErrMsg(pMsgBuf, TSDB_CODE_PAR_TBNAME_ERROR); } _OUT: @@ -12772,21 +12773,19 @@ _OUT: return code; } -typedef struct { - // refer - STableMeta* pSuperTableMeta; - SArray* pTagIndexs; - TdFilePtr fp; +typedef struct SParseFileContext { + SHashObj* pTbNameHash; + SArray* aTagNames; + bool tagNameFilled; + STableMeta* pStbMeta; + SArray* aTagIndexs; - // containers - SHashObj* pTbNameHash; - SArray* aTagNames; - bool tagNameFilled; - SArray* aTagVals; - char tmpTokenBuf[TSDB_MAX_BYTES_PER_ROW]; + char tmpTokenBuf[TSDB_MAX_BYTES_PER_ROW]; + SArray* aCreateTbData; // per line const char* pSql; + SArray* aTagVals; STag* pTag; SName ctbName; SVgroupInfo vg; @@ -12810,48 +12809,48 @@ static int32_t fillVgroupInfo(SParseContext* pParseCxt, const SName* pName, SVgr return code; } -static int32_t parseOneStbRow(SMsgBuf* pMsgBuf, SParseFileContext* pParFileCtx) { +static int32_t parseOneStbRow(SMsgBuf* pMsgBuf, SParseFileContext* pParFileCxt) { int32_t code = TSDB_CODE_SUCCESS; - int sz = taosArrayGetSize(pParFileCtx->pTagIndexs); - int32_t numOfTags = getNumOfTags(pParFileCtx->pSuperTableMeta); - uint8_t precision = getTableInfo(pParFileCtx->pSuperTableMeta).precision; - SSchema* pSchemas = getTableTagSchema(pParFileCtx->pSuperTableMeta); + int sz = taosArrayGetSize(pParFileCxt->aTagIndexs); + int32_t numOfTags = getNumOfTags(pParFileCxt->pStbMeta); + uint8_t precision = getTableInfo(pParFileCxt->pStbMeta).precision; + SSchema* pSchemas = getTableTagSchema(pParFileCxt->pStbMeta); for (int i = 0; i < sz; i++) { - const char* pSql = pParFileCtx->pSql; + const char* pSql = pParFileCxt->pSql; int32_t pos = 0; SToken token = tStrGetToken(pSql, &pos, true, NULL); - pParFileCtx->pSql += pos; + pParFileCxt->pSql += pos; if (TK_NK_RP == token.type) { code = generateSyntaxErrMsg(pMsgBuf, TSDB_CODE_PAR_INVALID_COLUMNS_NUM); break; } - int16_t index = *(int16_t*)taosArrayGet(pParFileCtx->pTagIndexs, i); + int16_t index = *(int16_t*)taosArrayGet(pParFileCxt->aTagIndexs, i); if (index < numOfTags) { // parse tag const SSchema* pTagSchema = &pSchemas[index]; - code = checkAndTrimValue(&token, pParFileCtx->tmpTokenBuf, pMsgBuf, pTagSchema->type); + code = checkAndTrimValue(&token, pParFileCxt->tmpTokenBuf, pMsgBuf, pTagSchema->type); if (TSDB_CODE_SUCCESS == code && TK_NK_VARIABLE == token.type) { code = buildInvalidOperationMsg(pMsgBuf, "not expected row value"); } if (TSDB_CODE_SUCCESS == code) { - SArray* aTagNames = pParFileCtx->tagNameFilled ? NULL : pParFileCtx->aTagNames; - code = parseTagValue(pMsgBuf, &pParFileCtx->pSql, precision, (SSchema*)pTagSchema, &token, - aTagNames, pParFileCtx->aTagVals, &pParFileCtx->pTag); + SArray* aTagNames = pParFileCxt->tagNameFilled ? NULL : pParFileCxt->aTagNames; + code = parseTagValue(pMsgBuf, &pParFileCxt->pSql, precision, (SSchema*)pTagSchema, &token, aTagNames, + pParFileCxt->aTagVals, &pParFileCxt->pTag); } } else { // parse tbname - code = checkAndTrimValue(&token, pParFileCtx->tmpTokenBuf, pMsgBuf, TSDB_DATA_TYPE_BINARY); + code = checkAndTrimValue(&token, pParFileCxt->tmpTokenBuf, pMsgBuf, TSDB_DATA_TYPE_BINARY); if (TK_NK_VARIABLE == token.type) { code = buildInvalidOperationMsg(pMsgBuf, "not expected tbname"); } if (TSDB_CODE_SUCCESS == code) { bool bFoundTbName = false; - code = parseTbnameToken(pMsgBuf, pParFileCtx->ctbName.tname, &token, &bFoundTbName); + code = parseTbnameToken(pMsgBuf, pParFileCxt->ctbName.tname, &token, &bFoundTbName); } } @@ -12859,8 +12858,8 @@ static int32_t parseOneStbRow(SMsgBuf* pMsgBuf, SParseFileContext* pParFileCtx) } if (TSDB_CODE_SUCCESS == code) { - pParFileCtx->tagNameFilled = true; - code = tTagNew(pParFileCtx->aTagVals, 1, false, &pParFileCtx->pTag); + pParFileCxt->tagNameFilled = true; + code = tTagNew(pParFileCxt->aTagVals, 1, false, &pParFileCxt->pTag); } return code; @@ -12873,171 +12872,262 @@ typedef struct { SVgroupInfo vg; } SCreateTableData; -static void clearTagValArrayFp(void *data) { +static void clearTagValArrayFp(void* data) { STagVal* p = (STagVal*)data; if (IS_VAR_DATA_TYPE(p->type)) { taosMemoryFreeClear(p->pData); } } -static void clearCreateTbArrayFp(void *data) { +static void clearCreateTbArrayFp(void* data) { SCreateTableData* p = (SCreateTableData*)data; taosMemoryFreeClear(p->pTag); } -static int32_t parseCsvFile(SMsgBuf* pMsgBuf, SParseContext* pParseCxt, SParseFileContext* pParseFileCtx, - SArray* aCreateTbData) { +static int32_t parseCsvFile(SMsgBuf* pMsgBuf, SParseContext* pParseCxt, SParseFileContext* pParFileCxt, TdFilePtr fp, + int32_t maxLineCount) { int32_t code = TSDB_CODE_SUCCESS; char* pLine = NULL; int64_t readLen = 0; - while (TSDB_CODE_SUCCESS == code && (readLen = taosGetLineFile(pParseFileCtx->fp, &pLine)) != -1) { + int32_t lineCount = 0; + while (TSDB_CODE_SUCCESS == code && (readLen = taosGetLineFile(fp, &pLine)) != -1) { if (('\r' == pLine[readLen - 1]) || ('\n' == pLine[readLen - 1])) { pLine[--readLen] = '\0'; } if (readLen == 0) continue; - if (pLine[0] == '#') continue; + if (pLine[0] == '#') continue; // ignore comment line begins with '#' strtolower(pLine, pLine); - pParseFileCtx->pSql = pLine; + pParFileCxt->pSql = pLine; - code = parseOneStbRow(pMsgBuf, pParseFileCtx); + code = parseOneStbRow(pMsgBuf, pParFileCxt); if (TSDB_CODE_SUCCESS == code) { - if (taosHashGet(pParseFileCtx->pTbNameHash, pParseFileCtx->ctbName.tname, - strlen(pParseFileCtx->ctbName.tname) + 1) != NULL) { - taosMemoryFreeClear(pParseFileCtx->pTag); - code = generateSyntaxErrMsg(pMsgBuf, TSDB_CODE_PAR_TBNAME_DUPLICATED, pParseFileCtx->ctbName.tname); + if (taosHashGet(pParFileCxt->pTbNameHash, pParFileCxt->ctbName.tname, strlen(pParFileCxt->ctbName.tname) + 1) != + NULL) { + taosMemoryFreeClear(pParFileCxt->pTag); + code = generateSyntaxErrMsg(pMsgBuf, TSDB_CODE_PAR_TBNAME_DUPLICATED, pParFileCxt->ctbName.tname); break; } - code = taosHashPut(pParseFileCtx->pTbNameHash, pParseFileCtx->ctbName.tname, - strlen(pParseFileCtx->ctbName.tname) + 1, NULL, 0); + code = taosHashPut(pParFileCxt->pTbNameHash, pParFileCxt->ctbName.tname, strlen(pParFileCxt->ctbName.tname) + 1, + NULL, 0); } if (TSDB_CODE_SUCCESS == code) { - code = fillVgroupInfo(pParseCxt, &pParseFileCtx->ctbName, &pParseFileCtx->vg); + code = fillVgroupInfo(pParseCxt, &pParFileCxt->ctbName, &pParFileCxt->vg); } if (TSDB_CODE_SUCCESS == code) { - SCreateTableData data = {.ctbName = pParseFileCtx->ctbName, - .aTagNames = pParseFileCtx->aTagNames, - .pTag = pParseFileCtx->pTag, - .vg = pParseFileCtx->vg}; + SCreateTableData data = {.ctbName = pParFileCxt->ctbName, + .aTagNames = pParFileCxt->aTagNames, + .pTag = pParFileCxt->pTag, + .vg = pParFileCxt->vg}; - taosArrayPush(aCreateTbData, &data); + taosArrayPush(pParFileCxt->aCreateTbData, &data); } else { - taosMemoryFreeClear(pParseFileCtx->pTag); + taosMemoryFreeClear(pParFileCxt->pTag); } - pParseFileCtx->pTag = NULL; - taosArrayClearEx(pParseFileCtx->aTagVals, clearTagValArrayFp); + pParFileCxt->pTag = NULL; + taosArrayClearEx(pParFileCxt->aTagVals, clearTagValArrayFp); + lineCount++; + if (lineCount == maxLineCount) break; } if (TSDB_CODE_SUCCESS != code) { - taosArrayClearEx(aCreateTbData, clearCreateTbArrayFp); + taosArrayClearEx(pParFileCxt->aCreateTbData, clearCreateTbArrayFp); } taosMemoryFree(pLine); return code; } -static int32_t prepareReadFromFile(SCreateSubTableFromFileClause* pStmt) { +static void destructParseFileContext(SParseFileContext** ppParFileCxt) { + if (NULL == ppParFileCxt || NULL == *ppParFileCxt) { + return; + } + + SParseFileContext* pParFileCxt = *ppParFileCxt; + + taosHashCleanup(pParFileCxt->pTbNameHash); + taosArrayDestroy(pParFileCxt->aTagNames); + taosMemoryFreeClear(pParFileCxt->pStbMeta); + taosArrayDestroy(pParFileCxt->aTagIndexs); + taosArrayDestroy(pParFileCxt->aCreateTbData); + taosArrayDestroy(pParFileCxt->aTagVals); + taosMemoryFree(pParFileCxt); + + *ppParFileCxt = NULL; + + return; +} + +static int32_t constructParseFileContext(SCreateSubTableFromFileClause* pStmt, STableMeta* pSuperTableMeta, + int32_t acctId, SParseFileContext** ppParFileCxt) { int32_t code = TSDB_CODE_SUCCESS; - if (NULL == pStmt->fp) { - pStmt->fp = taosOpenFile(pStmt->filePath, TD_FILE_READ | TD_FILE_STREAM); - if (NULL == pStmt->fp) { + + SParseFileContext* pParFileCxt = taosMemoryCalloc(1, sizeof(SParseFileContext)); + pParFileCxt->pStbMeta = pSuperTableMeta; + pParFileCxt->tagNameFilled = false; + pParFileCxt->pTag = NULL; + pParFileCxt->ctbName.type = TSDB_TABLE_NAME_T; + pParFileCxt->ctbName.acctId = acctId; + strcpy(pParFileCxt->ctbName.dbname, pStmt->useDbName); + + if (NULL == pParFileCxt->pTbNameHash) { + pParFileCxt->pTbNameHash = + taosHashInit(128, taosGetDefaultHashFunction(TSDB_DATA_TYPE_VARCHAR), false, HASH_NO_LOCK); + if (!pParFileCxt->pTbNameHash) { + code = TSDB_CODE_OUT_OF_MEMORY; + goto _ERR; + } + } + + if (NULL == pParFileCxt->aTagNames) { + pParFileCxt->aTagNames = taosArrayInit(8, TSDB_COL_NAME_LEN); + if (NULL == pParFileCxt->aTagNames) { + code = TSDB_CODE_OUT_OF_MEMORY; + goto _ERR; + } + } + + if (NULL == pParFileCxt->aCreateTbData) { + pParFileCxt->aCreateTbData = taosArrayInit(16, sizeof(SCreateTableData)); + if (NULL == pParFileCxt->aCreateTbData) { + code = TSDB_CODE_OUT_OF_MEMORY; + goto _ERR; + } + } + + if (NULL == pParFileCxt->aTagIndexs) { + pParFileCxt->aTagIndexs = taosArrayInit(pStmt->pSpecificTags->length, sizeof(int16_t)); + if (!pParFileCxt->aTagIndexs) { + code = TSDB_CODE_OUT_OF_MEMORY; + goto _ERR; + } + } + + if (NULL == pParFileCxt->aTagVals) { + pParFileCxt->aTagVals = taosArrayInit(8, sizeof(STagVal)); + if (!pParFileCxt->aTagVals) { + code = TSDB_CODE_OUT_OF_MEMORY; + goto _ERR; + } + } + + *ppParFileCxt = pParFileCxt; + + return code; + +_ERR: + destructParseFileContext(&pParFileCxt); + + return code; +} + +typedef struct SCreateTbInfo { + bool ignoreExists; + char useDbName[TSDB_DB_NAME_LEN]; + char useTableName[TSDB_TABLE_NAME_LEN]; +} SCreateTbInfo; + +static int32_t prepareReadCsvFile(STranslateContext* pCxt, SCreateSubTableFromFileClause* pCreateStmt, + SVnodeModifyOpStmt* pModifyStmt) { + int32_t code = 0; + + TdFilePtr fp = NULL; + SCreateTbInfo* pCreateInfo = NULL; + SParseFileContext* pParFileCxt = NULL; + + if (NULL == pModifyStmt->fp) { + fp = taosOpenFile(pCreateStmt->filePath, TD_FILE_READ | TD_FILE_STREAM); + if (NULL == fp) { code = TAOS_SYSTEM_ERROR(errno); goto _ERR; } } - if (NULL == pStmt->aCreateTbData) { - pStmt->aCreateTbData = taosArrayInit(16, sizeof(SCreateTableData)); - if (NULL == pStmt->aCreateTbData) { + { + pCreateInfo = taosMemoryCalloc(1, sizeof(SCreateTbInfo)); + if (NULL == pCreateInfo) { code = TSDB_CODE_OUT_OF_MEMORY; goto _ERR; } + + pCreateInfo->ignoreExists = pCreateStmt->ignoreExists; + strncpy(pCreateInfo->useDbName, pCreateStmt->useDbName, TSDB_DB_NAME_LEN); + strncpy(pCreateInfo->useTableName, pCreateStmt->useTableName, TSDB_TABLE_NAME_LEN); } - if (NULL == pStmt->aTagIndexs) { - pStmt->aTagIndexs = taosArrayInit(pStmt->pSpecificTags->length, sizeof(int16_t)); - if (!pStmt->aTagIndexs) { - code = TSDB_CODE_OUT_OF_MEMORY; - goto _ERR; - } + { + STableMeta* pSuperTableMeta = NULL; + code = getTableMeta(pCxt, pCreateStmt->useDbName, pCreateStmt->useTableName, &pSuperTableMeta); + if (TSDB_CODE_SUCCESS != code) goto _ERR; + + code = constructParseFileContext(pCreateStmt, pSuperTableMeta, pCxt->pParseCxt->acctId, &pParFileCxt); + if (TSDB_CODE_SUCCESS != code) goto _ERR; + + code = buildTagIndexForBindTags(&pCxt->msgBuf, pCreateStmt, pParFileCxt->pStbMeta, pParFileCxt->aTagIndexs); + if (TSDB_CODE_SUCCESS != code) goto _ERR; } + pModifyStmt->fp = fp; + pModifyStmt->fileProcessing = false; + pModifyStmt->pCreateTbInfo = pCreateInfo; + pModifyStmt->pParFileCxt = pParFileCxt; + return code; _ERR: - taosCloseFile(&pStmt->fp); - taosArrayDestroy(pStmt->aCreateTbData); - taosArrayDestroy(pStmt->aTagIndexs); - + taosCloseFile(&fp); + taosMemoryFreeClear(pCreateInfo); + destructParseFileContext(&pParFileCxt); return code; } -static int32_t rewriteCreateSubTableFromFile(STranslateContext* pCxt, SCreateSubTableFromFileClause* pStmt, - SHashObj* pVgroupHashmap) { +static int32_t resetParseFileContext(SParseFileContext* pParFileCxt) { + taosArrayClear(pParFileCxt->aCreateTbData); + taosArrayClearEx(pParFileCxt->aTagVals, clearTagValArrayFp); + return TSDB_CODE_SUCCESS; +} + +static int32_t createSubTableFromFile(SMsgBuf* pMsgBuf, SParseContext* pParseCxt, SVnodeModifyOpStmt* pModifyStmt) { int32_t code = 0; - STableMeta* pSuperTableMeta = NULL; - if (TSDB_CODE_SUCCESS == code) { - code = getTableMeta(pCxt, pStmt->useDbName, pStmt->useTableName, &pSuperTableMeta); - } + SCreateTbInfo* pCreateInfo = pModifyStmt->pCreateTbInfo; + SParseFileContext* pParFileCxt = pModifyStmt->pParFileCxt; if (TSDB_CODE_SUCCESS == code) { - code = prepareReadFromFile(pStmt); + code = parseCsvFile(pMsgBuf, pParseCxt, pParFileCxt, pModifyStmt->fp, tsMaxInsertBatchRows); } + STableMeta* pSuperTableMeta = pParFileCxt->pStbMeta; if (TSDB_CODE_SUCCESS == code) { - code = buildTagIndexForBindTags(&pCxt->msgBuf, pStmt, pSuperTableMeta); - } - - SParseFileContext parseFileCtx = { - .pSuperTableMeta = pSuperTableMeta, .fp = pStmt->fp, .pTagIndexs = pStmt->aTagIndexs}; - parseFileCtx.pTbNameHash = taosHashInit(128, taosGetDefaultHashFunction(TSDB_DATA_TYPE_VARCHAR), false, HASH_NO_LOCK); - parseFileCtx.aTagNames = taosArrayInit(8, TSDB_COL_NAME_LEN); - parseFileCtx.tagNameFilled = false; - parseFileCtx.aTagVals = taosArrayInit(8, sizeof(STagVal)); - parseFileCtx.pTag = NULL; - parseFileCtx.ctbName.type = TSDB_TABLE_NAME_T; - parseFileCtx.ctbName.acctId = pCxt->pParseCxt->acctId; - strcpy(parseFileCtx.ctbName.dbname, pStmt->useDbName); - - if (NULL == parseFileCtx.aTagNames || NULL == parseFileCtx.aTagVals || NULL == parseFileCtx.pTbNameHash) { - code = TSDB_CODE_OUT_OF_MEMORY; - goto _OUT; - } - - if (TSDB_CODE_SUCCESS == code) { - code = parseCsvFile(&pCxt->msgBuf, pCxt->pParseCxt, &parseFileCtx, pStmt->aCreateTbData); - } - - if (TSDB_CODE_SUCCESS == code) { - int sz = taosArrayGetSize(pStmt->aCreateTbData); + int sz = taosArrayGetSize(pParFileCxt->aCreateTbData); for (int i = 0; i < sz; i++) { - SCreateTableData* pData = taosArrayGet(pStmt->aCreateTbData, i); + SCreateTableData* pData = taosArrayGet(pParFileCxt->aCreateTbData, i); - code = collectUseTable(&pData->ctbName, pCxt->pTargetTables); - if (TSDB_CODE_SUCCESS != code) { - taosMemoryFree(pData->pTag); - } + // code = collectUseTable(&pData->ctbName, pCxt->pTargetTables); + // if (TSDB_CODE_SUCCESS != code) { + // taosMemoryFree(pData->pTag); + // } - code = addCreateTbReqIntoVgroup(pVgroupHashmap, pStmt->useDbName, pSuperTableMeta->uid, pStmt->useTableName, - pData->ctbName.tname, pData->aTagNames, pSuperTableMeta->tableInfo.numOfTags, - pData->pTag, TSDB_DEFAULT_TABLE_TTL, NULL, pStmt->ignoreExists, &pData->vg); + code = addCreateTbReqIntoVgroup(pModifyStmt->pVgroupsHashObj, pCreateInfo->useDbName, pSuperTableMeta->uid, + pCreateInfo->useTableName, pData->ctbName.tname, pData->aTagNames, + pSuperTableMeta->tableInfo.numOfTags, pData->pTag, TSDB_DEFAULT_TABLE_TTL, NULL, + pCreateInfo->ignoreExists, &pData->vg); + } + + if (TSDB_CODE_SUCCESS == code) { + pModifyStmt->fileProcessing = (sz == tsMaxInsertBatchRows); } } -_OUT: - taosMemoryFreeClear(pSuperTableMeta); - taosHashCleanup(parseFileCtx.pTbNameHash); - taosArrayDestroy(parseFileCtx.aTagNames); - taosArrayDestroy(parseFileCtx.aTagVals); + (void)resetParseFileContext(pModifyStmt->pParFileCxt); return code; } @@ -13074,13 +13164,8 @@ static int32_t rewriteCreateMultiTable(STranslateContext* pCxt, SQuery* pQuery) int32_t code = TSDB_CODE_SUCCESS; SNode* pNode; FOREACH(pNode, pStmt->pSubTables) { - if (pNode->type == QUERY_NODE_CREATE_SUBTABLE_CLAUSE) { - SCreateSubTableClause* pClause = (SCreateSubTableClause*)pNode; - code = rewriteCreateSubTable(pCxt, pClause, pVgroupHashmap); - } else { - SCreateSubTableFromFileClause* pClause = (SCreateSubTableFromFileClause*)pNode; - code = rewriteCreateSubTableFromFile(pCxt, pClause, pVgroupHashmap); - } + SCreateSubTableClause* pClause = (SCreateSubTableClause*)pNode; + code = rewriteCreateSubTable(pCxt, pClause, pVgroupHashmap); if (TSDB_CODE_SUCCESS != code) { taosHashCleanup(pVgroupHashmap); return code; @@ -13096,6 +13181,75 @@ static int32_t rewriteCreateMultiTable(STranslateContext* pCxt, SQuery* pQuery) return rewriteToVnodeModifyOpStmt(pQuery, pBufArray); } +static int32_t rewriteCreateTableFromFile(STranslateContext* pCxt, SQuery* pQuery) { + SVnodeModifyOpStmt* pModifyStmt = (SVnodeModifyOpStmt*)nodesMakeNode(QUERY_NODE_VNODE_MODIFY_STMT); + if (pModifyStmt == NULL) { + return TSDB_CODE_OUT_OF_MEMORY; + } + pModifyStmt->sqlNodeType = nodeType(pQuery->pRoot); + pModifyStmt->fileProcessing = false; + pModifyStmt->destroyParseFileCxt = destructParseFileContext; + pModifyStmt->pVgroupsHashObj = taosHashInit(128, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, HASH_NO_LOCK); + if (NULL == pModifyStmt->pVgroupsHashObj) { + return TSDB_CODE_OUT_OF_MEMORY; + } + taosHashSetFreeFp(pModifyStmt->pVgroupsHashObj, destroyCreateTbReqBatch); + + SCreateSubTableFromFileClause* pCreateStmt = (SCreateSubTableFromFileClause*)pQuery->pRoot; + + int32_t code = prepareReadCsvFile(pCxt, pCreateStmt, pModifyStmt); + if (TSDB_CODE_SUCCESS != code) { + taosHashCleanup(pModifyStmt->pVgroupsHashObj); + return code; + } + + code = createSubTableFromFile(&pCxt->msgBuf, pCxt->pParseCxt, pModifyStmt); + if (TSDB_CODE_SUCCESS != code) { + taosHashCleanup(pModifyStmt->pVgroupsHashObj); + return code; + } + + SArray* pBufArray = serializeVgroupsCreateTableBatch(pModifyStmt->pVgroupsHashObj); + taosHashClear(pModifyStmt->pVgroupsHashObj); + if (NULL == pBufArray) { + taosHashCleanup(pModifyStmt->pVgroupsHashObj); + return TSDB_CODE_OUT_OF_MEMORY; + } + + pModifyStmt->pDataBlocks = pBufArray; + nodesDestroyNode(pQuery->pRoot); + pQuery->pRoot = (SNode*)pModifyStmt; + + return TSDB_CODE_SUCCESS; +} + +int32_t continueCreateTbFromFile(SParseContext* pParseCxt, SQuery** pQuery) { + SVnodeModifyOpStmt* pModifyStmt = (SVnodeModifyOpStmt*)(*pQuery)->pRoot; + + SMsgBuf tmpBuf = {0}; + tmpBuf.buf = taosMemoryMalloc(1024); + int32_t code = createSubTableFromFile(&tmpBuf, pParseCxt, pModifyStmt); + if (TSDB_CODE_SUCCESS != code) goto _OUT; + + SArray* pBufArray = serializeVgroupsCreateTableBatch(pModifyStmt->pVgroupsHashObj); + taosHashClear(pModifyStmt->pVgroupsHashObj); + if (NULL == pBufArray) { + code = TSDB_CODE_OUT_OF_MEMORY; + goto _OUT; + } + + pModifyStmt->pDataBlocks = pBufArray; + (*pQuery)->execStage = QUERY_EXEC_STAGE_SCHEDULE; + if (!pModifyStmt->fileProcessing) { + (*pQuery)->execMode = QUERY_EXEC_MODE_EMPTY_RESULT; + } + code = TSDB_CODE_SUCCESS; + +_OUT: + taosMemoryFreeClear(tmpBuf.buf); + return code; +} + typedef struct SVgroupDropTableBatch { SVDropTbBatchReq req; SVgroupInfo info; @@ -13798,7 +13952,8 @@ static int32_t createParWhenThenNode(SNode* pWhen, SNode* pThen, SNode** ppResWh return TSDB_CODE_SUCCESS; } -static int32_t createParCaseWhenNode(SNode* pCase, SNodeList* pWhenThenList, SNode* pElse, const char* pAias, SNode** ppResCaseWhen) { +static int32_t createParCaseWhenNode(SNode* pCase, SNodeList* pWhenThenList, SNode* pElse, const char* pAias, + SNode** ppResCaseWhen) { SCaseWhenNode* pCaseWhen = (SCaseWhenNode*)nodesMakeNode(QUERY_NODE_CASE_WHEN); CHECK_POINTER_OUT_OF_MEM(pCaseWhen); @@ -13813,7 +13968,8 @@ static int32_t createParCaseWhenNode(SNode* pCase, SNodeList* pWhenThenList, SNo return TSDB_CODE_SUCCESS; } -static int32_t createParFunctionNode(const char* pFunName, const char* pAias, SNodeList* pParameterList, SNode** ppResFunc) { +static int32_t createParFunctionNode(const char* pFunName, const char* pAias, SNodeList* pParameterList, + SNode** ppResFunc) { SFunctionNode* pFunc = (SFunctionNode*)nodesMakeNode(QUERY_NODE_FUNCTION); CHECK_POINTER_OUT_OF_MEM(pFunc); strcpy(pFunc->functionName, pFunName); @@ -13854,13 +14010,13 @@ static int32_t rewriteShowAliveStmt(STranslateContext* pCxt, SQuery* pQuery) { } } - SValueNode* pValNode = nodesMakeValueNodeFromString("leader"); + SValueNode* pValNode = nodesMakeValueNodeFromString("leader"); CHECK_POINTER_OUT_OF_MEM(pValNode); - SNode* pCond1 = NULL; - SNode* pCond2 = NULL; - SNode* pCond3 = NULL; - SNode* pCond4 = NULL; + SNode* pCond1 = NULL; + SNode* pCond2 = NULL; + SNode* pCond3 = NULL; + SNode* pCond4 = NULL; CHECK_RES_OUT_OF_MEM(createOperatorNode(OP_TYPE_EQUAL, "v1_status", (SNode*)pValNode, &pCond1)); CHECK_RES_OUT_OF_MEM(createOperatorNode(OP_TYPE_EQUAL, "v2_status", (SNode*)pValNode, &pCond2)); CHECK_RES_OUT_OF_MEM(createOperatorNode(OP_TYPE_EQUAL, "v3_status", (SNode*)pValNode, &pCond3)); @@ -13885,16 +14041,16 @@ static int32_t rewriteShowAliveStmt(STranslateContext* pCxt, SQuery* pQuery) { SNode* pElse = nodesMakeValueNodeFromInt32(0); CHECK_POINTER_OUT_OF_MEM(pElse); - // case when (v1_status = "leader" or v2_status = "lead er" or v3_status = "leader" or v4_status = "leader") then 1 else 0 end + // case when (v1_status = "leader" or v2_status = "lead er" or v3_status = "leader" or v4_status = "leader") then 1 + // else 0 end SNode* pCaseWhen = NULL; CHECK_RES_OUT_OF_MEM(createParCaseWhenNode(NULL, pWhenThenlist, pElse, NULL, &pCaseWhen)); SNodeList* pParaList = NULL; CHECK_RES_OUT_OF_MEM(createParListNode(pCaseWhen, &pParaList)); - // sum( case when ... end) as leader_col - SNode* pSumFun = NULL; + SNode* pSumFun = NULL; const char* pSumColAlias = "leader_col"; CHECK_RES_OUT_OF_MEM(createParFunctionNode("sum", pSumColAlias, pParaList, &pSumFun)); @@ -13904,7 +14060,7 @@ static int32_t rewriteShowAliveStmt(STranslateContext* pCxt, SQuery* pQuery) { CHECK_RES_OUT_OF_MEM(createParListNode(pPara1, &pParaList)); // count(1) as count_col - SNode* pCountFun = NULL; + SNode* pCountFun = NULL; const char* pCountColAlias = "count_col"; CHECK_RES_OUT_OF_MEM(createParFunctionNode("count", pCountColAlias, pParaList, &pCountFun)); @@ -13914,11 +14070,13 @@ static int32_t rewriteShowAliveStmt(STranslateContext* pCxt, SQuery* pQuery) { SSelectStmt* pSubSelect = NULL; // select sum( case when .... end) as leader_col, count(*) as count_col from information_schema.ins_vgroups - CHECK_RES_OUT_OF_MEM(createSimpleSelectStmtFromProjList(TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_VGROUPS, pProjList, &pSubSelect)); + CHECK_RES_OUT_OF_MEM( + createSimpleSelectStmtFromProjList(TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_VGROUPS, pProjList, &pSubSelect)); if (pDbName && pDbName[0] != 0) { // for show db.alive - // select sum( case when .... end) as leader_col, count(*) as count_col from information_schema.ins_vgroups where db_name = "..." + // select sum( case when .... end) as leader_col, count(*) as count_col from information_schema.ins_vgroups where + // db_name = "..." SNode* pDbCond = NULL; pValNode = nodesMakeValueNodeFromString(pDbName); CHECK_RES_OUT_OF_MEM(createOperatorNode(OP_TYPE_EQUAL, "db_name", (SNode*)pValNode, &pDbCond)); @@ -13928,14 +14086,12 @@ static int32_t rewriteShowAliveStmt(STranslateContext* pCxt, SQuery* pQuery) { pSubSelect->pWhere = pDbCond; } - - pCond1 = NULL; CHECK_RES_OUT_OF_MEM(createParOperatorNode(OP_TYPE_EQUAL, pSumColAlias, pCountColAlias, &pCond1)); pCond2 = NULL; SNode* pTempVal = nodesMakeValueNodeFromInt32(0); CHECK_RES_OUT_OF_MEM(createOperatorNode(OP_TYPE_GREATER_THAN, pSumColAlias, pTempVal, &pCond2)); - //leader_col = count_col and leader_col > 0 + // leader_col = count_col and leader_col > 0 pTemp1 = NULL; CHECK_RES_OUT_OF_MEM(createLogicCondNode(pCond1, pCond2, &pTemp1, LOGIC_COND_TYPE_AND)); @@ -13961,7 +14117,8 @@ static int32_t rewriteShowAliveStmt(STranslateContext* pCxt, SQuery* pQuery) { CHECK_RES_OUT_OF_MEM(createParWhenThenNode(pTemp2, pThen, &pWhenThen)); CHECK_RES_OUT_OF_MEM(nodesListStrictAppend(pWhenThenlist, pWhenThen)); - // case when leader_col = count_col and count_col > 0 then 1 when leader_col < count_col and count_col > 0 then 2 else 0 end as status + // case when leader_col = count_col and count_col > 0 then 1 when leader_col < count_col and count_col > 0 then 2 else + // 0 end as status pCaseWhen = NULL; pElse = nodesMakeValueNodeFromInt32(0); CHECK_POINTER_OUT_OF_MEM(pElse); @@ -13973,7 +14130,6 @@ static int32_t rewriteShowAliveStmt(STranslateContext* pCxt, SQuery* pQuery) { SNode* pTempTblNode = NULL; CHECK_RES_OUT_OF_MEM(createParTempTableNode(pSubSelect, &pTempTblNode)); - SSelectStmt* pStmt = (SSelectStmt*)nodesMakeNode(QUERY_NODE_SELECT_STMT); CHECK_POINTER_OUT_OF_MEM(pStmt); pStmt->pProjectionList = pProjList; @@ -14047,6 +14203,9 @@ static int32_t rewriteQuery(STranslateContext* pCxt, SQuery* pQuery) { case QUERY_NODE_CREATE_MULTI_TABLES_STMT: code = rewriteCreateMultiTable(pCxt, pQuery); break; + case QUERY_NODE_CREATE_SUBTABLE_FROM_FILE_CLAUSE: + code = rewriteCreateTableFromFile(pCxt, pQuery); + break; case QUERY_NODE_DROP_TABLE_STMT: code = rewriteDropTable(pCxt, pQuery); break; diff --git a/source/libs/parser/src/parUtil.c b/source/libs/parser/src/parUtil.c index d67c7d306f..e6b6bcc903 100644 --- a/source/libs/parser/src/parUtil.c +++ b/source/libs/parser/src/parUtil.c @@ -223,7 +223,9 @@ static char* getSyntaxErrFormat(int32_t errCode) { return "Tag name:%s duplicated"; case TSDB_CODE_PAR_NOT_ALLOWED_DIFFERENT_BY_ROW_FUNC: return "Some functions cannot appear in the select list at the same time"; - default: + case TSDB_CODE_PAR_REGULAR_EXPRESSION_ERROR: + return "Syntax error in regular expression"; + default: return "Unknown error"; } } diff --git a/source/libs/parser/src/parser.c b/source/libs/parser/src/parser.c index a5cbe90598..7d042aeddb 100644 --- a/source/libs/parser/src/parser.c +++ b/source/libs/parser/src/parser.c @@ -48,6 +48,33 @@ bool qIsInsertValuesSql(const char* pStr, size_t length) { return false; } +bool qIsCreateTbFromFileSql(const char* pStr, size_t length) { + if (NULL == pStr) { + return false; + } + + const char* pSql = pStr; + + int32_t index = 0; + SToken t = tStrGetToken((char*)pStr, &index, false, NULL); + if (TK_CREATE != t.type) { + return false; + } + + do { + pStr += index; + index = 0; + t = tStrGetToken((char*)pStr, &index, false, NULL); + if (TK_FILE == t.type) { + return true; + } + if (0 == t.type || 0 == t.n) { + break; + } + } while (pStr - pSql < length); + return false; +} + bool qParseDbName(const char* pStr, size_t length, char** pDbName) { (void) length; int32_t index = 0; @@ -239,11 +266,19 @@ static int32_t parseQuerySyntax(SParseContext* pCxt, SQuery** pQuery, struct SCa return code; } +static int32_t parseCreateTbFromFileSyntax(SParseContext* pCxt, SQuery** pQuery, struct SCatalogReq* pCatalogReq) { + if (NULL == *pQuery) return parseQuerySyntax(pCxt, pQuery, pCatalogReq); + + return continueCreateTbFromFile(pCxt, pQuery); +} + int32_t qParseSqlSyntax(SParseContext* pCxt, SQuery** pQuery, struct SCatalogReq* pCatalogReq) { int32_t code = nodesAcquireAllocator(pCxt->allocatorId); if (TSDB_CODE_SUCCESS == code) { if (qIsInsertValuesSql(pCxt->pSql, pCxt->sqlLen)) { code = parseInsertSql(pCxt, pQuery, pCatalogReq, NULL); + } else if (qIsCreateTbFromFileSql(pCxt->pSql, pCxt->sqlLen)) { + code = parseCreateTbFromFileSyntax(pCxt, pQuery, pCatalogReq); } else { code = parseQuerySyntax(pCxt, pQuery, pCatalogReq); } @@ -322,7 +357,7 @@ void destoryCatalogReq(SCatalogReq *pCatalogReq) { taosArrayDestroyEx(pCatalogReq->pTableHash, destoryTablesReq); #ifdef TD_ENTERPRISE taosArrayDestroyEx(pCatalogReq->pView, destoryTablesReq); -#endif +#endif taosArrayDestroyEx(pCatalogReq->pTableTSMAs, destoryTablesReq); taosArrayDestroyEx(pCatalogReq->pTSMAs, destoryTablesReq); } diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index 2af9c1dadd..26c5465b8c 100644 --- a/source/libs/parser/src/sql.c +++ b/source/libs/parser/src/sql.c @@ -163,16 +163,16 @@ #define TK_TABLE 114 #define TK_NK_LP 115 #define TK_NK_RP 116 -#define TK_STABLE 117 -#define TK_COLUMN 118 -#define TK_MODIFY 119 -#define TK_RENAME 120 -#define TK_TAG 121 -#define TK_SET 122 -#define TK_NK_EQ 123 -#define TK_USING 124 -#define TK_TAGS 125 -#define TK_FILE 126 +#define TK_USING 117 +#define TK_FILE 118 +#define TK_STABLE 119 +#define TK_COLUMN 120 +#define TK_MODIFY 121 +#define TK_RENAME 122 +#define TK_TAG 123 +#define TK_SET 124 +#define TK_NK_EQ 125 +#define TK_TAGS 126 #define TK_BOOL 127 #define TK_TINYINT 128 #define TK_SMALLINT 129 @@ -483,30 +483,30 @@ #endif /************* Begin control #defines *****************************************/ #define YYCODETYPE unsigned short int -#define YYNOCODE 559 +#define YYNOCODE 558 #define YYACTIONTYPE unsigned short int #define ParseTOKENTYPE SToken typedef union { int yyinit; ParseTOKENTYPE yy0; - SNode* yy54; - SDataType yy84; - EJoinType yy230; - bool yy325; - int32_t yy332; - EFillMode yy478; - STokenPair yy495; - ENullOrder yy503; - int8_t yy535; - SShowTablesOption yy579; - SNodeList* yy652; - SAlterOption yy663; - EShowKind yy719; - EOrder yy760; - SToken yy837; - int64_t yy909; - EOperatorType yy922; - EJoinSubType yy948; + SAlterOption yy101; + bool yy209; + SNodeList* yy316; + SNode* yy416; + EOrder yy506; + EJoinSubType yy630; + EShowKind yy681; + int32_t yy820; + EOperatorType yy848; + STokenPair yy849; + EFillMode yy882; + SShowTablesOption yy925; + SDataType yy952; + EJoinType yy972; + int8_t yy1043; + ENullOrder yy1045; + int64_t yy1089; + SToken yy1109; } YYMINORTYPE; #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 @@ -522,18 +522,18 @@ typedef union { #define ParseCTX_FETCH #define ParseCTX_STORE #define YYFALLBACK 1 -#define YYNSTATE 978 -#define YYNRULE 756 -#define YYNRULE_WITH_ACTION 756 +#define YYNSTATE 979 +#define YYNRULE 755 +#define YYNRULE_WITH_ACTION 755 #define YYNTOKEN 378 -#define YY_MAX_SHIFT 977 -#define YY_MIN_SHIFTREDUCE 1449 -#define YY_MAX_SHIFTREDUCE 2204 -#define YY_ERROR_ACTION 2205 -#define YY_ACCEPT_ACTION 2206 -#define YY_NO_ACTION 2207 -#define YY_MIN_REDUCE 2208 -#define YY_MAX_REDUCE 2963 +#define YY_MAX_SHIFT 978 +#define YY_MIN_SHIFTREDUCE 1448 +#define YY_MAX_SHIFTREDUCE 2202 +#define YY_ERROR_ACTION 2203 +#define YY_ACCEPT_ACTION 2204 +#define YY_NO_ACTION 2205 +#define YY_MIN_REDUCE 2206 +#define YY_MAX_REDUCE 2960 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -600,646 +600,637 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (3105) +#define YY_ACTTAB_COUNT (3018) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 2404, 2697, 101, 2572, 2406, 493, 647, 2572, 798, 648, - /* 10 */ 2256, 2402, 47, 45, 2121, 2739, 2929, 471, 2934, 446, - /* 20 */ 476, 478, 1942, 2569, 855, 1967, 2929, 2569, 855, 2714, - /* 30 */ 813, 2412, 810, 157, 797, 218, 1940, 2714, 2030, 2930, - /* 40 */ 799, 502, 501, 2231, 787, 2933, 172, 40, 39, 2930, - /* 50 */ 2932, 46, 44, 43, 42, 41, 2934, 655, 2757, 2718, - /* 60 */ 648, 2256, 450, 449, 2739, 1949, 482, 2718, 2025, 482, - /* 70 */ 734, 1967, 2757, 1970, 2698, 19, 2704, 872, 850, 848, - /* 80 */ 872, 788, 1948, 66, 810, 157, 728, 33, 732, 730, - /* 90 */ 288, 287, 2477, 40, 39, 47, 45, 46, 44, 43, - /* 100 */ 42, 41, 469, 476, 2704, 1942, 606, 2757, 867, 2720, - /* 110 */ 2722, 473, 974, 2475, 435, 15, 207, 2720, 2723, 1940, - /* 120 */ 872, 2030, 867, 2738, 443, 2704, 2777, 850, 872, 54, - /* 130 */ 121, 2740, 854, 2742, 2743, 849, 867, 872, 2206, 482, - /* 140 */ 448, 447, 200, 695, 2831, 2545, 786, 2421, 472, 2827, - /* 150 */ 872, 2025, 2032, 2033, 812, 187, 2839, 2840, 19, 155, - /* 160 */ 2844, 911, 2059, 550, 841, 1948, 697, 254, 219, 2189, - /* 170 */ 696, 650, 2738, 2264, 243, 2777, 2878, 840, 2739, 410, - /* 180 */ 2740, 854, 2742, 2743, 849, 847, 872, 833, 2796, 559, - /* 190 */ 2541, 2003, 2013, 851, 62, 974, 1788, 1789, 15, 605, - /* 200 */ 242, 2031, 2034, 50, 810, 157, 867, 194, 2839, 809, - /* 210 */ 744, 149, 808, 603, 612, 610, 1943, 415, 1941, 2929, - /* 220 */ 232, 2757, 46, 44, 43, 42, 41, 211, 508, 2060, - /* 230 */ 2572, 50, 79, 507, 652, 2032, 2033, 797, 218, 2704, - /* 240 */ 649, 850, 2930, 799, 234, 2464, 322, 1952, 810, 157, - /* 250 */ 2570, 855, 1946, 1947, 2000, 62, 2002, 2005, 2006, 2007, - /* 260 */ 2008, 2009, 2010, 2011, 2012, 846, 870, 869, 2024, 2026, - /* 270 */ 2027, 2028, 2029, 2, 2003, 2013, 192, 256, 317, 644, - /* 280 */ 9, 650, 764, 2264, 2031, 2034, 2738, 92, 642, 2777, - /* 290 */ 2929, 638, 634, 121, 2740, 854, 2742, 2743, 849, 1943, - /* 300 */ 872, 1941, 2303, 159, 2497, 168, 2802, 2831, 2935, 218, - /* 310 */ 115, 472, 2827, 2930, 799, 2000, 36, 474, 2054, 2055, - /* 320 */ 2056, 2057, 2058, 2062, 2063, 2064, 2065, 127, 2839, 2840, - /* 330 */ 497, 155, 2844, 2470, 2472, 1946, 1947, 2000, 381, 2002, - /* 340 */ 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 846, 870, - /* 350 */ 869, 2024, 2026, 2027, 2028, 2029, 2, 12, 47, 45, - /* 360 */ 747, 1968, 2739, 1971, 667, 183, 476, 185, 1942, 2220, - /* 370 */ 394, 188, 2839, 2840, 2390, 155, 2844, 813, 324, 714, - /* 380 */ 713, 712, 1940, 124, 2030, 85, 704, 154, 708, 392, - /* 390 */ 77, 2096, 707, 76, 495, 2419, 2846, 706, 711, 453, - /* 400 */ 452, 2620, 160, 705, 421, 2757, 2209, 451, 701, 700, - /* 410 */ 699, 2407, 2409, 381, 2025, 324, 252, 629, 627, 624, - /* 420 */ 622, 19, 2843, 2704, 2559, 850, 668, 138, 1948, 748, - /* 430 */ 137, 136, 135, 134, 133, 132, 131, 130, 129, 324, - /* 440 */ 783, 47, 45, 2035, 2154, 460, 2619, 2477, 911, 476, - /* 450 */ 2477, 1942, 868, 2417, 292, 1968, 2934, 441, 974, 589, - /* 460 */ 481, 15, 62, 928, 2929, 1940, 2375, 2030, 2475, 663, - /* 470 */ 2738, 2475, 499, 2777, 588, 459, 2619, 121, 2740, 854, - /* 480 */ 2742, 2743, 849, 2933, 872, 1967, 802, 2930, 2931, 200, - /* 490 */ 2208, 2831, 2391, 1815, 1816, 472, 2827, 2025, 2032, 2033, - /* 500 */ 51, 63, 184, 780, 779, 2152, 2153, 2155, 2156, 2157, - /* 510 */ 2349, 1948, 657, 2611, 147, 146, 145, 144, 143, 142, - /* 520 */ 141, 140, 139, 2879, 2851, 2093, 2094, 2095, 2851, 2851, - /* 530 */ 2851, 2851, 2851, 1612, 868, 2417, 213, 2003, 2013, 1869, - /* 540 */ 1870, 974, 1814, 1817, 48, 798, 207, 2031, 2034, 789, - /* 550 */ 784, 777, 773, 2929, 148, 89, 88, 546, 868, 2417, - /* 560 */ 231, 693, 1943, 666, 1941, 2098, 2099, 2100, 2101, 2102, - /* 570 */ 670, 797, 218, 538, 536, 2546, 2930, 799, 148, 1614, - /* 580 */ 62, 2032, 2033, 2096, 664, 698, 418, 1714, 1715, 525, - /* 590 */ 527, 2514, 521, 517, 513, 510, 539, 1972, 1946, 1947, - /* 600 */ 2000, 2477, 2002, 2005, 2006, 2007, 2008, 2009, 2010, 2011, - /* 610 */ 2012, 846, 870, 869, 2024, 2026, 2027, 2028, 2029, 2, - /* 620 */ 2003, 2013, 817, 909, 174, 173, 906, 905, 904, 171, - /* 630 */ 2031, 2034, 1521, 1521, 1520, 1520, 1675, 909, 174, 173, - /* 640 */ 906, 905, 904, 171, 2118, 1943, 324, 1941, 153, 665, - /* 650 */ 2565, 1666, 901, 900, 899, 1670, 898, 1672, 1673, 897, - /* 660 */ 894, 238, 1681, 891, 1683, 1684, 888, 885, 882, 138, - /* 670 */ 1522, 1522, 137, 136, 135, 134, 133, 132, 131, 130, - /* 680 */ 129, 1946, 1947, 2000, 324, 2002, 2005, 2006, 2007, 2008, - /* 690 */ 2009, 2010, 2011, 2012, 846, 870, 869, 2024, 2026, 2027, - /* 700 */ 2028, 2029, 2, 47, 45, 2739, 1494, 95, 181, 1942, - /* 710 */ 94, 476, 697, 1942, 1970, 1675, 696, 2093, 2094, 2095, - /* 720 */ 851, 2423, 2266, 1940, 12, 1501, 10, 1940, 531, 2030, - /* 730 */ 1666, 901, 900, 899, 1670, 898, 1672, 1673, 845, 844, - /* 740 */ 721, 1681, 843, 1683, 1684, 842, 885, 882, 2757, 745, - /* 750 */ 1496, 1499, 1500, 37, 340, 735, 1624, 533, 529, 2025, - /* 760 */ 158, 2096, 587, 2802, 324, 2125, 2704, 586, 850, 1948, - /* 770 */ 1623, 1967, 207, 1948, 289, 585, 803, 40, 39, 93, - /* 780 */ 480, 46, 44, 43, 42, 41, 47, 45, 868, 2417, - /* 790 */ 724, 868, 2417, 1948, 476, 543, 1942, 718, 716, 974, - /* 800 */ 542, 2545, 2739, 974, 286, 2477, 48, 2846, 223, 12, - /* 810 */ 1940, 55, 2030, 2738, 2846, 496, 2777, 851, 902, 2886, - /* 820 */ 121, 2740, 854, 2742, 2743, 849, 2475, 872, 748, 565, - /* 830 */ 2541, 1607, 2949, 2842, 2831, 878, 596, 2541, 472, 2827, - /* 840 */ 2841, 2061, 2025, 2032, 2033, 2757, 617, 2230, 35, 764, - /* 850 */ 72, 2389, 1501, 71, 40, 39, 1948, 2929, 46, 44, - /* 860 */ 43, 42, 41, 2704, 114, 850, 40, 39, 868, 2417, - /* 870 */ 46, 44, 43, 42, 41, 2935, 218, 1608, 1499, 1500, - /* 880 */ 2930, 799, 2003, 2013, 236, 2165, 974, 322, 547, 15, - /* 890 */ 2408, 241, 2031, 2034, 2851, 2093, 2094, 2095, 2851, 2851, - /* 900 */ 2851, 2851, 2851, 1943, 2644, 1941, 2229, 1943, 2704, 1941, - /* 910 */ 2738, 750, 2611, 2777, 868, 2417, 925, 121, 2740, 854, - /* 920 */ 2742, 2743, 849, 3, 872, 479, 2032, 2033, 34, 2949, - /* 930 */ 834, 2831, 2803, 181, 548, 472, 2827, 53, 2066, 1946, - /* 940 */ 1947, 2117, 2004, 1946, 1947, 2000, 2422, 2002, 2005, 2006, - /* 950 */ 2007, 2008, 2009, 2010, 2011, 2012, 846, 870, 869, 2024, - /* 960 */ 2026, 2027, 2028, 2029, 2, 2003, 2013, 2704, 419, 1967, - /* 970 */ 1965, 522, 2040, 498, 2137, 2031, 2034, 594, 1967, 380, - /* 980 */ 445, 181, 877, 876, 875, 927, 331, 332, 614, 1971, - /* 990 */ 1943, 330, 1941, 2300, 2422, 225, 909, 174, 173, 906, - /* 1000 */ 905, 904, 171, 299, 573, 2001, 616, 2399, 422, 868, - /* 1010 */ 2417, 420, 575, 40, 39, 763, 374, 46, 44, 43, - /* 1020 */ 42, 41, 387, 553, 2471, 2472, 1946, 1947, 2000, 567, - /* 1030 */ 2002, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 846, - /* 1040 */ 870, 869, 2024, 2026, 2027, 2028, 2029, 2, 40, 39, - /* 1050 */ 689, 688, 46, 44, 43, 42, 41, 836, 488, 2803, - /* 1060 */ 1971, 40, 39, 1585, 444, 46, 44, 43, 42, 41, - /* 1070 */ 945, 944, 943, 942, 505, 561, 941, 940, 162, 935, - /* 1080 */ 934, 933, 932, 931, 930, 929, 161, 923, 922, 921, - /* 1090 */ 504, 503, 918, 917, 916, 198, 197, 915, 500, 914, - /* 1100 */ 913, 912, 43, 42, 41, 2933, 2146, 2552, 2531, 1586, + /* 0 */ 2711, 2403, 647, 543, 2569, 648, 2254, 2569, 542, 37, + /* 10 */ 340, 550, 47, 45, 2119, 2401, 2736, 652, 798, 211, + /* 20 */ 476, 471, 1940, 649, 2567, 855, 2926, 2566, 855, 2715, + /* 30 */ 2711, 813, 124, 810, 157, 2461, 1938, 787, 2028, 2405, + /* 40 */ 1965, 495, 2416, 2694, 797, 218, 493, 40, 39, 2927, + /* 50 */ 799, 46, 44, 43, 42, 41, 2736, 764, 748, 2715, + /* 60 */ 2754, 612, 610, 2123, 415, 2926, 2754, 232, 2023, 1965, + /* 70 */ 788, 851, 868, 502, 501, 19, 2701, 527, 850, 2717, + /* 80 */ 2719, 473, 1946, 2932, 218, 810, 157, 2569, 2927, 799, + /* 90 */ 873, 2645, 460, 2616, 1966, 47, 45, 1947, 810, 157, + /* 100 */ 2754, 478, 482, 476, 2695, 1940, 482, 2566, 855, 2717, + /* 110 */ 2720, 670, 975, 873, 435, 15, 2701, 873, 850, 1938, + /* 120 */ 873, 2028, 868, 2735, 810, 157, 2774, 43, 42, 41, + /* 130 */ 121, 2737, 854, 2739, 2740, 849, 1965, 873, 786, 2204, + /* 140 */ 657, 2608, 200, 655, 2828, 515, 648, 2254, 472, 2824, + /* 150 */ 2229, 2023, 2030, 2031, 812, 187, 2836, 2837, 19, 155, + /* 160 */ 2841, 14, 13, 2735, 2057, 1946, 2774, 482, 219, 114, + /* 170 */ 121, 2737, 854, 2739, 2740, 849, 2875, 873, 873, 2736, + /* 180 */ 159, 488, 168, 2799, 2828, 869, 2414, 929, 472, 2824, + /* 190 */ 2373, 2001, 2011, 254, 851, 975, 2264, 650, 15, 2262, + /* 200 */ 256, 2029, 2032, 841, 650, 148, 2262, 194, 2836, 809, + /* 210 */ 2701, 149, 808, 693, 840, 531, 1941, 50, 1939, 2926, + /* 220 */ 127, 2836, 2837, 2754, 155, 2841, 1712, 1713, 508, 2058, + /* 230 */ 2474, 62, 868, 507, 868, 2030, 2031, 797, 218, 2701, + /* 240 */ 2002, 850, 2927, 799, 533, 529, 188, 2836, 2837, 817, + /* 250 */ 155, 2841, 1944, 1945, 1998, 172, 2000, 2003, 2004, 2005, + /* 260 */ 2006, 2007, 2008, 2009, 2010, 846, 871, 870, 2022, 2024, + /* 270 */ 2025, 2026, 2027, 2, 2001, 2011, 2071, 2094, 443, 1950, + /* 280 */ 9, 1968, 764, 207, 2029, 2032, 2735, 331, 332, 2774, + /* 290 */ 2926, 491, 330, 121, 2737, 854, 2739, 2740, 849, 1941, + /* 300 */ 873, 1939, 2301, 1999, 1998, 2946, 747, 2828, 2932, 218, + /* 310 */ 2542, 472, 2824, 2927, 799, 2418, 36, 474, 2052, 2053, + /* 320 */ 2054, 2055, 2056, 2060, 2061, 2062, 2063, 50, 910, 174, + /* 330 */ 173, 907, 906, 905, 171, 1944, 1945, 1998, 54, 2000, + /* 340 */ 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 846, 871, + /* 350 */ 870, 2022, 2024, 2025, 2026, 2027, 2, 12, 47, 45, + /* 360 */ 2398, 422, 2736, 1909, 2474, 183, 476, 291, 1940, 388, + /* 370 */ 394, 290, 441, 2451, 869, 2414, 744, 813, 2228, 714, + /* 380 */ 713, 712, 1938, 2472, 2028, 667, 704, 154, 708, 392, + /* 390 */ 76, 2094, 707, 75, 148, 487, 486, 706, 711, 453, + /* 400 */ 452, 324, 698, 705, 421, 2207, 2754, 451, 701, 700, + /* 410 */ 699, 2091, 2092, 2093, 2023, 324, 252, 629, 627, 624, + /* 420 */ 622, 19, 2701, 192, 850, 317, 138, 663, 1946, 137, + /* 430 */ 136, 135, 134, 133, 132, 131, 130, 129, 2701, 2931, + /* 440 */ 2474, 47, 45, 2033, 2556, 103, 668, 2926, 469, 476, + /* 450 */ 430, 1940, 1966, 458, 322, 736, 2474, 1965, 975, 2472, + /* 460 */ 798, 15, 62, 1493, 481, 1938, 2930, 2028, 2926, 2735, + /* 470 */ 2927, 2929, 2774, 1908, 926, 2472, 121, 2737, 854, 2739, + /* 480 */ 2740, 849, 1500, 873, 869, 2414, 797, 218, 200, 381, + /* 490 */ 2828, 2927, 799, 666, 472, 2824, 2388, 2023, 2030, 2031, + /* 500 */ 185, 63, 2218, 2094, 499, 490, 489, 1495, 1498, 1499, + /* 510 */ 138, 1946, 207, 137, 136, 135, 134, 133, 132, 131, + /* 520 */ 130, 129, 2876, 62, 2848, 2091, 2092, 2093, 2848, 2848, + /* 530 */ 2848, 2848, 2848, 734, 2931, 480, 182, 2001, 2011, 2543, + /* 540 */ 207, 975, 2926, 928, 48, 495, 2416, 2029, 2032, 728, + /* 550 */ 2617, 732, 730, 288, 287, 88, 87, 546, 2285, 783, + /* 560 */ 231, 2930, 1941, 1965, 1939, 2927, 2928, 2542, 869, 2414, + /* 570 */ 912, 40, 39, 538, 536, 46, 44, 43, 42, 41, + /* 580 */ 715, 2030, 2031, 1969, 1813, 1814, 418, 497, 223, 525, + /* 590 */ 2467, 2469, 521, 517, 513, 510, 539, 697, 1944, 1945, + /* 600 */ 1998, 696, 2000, 2003, 2004, 2005, 2006, 2007, 2008, 2009, + /* 610 */ 2010, 846, 871, 870, 2022, 2024, 2025, 2026, 2027, 2, + /* 620 */ 2001, 2011, 2096, 2097, 2098, 2099, 2100, 66, 1786, 1787, + /* 630 */ 2029, 2032, 100, 1812, 1815, 1673, 2848, 2091, 2092, 2093, + /* 640 */ 2848, 2848, 2848, 2848, 2848, 1941, 324, 1939, 2206, 62, + /* 650 */ 1664, 902, 901, 900, 1668, 899, 1670, 1671, 898, 895, + /* 660 */ 2410, 1679, 892, 1681, 1682, 889, 886, 883, 789, 784, + /* 670 */ 777, 773, 147, 146, 145, 144, 143, 142, 141, 140, + /* 680 */ 139, 1944, 1945, 1998, 238, 2000, 2003, 2004, 2005, 2006, + /* 690 */ 2007, 2008, 2009, 2010, 846, 871, 870, 2022, 2024, 2025, + /* 700 */ 2026, 2027, 2, 47, 45, 1623, 2736, 324, 869, 2414, + /* 710 */ 912, 476, 1969, 1940, 46, 44, 43, 42, 41, 1622, + /* 720 */ 1520, 851, 1519, 2883, 714, 713, 712, 1938, 55, 2028, + /* 730 */ 94, 704, 154, 708, 2002, 93, 153, 707, 62, 745, + /* 740 */ 869, 2414, 706, 711, 453, 452, 2931, 2736, 705, 541, + /* 750 */ 2754, 540, 451, 701, 700, 699, 214, 12, 1521, 2023, + /* 760 */ 547, 2038, 851, 1968, 2896, 479, 2701, 1965, 850, 2494, + /* 770 */ 879, 40, 39, 1946, 181, 46, 44, 43, 42, 41, + /* 780 */ 644, 498, 664, 539, 606, 2419, 47, 45, 748, 642, + /* 790 */ 181, 2754, 638, 634, 476, 617, 1940, 1999, 869, 2414, + /* 800 */ 2474, 2419, 92, 975, 559, 2538, 48, 2701, 496, 850, + /* 810 */ 1938, 2511, 2028, 2735, 2468, 2469, 2774, 1970, 548, 2472, + /* 820 */ 121, 2737, 854, 2739, 2740, 849, 1611, 873, 869, 2414, + /* 830 */ 565, 2538, 2946, 324, 2828, 869, 2414, 381, 472, 2824, + /* 840 */ 869, 2414, 2023, 2030, 2031, 839, 665, 2562, 567, 869, + /* 850 */ 2414, 2152, 243, 3, 2735, 581, 1946, 2774, 234, 2187, + /* 860 */ 669, 121, 2737, 854, 2739, 2740, 849, 53, 873, 582, + /* 870 */ 750, 2608, 1613, 2946, 1946, 2828, 100, 605, 242, 472, + /* 880 */ 2824, 51, 2001, 2011, 236, 213, 975, 596, 2538, 15, + /* 890 */ 903, 603, 2029, 2032, 446, 40, 39, 459, 2616, 46, + /* 900 */ 44, 43, 42, 41, 2409, 274, 12, 1941, 10, 1939, + /* 910 */ 780, 779, 2150, 2151, 2153, 2154, 2155, 878, 877, 876, + /* 920 */ 29, 193, 324, 2144, 589, 2521, 2030, 2031, 2059, 2227, + /* 930 */ 687, 683, 679, 675, 2390, 273, 322, 2145, 2002, 588, + /* 940 */ 834, 241, 2800, 1944, 1945, 1998, 1970, 2000, 2003, 2004, + /* 950 */ 2005, 2006, 2007, 2008, 2009, 2010, 846, 871, 870, 2022, + /* 960 */ 2024, 2025, 2026, 2027, 2, 2001, 2011, 84, 419, 557, + /* 970 */ 1963, 2194, 2474, 869, 2414, 2029, 2032, 594, 869, 2414, + /* 980 */ 445, 101, 587, 2143, 160, 2116, 271, 586, 614, 2701, + /* 990 */ 1941, 825, 1939, 583, 2406, 585, 869, 2414, 2411, 763, + /* 1000 */ 184, 1999, 292, 2164, 573, 836, 616, 2800, 2347, 869, + /* 1010 */ 2414, 420, 575, 40, 39, 34, 294, 46, 44, 43, + /* 1020 */ 42, 41, 2049, 553, 2843, 2064, 1944, 1945, 1998, 302, + /* 1030 */ 2000, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 846, + /* 1040 */ 871, 870, 2022, 2024, 2025, 2026, 2027, 2, 869, 2414, + /* 1050 */ 2840, 40, 39, 259, 522, 46, 44, 43, 42, 41, + /* 1060 */ 1940, 1969, 270, 1502, 444, 324, 261, 268, 816, 1964, + /* 1070 */ 869, 2414, 266, 661, 1938, 113, 561, 2298, 225, 910, + /* 1080 */ 174, 173, 907, 906, 905, 171, 2736, 1867, 1868, 2193, + /* 1090 */ 335, 258, 40, 39, 1523, 1524, 46, 44, 43, 42, + /* 1100 */ 41, 851, 2407, 775, 689, 688, 2930, 2549, 2528, 1500, /* 1110 */ 602, 601, 600, 599, 598, 593, 592, 591, 590, 427, - /* 1120 */ 2147, 2625, 580, 579, 578, 577, 576, 570, 569, 568, - /* 1130 */ 2739, 563, 562, 442, 2657, 868, 2417, 554, 1776, 1777, - /* 1140 */ 2004, 868, 2417, 2228, 1795, 851, 2725, 2899, 209, 2004, - /* 1150 */ 2421, 714, 713, 712, 491, 581, 60, 2227, 704, 154, - /* 1160 */ 708, 582, 221, 212, 707, 62, 2145, 761, 2739, 706, - /* 1170 */ 711, 453, 452, 2757, 2350, 705, 1628, 868, 2417, 451, - /* 1180 */ 701, 700, 699, 851, 293, 775, 868, 2417, 764, 182, - /* 1190 */ 1627, 2704, 2739, 850, 1524, 1525, 2929, 583, 502, 501, - /* 1200 */ 495, 2419, 792, 2001, 2704, 101, 669, 851, 1956, 2922, - /* 1210 */ 2727, 2757, 2001, 2196, 2935, 218, 868, 2417, 2704, 2930, - /* 1220 */ 799, 2477, 1949, 1972, 2030, 691, 690, 710, 709, 2704, - /* 1230 */ 2221, 850, 1971, 214, 2413, 2757, 2414, 2477, 2738, 182, - /* 1240 */ 1911, 2777, 825, 2226, 2225, 121, 2740, 854, 2742, 2743, - /* 1250 */ 849, 2420, 872, 2704, 2025, 850, 291, 2949, 2476, 2831, - /* 1260 */ 290, 868, 2417, 472, 2827, 541, 619, 540, 1948, 14, - /* 1270 */ 13, 2107, 487, 486, 2739, 903, 2738, 2224, 2468, 2777, - /* 1280 */ 1967, 294, 2223, 121, 2740, 854, 2742, 2743, 849, 851, - /* 1290 */ 872, 2863, 2222, 2219, 1972, 2949, 805, 2831, 838, 539, - /* 1300 */ 2738, 472, 2827, 2777, 2704, 2704, 2892, 121, 2740, 854, - /* 1310 */ 2742, 2743, 849, 2739, 872, 907, 2218, 2757, 2468, 2949, - /* 1320 */ 2217, 2831, 425, 424, 303, 472, 2827, 2216, 851, 939, - /* 1330 */ 937, 2195, 483, 150, 104, 2704, 1910, 850, 2704, 430, - /* 1340 */ 868, 2417, 458, 2704, 736, 2479, 492, 91, 2030, 324, - /* 1350 */ 868, 2417, 2739, 2704, 2704, 2215, 2757, 40, 39, 2214, - /* 1360 */ 302, 46, 44, 43, 42, 41, 2213, 851, 490, 489, - /* 1370 */ 816, 2236, 967, 106, 2704, 2212, 850, 2704, 2025, 868, - /* 1380 */ 2417, 2704, 2738, 2648, 2073, 2777, 868, 2417, 2704, 121, - /* 1390 */ 2740, 854, 2742, 2743, 849, 2757, 872, 868, 2417, 335, - /* 1400 */ 2211, 2949, 1957, 2831, 1952, 192, 830, 472, 2827, 908, - /* 1410 */ 105, 279, 2468, 2704, 277, 850, 2704, 342, 1951, 2739, - /* 1420 */ 2704, 2738, 318, 801, 2777, 868, 2417, 2704, 121, 2740, - /* 1430 */ 854, 2742, 2743, 849, 851, 872, 2704, 515, 1960, 1962, - /* 1440 */ 2806, 746, 2831, 1503, 1843, 862, 472, 2827, 388, 1966, - /* 1450 */ 2392, 2454, 870, 869, 2024, 2026, 2027, 2028, 2029, 977, - /* 1460 */ 2738, 2704, 2757, 2777, 868, 2417, 1972, 121, 2740, 854, - /* 1470 */ 2742, 2743, 849, 2524, 872, 738, 164, 737, 378, 2804, - /* 1480 */ 2704, 2831, 850, 163, 863, 472, 2827, 868, 2417, 2658, - /* 1490 */ 164, 40, 39, 965, 208, 46, 44, 43, 42, 41, - /* 1500 */ 615, 702, 703, 961, 957, 953, 949, 866, 373, 771, - /* 1510 */ 281, 868, 2417, 280, 2001, 283, 29, 557, 282, 285, - /* 1520 */ 49, 839, 284, 2287, 1605, 1603, 1933, 2738, 1909, 741, - /* 1530 */ 2777, 370, 781, 49, 121, 2740, 854, 2742, 2743, 849, - /* 1540 */ 749, 872, 125, 764, 2285, 715, 835, 1950, 2831, 2276, - /* 1550 */ 2739, 2929, 472, 2827, 73, 2198, 2199, 346, 201, 1859, - /* 1560 */ 485, 484, 1934, 2274, 310, 851, 717, 811, 814, 2935, - /* 1570 */ 218, 719, 172, 1867, 2930, 799, 870, 869, 2024, 2026, - /* 1580 */ 2027, 2028, 2029, 764, 152, 722, 2758, 120, 806, 2739, - /* 1590 */ 826, 2929, 2141, 2757, 764, 329, 117, 78, 2257, 2166, - /* 1600 */ 1954, 2882, 2929, 2151, 851, 14, 13, 64, 2342, 2935, - /* 1610 */ 218, 2704, 49, 850, 2930, 799, 2150, 349, 348, 49, - /* 1620 */ 2935, 218, 764, 351, 350, 2930, 799, 2341, 2739, 78, - /* 1630 */ 2929, 169, 2757, 150, 778, 344, 172, 832, 353, 352, - /* 1640 */ 327, 308, 1558, 851, 465, 326, 355, 354, 2935, 218, - /* 1650 */ 2704, 75, 850, 2930, 799, 815, 357, 356, 2738, 359, - /* 1660 */ 358, 2777, 361, 360, 296, 122, 2740, 854, 2742, 2743, - /* 1670 */ 849, 2757, 872, 363, 362, 365, 364, 2739, 333, 2831, - /* 1680 */ 822, 367, 366, 2830, 2827, 369, 368, 880, 1559, 2704, - /* 1690 */ 2067, 850, 851, 170, 919, 2014, 2268, 2738, 2051, 172, - /* 1700 */ 2777, 151, 1812, 169, 122, 2740, 854, 2742, 2743, 849, - /* 1710 */ 2739, 872, 1802, 785, 345, 461, 865, 1577, 2831, 1657, - /* 1720 */ 2757, 819, 837, 2827, 2550, 851, 920, 506, 524, 1953, - /* 1730 */ 2263, 2465, 757, 2883, 386, 2893, 852, 320, 2704, 2777, - /* 1740 */ 850, 315, 793, 122, 2740, 854, 2742, 2743, 849, 1575, - /* 1750 */ 872, 963, 794, 2757, 323, 2551, 2376, 2831, 5, 514, - /* 1760 */ 509, 434, 2827, 439, 1965, 523, 1975, 535, 534, 226, - /* 1770 */ 1688, 2704, 2739, 850, 537, 274, 1696, 227, 229, 1836, - /* 1780 */ 379, 551, 1703, 1966, 1701, 2738, 175, 851, 2777, 558, - /* 1790 */ 240, 193, 186, 2740, 854, 2742, 2743, 849, 560, 872, - /* 1800 */ 687, 683, 679, 675, 564, 273, 566, 608, 571, 584, - /* 1810 */ 597, 595, 2543, 604, 607, 2757, 609, 620, 2738, 621, - /* 1820 */ 618, 2777, 246, 245, 625, 189, 2740, 854, 2742, 2743, - /* 1830 */ 849, 623, 872, 2704, 626, 850, 249, 628, 1973, 765, - /* 1840 */ 2889, 645, 630, 4, 646, 1968, 653, 654, 257, 656, - /* 1850 */ 658, 102, 2739, 97, 271, 260, 1974, 659, 1976, 660, - /* 1860 */ 662, 1977, 1978, 263, 2560, 265, 2566, 851, 98, 99, - /* 1870 */ 100, 272, 671, 692, 725, 726, 2634, 126, 694, 2631, - /* 1880 */ 2738, 413, 740, 2777, 800, 2950, 2405, 122, 2740, 854, - /* 1890 */ 2742, 2743, 849, 276, 872, 2757, 742, 103, 2401, 278, - /* 1900 */ 165, 2831, 177, 123, 2403, 2398, 2828, 295, 178, 1969, - /* 1910 */ 179, 382, 2739, 2704, 2612, 850, 752, 300, 751, 759, - /* 1920 */ 782, 820, 753, 259, 298, 2898, 2897, 851, 791, 769, - /* 1930 */ 305, 8, 270, 191, 2630, 2870, 261, 268, 756, 2739, - /* 1940 */ 768, 767, 266, 661, 309, 766, 796, 311, 2850, 312, - /* 1950 */ 795, 316, 466, 804, 851, 2757, 313, 2952, 307, 807, - /* 1960 */ 2738, 258, 156, 2777, 758, 1970, 314, 186, 2740, 854, - /* 1970 */ 2742, 2743, 849, 2704, 872, 850, 2115, 2928, 2113, 204, - /* 1980 */ 325, 319, 2757, 166, 383, 818, 823, 2580, 2579, 2578, - /* 1990 */ 384, 824, 470, 167, 2847, 828, 831, 463, 61, 338, - /* 2000 */ 2704, 858, 850, 1, 856, 385, 116, 860, 1473, 861, - /* 2010 */ 2739, 2696, 2418, 2695, 2812, 2890, 343, 113, 2691, 2690, - /* 2020 */ 2738, 372, 2682, 2777, 464, 851, 2681, 411, 2740, 854, - /* 2030 */ 2742, 2743, 849, 220, 872, 2673, 2672, 2688, 874, 969, - /* 2040 */ 970, 2687, 375, 2679, 2678, 176, 389, 2738, 2739, 2667, - /* 2050 */ 2777, 971, 966, 2757, 411, 2740, 854, 2742, 2743, 849, - /* 2060 */ 376, 872, 2666, 851, 973, 2685, 2684, 423, 414, 2676, - /* 2070 */ 2675, 2704, 2664, 850, 2739, 2663, 744, 391, 2661, 2660, - /* 2080 */ 2469, 393, 401, 412, 426, 2656, 2655, 2654, 86, 848, - /* 2090 */ 402, 2757, 2649, 52, 511, 431, 512, 1893, 1894, 224, - /* 2100 */ 516, 2647, 432, 518, 519, 520, 1892, 2646, 2645, 2704, - /* 2110 */ 440, 850, 2643, 526, 2642, 528, 2641, 2757, 2738, 530, - /* 2120 */ 2640, 2777, 1880, 2616, 532, 404, 2740, 854, 2742, 2743, - /* 2130 */ 849, 228, 872, 2615, 230, 2704, 87, 850, 1839, 1838, - /* 2140 */ 2593, 2592, 2591, 2739, 544, 545, 2590, 2589, 2533, 549, - /* 2150 */ 1775, 2530, 2529, 552, 2523, 555, 2738, 556, 851, 2777, - /* 2160 */ 2520, 233, 2519, 189, 2740, 854, 2742, 2743, 849, 90, - /* 2170 */ 872, 2518, 2517, 2522, 2521, 235, 790, 2516, 2515, 2513, - /* 2180 */ 2512, 2511, 2738, 237, 2739, 2777, 2757, 239, 2490, 410, - /* 2190 */ 2740, 854, 2742, 2743, 849, 572, 872, 2510, 2797, 851, - /* 2200 */ 574, 2508, 2507, 2739, 2704, 2506, 850, 2505, 2504, 2528, - /* 2210 */ 2503, 2502, 2501, 2526, 2509, 2500, 2499, 2498, 851, 428, - /* 2220 */ 1781, 2483, 96, 2951, 2496, 2495, 2494, 2757, 475, 2493, - /* 2230 */ 2492, 2491, 2489, 2739, 2488, 2487, 2486, 2558, 2527, 2525, - /* 2240 */ 2485, 2484, 244, 2482, 2481, 2704, 2757, 850, 851, 2480, - /* 2250 */ 611, 2738, 613, 2478, 2777, 1625, 429, 2307, 411, 2740, - /* 2260 */ 854, 2742, 2743, 849, 2704, 872, 850, 2739, 1629, 477, - /* 2270 */ 253, 247, 2306, 2305, 248, 2304, 2757, 2302, 1621, 2299, - /* 2280 */ 2298, 631, 851, 2291, 635, 2278, 250, 2252, 251, 199, - /* 2290 */ 2251, 633, 2738, 2614, 2704, 2777, 850, 2739, 639, 411, - /* 2300 */ 2740, 854, 2742, 2743, 849, 632, 872, 637, 636, 640, - /* 2310 */ 2757, 739, 851, 641, 2777, 82, 2724, 643, 406, 2740, - /* 2320 */ 854, 2742, 2743, 849, 1502, 872, 83, 210, 2704, 651, - /* 2330 */ 850, 255, 2610, 2600, 2588, 262, 264, 2587, 2564, 267, - /* 2340 */ 2757, 2738, 2557, 269, 2777, 2393, 2301, 2297, 396, 2740, - /* 2350 */ 854, 2742, 2743, 849, 672, 872, 673, 2739, 2704, 674, - /* 2360 */ 850, 2295, 676, 677, 678, 1551, 2293, 680, 681, 682, - /* 2370 */ 2290, 684, 851, 685, 686, 2738, 2273, 2271, 2777, 2739, - /* 2380 */ 275, 74, 395, 2740, 854, 2742, 2743, 849, 2272, 872, - /* 2390 */ 2270, 2248, 2739, 2395, 851, 1707, 1708, 2394, 1610, 1609, - /* 2400 */ 2757, 1611, 936, 1606, 1604, 2738, 1593, 851, 2777, 2288, - /* 2410 */ 1602, 1601, 397, 2740, 854, 2742, 2743, 849, 2704, 872, - /* 2420 */ 850, 1600, 2757, 1599, 454, 1598, 2286, 938, 1595, 455, - /* 2430 */ 2277, 1594, 1592, 456, 720, 2757, 2275, 457, 2247, 723, - /* 2440 */ 2704, 2739, 850, 2246, 2245, 2244, 727, 2243, 729, 731, - /* 2450 */ 2242, 733, 128, 2704, 1874, 850, 851, 1878, 1876, 1873, - /* 2460 */ 2613, 56, 2609, 28, 67, 2738, 2599, 297, 2777, 1845, - /* 2470 */ 1847, 754, 403, 2740, 854, 2742, 2743, 849, 743, 872, - /* 2480 */ 180, 1864, 2586, 1849, 2757, 2585, 2934, 2738, 57, 755, - /* 2490 */ 2777, 1824, 1823, 301, 407, 2740, 854, 2742, 2743, 849, - /* 2500 */ 2738, 872, 2704, 2777, 850, 20, 760, 398, 2740, 854, - /* 2510 */ 2742, 2743, 849, 30, 872, 762, 2168, 2142, 215, 2739, - /* 2520 */ 304, 772, 770, 462, 306, 6, 17, 774, 7, 21, - /* 2530 */ 776, 22, 203, 2149, 851, 190, 32, 2108, 2739, 202, - /* 2540 */ 31, 2725, 216, 2136, 2106, 65, 84, 2110, 24, 2738, - /* 2550 */ 217, 321, 2777, 851, 2183, 2188, 408, 2740, 854, 2742, - /* 2560 */ 2743, 849, 2757, 872, 2182, 467, 2187, 2189, 2739, 2186, - /* 2570 */ 23, 18, 468, 2090, 2089, 195, 59, 2584, 2563, 107, - /* 2580 */ 2704, 2757, 850, 851, 108, 328, 2144, 2562, 58, 205, - /* 2590 */ 334, 109, 69, 2556, 827, 821, 337, 110, 25, 2704, - /* 2600 */ 2739, 850, 2042, 11, 336, 2041, 13, 1958, 2052, 2017, - /* 2610 */ 2016, 2757, 887, 196, 206, 851, 890, 893, 1993, 853, - /* 2620 */ 896, 38, 2555, 2015, 1985, 16, 347, 2738, 26, 2704, - /* 2630 */ 2777, 850, 27, 829, 399, 2740, 854, 2742, 2743, 849, - /* 2640 */ 70, 872, 857, 2757, 111, 117, 2738, 339, 1652, 2777, - /* 2650 */ 341, 2739, 859, 409, 2740, 854, 2742, 2743, 849, 112, - /* 2660 */ 872, 2704, 2019, 850, 864, 80, 851, 2782, 2204, 2781, - /* 2670 */ 871, 68, 2203, 873, 2202, 2201, 2738, 1689, 2739, 2777, - /* 2680 */ 879, 494, 881, 400, 2740, 854, 2742, 2743, 849, 1686, - /* 2690 */ 872, 883, 1685, 851, 2757, 884, 886, 1682, 889, 1676, - /* 2700 */ 892, 895, 1674, 1680, 118, 1679, 1678, 1677, 2738, 371, - /* 2710 */ 119, 2777, 2704, 1702, 850, 416, 2740, 854, 2742, 2743, - /* 2720 */ 849, 2757, 872, 81, 1698, 1549, 910, 1589, 1588, 1587, - /* 2730 */ 1584, 1581, 1580, 1579, 1578, 1576, 1574, 1573, 1619, 2704, - /* 2740 */ 2739, 850, 1572, 924, 926, 1618, 222, 1570, 1569, 1567, - /* 2750 */ 1568, 1566, 1565, 1564, 1615, 851, 1613, 1561, 1560, 2738, - /* 2760 */ 1557, 2739, 2777, 1555, 1556, 1554, 417, 2740, 854, 2742, - /* 2770 */ 2743, 849, 2296, 872, 946, 948, 851, 947, 2294, 950, - /* 2780 */ 951, 952, 2292, 2757, 954, 2289, 2738, 955, 956, 2777, - /* 2790 */ 958, 960, 2269, 2751, 2740, 854, 2742, 2743, 849, 959, - /* 2800 */ 872, 2704, 2739, 850, 2757, 962, 2267, 1491, 964, 2241, - /* 2810 */ 1474, 1479, 968, 1481, 976, 377, 972, 851, 1944, 390, - /* 2820 */ 975, 2207, 2704, 2739, 850, 2207, 2207, 2207, 2207, 2207, - /* 2830 */ 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 851, 2207, - /* 2840 */ 2207, 2207, 2207, 2207, 2207, 2757, 2207, 2207, 2738, 2207, - /* 2850 */ 2207, 2777, 2207, 2207, 2207, 2750, 2740, 854, 2742, 2743, - /* 2860 */ 849, 2207, 872, 2704, 2207, 850, 2757, 2207, 2207, 2738, - /* 2870 */ 2207, 2207, 2777, 2207, 2207, 2207, 2749, 2740, 854, 2742, - /* 2880 */ 2743, 849, 2207, 872, 2704, 2739, 850, 2207, 2207, 2207, - /* 2890 */ 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, - /* 2900 */ 851, 2739, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, - /* 2910 */ 2738, 2207, 2207, 2777, 2207, 2207, 851, 436, 2740, 854, - /* 2920 */ 2742, 2743, 849, 2207, 872, 2207, 2207, 2207, 2757, 2207, - /* 2930 */ 2207, 2738, 2207, 2207, 2777, 2207, 2207, 2207, 437, 2740, - /* 2940 */ 854, 2742, 2743, 849, 2757, 872, 2704, 2207, 850, 2207, - /* 2950 */ 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, - /* 2960 */ 2207, 2207, 2704, 2739, 850, 2207, 2207, 2207, 2207, 2207, - /* 2970 */ 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 851, 2207, - /* 2980 */ 2207, 2207, 2739, 2207, 2207, 2207, 2207, 2207, 2207, 2207, - /* 2990 */ 2207, 2207, 2207, 2738, 2207, 2207, 2777, 851, 2207, 2207, - /* 3000 */ 433, 2740, 854, 2742, 2743, 849, 2757, 872, 2207, 2738, - /* 3010 */ 2207, 2207, 2777, 2207, 2207, 2207, 438, 2740, 854, 2742, - /* 3020 */ 2743, 849, 2207, 872, 2704, 2757, 850, 2207, 2207, 2207, - /* 3030 */ 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, - /* 3040 */ 2207, 2207, 2207, 2704, 2207, 850, 2207, 2207, 2207, 2207, - /* 3050 */ 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, - /* 3060 */ 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, 2207, - /* 3070 */ 2207, 852, 2207, 2207, 2777, 2207, 2207, 2207, 406, 2740, - /* 3080 */ 854, 2742, 2743, 849, 2207, 872, 2207, 2207, 2207, 2207, - /* 3090 */ 2738, 2207, 2207, 2777, 2207, 2207, 2207, 405, 2740, 854, - /* 3100 */ 2742, 2743, 849, 2207, 872, + /* 1120 */ 1946, 2163, 580, 579, 578, 577, 576, 570, 569, 568, + /* 1130 */ 2754, 563, 562, 442, 2226, 1498, 1499, 554, 1774, 1775, + /* 1140 */ 60, 691, 690, 182, 1793, 78, 2701, 805, 850, 158, + /* 1150 */ 975, 761, 2799, 2417, 946, 945, 944, 943, 505, 2135, + /* 1160 */ 942, 941, 162, 936, 935, 934, 933, 932, 931, 930, + /* 1170 */ 161, 924, 923, 922, 504, 503, 919, 918, 917, 198, + /* 1180 */ 197, 916, 500, 915, 914, 913, 1969, 502, 501, 869, + /* 1190 */ 2414, 2736, 1965, 2735, 2701, 2225, 2774, 1954, 2224, 91, + /* 1200 */ 121, 2737, 854, 2739, 2740, 849, 851, 873, 2919, 830, + /* 1210 */ 721, 1947, 2946, 2028, 2828, 2223, 33, 2222, 472, 2824, + /* 1220 */ 2221, 2736, 40, 39, 2220, 735, 46, 44, 43, 42, + /* 1230 */ 41, 1627, 869, 2414, 221, 2754, 851, 104, 2860, 869, + /* 1240 */ 2414, 2641, 2217, 2023, 289, 1626, 869, 2414, 1520, 2476, + /* 1250 */ 1519, 2701, 342, 850, 1941, 2701, 1939, 1946, 2701, 862, + /* 1260 */ 724, 374, 2216, 450, 449, 2754, 863, 718, 716, 869, + /* 1270 */ 2414, 1841, 869, 2414, 286, 2701, 303, 2701, 710, 709, + /* 1280 */ 2701, 2701, 2115, 850, 2701, 2215, 1521, 838, 181, 867, + /* 1290 */ 1944, 1945, 370, 940, 938, 1970, 2474, 2214, 2735, 2420, + /* 1300 */ 2843, 2774, 2701, 2234, 968, 121, 2737, 854, 2739, 2740, + /* 1310 */ 849, 802, 873, 2213, 2622, 2473, 164, 2946, 2212, 2828, + /* 1320 */ 72, 619, 2701, 472, 2824, 71, 2839, 105, 2735, 2211, + /* 1330 */ 2210, 2774, 2654, 792, 150, 121, 2737, 854, 2739, 2740, + /* 1340 */ 849, 2736, 873, 448, 447, 2701, 695, 2946, 90, 2828, + /* 1350 */ 425, 424, 35, 472, 2824, 2209, 851, 2701, 40, 39, + /* 1360 */ 483, 380, 46, 44, 43, 42, 41, 697, 2196, 2197, + /* 1370 */ 2843, 696, 2736, 2701, 492, 293, 2028, 904, 2701, 908, + /* 1380 */ 2465, 909, 2465, 1606, 2465, 2754, 764, 851, 2391, 2701, + /* 1390 */ 2701, 1955, 279, 1950, 2926, 277, 2838, 2283, 738, 1857, + /* 1400 */ 737, 2701, 2105, 850, 615, 1949, 2023, 281, 2736, 164, + /* 1410 */ 280, 283, 2932, 218, 282, 2701, 2754, 2927, 799, 717, + /* 1420 */ 1970, 163, 2655, 851, 801, 299, 1999, 1958, 1960, 1607, + /* 1430 */ 285, 702, 2701, 284, 850, 387, 771, 49, 703, 806, + /* 1440 */ 2266, 871, 870, 2022, 2024, 2025, 2026, 2027, 2735, 2274, + /* 1450 */ 2272, 2774, 2754, 2722, 1604, 121, 2737, 854, 2739, 2740, + /* 1460 */ 849, 1602, 873, 49, 201, 172, 2418, 2803, 2701, 2828, + /* 1470 */ 850, 719, 722, 472, 2824, 2387, 764, 14, 13, 2735, + /* 1480 */ 212, 119, 2774, 116, 2926, 209, 121, 2737, 854, 2739, + /* 1490 */ 2740, 849, 1865, 873, 1948, 964, 329, 77, 2801, 64, + /* 1500 */ 2828, 49, 2932, 218, 472, 2824, 2348, 2927, 799, 1584, + /* 1510 */ 49, 77, 169, 349, 348, 2735, 2219, 2724, 2774, 2139, + /* 1520 */ 2149, 920, 121, 2737, 854, 2739, 2740, 849, 2889, 873, + /* 1530 */ 150, 172, 351, 350, 835, 192, 2828, 2736, 353, 352, + /* 1540 */ 472, 2824, 355, 354, 1576, 1673, 2148, 308, 815, 318, + /* 1550 */ 357, 356, 851, 781, 1931, 1585, 1907, 811, 359, 358, + /* 1560 */ 1664, 902, 901, 900, 1668, 899, 1670, 1671, 845, 844, + /* 1570 */ 310, 1679, 843, 1681, 1682, 842, 886, 883, 746, 333, + /* 1580 */ 822, 2754, 2065, 1557, 2012, 361, 360, 1952, 485, 484, + /* 1590 */ 1932, 363, 362, 1810, 1800, 345, 978, 2701, 74, 850, + /* 1600 */ 881, 803, 365, 364, 871, 870, 2022, 2024, 2025, 2026, + /* 1610 */ 2027, 921, 741, 866, 1655, 378, 367, 366, 2736, 170, + /* 1620 */ 910, 174, 173, 907, 906, 905, 171, 369, 368, 1558, + /* 1630 */ 966, 208, 749, 851, 1574, 152, 172, 2755, 2340, 2255, + /* 1640 */ 962, 958, 954, 950, 2735, 373, 151, 2774, 2879, 778, + /* 1650 */ 2339, 122, 2737, 854, 2739, 2740, 849, 169, 873, 465, + /* 1660 */ 785, 819, 2754, 461, 2547, 2828, 764, 506, 814, 2827, + /* 1670 */ 2824, 524, 2261, 2462, 2926, 793, 1951, 757, 2701, 794, + /* 1680 */ 850, 386, 2880, 1686, 2890, 320, 764, 2548, 315, 323, + /* 1690 */ 514, 120, 2932, 218, 2926, 2374, 346, 2927, 799, 2736, + /* 1700 */ 40, 39, 1694, 5, 46, 44, 43, 42, 41, 439, + /* 1710 */ 509, 1963, 2932, 218, 851, 1973, 523, 2927, 799, 1701, + /* 1720 */ 534, 227, 764, 2736, 226, 2735, 535, 826, 2774, 1699, + /* 1730 */ 2926, 537, 122, 2737, 854, 2739, 2740, 849, 848, 873, + /* 1740 */ 175, 229, 2736, 2754, 379, 1834, 2828, 551, 2932, 218, + /* 1750 */ 837, 2824, 1964, 2927, 799, 558, 240, 851, 560, 2701, + /* 1760 */ 564, 850, 566, 571, 608, 584, 2540, 2754, 595, 597, + /* 1770 */ 604, 607, 344, 609, 832, 620, 621, 327, 618, 246, + /* 1780 */ 245, 623, 326, 2701, 625, 850, 2754, 626, 249, 628, + /* 1790 */ 630, 1971, 4, 645, 656, 653, 257, 1966, 646, 658, + /* 1800 */ 654, 296, 2701, 96, 850, 1972, 852, 659, 1974, 2774, + /* 1810 */ 2736, 662, 660, 122, 2737, 854, 2739, 2740, 849, 260, + /* 1820 */ 873, 263, 1975, 265, 97, 851, 1976, 2828, 98, 2557, + /* 1830 */ 2735, 434, 2824, 2774, 2563, 692, 671, 410, 2737, 854, + /* 1840 */ 2739, 2740, 849, 847, 873, 833, 2793, 99, 272, 2735, + /* 1850 */ 2736, 694, 2774, 2404, 2754, 126, 186, 2737, 854, 2739, + /* 1860 */ 2740, 849, 276, 873, 2400, 851, 725, 278, 726, 413, + /* 1870 */ 2701, 177, 850, 123, 740, 2736, 2402, 2397, 178, 179, + /* 1880 */ 102, 742, 295, 1967, 751, 125, 2631, 752, 382, 758, + /* 1890 */ 851, 2609, 165, 300, 2754, 759, 2628, 2627, 753, 782, + /* 1900 */ 756, 820, 298, 765, 2886, 8, 768, 2867, 791, 766, + /* 1910 */ 2701, 769, 850, 767, 2895, 2894, 191, 2735, 2736, 2754, + /* 1920 */ 2774, 309, 305, 307, 189, 2737, 854, 2739, 2740, 849, + /* 1930 */ 796, 873, 311, 851, 313, 2701, 795, 850, 314, 466, + /* 1940 */ 2949, 807, 2925, 2847, 2736, 804, 156, 312, 2113, 316, + /* 1950 */ 1968, 2111, 204, 325, 166, 818, 383, 2735, 2577, 851, + /* 1960 */ 2774, 2844, 2754, 2576, 186, 2737, 854, 2739, 2740, 849, + /* 1970 */ 1, 873, 384, 2575, 470, 823, 824, 167, 2701, 831, + /* 1980 */ 850, 828, 2735, 800, 2947, 2774, 2736, 338, 2754, 122, + /* 1990 */ 2737, 854, 2739, 2740, 849, 61, 873, 2809, 858, 856, + /* 2000 */ 860, 851, 463, 2828, 2701, 385, 850, 861, 2825, 319, + /* 2010 */ 343, 112, 2887, 220, 2415, 115, 389, 2693, 1472, 2692, + /* 2020 */ 971, 2688, 2687, 2736, 2679, 2735, 875, 970, 2774, 2678, + /* 2030 */ 2754, 372, 411, 2737, 854, 2739, 2740, 849, 851, 873, + /* 2040 */ 2670, 2669, 2685, 2684, 176, 972, 2701, 375, 850, 967, + /* 2050 */ 376, 2735, 2676, 52, 2774, 2675, 974, 2664, 404, 2737, + /* 2060 */ 854, 2739, 2740, 849, 393, 873, 2663, 2754, 2682, 2681, + /* 2070 */ 464, 2673, 2672, 423, 2661, 2660, 2658, 414, 391, 2657, + /* 2080 */ 744, 2466, 431, 2701, 432, 850, 426, 401, 412, 402, + /* 2090 */ 2653, 2652, 2651, 2735, 85, 2646, 2774, 511, 512, 1891, + /* 2100 */ 411, 2737, 854, 2739, 2740, 849, 1892, 873, 224, 790, + /* 2110 */ 2736, 516, 2644, 518, 519, 520, 1890, 2643, 2642, 440, + /* 2120 */ 2640, 526, 2639, 528, 2638, 848, 530, 2637, 1878, 532, + /* 2130 */ 2735, 2613, 2736, 2774, 228, 2612, 230, 189, 2737, 854, + /* 2140 */ 2739, 2740, 849, 86, 873, 1837, 2590, 851, 1836, 2589, + /* 2150 */ 2588, 544, 545, 2587, 2754, 2586, 2530, 549, 1773, 2736, + /* 2160 */ 2527, 552, 2526, 2520, 555, 556, 2517, 233, 2516, 2515, + /* 2170 */ 2701, 2514, 850, 89, 851, 2519, 2754, 2518, 2513, 2512, + /* 2180 */ 235, 2510, 2509, 2508, 572, 2507, 237, 574, 2505, 2504, + /* 2190 */ 2503, 2502, 2701, 2501, 850, 2525, 2736, 2948, 2500, 2499, + /* 2200 */ 2498, 2523, 2506, 2754, 2497, 2496, 2495, 2493, 2492, 2491, + /* 2210 */ 2490, 851, 2489, 2488, 2487, 239, 475, 2735, 2486, 2701, + /* 2220 */ 2774, 850, 2485, 2736, 410, 2737, 854, 2739, 2740, 849, + /* 2230 */ 2484, 873, 2483, 2794, 95, 2555, 2524, 2522, 851, 2735, + /* 2240 */ 2754, 2482, 2774, 477, 2481, 2736, 411, 2737, 854, 2739, + /* 2250 */ 2740, 849, 2480, 873, 244, 1779, 2701, 2479, 850, 611, + /* 2260 */ 851, 2478, 2477, 2475, 613, 1624, 2735, 2754, 428, 2774, + /* 2270 */ 1628, 429, 2736, 411, 2737, 854, 2739, 2740, 849, 2305, + /* 2280 */ 873, 2304, 2303, 2701, 2302, 850, 1620, 851, 247, 2754, + /* 2290 */ 2300, 248, 250, 251, 2297, 631, 632, 633, 2296, 636, + /* 2300 */ 635, 2289, 637, 739, 639, 2701, 2774, 850, 640, 2736, + /* 2310 */ 406, 2737, 854, 2739, 2740, 849, 2754, 873, 641, 2276, + /* 2320 */ 2250, 643, 253, 2721, 851, 199, 1501, 81, 210, 651, + /* 2330 */ 2735, 2249, 2701, 2774, 850, 2611, 255, 396, 2737, 854, + /* 2340 */ 2739, 2740, 849, 82, 873, 2607, 2597, 2585, 262, 264, + /* 2350 */ 2736, 267, 2735, 2754, 2584, 2774, 2561, 269, 2554, 395, + /* 2360 */ 2737, 854, 2739, 2740, 849, 851, 873, 2392, 2299, 2701, + /* 2370 */ 2295, 850, 1550, 672, 674, 673, 2293, 676, 677, 2735, + /* 2380 */ 678, 2291, 2774, 681, 680, 2736, 397, 2737, 854, 2739, + /* 2390 */ 2740, 849, 2288, 873, 2754, 684, 682, 685, 2271, 686, + /* 2400 */ 851, 2269, 2270, 2268, 2246, 2394, 1705, 1706, 2393, 1610, + /* 2410 */ 2701, 1609, 850, 73, 1608, 1605, 2735, 2736, 275, 2774, + /* 2420 */ 2286, 1603, 1601, 403, 2737, 854, 2739, 2740, 849, 2754, + /* 2430 */ 873, 1600, 851, 1599, 2284, 1598, 2736, 1592, 454, 455, + /* 2440 */ 937, 2275, 1597, 939, 456, 2701, 720, 850, 1594, 1593, + /* 2450 */ 1591, 851, 2273, 457, 2245, 723, 2244, 2735, 2243, 727, + /* 2460 */ 2774, 2754, 2242, 729, 407, 2737, 854, 2739, 2740, 849, + /* 2470 */ 2241, 873, 731, 2240, 1872, 733, 1874, 2701, 1871, 850, + /* 2480 */ 2754, 128, 2736, 2610, 1862, 1876, 56, 28, 743, 67, + /* 2490 */ 1847, 2606, 2735, 1843, 297, 2774, 2701, 851, 850, 398, + /* 2500 */ 2737, 854, 2739, 2740, 849, 2596, 873, 57, 1845, 754, + /* 2510 */ 755, 2583, 301, 2582, 2736, 1822, 180, 2931, 760, 1821, + /* 2520 */ 770, 762, 20, 6, 2735, 2166, 2754, 2774, 462, 851, + /* 2530 */ 17, 408, 2737, 854, 2739, 2740, 849, 2140, 873, 30, + /* 2540 */ 304, 772, 2701, 2735, 850, 774, 2774, 7, 215, 306, + /* 2550 */ 399, 2737, 854, 2739, 2740, 849, 776, 873, 2754, 21, + /* 2560 */ 22, 203, 2147, 190, 202, 31, 32, 2134, 2722, 23, + /* 2570 */ 83, 216, 2106, 2108, 2701, 2104, 850, 65, 2736, 217, + /* 2580 */ 24, 2186, 2187, 2088, 18, 2181, 2180, 467, 2185, 2735, + /* 2590 */ 2184, 468, 2774, 851, 2087, 321, 409, 2737, 854, 2739, + /* 2600 */ 2740, 849, 2736, 873, 58, 59, 2581, 195, 2560, 106, + /* 2610 */ 107, 2559, 328, 108, 2142, 205, 334, 851, 69, 2553, + /* 2620 */ 827, 2735, 2754, 337, 2774, 821, 829, 2736, 400, 2737, + /* 2630 */ 854, 2739, 2740, 849, 109, 873, 25, 2040, 2701, 336, + /* 2640 */ 850, 11, 851, 2039, 13, 1956, 2754, 2015, 2050, 196, + /* 2650 */ 2014, 888, 206, 1991, 891, 339, 894, 897, 38, 2552, + /* 2660 */ 110, 2013, 2701, 16, 850, 859, 853, 2736, 26, 2389, + /* 2670 */ 864, 2754, 347, 1983, 27, 70, 865, 857, 341, 111, + /* 2680 */ 79, 880, 851, 2779, 116, 2735, 2778, 2701, 2774, 850, + /* 2690 */ 872, 2736, 416, 2737, 854, 2739, 2740, 849, 2017, 873, + /* 2700 */ 68, 2202, 874, 2201, 2199, 2200, 851, 1687, 494, 2735, + /* 2710 */ 882, 2754, 2774, 1684, 884, 885, 417, 2737, 854, 2739, + /* 2720 */ 2740, 849, 887, 873, 890, 1683, 1680, 2701, 1674, 850, + /* 2730 */ 893, 1672, 2736, 896, 2735, 2754, 1678, 2774, 371, 1677, + /* 2740 */ 117, 2748, 2737, 854, 2739, 2740, 849, 851, 873, 118, + /* 2750 */ 1676, 2701, 1700, 850, 1675, 80, 1696, 1588, 1548, 911, + /* 2760 */ 1587, 1586, 1583, 1580, 1579, 1578, 1577, 1575, 1573, 1572, + /* 2770 */ 925, 1618, 2736, 1571, 2735, 1617, 2754, 2774, 222, 927, + /* 2780 */ 1569, 2747, 2737, 854, 2739, 2740, 849, 851, 873, 1568, + /* 2790 */ 1567, 1566, 2701, 1565, 850, 1564, 1563, 1614, 2735, 2736, + /* 2800 */ 1612, 2774, 1560, 1559, 1556, 2746, 2737, 854, 2739, 2740, + /* 2810 */ 849, 1555, 873, 1554, 851, 1553, 2754, 2294, 2736, 947, + /* 2820 */ 949, 2292, 951, 2290, 948, 952, 953, 956, 955, 957, + /* 2830 */ 2287, 959, 2701, 851, 850, 960, 2267, 961, 963, 2735, + /* 2840 */ 2265, 965, 2774, 2754, 1490, 2239, 436, 2737, 854, 2739, + /* 2850 */ 2740, 849, 1478, 873, 1473, 969, 1480, 377, 973, 2701, + /* 2860 */ 1942, 850, 2754, 390, 976, 2205, 977, 2205, 2205, 2205, + /* 2870 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2701, 2735, + /* 2880 */ 850, 2205, 2774, 2736, 2205, 2205, 437, 2737, 854, 2739, + /* 2890 */ 2740, 849, 2205, 873, 2205, 2205, 2736, 2205, 851, 2205, + /* 2900 */ 2205, 2205, 2205, 2205, 2205, 2205, 2735, 2205, 2205, 2774, + /* 2910 */ 2205, 851, 2205, 433, 2737, 854, 2739, 2740, 849, 2205, + /* 2920 */ 873, 2205, 2205, 2205, 2205, 2735, 2205, 2754, 2774, 2205, + /* 2930 */ 2205, 2205, 438, 2737, 854, 2739, 2740, 849, 2205, 873, + /* 2940 */ 2754, 2205, 2205, 2701, 2205, 850, 2205, 2205, 2205, 2205, + /* 2950 */ 2205, 2205, 2205, 2205, 2205, 2205, 2701, 2205, 850, 2205, + /* 2960 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 2970 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 2980 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 2990 */ 852, 2205, 2205, 2774, 2205, 2205, 2205, 406, 2737, 854, + /* 3000 */ 2739, 2740, 849, 2735, 873, 2205, 2774, 2205, 2205, 2205, + /* 3010 */ 405, 2737, 854, 2739, 2740, 849, 2205, 873, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 425, 427, 404, 444, 427, 431, 390, 444, 522, 393, - /* 10 */ 394, 425, 12, 13, 14, 381, 530, 458, 522, 421, - /* 20 */ 20, 458, 22, 464, 465, 20, 530, 464, 465, 412, - /* 30 */ 396, 433, 395, 396, 548, 549, 36, 412, 38, 553, - /* 40 */ 554, 12, 13, 381, 396, 549, 33, 8, 9, 553, - /* 50 */ 554, 12, 13, 14, 15, 16, 3, 390, 424, 442, - /* 60 */ 393, 394, 41, 42, 381, 36, 492, 442, 68, 492, - /* 70 */ 21, 20, 424, 20, 427, 75, 442, 503, 444, 396, - /* 80 */ 503, 20, 82, 4, 395, 396, 37, 2, 39, 40, - /* 90 */ 41, 42, 424, 8, 9, 12, 13, 12, 13, 14, - /* 100 */ 15, 16, 434, 20, 442, 22, 91, 424, 20, 492, - /* 110 */ 493, 494, 112, 445, 75, 115, 424, 492, 493, 36, - /* 120 */ 503, 38, 20, 489, 432, 442, 492, 444, 503, 116, - /* 130 */ 496, 497, 498, 499, 500, 501, 20, 503, 378, 492, - /* 140 */ 119, 120, 508, 122, 510, 453, 498, 425, 514, 515, - /* 150 */ 503, 68, 152, 153, 517, 518, 519, 520, 75, 522, - /* 160 */ 523, 74, 123, 395, 425, 82, 145, 391, 534, 116, - /* 170 */ 149, 395, 489, 397, 159, 492, 542, 438, 381, 496, - /* 180 */ 497, 498, 499, 500, 501, 502, 503, 504, 505, 395, - /* 190 */ 396, 191, 192, 396, 115, 112, 191, 192, 115, 184, - /* 200 */ 185, 201, 202, 115, 395, 396, 20, 518, 519, 520, - /* 210 */ 488, 522, 523, 198, 446, 447, 216, 449, 218, 530, - /* 220 */ 452, 424, 12, 13, 14, 15, 16, 423, 468, 190, - /* 230 */ 444, 115, 125, 473, 14, 152, 153, 548, 549, 442, - /* 240 */ 20, 444, 553, 554, 450, 441, 193, 218, 395, 396, - /* 250 */ 464, 465, 252, 253, 254, 115, 256, 257, 258, 259, + /* 0 */ 412, 426, 390, 467, 443, 393, 394, 443, 472, 510, + /* 10 */ 511, 395, 12, 13, 14, 426, 381, 14, 521, 424, + /* 20 */ 20, 457, 22, 20, 463, 464, 529, 463, 464, 441, + /* 30 */ 412, 396, 425, 395, 396, 440, 36, 396, 38, 428, + /* 40 */ 20, 434, 435, 428, 547, 548, 431, 8, 9, 552, + /* 50 */ 553, 12, 13, 14, 15, 16, 381, 521, 395, 441, + /* 60 */ 425, 445, 446, 14, 448, 529, 425, 451, 68, 20, + /* 70 */ 20, 396, 20, 12, 13, 75, 441, 73, 443, 491, + /* 80 */ 492, 493, 82, 547, 548, 395, 396, 443, 552, 553, + /* 90 */ 502, 0, 485, 486, 20, 12, 13, 36, 395, 396, + /* 100 */ 425, 457, 491, 20, 428, 22, 491, 463, 464, 491, + /* 110 */ 492, 74, 112, 502, 75, 115, 441, 502, 443, 36, + /* 120 */ 502, 38, 20, 488, 395, 396, 491, 14, 15, 16, + /* 130 */ 495, 496, 497, 498, 499, 500, 20, 502, 497, 378, + /* 140 */ 477, 478, 507, 390, 509, 54, 393, 394, 513, 514, + /* 150 */ 381, 68, 152, 153, 516, 517, 518, 519, 75, 521, + /* 160 */ 522, 1, 2, 488, 125, 82, 491, 491, 533, 117, + /* 170 */ 495, 496, 497, 498, 499, 500, 541, 502, 502, 381, + /* 180 */ 505, 36, 507, 508, 509, 395, 396, 411, 513, 514, + /* 190 */ 414, 191, 192, 391, 396, 112, 398, 395, 115, 397, + /* 200 */ 391, 201, 202, 426, 395, 415, 397, 517, 518, 519, + /* 210 */ 441, 521, 522, 423, 437, 211, 216, 115, 218, 529, + /* 220 */ 517, 518, 519, 425, 521, 522, 152, 153, 467, 190, + /* 230 */ 425, 115, 20, 472, 20, 152, 153, 547, 548, 441, + /* 240 */ 191, 443, 552, 553, 240, 241, 517, 518, 519, 444, + /* 250 */ 521, 522, 252, 253, 254, 33, 256, 257, 258, 259, /* 260 */ 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, - /* 270 */ 270, 271, 272, 273, 191, 192, 524, 391, 526, 54, - /* 280 */ 44, 395, 522, 397, 201, 202, 489, 180, 63, 492, - /* 290 */ 530, 66, 67, 496, 497, 498, 499, 500, 501, 216, - /* 300 */ 503, 218, 0, 506, 0, 508, 509, 510, 548, 549, - /* 310 */ 124, 514, 515, 553, 554, 254, 277, 278, 279, 280, - /* 320 */ 281, 282, 283, 284, 285, 286, 287, 518, 519, 520, - /* 330 */ 440, 522, 523, 443, 444, 252, 253, 254, 424, 256, + /* 270 */ 270, 271, 272, 273, 191, 192, 116, 155, 420, 218, + /* 280 */ 44, 20, 521, 425, 201, 202, 488, 146, 147, 491, + /* 290 */ 529, 36, 151, 495, 496, 497, 498, 499, 500, 216, + /* 300 */ 502, 218, 0, 254, 254, 507, 20, 509, 547, 548, + /* 310 */ 452, 513, 514, 552, 553, 426, 277, 278, 279, 280, + /* 320 */ 281, 282, 283, 284, 285, 286, 287, 115, 145, 146, + /* 330 */ 147, 148, 149, 150, 151, 252, 253, 254, 116, 256, /* 340 */ 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, /* 350 */ 267, 268, 269, 270, 271, 272, 273, 274, 12, 13, - /* 360 */ 20, 20, 381, 20, 395, 18, 20, 380, 22, 382, - /* 370 */ 23, 518, 519, 520, 0, 522, 523, 396, 299, 77, - /* 380 */ 78, 79, 36, 424, 38, 402, 84, 85, 86, 42, - /* 390 */ 43, 155, 90, 46, 435, 436, 495, 95, 96, 97, - /* 400 */ 98, 487, 419, 101, 57, 424, 0, 105, 106, 107, - /* 410 */ 108, 428, 429, 424, 68, 299, 69, 70, 71, 72, - /* 420 */ 73, 75, 521, 442, 455, 444, 457, 21, 82, 395, - /* 430 */ 24, 25, 26, 27, 28, 29, 30, 31, 32, 299, - /* 440 */ 196, 12, 13, 14, 252, 486, 487, 424, 74, 20, - /* 450 */ 424, 22, 395, 396, 146, 20, 522, 434, 112, 155, - /* 460 */ 434, 115, 115, 411, 530, 36, 414, 38, 445, 20, - /* 470 */ 489, 445, 415, 492, 170, 486, 487, 496, 497, 498, - /* 480 */ 499, 500, 501, 549, 503, 20, 33, 553, 554, 508, - /* 490 */ 0, 510, 0, 152, 153, 514, 515, 68, 152, 153, - /* 500 */ 115, 154, 405, 311, 312, 313, 314, 315, 316, 317, - /* 510 */ 413, 82, 478, 479, 24, 25, 26, 27, 28, 29, - /* 520 */ 30, 31, 32, 542, 288, 289, 290, 291, 292, 293, - /* 530 */ 294, 295, 296, 36, 395, 396, 193, 191, 192, 231, - /* 540 */ 232, 112, 201, 202, 115, 522, 424, 201, 202, 305, - /* 550 */ 306, 307, 308, 530, 415, 208, 209, 210, 395, 396, - /* 560 */ 213, 422, 216, 20, 218, 292, 293, 294, 295, 296, - /* 570 */ 74, 548, 549, 226, 227, 453, 553, 554, 415, 82, - /* 580 */ 115, 152, 153, 155, 395, 422, 239, 152, 153, 242, - /* 590 */ 73, 0, 245, 246, 247, 248, 249, 254, 252, 253, - /* 600 */ 254, 424, 256, 257, 258, 259, 260, 261, 262, 263, + /* 360 */ 426, 427, 381, 218, 425, 18, 20, 147, 22, 417, + /* 370 */ 23, 151, 433, 421, 395, 396, 487, 396, 381, 77, + /* 380 */ 78, 79, 36, 444, 38, 395, 84, 85, 86, 42, + /* 390 */ 43, 155, 90, 46, 415, 250, 251, 95, 96, 97, + /* 400 */ 98, 299, 423, 101, 57, 0, 425, 105, 106, 107, + /* 410 */ 108, 289, 290, 291, 68, 299, 69, 70, 71, 72, + /* 420 */ 73, 75, 441, 523, 443, 525, 21, 20, 82, 24, + /* 430 */ 25, 26, 27, 28, 29, 30, 31, 32, 441, 521, + /* 440 */ 425, 12, 13, 14, 454, 225, 456, 529, 433, 20, + /* 450 */ 230, 22, 20, 233, 193, 235, 425, 20, 112, 444, + /* 460 */ 521, 115, 115, 4, 433, 36, 548, 38, 529, 488, + /* 470 */ 552, 553, 491, 218, 13, 444, 495, 496, 497, 498, + /* 480 */ 499, 500, 23, 502, 395, 396, 547, 548, 507, 425, + /* 490 */ 509, 552, 553, 20, 513, 514, 0, 68, 152, 153, + /* 500 */ 380, 154, 382, 155, 415, 250, 251, 48, 49, 50, + /* 510 */ 21, 82, 425, 24, 25, 26, 27, 28, 29, 30, + /* 520 */ 31, 32, 541, 115, 288, 289, 290, 291, 292, 293, + /* 530 */ 294, 295, 296, 21, 521, 420, 425, 191, 192, 452, + /* 540 */ 425, 112, 529, 82, 115, 434, 435, 201, 202, 37, + /* 550 */ 486, 39, 40, 41, 42, 208, 209, 210, 0, 196, + /* 560 */ 213, 548, 216, 20, 218, 552, 553, 452, 395, 396, + /* 570 */ 74, 8, 9, 226, 227, 12, 13, 14, 15, 16, + /* 580 */ 22, 152, 153, 20, 152, 153, 239, 439, 415, 242, + /* 590 */ 442, 443, 245, 246, 247, 248, 249, 145, 252, 253, + /* 600 */ 254, 149, 256, 257, 258, 259, 260, 261, 262, 263, /* 610 */ 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, - /* 620 */ 191, 192, 445, 145, 146, 147, 148, 149, 150, 151, - /* 630 */ 201, 202, 20, 20, 22, 22, 112, 145, 146, 147, - /* 640 */ 148, 149, 150, 151, 4, 216, 299, 218, 36, 460, - /* 650 */ 461, 127, 128, 129, 130, 131, 132, 133, 134, 135, - /* 660 */ 136, 68, 138, 139, 140, 141, 142, 143, 144, 21, - /* 670 */ 58, 58, 24, 25, 26, 27, 28, 29, 30, 31, - /* 680 */ 32, 252, 253, 254, 299, 256, 257, 258, 259, 260, + /* 620 */ 191, 192, 292, 293, 294, 295, 296, 4, 191, 192, + /* 630 */ 201, 202, 404, 201, 202, 112, 288, 289, 290, 291, + /* 640 */ 292, 293, 294, 295, 296, 216, 299, 218, 0, 115, + /* 650 */ 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, + /* 660 */ 432, 138, 139, 140, 141, 142, 143, 144, 305, 306, + /* 670 */ 307, 308, 24, 25, 26, 27, 28, 29, 30, 31, + /* 680 */ 32, 252, 253, 254, 68, 256, 257, 258, 259, 260, /* 690 */ 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, - /* 700 */ 271, 272, 273, 12, 13, 381, 4, 114, 424, 22, - /* 710 */ 117, 20, 145, 22, 20, 112, 149, 289, 290, 291, - /* 720 */ 396, 437, 398, 36, 274, 23, 276, 36, 211, 38, - /* 730 */ 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, - /* 740 */ 4, 138, 139, 140, 141, 142, 143, 144, 424, 125, - /* 750 */ 48, 49, 50, 511, 512, 19, 22, 240, 241, 68, - /* 760 */ 506, 155, 171, 509, 299, 14, 442, 176, 444, 82, - /* 770 */ 36, 20, 424, 82, 38, 184, 323, 8, 9, 186, - /* 780 */ 432, 12, 13, 14, 15, 16, 12, 13, 395, 396, - /* 790 */ 54, 395, 396, 82, 20, 468, 22, 61, 62, 112, - /* 800 */ 473, 453, 381, 112, 68, 424, 115, 495, 415, 274, - /* 810 */ 36, 415, 38, 489, 495, 434, 492, 396, 125, 398, - /* 820 */ 496, 497, 498, 499, 500, 501, 445, 503, 395, 395, - /* 830 */ 396, 36, 508, 521, 510, 228, 395, 396, 514, 515, - /* 840 */ 521, 190, 68, 152, 153, 424, 112, 381, 2, 522, - /* 850 */ 114, 0, 23, 117, 8, 9, 82, 530, 12, 13, - /* 860 */ 14, 15, 16, 442, 402, 444, 8, 9, 395, 396, - /* 870 */ 12, 13, 14, 15, 16, 548, 549, 82, 49, 50, - /* 880 */ 553, 554, 191, 192, 450, 116, 112, 193, 415, 115, - /* 890 */ 428, 450, 201, 202, 288, 289, 290, 291, 292, 293, - /* 900 */ 294, 295, 296, 216, 0, 218, 381, 216, 442, 218, - /* 910 */ 489, 478, 479, 492, 395, 396, 13, 496, 497, 498, - /* 920 */ 499, 500, 501, 33, 503, 416, 152, 153, 277, 508, - /* 930 */ 507, 510, 509, 424, 415, 514, 515, 47, 287, 252, - /* 940 */ 253, 301, 191, 252, 253, 254, 437, 256, 257, 258, + /* 700 */ 271, 272, 273, 12, 13, 22, 381, 299, 395, 396, + /* 710 */ 74, 20, 20, 22, 12, 13, 14, 15, 16, 36, + /* 720 */ 20, 396, 22, 398, 77, 78, 79, 36, 415, 38, + /* 730 */ 114, 84, 85, 86, 191, 119, 36, 90, 115, 126, + /* 740 */ 395, 396, 95, 96, 97, 98, 3, 381, 101, 215, + /* 750 */ 425, 217, 105, 106, 107, 108, 193, 274, 58, 68, + /* 760 */ 415, 14, 396, 20, 398, 416, 441, 20, 443, 0, + /* 770 */ 228, 8, 9, 82, 425, 12, 13, 14, 15, 16, + /* 780 */ 54, 416, 395, 249, 91, 436, 12, 13, 395, 63, + /* 790 */ 425, 425, 66, 67, 20, 112, 22, 254, 395, 396, + /* 800 */ 425, 436, 186, 112, 395, 396, 115, 441, 433, 443, + /* 810 */ 36, 0, 38, 488, 442, 443, 491, 254, 415, 444, + /* 820 */ 495, 496, 497, 498, 499, 500, 36, 502, 395, 396, + /* 830 */ 395, 396, 507, 299, 509, 395, 396, 425, 513, 514, + /* 840 */ 395, 396, 68, 152, 153, 75, 459, 460, 415, 395, + /* 850 */ 396, 252, 159, 33, 488, 415, 82, 491, 449, 116, + /* 860 */ 415, 495, 496, 497, 498, 499, 500, 47, 502, 415, + /* 870 */ 477, 478, 82, 507, 82, 509, 404, 184, 185, 513, + /* 880 */ 514, 115, 191, 192, 449, 193, 112, 395, 396, 115, + /* 890 */ 126, 198, 201, 202, 422, 8, 9, 485, 486, 12, + /* 900 */ 13, 14, 15, 16, 432, 38, 274, 216, 276, 218, + /* 910 */ 311, 312, 313, 314, 315, 316, 317, 375, 376, 377, + /* 920 */ 33, 54, 299, 22, 155, 0, 152, 153, 190, 381, + /* 930 */ 63, 64, 65, 66, 0, 68, 193, 36, 191, 170, + /* 940 */ 506, 449, 508, 252, 253, 254, 254, 256, 257, 258, /* 950 */ 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, - /* 960 */ 269, 270, 271, 272, 273, 191, 192, 442, 18, 20, - /* 970 */ 20, 44, 14, 416, 116, 201, 202, 27, 20, 425, - /* 980 */ 30, 424, 375, 376, 377, 82, 146, 147, 38, 20, - /* 990 */ 216, 151, 218, 0, 437, 68, 145, 146, 147, 148, - /* 1000 */ 149, 150, 151, 425, 54, 254, 56, 425, 426, 395, - /* 1010 */ 396, 61, 62, 8, 9, 52, 34, 12, 13, 14, - /* 1020 */ 15, 16, 425, 73, 443, 444, 252, 253, 254, 415, + /* 960 */ 269, 270, 271, 272, 273, 191, 192, 402, 18, 44, + /* 970 */ 20, 208, 425, 395, 396, 201, 202, 27, 395, 396, + /* 980 */ 30, 114, 171, 82, 419, 4, 119, 176, 38, 441, + /* 990 */ 216, 444, 218, 415, 429, 184, 395, 396, 415, 52, + /* 1000 */ 405, 254, 146, 116, 54, 506, 56, 508, 413, 395, + /* 1010 */ 396, 61, 62, 8, 9, 277, 415, 12, 13, 14, + /* 1020 */ 15, 16, 252, 73, 494, 287, 252, 253, 254, 415, /* 1030 */ 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, - /* 1040 */ 266, 267, 268, 269, 270, 271, 272, 273, 8, 9, - /* 1050 */ 400, 401, 12, 13, 14, 15, 16, 507, 36, 509, - /* 1060 */ 20, 8, 9, 36, 114, 12, 13, 14, 15, 16, - /* 1070 */ 77, 78, 79, 80, 81, 125, 83, 84, 85, 86, - /* 1080 */ 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, - /* 1090 */ 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, - /* 1100 */ 107, 108, 14, 15, 16, 3, 22, 157, 158, 82, + /* 1040 */ 266, 267, 268, 269, 270, 271, 272, 273, 395, 396, + /* 1050 */ 520, 8, 9, 186, 44, 12, 13, 14, 15, 16, + /* 1060 */ 22, 20, 195, 14, 114, 299, 199, 200, 415, 20, + /* 1070 */ 395, 396, 205, 206, 36, 402, 126, 0, 68, 145, + /* 1080 */ 146, 147, 148, 149, 150, 151, 381, 231, 232, 326, + /* 1090 */ 415, 224, 8, 9, 59, 60, 12, 13, 14, 15, + /* 1100 */ 16, 396, 429, 398, 400, 401, 3, 157, 158, 23, /* 1110 */ 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, - /* 1120 */ 36, 420, 172, 173, 174, 175, 176, 177, 178, 179, - /* 1130 */ 381, 181, 182, 183, 468, 395, 396, 187, 188, 189, - /* 1140 */ 191, 395, 396, 381, 194, 396, 51, 398, 244, 191, - /* 1150 */ 425, 77, 78, 79, 36, 415, 193, 381, 84, 85, - /* 1160 */ 86, 415, 193, 474, 90, 115, 82, 204, 381, 95, - /* 1170 */ 96, 97, 98, 424, 413, 101, 22, 395, 396, 105, - /* 1180 */ 106, 107, 108, 396, 483, 398, 395, 396, 522, 424, - /* 1190 */ 36, 442, 381, 444, 59, 60, 530, 415, 12, 13, - /* 1200 */ 435, 436, 13, 254, 442, 404, 415, 396, 22, 398, - /* 1210 */ 115, 424, 254, 208, 548, 549, 395, 396, 442, 553, - /* 1220 */ 554, 424, 36, 254, 38, 400, 401, 409, 410, 442, - /* 1230 */ 382, 444, 20, 193, 433, 424, 415, 424, 489, 424, - /* 1240 */ 218, 492, 445, 381, 381, 496, 497, 498, 499, 500, - /* 1250 */ 501, 436, 503, 442, 68, 444, 147, 508, 445, 510, - /* 1260 */ 151, 395, 396, 514, 515, 215, 112, 217, 82, 1, - /* 1270 */ 2, 82, 250, 251, 381, 439, 489, 381, 442, 492, - /* 1280 */ 20, 415, 381, 496, 497, 498, 499, 500, 501, 396, - /* 1290 */ 503, 398, 381, 381, 254, 508, 33, 510, 112, 249, - /* 1300 */ 489, 514, 515, 492, 442, 442, 454, 496, 497, 498, - /* 1310 */ 499, 500, 501, 381, 503, 439, 381, 424, 442, 508, - /* 1320 */ 381, 510, 12, 13, 68, 514, 515, 381, 396, 409, - /* 1330 */ 410, 326, 22, 33, 225, 442, 218, 444, 442, 230, - /* 1340 */ 395, 396, 233, 442, 235, 0, 36, 47, 38, 299, - /* 1350 */ 395, 396, 381, 442, 442, 381, 424, 8, 9, 381, - /* 1360 */ 415, 12, 13, 14, 15, 16, 381, 396, 250, 251, - /* 1370 */ 415, 384, 385, 117, 442, 381, 444, 442, 68, 395, - /* 1380 */ 396, 442, 489, 0, 116, 492, 395, 396, 442, 496, - /* 1390 */ 497, 498, 499, 500, 501, 424, 503, 395, 396, 415, - /* 1400 */ 381, 508, 216, 510, 218, 524, 415, 514, 515, 439, - /* 1410 */ 186, 118, 442, 442, 121, 444, 442, 415, 36, 381, - /* 1420 */ 442, 489, 557, 321, 492, 395, 396, 442, 496, 497, - /* 1430 */ 498, 499, 500, 501, 396, 503, 442, 54, 252, 253, - /* 1440 */ 508, 1, 510, 14, 220, 415, 514, 515, 417, 20, - /* 1450 */ 0, 420, 266, 267, 268, 269, 270, 271, 272, 19, - /* 1460 */ 489, 442, 424, 492, 395, 396, 254, 496, 497, 498, - /* 1470 */ 499, 500, 501, 0, 503, 234, 33, 236, 38, 508, - /* 1480 */ 442, 510, 444, 33, 415, 514, 515, 395, 396, 468, - /* 1490 */ 33, 8, 9, 53, 54, 12, 13, 14, 15, 16, - /* 1500 */ 155, 13, 13, 63, 64, 65, 66, 415, 68, 33, - /* 1510 */ 118, 395, 396, 121, 254, 118, 33, 44, 121, 118, - /* 1520 */ 33, 75, 121, 0, 36, 36, 216, 489, 218, 468, - /* 1530 */ 492, 415, 546, 33, 496, 497, 498, 499, 500, 501, - /* 1540 */ 468, 503, 193, 522, 0, 22, 508, 36, 510, 0, - /* 1550 */ 381, 530, 514, 515, 114, 152, 153, 117, 33, 116, - /* 1560 */ 250, 251, 252, 0, 539, 396, 22, 525, 468, 548, - /* 1570 */ 549, 22, 33, 116, 553, 554, 266, 267, 268, 269, - /* 1580 */ 270, 271, 272, 522, 399, 22, 424, 115, 325, 381, - /* 1590 */ 150, 530, 116, 424, 522, 33, 124, 33, 394, 116, - /* 1600 */ 218, 454, 530, 116, 396, 1, 2, 33, 412, 548, - /* 1610 */ 549, 442, 33, 444, 553, 554, 116, 12, 13, 33, - /* 1620 */ 548, 549, 522, 12, 13, 553, 554, 412, 381, 33, - /* 1630 */ 530, 33, 424, 33, 545, 195, 33, 197, 12, 13, - /* 1640 */ 200, 116, 36, 396, 545, 205, 12, 13, 548, 549, - /* 1650 */ 442, 33, 444, 553, 554, 116, 12, 13, 489, 12, - /* 1660 */ 13, 492, 12, 13, 224, 496, 497, 498, 499, 500, - /* 1670 */ 501, 424, 503, 12, 13, 12, 13, 381, 116, 510, - /* 1680 */ 116, 12, 13, 514, 515, 12, 13, 33, 82, 442, - /* 1690 */ 116, 444, 396, 33, 13, 116, 0, 489, 252, 33, - /* 1700 */ 492, 33, 116, 33, 496, 497, 498, 499, 500, 501, - /* 1710 */ 381, 503, 116, 545, 116, 467, 116, 36, 510, 116, - /* 1720 */ 424, 545, 514, 515, 454, 396, 13, 399, 490, 218, - /* 1730 */ 396, 441, 475, 454, 116, 454, 489, 550, 442, 492, - /* 1740 */ 444, 516, 529, 496, 497, 498, 499, 500, 501, 36, - /* 1750 */ 503, 55, 529, 424, 532, 454, 414, 510, 302, 54, - /* 1760 */ 469, 514, 515, 491, 20, 395, 20, 480, 233, 485, - /* 1770 */ 116, 442, 381, 444, 480, 38, 116, 404, 404, 214, - /* 1780 */ 471, 395, 116, 20, 116, 489, 116, 396, 492, 396, - /* 1790 */ 47, 54, 496, 497, 498, 499, 500, 501, 451, 503, - /* 1800 */ 63, 64, 65, 66, 396, 68, 451, 190, 448, 395, - /* 1810 */ 451, 396, 395, 448, 448, 424, 448, 113, 489, 408, - /* 1820 */ 111, 492, 395, 407, 110, 496, 497, 498, 499, 500, - /* 1830 */ 501, 395, 503, 442, 406, 444, 395, 395, 20, 543, - /* 1840 */ 544, 388, 395, 52, 392, 20, 388, 392, 404, 480, - /* 1850 */ 444, 114, 381, 404, 117, 404, 20, 397, 20, 470, - /* 1860 */ 397, 20, 20, 404, 455, 404, 461, 396, 404, 404, - /* 1870 */ 404, 404, 395, 388, 384, 384, 442, 395, 424, 442, - /* 1880 */ 489, 388, 237, 492, 555, 556, 424, 496, 497, 498, - /* 1890 */ 499, 500, 501, 424, 503, 424, 484, 115, 424, 424, - /* 1900 */ 482, 510, 424, 424, 424, 424, 515, 402, 424, 20, - /* 1910 */ 424, 480, 381, 442, 479, 444, 222, 402, 221, 395, - /* 1920 */ 310, 309, 477, 186, 476, 538, 538, 396, 207, 320, - /* 1930 */ 462, 318, 195, 538, 442, 541, 199, 200, 444, 381, - /* 1940 */ 442, 319, 205, 206, 540, 303, 298, 537, 528, 536, - /* 1950 */ 297, 527, 327, 322, 396, 424, 535, 558, 462, 324, - /* 1960 */ 489, 224, 396, 492, 469, 20, 469, 496, 497, 498, - /* 1970 */ 499, 500, 501, 442, 503, 444, 125, 552, 300, 397, - /* 1980 */ 402, 551, 424, 402, 462, 442, 199, 442, 442, 442, - /* 1990 */ 462, 459, 442, 402, 495, 442, 455, 466, 115, 402, - /* 2000 */ 442, 442, 444, 533, 199, 420, 115, 456, 22, 455, - /* 2010 */ 381, 442, 396, 442, 513, 544, 402, 402, 442, 442, - /* 2020 */ 489, 402, 442, 492, 466, 396, 442, 496, 497, 498, - /* 2030 */ 499, 500, 501, 531, 503, 442, 442, 442, 430, 383, - /* 2040 */ 35, 442, 387, 442, 442, 386, 395, 489, 381, 442, - /* 2050 */ 492, 37, 40, 424, 496, 497, 498, 499, 500, 501, - /* 2060 */ 389, 503, 442, 396, 388, 442, 442, 426, 481, 442, - /* 2070 */ 442, 442, 442, 444, 381, 442, 488, 403, 442, 442, - /* 2080 */ 442, 379, 418, 418, 426, 0, 0, 0, 47, 396, - /* 2090 */ 418, 424, 0, 472, 36, 463, 243, 36, 36, 36, - /* 2100 */ 243, 0, 463, 36, 36, 243, 36, 0, 0, 442, - /* 2110 */ 243, 444, 0, 36, 0, 36, 0, 424, 489, 22, - /* 2120 */ 0, 492, 238, 0, 36, 496, 497, 498, 499, 500, - /* 2130 */ 501, 224, 503, 0, 224, 442, 225, 444, 218, 216, - /* 2140 */ 0, 0, 0, 381, 212, 211, 0, 0, 158, 51, - /* 2150 */ 51, 0, 0, 36, 0, 36, 489, 54, 396, 492, - /* 2160 */ 0, 51, 0, 496, 497, 498, 499, 500, 501, 47, - /* 2170 */ 503, 0, 0, 0, 0, 51, 547, 0, 0, 0, - /* 2180 */ 0, 0, 489, 176, 381, 492, 424, 51, 0, 496, - /* 2190 */ 497, 498, 499, 500, 501, 36, 503, 0, 505, 396, - /* 2200 */ 176, 0, 0, 381, 442, 0, 444, 0, 0, 0, - /* 2210 */ 0, 0, 0, 0, 0, 0, 0, 0, 396, 52, - /* 2220 */ 22, 0, 47, 556, 0, 0, 0, 424, 466, 0, - /* 2230 */ 0, 0, 0, 381, 0, 0, 0, 0, 0, 0, - /* 2240 */ 0, 0, 158, 0, 0, 442, 424, 444, 396, 0, - /* 2250 */ 157, 489, 156, 0, 492, 22, 52, 0, 496, 497, - /* 2260 */ 498, 499, 500, 501, 442, 503, 444, 381, 22, 466, - /* 2270 */ 47, 68, 0, 0, 68, 0, 424, 0, 36, 0, - /* 2280 */ 0, 36, 396, 0, 36, 0, 68, 0, 68, 33, - /* 2290 */ 0, 44, 489, 0, 442, 492, 444, 381, 36, 496, - /* 2300 */ 497, 498, 499, 500, 501, 54, 503, 44, 54, 54, - /* 2310 */ 424, 489, 396, 44, 492, 44, 51, 36, 496, 497, - /* 2320 */ 498, 499, 500, 501, 14, 503, 44, 51, 442, 51, - /* 2330 */ 444, 45, 0, 0, 0, 44, 207, 0, 0, 51, - /* 2340 */ 424, 489, 0, 51, 492, 0, 0, 0, 496, 497, - /* 2350 */ 498, 499, 500, 501, 36, 503, 54, 381, 442, 44, - /* 2360 */ 444, 0, 36, 54, 44, 76, 0, 36, 54, 44, - /* 2370 */ 0, 36, 396, 54, 44, 489, 0, 0, 492, 381, - /* 2380 */ 121, 123, 496, 497, 498, 499, 500, 501, 0, 503, - /* 2390 */ 0, 0, 381, 0, 396, 22, 36, 0, 36, 36, - /* 2400 */ 424, 22, 33, 36, 36, 489, 22, 396, 492, 0, - /* 2410 */ 36, 36, 496, 497, 498, 499, 500, 501, 442, 503, - /* 2420 */ 444, 36, 424, 36, 22, 36, 0, 33, 36, 22, - /* 2430 */ 0, 36, 36, 22, 56, 424, 0, 22, 0, 36, - /* 2440 */ 442, 381, 444, 0, 0, 0, 36, 0, 36, 36, - /* 2450 */ 0, 22, 20, 442, 36, 444, 396, 116, 36, 36, - /* 2460 */ 0, 193, 0, 115, 115, 489, 0, 51, 492, 36, - /* 2470 */ 22, 22, 496, 497, 498, 499, 500, 501, 228, 503, - /* 2480 */ 219, 229, 0, 223, 424, 0, 3, 489, 193, 193, - /* 2490 */ 492, 193, 193, 199, 496, 497, 498, 499, 500, 501, - /* 2500 */ 489, 503, 442, 492, 444, 33, 203, 496, 497, 498, - /* 2510 */ 499, 500, 501, 115, 503, 203, 116, 116, 51, 381, - /* 2520 */ 115, 115, 36, 36, 116, 52, 304, 113, 52, 33, - /* 2530 */ 111, 33, 33, 116, 396, 115, 33, 82, 381, 115, - /* 2540 */ 115, 51, 33, 116, 116, 3, 115, 36, 33, 489, - /* 2550 */ 115, 51, 492, 396, 36, 116, 496, 497, 498, 499, - /* 2560 */ 500, 501, 424, 503, 36, 36, 36, 116, 381, 36, - /* 2570 */ 304, 304, 36, 116, 116, 51, 33, 0, 0, 115, - /* 2580 */ 442, 424, 444, 396, 44, 116, 116, 0, 288, 115, - /* 2590 */ 115, 44, 115, 0, 116, 196, 115, 44, 33, 442, - /* 2600 */ 381, 444, 113, 275, 200, 113, 2, 22, 252, 116, - /* 2610 */ 116, 424, 115, 51, 51, 396, 115, 115, 22, 255, - /* 2620 */ 115, 115, 0, 116, 116, 115, 51, 489, 115, 442, - /* 2630 */ 492, 444, 115, 196, 496, 497, 498, 499, 500, 501, - /* 2640 */ 115, 503, 116, 424, 44, 124, 489, 195, 22, 492, - /* 2650 */ 115, 381, 196, 496, 497, 498, 499, 500, 501, 115, - /* 2660 */ 503, 442, 116, 444, 126, 115, 396, 115, 22, 115, - /* 2670 */ 115, 115, 22, 125, 22, 229, 489, 116, 381, 492, - /* 2680 */ 36, 36, 115, 496, 497, 498, 499, 500, 501, 116, - /* 2690 */ 503, 36, 116, 396, 424, 115, 36, 116, 36, 116, - /* 2700 */ 36, 36, 116, 137, 115, 137, 137, 137, 489, 33, - /* 2710 */ 115, 492, 442, 36, 444, 496, 497, 498, 499, 500, - /* 2720 */ 501, 424, 503, 115, 22, 76, 75, 22, 36, 36, - /* 2730 */ 36, 36, 36, 36, 36, 36, 36, 36, 82, 442, - /* 2740 */ 381, 444, 36, 109, 109, 82, 33, 36, 36, 22, - /* 2750 */ 36, 36, 36, 36, 82, 396, 36, 36, 36, 489, - /* 2760 */ 36, 381, 492, 22, 36, 36, 496, 497, 498, 499, - /* 2770 */ 500, 501, 0, 503, 36, 44, 396, 54, 0, 36, - /* 2780 */ 54, 44, 0, 424, 36, 0, 489, 54, 44, 492, - /* 2790 */ 36, 44, 0, 496, 497, 498, 499, 500, 501, 54, - /* 2800 */ 503, 442, 381, 444, 424, 36, 0, 36, 22, 0, - /* 2810 */ 22, 36, 33, 36, 20, 22, 21, 396, 22, 22, - /* 2820 */ 21, 559, 442, 381, 444, 559, 559, 559, 559, 559, - /* 2830 */ 559, 559, 559, 559, 559, 559, 559, 559, 396, 559, - /* 2840 */ 559, 559, 559, 559, 559, 424, 559, 559, 489, 559, - /* 2850 */ 559, 492, 559, 559, 559, 496, 497, 498, 499, 500, - /* 2860 */ 501, 559, 503, 442, 559, 444, 424, 559, 559, 489, - /* 2870 */ 559, 559, 492, 559, 559, 559, 496, 497, 498, 499, - /* 2880 */ 500, 501, 559, 503, 442, 381, 444, 559, 559, 559, - /* 2890 */ 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, - /* 2900 */ 396, 381, 559, 559, 559, 559, 559, 559, 559, 559, - /* 2910 */ 489, 559, 559, 492, 559, 559, 396, 496, 497, 498, - /* 2920 */ 499, 500, 501, 559, 503, 559, 559, 559, 424, 559, - /* 2930 */ 559, 489, 559, 559, 492, 559, 559, 559, 496, 497, - /* 2940 */ 498, 499, 500, 501, 424, 503, 442, 559, 444, 559, - /* 2950 */ 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, - /* 2960 */ 559, 559, 442, 381, 444, 559, 559, 559, 559, 559, - /* 2970 */ 559, 559, 559, 559, 559, 559, 559, 559, 396, 559, - /* 2980 */ 559, 559, 381, 559, 559, 559, 559, 559, 559, 559, - /* 2990 */ 559, 559, 559, 489, 559, 559, 492, 396, 559, 559, - /* 3000 */ 496, 497, 498, 499, 500, 501, 424, 503, 559, 489, - /* 3010 */ 559, 559, 492, 559, 559, 559, 496, 497, 498, 499, - /* 3020 */ 500, 501, 559, 503, 442, 424, 444, 559, 559, 559, - /* 3030 */ 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, - /* 3040 */ 559, 559, 559, 442, 559, 444, 559, 559, 559, 559, - /* 3050 */ 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, - /* 3060 */ 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, - /* 3070 */ 559, 489, 559, 559, 492, 559, 559, 559, 496, 497, - /* 3080 */ 498, 499, 500, 501, 559, 503, 559, 559, 559, 559, - /* 3090 */ 489, 559, 559, 492, 559, 559, 559, 496, 497, 498, - /* 3100 */ 499, 500, 501, 559, 503, 559, 559, 559, 559, 559, - /* 3110 */ 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, - /* 3120 */ 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, - /* 3130 */ 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, - /* 3140 */ 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, - /* 3150 */ 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, - /* 3160 */ 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, - /* 3170 */ 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, - /* 3180 */ 559, 559, 559, 559, 559, 559, 559, 559, 559, 559, - /* 3190 */ 559, 559, 559, 559, 559, 559, 559, 559, 559, 378, - /* 3200 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, - /* 3210 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, - /* 3220 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, - /* 3230 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, - /* 3240 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, + /* 1120 */ 82, 116, 172, 173, 174, 175, 176, 177, 178, 179, + /* 1130 */ 425, 181, 182, 183, 381, 49, 50, 187, 188, 189, + /* 1140 */ 193, 400, 401, 425, 194, 126, 441, 33, 443, 505, + /* 1150 */ 112, 204, 508, 435, 77, 78, 79, 80, 81, 116, + /* 1160 */ 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, + /* 1170 */ 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, + /* 1180 */ 103, 104, 105, 106, 107, 108, 20, 12, 13, 395, + /* 1190 */ 396, 381, 20, 488, 441, 381, 491, 22, 381, 180, + /* 1200 */ 495, 496, 497, 498, 499, 500, 396, 502, 398, 415, + /* 1210 */ 4, 36, 507, 38, 509, 381, 2, 381, 513, 514, + /* 1220 */ 381, 381, 8, 9, 381, 19, 12, 13, 14, 15, + /* 1230 */ 16, 22, 395, 396, 193, 425, 396, 186, 398, 395, + /* 1240 */ 396, 0, 381, 68, 38, 36, 395, 396, 20, 0, + /* 1250 */ 22, 441, 415, 443, 216, 441, 218, 82, 441, 415, + /* 1260 */ 54, 34, 381, 41, 42, 425, 415, 61, 62, 395, + /* 1270 */ 396, 220, 395, 396, 68, 441, 68, 441, 409, 410, + /* 1280 */ 441, 441, 301, 443, 441, 381, 58, 112, 425, 415, + /* 1290 */ 252, 253, 415, 409, 410, 254, 425, 381, 488, 436, + /* 1300 */ 494, 491, 441, 384, 385, 495, 496, 497, 498, 499, + /* 1310 */ 500, 33, 502, 381, 421, 444, 33, 507, 381, 509, + /* 1320 */ 114, 112, 441, 513, 514, 119, 520, 119, 488, 381, + /* 1330 */ 381, 491, 467, 13, 33, 495, 496, 497, 498, 499, + /* 1340 */ 500, 381, 502, 121, 122, 441, 124, 507, 47, 509, + /* 1350 */ 12, 13, 2, 513, 514, 381, 396, 441, 8, 9, + /* 1360 */ 22, 426, 12, 13, 14, 15, 16, 145, 152, 153, + /* 1370 */ 494, 149, 381, 441, 36, 482, 38, 438, 441, 438, + /* 1380 */ 441, 438, 441, 36, 441, 425, 521, 396, 0, 441, + /* 1390 */ 441, 216, 120, 218, 529, 123, 520, 0, 234, 116, + /* 1400 */ 236, 441, 82, 443, 155, 36, 68, 120, 381, 33, + /* 1410 */ 123, 120, 547, 548, 123, 441, 425, 552, 553, 22, + /* 1420 */ 254, 33, 467, 396, 321, 426, 254, 252, 253, 82, + /* 1430 */ 120, 13, 441, 123, 443, 426, 33, 33, 13, 325, + /* 1440 */ 0, 266, 267, 268, 269, 270, 271, 272, 488, 0, + /* 1450 */ 0, 491, 425, 51, 36, 495, 496, 497, 498, 499, + /* 1460 */ 500, 36, 502, 33, 33, 33, 426, 507, 441, 509, + /* 1470 */ 443, 22, 22, 513, 514, 0, 521, 1, 2, 488, + /* 1480 */ 473, 115, 491, 117, 529, 244, 495, 496, 497, 498, + /* 1490 */ 499, 500, 116, 502, 36, 55, 33, 33, 507, 33, + /* 1500 */ 509, 33, 547, 548, 513, 514, 413, 552, 553, 36, + /* 1510 */ 33, 33, 33, 12, 13, 488, 382, 115, 491, 116, + /* 1520 */ 116, 13, 495, 496, 497, 498, 499, 500, 453, 502, + /* 1530 */ 33, 33, 12, 13, 507, 523, 509, 381, 12, 13, + /* 1540 */ 513, 514, 12, 13, 36, 112, 116, 116, 116, 556, + /* 1550 */ 12, 13, 396, 545, 216, 82, 218, 524, 12, 13, + /* 1560 */ 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, + /* 1570 */ 538, 138, 139, 140, 141, 142, 143, 144, 1, 116, + /* 1580 */ 116, 425, 116, 36, 116, 12, 13, 218, 250, 251, + /* 1590 */ 252, 12, 13, 116, 116, 116, 19, 441, 33, 443, + /* 1600 */ 33, 323, 12, 13, 266, 267, 268, 269, 270, 271, + /* 1610 */ 272, 13, 467, 116, 116, 38, 12, 13, 381, 33, + /* 1620 */ 145, 146, 147, 148, 149, 150, 151, 12, 13, 82, + /* 1630 */ 53, 54, 467, 396, 36, 399, 33, 425, 412, 394, + /* 1640 */ 63, 64, 65, 66, 488, 68, 33, 491, 453, 544, + /* 1650 */ 412, 495, 496, 497, 498, 499, 500, 33, 502, 544, + /* 1660 */ 544, 544, 425, 466, 453, 509, 521, 399, 467, 513, + /* 1670 */ 514, 489, 396, 440, 529, 528, 218, 474, 441, 528, + /* 1680 */ 443, 116, 453, 116, 453, 549, 521, 453, 515, 531, + /* 1690 */ 54, 114, 547, 548, 529, 414, 119, 552, 553, 381, + /* 1700 */ 8, 9, 116, 302, 12, 13, 14, 15, 16, 490, + /* 1710 */ 468, 20, 547, 548, 396, 20, 395, 552, 553, 116, + /* 1720 */ 233, 404, 521, 381, 484, 488, 479, 150, 491, 116, + /* 1730 */ 529, 479, 495, 496, 497, 498, 499, 500, 396, 502, + /* 1740 */ 116, 404, 381, 425, 470, 214, 509, 395, 547, 548, + /* 1750 */ 513, 514, 20, 552, 553, 396, 47, 396, 450, 441, + /* 1760 */ 396, 443, 450, 447, 190, 395, 395, 425, 396, 450, + /* 1770 */ 447, 447, 195, 447, 197, 113, 408, 200, 111, 395, + /* 1780 */ 407, 395, 205, 441, 110, 443, 425, 406, 395, 395, + /* 1790 */ 395, 20, 52, 388, 479, 388, 404, 20, 392, 443, + /* 1800 */ 392, 224, 441, 404, 443, 20, 488, 397, 20, 491, + /* 1810 */ 381, 397, 469, 495, 496, 497, 498, 499, 500, 404, + /* 1820 */ 502, 404, 20, 404, 404, 396, 20, 509, 404, 454, + /* 1830 */ 488, 513, 514, 491, 460, 388, 395, 495, 496, 497, + /* 1840 */ 498, 499, 500, 501, 502, 503, 504, 404, 404, 488, + /* 1850 */ 381, 425, 491, 425, 425, 395, 495, 496, 497, 498, + /* 1860 */ 499, 500, 425, 502, 425, 396, 384, 425, 384, 388, + /* 1870 */ 441, 425, 443, 425, 237, 381, 425, 425, 425, 425, + /* 1880 */ 115, 483, 402, 20, 221, 193, 441, 222, 479, 468, + /* 1890 */ 396, 478, 481, 402, 425, 395, 441, 441, 476, 310, + /* 1900 */ 443, 309, 475, 542, 543, 318, 441, 540, 207, 303, + /* 1910 */ 441, 320, 443, 319, 537, 537, 537, 488, 381, 425, + /* 1920 */ 491, 539, 461, 461, 495, 496, 497, 498, 499, 500, + /* 1930 */ 298, 502, 536, 396, 534, 441, 297, 443, 468, 327, + /* 1940 */ 557, 324, 551, 527, 381, 322, 396, 535, 126, 526, + /* 1950 */ 20, 300, 397, 402, 402, 441, 461, 488, 441, 396, + /* 1960 */ 491, 494, 425, 441, 495, 496, 497, 498, 499, 500, + /* 1970 */ 532, 502, 461, 441, 441, 199, 458, 402, 441, 454, + /* 1980 */ 443, 441, 488, 554, 555, 491, 381, 402, 425, 495, + /* 1990 */ 496, 497, 498, 499, 500, 115, 502, 512, 441, 199, + /* 2000 */ 455, 396, 465, 509, 441, 421, 443, 454, 514, 550, + /* 2010 */ 402, 402, 543, 530, 396, 115, 395, 441, 22, 441, + /* 2020 */ 35, 441, 441, 381, 441, 488, 430, 383, 491, 441, + /* 2030 */ 425, 402, 495, 496, 497, 498, 499, 500, 396, 502, + /* 2040 */ 441, 441, 441, 441, 386, 37, 441, 387, 443, 40, + /* 2050 */ 389, 488, 441, 471, 491, 441, 388, 441, 495, 496, + /* 2060 */ 497, 498, 499, 500, 379, 502, 441, 425, 441, 441, + /* 2070 */ 465, 441, 441, 427, 441, 441, 441, 480, 403, 441, + /* 2080 */ 487, 441, 462, 441, 462, 443, 427, 418, 418, 418, + /* 2090 */ 0, 0, 0, 488, 47, 0, 491, 36, 243, 36, + /* 2100 */ 495, 496, 497, 498, 499, 500, 36, 502, 36, 546, + /* 2110 */ 381, 243, 0, 36, 36, 243, 36, 0, 0, 243, + /* 2120 */ 0, 36, 0, 36, 0, 396, 22, 0, 238, 36, + /* 2130 */ 488, 0, 381, 491, 224, 0, 224, 495, 496, 497, + /* 2140 */ 498, 499, 500, 225, 502, 218, 0, 396, 216, 0, + /* 2150 */ 0, 212, 211, 0, 425, 0, 158, 51, 51, 381, + /* 2160 */ 0, 36, 0, 0, 36, 54, 0, 51, 0, 0, + /* 2170 */ 441, 0, 443, 47, 396, 0, 425, 0, 0, 0, + /* 2180 */ 51, 0, 0, 0, 36, 0, 176, 176, 0, 0, + /* 2190 */ 0, 0, 441, 0, 443, 0, 381, 555, 0, 0, + /* 2200 */ 0, 0, 0, 425, 0, 0, 0, 0, 0, 0, + /* 2210 */ 0, 396, 0, 0, 0, 51, 465, 488, 0, 441, + /* 2220 */ 491, 443, 0, 381, 495, 496, 497, 498, 499, 500, + /* 2230 */ 0, 502, 0, 504, 47, 0, 0, 0, 396, 488, + /* 2240 */ 425, 0, 491, 465, 0, 381, 495, 496, 497, 498, + /* 2250 */ 499, 500, 0, 502, 158, 22, 441, 0, 443, 157, + /* 2260 */ 396, 0, 0, 0, 156, 22, 488, 425, 52, 491, + /* 2270 */ 22, 52, 381, 495, 496, 497, 498, 499, 500, 0, + /* 2280 */ 502, 0, 0, 441, 0, 443, 36, 396, 68, 425, + /* 2290 */ 0, 68, 68, 68, 0, 36, 54, 44, 0, 54, + /* 2300 */ 36, 0, 44, 488, 36, 441, 491, 443, 54, 381, + /* 2310 */ 495, 496, 497, 498, 499, 500, 425, 502, 44, 0, + /* 2320 */ 0, 36, 47, 51, 396, 33, 14, 44, 51, 51, + /* 2330 */ 488, 0, 441, 491, 443, 0, 45, 495, 496, 497, + /* 2340 */ 498, 499, 500, 44, 502, 0, 0, 0, 44, 207, + /* 2350 */ 381, 51, 488, 425, 0, 491, 0, 51, 0, 495, + /* 2360 */ 496, 497, 498, 499, 500, 396, 502, 0, 0, 441, + /* 2370 */ 0, 443, 76, 36, 44, 54, 0, 36, 54, 488, + /* 2380 */ 44, 0, 491, 54, 36, 381, 495, 496, 497, 498, + /* 2390 */ 499, 500, 0, 502, 425, 36, 44, 54, 0, 44, + /* 2400 */ 396, 0, 0, 0, 0, 0, 22, 36, 0, 22, + /* 2410 */ 441, 36, 443, 125, 36, 36, 488, 381, 123, 491, + /* 2420 */ 0, 36, 36, 495, 496, 497, 498, 499, 500, 425, + /* 2430 */ 502, 36, 396, 36, 0, 36, 381, 22, 22, 22, + /* 2440 */ 33, 0, 36, 33, 22, 441, 56, 443, 36, 36, + /* 2450 */ 36, 396, 0, 22, 0, 36, 0, 488, 0, 36, + /* 2460 */ 491, 425, 0, 36, 495, 496, 497, 498, 499, 500, + /* 2470 */ 0, 502, 36, 0, 36, 22, 36, 441, 36, 443, + /* 2480 */ 425, 20, 381, 0, 229, 116, 193, 115, 228, 115, + /* 2490 */ 223, 0, 488, 36, 51, 491, 441, 396, 443, 495, + /* 2500 */ 496, 497, 498, 499, 500, 0, 502, 193, 22, 22, + /* 2510 */ 193, 0, 199, 0, 381, 193, 219, 3, 203, 193, + /* 2520 */ 36, 203, 33, 52, 488, 116, 425, 491, 36, 396, + /* 2530 */ 304, 495, 496, 497, 498, 499, 500, 116, 502, 115, + /* 2540 */ 115, 115, 441, 488, 443, 113, 491, 52, 51, 116, + /* 2550 */ 495, 496, 497, 498, 499, 500, 111, 502, 425, 33, + /* 2560 */ 33, 33, 116, 115, 115, 115, 33, 116, 51, 304, + /* 2570 */ 115, 33, 82, 36, 441, 116, 443, 3, 381, 115, + /* 2580 */ 33, 116, 116, 116, 304, 36, 36, 36, 36, 488, + /* 2590 */ 36, 36, 491, 396, 116, 51, 495, 496, 497, 498, + /* 2600 */ 499, 500, 381, 502, 288, 33, 0, 51, 0, 115, + /* 2610 */ 44, 0, 116, 44, 116, 115, 115, 396, 115, 0, + /* 2620 */ 116, 488, 425, 115, 491, 196, 196, 381, 495, 496, + /* 2630 */ 497, 498, 499, 500, 44, 502, 33, 113, 441, 200, + /* 2640 */ 443, 275, 396, 113, 2, 22, 425, 116, 252, 51, + /* 2650 */ 116, 115, 51, 22, 115, 195, 115, 115, 115, 0, + /* 2660 */ 44, 116, 441, 115, 443, 196, 255, 381, 115, 0, + /* 2670 */ 22, 425, 51, 116, 115, 115, 118, 116, 115, 115, + /* 2680 */ 115, 36, 396, 115, 117, 488, 115, 441, 491, 443, + /* 2690 */ 115, 381, 495, 496, 497, 498, 499, 500, 116, 502, + /* 2700 */ 115, 22, 126, 22, 229, 22, 396, 116, 36, 488, + /* 2710 */ 115, 425, 491, 116, 36, 115, 495, 496, 497, 498, + /* 2720 */ 499, 500, 36, 502, 36, 116, 116, 441, 116, 443, + /* 2730 */ 36, 116, 381, 36, 488, 425, 137, 491, 33, 137, + /* 2740 */ 115, 495, 496, 497, 498, 499, 500, 396, 502, 115, + /* 2750 */ 137, 441, 36, 443, 137, 115, 22, 22, 76, 75, + /* 2760 */ 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, + /* 2770 */ 109, 82, 381, 36, 488, 82, 425, 491, 33, 109, + /* 2780 */ 36, 495, 496, 497, 498, 499, 500, 396, 502, 36, + /* 2790 */ 36, 22, 441, 36, 443, 36, 36, 82, 488, 381, + /* 2800 */ 36, 491, 36, 36, 36, 495, 496, 497, 498, 499, + /* 2810 */ 500, 36, 502, 22, 396, 36, 425, 0, 381, 36, + /* 2820 */ 44, 0, 36, 0, 54, 54, 44, 54, 36, 44, + /* 2830 */ 0, 36, 441, 396, 443, 54, 0, 44, 36, 488, + /* 2840 */ 0, 22, 491, 425, 36, 0, 495, 496, 497, 498, + /* 2850 */ 499, 500, 36, 502, 22, 33, 36, 22, 21, 441, + /* 2860 */ 22, 443, 425, 22, 21, 558, 20, 558, 558, 558, + /* 2870 */ 558, 558, 558, 558, 558, 558, 558, 558, 441, 488, + /* 2880 */ 443, 558, 491, 381, 558, 558, 495, 496, 497, 498, + /* 2890 */ 499, 500, 558, 502, 558, 558, 381, 558, 396, 558, + /* 2900 */ 558, 558, 558, 558, 558, 558, 488, 558, 558, 491, + /* 2910 */ 558, 396, 558, 495, 496, 497, 498, 499, 500, 558, + /* 2920 */ 502, 558, 558, 558, 558, 488, 558, 425, 491, 558, + /* 2930 */ 558, 558, 495, 496, 497, 498, 499, 500, 558, 502, + /* 2940 */ 425, 558, 558, 441, 558, 443, 558, 558, 558, 558, + /* 2950 */ 558, 558, 558, 558, 558, 558, 441, 558, 443, 558, + /* 2960 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, + /* 2970 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, + /* 2980 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, + /* 2990 */ 488, 558, 558, 491, 558, 558, 558, 495, 496, 497, + /* 3000 */ 498, 499, 500, 488, 502, 558, 491, 558, 558, 558, + /* 3010 */ 495, 496, 497, 498, 499, 500, 558, 502, 558, 558, + /* 3020 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, + /* 3030 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, + /* 3040 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, + /* 3050 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, + /* 3060 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, + /* 3070 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, + /* 3080 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, + /* 3090 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, + /* 3100 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, + /* 3110 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, + /* 3120 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, + /* 3130 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, + /* 3140 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, + /* 3150 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, + /* 3160 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, + /* 3170 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, + /* 3180 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, + /* 3190 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, + /* 3200 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, + /* 3210 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, + /* 3220 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, + /* 3230 */ 558, 558, 558, 558, 558, 558, 558, 558, 558, 558, + /* 3240 */ 558, 558, 558, 558, 558, 378, 378, 378, 378, 378, /* 3250 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, /* 3260 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, /* 3270 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, @@ -1254,264 +1245,255 @@ static const YYCODETYPE yy_lookahead[] = { /* 3360 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, /* 3370 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, /* 3380 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, - /* 3390 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, - /* 3400 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, - /* 3410 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, - /* 3420 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, - /* 3430 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, - /* 3440 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, - /* 3450 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, - /* 3460 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, - /* 3470 */ 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, - /* 3480 */ 378, 378, 378, + /* 3390 */ 378, 378, 378, 378, 378, 378, }; -#define YY_SHIFT_COUNT (977) +#define YY_SHIFT_COUNT (978) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (2809) +#define YY_SHIFT_MAX (2846) static const unsigned short int yy_shift_ofst[] = { /* 0 */ 347, 0, 83, 0, 346, 346, 346, 346, 346, 346, /* 10 */ 346, 346, 346, 346, 346, 346, 429, 691, 691, 774, /* 20 */ 691, 691, 691, 691, 691, 691, 691, 691, 691, 691, /* 30 */ 691, 691, 691, 691, 691, 691, 691, 691, 691, 691, /* 40 */ 691, 691, 691, 691, 691, 691, 691, 691, 691, 691, - /* 50 */ 116, 465, 1050, 88, 140, 385, 140, 140, 88, 88, - /* 60 */ 140, 1186, 140, 950, 1186, 79, 140, 51, 1310, 341, - /* 70 */ 341, 102, 102, 87, 1310, 1310, 702, 702, 341, 5, - /* 80 */ 5, 435, 220, 220, 61, 186, 102, 102, 102, 102, - /* 90 */ 102, 102, 102, 102, 102, 102, 102, 340, 449, 543, - /* 100 */ 102, 102, 496, 51, 102, 340, 102, 51, 102, 102, - /* 110 */ 102, 102, 51, 102, 102, 102, 51, 102, 51, 51, - /* 120 */ 51, 39, 39, 524, 524, 603, 1074, 236, 648, 687, - /* 130 */ 687, 687, 687, 687, 687, 687, 687, 687, 687, 687, - /* 140 */ 687, 687, 687, 687, 687, 687, 687, 687, 21, 53, - /* 150 */ 5, 435, 1135, 1135, 497, 694, 694, 694, 450, 450, - /* 160 */ 374, 903, 497, 496, 51, 624, 51, 51, 535, 51, - /* 170 */ 51, 711, 51, 711, 711, 693, 982, 524, 524, 524, - /* 180 */ 524, 524, 524, 1440, 302, 406, 1040, 606, 606, 1005, - /* 190 */ 192, 244, 273, 612, 428, 751, 958, 29, 29, 829, - /* 200 */ 343, 1084, 1084, 1084, 963, 1084, 949, 969, 613, 927, - /* 210 */ 1429, 567, 1224, 1212, 1212, 1260, 1189, 1189, 1102, 890, - /* 220 */ 640, 1212, 903, 1456, 1705, 1744, 1746, 1535, 496, 1746, - /* 230 */ 496, 1565, 1744, 1763, 1743, 1763, 1743, 1617, 1744, 1763, - /* 240 */ 1744, 1743, 1617, 1617, 1617, 1704, 1709, 1744, 1744, 1714, - /* 250 */ 1744, 1744, 1744, 1818, 1791, 1818, 1791, 1746, 496, 496, - /* 260 */ 1825, 496, 1836, 1838, 496, 1836, 496, 1841, 496, 1842, - /* 270 */ 496, 496, 1744, 496, 1818, 51, 51, 51, 51, 51, - /* 280 */ 51, 51, 51, 51, 51, 51, 1744, 982, 982, 1818, - /* 290 */ 711, 711, 711, 1645, 1782, 1746, 87, 1889, 1694, 1697, - /* 300 */ 1825, 87, 1456, 1744, 711, 1610, 1612, 1610, 1612, 1613, - /* 310 */ 1721, 1610, 1609, 1622, 1642, 1456, 1648, 1653, 1625, 1635, - /* 320 */ 1631, 1763, 1945, 1851, 1678, 1836, 87, 87, 1612, 711, - /* 330 */ 711, 711, 711, 1612, 711, 1787, 87, 711, 1842, 87, - /* 340 */ 1883, 711, 1805, 1842, 87, 693, 87, 1763, 711, 711, - /* 350 */ 711, 711, 711, 711, 711, 711, 711, 711, 711, 711, - /* 360 */ 711, 711, 711, 711, 711, 711, 711, 711, 711, 711, - /* 370 */ 1891, 711, 1744, 87, 1986, 2005, 2014, 2012, 1818, 3105, - /* 380 */ 3105, 3105, 3105, 3105, 3105, 3105, 3105, 3105, 3105, 3105, - /* 390 */ 3105, 993, 1737, 490, 736, 1483, 769, 858, 85, 846, - /* 400 */ 1349, 492, 851, 1053, 1053, 1053, 1053, 1053, 1053, 1053, - /* 410 */ 1053, 1053, 478, 49, 1109, 15, 210, 210, 517, 593, - /* 420 */ 591, 225, 607, 607, 1022, 1118, 607, 304, 734, 1154, - /* 430 */ 308, 840, 840, 1088, 1268, 651, 1088, 1088, 1088, 1383, - /* 440 */ 904, 13, 1473, 1300, 107, 1345, 1450, 1293, 1392, 1397, - /* 450 */ 1401, 795, 1488, 1489, 1523, 1544, 1549, 1563, 1241, 1443, - /* 460 */ 1457, 1256, 1476, 1487, 1500, 1525, 1403, 453, 1263, 1539, - /* 470 */ 1562, 1564, 1604, 1574, 1446, 1579, 1095, 1586, 1596, 1598, - /* 480 */ 1600, 1603, 1605, 1611, 1626, 1634, 1644, 1647, 1650, 1661, - /* 490 */ 1663, 1669, 1673, 1618, 1654, 1660, 1666, 1668, 1670, 1472, - /* 500 */ 1027, 1382, 1511, 1681, 1713, 1606, 1696, 2085, 2086, 2087, - /* 510 */ 2041, 2092, 2058, 1853, 2061, 2062, 2063, 1857, 2101, 2067, - /* 520 */ 2068, 1862, 2070, 2107, 2108, 1867, 2112, 2077, 2114, 2079, - /* 530 */ 2116, 2097, 2120, 2088, 1884, 2123, 1907, 2133, 1910, 1911, - /* 540 */ 1920, 1923, 2140, 2141, 2142, 1932, 1934, 2146, 2147, 1990, - /* 550 */ 2098, 2099, 2151, 2117, 2152, 2154, 2119, 2103, 2160, 2110, - /* 560 */ 2162, 2122, 2171, 2172, 2173, 2124, 2174, 2177, 2178, 2179, - /* 570 */ 2180, 2181, 2007, 2159, 2197, 2024, 2201, 2202, 2205, 2207, - /* 580 */ 2208, 2209, 2210, 2211, 2212, 2213, 2214, 2215, 2216, 2217, - /* 590 */ 2224, 2225, 2226, 2229, 2230, 2231, 2136, 2188, 2175, 2232, - /* 600 */ 2234, 2235, 2236, 2237, 2238, 2239, 2240, 2241, 2198, 2221, - /* 610 */ 2084, 2243, 2093, 2244, 2096, 2249, 2253, 2233, 2167, 2246, - /* 620 */ 2204, 2257, 2203, 2272, 2206, 2242, 2273, 2218, 2275, 2220, - /* 630 */ 2277, 2279, 2245, 2251, 2247, 2280, 2248, 2254, 2263, 2283, - /* 640 */ 2262, 2255, 2269, 2285, 2281, 2287, 2223, 2271, 2256, 2265, - /* 650 */ 2276, 2310, 2278, 2290, 2286, 2282, 2293, 2332, 2333, 2334, - /* 660 */ 2291, 2129, 2337, 2265, 2288, 2338, 2265, 2292, 2342, 2345, - /* 670 */ 2289, 2346, 2347, 2318, 2302, 2315, 2361, 2326, 2309, 2320, - /* 680 */ 2366, 2331, 2314, 2325, 2370, 2335, 2319, 2330, 2376, 2377, - /* 690 */ 2388, 2390, 2391, 2393, 2258, 2259, 2360, 2373, 2397, 2379, - /* 700 */ 2362, 2363, 2367, 2368, 2374, 2375, 2385, 2387, 2389, 2369, - /* 710 */ 2394, 2392, 2395, 2384, 2396, 2409, 2402, 2426, 2407, 2430, - /* 720 */ 2411, 2378, 2436, 2415, 2403, 2438, 2443, 2444, 2410, 2445, - /* 730 */ 2412, 2447, 2413, 2450, 2429, 2432, 2418, 2422, 2423, 2341, - /* 740 */ 2348, 2460, 2268, 2252, 2250, 2349, 2260, 2265, 2416, 2462, - /* 750 */ 2295, 2433, 2448, 2466, 2261, 2449, 2296, 2294, 2482, 2485, - /* 760 */ 2298, 2303, 2299, 2312, 2483, 2472, 2222, 2398, 2400, 2405, - /* 770 */ 2401, 2486, 2487, 2406, 2473, 2414, 2476, 2419, 2408, 2496, - /* 780 */ 2498, 2417, 2420, 2424, 2425, 2427, 2499, 2467, 2490, 2431, - /* 790 */ 2503, 2266, 2455, 2428, 2509, 2435, 2511, 2439, 2451, 2542, - /* 800 */ 2515, 2267, 2518, 2528, 2529, 2530, 2533, 2536, 2457, 2458, - /* 810 */ 2500, 2300, 2543, 2524, 2577, 2578, 2464, 2540, 2469, 2470, - /* 820 */ 2474, 2475, 2399, 2477, 2587, 2547, 2404, 2593, 2478, 2481, - /* 830 */ 2437, 2553, 2452, 2565, 2489, 2328, 2492, 2604, 2585, 2356, - /* 840 */ 2493, 2494, 2497, 2501, 2502, 2505, 2506, 2507, 2562, 2510, - /* 850 */ 2513, 2563, 2508, 2596, 2364, 2517, 2525, 2622, 2526, 2535, - /* 860 */ 2456, 2600, 2544, 2521, 2626, 2538, 2550, 2265, 2575, 2552, - /* 870 */ 2554, 2546, 2555, 2556, 2548, 2646, 2650, 2652, 2446, 2561, - /* 880 */ 2644, 2645, 2567, 2573, 2655, 2580, 2576, 2660, 2497, 2581, - /* 890 */ 2662, 2501, 2583, 2664, 2502, 2586, 2665, 2505, 2566, 2568, - /* 900 */ 2569, 2570, 2589, 2676, 2595, 2677, 2608, 2676, 2676, 2702, - /* 910 */ 2649, 2651, 2705, 2692, 2693, 2694, 2695, 2696, 2697, 2698, - /* 920 */ 2699, 2700, 2701, 2706, 2656, 2634, 2663, 2635, 2713, 2711, - /* 930 */ 2712, 2714, 2727, 2715, 2716, 2717, 2672, 2369, 2720, 2394, - /* 940 */ 2721, 2722, 2724, 2728, 2741, 2729, 2772, 2738, 2723, 2731, - /* 950 */ 2778, 2743, 2726, 2737, 2782, 2748, 2733, 2744, 2785, 2754, - /* 960 */ 2745, 2747, 2792, 2769, 2806, 2786, 2771, 2809, 2788, 2779, - /* 970 */ 2775, 2777, 2793, 2795, 2796, 2797, 2799, 2794, + /* 50 */ 102, 116, 534, 212, 408, 766, 408, 408, 212, 212, + /* 60 */ 408, 1175, 408, 950, 1175, 623, 408, 20, 1338, 432, + /* 70 */ 432, 214, 214, 1338, 1338, 459, 459, 432, 437, 437, + /* 80 */ 74, 3, 3, 50, 52, 214, 214, 214, 214, 214, + /* 90 */ 214, 214, 214, 214, 214, 214, 286, 407, 473, 214, + /* 100 */ 214, 37, 20, 214, 286, 214, 20, 214, 214, 214, + /* 110 */ 214, 20, 214, 214, 214, 20, 214, 20, 20, 20, + /* 120 */ 636, 39, 39, 523, 523, 1433, 647, 236, 489, 1038, + /* 130 */ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, + /* 140 */ 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1222, 743, + /* 150 */ 437, 74, 1035, 1035, 790, 261, 261, 261, 632, 632, + /* 160 */ 496, 461, 790, 37, 20, 613, 20, 20, 483, 20, + /* 170 */ 20, 792, 20, 792, 792, 764, 1227, 523, 523, 523, + /* 180 */ 523, 523, 523, 1577, 302, 405, 563, 348, 348, 763, + /* 190 */ 599, 363, 330, 700, 122, 49, 747, 61, 61, 1086, + /* 200 */ 692, 901, 901, 901, 947, 901, 543, 1041, 1228, 1010, + /* 210 */ 1049, 452, 1051, 1166, 1166, 1172, 1320, 1320, 1103, 820, + /* 220 */ 981, 1166, 461, 1401, 1636, 1691, 1695, 1487, 37, 1695, + /* 230 */ 37, 1531, 1691, 1732, 1709, 1732, 1709, 1574, 1691, 1732, + /* 240 */ 1691, 1709, 1574, 1574, 1574, 1662, 1667, 1691, 1691, 1674, + /* 250 */ 1691, 1691, 1691, 1771, 1740, 1771, 1740, 1695, 37, 37, + /* 260 */ 1777, 37, 1785, 1788, 37, 1785, 37, 1802, 37, 1806, + /* 270 */ 37, 37, 1691, 37, 1771, 20, 20, 20, 20, 20, + /* 280 */ 20, 20, 20, 20, 20, 20, 1691, 1227, 1227, 1771, + /* 290 */ 792, 792, 792, 1637, 1765, 1695, 636, 1863, 1665, 1663, + /* 300 */ 1777, 636, 1401, 1691, 792, 1589, 1592, 1589, 1592, 1587, + /* 310 */ 1701, 1589, 1591, 1594, 1606, 1401, 1632, 1639, 1612, 1617, + /* 320 */ 1623, 1732, 1930, 1822, 1651, 1785, 636, 636, 1592, 792, + /* 330 */ 792, 792, 792, 1592, 792, 1776, 636, 792, 1806, 636, + /* 340 */ 1880, 792, 1800, 1806, 636, 764, 636, 1732, 792, 792, + /* 350 */ 792, 792, 792, 792, 792, 792, 792, 792, 792, 792, + /* 360 */ 792, 792, 792, 792, 792, 792, 792, 792, 792, 792, + /* 370 */ 1900, 792, 1691, 636, 1996, 1985, 2008, 2009, 1771, 3018, + /* 380 */ 3018, 3018, 3018, 3018, 3018, 3018, 3018, 3018, 3018, 3018, + /* 390 */ 3018, 1077, 867, 648, 1206, 887, 1005, 1043, 1214, 1350, + /* 400 */ 1692, 934, 1475, 1084, 1084, 1084, 1084, 1084, 1084, 1084, + /* 410 */ 1084, 1084, 183, 512, 220, 693, 702, 702, 4, 616, + /* 420 */ 811, 726, 542, 542, 145, 255, 542, 769, 683, 1209, + /* 430 */ 856, 141, 141, 113, 160, 738, 113, 113, 113, 91, + /* 440 */ 1241, 222, 925, 1301, 1019, 1249, 1388, 1272, 1287, 1291, + /* 450 */ 1310, 1347, 1418, 1425, 558, 1397, 1449, 1450, 1164, 1283, + /* 460 */ 1376, 1208, 1403, 1404, 1430, 1431, 1216, 1278, 1114, 1432, + /* 470 */ 1463, 1464, 1476, 1466, 770, 1468, 1402, 1477, 1478, 1479, + /* 480 */ 1497, 1498, 1501, 1520, 1526, 1530, 1538, 1546, 1573, 1579, + /* 490 */ 1590, 1604, 1615, 1565, 1567, 1586, 1603, 1613, 1624, 1366, + /* 500 */ 1473, 1369, 1458, 1508, 1598, 1547, 1440, 2090, 2091, 2092, + /* 510 */ 2047, 2095, 2061, 1855, 2063, 2070, 2072, 1868, 2112, 2077, + /* 520 */ 2078, 1872, 2080, 2117, 2118, 1876, 2120, 2085, 2122, 2087, + /* 530 */ 2124, 2104, 2127, 2093, 1890, 2131, 1910, 2135, 1912, 1918, + /* 540 */ 1927, 1932, 2146, 2149, 2150, 1939, 1941, 2153, 2155, 1998, + /* 550 */ 2106, 2107, 2160, 2125, 2162, 2163, 2128, 2111, 2166, 2116, + /* 560 */ 2168, 2126, 2169, 2171, 2175, 2129, 2177, 2178, 2179, 2181, + /* 570 */ 2182, 2183, 2010, 2148, 2185, 2011, 2188, 2189, 2190, 2191, + /* 580 */ 2193, 2195, 2198, 2199, 2200, 2201, 2202, 2204, 2205, 2206, + /* 590 */ 2207, 2208, 2209, 2210, 2212, 2213, 2164, 2214, 2187, 2218, + /* 600 */ 2222, 2230, 2232, 2235, 2236, 2237, 2241, 2244, 2233, 2252, + /* 610 */ 2096, 2257, 2102, 2261, 2108, 2262, 2263, 2243, 2216, 2248, + /* 620 */ 2219, 2279, 2220, 2281, 2223, 2250, 2282, 2224, 2284, 2225, + /* 630 */ 2290, 2294, 2259, 2242, 2253, 2298, 2264, 2245, 2258, 2301, + /* 640 */ 2268, 2254, 2274, 2319, 2285, 2320, 2275, 2283, 2292, 2272, + /* 650 */ 2277, 2312, 2278, 2331, 2291, 2299, 2335, 2345, 2346, 2347, + /* 660 */ 2304, 2142, 2354, 2272, 2300, 2356, 2272, 2306, 2358, 2367, + /* 670 */ 2296, 2368, 2370, 2337, 2321, 2330, 2376, 2341, 2324, 2336, + /* 680 */ 2381, 2348, 2329, 2352, 2392, 2359, 2343, 2355, 2398, 2401, + /* 690 */ 2402, 2403, 2404, 2405, 2288, 2295, 2371, 2384, 2408, 2387, + /* 700 */ 2375, 2378, 2379, 2385, 2386, 2395, 2397, 2399, 2406, 2407, + /* 710 */ 2410, 2412, 2413, 2415, 2414, 2420, 2416, 2434, 2417, 2441, + /* 720 */ 2422, 2390, 2452, 2431, 2419, 2454, 2456, 2458, 2423, 2462, + /* 730 */ 2427, 2470, 2436, 2473, 2453, 2461, 2438, 2440, 2442, 2369, + /* 740 */ 2372, 2483, 2293, 2255, 2260, 2374, 2267, 2272, 2443, 2491, + /* 750 */ 2314, 2457, 2486, 2505, 2297, 2487, 2317, 2313, 2511, 2513, + /* 760 */ 2322, 2315, 2326, 2318, 2514, 2489, 2226, 2424, 2409, 2425, + /* 770 */ 2421, 2484, 2492, 2426, 2471, 2432, 2495, 2445, 2433, 2526, + /* 780 */ 2527, 2446, 2448, 2449, 2450, 2451, 2528, 2497, 2517, 2455, + /* 790 */ 2533, 2265, 2490, 2459, 2538, 2464, 2537, 2465, 2466, 2574, + /* 800 */ 2547, 2280, 2549, 2550, 2551, 2552, 2554, 2555, 2467, 2478, + /* 810 */ 2544, 2316, 2572, 2556, 2606, 2608, 2494, 2566, 2496, 2498, + /* 820 */ 2500, 2501, 2429, 2503, 2611, 2569, 2439, 2619, 2504, 2508, + /* 830 */ 2430, 2590, 2460, 2603, 2524, 2366, 2530, 2642, 2623, 2396, + /* 840 */ 2531, 2534, 2536, 2539, 2541, 2542, 2543, 2545, 2598, 2548, + /* 850 */ 2553, 2601, 2557, 2631, 2411, 2559, 2560, 2659, 2561, 2563, + /* 860 */ 2469, 2616, 2564, 2567, 2669, 2648, 2558, 2565, 2272, 2621, + /* 870 */ 2568, 2571, 2582, 2575, 2585, 2576, 2679, 2681, 2683, 2475, + /* 880 */ 2591, 2645, 2672, 2595, 2597, 2678, 2600, 2609, 2686, 2536, + /* 890 */ 2610, 2688, 2539, 2612, 2694, 2541, 2615, 2697, 2542, 2599, + /* 900 */ 2602, 2613, 2617, 2625, 2705, 2634, 2716, 2640, 2705, 2705, + /* 910 */ 2734, 2682, 2684, 2735, 2724, 2725, 2726, 2727, 2728, 2729, + /* 920 */ 2730, 2731, 2732, 2733, 2737, 2689, 2661, 2693, 2670, 2745, + /* 930 */ 2744, 2753, 2754, 2769, 2757, 2759, 2760, 2715, 2407, 2764, + /* 940 */ 2410, 2766, 2767, 2768, 2775, 2791, 2779, 2817, 2783, 2770, + /* 950 */ 2776, 2821, 2786, 2771, 2782, 2823, 2792, 2773, 2785, 2830, + /* 960 */ 2795, 2781, 2793, 2836, 2802, 2840, 2819, 2808, 2845, 2832, + /* 970 */ 2822, 2816, 2820, 2835, 2837, 2838, 2841, 2843, 2846, }; #define YY_REDUCE_COUNT (390) -#define YY_REDUCE_MIN (-514) -#define YY_REDUCE_MAX (2601) +#define YY_REDUCE_MIN (-503) +#define YY_REDUCE_MAX (2515) static const short yy_reduce_ofst[] = { - /* 0 */ -240, -366, -203, -19, 324, 421, 749, 787, 811, 893, - /* 10 */ 932, 971, 1038, 1169, 1208, 1247, -317, 1296, 1329, 1391, - /* 20 */ 1471, 1531, 1558, 1629, 1667, 1693, 1762, 1803, 1822, 1852, - /* 30 */ 1886, 1916, 1976, 1998, 2011, 2060, 2138, 2157, 2187, 2219, - /* 40 */ 2270, 2297, 2359, 2380, 2421, 2442, 2504, 2520, 2582, 2601, - /* 50 */ -311, 23, 327, -363, 666, 1021, 1061, 1072, -191, -147, - /* 60 */ 1100, -383, -514, -232, -375, -504, -66, -41, -426, -441, - /* 70 */ -437, 139, 163, -17, -423, -353, -384, -333, -214, -308, - /* 80 */ 348, -110, -224, -114, -352, 57, 393, 396, 473, 519, - /* 90 */ -206, 434, 614, 740, 746, 782, 441, 34, 189, -31, - /* 100 */ 791, 821, -402, -11, 866, 433, 945, -332, 955, 984, - /* 110 */ 991, 1002, 509, 1030, 1069, 1092, 26, 1116, 765, 381, - /* 120 */ 557, 242, 242, 582, -278, -261, 97, -248, -13, -338, - /* 130 */ 466, 525, 762, 776, 862, 863, 896, 901, 911, 912, - /* 140 */ 935, 939, 946, 974, 978, 985, 994, 1019, -196, -99, - /* 150 */ 122, 581, 650, 825, 818, -99, 312, 319, 423, 550, - /* 160 */ 462, 52, 920, 801, -86, 701, 177, 797, 254, 284, - /* 170 */ 815, 836, 813, 876, 970, 1031, 987, -425, -414, 554, - /* 180 */ 578, 597, 725, 689, 761, 848, 852, 881, 881, 865, - /* 190 */ 986, 1025, 1042, 1185, 881, 1162, 1162, 1196, 1215, 1204, - /* 200 */ 1147, 1089, 1099, 1168, 1248, 1176, 1162, 1270, 1328, 1238, - /* 210 */ 1334, 1290, 1257, 1279, 1281, 1162, 1213, 1223, 1187, 1225, - /* 220 */ 1222, 1301, 1342, 1291, 1272, 1370, 1287, 1284, 1373, 1294, - /* 230 */ 1374, 1309, 1386, 1393, 1347, 1408, 1355, 1360, 1414, 1415, - /* 240 */ 1417, 1359, 1365, 1366, 1368, 1411, 1416, 1427, 1436, 1428, - /* 250 */ 1441, 1442, 1447, 1453, 1452, 1458, 1455, 1369, 1444, 1449, - /* 260 */ 1406, 1451, 1460, 1389, 1459, 1463, 1461, 1405, 1464, 1409, - /* 270 */ 1465, 1466, 1477, 1467, 1485, 1454, 1462, 1469, 1474, 1475, - /* 280 */ 1478, 1479, 1480, 1481, 1484, 1486, 1482, 1490, 1491, 1493, - /* 290 */ 1434, 1437, 1492, 1412, 1418, 1431, 1505, 1435, 1445, 1448, - /* 300 */ 1494, 1515, 1495, 1524, 1498, 1387, 1468, 1388, 1496, 1394, - /* 310 */ 1404, 1395, 1410, 1413, 1421, 1497, 1420, 1424, 1399, 1425, - /* 320 */ 1430, 1566, 1499, 1470, 1502, 1582, 1578, 1581, 1522, 1543, - /* 330 */ 1545, 1546, 1547, 1528, 1550, 1532, 1591, 1553, 1541, 1597, - /* 340 */ 1501, 1559, 1551, 1554, 1614, 1585, 1615, 1616, 1569, 1571, - /* 350 */ 1576, 1577, 1580, 1584, 1593, 1594, 1595, 1599, 1601, 1602, - /* 360 */ 1607, 1620, 1623, 1624, 1627, 1628, 1630, 1633, 1636, 1637, - /* 370 */ 1608, 1638, 1651, 1619, 1656, 1659, 1655, 1671, 1676, 1621, - /* 380 */ 1641, 1588, 1587, 1632, 1639, 1664, 1665, 1658, 1672, 1674, - /* 390 */ 1702, + /* 0 */ -239, -365, -325, -19, -202, 325, 366, 705, 810, 840, + /* 10 */ 960, 991, 1027, 1156, 1237, 1318, 1342, 1361, 1429, 1494, + /* 20 */ 1469, 1537, 1605, 1563, 1642, 1729, 1751, 1778, 1815, 1842, + /* 30 */ 1864, 1891, 1928, 1969, 2004, 2036, 2055, 2101, 2133, 2197, + /* 40 */ 2221, 2246, 2286, 2310, 2351, 2391, 2418, 2437, 2502, 2515, + /* 50 */ -310, -61, -464, -362, 865, 955, 1145, 1165, -297, -271, + /* 60 */ 1201, -412, -503, -384, -382, -82, 13, -393, -385, -436, + /* 70 */ -356, -210, -21, -389, -324, -388, -247, -439, -142, 115, + /* 80 */ 148, -198, -191, -359, 89, 173, 313, 345, 403, 409, + /* 90 */ 435, 433, 440, 454, 578, 492, -337, 387, -10, 445, + /* 100 */ 583, 472, 412, 601, 393, 614, 15, 653, 675, 794, + /* 110 */ 837, 349, 844, 851, 874, 31, 877, 111, 375, 365, + /* 120 */ 565, -501, -501, -66, -111, -223, 595, -100, 120, -231, + /* 130 */ -3, 548, 753, 814, 817, 834, 836, 839, 843, 861, + /* 140 */ 881, 904, 916, 932, 937, 948, 949, 974, -405, 530, + /* 150 */ 87, 372, 704, 741, 869, 530, 806, 876, 434, 499, + /* 160 */ 673, -224, 884, 228, 64, 893, -195, 547, 644, 863, + /* 170 */ 718, 939, 871, 941, 943, -48, 919, -425, -411, 935, + /* 180 */ 999, 1009, 1040, 1007, 1093, 1134, 1075, 1012, 1012, 993, + /* 190 */ 1008, 1032, 1033, 1236, 1012, 1212, 1212, 1226, 1238, 1245, + /* 200 */ 1195, 1105, 1115, 1116, 1197, 1117, 1212, 1211, 1268, 1182, + /* 210 */ 1276, 1233, 1203, 1229, 1231, 1212, 1147, 1151, 1136, 1173, + /* 220 */ 1158, 1234, 1281, 1242, 1219, 1321, 1247, 1240, 1317, 1252, + /* 230 */ 1337, 1274, 1352, 1359, 1308, 1364, 1312, 1316, 1370, 1372, + /* 240 */ 1371, 1319, 1323, 1324, 1326, 1368, 1373, 1384, 1386, 1381, + /* 250 */ 1393, 1394, 1395, 1405, 1406, 1407, 1408, 1315, 1392, 1399, + /* 260 */ 1356, 1415, 1410, 1343, 1417, 1414, 1419, 1374, 1420, 1375, + /* 270 */ 1424, 1443, 1441, 1444, 1447, 1426, 1428, 1437, 1439, 1442, + /* 280 */ 1446, 1448, 1451, 1452, 1453, 1454, 1460, 1482, 1484, 1481, + /* 290 */ 1445, 1455, 1456, 1398, 1411, 1409, 1480, 1413, 1422, 1427, + /* 300 */ 1457, 1491, 1421, 1500, 1465, 1377, 1461, 1378, 1462, 1367, + /* 310 */ 1382, 1379, 1396, 1412, 1400, 1470, 1416, 1423, 1383, 1391, + /* 320 */ 1459, 1550, 1467, 1438, 1483, 1555, 1551, 1552, 1495, 1514, + /* 330 */ 1517, 1522, 1532, 1511, 1533, 1518, 1575, 1540, 1525, 1585, + /* 340 */ 1485, 1557, 1545, 1553, 1608, 1584, 1609, 1618, 1576, 1578, + /* 350 */ 1580, 1581, 1583, 1588, 1599, 1600, 1601, 1602, 1611, 1614, + /* 360 */ 1616, 1625, 1627, 1628, 1630, 1631, 1633, 1634, 1635, 1638, + /* 370 */ 1596, 1640, 1621, 1629, 1644, 1658, 1660, 1661, 1668, 1582, + /* 380 */ 1646, 1593, 1597, 1620, 1622, 1669, 1670, 1659, 1671, 1675, + /* 390 */ 1685, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, - /* 10 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, - /* 20 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, - /* 30 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, - /* 40 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, - /* 50 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, - /* 60 */ 2581, 2205, 2205, 2537, 2205, 2205, 2205, 2205, 2205, 2205, - /* 70 */ 2205, 2205, 2205, 2309, 2205, 2205, 2205, 2205, 2205, 2544, - /* 80 */ 2544, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, - /* 90 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, - /* 100 */ 2205, 2205, 2311, 2205, 2205, 2205, 2205, 2205, 2205, 2205, - /* 110 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, - /* 120 */ 2205, 2833, 2205, 2959, 2622, 2205, 2205, 2862, 2205, 2205, - /* 130 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, - /* 140 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2845, - /* 150 */ 2205, 2205, 2282, 2282, 2205, 2845, 2845, 2845, 2805, 2805, - /* 160 */ 2309, 2205, 2205, 2311, 2205, 2624, 2205, 2205, 2205, 2205, - /* 170 */ 2205, 2205, 2205, 2205, 2205, 2453, 2235, 2205, 2205, 2205, - /* 180 */ 2205, 2205, 2205, 2607, 2205, 2205, 2891, 2837, 2838, 2953, - /* 190 */ 2205, 2894, 2856, 2205, 2851, 2205, 2205, 2205, 2205, 2205, - /* 200 */ 2881, 2205, 2205, 2205, 2205, 2205, 2205, 2549, 2205, 2650, - /* 210 */ 2205, 2396, 2601, 2205, 2205, 2205, 2205, 2205, 2937, 2835, - /* 220 */ 2875, 2205, 2205, 2885, 2205, 2205, 2205, 2638, 2311, 2205, - /* 230 */ 2311, 2594, 2532, 2205, 2542, 2205, 2542, 2539, 2205, 2205, - /* 240 */ 2205, 2542, 2539, 2539, 2539, 2385, 2381, 2205, 2205, 2379, - /* 250 */ 2205, 2205, 2205, 2205, 2265, 2205, 2265, 2205, 2311, 2311, - /* 260 */ 2205, 2311, 2205, 2205, 2311, 2205, 2311, 2205, 2311, 2205, - /* 270 */ 2311, 2311, 2205, 2311, 2205, 2205, 2205, 2205, 2205, 2205, - /* 280 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, - /* 290 */ 2205, 2205, 2205, 2636, 2617, 2205, 2309, 2205, 2605, 2603, - /* 300 */ 2205, 2309, 2885, 2205, 2205, 2907, 2902, 2907, 2902, 2921, - /* 310 */ 2917, 2907, 2926, 2923, 2887, 2885, 2868, 2864, 2956, 2943, - /* 320 */ 2939, 2205, 2205, 2873, 2871, 2205, 2309, 2309, 2902, 2205, - /* 330 */ 2205, 2205, 2205, 2902, 2205, 2205, 2309, 2205, 2205, 2309, - /* 340 */ 2205, 2205, 2205, 2205, 2309, 2205, 2309, 2205, 2205, 2205, - /* 350 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, - /* 360 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, - /* 370 */ 2415, 2205, 2205, 2309, 2205, 2237, 2239, 2249, 2205, 2596, - /* 380 */ 2959, 2622, 2627, 2577, 2577, 2456, 2456, 2959, 2456, 2312, - /* 390 */ 2210, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, - /* 400 */ 2205, 2205, 2205, 2920, 2919, 2756, 2205, 2809, 2808, 2807, - /* 410 */ 2798, 2755, 2410, 2205, 2205, 2205, 2754, 2753, 2205, 2205, - /* 420 */ 2205, 2205, 2400, 2397, 2205, 2205, 2424, 2205, 2205, 2205, - /* 430 */ 2205, 2568, 2567, 2747, 2205, 2205, 2748, 2746, 2745, 2205, - /* 440 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, - /* 450 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, - /* 460 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2940, 2944, 2205, - /* 470 */ 2205, 2205, 2834, 2205, 2205, 2205, 2726, 2205, 2205, 2205, - /* 480 */ 2205, 2205, 2694, 2689, 2680, 2671, 2686, 2677, 2665, 2683, - /* 490 */ 2674, 2662, 2659, 2205, 2205, 2205, 2205, 2205, 2205, 2205, - /* 500 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, - /* 510 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, - /* 520 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, - /* 530 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, - /* 540 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2538, - /* 550 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, - /* 560 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, - /* 570 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, - /* 580 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, - /* 590 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, - /* 600 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, - /* 610 */ 2205, 2205, 2205, 2205, 2553, 2205, 2205, 2205, 2205, 2205, - /* 620 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, - /* 630 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, - /* 640 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2254, 2733, - /* 650 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, - /* 660 */ 2205, 2205, 2205, 2736, 2205, 2205, 2737, 2205, 2205, 2205, - /* 670 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, - /* 680 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, - /* 690 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, - /* 700 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2356, - /* 710 */ 2355, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, - /* 720 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, - /* 730 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2738, - /* 740 */ 2205, 2205, 2205, 2205, 2621, 2205, 2205, 2728, 2205, 2205, - /* 750 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, - /* 760 */ 2205, 2205, 2205, 2205, 2936, 2888, 2205, 2205, 2205, 2205, - /* 770 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, - /* 780 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2726, 2205, - /* 790 */ 2918, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2934, 2205, - /* 800 */ 2938, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2844, 2840, - /* 810 */ 2205, 2205, 2836, 2205, 2205, 2205, 2205, 2205, 2205, 2205, - /* 820 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, - /* 830 */ 2205, 2205, 2205, 2795, 2205, 2205, 2205, 2829, 2205, 2205, - /* 840 */ 2205, 2205, 2452, 2451, 2450, 2449, 2205, 2205, 2205, 2205, - /* 850 */ 2205, 2205, 2738, 2205, 2741, 2205, 2205, 2205, 2205, 2205, - /* 860 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2725, 2205, 2780, - /* 870 */ 2779, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, - /* 880 */ 2205, 2205, 2446, 2205, 2205, 2205, 2205, 2205, 2205, 2205, - /* 890 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2430, 2428, - /* 900 */ 2427, 2426, 2205, 2463, 2205, 2205, 2205, 2459, 2458, 2205, - /* 910 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, - /* 920 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2330, 2205, - /* 930 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2322, 2205, 2321, - /* 940 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, - /* 950 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, - /* 960 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2234, - /* 970 */ 2205, 2205, 2205, 2205, 2205, 2205, 2205, 2205, + /* 0 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, + /* 10 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, + /* 20 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, + /* 30 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, + /* 40 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, + /* 50 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, + /* 60 */ 2578, 2203, 2203, 2534, 2203, 2203, 2203, 2203, 2203, 2203, + /* 70 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2541, 2541, + /* 80 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, + /* 90 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, + /* 100 */ 2203, 2309, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, + /* 110 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, + /* 120 */ 2307, 2830, 2203, 2956, 2619, 2203, 2203, 2859, 2203, 2203, + /* 130 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, + /* 140 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2842, + /* 150 */ 2203, 2203, 2280, 2280, 2203, 2842, 2842, 2842, 2802, 2802, + /* 160 */ 2307, 2203, 2203, 2309, 2203, 2621, 2203, 2203, 2203, 2203, + /* 170 */ 2203, 2203, 2203, 2203, 2203, 2450, 2233, 2203, 2203, 2203, + /* 180 */ 2203, 2203, 2203, 2604, 2203, 2203, 2888, 2834, 2835, 2950, + /* 190 */ 2203, 2891, 2853, 2203, 2848, 2203, 2203, 2203, 2203, 2203, + /* 200 */ 2878, 2203, 2203, 2203, 2203, 2203, 2203, 2546, 2203, 2647, + /* 210 */ 2203, 2395, 2598, 2203, 2203, 2203, 2203, 2203, 2934, 2832, + /* 220 */ 2872, 2203, 2203, 2882, 2203, 2203, 2203, 2635, 2309, 2203, + /* 230 */ 2309, 2591, 2529, 2203, 2539, 2203, 2539, 2536, 2203, 2203, + /* 240 */ 2203, 2539, 2536, 2536, 2536, 2383, 2379, 2203, 2203, 2377, + /* 250 */ 2203, 2203, 2203, 2203, 2263, 2203, 2263, 2203, 2309, 2309, + /* 260 */ 2203, 2309, 2203, 2203, 2309, 2203, 2309, 2203, 2309, 2203, + /* 270 */ 2309, 2309, 2203, 2309, 2203, 2203, 2203, 2203, 2203, 2203, + /* 280 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, + /* 290 */ 2203, 2203, 2203, 2633, 2614, 2203, 2307, 2203, 2602, 2600, + /* 300 */ 2203, 2307, 2882, 2203, 2203, 2904, 2899, 2904, 2899, 2918, + /* 310 */ 2914, 2904, 2923, 2920, 2884, 2882, 2865, 2861, 2953, 2940, + /* 320 */ 2936, 2203, 2203, 2870, 2868, 2203, 2307, 2307, 2899, 2203, + /* 330 */ 2203, 2203, 2203, 2899, 2203, 2203, 2307, 2203, 2203, 2307, + /* 340 */ 2203, 2203, 2203, 2203, 2307, 2203, 2307, 2203, 2203, 2203, + /* 350 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, + /* 360 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, + /* 370 */ 2412, 2203, 2203, 2307, 2203, 2235, 2237, 2247, 2203, 2593, + /* 380 */ 2956, 2619, 2624, 2574, 2574, 2453, 2453, 2956, 2453, 2310, + /* 390 */ 2208, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, + /* 400 */ 2203, 2203, 2203, 2917, 2916, 2753, 2203, 2806, 2805, 2804, + /* 410 */ 2795, 2752, 2408, 2203, 2203, 2203, 2751, 2750, 2203, 2203, + /* 420 */ 2203, 2203, 2399, 2396, 2203, 2203, 2421, 2203, 2203, 2203, + /* 430 */ 2203, 2565, 2564, 2744, 2203, 2203, 2745, 2743, 2742, 2203, + /* 440 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, + /* 450 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, + /* 460 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2937, 2941, 2203, + /* 470 */ 2203, 2203, 2831, 2203, 2203, 2203, 2723, 2203, 2203, 2203, + /* 480 */ 2203, 2203, 2691, 2686, 2677, 2668, 2683, 2674, 2662, 2680, + /* 490 */ 2671, 2659, 2656, 2203, 2203, 2203, 2203, 2203, 2203, 2203, + /* 500 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, + /* 510 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, + /* 520 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, + /* 530 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, + /* 540 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2535, + /* 550 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, + /* 560 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, + /* 570 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, + /* 580 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, + /* 590 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, + /* 600 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, + /* 610 */ 2203, 2203, 2203, 2203, 2550, 2203, 2203, 2203, 2203, 2203, + /* 620 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, + /* 630 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, + /* 640 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2252, 2730, + /* 650 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, + /* 660 */ 2203, 2203, 2203, 2733, 2203, 2203, 2734, 2203, 2203, 2203, + /* 670 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, + /* 680 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, + /* 690 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, + /* 700 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2354, + /* 710 */ 2353, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, + /* 720 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, + /* 730 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2735, + /* 740 */ 2203, 2203, 2203, 2203, 2618, 2203, 2203, 2725, 2203, 2203, + /* 750 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, + /* 760 */ 2203, 2203, 2203, 2203, 2933, 2885, 2203, 2203, 2203, 2203, + /* 770 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, + /* 780 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2723, 2203, + /* 790 */ 2915, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2931, 2203, + /* 800 */ 2935, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2841, 2837, + /* 810 */ 2203, 2203, 2833, 2203, 2203, 2203, 2203, 2203, 2203, 2203, + /* 820 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, + /* 830 */ 2203, 2203, 2203, 2792, 2203, 2203, 2203, 2826, 2203, 2203, + /* 840 */ 2203, 2203, 2449, 2448, 2447, 2446, 2203, 2203, 2203, 2203, + /* 850 */ 2203, 2203, 2735, 2203, 2738, 2203, 2203, 2203, 2203, 2203, + /* 860 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2722, 2203, + /* 870 */ 2777, 2776, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, + /* 880 */ 2203, 2203, 2203, 2443, 2203, 2203, 2203, 2203, 2203, 2203, + /* 890 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2427, + /* 900 */ 2425, 2424, 2423, 2203, 2460, 2203, 2203, 2203, 2456, 2455, + /* 910 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, + /* 920 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2328, + /* 930 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2320, 2203, + /* 940 */ 2319, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, + /* 950 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, + /* 960 */ 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, + /* 970 */ 2232, 2203, 2203, 2203, 2203, 2203, 2203, 2203, 2203, }; /********** End of lemon-generated parsing tables *****************************/ @@ -1648,6 +1630,8 @@ static const YYCODETYPE yyFallback[] = { 0, /* TABLE => nothing */ 0, /* NK_LP => nothing */ 0, /* NK_RP => nothing */ + 0, /* USING => nothing */ + 328, /* FILE => ABORT */ 0, /* STABLE => nothing */ 0, /* COLUMN => nothing */ 0, /* MODIFY => nothing */ @@ -1655,9 +1639,7 @@ static const YYCODETYPE yyFallback[] = { 0, /* TAG => nothing */ 0, /* SET => nothing */ 0, /* NK_EQ => nothing */ - 0, /* USING => nothing */ 0, /* TAGS => nothing */ - 328, /* FILE => ABORT */ 0, /* BOOL => nothing */ 0, /* TINYINT => nothing */ 0, /* SMALLINT => nothing */ @@ -2114,16 +2096,16 @@ static const char *const yyTokenName[] = { /* 114 */ "TABLE", /* 115 */ "NK_LP", /* 116 */ "NK_RP", - /* 117 */ "STABLE", - /* 118 */ "COLUMN", - /* 119 */ "MODIFY", - /* 120 */ "RENAME", - /* 121 */ "TAG", - /* 122 */ "SET", - /* 123 */ "NK_EQ", - /* 124 */ "USING", - /* 125 */ "TAGS", - /* 126 */ "FILE", + /* 117 */ "USING", + /* 118 */ "FILE", + /* 119 */ "STABLE", + /* 120 */ "COLUMN", + /* 121 */ "MODIFY", + /* 122 */ "RENAME", + /* 123 */ "TAG", + /* 124 */ "SET", + /* 125 */ "NK_EQ", + /* 126 */ "TAGS", /* 127 */ "BOOL", /* 128 */ "TINYINT", /* 129 */ "SMALLINT", @@ -2417,145 +2399,144 @@ static const char *const yyTokenName[] = { /* 417 */ "tags_def_opt", /* 418 */ "table_options", /* 419 */ "multi_create_clause", - /* 420 */ "tags_def", - /* 421 */ "multi_drop_clause", - /* 422 */ "alter_table_clause", - /* 423 */ "alter_table_options", - /* 424 */ "column_name", - /* 425 */ "type_name", - /* 426 */ "column_options", - /* 427 */ "tags_literal", - /* 428 */ "create_subtable_clause", - /* 429 */ "create_from_file_clause", + /* 420 */ "tag_list_opt", + /* 421 */ "tags_def", + /* 422 */ "multi_drop_clause", + /* 423 */ "alter_table_clause", + /* 424 */ "alter_table_options", + /* 425 */ "column_name", + /* 426 */ "type_name", + /* 427 */ "column_options", + /* 428 */ "tags_literal", + /* 429 */ "create_subtable_clause", /* 430 */ "specific_cols_opt", /* 431 */ "tags_literal_list", - /* 432 */ "tag_list_opt", - /* 433 */ "drop_table_clause", - /* 434 */ "col_name_list", - /* 435 */ "tag_def_list", - /* 436 */ "tag_def", - /* 437 */ "column_def", - /* 438 */ "type_name_default_len", - /* 439 */ "duration_list", - /* 440 */ "rollup_func_list", - /* 441 */ "alter_table_option", - /* 442 */ "duration_literal", - /* 443 */ "rollup_func_name", - /* 444 */ "function_name", - /* 445 */ "col_name", - /* 446 */ "db_kind_opt", - /* 447 */ "table_kind_db_name_cond_opt", - /* 448 */ "like_pattern_opt", - /* 449 */ "db_name_cond_opt", - /* 450 */ "table_name_cond", - /* 451 */ "from_db_opt", - /* 452 */ "table_kind", - /* 453 */ "tag_item", - /* 454 */ "column_alias", - /* 455 */ "tsma_name", - /* 456 */ "tsma_func_list", - /* 457 */ "full_tsma_name", - /* 458 */ "func_list", - /* 459 */ "index_options", - /* 460 */ "full_index_name", - /* 461 */ "index_name", - /* 462 */ "sliding_opt", - /* 463 */ "sma_stream_opt", - /* 464 */ "func", - /* 465 */ "sma_func_name", - /* 466 */ "expression_list", - /* 467 */ "with_meta", - /* 468 */ "query_or_subquery", - /* 469 */ "where_clause_opt", - /* 470 */ "cgroup_name", - /* 471 */ "analyze_opt", - /* 472 */ "explain_options", - /* 473 */ "insert_query", - /* 474 */ "or_replace_opt", - /* 475 */ "agg_func_opt", - /* 476 */ "bufsize_opt", - /* 477 */ "language_opt", - /* 478 */ "full_view_name", - /* 479 */ "view_name", - /* 480 */ "stream_name", - /* 481 */ "stream_options", - /* 482 */ "col_list_opt", - /* 483 */ "tag_def_or_ref_opt", - /* 484 */ "subtable_opt", - /* 485 */ "ignore_opt", - /* 486 */ "column_stream_def_list", - /* 487 */ "column_stream_def", - /* 488 */ "stream_col_options", - /* 489 */ "expression", - /* 490 */ "on_vgroup_id", - /* 491 */ "dnode_list", - /* 492 */ "literal_func", - /* 493 */ "signed_literal", - /* 494 */ "literal_list", - /* 495 */ "table_alias", - /* 496 */ "expr_or_subquery", - /* 497 */ "pseudo_column", - /* 498 */ "column_reference", - /* 499 */ "function_expression", - /* 500 */ "case_when_expression", - /* 501 */ "star_func", - /* 502 */ "star_func_para_list", - /* 503 */ "noarg_func", - /* 504 */ "other_para_list", - /* 505 */ "star_func_para", - /* 506 */ "when_then_list", - /* 507 */ "case_when_else_opt", - /* 508 */ "common_expression", - /* 509 */ "when_then_expr", - /* 510 */ "predicate", - /* 511 */ "compare_op", - /* 512 */ "in_op", - /* 513 */ "in_predicate_value", - /* 514 */ "boolean_value_expression", - /* 515 */ "boolean_primary", - /* 516 */ "from_clause_opt", - /* 517 */ "table_reference_list", - /* 518 */ "table_reference", - /* 519 */ "table_primary", - /* 520 */ "joined_table", - /* 521 */ "alias_opt", - /* 522 */ "subquery", - /* 523 */ "parenthesized_joined_table", - /* 524 */ "join_type", - /* 525 */ "join_subtype", - /* 526 */ "join_on_clause_opt", - /* 527 */ "window_offset_clause_opt", - /* 528 */ "jlimit_clause_opt", - /* 529 */ "window_offset_literal", - /* 530 */ "query_specification", - /* 531 */ "hint_list", - /* 532 */ "set_quantifier_opt", - /* 533 */ "tag_mode_opt", - /* 534 */ "select_list", - /* 535 */ "partition_by_clause_opt", - /* 536 */ "range_opt", - /* 537 */ "every_opt", - /* 538 */ "fill_opt", - /* 539 */ "twindow_clause_opt", - /* 540 */ "group_by_clause_opt", - /* 541 */ "having_clause_opt", - /* 542 */ "select_item", - /* 543 */ "partition_list", - /* 544 */ "partition_item", - /* 545 */ "interval_sliding_duration_literal", - /* 546 */ "fill_mode", - /* 547 */ "group_by_list", - /* 548 */ "query_expression", - /* 549 */ "query_simple", - /* 550 */ "order_by_clause_opt", - /* 551 */ "slimit_clause_opt", - /* 552 */ "limit_clause_opt", - /* 553 */ "union_query_expression", - /* 554 */ "query_simple_or_subquery", - /* 555 */ "sort_specification_list", - /* 556 */ "sort_specification", - /* 557 */ "ordering_specification_opt", - /* 558 */ "null_ordering_opt", + /* 432 */ "drop_table_clause", + /* 433 */ "col_name_list", + /* 434 */ "tag_def_list", + /* 435 */ "tag_def", + /* 436 */ "column_def", + /* 437 */ "type_name_default_len", + /* 438 */ "duration_list", + /* 439 */ "rollup_func_list", + /* 440 */ "alter_table_option", + /* 441 */ "duration_literal", + /* 442 */ "rollup_func_name", + /* 443 */ "function_name", + /* 444 */ "col_name", + /* 445 */ "db_kind_opt", + /* 446 */ "table_kind_db_name_cond_opt", + /* 447 */ "like_pattern_opt", + /* 448 */ "db_name_cond_opt", + /* 449 */ "table_name_cond", + /* 450 */ "from_db_opt", + /* 451 */ "table_kind", + /* 452 */ "tag_item", + /* 453 */ "column_alias", + /* 454 */ "tsma_name", + /* 455 */ "tsma_func_list", + /* 456 */ "full_tsma_name", + /* 457 */ "func_list", + /* 458 */ "index_options", + /* 459 */ "full_index_name", + /* 460 */ "index_name", + /* 461 */ "sliding_opt", + /* 462 */ "sma_stream_opt", + /* 463 */ "func", + /* 464 */ "sma_func_name", + /* 465 */ "expression_list", + /* 466 */ "with_meta", + /* 467 */ "query_or_subquery", + /* 468 */ "where_clause_opt", + /* 469 */ "cgroup_name", + /* 470 */ "analyze_opt", + /* 471 */ "explain_options", + /* 472 */ "insert_query", + /* 473 */ "or_replace_opt", + /* 474 */ "agg_func_opt", + /* 475 */ "bufsize_opt", + /* 476 */ "language_opt", + /* 477 */ "full_view_name", + /* 478 */ "view_name", + /* 479 */ "stream_name", + /* 480 */ "stream_options", + /* 481 */ "col_list_opt", + /* 482 */ "tag_def_or_ref_opt", + /* 483 */ "subtable_opt", + /* 484 */ "ignore_opt", + /* 485 */ "column_stream_def_list", + /* 486 */ "column_stream_def", + /* 487 */ "stream_col_options", + /* 488 */ "expression", + /* 489 */ "on_vgroup_id", + /* 490 */ "dnode_list", + /* 491 */ "literal_func", + /* 492 */ "signed_literal", + /* 493 */ "literal_list", + /* 494 */ "table_alias", + /* 495 */ "expr_or_subquery", + /* 496 */ "pseudo_column", + /* 497 */ "column_reference", + /* 498 */ "function_expression", + /* 499 */ "case_when_expression", + /* 500 */ "star_func", + /* 501 */ "star_func_para_list", + /* 502 */ "noarg_func", + /* 503 */ "other_para_list", + /* 504 */ "star_func_para", + /* 505 */ "when_then_list", + /* 506 */ "case_when_else_opt", + /* 507 */ "common_expression", + /* 508 */ "when_then_expr", + /* 509 */ "predicate", + /* 510 */ "compare_op", + /* 511 */ "in_op", + /* 512 */ "in_predicate_value", + /* 513 */ "boolean_value_expression", + /* 514 */ "boolean_primary", + /* 515 */ "from_clause_opt", + /* 516 */ "table_reference_list", + /* 517 */ "table_reference", + /* 518 */ "table_primary", + /* 519 */ "joined_table", + /* 520 */ "alias_opt", + /* 521 */ "subquery", + /* 522 */ "parenthesized_joined_table", + /* 523 */ "join_type", + /* 524 */ "join_subtype", + /* 525 */ "join_on_clause_opt", + /* 526 */ "window_offset_clause_opt", + /* 527 */ "jlimit_clause_opt", + /* 528 */ "window_offset_literal", + /* 529 */ "query_specification", + /* 530 */ "hint_list", + /* 531 */ "set_quantifier_opt", + /* 532 */ "tag_mode_opt", + /* 533 */ "select_list", + /* 534 */ "partition_by_clause_opt", + /* 535 */ "range_opt", + /* 536 */ "every_opt", + /* 537 */ "fill_opt", + /* 538 */ "twindow_clause_opt", + /* 539 */ "group_by_clause_opt", + /* 540 */ "having_clause_opt", + /* 541 */ "select_item", + /* 542 */ "partition_list", + /* 543 */ "partition_item", + /* 544 */ "interval_sliding_duration_literal", + /* 545 */ "fill_mode", + /* 546 */ "group_by_list", + /* 547 */ "query_expression", + /* 548 */ "query_simple", + /* 549 */ "order_by_clause_opt", + /* 550 */ "slimit_clause_opt", + /* 551 */ "limit_clause_opt", + /* 552 */ "union_query_expression", + /* 553 */ "query_simple_or_subquery", + /* 554 */ "sort_specification_list", + /* 555 */ "sort_specification", + /* 556 */ "ordering_specification_opt", + /* 557 */ "null_ordering_opt", }; #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ @@ -2746,579 +2727,578 @@ static const char *const yyRuleName[] = { /* 180 */ "end_opt ::= END WITH TIMESTAMP NK_STRING", /* 181 */ "cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options", /* 182 */ "cmd ::= CREATE TABLE multi_create_clause", - /* 183 */ "cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options", - /* 184 */ "cmd ::= DROP TABLE multi_drop_clause", - /* 185 */ "cmd ::= DROP STABLE exists_opt full_table_name", - /* 186 */ "cmd ::= ALTER TABLE alter_table_clause", - /* 187 */ "cmd ::= ALTER STABLE alter_table_clause", - /* 188 */ "alter_table_clause ::= full_table_name alter_table_options", - /* 189 */ "alter_table_clause ::= full_table_name ADD COLUMN column_name type_name column_options", - /* 190 */ "alter_table_clause ::= full_table_name DROP COLUMN column_name", - /* 191 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name", - /* 192 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name column_options", - /* 193 */ "alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name", - /* 194 */ "alter_table_clause ::= full_table_name ADD TAG column_name type_name", - /* 195 */ "alter_table_clause ::= full_table_name DROP TAG column_name", - /* 196 */ "alter_table_clause ::= full_table_name MODIFY TAG column_name type_name", - /* 197 */ "alter_table_clause ::= full_table_name RENAME TAG column_name column_name", - /* 198 */ "alter_table_clause ::= full_table_name SET TAG column_name NK_EQ tags_literal", - /* 199 */ "multi_create_clause ::= create_subtable_clause", - /* 200 */ "multi_create_clause ::= multi_create_clause create_subtable_clause", - /* 201 */ "multi_create_clause ::= create_from_file_clause", + /* 183 */ "cmd ::= CREATE TABLE not_exists_opt USING full_table_name NK_LP tag_list_opt NK_RP FILE NK_STRING", + /* 184 */ "cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options", + /* 185 */ "cmd ::= DROP TABLE multi_drop_clause", + /* 186 */ "cmd ::= DROP STABLE exists_opt full_table_name", + /* 187 */ "cmd ::= ALTER TABLE alter_table_clause", + /* 188 */ "cmd ::= ALTER STABLE alter_table_clause", + /* 189 */ "alter_table_clause ::= full_table_name alter_table_options", + /* 190 */ "alter_table_clause ::= full_table_name ADD COLUMN column_name type_name column_options", + /* 191 */ "alter_table_clause ::= full_table_name DROP COLUMN column_name", + /* 192 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name", + /* 193 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name column_options", + /* 194 */ "alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name", + /* 195 */ "alter_table_clause ::= full_table_name ADD TAG column_name type_name", + /* 196 */ "alter_table_clause ::= full_table_name DROP TAG column_name", + /* 197 */ "alter_table_clause ::= full_table_name MODIFY TAG column_name type_name", + /* 198 */ "alter_table_clause ::= full_table_name RENAME TAG column_name column_name", + /* 199 */ "alter_table_clause ::= full_table_name SET TAG column_name NK_EQ tags_literal", + /* 200 */ "multi_create_clause ::= create_subtable_clause", + /* 201 */ "multi_create_clause ::= multi_create_clause create_subtable_clause", /* 202 */ "create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP tags_literal_list NK_RP table_options", - /* 203 */ "create_from_file_clause ::= not_exists_opt USING full_table_name NK_LP tag_list_opt NK_RP FILE NK_STRING", - /* 204 */ "multi_drop_clause ::= drop_table_clause", - /* 205 */ "multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause", - /* 206 */ "drop_table_clause ::= exists_opt full_table_name", - /* 207 */ "specific_cols_opt ::=", - /* 208 */ "specific_cols_opt ::= NK_LP col_name_list NK_RP", - /* 209 */ "full_table_name ::= table_name", - /* 210 */ "full_table_name ::= db_name NK_DOT table_name", - /* 211 */ "tag_def_list ::= tag_def", - /* 212 */ "tag_def_list ::= tag_def_list NK_COMMA tag_def", - /* 213 */ "tag_def ::= column_name type_name", - /* 214 */ "column_def_list ::= column_def", - /* 215 */ "column_def_list ::= column_def_list NK_COMMA column_def", - /* 216 */ "column_def ::= column_name type_name column_options", - /* 217 */ "type_name ::= BOOL", - /* 218 */ "type_name ::= TINYINT", - /* 219 */ "type_name ::= SMALLINT", - /* 220 */ "type_name ::= INT", - /* 221 */ "type_name ::= INTEGER", - /* 222 */ "type_name ::= BIGINT", - /* 223 */ "type_name ::= FLOAT", - /* 224 */ "type_name ::= DOUBLE", - /* 225 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP", - /* 226 */ "type_name ::= TIMESTAMP", - /* 227 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP", - /* 228 */ "type_name ::= TINYINT UNSIGNED", - /* 229 */ "type_name ::= SMALLINT UNSIGNED", - /* 230 */ "type_name ::= INT UNSIGNED", - /* 231 */ "type_name ::= BIGINT UNSIGNED", - /* 232 */ "type_name ::= JSON", - /* 233 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP", - /* 234 */ "type_name ::= MEDIUMBLOB", - /* 235 */ "type_name ::= BLOB", - /* 236 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP", - /* 237 */ "type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP", - /* 238 */ "type_name ::= DECIMAL", - /* 239 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP", - /* 240 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", - /* 241 */ "type_name_default_len ::= BINARY", - /* 242 */ "type_name_default_len ::= NCHAR", - /* 243 */ "type_name_default_len ::= VARCHAR", - /* 244 */ "type_name_default_len ::= VARBINARY", - /* 245 */ "tags_def_opt ::=", - /* 246 */ "tags_def_opt ::= tags_def", - /* 247 */ "tags_def ::= TAGS NK_LP tag_def_list NK_RP", - /* 248 */ "table_options ::=", - /* 249 */ "table_options ::= table_options COMMENT NK_STRING", - /* 250 */ "table_options ::= table_options MAX_DELAY duration_list", - /* 251 */ "table_options ::= table_options WATERMARK duration_list", - /* 252 */ "table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP", - /* 253 */ "table_options ::= table_options TTL NK_INTEGER", - /* 254 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP", - /* 255 */ "table_options ::= table_options DELETE_MARK duration_list", - /* 256 */ "alter_table_options ::= alter_table_option", - /* 257 */ "alter_table_options ::= alter_table_options alter_table_option", - /* 258 */ "alter_table_option ::= COMMENT NK_STRING", - /* 259 */ "alter_table_option ::= TTL NK_INTEGER", - /* 260 */ "duration_list ::= duration_literal", - /* 261 */ "duration_list ::= duration_list NK_COMMA duration_literal", - /* 262 */ "rollup_func_list ::= rollup_func_name", - /* 263 */ "rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name", - /* 264 */ "rollup_func_name ::= function_name", - /* 265 */ "rollup_func_name ::= FIRST", - /* 266 */ "rollup_func_name ::= LAST", - /* 267 */ "col_name_list ::= col_name", - /* 268 */ "col_name_list ::= col_name_list NK_COMMA col_name", - /* 269 */ "col_name ::= column_name", - /* 270 */ "cmd ::= SHOW DNODES", - /* 271 */ "cmd ::= SHOW USERS", - /* 272 */ "cmd ::= SHOW USERS FULL", - /* 273 */ "cmd ::= SHOW USER PRIVILEGES", - /* 274 */ "cmd ::= SHOW db_kind_opt DATABASES", - /* 275 */ "cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt", - /* 276 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt", - /* 277 */ "cmd ::= SHOW db_name_cond_opt VGROUPS", - /* 278 */ "cmd ::= SHOW MNODES", - /* 279 */ "cmd ::= SHOW QNODES", - /* 280 */ "cmd ::= SHOW ARBGROUPS", - /* 281 */ "cmd ::= SHOW FUNCTIONS", - /* 282 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt", - /* 283 */ "cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name", - /* 284 */ "cmd ::= SHOW STREAMS", - /* 285 */ "cmd ::= SHOW ACCOUNTS", - /* 286 */ "cmd ::= SHOW APPS", - /* 287 */ "cmd ::= SHOW CONNECTIONS", - /* 288 */ "cmd ::= SHOW LICENCES", - /* 289 */ "cmd ::= SHOW GRANTS", - /* 290 */ "cmd ::= SHOW GRANTS FULL", - /* 291 */ "cmd ::= SHOW GRANTS LOGS", - /* 292 */ "cmd ::= SHOW CLUSTER MACHINES", - /* 293 */ "cmd ::= SHOW CREATE DATABASE db_name", - /* 294 */ "cmd ::= SHOW CREATE TABLE full_table_name", - /* 295 */ "cmd ::= SHOW CREATE STABLE full_table_name", - /* 296 */ "cmd ::= SHOW ENCRYPTIONS", - /* 297 */ "cmd ::= SHOW QUERIES", - /* 298 */ "cmd ::= SHOW SCORES", - /* 299 */ "cmd ::= SHOW TOPICS", - /* 300 */ "cmd ::= SHOW VARIABLES", - /* 301 */ "cmd ::= SHOW CLUSTER VARIABLES", - /* 302 */ "cmd ::= SHOW LOCAL VARIABLES", - /* 303 */ "cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt", - /* 304 */ "cmd ::= SHOW BNODES", - /* 305 */ "cmd ::= SHOW SNODES", - /* 306 */ "cmd ::= SHOW CLUSTER", - /* 307 */ "cmd ::= SHOW TRANSACTIONS", - /* 308 */ "cmd ::= SHOW TABLE DISTRIBUTED full_table_name", - /* 309 */ "cmd ::= SHOW CONSUMERS", - /* 310 */ "cmd ::= SHOW SUBSCRIPTIONS", - /* 311 */ "cmd ::= SHOW TAGS FROM table_name_cond from_db_opt", - /* 312 */ "cmd ::= SHOW TAGS FROM db_name NK_DOT table_name", - /* 313 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt", - /* 314 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name", - /* 315 */ "cmd ::= SHOW VNODES ON DNODE NK_INTEGER", - /* 316 */ "cmd ::= SHOW VNODES", - /* 317 */ "cmd ::= SHOW db_name_cond_opt ALIVE", - /* 318 */ "cmd ::= SHOW CLUSTER ALIVE", - /* 319 */ "cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt", - /* 320 */ "cmd ::= SHOW CREATE VIEW full_table_name", - /* 321 */ "cmd ::= SHOW COMPACTS", - /* 322 */ "cmd ::= SHOW COMPACT NK_INTEGER", - /* 323 */ "table_kind_db_name_cond_opt ::=", - /* 324 */ "table_kind_db_name_cond_opt ::= table_kind", - /* 325 */ "table_kind_db_name_cond_opt ::= db_name NK_DOT", - /* 326 */ "table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT", - /* 327 */ "table_kind ::= NORMAL", - /* 328 */ "table_kind ::= CHILD", - /* 329 */ "db_name_cond_opt ::=", - /* 330 */ "db_name_cond_opt ::= db_name NK_DOT", - /* 331 */ "like_pattern_opt ::=", - /* 332 */ "like_pattern_opt ::= LIKE NK_STRING", - /* 333 */ "table_name_cond ::= table_name", - /* 334 */ "from_db_opt ::=", - /* 335 */ "from_db_opt ::= FROM db_name", - /* 336 */ "tag_list_opt ::=", - /* 337 */ "tag_list_opt ::= tag_item", - /* 338 */ "tag_list_opt ::= tag_list_opt NK_COMMA tag_item", - /* 339 */ "tag_item ::= TBNAME", - /* 340 */ "tag_item ::= QTAGS", - /* 341 */ "tag_item ::= column_name", - /* 342 */ "tag_item ::= column_name column_alias", - /* 343 */ "tag_item ::= column_name AS column_alias", - /* 344 */ "db_kind_opt ::=", - /* 345 */ "db_kind_opt ::= USER", - /* 346 */ "db_kind_opt ::= SYSTEM", - /* 347 */ "cmd ::= CREATE TSMA not_exists_opt tsma_name ON full_table_name tsma_func_list INTERVAL NK_LP duration_literal NK_RP", - /* 348 */ "cmd ::= CREATE RECURSIVE TSMA not_exists_opt tsma_name ON full_table_name INTERVAL NK_LP duration_literal NK_RP", - /* 349 */ "cmd ::= DROP TSMA exists_opt full_tsma_name", - /* 350 */ "cmd ::= SHOW db_name_cond_opt TSMAS", - /* 351 */ "full_tsma_name ::= tsma_name", - /* 352 */ "full_tsma_name ::= db_name NK_DOT tsma_name", - /* 353 */ "tsma_func_list ::= FUNCTION NK_LP func_list NK_RP", - /* 354 */ "cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options", - /* 355 */ "cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP", - /* 356 */ "cmd ::= DROP INDEX exists_opt full_index_name", - /* 357 */ "full_index_name ::= index_name", - /* 358 */ "full_index_name ::= db_name NK_DOT index_name", - /* 359 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt", - /* 360 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt", - /* 361 */ "func_list ::= func", - /* 362 */ "func_list ::= func_list NK_COMMA func", - /* 363 */ "func ::= sma_func_name NK_LP expression_list NK_RP", - /* 364 */ "sma_func_name ::= function_name", - /* 365 */ "sma_func_name ::= COUNT", - /* 366 */ "sma_func_name ::= FIRST", - /* 367 */ "sma_func_name ::= LAST", - /* 368 */ "sma_func_name ::= LAST_ROW", - /* 369 */ "sma_stream_opt ::=", - /* 370 */ "sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal", - /* 371 */ "sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal", - /* 372 */ "sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal", - /* 373 */ "with_meta ::= AS", - /* 374 */ "with_meta ::= WITH META AS", - /* 375 */ "with_meta ::= ONLY META AS", - /* 376 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery", - /* 377 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name", - /* 378 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt", - /* 379 */ "cmd ::= DROP TOPIC exists_opt topic_name", - /* 380 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name", - /* 381 */ "cmd ::= DESC full_table_name", - /* 382 */ "cmd ::= DESCRIBE full_table_name", - /* 383 */ "cmd ::= RESET QUERY CACHE", - /* 384 */ "cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery", - /* 385 */ "cmd ::= EXPLAIN analyze_opt explain_options insert_query", - /* 386 */ "analyze_opt ::=", - /* 387 */ "analyze_opt ::= ANALYZE", - /* 388 */ "explain_options ::=", - /* 389 */ "explain_options ::= explain_options VERBOSE NK_BOOL", - /* 390 */ "explain_options ::= explain_options RATIO NK_FLOAT", - /* 391 */ "cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt", - /* 392 */ "cmd ::= DROP FUNCTION exists_opt function_name", - /* 393 */ "agg_func_opt ::=", - /* 394 */ "agg_func_opt ::= AGGREGATE", - /* 395 */ "bufsize_opt ::=", - /* 396 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", - /* 397 */ "language_opt ::=", - /* 398 */ "language_opt ::= LANGUAGE NK_STRING", - /* 399 */ "or_replace_opt ::=", - /* 400 */ "or_replace_opt ::= OR REPLACE", - /* 401 */ "cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery", - /* 402 */ "cmd ::= DROP VIEW exists_opt full_view_name", - /* 403 */ "full_view_name ::= view_name", - /* 404 */ "full_view_name ::= db_name NK_DOT view_name", - /* 405 */ "cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery", - /* 406 */ "cmd ::= DROP STREAM exists_opt stream_name", - /* 407 */ "cmd ::= PAUSE STREAM exists_opt stream_name", - /* 408 */ "cmd ::= RESUME STREAM exists_opt ignore_opt stream_name", - /* 409 */ "col_list_opt ::=", - /* 410 */ "col_list_opt ::= NK_LP column_stream_def_list NK_RP", - /* 411 */ "column_stream_def_list ::= column_stream_def", - /* 412 */ "column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def", - /* 413 */ "column_stream_def ::= column_name stream_col_options", - /* 414 */ "stream_col_options ::=", - /* 415 */ "stream_col_options ::= stream_col_options PRIMARY KEY", - /* 416 */ "tag_def_or_ref_opt ::=", - /* 417 */ "tag_def_or_ref_opt ::= tags_def", - /* 418 */ "tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP", - /* 419 */ "stream_options ::=", - /* 420 */ "stream_options ::= stream_options TRIGGER AT_ONCE", - /* 421 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", - /* 422 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", - /* 423 */ "stream_options ::= stream_options WATERMARK duration_literal", - /* 424 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER", - /* 425 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER", - /* 426 */ "stream_options ::= stream_options DELETE_MARK duration_literal", - /* 427 */ "stream_options ::= stream_options IGNORE UPDATE NK_INTEGER", - /* 428 */ "subtable_opt ::=", - /* 429 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP", - /* 430 */ "ignore_opt ::=", - /* 431 */ "ignore_opt ::= IGNORE UNTREATED", - /* 432 */ "cmd ::= KILL CONNECTION NK_INTEGER", - /* 433 */ "cmd ::= KILL QUERY NK_STRING", - /* 434 */ "cmd ::= KILL TRANSACTION NK_INTEGER", - /* 435 */ "cmd ::= KILL COMPACT NK_INTEGER", - /* 436 */ "cmd ::= BALANCE VGROUP", - /* 437 */ "cmd ::= BALANCE VGROUP LEADER on_vgroup_id", - /* 438 */ "cmd ::= BALANCE VGROUP LEADER DATABASE db_name", - /* 439 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", - /* 440 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", - /* 441 */ "cmd ::= SPLIT VGROUP NK_INTEGER", - /* 442 */ "on_vgroup_id ::=", - /* 443 */ "on_vgroup_id ::= ON NK_INTEGER", - /* 444 */ "dnode_list ::= DNODE NK_INTEGER", - /* 445 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", - /* 446 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", - /* 447 */ "cmd ::= query_or_subquery", - /* 448 */ "cmd ::= insert_query", - /* 449 */ "insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery", - /* 450 */ "insert_query ::= INSERT INTO full_table_name query_or_subquery", - /* 451 */ "tags_literal ::= NK_INTEGER", - /* 452 */ "tags_literal ::= NK_INTEGER NK_PLUS duration_literal", - /* 453 */ "tags_literal ::= NK_INTEGER NK_MINUS duration_literal", - /* 454 */ "tags_literal ::= NK_PLUS NK_INTEGER", - /* 455 */ "tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal", - /* 456 */ "tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal", - /* 457 */ "tags_literal ::= NK_MINUS NK_INTEGER", - /* 458 */ "tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal", - /* 459 */ "tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal", - /* 460 */ "tags_literal ::= NK_FLOAT", - /* 461 */ "tags_literal ::= NK_PLUS NK_FLOAT", - /* 462 */ "tags_literal ::= NK_MINUS NK_FLOAT", - /* 463 */ "tags_literal ::= NK_BIN", - /* 464 */ "tags_literal ::= NK_BIN NK_PLUS duration_literal", - /* 465 */ "tags_literal ::= NK_BIN NK_MINUS duration_literal", - /* 466 */ "tags_literal ::= NK_PLUS NK_BIN", - /* 467 */ "tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal", - /* 468 */ "tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal", - /* 469 */ "tags_literal ::= NK_MINUS NK_BIN", - /* 470 */ "tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal", - /* 471 */ "tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal", - /* 472 */ "tags_literal ::= NK_HEX", - /* 473 */ "tags_literal ::= NK_HEX NK_PLUS duration_literal", - /* 474 */ "tags_literal ::= NK_HEX NK_MINUS duration_literal", - /* 475 */ "tags_literal ::= NK_PLUS NK_HEX", - /* 476 */ "tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal", - /* 477 */ "tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal", - /* 478 */ "tags_literal ::= NK_MINUS NK_HEX", - /* 479 */ "tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal", - /* 480 */ "tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal", - /* 481 */ "tags_literal ::= NK_STRING", - /* 482 */ "tags_literal ::= NK_STRING NK_PLUS duration_literal", - /* 483 */ "tags_literal ::= NK_STRING NK_MINUS duration_literal", - /* 484 */ "tags_literal ::= NK_BOOL", - /* 485 */ "tags_literal ::= NULL", - /* 486 */ "tags_literal ::= literal_func", - /* 487 */ "tags_literal ::= literal_func NK_PLUS duration_literal", - /* 488 */ "tags_literal ::= literal_func NK_MINUS duration_literal", - /* 489 */ "tags_literal_list ::= tags_literal", - /* 490 */ "tags_literal_list ::= tags_literal_list NK_COMMA tags_literal", - /* 491 */ "literal ::= NK_INTEGER", - /* 492 */ "literal ::= NK_FLOAT", - /* 493 */ "literal ::= NK_STRING", - /* 494 */ "literal ::= NK_BOOL", - /* 495 */ "literal ::= TIMESTAMP NK_STRING", - /* 496 */ "literal ::= duration_literal", - /* 497 */ "literal ::= NULL", - /* 498 */ "literal ::= NK_QUESTION", - /* 499 */ "duration_literal ::= NK_VARIABLE", - /* 500 */ "signed ::= NK_INTEGER", - /* 501 */ "signed ::= NK_PLUS NK_INTEGER", - /* 502 */ "signed ::= NK_MINUS NK_INTEGER", - /* 503 */ "signed ::= NK_FLOAT", - /* 504 */ "signed ::= NK_PLUS NK_FLOAT", - /* 505 */ "signed ::= NK_MINUS NK_FLOAT", - /* 506 */ "signed_literal ::= signed", - /* 507 */ "signed_literal ::= NK_STRING", - /* 508 */ "signed_literal ::= NK_BOOL", - /* 509 */ "signed_literal ::= TIMESTAMP NK_STRING", - /* 510 */ "signed_literal ::= duration_literal", - /* 511 */ "signed_literal ::= NULL", - /* 512 */ "signed_literal ::= literal_func", - /* 513 */ "signed_literal ::= NK_QUESTION", - /* 514 */ "literal_list ::= signed_literal", - /* 515 */ "literal_list ::= literal_list NK_COMMA signed_literal", - /* 516 */ "db_name ::= NK_ID", - /* 517 */ "table_name ::= NK_ID", - /* 518 */ "column_name ::= NK_ID", - /* 519 */ "function_name ::= NK_ID", - /* 520 */ "view_name ::= NK_ID", - /* 521 */ "table_alias ::= NK_ID", - /* 522 */ "column_alias ::= NK_ID", - /* 523 */ "column_alias ::= NK_ALIAS", - /* 524 */ "user_name ::= NK_ID", - /* 525 */ "topic_name ::= NK_ID", - /* 526 */ "stream_name ::= NK_ID", - /* 527 */ "cgroup_name ::= NK_ID", - /* 528 */ "index_name ::= NK_ID", - /* 529 */ "tsma_name ::= NK_ID", - /* 530 */ "expr_or_subquery ::= expression", - /* 531 */ "expression ::= literal", - /* 532 */ "expression ::= pseudo_column", - /* 533 */ "expression ::= column_reference", - /* 534 */ "expression ::= function_expression", - /* 535 */ "expression ::= case_when_expression", - /* 536 */ "expression ::= NK_LP expression NK_RP", - /* 537 */ "expression ::= NK_PLUS expr_or_subquery", - /* 538 */ "expression ::= NK_MINUS expr_or_subquery", - /* 539 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery", - /* 540 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery", - /* 541 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery", - /* 542 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery", - /* 543 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery", - /* 544 */ "expression ::= column_reference NK_ARROW NK_STRING", - /* 545 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery", - /* 546 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery", - /* 547 */ "expression_list ::= expr_or_subquery", - /* 548 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery", - /* 549 */ "column_reference ::= column_name", - /* 550 */ "column_reference ::= table_name NK_DOT column_name", - /* 551 */ "column_reference ::= NK_ALIAS", - /* 552 */ "column_reference ::= table_name NK_DOT NK_ALIAS", - /* 553 */ "pseudo_column ::= ROWTS", - /* 554 */ "pseudo_column ::= TBNAME", - /* 555 */ "pseudo_column ::= table_name NK_DOT TBNAME", - /* 556 */ "pseudo_column ::= QSTART", - /* 557 */ "pseudo_column ::= QEND", - /* 558 */ "pseudo_column ::= QDURATION", - /* 559 */ "pseudo_column ::= WSTART", - /* 560 */ "pseudo_column ::= WEND", - /* 561 */ "pseudo_column ::= WDURATION", - /* 562 */ "pseudo_column ::= IROWTS", - /* 563 */ "pseudo_column ::= ISFILLED", - /* 564 */ "pseudo_column ::= QTAGS", - /* 565 */ "function_expression ::= function_name NK_LP expression_list NK_RP", - /* 566 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", - /* 567 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP", - /* 568 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP", - /* 569 */ "function_expression ::= literal_func", - /* 570 */ "literal_func ::= noarg_func NK_LP NK_RP", - /* 571 */ "literal_func ::= NOW", - /* 572 */ "literal_func ::= TODAY", - /* 573 */ "noarg_func ::= NOW", - /* 574 */ "noarg_func ::= TODAY", - /* 575 */ "noarg_func ::= TIMEZONE", - /* 576 */ "noarg_func ::= DATABASE", - /* 577 */ "noarg_func ::= CLIENT_VERSION", - /* 578 */ "noarg_func ::= SERVER_VERSION", - /* 579 */ "noarg_func ::= SERVER_STATUS", - /* 580 */ "noarg_func ::= CURRENT_USER", - /* 581 */ "noarg_func ::= USER", - /* 582 */ "star_func ::= COUNT", - /* 583 */ "star_func ::= FIRST", - /* 584 */ "star_func ::= LAST", - /* 585 */ "star_func ::= LAST_ROW", - /* 586 */ "star_func_para_list ::= NK_STAR", - /* 587 */ "star_func_para_list ::= other_para_list", - /* 588 */ "other_para_list ::= star_func_para", - /* 589 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", - /* 590 */ "star_func_para ::= expr_or_subquery", - /* 591 */ "star_func_para ::= table_name NK_DOT NK_STAR", - /* 592 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END", - /* 593 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END", - /* 594 */ "when_then_list ::= when_then_expr", - /* 595 */ "when_then_list ::= when_then_list when_then_expr", - /* 596 */ "when_then_expr ::= WHEN common_expression THEN common_expression", - /* 597 */ "case_when_else_opt ::=", - /* 598 */ "case_when_else_opt ::= ELSE common_expression", - /* 599 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery", - /* 600 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery", - /* 601 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery", - /* 602 */ "predicate ::= expr_or_subquery IS NULL", - /* 603 */ "predicate ::= expr_or_subquery IS NOT NULL", - /* 604 */ "predicate ::= expr_or_subquery in_op in_predicate_value", - /* 605 */ "compare_op ::= NK_LT", - /* 606 */ "compare_op ::= NK_GT", - /* 607 */ "compare_op ::= NK_LE", - /* 608 */ "compare_op ::= NK_GE", - /* 609 */ "compare_op ::= NK_NE", - /* 610 */ "compare_op ::= NK_EQ", - /* 611 */ "compare_op ::= LIKE", - /* 612 */ "compare_op ::= NOT LIKE", - /* 613 */ "compare_op ::= MATCH", - /* 614 */ "compare_op ::= NMATCH", - /* 615 */ "compare_op ::= CONTAINS", - /* 616 */ "in_op ::= IN", - /* 617 */ "in_op ::= NOT IN", - /* 618 */ "in_predicate_value ::= NK_LP literal_list NK_RP", - /* 619 */ "boolean_value_expression ::= boolean_primary", - /* 620 */ "boolean_value_expression ::= NOT boolean_primary", - /* 621 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", - /* 622 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", - /* 623 */ "boolean_primary ::= predicate", - /* 624 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", - /* 625 */ "common_expression ::= expr_or_subquery", - /* 626 */ "common_expression ::= boolean_value_expression", - /* 627 */ "from_clause_opt ::=", - /* 628 */ "from_clause_opt ::= FROM table_reference_list", - /* 629 */ "table_reference_list ::= table_reference", - /* 630 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", - /* 631 */ "table_reference ::= table_primary", - /* 632 */ "table_reference ::= joined_table", - /* 633 */ "table_primary ::= table_name alias_opt", - /* 634 */ "table_primary ::= db_name NK_DOT table_name alias_opt", - /* 635 */ "table_primary ::= subquery alias_opt", - /* 636 */ "table_primary ::= parenthesized_joined_table", - /* 637 */ "alias_opt ::=", - /* 638 */ "alias_opt ::= table_alias", - /* 639 */ "alias_opt ::= AS table_alias", - /* 640 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", - /* 641 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", - /* 642 */ "joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt", - /* 643 */ "join_type ::=", - /* 644 */ "join_type ::= INNER", - /* 645 */ "join_type ::= LEFT", - /* 646 */ "join_type ::= RIGHT", - /* 647 */ "join_type ::= FULL", - /* 648 */ "join_subtype ::=", - /* 649 */ "join_subtype ::= OUTER", - /* 650 */ "join_subtype ::= SEMI", - /* 651 */ "join_subtype ::= ANTI", - /* 652 */ "join_subtype ::= ASOF", - /* 653 */ "join_subtype ::= WINDOW", - /* 654 */ "join_on_clause_opt ::=", - /* 655 */ "join_on_clause_opt ::= ON search_condition", - /* 656 */ "window_offset_clause_opt ::=", - /* 657 */ "window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP", - /* 658 */ "window_offset_literal ::= NK_VARIABLE", - /* 659 */ "window_offset_literal ::= NK_MINUS NK_VARIABLE", - /* 660 */ "jlimit_clause_opt ::=", - /* 661 */ "jlimit_clause_opt ::= JLIMIT NK_INTEGER", - /* 662 */ "query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt", - /* 663 */ "hint_list ::=", - /* 664 */ "hint_list ::= NK_HINT", - /* 665 */ "tag_mode_opt ::=", - /* 666 */ "tag_mode_opt ::= TAGS", - /* 667 */ "set_quantifier_opt ::=", - /* 668 */ "set_quantifier_opt ::= DISTINCT", - /* 669 */ "set_quantifier_opt ::= ALL", - /* 670 */ "select_list ::= select_item", - /* 671 */ "select_list ::= select_list NK_COMMA select_item", - /* 672 */ "select_item ::= NK_STAR", - /* 673 */ "select_item ::= common_expression", - /* 674 */ "select_item ::= common_expression column_alias", - /* 675 */ "select_item ::= common_expression AS column_alias", - /* 676 */ "select_item ::= table_name NK_DOT NK_STAR", - /* 677 */ "where_clause_opt ::=", - /* 678 */ "where_clause_opt ::= WHERE search_condition", - /* 679 */ "partition_by_clause_opt ::=", - /* 680 */ "partition_by_clause_opt ::= PARTITION BY partition_list", - /* 681 */ "partition_list ::= partition_item", - /* 682 */ "partition_list ::= partition_list NK_COMMA partition_item", - /* 683 */ "partition_item ::= expr_or_subquery", - /* 684 */ "partition_item ::= expr_or_subquery column_alias", - /* 685 */ "partition_item ::= expr_or_subquery AS column_alias", - /* 686 */ "twindow_clause_opt ::=", - /* 687 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP", - /* 688 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP", - /* 689 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt", - /* 690 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt", - /* 691 */ "twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition", - /* 692 */ "twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP", - /* 693 */ "twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", - /* 694 */ "sliding_opt ::=", - /* 695 */ "sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP", - /* 696 */ "interval_sliding_duration_literal ::= NK_VARIABLE", - /* 697 */ "interval_sliding_duration_literal ::= NK_STRING", - /* 698 */ "interval_sliding_duration_literal ::= NK_INTEGER", - /* 699 */ "fill_opt ::=", - /* 700 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", - /* 701 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP", - /* 702 */ "fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP", - /* 703 */ "fill_mode ::= NONE", - /* 704 */ "fill_mode ::= PREV", - /* 705 */ "fill_mode ::= NULL", - /* 706 */ "fill_mode ::= NULL_F", - /* 707 */ "fill_mode ::= LINEAR", - /* 708 */ "fill_mode ::= NEXT", - /* 709 */ "group_by_clause_opt ::=", - /* 710 */ "group_by_clause_opt ::= GROUP BY group_by_list", - /* 711 */ "group_by_list ::= expr_or_subquery", - /* 712 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery", - /* 713 */ "having_clause_opt ::=", - /* 714 */ "having_clause_opt ::= HAVING search_condition", - /* 715 */ "range_opt ::=", - /* 716 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP", - /* 717 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_RP", - /* 718 */ "every_opt ::=", - /* 719 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", - /* 720 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt", - /* 721 */ "query_simple ::= query_specification", - /* 722 */ "query_simple ::= union_query_expression", - /* 723 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery", - /* 724 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery", - /* 725 */ "query_simple_or_subquery ::= query_simple", - /* 726 */ "query_simple_or_subquery ::= subquery", - /* 727 */ "query_or_subquery ::= query_expression", - /* 728 */ "query_or_subquery ::= subquery", - /* 729 */ "order_by_clause_opt ::=", - /* 730 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", - /* 731 */ "slimit_clause_opt ::=", - /* 732 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", - /* 733 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", - /* 734 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 735 */ "limit_clause_opt ::=", - /* 736 */ "limit_clause_opt ::= LIMIT NK_INTEGER", - /* 737 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", - /* 738 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 739 */ "subquery ::= NK_LP query_expression NK_RP", - /* 740 */ "subquery ::= NK_LP subquery NK_RP", - /* 741 */ "search_condition ::= common_expression", - /* 742 */ "sort_specification_list ::= sort_specification", - /* 743 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", - /* 744 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt", - /* 745 */ "ordering_specification_opt ::=", - /* 746 */ "ordering_specification_opt ::= ASC", - /* 747 */ "ordering_specification_opt ::= DESC", - /* 748 */ "null_ordering_opt ::=", - /* 749 */ "null_ordering_opt ::= NULLS FIRST", - /* 750 */ "null_ordering_opt ::= NULLS LAST", - /* 751 */ "column_options ::=", - /* 752 */ "column_options ::= column_options PRIMARY KEY", - /* 753 */ "column_options ::= column_options ENCODE NK_STRING", - /* 754 */ "column_options ::= column_options COMPRESS NK_STRING", - /* 755 */ "column_options ::= column_options LEVEL NK_STRING", + /* 203 */ "multi_drop_clause ::= drop_table_clause", + /* 204 */ "multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause", + /* 205 */ "drop_table_clause ::= exists_opt full_table_name", + /* 206 */ "specific_cols_opt ::=", + /* 207 */ "specific_cols_opt ::= NK_LP col_name_list NK_RP", + /* 208 */ "full_table_name ::= table_name", + /* 209 */ "full_table_name ::= db_name NK_DOT table_name", + /* 210 */ "tag_def_list ::= tag_def", + /* 211 */ "tag_def_list ::= tag_def_list NK_COMMA tag_def", + /* 212 */ "tag_def ::= column_name type_name", + /* 213 */ "column_def_list ::= column_def", + /* 214 */ "column_def_list ::= column_def_list NK_COMMA column_def", + /* 215 */ "column_def ::= column_name type_name column_options", + /* 216 */ "type_name ::= BOOL", + /* 217 */ "type_name ::= TINYINT", + /* 218 */ "type_name ::= SMALLINT", + /* 219 */ "type_name ::= INT", + /* 220 */ "type_name ::= INTEGER", + /* 221 */ "type_name ::= BIGINT", + /* 222 */ "type_name ::= FLOAT", + /* 223 */ "type_name ::= DOUBLE", + /* 224 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP", + /* 225 */ "type_name ::= TIMESTAMP", + /* 226 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP", + /* 227 */ "type_name ::= TINYINT UNSIGNED", + /* 228 */ "type_name ::= SMALLINT UNSIGNED", + /* 229 */ "type_name ::= INT UNSIGNED", + /* 230 */ "type_name ::= BIGINT UNSIGNED", + /* 231 */ "type_name ::= JSON", + /* 232 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP", + /* 233 */ "type_name ::= MEDIUMBLOB", + /* 234 */ "type_name ::= BLOB", + /* 235 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP", + /* 236 */ "type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP", + /* 237 */ "type_name ::= DECIMAL", + /* 238 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP", + /* 239 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", + /* 240 */ "type_name_default_len ::= BINARY", + /* 241 */ "type_name_default_len ::= NCHAR", + /* 242 */ "type_name_default_len ::= VARCHAR", + /* 243 */ "type_name_default_len ::= VARBINARY", + /* 244 */ "tags_def_opt ::=", + /* 245 */ "tags_def_opt ::= tags_def", + /* 246 */ "tags_def ::= TAGS NK_LP tag_def_list NK_RP", + /* 247 */ "table_options ::=", + /* 248 */ "table_options ::= table_options COMMENT NK_STRING", + /* 249 */ "table_options ::= table_options MAX_DELAY duration_list", + /* 250 */ "table_options ::= table_options WATERMARK duration_list", + /* 251 */ "table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP", + /* 252 */ "table_options ::= table_options TTL NK_INTEGER", + /* 253 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP", + /* 254 */ "table_options ::= table_options DELETE_MARK duration_list", + /* 255 */ "alter_table_options ::= alter_table_option", + /* 256 */ "alter_table_options ::= alter_table_options alter_table_option", + /* 257 */ "alter_table_option ::= COMMENT NK_STRING", + /* 258 */ "alter_table_option ::= TTL NK_INTEGER", + /* 259 */ "duration_list ::= duration_literal", + /* 260 */ "duration_list ::= duration_list NK_COMMA duration_literal", + /* 261 */ "rollup_func_list ::= rollup_func_name", + /* 262 */ "rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name", + /* 263 */ "rollup_func_name ::= function_name", + /* 264 */ "rollup_func_name ::= FIRST", + /* 265 */ "rollup_func_name ::= LAST", + /* 266 */ "col_name_list ::= col_name", + /* 267 */ "col_name_list ::= col_name_list NK_COMMA col_name", + /* 268 */ "col_name ::= column_name", + /* 269 */ "cmd ::= SHOW DNODES", + /* 270 */ "cmd ::= SHOW USERS", + /* 271 */ "cmd ::= SHOW USERS FULL", + /* 272 */ "cmd ::= SHOW USER PRIVILEGES", + /* 273 */ "cmd ::= SHOW db_kind_opt DATABASES", + /* 274 */ "cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt", + /* 275 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt", + /* 276 */ "cmd ::= SHOW db_name_cond_opt VGROUPS", + /* 277 */ "cmd ::= SHOW MNODES", + /* 278 */ "cmd ::= SHOW QNODES", + /* 279 */ "cmd ::= SHOW ARBGROUPS", + /* 280 */ "cmd ::= SHOW FUNCTIONS", + /* 281 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt", + /* 282 */ "cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name", + /* 283 */ "cmd ::= SHOW STREAMS", + /* 284 */ "cmd ::= SHOW ACCOUNTS", + /* 285 */ "cmd ::= SHOW APPS", + /* 286 */ "cmd ::= SHOW CONNECTIONS", + /* 287 */ "cmd ::= SHOW LICENCES", + /* 288 */ "cmd ::= SHOW GRANTS", + /* 289 */ "cmd ::= SHOW GRANTS FULL", + /* 290 */ "cmd ::= SHOW GRANTS LOGS", + /* 291 */ "cmd ::= SHOW CLUSTER MACHINES", + /* 292 */ "cmd ::= SHOW CREATE DATABASE db_name", + /* 293 */ "cmd ::= SHOW CREATE TABLE full_table_name", + /* 294 */ "cmd ::= SHOW CREATE STABLE full_table_name", + /* 295 */ "cmd ::= SHOW ENCRYPTIONS", + /* 296 */ "cmd ::= SHOW QUERIES", + /* 297 */ "cmd ::= SHOW SCORES", + /* 298 */ "cmd ::= SHOW TOPICS", + /* 299 */ "cmd ::= SHOW VARIABLES", + /* 300 */ "cmd ::= SHOW CLUSTER VARIABLES", + /* 301 */ "cmd ::= SHOW LOCAL VARIABLES", + /* 302 */ "cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt", + /* 303 */ "cmd ::= SHOW BNODES", + /* 304 */ "cmd ::= SHOW SNODES", + /* 305 */ "cmd ::= SHOW CLUSTER", + /* 306 */ "cmd ::= SHOW TRANSACTIONS", + /* 307 */ "cmd ::= SHOW TABLE DISTRIBUTED full_table_name", + /* 308 */ "cmd ::= SHOW CONSUMERS", + /* 309 */ "cmd ::= SHOW SUBSCRIPTIONS", + /* 310 */ "cmd ::= SHOW TAGS FROM table_name_cond from_db_opt", + /* 311 */ "cmd ::= SHOW TAGS FROM db_name NK_DOT table_name", + /* 312 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt", + /* 313 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name", + /* 314 */ "cmd ::= SHOW VNODES ON DNODE NK_INTEGER", + /* 315 */ "cmd ::= SHOW VNODES", + /* 316 */ "cmd ::= SHOW db_name_cond_opt ALIVE", + /* 317 */ "cmd ::= SHOW CLUSTER ALIVE", + /* 318 */ "cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt", + /* 319 */ "cmd ::= SHOW CREATE VIEW full_table_name", + /* 320 */ "cmd ::= SHOW COMPACTS", + /* 321 */ "cmd ::= SHOW COMPACT NK_INTEGER", + /* 322 */ "table_kind_db_name_cond_opt ::=", + /* 323 */ "table_kind_db_name_cond_opt ::= table_kind", + /* 324 */ "table_kind_db_name_cond_opt ::= db_name NK_DOT", + /* 325 */ "table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT", + /* 326 */ "table_kind ::= NORMAL", + /* 327 */ "table_kind ::= CHILD", + /* 328 */ "db_name_cond_opt ::=", + /* 329 */ "db_name_cond_opt ::= db_name NK_DOT", + /* 330 */ "like_pattern_opt ::=", + /* 331 */ "like_pattern_opt ::= LIKE NK_STRING", + /* 332 */ "table_name_cond ::= table_name", + /* 333 */ "from_db_opt ::=", + /* 334 */ "from_db_opt ::= FROM db_name", + /* 335 */ "tag_list_opt ::=", + /* 336 */ "tag_list_opt ::= tag_item", + /* 337 */ "tag_list_opt ::= tag_list_opt NK_COMMA tag_item", + /* 338 */ "tag_item ::= TBNAME", + /* 339 */ "tag_item ::= QTAGS", + /* 340 */ "tag_item ::= column_name", + /* 341 */ "tag_item ::= column_name column_alias", + /* 342 */ "tag_item ::= column_name AS column_alias", + /* 343 */ "db_kind_opt ::=", + /* 344 */ "db_kind_opt ::= USER", + /* 345 */ "db_kind_opt ::= SYSTEM", + /* 346 */ "cmd ::= CREATE TSMA not_exists_opt tsma_name ON full_table_name tsma_func_list INTERVAL NK_LP duration_literal NK_RP", + /* 347 */ "cmd ::= CREATE RECURSIVE TSMA not_exists_opt tsma_name ON full_table_name INTERVAL NK_LP duration_literal NK_RP", + /* 348 */ "cmd ::= DROP TSMA exists_opt full_tsma_name", + /* 349 */ "cmd ::= SHOW db_name_cond_opt TSMAS", + /* 350 */ "full_tsma_name ::= tsma_name", + /* 351 */ "full_tsma_name ::= db_name NK_DOT tsma_name", + /* 352 */ "tsma_func_list ::= FUNCTION NK_LP func_list NK_RP", + /* 353 */ "cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options", + /* 354 */ "cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP", + /* 355 */ "cmd ::= DROP INDEX exists_opt full_index_name", + /* 356 */ "full_index_name ::= index_name", + /* 357 */ "full_index_name ::= db_name NK_DOT index_name", + /* 358 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt", + /* 359 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt", + /* 360 */ "func_list ::= func", + /* 361 */ "func_list ::= func_list NK_COMMA func", + /* 362 */ "func ::= sma_func_name NK_LP expression_list NK_RP", + /* 363 */ "sma_func_name ::= function_name", + /* 364 */ "sma_func_name ::= COUNT", + /* 365 */ "sma_func_name ::= FIRST", + /* 366 */ "sma_func_name ::= LAST", + /* 367 */ "sma_func_name ::= LAST_ROW", + /* 368 */ "sma_stream_opt ::=", + /* 369 */ "sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal", + /* 370 */ "sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal", + /* 371 */ "sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal", + /* 372 */ "with_meta ::= AS", + /* 373 */ "with_meta ::= WITH META AS", + /* 374 */ "with_meta ::= ONLY META AS", + /* 375 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery", + /* 376 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name", + /* 377 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt", + /* 378 */ "cmd ::= DROP TOPIC exists_opt topic_name", + /* 379 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name", + /* 380 */ "cmd ::= DESC full_table_name", + /* 381 */ "cmd ::= DESCRIBE full_table_name", + /* 382 */ "cmd ::= RESET QUERY CACHE", + /* 383 */ "cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery", + /* 384 */ "cmd ::= EXPLAIN analyze_opt explain_options insert_query", + /* 385 */ "analyze_opt ::=", + /* 386 */ "analyze_opt ::= ANALYZE", + /* 387 */ "explain_options ::=", + /* 388 */ "explain_options ::= explain_options VERBOSE NK_BOOL", + /* 389 */ "explain_options ::= explain_options RATIO NK_FLOAT", + /* 390 */ "cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt", + /* 391 */ "cmd ::= DROP FUNCTION exists_opt function_name", + /* 392 */ "agg_func_opt ::=", + /* 393 */ "agg_func_opt ::= AGGREGATE", + /* 394 */ "bufsize_opt ::=", + /* 395 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", + /* 396 */ "language_opt ::=", + /* 397 */ "language_opt ::= LANGUAGE NK_STRING", + /* 398 */ "or_replace_opt ::=", + /* 399 */ "or_replace_opt ::= OR REPLACE", + /* 400 */ "cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery", + /* 401 */ "cmd ::= DROP VIEW exists_opt full_view_name", + /* 402 */ "full_view_name ::= view_name", + /* 403 */ "full_view_name ::= db_name NK_DOT view_name", + /* 404 */ "cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery", + /* 405 */ "cmd ::= DROP STREAM exists_opt stream_name", + /* 406 */ "cmd ::= PAUSE STREAM exists_opt stream_name", + /* 407 */ "cmd ::= RESUME STREAM exists_opt ignore_opt stream_name", + /* 408 */ "col_list_opt ::=", + /* 409 */ "col_list_opt ::= NK_LP column_stream_def_list NK_RP", + /* 410 */ "column_stream_def_list ::= column_stream_def", + /* 411 */ "column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def", + /* 412 */ "column_stream_def ::= column_name stream_col_options", + /* 413 */ "stream_col_options ::=", + /* 414 */ "stream_col_options ::= stream_col_options PRIMARY KEY", + /* 415 */ "tag_def_or_ref_opt ::=", + /* 416 */ "tag_def_or_ref_opt ::= tags_def", + /* 417 */ "tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP", + /* 418 */ "stream_options ::=", + /* 419 */ "stream_options ::= stream_options TRIGGER AT_ONCE", + /* 420 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", + /* 421 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", + /* 422 */ "stream_options ::= stream_options WATERMARK duration_literal", + /* 423 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER", + /* 424 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER", + /* 425 */ "stream_options ::= stream_options DELETE_MARK duration_literal", + /* 426 */ "stream_options ::= stream_options IGNORE UPDATE NK_INTEGER", + /* 427 */ "subtable_opt ::=", + /* 428 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP", + /* 429 */ "ignore_opt ::=", + /* 430 */ "ignore_opt ::= IGNORE UNTREATED", + /* 431 */ "cmd ::= KILL CONNECTION NK_INTEGER", + /* 432 */ "cmd ::= KILL QUERY NK_STRING", + /* 433 */ "cmd ::= KILL TRANSACTION NK_INTEGER", + /* 434 */ "cmd ::= KILL COMPACT NK_INTEGER", + /* 435 */ "cmd ::= BALANCE VGROUP", + /* 436 */ "cmd ::= BALANCE VGROUP LEADER on_vgroup_id", + /* 437 */ "cmd ::= BALANCE VGROUP LEADER DATABASE db_name", + /* 438 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", + /* 439 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", + /* 440 */ "cmd ::= SPLIT VGROUP NK_INTEGER", + /* 441 */ "on_vgroup_id ::=", + /* 442 */ "on_vgroup_id ::= ON NK_INTEGER", + /* 443 */ "dnode_list ::= DNODE NK_INTEGER", + /* 444 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", + /* 445 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", + /* 446 */ "cmd ::= query_or_subquery", + /* 447 */ "cmd ::= insert_query", + /* 448 */ "insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery", + /* 449 */ "insert_query ::= INSERT INTO full_table_name query_or_subquery", + /* 450 */ "tags_literal ::= NK_INTEGER", + /* 451 */ "tags_literal ::= NK_INTEGER NK_PLUS duration_literal", + /* 452 */ "tags_literal ::= NK_INTEGER NK_MINUS duration_literal", + /* 453 */ "tags_literal ::= NK_PLUS NK_INTEGER", + /* 454 */ "tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal", + /* 455 */ "tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal", + /* 456 */ "tags_literal ::= NK_MINUS NK_INTEGER", + /* 457 */ "tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal", + /* 458 */ "tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal", + /* 459 */ "tags_literal ::= NK_FLOAT", + /* 460 */ "tags_literal ::= NK_PLUS NK_FLOAT", + /* 461 */ "tags_literal ::= NK_MINUS NK_FLOAT", + /* 462 */ "tags_literal ::= NK_BIN", + /* 463 */ "tags_literal ::= NK_BIN NK_PLUS duration_literal", + /* 464 */ "tags_literal ::= NK_BIN NK_MINUS duration_literal", + /* 465 */ "tags_literal ::= NK_PLUS NK_BIN", + /* 466 */ "tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal", + /* 467 */ "tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal", + /* 468 */ "tags_literal ::= NK_MINUS NK_BIN", + /* 469 */ "tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal", + /* 470 */ "tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal", + /* 471 */ "tags_literal ::= NK_HEX", + /* 472 */ "tags_literal ::= NK_HEX NK_PLUS duration_literal", + /* 473 */ "tags_literal ::= NK_HEX NK_MINUS duration_literal", + /* 474 */ "tags_literal ::= NK_PLUS NK_HEX", + /* 475 */ "tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal", + /* 476 */ "tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal", + /* 477 */ "tags_literal ::= NK_MINUS NK_HEX", + /* 478 */ "tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal", + /* 479 */ "tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal", + /* 480 */ "tags_literal ::= NK_STRING", + /* 481 */ "tags_literal ::= NK_STRING NK_PLUS duration_literal", + /* 482 */ "tags_literal ::= NK_STRING NK_MINUS duration_literal", + /* 483 */ "tags_literal ::= NK_BOOL", + /* 484 */ "tags_literal ::= NULL", + /* 485 */ "tags_literal ::= literal_func", + /* 486 */ "tags_literal ::= literal_func NK_PLUS duration_literal", + /* 487 */ "tags_literal ::= literal_func NK_MINUS duration_literal", + /* 488 */ "tags_literal_list ::= tags_literal", + /* 489 */ "tags_literal_list ::= tags_literal_list NK_COMMA tags_literal", + /* 490 */ "literal ::= NK_INTEGER", + /* 491 */ "literal ::= NK_FLOAT", + /* 492 */ "literal ::= NK_STRING", + /* 493 */ "literal ::= NK_BOOL", + /* 494 */ "literal ::= TIMESTAMP NK_STRING", + /* 495 */ "literal ::= duration_literal", + /* 496 */ "literal ::= NULL", + /* 497 */ "literal ::= NK_QUESTION", + /* 498 */ "duration_literal ::= NK_VARIABLE", + /* 499 */ "signed ::= NK_INTEGER", + /* 500 */ "signed ::= NK_PLUS NK_INTEGER", + /* 501 */ "signed ::= NK_MINUS NK_INTEGER", + /* 502 */ "signed ::= NK_FLOAT", + /* 503 */ "signed ::= NK_PLUS NK_FLOAT", + /* 504 */ "signed ::= NK_MINUS NK_FLOAT", + /* 505 */ "signed_literal ::= signed", + /* 506 */ "signed_literal ::= NK_STRING", + /* 507 */ "signed_literal ::= NK_BOOL", + /* 508 */ "signed_literal ::= TIMESTAMP NK_STRING", + /* 509 */ "signed_literal ::= duration_literal", + /* 510 */ "signed_literal ::= NULL", + /* 511 */ "signed_literal ::= literal_func", + /* 512 */ "signed_literal ::= NK_QUESTION", + /* 513 */ "literal_list ::= signed_literal", + /* 514 */ "literal_list ::= literal_list NK_COMMA signed_literal", + /* 515 */ "db_name ::= NK_ID", + /* 516 */ "table_name ::= NK_ID", + /* 517 */ "column_name ::= NK_ID", + /* 518 */ "function_name ::= NK_ID", + /* 519 */ "view_name ::= NK_ID", + /* 520 */ "table_alias ::= NK_ID", + /* 521 */ "column_alias ::= NK_ID", + /* 522 */ "column_alias ::= NK_ALIAS", + /* 523 */ "user_name ::= NK_ID", + /* 524 */ "topic_name ::= NK_ID", + /* 525 */ "stream_name ::= NK_ID", + /* 526 */ "cgroup_name ::= NK_ID", + /* 527 */ "index_name ::= NK_ID", + /* 528 */ "tsma_name ::= NK_ID", + /* 529 */ "expr_or_subquery ::= expression", + /* 530 */ "expression ::= literal", + /* 531 */ "expression ::= pseudo_column", + /* 532 */ "expression ::= column_reference", + /* 533 */ "expression ::= function_expression", + /* 534 */ "expression ::= case_when_expression", + /* 535 */ "expression ::= NK_LP expression NK_RP", + /* 536 */ "expression ::= NK_PLUS expr_or_subquery", + /* 537 */ "expression ::= NK_MINUS expr_or_subquery", + /* 538 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery", + /* 539 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery", + /* 540 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery", + /* 541 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery", + /* 542 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery", + /* 543 */ "expression ::= column_reference NK_ARROW NK_STRING", + /* 544 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery", + /* 545 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery", + /* 546 */ "expression_list ::= expr_or_subquery", + /* 547 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery", + /* 548 */ "column_reference ::= column_name", + /* 549 */ "column_reference ::= table_name NK_DOT column_name", + /* 550 */ "column_reference ::= NK_ALIAS", + /* 551 */ "column_reference ::= table_name NK_DOT NK_ALIAS", + /* 552 */ "pseudo_column ::= ROWTS", + /* 553 */ "pseudo_column ::= TBNAME", + /* 554 */ "pseudo_column ::= table_name NK_DOT TBNAME", + /* 555 */ "pseudo_column ::= QSTART", + /* 556 */ "pseudo_column ::= QEND", + /* 557 */ "pseudo_column ::= QDURATION", + /* 558 */ "pseudo_column ::= WSTART", + /* 559 */ "pseudo_column ::= WEND", + /* 560 */ "pseudo_column ::= WDURATION", + /* 561 */ "pseudo_column ::= IROWTS", + /* 562 */ "pseudo_column ::= ISFILLED", + /* 563 */ "pseudo_column ::= QTAGS", + /* 564 */ "function_expression ::= function_name NK_LP expression_list NK_RP", + /* 565 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", + /* 566 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP", + /* 567 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP", + /* 568 */ "function_expression ::= literal_func", + /* 569 */ "literal_func ::= noarg_func NK_LP NK_RP", + /* 570 */ "literal_func ::= NOW", + /* 571 */ "literal_func ::= TODAY", + /* 572 */ "noarg_func ::= NOW", + /* 573 */ "noarg_func ::= TODAY", + /* 574 */ "noarg_func ::= TIMEZONE", + /* 575 */ "noarg_func ::= DATABASE", + /* 576 */ "noarg_func ::= CLIENT_VERSION", + /* 577 */ "noarg_func ::= SERVER_VERSION", + /* 578 */ "noarg_func ::= SERVER_STATUS", + /* 579 */ "noarg_func ::= CURRENT_USER", + /* 580 */ "noarg_func ::= USER", + /* 581 */ "star_func ::= COUNT", + /* 582 */ "star_func ::= FIRST", + /* 583 */ "star_func ::= LAST", + /* 584 */ "star_func ::= LAST_ROW", + /* 585 */ "star_func_para_list ::= NK_STAR", + /* 586 */ "star_func_para_list ::= other_para_list", + /* 587 */ "other_para_list ::= star_func_para", + /* 588 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", + /* 589 */ "star_func_para ::= expr_or_subquery", + /* 590 */ "star_func_para ::= table_name NK_DOT NK_STAR", + /* 591 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END", + /* 592 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END", + /* 593 */ "when_then_list ::= when_then_expr", + /* 594 */ "when_then_list ::= when_then_list when_then_expr", + /* 595 */ "when_then_expr ::= WHEN common_expression THEN common_expression", + /* 596 */ "case_when_else_opt ::=", + /* 597 */ "case_when_else_opt ::= ELSE common_expression", + /* 598 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery", + /* 599 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery", + /* 600 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery", + /* 601 */ "predicate ::= expr_or_subquery IS NULL", + /* 602 */ "predicate ::= expr_or_subquery IS NOT NULL", + /* 603 */ "predicate ::= expr_or_subquery in_op in_predicate_value", + /* 604 */ "compare_op ::= NK_LT", + /* 605 */ "compare_op ::= NK_GT", + /* 606 */ "compare_op ::= NK_LE", + /* 607 */ "compare_op ::= NK_GE", + /* 608 */ "compare_op ::= NK_NE", + /* 609 */ "compare_op ::= NK_EQ", + /* 610 */ "compare_op ::= LIKE", + /* 611 */ "compare_op ::= NOT LIKE", + /* 612 */ "compare_op ::= MATCH", + /* 613 */ "compare_op ::= NMATCH", + /* 614 */ "compare_op ::= CONTAINS", + /* 615 */ "in_op ::= IN", + /* 616 */ "in_op ::= NOT IN", + /* 617 */ "in_predicate_value ::= NK_LP literal_list NK_RP", + /* 618 */ "boolean_value_expression ::= boolean_primary", + /* 619 */ "boolean_value_expression ::= NOT boolean_primary", + /* 620 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", + /* 621 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", + /* 622 */ "boolean_primary ::= predicate", + /* 623 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", + /* 624 */ "common_expression ::= expr_or_subquery", + /* 625 */ "common_expression ::= boolean_value_expression", + /* 626 */ "from_clause_opt ::=", + /* 627 */ "from_clause_opt ::= FROM table_reference_list", + /* 628 */ "table_reference_list ::= table_reference", + /* 629 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", + /* 630 */ "table_reference ::= table_primary", + /* 631 */ "table_reference ::= joined_table", + /* 632 */ "table_primary ::= table_name alias_opt", + /* 633 */ "table_primary ::= db_name NK_DOT table_name alias_opt", + /* 634 */ "table_primary ::= subquery alias_opt", + /* 635 */ "table_primary ::= parenthesized_joined_table", + /* 636 */ "alias_opt ::=", + /* 637 */ "alias_opt ::= table_alias", + /* 638 */ "alias_opt ::= AS table_alias", + /* 639 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", + /* 640 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", + /* 641 */ "joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt", + /* 642 */ "join_type ::=", + /* 643 */ "join_type ::= INNER", + /* 644 */ "join_type ::= LEFT", + /* 645 */ "join_type ::= RIGHT", + /* 646 */ "join_type ::= FULL", + /* 647 */ "join_subtype ::=", + /* 648 */ "join_subtype ::= OUTER", + /* 649 */ "join_subtype ::= SEMI", + /* 650 */ "join_subtype ::= ANTI", + /* 651 */ "join_subtype ::= ASOF", + /* 652 */ "join_subtype ::= WINDOW", + /* 653 */ "join_on_clause_opt ::=", + /* 654 */ "join_on_clause_opt ::= ON search_condition", + /* 655 */ "window_offset_clause_opt ::=", + /* 656 */ "window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP", + /* 657 */ "window_offset_literal ::= NK_VARIABLE", + /* 658 */ "window_offset_literal ::= NK_MINUS NK_VARIABLE", + /* 659 */ "jlimit_clause_opt ::=", + /* 660 */ "jlimit_clause_opt ::= JLIMIT NK_INTEGER", + /* 661 */ "query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt", + /* 662 */ "hint_list ::=", + /* 663 */ "hint_list ::= NK_HINT", + /* 664 */ "tag_mode_opt ::=", + /* 665 */ "tag_mode_opt ::= TAGS", + /* 666 */ "set_quantifier_opt ::=", + /* 667 */ "set_quantifier_opt ::= DISTINCT", + /* 668 */ "set_quantifier_opt ::= ALL", + /* 669 */ "select_list ::= select_item", + /* 670 */ "select_list ::= select_list NK_COMMA select_item", + /* 671 */ "select_item ::= NK_STAR", + /* 672 */ "select_item ::= common_expression", + /* 673 */ "select_item ::= common_expression column_alias", + /* 674 */ "select_item ::= common_expression AS column_alias", + /* 675 */ "select_item ::= table_name NK_DOT NK_STAR", + /* 676 */ "where_clause_opt ::=", + /* 677 */ "where_clause_opt ::= WHERE search_condition", + /* 678 */ "partition_by_clause_opt ::=", + /* 679 */ "partition_by_clause_opt ::= PARTITION BY partition_list", + /* 680 */ "partition_list ::= partition_item", + /* 681 */ "partition_list ::= partition_list NK_COMMA partition_item", + /* 682 */ "partition_item ::= expr_or_subquery", + /* 683 */ "partition_item ::= expr_or_subquery column_alias", + /* 684 */ "partition_item ::= expr_or_subquery AS column_alias", + /* 685 */ "twindow_clause_opt ::=", + /* 686 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP", + /* 687 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP", + /* 688 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt", + /* 689 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt", + /* 690 */ "twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition", + /* 691 */ "twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP", + /* 692 */ "twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", + /* 693 */ "sliding_opt ::=", + /* 694 */ "sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP", + /* 695 */ "interval_sliding_duration_literal ::= NK_VARIABLE", + /* 696 */ "interval_sliding_duration_literal ::= NK_STRING", + /* 697 */ "interval_sliding_duration_literal ::= NK_INTEGER", + /* 698 */ "fill_opt ::=", + /* 699 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", + /* 700 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP", + /* 701 */ "fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP", + /* 702 */ "fill_mode ::= NONE", + /* 703 */ "fill_mode ::= PREV", + /* 704 */ "fill_mode ::= NULL", + /* 705 */ "fill_mode ::= NULL_F", + /* 706 */ "fill_mode ::= LINEAR", + /* 707 */ "fill_mode ::= NEXT", + /* 708 */ "group_by_clause_opt ::=", + /* 709 */ "group_by_clause_opt ::= GROUP BY group_by_list", + /* 710 */ "group_by_list ::= expr_or_subquery", + /* 711 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery", + /* 712 */ "having_clause_opt ::=", + /* 713 */ "having_clause_opt ::= HAVING search_condition", + /* 714 */ "range_opt ::=", + /* 715 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP", + /* 716 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_RP", + /* 717 */ "every_opt ::=", + /* 718 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", + /* 719 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt", + /* 720 */ "query_simple ::= query_specification", + /* 721 */ "query_simple ::= union_query_expression", + /* 722 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery", + /* 723 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery", + /* 724 */ "query_simple_or_subquery ::= query_simple", + /* 725 */ "query_simple_or_subquery ::= subquery", + /* 726 */ "query_or_subquery ::= query_expression", + /* 727 */ "query_or_subquery ::= subquery", + /* 728 */ "order_by_clause_opt ::=", + /* 729 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", + /* 730 */ "slimit_clause_opt ::=", + /* 731 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", + /* 732 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", + /* 733 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 734 */ "limit_clause_opt ::=", + /* 735 */ "limit_clause_opt ::= LIMIT NK_INTEGER", + /* 736 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", + /* 737 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 738 */ "subquery ::= NK_LP query_expression NK_RP", + /* 739 */ "subquery ::= NK_LP subquery NK_RP", + /* 740 */ "search_condition ::= common_expression", + /* 741 */ "sort_specification_list ::= sort_specification", + /* 742 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", + /* 743 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt", + /* 744 */ "ordering_specification_opt ::=", + /* 745 */ "ordering_specification_opt ::= ASC", + /* 746 */ "ordering_specification_opt ::= DESC", + /* 747 */ "null_ordering_opt ::=", + /* 748 */ "null_ordering_opt ::= NULLS FIRST", + /* 749 */ "null_ordering_opt ::= NULLS LAST", + /* 750 */ "column_options ::=", + /* 751 */ "column_options ::= column_options PRIMARY KEY", + /* 752 */ "column_options ::= column_options ENCODE NK_STRING", + /* 753 */ "column_options ::= column_options COMPRESS NK_STRING", + /* 754 */ "column_options ::= column_options LEVEL NK_STRING", }; #endif /* NDEBUG */ @@ -3457,97 +3437,96 @@ static void yy_destructor( case 414: /* retention */ case 415: /* full_table_name */ case 418: /* table_options */ - case 422: /* alter_table_clause */ - case 423: /* alter_table_options */ - case 426: /* column_options */ - case 427: /* tags_literal */ - case 428: /* create_subtable_clause */ - case 429: /* create_from_file_clause */ - case 433: /* drop_table_clause */ - case 436: /* tag_def */ - case 437: /* column_def */ - case 442: /* duration_literal */ - case 443: /* rollup_func_name */ - case 445: /* col_name */ - case 448: /* like_pattern_opt */ - case 449: /* db_name_cond_opt */ - case 450: /* table_name_cond */ - case 451: /* from_db_opt */ - case 453: /* tag_item */ - case 457: /* full_tsma_name */ - case 459: /* index_options */ - case 460: /* full_index_name */ - case 462: /* sliding_opt */ - case 463: /* sma_stream_opt */ - case 464: /* func */ - case 468: /* query_or_subquery */ - case 469: /* where_clause_opt */ - case 472: /* explain_options */ - case 473: /* insert_query */ - case 478: /* full_view_name */ - case 481: /* stream_options */ - case 484: /* subtable_opt */ - case 487: /* column_stream_def */ - case 488: /* stream_col_options */ - case 489: /* expression */ - case 492: /* literal_func */ - case 493: /* signed_literal */ - case 496: /* expr_or_subquery */ - case 497: /* pseudo_column */ - case 498: /* column_reference */ - case 499: /* function_expression */ - case 500: /* case_when_expression */ - case 505: /* star_func_para */ - case 507: /* case_when_else_opt */ - case 508: /* common_expression */ - case 509: /* when_then_expr */ - case 510: /* predicate */ - case 513: /* in_predicate_value */ - case 514: /* boolean_value_expression */ - case 515: /* boolean_primary */ - case 516: /* from_clause_opt */ - case 517: /* table_reference_list */ - case 518: /* table_reference */ - case 519: /* table_primary */ - case 520: /* joined_table */ - case 522: /* subquery */ - case 523: /* parenthesized_joined_table */ - case 526: /* join_on_clause_opt */ - case 527: /* window_offset_clause_opt */ - case 528: /* jlimit_clause_opt */ - case 529: /* window_offset_literal */ - case 530: /* query_specification */ - case 536: /* range_opt */ - case 537: /* every_opt */ - case 538: /* fill_opt */ - case 539: /* twindow_clause_opt */ - case 541: /* having_clause_opt */ - case 542: /* select_item */ - case 544: /* partition_item */ - case 545: /* interval_sliding_duration_literal */ - case 548: /* query_expression */ - case 549: /* query_simple */ - case 551: /* slimit_clause_opt */ - case 552: /* limit_clause_opt */ - case 553: /* union_query_expression */ - case 554: /* query_simple_or_subquery */ - case 556: /* sort_specification */ + case 423: /* alter_table_clause */ + case 424: /* alter_table_options */ + case 427: /* column_options */ + case 428: /* tags_literal */ + case 429: /* create_subtable_clause */ + case 432: /* drop_table_clause */ + case 435: /* tag_def */ + case 436: /* column_def */ + case 441: /* duration_literal */ + case 442: /* rollup_func_name */ + case 444: /* col_name */ + case 447: /* like_pattern_opt */ + case 448: /* db_name_cond_opt */ + case 449: /* table_name_cond */ + case 450: /* from_db_opt */ + case 452: /* tag_item */ + case 456: /* full_tsma_name */ + case 458: /* index_options */ + case 459: /* full_index_name */ + case 461: /* sliding_opt */ + case 462: /* sma_stream_opt */ + case 463: /* func */ + case 467: /* query_or_subquery */ + case 468: /* where_clause_opt */ + case 471: /* explain_options */ + case 472: /* insert_query */ + case 477: /* full_view_name */ + case 480: /* stream_options */ + case 483: /* subtable_opt */ + case 486: /* column_stream_def */ + case 487: /* stream_col_options */ + case 488: /* expression */ + case 491: /* literal_func */ + case 492: /* signed_literal */ + case 495: /* expr_or_subquery */ + case 496: /* pseudo_column */ + case 497: /* column_reference */ + case 498: /* function_expression */ + case 499: /* case_when_expression */ + case 504: /* star_func_para */ + case 506: /* case_when_else_opt */ + case 507: /* common_expression */ + case 508: /* when_then_expr */ + case 509: /* predicate */ + case 512: /* in_predicate_value */ + case 513: /* boolean_value_expression */ + case 514: /* boolean_primary */ + case 515: /* from_clause_opt */ + case 516: /* table_reference_list */ + case 517: /* table_reference */ + case 518: /* table_primary */ + case 519: /* joined_table */ + case 521: /* subquery */ + case 522: /* parenthesized_joined_table */ + case 525: /* join_on_clause_opt */ + case 526: /* window_offset_clause_opt */ + case 527: /* jlimit_clause_opt */ + case 528: /* window_offset_literal */ + case 529: /* query_specification */ + case 535: /* range_opt */ + case 536: /* every_opt */ + case 537: /* fill_opt */ + case 538: /* twindow_clause_opt */ + case 540: /* having_clause_opt */ + case 541: /* select_item */ + case 543: /* partition_item */ + case 544: /* interval_sliding_duration_literal */ + case 547: /* query_expression */ + case 548: /* query_simple */ + case 550: /* slimit_clause_opt */ + case 551: /* limit_clause_opt */ + case 552: /* union_query_expression */ + case 553: /* query_simple_or_subquery */ + case 555: /* sort_specification */ { #line 7 "sql.y" - nodesDestroyNode((yypminor->yy54)); -#line 3538 "sql.c" + nodesDestroyNode((yypminor->yy416)); +#line 3517 "sql.c" } break; case 379: /* account_options */ case 380: /* alter_account_options */ case 382: /* alter_account_option */ case 406: /* speed_opt */ - case 467: /* with_meta */ - case 476: /* bufsize_opt */ + case 466: /* with_meta */ + case 475: /* bufsize_opt */ { #line 54 "sql.y" -#line 3550 "sql.c" +#line 3529 "sql.c" } break; case 383: /* ip_range_list */ @@ -3559,37 +3538,37 @@ static void yy_destructor( case 416: /* column_def_list */ case 417: /* tags_def_opt */ case 419: /* multi_create_clause */ - case 420: /* tags_def */ - case 421: /* multi_drop_clause */ + case 420: /* tag_list_opt */ + case 421: /* tags_def */ + case 422: /* multi_drop_clause */ case 430: /* specific_cols_opt */ case 431: /* tags_literal_list */ - case 432: /* tag_list_opt */ - case 434: /* col_name_list */ - case 435: /* tag_def_list */ - case 439: /* duration_list */ - case 440: /* rollup_func_list */ - case 458: /* func_list */ - case 466: /* expression_list */ - case 482: /* col_list_opt */ - case 483: /* tag_def_or_ref_opt */ - case 486: /* column_stream_def_list */ - case 491: /* dnode_list */ - case 494: /* literal_list */ - case 502: /* star_func_para_list */ - case 504: /* other_para_list */ - case 506: /* when_then_list */ - case 531: /* hint_list */ - case 534: /* select_list */ - case 535: /* partition_by_clause_opt */ - case 540: /* group_by_clause_opt */ - case 543: /* partition_list */ - case 547: /* group_by_list */ - case 550: /* order_by_clause_opt */ - case 555: /* sort_specification_list */ + case 433: /* col_name_list */ + case 434: /* tag_def_list */ + case 438: /* duration_list */ + case 439: /* rollup_func_list */ + case 457: /* func_list */ + case 465: /* expression_list */ + case 481: /* col_list_opt */ + case 482: /* tag_def_or_ref_opt */ + case 485: /* column_stream_def_list */ + case 490: /* dnode_list */ + case 493: /* literal_list */ + case 501: /* star_func_para_list */ + case 503: /* other_para_list */ + case 505: /* when_then_list */ + case 530: /* hint_list */ + case 533: /* select_list */ + case 534: /* partition_by_clause_opt */ + case 539: /* group_by_clause_opt */ + case 542: /* partition_list */ + case 546: /* group_by_list */ + case 549: /* order_by_clause_opt */ + case 554: /* sort_specification_list */ { #line 85 "sql.y" - nodesDestroyList((yypminor->yy652)); -#line 3592 "sql.c" + nodesDestroyList((yypminor->yy316)); +#line 3571 "sql.c" } break; case 386: /* is_import_opt */ @@ -3598,7 +3577,7 @@ static void yy_destructor( { #line 99 "sql.y" -#line 3601 "sql.c" +#line 3580 "sql.c" } break; case 388: /* user_name */ @@ -3606,25 +3585,25 @@ static void yy_destructor( case 396: /* table_name */ case 397: /* topic_name */ case 399: /* dnode_endpoint */ - case 424: /* column_name */ - case 444: /* function_name */ - case 454: /* column_alias */ - case 455: /* tsma_name */ - case 461: /* index_name */ - case 465: /* sma_func_name */ - case 470: /* cgroup_name */ - case 477: /* language_opt */ - case 479: /* view_name */ - case 480: /* stream_name */ - case 490: /* on_vgroup_id */ - case 495: /* table_alias */ - case 501: /* star_func */ - case 503: /* noarg_func */ - case 521: /* alias_opt */ + case 425: /* column_name */ + case 443: /* function_name */ + case 453: /* column_alias */ + case 454: /* tsma_name */ + case 460: /* index_name */ + case 464: /* sma_func_name */ + case 469: /* cgroup_name */ + case 476: /* language_opt */ + case 478: /* view_name */ + case 479: /* stream_name */ + case 489: /* on_vgroup_id */ + case 494: /* table_alias */ + case 500: /* star_func */ + case 502: /* noarg_func */ + case 520: /* alias_opt */ { -#line 1084 "sql.y" +#line 1082 "sql.y" -#line 3627 "sql.c" +#line 3606 "sql.c" } break; case 390: /* privileges */ @@ -3633,111 +3612,111 @@ static void yy_destructor( { #line 131 "sql.y" -#line 3636 "sql.c" +#line 3615 "sql.c" } break; case 391: /* priv_level */ { #line 148 "sql.y" -#line 3643 "sql.c" +#line 3622 "sql.c" } break; case 400: /* force_opt */ case 401: /* unsafe_opt */ case 402: /* not_exists_opt */ case 404: /* exists_opt */ - case 471: /* analyze_opt */ - case 474: /* or_replace_opt */ - case 475: /* agg_func_opt */ - case 485: /* ignore_opt */ - case 532: /* set_quantifier_opt */ - case 533: /* tag_mode_opt */ + case 470: /* analyze_opt */ + case 473: /* or_replace_opt */ + case 474: /* agg_func_opt */ + case 484: /* ignore_opt */ + case 531: /* set_quantifier_opt */ + case 532: /* tag_mode_opt */ { #line 180 "sql.y" -#line 3659 "sql.c" +#line 3638 "sql.c" } break; case 413: /* alter_db_option */ - case 441: /* alter_table_option */ + case 440: /* alter_table_option */ { #line 288 "sql.y" -#line 3667 "sql.c" +#line 3646 "sql.c" } break; - case 425: /* type_name */ - case 438: /* type_name_default_len */ + case 426: /* type_name */ + case 437: /* type_name_default_len */ { -#line 427 "sql.y" +#line 425 "sql.y" -#line 3675 "sql.c" +#line 3654 "sql.c" } break; - case 446: /* db_kind_opt */ - case 452: /* table_kind */ + case 445: /* db_kind_opt */ + case 451: /* table_kind */ { -#line 606 "sql.y" +#line 604 "sql.y" -#line 3683 "sql.c" +#line 3662 "sql.c" } break; - case 447: /* table_kind_db_name_cond_opt */ + case 446: /* table_kind_db_name_cond_opt */ { -#line 571 "sql.y" +#line 569 "sql.y" -#line 3690 "sql.c" +#line 3669 "sql.c" } break; - case 456: /* tsma_func_list */ + case 455: /* tsma_func_list */ { -#line 625 "sql.y" - nodesDestroyNode((yypminor->yy54)); -#line 3697 "sql.c" +#line 623 "sql.y" + nodesDestroyNode((yypminor->yy416)); +#line 3676 "sql.c" } break; - case 511: /* compare_op */ - case 512: /* in_op */ + case 510: /* compare_op */ + case 511: /* in_op */ { -#line 1282 "sql.y" +#line 1280 "sql.y" + +#line 3684 "sql.c" +} + break; + case 523: /* join_type */ +{ +#line 1361 "sql.y" + +#line 3691 "sql.c" +} + break; + case 524: /* join_subtype */ +{ +#line 1369 "sql.y" + +#line 3698 "sql.c" +} + break; + case 545: /* fill_mode */ +{ +#line 1485 "sql.y" #line 3705 "sql.c" } break; - case 524: /* join_type */ + case 556: /* ordering_specification_opt */ { -#line 1363 "sql.y" +#line 1570 "sql.y" #line 3712 "sql.c" } break; - case 525: /* join_subtype */ + case 557: /* null_ordering_opt */ { -#line 1371 "sql.y" +#line 1576 "sql.y" #line 3719 "sql.c" -} - break; - case 546: /* fill_mode */ -{ -#line 1487 "sql.y" - -#line 3726 "sql.c" -} - break; - case 557: /* ordering_specification_opt */ -{ -#line 1572 "sql.y" - -#line 3733 "sql.c" -} - break; - case 558: /* null_ordering_opt */ -{ -#line 1578 "sql.y" - -#line 3740 "sql.c" } break; /********* End destructor definitions *****************************************/ @@ -4209,579 +4188,578 @@ static const YYCODETYPE yyRuleInfoLhs[] = { 408, /* (180) end_opt ::= END WITH TIMESTAMP NK_STRING */ 378, /* (181) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ 378, /* (182) cmd ::= CREATE TABLE multi_create_clause */ - 378, /* (183) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ - 378, /* (184) cmd ::= DROP TABLE multi_drop_clause */ - 378, /* (185) cmd ::= DROP STABLE exists_opt full_table_name */ - 378, /* (186) cmd ::= ALTER TABLE alter_table_clause */ - 378, /* (187) cmd ::= ALTER STABLE alter_table_clause */ - 422, /* (188) alter_table_clause ::= full_table_name alter_table_options */ - 422, /* (189) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name column_options */ - 422, /* (190) alter_table_clause ::= full_table_name DROP COLUMN column_name */ - 422, /* (191) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ - 422, /* (192) alter_table_clause ::= full_table_name MODIFY COLUMN column_name column_options */ - 422, /* (193) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ - 422, /* (194) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ - 422, /* (195) alter_table_clause ::= full_table_name DROP TAG column_name */ - 422, /* (196) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ - 422, /* (197) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ - 422, /* (198) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ tags_literal */ - 419, /* (199) multi_create_clause ::= create_subtable_clause */ - 419, /* (200) multi_create_clause ::= multi_create_clause create_subtable_clause */ - 419, /* (201) multi_create_clause ::= create_from_file_clause */ - 428, /* (202) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP tags_literal_list NK_RP table_options */ - 429, /* (203) create_from_file_clause ::= not_exists_opt USING full_table_name NK_LP tag_list_opt NK_RP FILE NK_STRING */ - 421, /* (204) multi_drop_clause ::= drop_table_clause */ - 421, /* (205) multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ - 433, /* (206) drop_table_clause ::= exists_opt full_table_name */ - 430, /* (207) specific_cols_opt ::= */ - 430, /* (208) specific_cols_opt ::= NK_LP col_name_list NK_RP */ - 415, /* (209) full_table_name ::= table_name */ - 415, /* (210) full_table_name ::= db_name NK_DOT table_name */ - 435, /* (211) tag_def_list ::= tag_def */ - 435, /* (212) tag_def_list ::= tag_def_list NK_COMMA tag_def */ - 436, /* (213) tag_def ::= column_name type_name */ - 416, /* (214) column_def_list ::= column_def */ - 416, /* (215) column_def_list ::= column_def_list NK_COMMA column_def */ - 437, /* (216) column_def ::= column_name type_name column_options */ - 425, /* (217) type_name ::= BOOL */ - 425, /* (218) type_name ::= TINYINT */ - 425, /* (219) type_name ::= SMALLINT */ - 425, /* (220) type_name ::= INT */ - 425, /* (221) type_name ::= INTEGER */ - 425, /* (222) type_name ::= BIGINT */ - 425, /* (223) type_name ::= FLOAT */ - 425, /* (224) type_name ::= DOUBLE */ - 425, /* (225) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ - 425, /* (226) type_name ::= TIMESTAMP */ - 425, /* (227) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ - 425, /* (228) type_name ::= TINYINT UNSIGNED */ - 425, /* (229) type_name ::= SMALLINT UNSIGNED */ - 425, /* (230) type_name ::= INT UNSIGNED */ - 425, /* (231) type_name ::= BIGINT UNSIGNED */ - 425, /* (232) type_name ::= JSON */ - 425, /* (233) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ - 425, /* (234) type_name ::= MEDIUMBLOB */ - 425, /* (235) type_name ::= BLOB */ - 425, /* (236) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ - 425, /* (237) type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ - 425, /* (238) type_name ::= DECIMAL */ - 425, /* (239) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ - 425, /* (240) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - 438, /* (241) type_name_default_len ::= BINARY */ - 438, /* (242) type_name_default_len ::= NCHAR */ - 438, /* (243) type_name_default_len ::= VARCHAR */ - 438, /* (244) type_name_default_len ::= VARBINARY */ - 417, /* (245) tags_def_opt ::= */ - 417, /* (246) tags_def_opt ::= tags_def */ - 420, /* (247) tags_def ::= TAGS NK_LP tag_def_list NK_RP */ - 418, /* (248) table_options ::= */ - 418, /* (249) table_options ::= table_options COMMENT NK_STRING */ - 418, /* (250) table_options ::= table_options MAX_DELAY duration_list */ - 418, /* (251) table_options ::= table_options WATERMARK duration_list */ - 418, /* (252) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ - 418, /* (253) table_options ::= table_options TTL NK_INTEGER */ - 418, /* (254) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ - 418, /* (255) table_options ::= table_options DELETE_MARK duration_list */ - 423, /* (256) alter_table_options ::= alter_table_option */ - 423, /* (257) alter_table_options ::= alter_table_options alter_table_option */ - 441, /* (258) alter_table_option ::= COMMENT NK_STRING */ - 441, /* (259) alter_table_option ::= TTL NK_INTEGER */ - 439, /* (260) duration_list ::= duration_literal */ - 439, /* (261) duration_list ::= duration_list NK_COMMA duration_literal */ - 440, /* (262) rollup_func_list ::= rollup_func_name */ - 440, /* (263) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ - 443, /* (264) rollup_func_name ::= function_name */ - 443, /* (265) rollup_func_name ::= FIRST */ - 443, /* (266) rollup_func_name ::= LAST */ - 434, /* (267) col_name_list ::= col_name */ - 434, /* (268) col_name_list ::= col_name_list NK_COMMA col_name */ - 445, /* (269) col_name ::= column_name */ - 378, /* (270) cmd ::= SHOW DNODES */ - 378, /* (271) cmd ::= SHOW USERS */ - 378, /* (272) cmd ::= SHOW USERS FULL */ - 378, /* (273) cmd ::= SHOW USER PRIVILEGES */ - 378, /* (274) cmd ::= SHOW db_kind_opt DATABASES */ - 378, /* (275) cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */ - 378, /* (276) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ - 378, /* (277) cmd ::= SHOW db_name_cond_opt VGROUPS */ - 378, /* (278) cmd ::= SHOW MNODES */ - 378, /* (279) cmd ::= SHOW QNODES */ - 378, /* (280) cmd ::= SHOW ARBGROUPS */ - 378, /* (281) cmd ::= SHOW FUNCTIONS */ - 378, /* (282) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ - 378, /* (283) cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ - 378, /* (284) cmd ::= SHOW STREAMS */ - 378, /* (285) cmd ::= SHOW ACCOUNTS */ - 378, /* (286) cmd ::= SHOW APPS */ - 378, /* (287) cmd ::= SHOW CONNECTIONS */ - 378, /* (288) cmd ::= SHOW LICENCES */ - 378, /* (289) cmd ::= SHOW GRANTS */ - 378, /* (290) cmd ::= SHOW GRANTS FULL */ - 378, /* (291) cmd ::= SHOW GRANTS LOGS */ - 378, /* (292) cmd ::= SHOW CLUSTER MACHINES */ - 378, /* (293) cmd ::= SHOW CREATE DATABASE db_name */ - 378, /* (294) cmd ::= SHOW CREATE TABLE full_table_name */ - 378, /* (295) cmd ::= SHOW CREATE STABLE full_table_name */ - 378, /* (296) cmd ::= SHOW ENCRYPTIONS */ - 378, /* (297) cmd ::= SHOW QUERIES */ - 378, /* (298) cmd ::= SHOW SCORES */ - 378, /* (299) cmd ::= SHOW TOPICS */ - 378, /* (300) cmd ::= SHOW VARIABLES */ - 378, /* (301) cmd ::= SHOW CLUSTER VARIABLES */ - 378, /* (302) cmd ::= SHOW LOCAL VARIABLES */ - 378, /* (303) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ - 378, /* (304) cmd ::= SHOW BNODES */ - 378, /* (305) cmd ::= SHOW SNODES */ - 378, /* (306) cmd ::= SHOW CLUSTER */ - 378, /* (307) cmd ::= SHOW TRANSACTIONS */ - 378, /* (308) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ - 378, /* (309) cmd ::= SHOW CONSUMERS */ - 378, /* (310) cmd ::= SHOW SUBSCRIPTIONS */ - 378, /* (311) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ - 378, /* (312) cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ - 378, /* (313) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ - 378, /* (314) cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ - 378, /* (315) cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ - 378, /* (316) cmd ::= SHOW VNODES */ - 378, /* (317) cmd ::= SHOW db_name_cond_opt ALIVE */ - 378, /* (318) cmd ::= SHOW CLUSTER ALIVE */ - 378, /* (319) cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt */ - 378, /* (320) cmd ::= SHOW CREATE VIEW full_table_name */ - 378, /* (321) cmd ::= SHOW COMPACTS */ - 378, /* (322) cmd ::= SHOW COMPACT NK_INTEGER */ - 447, /* (323) table_kind_db_name_cond_opt ::= */ - 447, /* (324) table_kind_db_name_cond_opt ::= table_kind */ - 447, /* (325) table_kind_db_name_cond_opt ::= db_name NK_DOT */ - 447, /* (326) table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ - 452, /* (327) table_kind ::= NORMAL */ - 452, /* (328) table_kind ::= CHILD */ - 449, /* (329) db_name_cond_opt ::= */ - 449, /* (330) db_name_cond_opt ::= db_name NK_DOT */ - 448, /* (331) like_pattern_opt ::= */ - 448, /* (332) like_pattern_opt ::= LIKE NK_STRING */ - 450, /* (333) table_name_cond ::= table_name */ - 451, /* (334) from_db_opt ::= */ - 451, /* (335) from_db_opt ::= FROM db_name */ - 432, /* (336) tag_list_opt ::= */ - 432, /* (337) tag_list_opt ::= tag_item */ - 432, /* (338) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ - 453, /* (339) tag_item ::= TBNAME */ - 453, /* (340) tag_item ::= QTAGS */ - 453, /* (341) tag_item ::= column_name */ - 453, /* (342) tag_item ::= column_name column_alias */ - 453, /* (343) tag_item ::= column_name AS column_alias */ - 446, /* (344) db_kind_opt ::= */ - 446, /* (345) db_kind_opt ::= USER */ - 446, /* (346) db_kind_opt ::= SYSTEM */ - 378, /* (347) cmd ::= CREATE TSMA not_exists_opt tsma_name ON full_table_name tsma_func_list INTERVAL NK_LP duration_literal NK_RP */ - 378, /* (348) cmd ::= CREATE RECURSIVE TSMA not_exists_opt tsma_name ON full_table_name INTERVAL NK_LP duration_literal NK_RP */ - 378, /* (349) cmd ::= DROP TSMA exists_opt full_tsma_name */ - 378, /* (350) cmd ::= SHOW db_name_cond_opt TSMAS */ - 457, /* (351) full_tsma_name ::= tsma_name */ - 457, /* (352) full_tsma_name ::= db_name NK_DOT tsma_name */ - 456, /* (353) tsma_func_list ::= FUNCTION NK_LP func_list NK_RP */ - 378, /* (354) cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ - 378, /* (355) cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ - 378, /* (356) cmd ::= DROP INDEX exists_opt full_index_name */ - 460, /* (357) full_index_name ::= index_name */ - 460, /* (358) full_index_name ::= db_name NK_DOT index_name */ - 459, /* (359) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ - 459, /* (360) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */ - 458, /* (361) func_list ::= func */ - 458, /* (362) func_list ::= func_list NK_COMMA func */ - 464, /* (363) func ::= sma_func_name NK_LP expression_list NK_RP */ - 465, /* (364) sma_func_name ::= function_name */ - 465, /* (365) sma_func_name ::= COUNT */ - 465, /* (366) sma_func_name ::= FIRST */ - 465, /* (367) sma_func_name ::= LAST */ - 465, /* (368) sma_func_name ::= LAST_ROW */ - 463, /* (369) sma_stream_opt ::= */ - 463, /* (370) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ - 463, /* (371) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ - 463, /* (372) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ - 467, /* (373) with_meta ::= AS */ - 467, /* (374) with_meta ::= WITH META AS */ - 467, /* (375) with_meta ::= ONLY META AS */ - 378, /* (376) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ - 378, /* (377) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ - 378, /* (378) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ - 378, /* (379) cmd ::= DROP TOPIC exists_opt topic_name */ - 378, /* (380) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ - 378, /* (381) cmd ::= DESC full_table_name */ - 378, /* (382) cmd ::= DESCRIBE full_table_name */ - 378, /* (383) cmd ::= RESET QUERY CACHE */ - 378, /* (384) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ - 378, /* (385) cmd ::= EXPLAIN analyze_opt explain_options insert_query */ - 471, /* (386) analyze_opt ::= */ - 471, /* (387) analyze_opt ::= ANALYZE */ - 472, /* (388) explain_options ::= */ - 472, /* (389) explain_options ::= explain_options VERBOSE NK_BOOL */ - 472, /* (390) explain_options ::= explain_options RATIO NK_FLOAT */ - 378, /* (391) cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ - 378, /* (392) cmd ::= DROP FUNCTION exists_opt function_name */ - 475, /* (393) agg_func_opt ::= */ - 475, /* (394) agg_func_opt ::= AGGREGATE */ - 476, /* (395) bufsize_opt ::= */ - 476, /* (396) bufsize_opt ::= BUFSIZE NK_INTEGER */ - 477, /* (397) language_opt ::= */ - 477, /* (398) language_opt ::= LANGUAGE NK_STRING */ - 474, /* (399) or_replace_opt ::= */ - 474, /* (400) or_replace_opt ::= OR REPLACE */ - 378, /* (401) cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */ - 378, /* (402) cmd ::= DROP VIEW exists_opt full_view_name */ - 478, /* (403) full_view_name ::= view_name */ - 478, /* (404) full_view_name ::= db_name NK_DOT view_name */ - 378, /* (405) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */ - 378, /* (406) cmd ::= DROP STREAM exists_opt stream_name */ - 378, /* (407) cmd ::= PAUSE STREAM exists_opt stream_name */ - 378, /* (408) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ - 482, /* (409) col_list_opt ::= */ - 482, /* (410) col_list_opt ::= NK_LP column_stream_def_list NK_RP */ - 486, /* (411) column_stream_def_list ::= column_stream_def */ - 486, /* (412) column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def */ - 487, /* (413) column_stream_def ::= column_name stream_col_options */ - 488, /* (414) stream_col_options ::= */ - 488, /* (415) stream_col_options ::= stream_col_options PRIMARY KEY */ - 483, /* (416) tag_def_or_ref_opt ::= */ - 483, /* (417) tag_def_or_ref_opt ::= tags_def */ - 483, /* (418) tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP */ - 481, /* (419) stream_options ::= */ - 481, /* (420) stream_options ::= stream_options TRIGGER AT_ONCE */ - 481, /* (421) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ - 481, /* (422) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ - 481, /* (423) stream_options ::= stream_options WATERMARK duration_literal */ - 481, /* (424) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ - 481, /* (425) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ - 481, /* (426) stream_options ::= stream_options DELETE_MARK duration_literal */ - 481, /* (427) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ - 484, /* (428) subtable_opt ::= */ - 484, /* (429) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - 485, /* (430) ignore_opt ::= */ - 485, /* (431) ignore_opt ::= IGNORE UNTREATED */ - 378, /* (432) cmd ::= KILL CONNECTION NK_INTEGER */ - 378, /* (433) cmd ::= KILL QUERY NK_STRING */ - 378, /* (434) cmd ::= KILL TRANSACTION NK_INTEGER */ - 378, /* (435) cmd ::= KILL COMPACT NK_INTEGER */ - 378, /* (436) cmd ::= BALANCE VGROUP */ - 378, /* (437) cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ - 378, /* (438) cmd ::= BALANCE VGROUP LEADER DATABASE db_name */ - 378, /* (439) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ - 378, /* (440) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ - 378, /* (441) cmd ::= SPLIT VGROUP NK_INTEGER */ - 490, /* (442) on_vgroup_id ::= */ - 490, /* (443) on_vgroup_id ::= ON NK_INTEGER */ - 491, /* (444) dnode_list ::= DNODE NK_INTEGER */ - 491, /* (445) dnode_list ::= dnode_list DNODE NK_INTEGER */ - 378, /* (446) cmd ::= DELETE FROM full_table_name where_clause_opt */ - 378, /* (447) cmd ::= query_or_subquery */ - 378, /* (448) cmd ::= insert_query */ - 473, /* (449) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ - 473, /* (450) insert_query ::= INSERT INTO full_table_name query_or_subquery */ - 427, /* (451) tags_literal ::= NK_INTEGER */ - 427, /* (452) tags_literal ::= NK_INTEGER NK_PLUS duration_literal */ - 427, /* (453) tags_literal ::= NK_INTEGER NK_MINUS duration_literal */ - 427, /* (454) tags_literal ::= NK_PLUS NK_INTEGER */ - 427, /* (455) tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal */ - 427, /* (456) tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal */ - 427, /* (457) tags_literal ::= NK_MINUS NK_INTEGER */ - 427, /* (458) tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal */ - 427, /* (459) tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal */ - 427, /* (460) tags_literal ::= NK_FLOAT */ - 427, /* (461) tags_literal ::= NK_PLUS NK_FLOAT */ - 427, /* (462) tags_literal ::= NK_MINUS NK_FLOAT */ - 427, /* (463) tags_literal ::= NK_BIN */ - 427, /* (464) tags_literal ::= NK_BIN NK_PLUS duration_literal */ - 427, /* (465) tags_literal ::= NK_BIN NK_MINUS duration_literal */ - 427, /* (466) tags_literal ::= NK_PLUS NK_BIN */ - 427, /* (467) tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal */ - 427, /* (468) tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal */ - 427, /* (469) tags_literal ::= NK_MINUS NK_BIN */ - 427, /* (470) tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal */ - 427, /* (471) tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal */ - 427, /* (472) tags_literal ::= NK_HEX */ - 427, /* (473) tags_literal ::= NK_HEX NK_PLUS duration_literal */ - 427, /* (474) tags_literal ::= NK_HEX NK_MINUS duration_literal */ - 427, /* (475) tags_literal ::= NK_PLUS NK_HEX */ - 427, /* (476) tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal */ - 427, /* (477) tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal */ - 427, /* (478) tags_literal ::= NK_MINUS NK_HEX */ - 427, /* (479) tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal */ - 427, /* (480) tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal */ - 427, /* (481) tags_literal ::= NK_STRING */ - 427, /* (482) tags_literal ::= NK_STRING NK_PLUS duration_literal */ - 427, /* (483) tags_literal ::= NK_STRING NK_MINUS duration_literal */ - 427, /* (484) tags_literal ::= NK_BOOL */ - 427, /* (485) tags_literal ::= NULL */ - 427, /* (486) tags_literal ::= literal_func */ - 427, /* (487) tags_literal ::= literal_func NK_PLUS duration_literal */ - 427, /* (488) tags_literal ::= literal_func NK_MINUS duration_literal */ - 431, /* (489) tags_literal_list ::= tags_literal */ - 431, /* (490) tags_literal_list ::= tags_literal_list NK_COMMA tags_literal */ - 381, /* (491) literal ::= NK_INTEGER */ - 381, /* (492) literal ::= NK_FLOAT */ - 381, /* (493) literal ::= NK_STRING */ - 381, /* (494) literal ::= NK_BOOL */ - 381, /* (495) literal ::= TIMESTAMP NK_STRING */ - 381, /* (496) literal ::= duration_literal */ - 381, /* (497) literal ::= NULL */ - 381, /* (498) literal ::= NK_QUESTION */ - 442, /* (499) duration_literal ::= NK_VARIABLE */ - 412, /* (500) signed ::= NK_INTEGER */ - 412, /* (501) signed ::= NK_PLUS NK_INTEGER */ - 412, /* (502) signed ::= NK_MINUS NK_INTEGER */ - 412, /* (503) signed ::= NK_FLOAT */ - 412, /* (504) signed ::= NK_PLUS NK_FLOAT */ - 412, /* (505) signed ::= NK_MINUS NK_FLOAT */ - 493, /* (506) signed_literal ::= signed */ - 493, /* (507) signed_literal ::= NK_STRING */ - 493, /* (508) signed_literal ::= NK_BOOL */ - 493, /* (509) signed_literal ::= TIMESTAMP NK_STRING */ - 493, /* (510) signed_literal ::= duration_literal */ - 493, /* (511) signed_literal ::= NULL */ - 493, /* (512) signed_literal ::= literal_func */ - 493, /* (513) signed_literal ::= NK_QUESTION */ - 494, /* (514) literal_list ::= signed_literal */ - 494, /* (515) literal_list ::= literal_list NK_COMMA signed_literal */ - 395, /* (516) db_name ::= NK_ID */ - 396, /* (517) table_name ::= NK_ID */ - 424, /* (518) column_name ::= NK_ID */ - 444, /* (519) function_name ::= NK_ID */ - 479, /* (520) view_name ::= NK_ID */ - 495, /* (521) table_alias ::= NK_ID */ - 454, /* (522) column_alias ::= NK_ID */ - 454, /* (523) column_alias ::= NK_ALIAS */ - 388, /* (524) user_name ::= NK_ID */ - 397, /* (525) topic_name ::= NK_ID */ - 480, /* (526) stream_name ::= NK_ID */ - 470, /* (527) cgroup_name ::= NK_ID */ - 461, /* (528) index_name ::= NK_ID */ - 455, /* (529) tsma_name ::= NK_ID */ - 496, /* (530) expr_or_subquery ::= expression */ - 489, /* (531) expression ::= literal */ - 489, /* (532) expression ::= pseudo_column */ - 489, /* (533) expression ::= column_reference */ - 489, /* (534) expression ::= function_expression */ - 489, /* (535) expression ::= case_when_expression */ - 489, /* (536) expression ::= NK_LP expression NK_RP */ - 489, /* (537) expression ::= NK_PLUS expr_or_subquery */ - 489, /* (538) expression ::= NK_MINUS expr_or_subquery */ - 489, /* (539) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ - 489, /* (540) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ - 489, /* (541) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ - 489, /* (542) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ - 489, /* (543) expression ::= expr_or_subquery NK_REM expr_or_subquery */ - 489, /* (544) expression ::= column_reference NK_ARROW NK_STRING */ - 489, /* (545) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ - 489, /* (546) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ - 466, /* (547) expression_list ::= expr_or_subquery */ - 466, /* (548) expression_list ::= expression_list NK_COMMA expr_or_subquery */ - 498, /* (549) column_reference ::= column_name */ - 498, /* (550) column_reference ::= table_name NK_DOT column_name */ - 498, /* (551) column_reference ::= NK_ALIAS */ - 498, /* (552) column_reference ::= table_name NK_DOT NK_ALIAS */ - 497, /* (553) pseudo_column ::= ROWTS */ - 497, /* (554) pseudo_column ::= TBNAME */ - 497, /* (555) pseudo_column ::= table_name NK_DOT TBNAME */ - 497, /* (556) pseudo_column ::= QSTART */ - 497, /* (557) pseudo_column ::= QEND */ - 497, /* (558) pseudo_column ::= QDURATION */ - 497, /* (559) pseudo_column ::= WSTART */ - 497, /* (560) pseudo_column ::= WEND */ - 497, /* (561) pseudo_column ::= WDURATION */ - 497, /* (562) pseudo_column ::= IROWTS */ - 497, /* (563) pseudo_column ::= ISFILLED */ - 497, /* (564) pseudo_column ::= QTAGS */ - 499, /* (565) function_expression ::= function_name NK_LP expression_list NK_RP */ - 499, /* (566) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ - 499, /* (567) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ - 499, /* (568) function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP */ - 499, /* (569) function_expression ::= literal_func */ - 492, /* (570) literal_func ::= noarg_func NK_LP NK_RP */ - 492, /* (571) literal_func ::= NOW */ - 492, /* (572) literal_func ::= TODAY */ - 503, /* (573) noarg_func ::= NOW */ - 503, /* (574) noarg_func ::= TODAY */ - 503, /* (575) noarg_func ::= TIMEZONE */ - 503, /* (576) noarg_func ::= DATABASE */ - 503, /* (577) noarg_func ::= CLIENT_VERSION */ - 503, /* (578) noarg_func ::= SERVER_VERSION */ - 503, /* (579) noarg_func ::= SERVER_STATUS */ - 503, /* (580) noarg_func ::= CURRENT_USER */ - 503, /* (581) noarg_func ::= USER */ - 501, /* (582) star_func ::= COUNT */ - 501, /* (583) star_func ::= FIRST */ - 501, /* (584) star_func ::= LAST */ - 501, /* (585) star_func ::= LAST_ROW */ - 502, /* (586) star_func_para_list ::= NK_STAR */ - 502, /* (587) star_func_para_list ::= other_para_list */ - 504, /* (588) other_para_list ::= star_func_para */ - 504, /* (589) other_para_list ::= other_para_list NK_COMMA star_func_para */ - 505, /* (590) star_func_para ::= expr_or_subquery */ - 505, /* (591) star_func_para ::= table_name NK_DOT NK_STAR */ - 500, /* (592) case_when_expression ::= CASE when_then_list case_when_else_opt END */ - 500, /* (593) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ - 506, /* (594) when_then_list ::= when_then_expr */ - 506, /* (595) when_then_list ::= when_then_list when_then_expr */ - 509, /* (596) when_then_expr ::= WHEN common_expression THEN common_expression */ - 507, /* (597) case_when_else_opt ::= */ - 507, /* (598) case_when_else_opt ::= ELSE common_expression */ - 510, /* (599) predicate ::= expr_or_subquery compare_op expr_or_subquery */ - 510, /* (600) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ - 510, /* (601) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ - 510, /* (602) predicate ::= expr_or_subquery IS NULL */ - 510, /* (603) predicate ::= expr_or_subquery IS NOT NULL */ - 510, /* (604) predicate ::= expr_or_subquery in_op in_predicate_value */ - 511, /* (605) compare_op ::= NK_LT */ - 511, /* (606) compare_op ::= NK_GT */ - 511, /* (607) compare_op ::= NK_LE */ - 511, /* (608) compare_op ::= NK_GE */ - 511, /* (609) compare_op ::= NK_NE */ - 511, /* (610) compare_op ::= NK_EQ */ - 511, /* (611) compare_op ::= LIKE */ - 511, /* (612) compare_op ::= NOT LIKE */ - 511, /* (613) compare_op ::= MATCH */ - 511, /* (614) compare_op ::= NMATCH */ - 511, /* (615) compare_op ::= CONTAINS */ - 512, /* (616) in_op ::= IN */ - 512, /* (617) in_op ::= NOT IN */ - 513, /* (618) in_predicate_value ::= NK_LP literal_list NK_RP */ - 514, /* (619) boolean_value_expression ::= boolean_primary */ - 514, /* (620) boolean_value_expression ::= NOT boolean_primary */ - 514, /* (621) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - 514, /* (622) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - 515, /* (623) boolean_primary ::= predicate */ - 515, /* (624) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - 508, /* (625) common_expression ::= expr_or_subquery */ - 508, /* (626) common_expression ::= boolean_value_expression */ - 516, /* (627) from_clause_opt ::= */ - 516, /* (628) from_clause_opt ::= FROM table_reference_list */ - 517, /* (629) table_reference_list ::= table_reference */ - 517, /* (630) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - 518, /* (631) table_reference ::= table_primary */ - 518, /* (632) table_reference ::= joined_table */ - 519, /* (633) table_primary ::= table_name alias_opt */ - 519, /* (634) table_primary ::= db_name NK_DOT table_name alias_opt */ - 519, /* (635) table_primary ::= subquery alias_opt */ - 519, /* (636) table_primary ::= parenthesized_joined_table */ - 521, /* (637) alias_opt ::= */ - 521, /* (638) alias_opt ::= table_alias */ - 521, /* (639) alias_opt ::= AS table_alias */ - 523, /* (640) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - 523, /* (641) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - 520, /* (642) joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */ - 524, /* (643) join_type ::= */ - 524, /* (644) join_type ::= INNER */ - 524, /* (645) join_type ::= LEFT */ - 524, /* (646) join_type ::= RIGHT */ - 524, /* (647) join_type ::= FULL */ - 525, /* (648) join_subtype ::= */ - 525, /* (649) join_subtype ::= OUTER */ - 525, /* (650) join_subtype ::= SEMI */ - 525, /* (651) join_subtype ::= ANTI */ - 525, /* (652) join_subtype ::= ASOF */ - 525, /* (653) join_subtype ::= WINDOW */ - 526, /* (654) join_on_clause_opt ::= */ - 526, /* (655) join_on_clause_opt ::= ON search_condition */ - 527, /* (656) window_offset_clause_opt ::= */ - 527, /* (657) window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */ - 529, /* (658) window_offset_literal ::= NK_VARIABLE */ - 529, /* (659) window_offset_literal ::= NK_MINUS NK_VARIABLE */ - 528, /* (660) jlimit_clause_opt ::= */ - 528, /* (661) jlimit_clause_opt ::= JLIMIT NK_INTEGER */ - 530, /* (662) query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ - 531, /* (663) hint_list ::= */ - 531, /* (664) hint_list ::= NK_HINT */ - 533, /* (665) tag_mode_opt ::= */ - 533, /* (666) tag_mode_opt ::= TAGS */ - 532, /* (667) set_quantifier_opt ::= */ - 532, /* (668) set_quantifier_opt ::= DISTINCT */ - 532, /* (669) set_quantifier_opt ::= ALL */ - 534, /* (670) select_list ::= select_item */ - 534, /* (671) select_list ::= select_list NK_COMMA select_item */ - 542, /* (672) select_item ::= NK_STAR */ - 542, /* (673) select_item ::= common_expression */ - 542, /* (674) select_item ::= common_expression column_alias */ - 542, /* (675) select_item ::= common_expression AS column_alias */ - 542, /* (676) select_item ::= table_name NK_DOT NK_STAR */ - 469, /* (677) where_clause_opt ::= */ - 469, /* (678) where_clause_opt ::= WHERE search_condition */ - 535, /* (679) partition_by_clause_opt ::= */ - 535, /* (680) partition_by_clause_opt ::= PARTITION BY partition_list */ - 543, /* (681) partition_list ::= partition_item */ - 543, /* (682) partition_list ::= partition_list NK_COMMA partition_item */ - 544, /* (683) partition_item ::= expr_or_subquery */ - 544, /* (684) partition_item ::= expr_or_subquery column_alias */ - 544, /* (685) partition_item ::= expr_or_subquery AS column_alias */ - 539, /* (686) twindow_clause_opt ::= */ - 539, /* (687) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ - 539, /* (688) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ - 539, /* (689) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ - 539, /* (690) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ - 539, /* (691) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ - 539, /* (692) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */ - 539, /* (693) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - 462, /* (694) sliding_opt ::= */ - 462, /* (695) sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ - 545, /* (696) interval_sliding_duration_literal ::= NK_VARIABLE */ - 545, /* (697) interval_sliding_duration_literal ::= NK_STRING */ - 545, /* (698) interval_sliding_duration_literal ::= NK_INTEGER */ - 538, /* (699) fill_opt ::= */ - 538, /* (700) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - 538, /* (701) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ - 538, /* (702) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ - 546, /* (703) fill_mode ::= NONE */ - 546, /* (704) fill_mode ::= PREV */ - 546, /* (705) fill_mode ::= NULL */ - 546, /* (706) fill_mode ::= NULL_F */ - 546, /* (707) fill_mode ::= LINEAR */ - 546, /* (708) fill_mode ::= NEXT */ - 540, /* (709) group_by_clause_opt ::= */ - 540, /* (710) group_by_clause_opt ::= GROUP BY group_by_list */ - 547, /* (711) group_by_list ::= expr_or_subquery */ - 547, /* (712) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ - 541, /* (713) having_clause_opt ::= */ - 541, /* (714) having_clause_opt ::= HAVING search_condition */ - 536, /* (715) range_opt ::= */ - 536, /* (716) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ - 536, /* (717) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ - 537, /* (718) every_opt ::= */ - 537, /* (719) every_opt ::= EVERY NK_LP duration_literal NK_RP */ - 548, /* (720) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ - 549, /* (721) query_simple ::= query_specification */ - 549, /* (722) query_simple ::= union_query_expression */ - 553, /* (723) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ - 553, /* (724) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ - 554, /* (725) query_simple_or_subquery ::= query_simple */ - 554, /* (726) query_simple_or_subquery ::= subquery */ - 468, /* (727) query_or_subquery ::= query_expression */ - 468, /* (728) query_or_subquery ::= subquery */ - 550, /* (729) order_by_clause_opt ::= */ - 550, /* (730) order_by_clause_opt ::= ORDER BY sort_specification_list */ - 551, /* (731) slimit_clause_opt ::= */ - 551, /* (732) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - 551, /* (733) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - 551, /* (734) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - 552, /* (735) limit_clause_opt ::= */ - 552, /* (736) limit_clause_opt ::= LIMIT NK_INTEGER */ - 552, /* (737) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - 552, /* (738) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - 522, /* (739) subquery ::= NK_LP query_expression NK_RP */ - 522, /* (740) subquery ::= NK_LP subquery NK_RP */ - 398, /* (741) search_condition ::= common_expression */ - 555, /* (742) sort_specification_list ::= sort_specification */ - 555, /* (743) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - 556, /* (744) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ - 557, /* (745) ordering_specification_opt ::= */ - 557, /* (746) ordering_specification_opt ::= ASC */ - 557, /* (747) ordering_specification_opt ::= DESC */ - 558, /* (748) null_ordering_opt ::= */ - 558, /* (749) null_ordering_opt ::= NULLS FIRST */ - 558, /* (750) null_ordering_opt ::= NULLS LAST */ - 426, /* (751) column_options ::= */ - 426, /* (752) column_options ::= column_options PRIMARY KEY */ - 426, /* (753) column_options ::= column_options ENCODE NK_STRING */ - 426, /* (754) column_options ::= column_options COMPRESS NK_STRING */ - 426, /* (755) column_options ::= column_options LEVEL NK_STRING */ + 378, /* (183) cmd ::= CREATE TABLE not_exists_opt USING full_table_name NK_LP tag_list_opt NK_RP FILE NK_STRING */ + 378, /* (184) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ + 378, /* (185) cmd ::= DROP TABLE multi_drop_clause */ + 378, /* (186) cmd ::= DROP STABLE exists_opt full_table_name */ + 378, /* (187) cmd ::= ALTER TABLE alter_table_clause */ + 378, /* (188) cmd ::= ALTER STABLE alter_table_clause */ + 423, /* (189) alter_table_clause ::= full_table_name alter_table_options */ + 423, /* (190) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name column_options */ + 423, /* (191) alter_table_clause ::= full_table_name DROP COLUMN column_name */ + 423, /* (192) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ + 423, /* (193) alter_table_clause ::= full_table_name MODIFY COLUMN column_name column_options */ + 423, /* (194) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ + 423, /* (195) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ + 423, /* (196) alter_table_clause ::= full_table_name DROP TAG column_name */ + 423, /* (197) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ + 423, /* (198) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ + 423, /* (199) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ tags_literal */ + 419, /* (200) multi_create_clause ::= create_subtable_clause */ + 419, /* (201) multi_create_clause ::= multi_create_clause create_subtable_clause */ + 429, /* (202) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP tags_literal_list NK_RP table_options */ + 422, /* (203) multi_drop_clause ::= drop_table_clause */ + 422, /* (204) multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ + 432, /* (205) drop_table_clause ::= exists_opt full_table_name */ + 430, /* (206) specific_cols_opt ::= */ + 430, /* (207) specific_cols_opt ::= NK_LP col_name_list NK_RP */ + 415, /* (208) full_table_name ::= table_name */ + 415, /* (209) full_table_name ::= db_name NK_DOT table_name */ + 434, /* (210) tag_def_list ::= tag_def */ + 434, /* (211) tag_def_list ::= tag_def_list NK_COMMA tag_def */ + 435, /* (212) tag_def ::= column_name type_name */ + 416, /* (213) column_def_list ::= column_def */ + 416, /* (214) column_def_list ::= column_def_list NK_COMMA column_def */ + 436, /* (215) column_def ::= column_name type_name column_options */ + 426, /* (216) type_name ::= BOOL */ + 426, /* (217) type_name ::= TINYINT */ + 426, /* (218) type_name ::= SMALLINT */ + 426, /* (219) type_name ::= INT */ + 426, /* (220) type_name ::= INTEGER */ + 426, /* (221) type_name ::= BIGINT */ + 426, /* (222) type_name ::= FLOAT */ + 426, /* (223) type_name ::= DOUBLE */ + 426, /* (224) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ + 426, /* (225) type_name ::= TIMESTAMP */ + 426, /* (226) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ + 426, /* (227) type_name ::= TINYINT UNSIGNED */ + 426, /* (228) type_name ::= SMALLINT UNSIGNED */ + 426, /* (229) type_name ::= INT UNSIGNED */ + 426, /* (230) type_name ::= BIGINT UNSIGNED */ + 426, /* (231) type_name ::= JSON */ + 426, /* (232) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ + 426, /* (233) type_name ::= MEDIUMBLOB */ + 426, /* (234) type_name ::= BLOB */ + 426, /* (235) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ + 426, /* (236) type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ + 426, /* (237) type_name ::= DECIMAL */ + 426, /* (238) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ + 426, /* (239) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + 437, /* (240) type_name_default_len ::= BINARY */ + 437, /* (241) type_name_default_len ::= NCHAR */ + 437, /* (242) type_name_default_len ::= VARCHAR */ + 437, /* (243) type_name_default_len ::= VARBINARY */ + 417, /* (244) tags_def_opt ::= */ + 417, /* (245) tags_def_opt ::= tags_def */ + 421, /* (246) tags_def ::= TAGS NK_LP tag_def_list NK_RP */ + 418, /* (247) table_options ::= */ + 418, /* (248) table_options ::= table_options COMMENT NK_STRING */ + 418, /* (249) table_options ::= table_options MAX_DELAY duration_list */ + 418, /* (250) table_options ::= table_options WATERMARK duration_list */ + 418, /* (251) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ + 418, /* (252) table_options ::= table_options TTL NK_INTEGER */ + 418, /* (253) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ + 418, /* (254) table_options ::= table_options DELETE_MARK duration_list */ + 424, /* (255) alter_table_options ::= alter_table_option */ + 424, /* (256) alter_table_options ::= alter_table_options alter_table_option */ + 440, /* (257) alter_table_option ::= COMMENT NK_STRING */ + 440, /* (258) alter_table_option ::= TTL NK_INTEGER */ + 438, /* (259) duration_list ::= duration_literal */ + 438, /* (260) duration_list ::= duration_list NK_COMMA duration_literal */ + 439, /* (261) rollup_func_list ::= rollup_func_name */ + 439, /* (262) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ + 442, /* (263) rollup_func_name ::= function_name */ + 442, /* (264) rollup_func_name ::= FIRST */ + 442, /* (265) rollup_func_name ::= LAST */ + 433, /* (266) col_name_list ::= col_name */ + 433, /* (267) col_name_list ::= col_name_list NK_COMMA col_name */ + 444, /* (268) col_name ::= column_name */ + 378, /* (269) cmd ::= SHOW DNODES */ + 378, /* (270) cmd ::= SHOW USERS */ + 378, /* (271) cmd ::= SHOW USERS FULL */ + 378, /* (272) cmd ::= SHOW USER PRIVILEGES */ + 378, /* (273) cmd ::= SHOW db_kind_opt DATABASES */ + 378, /* (274) cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */ + 378, /* (275) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ + 378, /* (276) cmd ::= SHOW db_name_cond_opt VGROUPS */ + 378, /* (277) cmd ::= SHOW MNODES */ + 378, /* (278) cmd ::= SHOW QNODES */ + 378, /* (279) cmd ::= SHOW ARBGROUPS */ + 378, /* (280) cmd ::= SHOW FUNCTIONS */ + 378, /* (281) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ + 378, /* (282) cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ + 378, /* (283) cmd ::= SHOW STREAMS */ + 378, /* (284) cmd ::= SHOW ACCOUNTS */ + 378, /* (285) cmd ::= SHOW APPS */ + 378, /* (286) cmd ::= SHOW CONNECTIONS */ + 378, /* (287) cmd ::= SHOW LICENCES */ + 378, /* (288) cmd ::= SHOW GRANTS */ + 378, /* (289) cmd ::= SHOW GRANTS FULL */ + 378, /* (290) cmd ::= SHOW GRANTS LOGS */ + 378, /* (291) cmd ::= SHOW CLUSTER MACHINES */ + 378, /* (292) cmd ::= SHOW CREATE DATABASE db_name */ + 378, /* (293) cmd ::= SHOW CREATE TABLE full_table_name */ + 378, /* (294) cmd ::= SHOW CREATE STABLE full_table_name */ + 378, /* (295) cmd ::= SHOW ENCRYPTIONS */ + 378, /* (296) cmd ::= SHOW QUERIES */ + 378, /* (297) cmd ::= SHOW SCORES */ + 378, /* (298) cmd ::= SHOW TOPICS */ + 378, /* (299) cmd ::= SHOW VARIABLES */ + 378, /* (300) cmd ::= SHOW CLUSTER VARIABLES */ + 378, /* (301) cmd ::= SHOW LOCAL VARIABLES */ + 378, /* (302) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ + 378, /* (303) cmd ::= SHOW BNODES */ + 378, /* (304) cmd ::= SHOW SNODES */ + 378, /* (305) cmd ::= SHOW CLUSTER */ + 378, /* (306) cmd ::= SHOW TRANSACTIONS */ + 378, /* (307) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ + 378, /* (308) cmd ::= SHOW CONSUMERS */ + 378, /* (309) cmd ::= SHOW SUBSCRIPTIONS */ + 378, /* (310) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ + 378, /* (311) cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ + 378, /* (312) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ + 378, /* (313) cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ + 378, /* (314) cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ + 378, /* (315) cmd ::= SHOW VNODES */ + 378, /* (316) cmd ::= SHOW db_name_cond_opt ALIVE */ + 378, /* (317) cmd ::= SHOW CLUSTER ALIVE */ + 378, /* (318) cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt */ + 378, /* (319) cmd ::= SHOW CREATE VIEW full_table_name */ + 378, /* (320) cmd ::= SHOW COMPACTS */ + 378, /* (321) cmd ::= SHOW COMPACT NK_INTEGER */ + 446, /* (322) table_kind_db_name_cond_opt ::= */ + 446, /* (323) table_kind_db_name_cond_opt ::= table_kind */ + 446, /* (324) table_kind_db_name_cond_opt ::= db_name NK_DOT */ + 446, /* (325) table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ + 451, /* (326) table_kind ::= NORMAL */ + 451, /* (327) table_kind ::= CHILD */ + 448, /* (328) db_name_cond_opt ::= */ + 448, /* (329) db_name_cond_opt ::= db_name NK_DOT */ + 447, /* (330) like_pattern_opt ::= */ + 447, /* (331) like_pattern_opt ::= LIKE NK_STRING */ + 449, /* (332) table_name_cond ::= table_name */ + 450, /* (333) from_db_opt ::= */ + 450, /* (334) from_db_opt ::= FROM db_name */ + 420, /* (335) tag_list_opt ::= */ + 420, /* (336) tag_list_opt ::= tag_item */ + 420, /* (337) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ + 452, /* (338) tag_item ::= TBNAME */ + 452, /* (339) tag_item ::= QTAGS */ + 452, /* (340) tag_item ::= column_name */ + 452, /* (341) tag_item ::= column_name column_alias */ + 452, /* (342) tag_item ::= column_name AS column_alias */ + 445, /* (343) db_kind_opt ::= */ + 445, /* (344) db_kind_opt ::= USER */ + 445, /* (345) db_kind_opt ::= SYSTEM */ + 378, /* (346) cmd ::= CREATE TSMA not_exists_opt tsma_name ON full_table_name tsma_func_list INTERVAL NK_LP duration_literal NK_RP */ + 378, /* (347) cmd ::= CREATE RECURSIVE TSMA not_exists_opt tsma_name ON full_table_name INTERVAL NK_LP duration_literal NK_RP */ + 378, /* (348) cmd ::= DROP TSMA exists_opt full_tsma_name */ + 378, /* (349) cmd ::= SHOW db_name_cond_opt TSMAS */ + 456, /* (350) full_tsma_name ::= tsma_name */ + 456, /* (351) full_tsma_name ::= db_name NK_DOT tsma_name */ + 455, /* (352) tsma_func_list ::= FUNCTION NK_LP func_list NK_RP */ + 378, /* (353) cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ + 378, /* (354) cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ + 378, /* (355) cmd ::= DROP INDEX exists_opt full_index_name */ + 459, /* (356) full_index_name ::= index_name */ + 459, /* (357) full_index_name ::= db_name NK_DOT index_name */ + 458, /* (358) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ + 458, /* (359) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */ + 457, /* (360) func_list ::= func */ + 457, /* (361) func_list ::= func_list NK_COMMA func */ + 463, /* (362) func ::= sma_func_name NK_LP expression_list NK_RP */ + 464, /* (363) sma_func_name ::= function_name */ + 464, /* (364) sma_func_name ::= COUNT */ + 464, /* (365) sma_func_name ::= FIRST */ + 464, /* (366) sma_func_name ::= LAST */ + 464, /* (367) sma_func_name ::= LAST_ROW */ + 462, /* (368) sma_stream_opt ::= */ + 462, /* (369) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ + 462, /* (370) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ + 462, /* (371) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ + 466, /* (372) with_meta ::= AS */ + 466, /* (373) with_meta ::= WITH META AS */ + 466, /* (374) with_meta ::= ONLY META AS */ + 378, /* (375) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ + 378, /* (376) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ + 378, /* (377) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ + 378, /* (378) cmd ::= DROP TOPIC exists_opt topic_name */ + 378, /* (379) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ + 378, /* (380) cmd ::= DESC full_table_name */ + 378, /* (381) cmd ::= DESCRIBE full_table_name */ + 378, /* (382) cmd ::= RESET QUERY CACHE */ + 378, /* (383) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ + 378, /* (384) cmd ::= EXPLAIN analyze_opt explain_options insert_query */ + 470, /* (385) analyze_opt ::= */ + 470, /* (386) analyze_opt ::= ANALYZE */ + 471, /* (387) explain_options ::= */ + 471, /* (388) explain_options ::= explain_options VERBOSE NK_BOOL */ + 471, /* (389) explain_options ::= explain_options RATIO NK_FLOAT */ + 378, /* (390) cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ + 378, /* (391) cmd ::= DROP FUNCTION exists_opt function_name */ + 474, /* (392) agg_func_opt ::= */ + 474, /* (393) agg_func_opt ::= AGGREGATE */ + 475, /* (394) bufsize_opt ::= */ + 475, /* (395) bufsize_opt ::= BUFSIZE NK_INTEGER */ + 476, /* (396) language_opt ::= */ + 476, /* (397) language_opt ::= LANGUAGE NK_STRING */ + 473, /* (398) or_replace_opt ::= */ + 473, /* (399) or_replace_opt ::= OR REPLACE */ + 378, /* (400) cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */ + 378, /* (401) cmd ::= DROP VIEW exists_opt full_view_name */ + 477, /* (402) full_view_name ::= view_name */ + 477, /* (403) full_view_name ::= db_name NK_DOT view_name */ + 378, /* (404) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */ + 378, /* (405) cmd ::= DROP STREAM exists_opt stream_name */ + 378, /* (406) cmd ::= PAUSE STREAM exists_opt stream_name */ + 378, /* (407) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ + 481, /* (408) col_list_opt ::= */ + 481, /* (409) col_list_opt ::= NK_LP column_stream_def_list NK_RP */ + 485, /* (410) column_stream_def_list ::= column_stream_def */ + 485, /* (411) column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def */ + 486, /* (412) column_stream_def ::= column_name stream_col_options */ + 487, /* (413) stream_col_options ::= */ + 487, /* (414) stream_col_options ::= stream_col_options PRIMARY KEY */ + 482, /* (415) tag_def_or_ref_opt ::= */ + 482, /* (416) tag_def_or_ref_opt ::= tags_def */ + 482, /* (417) tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP */ + 480, /* (418) stream_options ::= */ + 480, /* (419) stream_options ::= stream_options TRIGGER AT_ONCE */ + 480, /* (420) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ + 480, /* (421) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ + 480, /* (422) stream_options ::= stream_options WATERMARK duration_literal */ + 480, /* (423) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ + 480, /* (424) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ + 480, /* (425) stream_options ::= stream_options DELETE_MARK duration_literal */ + 480, /* (426) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ + 483, /* (427) subtable_opt ::= */ + 483, /* (428) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + 484, /* (429) ignore_opt ::= */ + 484, /* (430) ignore_opt ::= IGNORE UNTREATED */ + 378, /* (431) cmd ::= KILL CONNECTION NK_INTEGER */ + 378, /* (432) cmd ::= KILL QUERY NK_STRING */ + 378, /* (433) cmd ::= KILL TRANSACTION NK_INTEGER */ + 378, /* (434) cmd ::= KILL COMPACT NK_INTEGER */ + 378, /* (435) cmd ::= BALANCE VGROUP */ + 378, /* (436) cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ + 378, /* (437) cmd ::= BALANCE VGROUP LEADER DATABASE db_name */ + 378, /* (438) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + 378, /* (439) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ + 378, /* (440) cmd ::= SPLIT VGROUP NK_INTEGER */ + 489, /* (441) on_vgroup_id ::= */ + 489, /* (442) on_vgroup_id ::= ON NK_INTEGER */ + 490, /* (443) dnode_list ::= DNODE NK_INTEGER */ + 490, /* (444) dnode_list ::= dnode_list DNODE NK_INTEGER */ + 378, /* (445) cmd ::= DELETE FROM full_table_name where_clause_opt */ + 378, /* (446) cmd ::= query_or_subquery */ + 378, /* (447) cmd ::= insert_query */ + 472, /* (448) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ + 472, /* (449) insert_query ::= INSERT INTO full_table_name query_or_subquery */ + 428, /* (450) tags_literal ::= NK_INTEGER */ + 428, /* (451) tags_literal ::= NK_INTEGER NK_PLUS duration_literal */ + 428, /* (452) tags_literal ::= NK_INTEGER NK_MINUS duration_literal */ + 428, /* (453) tags_literal ::= NK_PLUS NK_INTEGER */ + 428, /* (454) tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal */ + 428, /* (455) tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal */ + 428, /* (456) tags_literal ::= NK_MINUS NK_INTEGER */ + 428, /* (457) tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal */ + 428, /* (458) tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal */ + 428, /* (459) tags_literal ::= NK_FLOAT */ + 428, /* (460) tags_literal ::= NK_PLUS NK_FLOAT */ + 428, /* (461) tags_literal ::= NK_MINUS NK_FLOAT */ + 428, /* (462) tags_literal ::= NK_BIN */ + 428, /* (463) tags_literal ::= NK_BIN NK_PLUS duration_literal */ + 428, /* (464) tags_literal ::= NK_BIN NK_MINUS duration_literal */ + 428, /* (465) tags_literal ::= NK_PLUS NK_BIN */ + 428, /* (466) tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal */ + 428, /* (467) tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal */ + 428, /* (468) tags_literal ::= NK_MINUS NK_BIN */ + 428, /* (469) tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal */ + 428, /* (470) tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal */ + 428, /* (471) tags_literal ::= NK_HEX */ + 428, /* (472) tags_literal ::= NK_HEX NK_PLUS duration_literal */ + 428, /* (473) tags_literal ::= NK_HEX NK_MINUS duration_literal */ + 428, /* (474) tags_literal ::= NK_PLUS NK_HEX */ + 428, /* (475) tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal */ + 428, /* (476) tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal */ + 428, /* (477) tags_literal ::= NK_MINUS NK_HEX */ + 428, /* (478) tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal */ + 428, /* (479) tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal */ + 428, /* (480) tags_literal ::= NK_STRING */ + 428, /* (481) tags_literal ::= NK_STRING NK_PLUS duration_literal */ + 428, /* (482) tags_literal ::= NK_STRING NK_MINUS duration_literal */ + 428, /* (483) tags_literal ::= NK_BOOL */ + 428, /* (484) tags_literal ::= NULL */ + 428, /* (485) tags_literal ::= literal_func */ + 428, /* (486) tags_literal ::= literal_func NK_PLUS duration_literal */ + 428, /* (487) tags_literal ::= literal_func NK_MINUS duration_literal */ + 431, /* (488) tags_literal_list ::= tags_literal */ + 431, /* (489) tags_literal_list ::= tags_literal_list NK_COMMA tags_literal */ + 381, /* (490) literal ::= NK_INTEGER */ + 381, /* (491) literal ::= NK_FLOAT */ + 381, /* (492) literal ::= NK_STRING */ + 381, /* (493) literal ::= NK_BOOL */ + 381, /* (494) literal ::= TIMESTAMP NK_STRING */ + 381, /* (495) literal ::= duration_literal */ + 381, /* (496) literal ::= NULL */ + 381, /* (497) literal ::= NK_QUESTION */ + 441, /* (498) duration_literal ::= NK_VARIABLE */ + 412, /* (499) signed ::= NK_INTEGER */ + 412, /* (500) signed ::= NK_PLUS NK_INTEGER */ + 412, /* (501) signed ::= NK_MINUS NK_INTEGER */ + 412, /* (502) signed ::= NK_FLOAT */ + 412, /* (503) signed ::= NK_PLUS NK_FLOAT */ + 412, /* (504) signed ::= NK_MINUS NK_FLOAT */ + 492, /* (505) signed_literal ::= signed */ + 492, /* (506) signed_literal ::= NK_STRING */ + 492, /* (507) signed_literal ::= NK_BOOL */ + 492, /* (508) signed_literal ::= TIMESTAMP NK_STRING */ + 492, /* (509) signed_literal ::= duration_literal */ + 492, /* (510) signed_literal ::= NULL */ + 492, /* (511) signed_literal ::= literal_func */ + 492, /* (512) signed_literal ::= NK_QUESTION */ + 493, /* (513) literal_list ::= signed_literal */ + 493, /* (514) literal_list ::= literal_list NK_COMMA signed_literal */ + 395, /* (515) db_name ::= NK_ID */ + 396, /* (516) table_name ::= NK_ID */ + 425, /* (517) column_name ::= NK_ID */ + 443, /* (518) function_name ::= NK_ID */ + 478, /* (519) view_name ::= NK_ID */ + 494, /* (520) table_alias ::= NK_ID */ + 453, /* (521) column_alias ::= NK_ID */ + 453, /* (522) column_alias ::= NK_ALIAS */ + 388, /* (523) user_name ::= NK_ID */ + 397, /* (524) topic_name ::= NK_ID */ + 479, /* (525) stream_name ::= NK_ID */ + 469, /* (526) cgroup_name ::= NK_ID */ + 460, /* (527) index_name ::= NK_ID */ + 454, /* (528) tsma_name ::= NK_ID */ + 495, /* (529) expr_or_subquery ::= expression */ + 488, /* (530) expression ::= literal */ + 488, /* (531) expression ::= pseudo_column */ + 488, /* (532) expression ::= column_reference */ + 488, /* (533) expression ::= function_expression */ + 488, /* (534) expression ::= case_when_expression */ + 488, /* (535) expression ::= NK_LP expression NK_RP */ + 488, /* (536) expression ::= NK_PLUS expr_or_subquery */ + 488, /* (537) expression ::= NK_MINUS expr_or_subquery */ + 488, /* (538) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ + 488, /* (539) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ + 488, /* (540) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ + 488, /* (541) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ + 488, /* (542) expression ::= expr_or_subquery NK_REM expr_or_subquery */ + 488, /* (543) expression ::= column_reference NK_ARROW NK_STRING */ + 488, /* (544) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ + 488, /* (545) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ + 465, /* (546) expression_list ::= expr_or_subquery */ + 465, /* (547) expression_list ::= expression_list NK_COMMA expr_or_subquery */ + 497, /* (548) column_reference ::= column_name */ + 497, /* (549) column_reference ::= table_name NK_DOT column_name */ + 497, /* (550) column_reference ::= NK_ALIAS */ + 497, /* (551) column_reference ::= table_name NK_DOT NK_ALIAS */ + 496, /* (552) pseudo_column ::= ROWTS */ + 496, /* (553) pseudo_column ::= TBNAME */ + 496, /* (554) pseudo_column ::= table_name NK_DOT TBNAME */ + 496, /* (555) pseudo_column ::= QSTART */ + 496, /* (556) pseudo_column ::= QEND */ + 496, /* (557) pseudo_column ::= QDURATION */ + 496, /* (558) pseudo_column ::= WSTART */ + 496, /* (559) pseudo_column ::= WEND */ + 496, /* (560) pseudo_column ::= WDURATION */ + 496, /* (561) pseudo_column ::= IROWTS */ + 496, /* (562) pseudo_column ::= ISFILLED */ + 496, /* (563) pseudo_column ::= QTAGS */ + 498, /* (564) function_expression ::= function_name NK_LP expression_list NK_RP */ + 498, /* (565) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ + 498, /* (566) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ + 498, /* (567) function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP */ + 498, /* (568) function_expression ::= literal_func */ + 491, /* (569) literal_func ::= noarg_func NK_LP NK_RP */ + 491, /* (570) literal_func ::= NOW */ + 491, /* (571) literal_func ::= TODAY */ + 502, /* (572) noarg_func ::= NOW */ + 502, /* (573) noarg_func ::= TODAY */ + 502, /* (574) noarg_func ::= TIMEZONE */ + 502, /* (575) noarg_func ::= DATABASE */ + 502, /* (576) noarg_func ::= CLIENT_VERSION */ + 502, /* (577) noarg_func ::= SERVER_VERSION */ + 502, /* (578) noarg_func ::= SERVER_STATUS */ + 502, /* (579) noarg_func ::= CURRENT_USER */ + 502, /* (580) noarg_func ::= USER */ + 500, /* (581) star_func ::= COUNT */ + 500, /* (582) star_func ::= FIRST */ + 500, /* (583) star_func ::= LAST */ + 500, /* (584) star_func ::= LAST_ROW */ + 501, /* (585) star_func_para_list ::= NK_STAR */ + 501, /* (586) star_func_para_list ::= other_para_list */ + 503, /* (587) other_para_list ::= star_func_para */ + 503, /* (588) other_para_list ::= other_para_list NK_COMMA star_func_para */ + 504, /* (589) star_func_para ::= expr_or_subquery */ + 504, /* (590) star_func_para ::= table_name NK_DOT NK_STAR */ + 499, /* (591) case_when_expression ::= CASE when_then_list case_when_else_opt END */ + 499, /* (592) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ + 505, /* (593) when_then_list ::= when_then_expr */ + 505, /* (594) when_then_list ::= when_then_list when_then_expr */ + 508, /* (595) when_then_expr ::= WHEN common_expression THEN common_expression */ + 506, /* (596) case_when_else_opt ::= */ + 506, /* (597) case_when_else_opt ::= ELSE common_expression */ + 509, /* (598) predicate ::= expr_or_subquery compare_op expr_or_subquery */ + 509, /* (599) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ + 509, /* (600) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ + 509, /* (601) predicate ::= expr_or_subquery IS NULL */ + 509, /* (602) predicate ::= expr_or_subquery IS NOT NULL */ + 509, /* (603) predicate ::= expr_or_subquery in_op in_predicate_value */ + 510, /* (604) compare_op ::= NK_LT */ + 510, /* (605) compare_op ::= NK_GT */ + 510, /* (606) compare_op ::= NK_LE */ + 510, /* (607) compare_op ::= NK_GE */ + 510, /* (608) compare_op ::= NK_NE */ + 510, /* (609) compare_op ::= NK_EQ */ + 510, /* (610) compare_op ::= LIKE */ + 510, /* (611) compare_op ::= NOT LIKE */ + 510, /* (612) compare_op ::= MATCH */ + 510, /* (613) compare_op ::= NMATCH */ + 510, /* (614) compare_op ::= CONTAINS */ + 511, /* (615) in_op ::= IN */ + 511, /* (616) in_op ::= NOT IN */ + 512, /* (617) in_predicate_value ::= NK_LP literal_list NK_RP */ + 513, /* (618) boolean_value_expression ::= boolean_primary */ + 513, /* (619) boolean_value_expression ::= NOT boolean_primary */ + 513, /* (620) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + 513, /* (621) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + 514, /* (622) boolean_primary ::= predicate */ + 514, /* (623) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + 507, /* (624) common_expression ::= expr_or_subquery */ + 507, /* (625) common_expression ::= boolean_value_expression */ + 515, /* (626) from_clause_opt ::= */ + 515, /* (627) from_clause_opt ::= FROM table_reference_list */ + 516, /* (628) table_reference_list ::= table_reference */ + 516, /* (629) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + 517, /* (630) table_reference ::= table_primary */ + 517, /* (631) table_reference ::= joined_table */ + 518, /* (632) table_primary ::= table_name alias_opt */ + 518, /* (633) table_primary ::= db_name NK_DOT table_name alias_opt */ + 518, /* (634) table_primary ::= subquery alias_opt */ + 518, /* (635) table_primary ::= parenthesized_joined_table */ + 520, /* (636) alias_opt ::= */ + 520, /* (637) alias_opt ::= table_alias */ + 520, /* (638) alias_opt ::= AS table_alias */ + 522, /* (639) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + 522, /* (640) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + 519, /* (641) joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */ + 523, /* (642) join_type ::= */ + 523, /* (643) join_type ::= INNER */ + 523, /* (644) join_type ::= LEFT */ + 523, /* (645) join_type ::= RIGHT */ + 523, /* (646) join_type ::= FULL */ + 524, /* (647) join_subtype ::= */ + 524, /* (648) join_subtype ::= OUTER */ + 524, /* (649) join_subtype ::= SEMI */ + 524, /* (650) join_subtype ::= ANTI */ + 524, /* (651) join_subtype ::= ASOF */ + 524, /* (652) join_subtype ::= WINDOW */ + 525, /* (653) join_on_clause_opt ::= */ + 525, /* (654) join_on_clause_opt ::= ON search_condition */ + 526, /* (655) window_offset_clause_opt ::= */ + 526, /* (656) window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */ + 528, /* (657) window_offset_literal ::= NK_VARIABLE */ + 528, /* (658) window_offset_literal ::= NK_MINUS NK_VARIABLE */ + 527, /* (659) jlimit_clause_opt ::= */ + 527, /* (660) jlimit_clause_opt ::= JLIMIT NK_INTEGER */ + 529, /* (661) query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ + 530, /* (662) hint_list ::= */ + 530, /* (663) hint_list ::= NK_HINT */ + 532, /* (664) tag_mode_opt ::= */ + 532, /* (665) tag_mode_opt ::= TAGS */ + 531, /* (666) set_quantifier_opt ::= */ + 531, /* (667) set_quantifier_opt ::= DISTINCT */ + 531, /* (668) set_quantifier_opt ::= ALL */ + 533, /* (669) select_list ::= select_item */ + 533, /* (670) select_list ::= select_list NK_COMMA select_item */ + 541, /* (671) select_item ::= NK_STAR */ + 541, /* (672) select_item ::= common_expression */ + 541, /* (673) select_item ::= common_expression column_alias */ + 541, /* (674) select_item ::= common_expression AS column_alias */ + 541, /* (675) select_item ::= table_name NK_DOT NK_STAR */ + 468, /* (676) where_clause_opt ::= */ + 468, /* (677) where_clause_opt ::= WHERE search_condition */ + 534, /* (678) partition_by_clause_opt ::= */ + 534, /* (679) partition_by_clause_opt ::= PARTITION BY partition_list */ + 542, /* (680) partition_list ::= partition_item */ + 542, /* (681) partition_list ::= partition_list NK_COMMA partition_item */ + 543, /* (682) partition_item ::= expr_or_subquery */ + 543, /* (683) partition_item ::= expr_or_subquery column_alias */ + 543, /* (684) partition_item ::= expr_or_subquery AS column_alias */ + 538, /* (685) twindow_clause_opt ::= */ + 538, /* (686) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ + 538, /* (687) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ + 538, /* (688) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ + 538, /* (689) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ + 538, /* (690) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ + 538, /* (691) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */ + 538, /* (692) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + 461, /* (693) sliding_opt ::= */ + 461, /* (694) sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ + 544, /* (695) interval_sliding_duration_literal ::= NK_VARIABLE */ + 544, /* (696) interval_sliding_duration_literal ::= NK_STRING */ + 544, /* (697) interval_sliding_duration_literal ::= NK_INTEGER */ + 537, /* (698) fill_opt ::= */ + 537, /* (699) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + 537, /* (700) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ + 537, /* (701) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ + 545, /* (702) fill_mode ::= NONE */ + 545, /* (703) fill_mode ::= PREV */ + 545, /* (704) fill_mode ::= NULL */ + 545, /* (705) fill_mode ::= NULL_F */ + 545, /* (706) fill_mode ::= LINEAR */ + 545, /* (707) fill_mode ::= NEXT */ + 539, /* (708) group_by_clause_opt ::= */ + 539, /* (709) group_by_clause_opt ::= GROUP BY group_by_list */ + 546, /* (710) group_by_list ::= expr_or_subquery */ + 546, /* (711) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ + 540, /* (712) having_clause_opt ::= */ + 540, /* (713) having_clause_opt ::= HAVING search_condition */ + 535, /* (714) range_opt ::= */ + 535, /* (715) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ + 535, /* (716) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ + 536, /* (717) every_opt ::= */ + 536, /* (718) every_opt ::= EVERY NK_LP duration_literal NK_RP */ + 547, /* (719) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ + 548, /* (720) query_simple ::= query_specification */ + 548, /* (721) query_simple ::= union_query_expression */ + 552, /* (722) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ + 552, /* (723) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ + 553, /* (724) query_simple_or_subquery ::= query_simple */ + 553, /* (725) query_simple_or_subquery ::= subquery */ + 467, /* (726) query_or_subquery ::= query_expression */ + 467, /* (727) query_or_subquery ::= subquery */ + 549, /* (728) order_by_clause_opt ::= */ + 549, /* (729) order_by_clause_opt ::= ORDER BY sort_specification_list */ + 550, /* (730) slimit_clause_opt ::= */ + 550, /* (731) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + 550, /* (732) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + 550, /* (733) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + 551, /* (734) limit_clause_opt ::= */ + 551, /* (735) limit_clause_opt ::= LIMIT NK_INTEGER */ + 551, /* (736) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + 551, /* (737) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + 521, /* (738) subquery ::= NK_LP query_expression NK_RP */ + 521, /* (739) subquery ::= NK_LP subquery NK_RP */ + 398, /* (740) search_condition ::= common_expression */ + 554, /* (741) sort_specification_list ::= sort_specification */ + 554, /* (742) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + 555, /* (743) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ + 556, /* (744) ordering_specification_opt ::= */ + 556, /* (745) ordering_specification_opt ::= ASC */ + 556, /* (746) ordering_specification_opt ::= DESC */ + 557, /* (747) null_ordering_opt ::= */ + 557, /* (748) null_ordering_opt ::= NULLS FIRST */ + 557, /* (749) null_ordering_opt ::= NULLS LAST */ + 427, /* (750) column_options ::= */ + 427, /* (751) column_options ::= column_options PRIMARY KEY */ + 427, /* (752) column_options ::= column_options ENCODE NK_STRING */ + 427, /* (753) column_options ::= column_options COMPRESS NK_STRING */ + 427, /* (754) column_options ::= column_options LEVEL NK_STRING */ }; /* For rule J, yyRuleInfoNRhs[J] contains the negative of the number @@ -4970,579 +4948,578 @@ static const signed char yyRuleInfoNRhs[] = { -4, /* (180) end_opt ::= END WITH TIMESTAMP NK_STRING */ -9, /* (181) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ -3, /* (182) cmd ::= CREATE TABLE multi_create_clause */ - -9, /* (183) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ - -3, /* (184) cmd ::= DROP TABLE multi_drop_clause */ - -4, /* (185) cmd ::= DROP STABLE exists_opt full_table_name */ - -3, /* (186) cmd ::= ALTER TABLE alter_table_clause */ - -3, /* (187) cmd ::= ALTER STABLE alter_table_clause */ - -2, /* (188) alter_table_clause ::= full_table_name alter_table_options */ - -6, /* (189) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name column_options */ - -4, /* (190) alter_table_clause ::= full_table_name DROP COLUMN column_name */ - -5, /* (191) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ - -5, /* (192) alter_table_clause ::= full_table_name MODIFY COLUMN column_name column_options */ - -5, /* (193) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ - -5, /* (194) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ - -4, /* (195) alter_table_clause ::= full_table_name DROP TAG column_name */ - -5, /* (196) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ - -5, /* (197) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ - -6, /* (198) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ tags_literal */ - -1, /* (199) multi_create_clause ::= create_subtable_clause */ - -2, /* (200) multi_create_clause ::= multi_create_clause create_subtable_clause */ - -1, /* (201) multi_create_clause ::= create_from_file_clause */ + -10, /* (183) cmd ::= CREATE TABLE not_exists_opt USING full_table_name NK_LP tag_list_opt NK_RP FILE NK_STRING */ + -9, /* (184) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ + -3, /* (185) cmd ::= DROP TABLE multi_drop_clause */ + -4, /* (186) cmd ::= DROP STABLE exists_opt full_table_name */ + -3, /* (187) cmd ::= ALTER TABLE alter_table_clause */ + -3, /* (188) cmd ::= ALTER STABLE alter_table_clause */ + -2, /* (189) alter_table_clause ::= full_table_name alter_table_options */ + -6, /* (190) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name column_options */ + -4, /* (191) alter_table_clause ::= full_table_name DROP COLUMN column_name */ + -5, /* (192) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ + -5, /* (193) alter_table_clause ::= full_table_name MODIFY COLUMN column_name column_options */ + -5, /* (194) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ + -5, /* (195) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ + -4, /* (196) alter_table_clause ::= full_table_name DROP TAG column_name */ + -5, /* (197) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ + -5, /* (198) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ + -6, /* (199) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ tags_literal */ + -1, /* (200) multi_create_clause ::= create_subtable_clause */ + -2, /* (201) multi_create_clause ::= multi_create_clause create_subtable_clause */ -10, /* (202) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP tags_literal_list NK_RP table_options */ - -8, /* (203) create_from_file_clause ::= not_exists_opt USING full_table_name NK_LP tag_list_opt NK_RP FILE NK_STRING */ - -1, /* (204) multi_drop_clause ::= drop_table_clause */ - -3, /* (205) multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ - -2, /* (206) drop_table_clause ::= exists_opt full_table_name */ - 0, /* (207) specific_cols_opt ::= */ - -3, /* (208) specific_cols_opt ::= NK_LP col_name_list NK_RP */ - -1, /* (209) full_table_name ::= table_name */ - -3, /* (210) full_table_name ::= db_name NK_DOT table_name */ - -1, /* (211) tag_def_list ::= tag_def */ - -3, /* (212) tag_def_list ::= tag_def_list NK_COMMA tag_def */ - -2, /* (213) tag_def ::= column_name type_name */ - -1, /* (214) column_def_list ::= column_def */ - -3, /* (215) column_def_list ::= column_def_list NK_COMMA column_def */ - -3, /* (216) column_def ::= column_name type_name column_options */ - -1, /* (217) type_name ::= BOOL */ - -1, /* (218) type_name ::= TINYINT */ - -1, /* (219) type_name ::= SMALLINT */ - -1, /* (220) type_name ::= INT */ - -1, /* (221) type_name ::= INTEGER */ - -1, /* (222) type_name ::= BIGINT */ - -1, /* (223) type_name ::= FLOAT */ - -1, /* (224) type_name ::= DOUBLE */ - -4, /* (225) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ - -1, /* (226) type_name ::= TIMESTAMP */ - -4, /* (227) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ - -2, /* (228) type_name ::= TINYINT UNSIGNED */ - -2, /* (229) type_name ::= SMALLINT UNSIGNED */ - -2, /* (230) type_name ::= INT UNSIGNED */ - -2, /* (231) type_name ::= BIGINT UNSIGNED */ - -1, /* (232) type_name ::= JSON */ - -4, /* (233) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ - -1, /* (234) type_name ::= MEDIUMBLOB */ - -1, /* (235) type_name ::= BLOB */ - -4, /* (236) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ - -4, /* (237) type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ - -1, /* (238) type_name ::= DECIMAL */ - -4, /* (239) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ - -6, /* (240) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - -1, /* (241) type_name_default_len ::= BINARY */ - -1, /* (242) type_name_default_len ::= NCHAR */ - -1, /* (243) type_name_default_len ::= VARCHAR */ - -1, /* (244) type_name_default_len ::= VARBINARY */ - 0, /* (245) tags_def_opt ::= */ - -1, /* (246) tags_def_opt ::= tags_def */ - -4, /* (247) tags_def ::= TAGS NK_LP tag_def_list NK_RP */ - 0, /* (248) table_options ::= */ - -3, /* (249) table_options ::= table_options COMMENT NK_STRING */ - -3, /* (250) table_options ::= table_options MAX_DELAY duration_list */ - -3, /* (251) table_options ::= table_options WATERMARK duration_list */ - -5, /* (252) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ - -3, /* (253) table_options ::= table_options TTL NK_INTEGER */ - -5, /* (254) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ - -3, /* (255) table_options ::= table_options DELETE_MARK duration_list */ - -1, /* (256) alter_table_options ::= alter_table_option */ - -2, /* (257) alter_table_options ::= alter_table_options alter_table_option */ - -2, /* (258) alter_table_option ::= COMMENT NK_STRING */ - -2, /* (259) alter_table_option ::= TTL NK_INTEGER */ - -1, /* (260) duration_list ::= duration_literal */ - -3, /* (261) duration_list ::= duration_list NK_COMMA duration_literal */ - -1, /* (262) rollup_func_list ::= rollup_func_name */ - -3, /* (263) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ - -1, /* (264) rollup_func_name ::= function_name */ - -1, /* (265) rollup_func_name ::= FIRST */ - -1, /* (266) rollup_func_name ::= LAST */ - -1, /* (267) col_name_list ::= col_name */ - -3, /* (268) col_name_list ::= col_name_list NK_COMMA col_name */ - -1, /* (269) col_name ::= column_name */ - -2, /* (270) cmd ::= SHOW DNODES */ - -2, /* (271) cmd ::= SHOW USERS */ - -3, /* (272) cmd ::= SHOW USERS FULL */ - -3, /* (273) cmd ::= SHOW USER PRIVILEGES */ - -3, /* (274) cmd ::= SHOW db_kind_opt DATABASES */ - -4, /* (275) cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */ - -4, /* (276) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ - -3, /* (277) cmd ::= SHOW db_name_cond_opt VGROUPS */ - -2, /* (278) cmd ::= SHOW MNODES */ - -2, /* (279) cmd ::= SHOW QNODES */ - -2, /* (280) cmd ::= SHOW ARBGROUPS */ - -2, /* (281) cmd ::= SHOW FUNCTIONS */ - -5, /* (282) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ - -6, /* (283) cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ - -2, /* (284) cmd ::= SHOW STREAMS */ - -2, /* (285) cmd ::= SHOW ACCOUNTS */ - -2, /* (286) cmd ::= SHOW APPS */ - -2, /* (287) cmd ::= SHOW CONNECTIONS */ - -2, /* (288) cmd ::= SHOW LICENCES */ - -2, /* (289) cmd ::= SHOW GRANTS */ - -3, /* (290) cmd ::= SHOW GRANTS FULL */ - -3, /* (291) cmd ::= SHOW GRANTS LOGS */ - -3, /* (292) cmd ::= SHOW CLUSTER MACHINES */ - -4, /* (293) cmd ::= SHOW CREATE DATABASE db_name */ - -4, /* (294) cmd ::= SHOW CREATE TABLE full_table_name */ - -4, /* (295) cmd ::= SHOW CREATE STABLE full_table_name */ - -2, /* (296) cmd ::= SHOW ENCRYPTIONS */ - -2, /* (297) cmd ::= SHOW QUERIES */ - -2, /* (298) cmd ::= SHOW SCORES */ - -2, /* (299) cmd ::= SHOW TOPICS */ - -2, /* (300) cmd ::= SHOW VARIABLES */ - -3, /* (301) cmd ::= SHOW CLUSTER VARIABLES */ - -3, /* (302) cmd ::= SHOW LOCAL VARIABLES */ - -5, /* (303) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ - -2, /* (304) cmd ::= SHOW BNODES */ - -2, /* (305) cmd ::= SHOW SNODES */ - -2, /* (306) cmd ::= SHOW CLUSTER */ - -2, /* (307) cmd ::= SHOW TRANSACTIONS */ - -4, /* (308) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ - -2, /* (309) cmd ::= SHOW CONSUMERS */ - -2, /* (310) cmd ::= SHOW SUBSCRIPTIONS */ - -5, /* (311) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ - -6, /* (312) cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ - -7, /* (313) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ - -8, /* (314) cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ - -5, /* (315) cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ - -2, /* (316) cmd ::= SHOW VNODES */ - -3, /* (317) cmd ::= SHOW db_name_cond_opt ALIVE */ - -3, /* (318) cmd ::= SHOW CLUSTER ALIVE */ - -4, /* (319) cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt */ - -4, /* (320) cmd ::= SHOW CREATE VIEW full_table_name */ - -2, /* (321) cmd ::= SHOW COMPACTS */ - -3, /* (322) cmd ::= SHOW COMPACT NK_INTEGER */ - 0, /* (323) table_kind_db_name_cond_opt ::= */ - -1, /* (324) table_kind_db_name_cond_opt ::= table_kind */ - -2, /* (325) table_kind_db_name_cond_opt ::= db_name NK_DOT */ - -3, /* (326) table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ - -1, /* (327) table_kind ::= NORMAL */ - -1, /* (328) table_kind ::= CHILD */ - 0, /* (329) db_name_cond_opt ::= */ - -2, /* (330) db_name_cond_opt ::= db_name NK_DOT */ - 0, /* (331) like_pattern_opt ::= */ - -2, /* (332) like_pattern_opt ::= LIKE NK_STRING */ - -1, /* (333) table_name_cond ::= table_name */ - 0, /* (334) from_db_opt ::= */ - -2, /* (335) from_db_opt ::= FROM db_name */ - 0, /* (336) tag_list_opt ::= */ - -1, /* (337) tag_list_opt ::= tag_item */ - -3, /* (338) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ - -1, /* (339) tag_item ::= TBNAME */ - -1, /* (340) tag_item ::= QTAGS */ - -1, /* (341) tag_item ::= column_name */ - -2, /* (342) tag_item ::= column_name column_alias */ - -3, /* (343) tag_item ::= column_name AS column_alias */ - 0, /* (344) db_kind_opt ::= */ - -1, /* (345) db_kind_opt ::= USER */ - -1, /* (346) db_kind_opt ::= SYSTEM */ - -11, /* (347) cmd ::= CREATE TSMA not_exists_opt tsma_name ON full_table_name tsma_func_list INTERVAL NK_LP duration_literal NK_RP */ - -11, /* (348) cmd ::= CREATE RECURSIVE TSMA not_exists_opt tsma_name ON full_table_name INTERVAL NK_LP duration_literal NK_RP */ - -4, /* (349) cmd ::= DROP TSMA exists_opt full_tsma_name */ - -3, /* (350) cmd ::= SHOW db_name_cond_opt TSMAS */ - -1, /* (351) full_tsma_name ::= tsma_name */ - -3, /* (352) full_tsma_name ::= db_name NK_DOT tsma_name */ - -4, /* (353) tsma_func_list ::= FUNCTION NK_LP func_list NK_RP */ - -8, /* (354) cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ - -9, /* (355) cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ - -4, /* (356) cmd ::= DROP INDEX exists_opt full_index_name */ - -1, /* (357) full_index_name ::= index_name */ - -3, /* (358) full_index_name ::= db_name NK_DOT index_name */ - -10, /* (359) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ - -12, /* (360) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */ - -1, /* (361) func_list ::= func */ - -3, /* (362) func_list ::= func_list NK_COMMA func */ - -4, /* (363) func ::= sma_func_name NK_LP expression_list NK_RP */ - -1, /* (364) sma_func_name ::= function_name */ - -1, /* (365) sma_func_name ::= COUNT */ - -1, /* (366) sma_func_name ::= FIRST */ - -1, /* (367) sma_func_name ::= LAST */ - -1, /* (368) sma_func_name ::= LAST_ROW */ - 0, /* (369) sma_stream_opt ::= */ - -3, /* (370) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ - -3, /* (371) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ - -3, /* (372) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ - -1, /* (373) with_meta ::= AS */ - -3, /* (374) with_meta ::= WITH META AS */ - -3, /* (375) with_meta ::= ONLY META AS */ - -6, /* (376) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ - -7, /* (377) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ - -8, /* (378) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ - -4, /* (379) cmd ::= DROP TOPIC exists_opt topic_name */ - -7, /* (380) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ - -2, /* (381) cmd ::= DESC full_table_name */ - -2, /* (382) cmd ::= DESCRIBE full_table_name */ - -3, /* (383) cmd ::= RESET QUERY CACHE */ - -4, /* (384) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ - -4, /* (385) cmd ::= EXPLAIN analyze_opt explain_options insert_query */ - 0, /* (386) analyze_opt ::= */ - -1, /* (387) analyze_opt ::= ANALYZE */ - 0, /* (388) explain_options ::= */ - -3, /* (389) explain_options ::= explain_options VERBOSE NK_BOOL */ - -3, /* (390) explain_options ::= explain_options RATIO NK_FLOAT */ - -12, /* (391) cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ - -4, /* (392) cmd ::= DROP FUNCTION exists_opt function_name */ - 0, /* (393) agg_func_opt ::= */ - -1, /* (394) agg_func_opt ::= AGGREGATE */ - 0, /* (395) bufsize_opt ::= */ - -2, /* (396) bufsize_opt ::= BUFSIZE NK_INTEGER */ - 0, /* (397) language_opt ::= */ - -2, /* (398) language_opt ::= LANGUAGE NK_STRING */ - 0, /* (399) or_replace_opt ::= */ - -2, /* (400) or_replace_opt ::= OR REPLACE */ - -6, /* (401) cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */ - -4, /* (402) cmd ::= DROP VIEW exists_opt full_view_name */ - -1, /* (403) full_view_name ::= view_name */ - -3, /* (404) full_view_name ::= db_name NK_DOT view_name */ - -12, /* (405) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */ - -4, /* (406) cmd ::= DROP STREAM exists_opt stream_name */ - -4, /* (407) cmd ::= PAUSE STREAM exists_opt stream_name */ - -5, /* (408) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ - 0, /* (409) col_list_opt ::= */ - -3, /* (410) col_list_opt ::= NK_LP column_stream_def_list NK_RP */ - -1, /* (411) column_stream_def_list ::= column_stream_def */ - -3, /* (412) column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def */ - -2, /* (413) column_stream_def ::= column_name stream_col_options */ - 0, /* (414) stream_col_options ::= */ - -3, /* (415) stream_col_options ::= stream_col_options PRIMARY KEY */ - 0, /* (416) tag_def_or_ref_opt ::= */ - -1, /* (417) tag_def_or_ref_opt ::= tags_def */ - -4, /* (418) tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP */ - 0, /* (419) stream_options ::= */ - -3, /* (420) stream_options ::= stream_options TRIGGER AT_ONCE */ - -3, /* (421) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ - -4, /* (422) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ - -3, /* (423) stream_options ::= stream_options WATERMARK duration_literal */ - -4, /* (424) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ - -3, /* (425) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ - -3, /* (426) stream_options ::= stream_options DELETE_MARK duration_literal */ - -4, /* (427) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ - 0, /* (428) subtable_opt ::= */ - -4, /* (429) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - 0, /* (430) ignore_opt ::= */ - -2, /* (431) ignore_opt ::= IGNORE UNTREATED */ - -3, /* (432) cmd ::= KILL CONNECTION NK_INTEGER */ - -3, /* (433) cmd ::= KILL QUERY NK_STRING */ - -3, /* (434) cmd ::= KILL TRANSACTION NK_INTEGER */ - -3, /* (435) cmd ::= KILL COMPACT NK_INTEGER */ - -2, /* (436) cmd ::= BALANCE VGROUP */ - -4, /* (437) cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ - -5, /* (438) cmd ::= BALANCE VGROUP LEADER DATABASE db_name */ - -4, /* (439) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ - -4, /* (440) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ - -3, /* (441) cmd ::= SPLIT VGROUP NK_INTEGER */ - 0, /* (442) on_vgroup_id ::= */ - -2, /* (443) on_vgroup_id ::= ON NK_INTEGER */ - -2, /* (444) dnode_list ::= DNODE NK_INTEGER */ - -3, /* (445) dnode_list ::= dnode_list DNODE NK_INTEGER */ - -4, /* (446) cmd ::= DELETE FROM full_table_name where_clause_opt */ - -1, /* (447) cmd ::= query_or_subquery */ - -1, /* (448) cmd ::= insert_query */ - -7, /* (449) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ - -4, /* (450) insert_query ::= INSERT INTO full_table_name query_or_subquery */ - -1, /* (451) tags_literal ::= NK_INTEGER */ - -3, /* (452) tags_literal ::= NK_INTEGER NK_PLUS duration_literal */ - -3, /* (453) tags_literal ::= NK_INTEGER NK_MINUS duration_literal */ - -2, /* (454) tags_literal ::= NK_PLUS NK_INTEGER */ - -4, /* (455) tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal */ - -4, /* (456) tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal */ - -2, /* (457) tags_literal ::= NK_MINUS NK_INTEGER */ - -4, /* (458) tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal */ - -4, /* (459) tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal */ - -1, /* (460) tags_literal ::= NK_FLOAT */ - -2, /* (461) tags_literal ::= NK_PLUS NK_FLOAT */ - -2, /* (462) tags_literal ::= NK_MINUS NK_FLOAT */ - -1, /* (463) tags_literal ::= NK_BIN */ - -3, /* (464) tags_literal ::= NK_BIN NK_PLUS duration_literal */ - -3, /* (465) tags_literal ::= NK_BIN NK_MINUS duration_literal */ - -2, /* (466) tags_literal ::= NK_PLUS NK_BIN */ - -4, /* (467) tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal */ - -4, /* (468) tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal */ - -2, /* (469) tags_literal ::= NK_MINUS NK_BIN */ - -4, /* (470) tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal */ - -4, /* (471) tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal */ - -1, /* (472) tags_literal ::= NK_HEX */ - -3, /* (473) tags_literal ::= NK_HEX NK_PLUS duration_literal */ - -3, /* (474) tags_literal ::= NK_HEX NK_MINUS duration_literal */ - -2, /* (475) tags_literal ::= NK_PLUS NK_HEX */ - -4, /* (476) tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal */ - -4, /* (477) tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal */ - -2, /* (478) tags_literal ::= NK_MINUS NK_HEX */ - -4, /* (479) tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal */ - -4, /* (480) tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal */ - -1, /* (481) tags_literal ::= NK_STRING */ - -3, /* (482) tags_literal ::= NK_STRING NK_PLUS duration_literal */ - -3, /* (483) tags_literal ::= NK_STRING NK_MINUS duration_literal */ - -1, /* (484) tags_literal ::= NK_BOOL */ - -1, /* (485) tags_literal ::= NULL */ - -1, /* (486) tags_literal ::= literal_func */ - -3, /* (487) tags_literal ::= literal_func NK_PLUS duration_literal */ - -3, /* (488) tags_literal ::= literal_func NK_MINUS duration_literal */ - -1, /* (489) tags_literal_list ::= tags_literal */ - -3, /* (490) tags_literal_list ::= tags_literal_list NK_COMMA tags_literal */ - -1, /* (491) literal ::= NK_INTEGER */ - -1, /* (492) literal ::= NK_FLOAT */ - -1, /* (493) literal ::= NK_STRING */ - -1, /* (494) literal ::= NK_BOOL */ - -2, /* (495) literal ::= TIMESTAMP NK_STRING */ - -1, /* (496) literal ::= duration_literal */ - -1, /* (497) literal ::= NULL */ - -1, /* (498) literal ::= NK_QUESTION */ - -1, /* (499) duration_literal ::= NK_VARIABLE */ - -1, /* (500) signed ::= NK_INTEGER */ - -2, /* (501) signed ::= NK_PLUS NK_INTEGER */ - -2, /* (502) signed ::= NK_MINUS NK_INTEGER */ - -1, /* (503) signed ::= NK_FLOAT */ - -2, /* (504) signed ::= NK_PLUS NK_FLOAT */ - -2, /* (505) signed ::= NK_MINUS NK_FLOAT */ - -1, /* (506) signed_literal ::= signed */ - -1, /* (507) signed_literal ::= NK_STRING */ - -1, /* (508) signed_literal ::= NK_BOOL */ - -2, /* (509) signed_literal ::= TIMESTAMP NK_STRING */ - -1, /* (510) signed_literal ::= duration_literal */ - -1, /* (511) signed_literal ::= NULL */ - -1, /* (512) signed_literal ::= literal_func */ - -1, /* (513) signed_literal ::= NK_QUESTION */ - -1, /* (514) literal_list ::= signed_literal */ - -3, /* (515) literal_list ::= literal_list NK_COMMA signed_literal */ - -1, /* (516) db_name ::= NK_ID */ - -1, /* (517) table_name ::= NK_ID */ - -1, /* (518) column_name ::= NK_ID */ - -1, /* (519) function_name ::= NK_ID */ - -1, /* (520) view_name ::= NK_ID */ - -1, /* (521) table_alias ::= NK_ID */ - -1, /* (522) column_alias ::= NK_ID */ - -1, /* (523) column_alias ::= NK_ALIAS */ - -1, /* (524) user_name ::= NK_ID */ - -1, /* (525) topic_name ::= NK_ID */ - -1, /* (526) stream_name ::= NK_ID */ - -1, /* (527) cgroup_name ::= NK_ID */ - -1, /* (528) index_name ::= NK_ID */ - -1, /* (529) tsma_name ::= NK_ID */ - -1, /* (530) expr_or_subquery ::= expression */ - -1, /* (531) expression ::= literal */ - -1, /* (532) expression ::= pseudo_column */ - -1, /* (533) expression ::= column_reference */ - -1, /* (534) expression ::= function_expression */ - -1, /* (535) expression ::= case_when_expression */ - -3, /* (536) expression ::= NK_LP expression NK_RP */ - -2, /* (537) expression ::= NK_PLUS expr_or_subquery */ - -2, /* (538) expression ::= NK_MINUS expr_or_subquery */ - -3, /* (539) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ - -3, /* (540) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ - -3, /* (541) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ - -3, /* (542) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ - -3, /* (543) expression ::= expr_or_subquery NK_REM expr_or_subquery */ - -3, /* (544) expression ::= column_reference NK_ARROW NK_STRING */ - -3, /* (545) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ - -3, /* (546) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ - -1, /* (547) expression_list ::= expr_or_subquery */ - -3, /* (548) expression_list ::= expression_list NK_COMMA expr_or_subquery */ - -1, /* (549) column_reference ::= column_name */ - -3, /* (550) column_reference ::= table_name NK_DOT column_name */ - -1, /* (551) column_reference ::= NK_ALIAS */ - -3, /* (552) column_reference ::= table_name NK_DOT NK_ALIAS */ - -1, /* (553) pseudo_column ::= ROWTS */ - -1, /* (554) pseudo_column ::= TBNAME */ - -3, /* (555) pseudo_column ::= table_name NK_DOT TBNAME */ - -1, /* (556) pseudo_column ::= QSTART */ - -1, /* (557) pseudo_column ::= QEND */ - -1, /* (558) pseudo_column ::= QDURATION */ - -1, /* (559) pseudo_column ::= WSTART */ - -1, /* (560) pseudo_column ::= WEND */ - -1, /* (561) pseudo_column ::= WDURATION */ - -1, /* (562) pseudo_column ::= IROWTS */ - -1, /* (563) pseudo_column ::= ISFILLED */ - -1, /* (564) pseudo_column ::= QTAGS */ - -4, /* (565) function_expression ::= function_name NK_LP expression_list NK_RP */ - -4, /* (566) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ - -6, /* (567) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ - -6, /* (568) function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP */ - -1, /* (569) function_expression ::= literal_func */ - -3, /* (570) literal_func ::= noarg_func NK_LP NK_RP */ - -1, /* (571) literal_func ::= NOW */ - -1, /* (572) literal_func ::= TODAY */ - -1, /* (573) noarg_func ::= NOW */ - -1, /* (574) noarg_func ::= TODAY */ - -1, /* (575) noarg_func ::= TIMEZONE */ - -1, /* (576) noarg_func ::= DATABASE */ - -1, /* (577) noarg_func ::= CLIENT_VERSION */ - -1, /* (578) noarg_func ::= SERVER_VERSION */ - -1, /* (579) noarg_func ::= SERVER_STATUS */ - -1, /* (580) noarg_func ::= CURRENT_USER */ - -1, /* (581) noarg_func ::= USER */ - -1, /* (582) star_func ::= COUNT */ - -1, /* (583) star_func ::= FIRST */ - -1, /* (584) star_func ::= LAST */ - -1, /* (585) star_func ::= LAST_ROW */ - -1, /* (586) star_func_para_list ::= NK_STAR */ - -1, /* (587) star_func_para_list ::= other_para_list */ - -1, /* (588) other_para_list ::= star_func_para */ - -3, /* (589) other_para_list ::= other_para_list NK_COMMA star_func_para */ - -1, /* (590) star_func_para ::= expr_or_subquery */ - -3, /* (591) star_func_para ::= table_name NK_DOT NK_STAR */ - -4, /* (592) case_when_expression ::= CASE when_then_list case_when_else_opt END */ - -5, /* (593) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ - -1, /* (594) when_then_list ::= when_then_expr */ - -2, /* (595) when_then_list ::= when_then_list when_then_expr */ - -4, /* (596) when_then_expr ::= WHEN common_expression THEN common_expression */ - 0, /* (597) case_when_else_opt ::= */ - -2, /* (598) case_when_else_opt ::= ELSE common_expression */ - -3, /* (599) predicate ::= expr_or_subquery compare_op expr_or_subquery */ - -5, /* (600) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ - -6, /* (601) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ - -3, /* (602) predicate ::= expr_or_subquery IS NULL */ - -4, /* (603) predicate ::= expr_or_subquery IS NOT NULL */ - -3, /* (604) predicate ::= expr_or_subquery in_op in_predicate_value */ - -1, /* (605) compare_op ::= NK_LT */ - -1, /* (606) compare_op ::= NK_GT */ - -1, /* (607) compare_op ::= NK_LE */ - -1, /* (608) compare_op ::= NK_GE */ - -1, /* (609) compare_op ::= NK_NE */ - -1, /* (610) compare_op ::= NK_EQ */ - -1, /* (611) compare_op ::= LIKE */ - -2, /* (612) compare_op ::= NOT LIKE */ - -1, /* (613) compare_op ::= MATCH */ - -1, /* (614) compare_op ::= NMATCH */ - -1, /* (615) compare_op ::= CONTAINS */ - -1, /* (616) in_op ::= IN */ - -2, /* (617) in_op ::= NOT IN */ - -3, /* (618) in_predicate_value ::= NK_LP literal_list NK_RP */ - -1, /* (619) boolean_value_expression ::= boolean_primary */ - -2, /* (620) boolean_value_expression ::= NOT boolean_primary */ - -3, /* (621) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - -3, /* (622) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - -1, /* (623) boolean_primary ::= predicate */ - -3, /* (624) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - -1, /* (625) common_expression ::= expr_or_subquery */ - -1, /* (626) common_expression ::= boolean_value_expression */ - 0, /* (627) from_clause_opt ::= */ - -2, /* (628) from_clause_opt ::= FROM table_reference_list */ - -1, /* (629) table_reference_list ::= table_reference */ - -3, /* (630) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - -1, /* (631) table_reference ::= table_primary */ - -1, /* (632) table_reference ::= joined_table */ - -2, /* (633) table_primary ::= table_name alias_opt */ - -4, /* (634) table_primary ::= db_name NK_DOT table_name alias_opt */ - -2, /* (635) table_primary ::= subquery alias_opt */ - -1, /* (636) table_primary ::= parenthesized_joined_table */ - 0, /* (637) alias_opt ::= */ - -1, /* (638) alias_opt ::= table_alias */ - -2, /* (639) alias_opt ::= AS table_alias */ - -3, /* (640) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - -3, /* (641) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - -8, /* (642) joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */ - 0, /* (643) join_type ::= */ - -1, /* (644) join_type ::= INNER */ - -1, /* (645) join_type ::= LEFT */ - -1, /* (646) join_type ::= RIGHT */ - -1, /* (647) join_type ::= FULL */ - 0, /* (648) join_subtype ::= */ - -1, /* (649) join_subtype ::= OUTER */ - -1, /* (650) join_subtype ::= SEMI */ - -1, /* (651) join_subtype ::= ANTI */ - -1, /* (652) join_subtype ::= ASOF */ - -1, /* (653) join_subtype ::= WINDOW */ - 0, /* (654) join_on_clause_opt ::= */ - -2, /* (655) join_on_clause_opt ::= ON search_condition */ - 0, /* (656) window_offset_clause_opt ::= */ - -6, /* (657) window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */ - -1, /* (658) window_offset_literal ::= NK_VARIABLE */ - -2, /* (659) window_offset_literal ::= NK_MINUS NK_VARIABLE */ - 0, /* (660) jlimit_clause_opt ::= */ - -2, /* (661) jlimit_clause_opt ::= JLIMIT NK_INTEGER */ - -14, /* (662) query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ - 0, /* (663) hint_list ::= */ - -1, /* (664) hint_list ::= NK_HINT */ - 0, /* (665) tag_mode_opt ::= */ - -1, /* (666) tag_mode_opt ::= TAGS */ - 0, /* (667) set_quantifier_opt ::= */ - -1, /* (668) set_quantifier_opt ::= DISTINCT */ - -1, /* (669) set_quantifier_opt ::= ALL */ - -1, /* (670) select_list ::= select_item */ - -3, /* (671) select_list ::= select_list NK_COMMA select_item */ - -1, /* (672) select_item ::= NK_STAR */ - -1, /* (673) select_item ::= common_expression */ - -2, /* (674) select_item ::= common_expression column_alias */ - -3, /* (675) select_item ::= common_expression AS column_alias */ - -3, /* (676) select_item ::= table_name NK_DOT NK_STAR */ - 0, /* (677) where_clause_opt ::= */ - -2, /* (678) where_clause_opt ::= WHERE search_condition */ - 0, /* (679) partition_by_clause_opt ::= */ - -3, /* (680) partition_by_clause_opt ::= PARTITION BY partition_list */ - -1, /* (681) partition_list ::= partition_item */ - -3, /* (682) partition_list ::= partition_list NK_COMMA partition_item */ - -1, /* (683) partition_item ::= expr_or_subquery */ - -2, /* (684) partition_item ::= expr_or_subquery column_alias */ - -3, /* (685) partition_item ::= expr_or_subquery AS column_alias */ - 0, /* (686) twindow_clause_opt ::= */ - -6, /* (687) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ - -4, /* (688) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ - -6, /* (689) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ - -8, /* (690) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ - -7, /* (691) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ - -4, /* (692) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */ - -6, /* (693) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - 0, /* (694) sliding_opt ::= */ - -4, /* (695) sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ - -1, /* (696) interval_sliding_duration_literal ::= NK_VARIABLE */ - -1, /* (697) interval_sliding_duration_literal ::= NK_STRING */ - -1, /* (698) interval_sliding_duration_literal ::= NK_INTEGER */ - 0, /* (699) fill_opt ::= */ - -4, /* (700) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - -6, /* (701) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ - -6, /* (702) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ - -1, /* (703) fill_mode ::= NONE */ - -1, /* (704) fill_mode ::= PREV */ - -1, /* (705) fill_mode ::= NULL */ - -1, /* (706) fill_mode ::= NULL_F */ - -1, /* (707) fill_mode ::= LINEAR */ - -1, /* (708) fill_mode ::= NEXT */ - 0, /* (709) group_by_clause_opt ::= */ - -3, /* (710) group_by_clause_opt ::= GROUP BY group_by_list */ - -1, /* (711) group_by_list ::= expr_or_subquery */ - -3, /* (712) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ - 0, /* (713) having_clause_opt ::= */ - -2, /* (714) having_clause_opt ::= HAVING search_condition */ - 0, /* (715) range_opt ::= */ - -6, /* (716) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ - -4, /* (717) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ - 0, /* (718) every_opt ::= */ - -4, /* (719) every_opt ::= EVERY NK_LP duration_literal NK_RP */ - -4, /* (720) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ - -1, /* (721) query_simple ::= query_specification */ - -1, /* (722) query_simple ::= union_query_expression */ - -4, /* (723) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ - -3, /* (724) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ - -1, /* (725) query_simple_or_subquery ::= query_simple */ - -1, /* (726) query_simple_or_subquery ::= subquery */ - -1, /* (727) query_or_subquery ::= query_expression */ - -1, /* (728) query_or_subquery ::= subquery */ - 0, /* (729) order_by_clause_opt ::= */ - -3, /* (730) order_by_clause_opt ::= ORDER BY sort_specification_list */ - 0, /* (731) slimit_clause_opt ::= */ - -2, /* (732) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - -4, /* (733) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - -4, /* (734) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - 0, /* (735) limit_clause_opt ::= */ - -2, /* (736) limit_clause_opt ::= LIMIT NK_INTEGER */ - -4, /* (737) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - -4, /* (738) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - -3, /* (739) subquery ::= NK_LP query_expression NK_RP */ - -3, /* (740) subquery ::= NK_LP subquery NK_RP */ - -1, /* (741) search_condition ::= common_expression */ - -1, /* (742) sort_specification_list ::= sort_specification */ - -3, /* (743) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - -3, /* (744) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ - 0, /* (745) ordering_specification_opt ::= */ - -1, /* (746) ordering_specification_opt ::= ASC */ - -1, /* (747) ordering_specification_opt ::= DESC */ - 0, /* (748) null_ordering_opt ::= */ - -2, /* (749) null_ordering_opt ::= NULLS FIRST */ - -2, /* (750) null_ordering_opt ::= NULLS LAST */ - 0, /* (751) column_options ::= */ - -3, /* (752) column_options ::= column_options PRIMARY KEY */ - -3, /* (753) column_options ::= column_options ENCODE NK_STRING */ - -3, /* (754) column_options ::= column_options COMPRESS NK_STRING */ - -3, /* (755) column_options ::= column_options LEVEL NK_STRING */ + -1, /* (203) multi_drop_clause ::= drop_table_clause */ + -3, /* (204) multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ + -2, /* (205) drop_table_clause ::= exists_opt full_table_name */ + 0, /* (206) specific_cols_opt ::= */ + -3, /* (207) specific_cols_opt ::= NK_LP col_name_list NK_RP */ + -1, /* (208) full_table_name ::= table_name */ + -3, /* (209) full_table_name ::= db_name NK_DOT table_name */ + -1, /* (210) tag_def_list ::= tag_def */ + -3, /* (211) tag_def_list ::= tag_def_list NK_COMMA tag_def */ + -2, /* (212) tag_def ::= column_name type_name */ + -1, /* (213) column_def_list ::= column_def */ + -3, /* (214) column_def_list ::= column_def_list NK_COMMA column_def */ + -3, /* (215) column_def ::= column_name type_name column_options */ + -1, /* (216) type_name ::= BOOL */ + -1, /* (217) type_name ::= TINYINT */ + -1, /* (218) type_name ::= SMALLINT */ + -1, /* (219) type_name ::= INT */ + -1, /* (220) type_name ::= INTEGER */ + -1, /* (221) type_name ::= BIGINT */ + -1, /* (222) type_name ::= FLOAT */ + -1, /* (223) type_name ::= DOUBLE */ + -4, /* (224) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ + -1, /* (225) type_name ::= TIMESTAMP */ + -4, /* (226) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ + -2, /* (227) type_name ::= TINYINT UNSIGNED */ + -2, /* (228) type_name ::= SMALLINT UNSIGNED */ + -2, /* (229) type_name ::= INT UNSIGNED */ + -2, /* (230) type_name ::= BIGINT UNSIGNED */ + -1, /* (231) type_name ::= JSON */ + -4, /* (232) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ + -1, /* (233) type_name ::= MEDIUMBLOB */ + -1, /* (234) type_name ::= BLOB */ + -4, /* (235) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ + -4, /* (236) type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ + -1, /* (237) type_name ::= DECIMAL */ + -4, /* (238) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ + -6, /* (239) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + -1, /* (240) type_name_default_len ::= BINARY */ + -1, /* (241) type_name_default_len ::= NCHAR */ + -1, /* (242) type_name_default_len ::= VARCHAR */ + -1, /* (243) type_name_default_len ::= VARBINARY */ + 0, /* (244) tags_def_opt ::= */ + -1, /* (245) tags_def_opt ::= tags_def */ + -4, /* (246) tags_def ::= TAGS NK_LP tag_def_list NK_RP */ + 0, /* (247) table_options ::= */ + -3, /* (248) table_options ::= table_options COMMENT NK_STRING */ + -3, /* (249) table_options ::= table_options MAX_DELAY duration_list */ + -3, /* (250) table_options ::= table_options WATERMARK duration_list */ + -5, /* (251) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ + -3, /* (252) table_options ::= table_options TTL NK_INTEGER */ + -5, /* (253) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ + -3, /* (254) table_options ::= table_options DELETE_MARK duration_list */ + -1, /* (255) alter_table_options ::= alter_table_option */ + -2, /* (256) alter_table_options ::= alter_table_options alter_table_option */ + -2, /* (257) alter_table_option ::= COMMENT NK_STRING */ + -2, /* (258) alter_table_option ::= TTL NK_INTEGER */ + -1, /* (259) duration_list ::= duration_literal */ + -3, /* (260) duration_list ::= duration_list NK_COMMA duration_literal */ + -1, /* (261) rollup_func_list ::= rollup_func_name */ + -3, /* (262) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ + -1, /* (263) rollup_func_name ::= function_name */ + -1, /* (264) rollup_func_name ::= FIRST */ + -1, /* (265) rollup_func_name ::= LAST */ + -1, /* (266) col_name_list ::= col_name */ + -3, /* (267) col_name_list ::= col_name_list NK_COMMA col_name */ + -1, /* (268) col_name ::= column_name */ + -2, /* (269) cmd ::= SHOW DNODES */ + -2, /* (270) cmd ::= SHOW USERS */ + -3, /* (271) cmd ::= SHOW USERS FULL */ + -3, /* (272) cmd ::= SHOW USER PRIVILEGES */ + -3, /* (273) cmd ::= SHOW db_kind_opt DATABASES */ + -4, /* (274) cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */ + -4, /* (275) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ + -3, /* (276) cmd ::= SHOW db_name_cond_opt VGROUPS */ + -2, /* (277) cmd ::= SHOW MNODES */ + -2, /* (278) cmd ::= SHOW QNODES */ + -2, /* (279) cmd ::= SHOW ARBGROUPS */ + -2, /* (280) cmd ::= SHOW FUNCTIONS */ + -5, /* (281) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ + -6, /* (282) cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ + -2, /* (283) cmd ::= SHOW STREAMS */ + -2, /* (284) cmd ::= SHOW ACCOUNTS */ + -2, /* (285) cmd ::= SHOW APPS */ + -2, /* (286) cmd ::= SHOW CONNECTIONS */ + -2, /* (287) cmd ::= SHOW LICENCES */ + -2, /* (288) cmd ::= SHOW GRANTS */ + -3, /* (289) cmd ::= SHOW GRANTS FULL */ + -3, /* (290) cmd ::= SHOW GRANTS LOGS */ + -3, /* (291) cmd ::= SHOW CLUSTER MACHINES */ + -4, /* (292) cmd ::= SHOW CREATE DATABASE db_name */ + -4, /* (293) cmd ::= SHOW CREATE TABLE full_table_name */ + -4, /* (294) cmd ::= SHOW CREATE STABLE full_table_name */ + -2, /* (295) cmd ::= SHOW ENCRYPTIONS */ + -2, /* (296) cmd ::= SHOW QUERIES */ + -2, /* (297) cmd ::= SHOW SCORES */ + -2, /* (298) cmd ::= SHOW TOPICS */ + -2, /* (299) cmd ::= SHOW VARIABLES */ + -3, /* (300) cmd ::= SHOW CLUSTER VARIABLES */ + -3, /* (301) cmd ::= SHOW LOCAL VARIABLES */ + -5, /* (302) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ + -2, /* (303) cmd ::= SHOW BNODES */ + -2, /* (304) cmd ::= SHOW SNODES */ + -2, /* (305) cmd ::= SHOW CLUSTER */ + -2, /* (306) cmd ::= SHOW TRANSACTIONS */ + -4, /* (307) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ + -2, /* (308) cmd ::= SHOW CONSUMERS */ + -2, /* (309) cmd ::= SHOW SUBSCRIPTIONS */ + -5, /* (310) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ + -6, /* (311) cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ + -7, /* (312) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ + -8, /* (313) cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ + -5, /* (314) cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ + -2, /* (315) cmd ::= SHOW VNODES */ + -3, /* (316) cmd ::= SHOW db_name_cond_opt ALIVE */ + -3, /* (317) cmd ::= SHOW CLUSTER ALIVE */ + -4, /* (318) cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt */ + -4, /* (319) cmd ::= SHOW CREATE VIEW full_table_name */ + -2, /* (320) cmd ::= SHOW COMPACTS */ + -3, /* (321) cmd ::= SHOW COMPACT NK_INTEGER */ + 0, /* (322) table_kind_db_name_cond_opt ::= */ + -1, /* (323) table_kind_db_name_cond_opt ::= table_kind */ + -2, /* (324) table_kind_db_name_cond_opt ::= db_name NK_DOT */ + -3, /* (325) table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ + -1, /* (326) table_kind ::= NORMAL */ + -1, /* (327) table_kind ::= CHILD */ + 0, /* (328) db_name_cond_opt ::= */ + -2, /* (329) db_name_cond_opt ::= db_name NK_DOT */ + 0, /* (330) like_pattern_opt ::= */ + -2, /* (331) like_pattern_opt ::= LIKE NK_STRING */ + -1, /* (332) table_name_cond ::= table_name */ + 0, /* (333) from_db_opt ::= */ + -2, /* (334) from_db_opt ::= FROM db_name */ + 0, /* (335) tag_list_opt ::= */ + -1, /* (336) tag_list_opt ::= tag_item */ + -3, /* (337) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ + -1, /* (338) tag_item ::= TBNAME */ + -1, /* (339) tag_item ::= QTAGS */ + -1, /* (340) tag_item ::= column_name */ + -2, /* (341) tag_item ::= column_name column_alias */ + -3, /* (342) tag_item ::= column_name AS column_alias */ + 0, /* (343) db_kind_opt ::= */ + -1, /* (344) db_kind_opt ::= USER */ + -1, /* (345) db_kind_opt ::= SYSTEM */ + -11, /* (346) cmd ::= CREATE TSMA not_exists_opt tsma_name ON full_table_name tsma_func_list INTERVAL NK_LP duration_literal NK_RP */ + -11, /* (347) cmd ::= CREATE RECURSIVE TSMA not_exists_opt tsma_name ON full_table_name INTERVAL NK_LP duration_literal NK_RP */ + -4, /* (348) cmd ::= DROP TSMA exists_opt full_tsma_name */ + -3, /* (349) cmd ::= SHOW db_name_cond_opt TSMAS */ + -1, /* (350) full_tsma_name ::= tsma_name */ + -3, /* (351) full_tsma_name ::= db_name NK_DOT tsma_name */ + -4, /* (352) tsma_func_list ::= FUNCTION NK_LP func_list NK_RP */ + -8, /* (353) cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ + -9, /* (354) cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ + -4, /* (355) cmd ::= DROP INDEX exists_opt full_index_name */ + -1, /* (356) full_index_name ::= index_name */ + -3, /* (357) full_index_name ::= db_name NK_DOT index_name */ + -10, /* (358) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ + -12, /* (359) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */ + -1, /* (360) func_list ::= func */ + -3, /* (361) func_list ::= func_list NK_COMMA func */ + -4, /* (362) func ::= sma_func_name NK_LP expression_list NK_RP */ + -1, /* (363) sma_func_name ::= function_name */ + -1, /* (364) sma_func_name ::= COUNT */ + -1, /* (365) sma_func_name ::= FIRST */ + -1, /* (366) sma_func_name ::= LAST */ + -1, /* (367) sma_func_name ::= LAST_ROW */ + 0, /* (368) sma_stream_opt ::= */ + -3, /* (369) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ + -3, /* (370) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ + -3, /* (371) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ + -1, /* (372) with_meta ::= AS */ + -3, /* (373) with_meta ::= WITH META AS */ + -3, /* (374) with_meta ::= ONLY META AS */ + -6, /* (375) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ + -7, /* (376) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ + -8, /* (377) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ + -4, /* (378) cmd ::= DROP TOPIC exists_opt topic_name */ + -7, /* (379) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ + -2, /* (380) cmd ::= DESC full_table_name */ + -2, /* (381) cmd ::= DESCRIBE full_table_name */ + -3, /* (382) cmd ::= RESET QUERY CACHE */ + -4, /* (383) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ + -4, /* (384) cmd ::= EXPLAIN analyze_opt explain_options insert_query */ + 0, /* (385) analyze_opt ::= */ + -1, /* (386) analyze_opt ::= ANALYZE */ + 0, /* (387) explain_options ::= */ + -3, /* (388) explain_options ::= explain_options VERBOSE NK_BOOL */ + -3, /* (389) explain_options ::= explain_options RATIO NK_FLOAT */ + -12, /* (390) cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ + -4, /* (391) cmd ::= DROP FUNCTION exists_opt function_name */ + 0, /* (392) agg_func_opt ::= */ + -1, /* (393) agg_func_opt ::= AGGREGATE */ + 0, /* (394) bufsize_opt ::= */ + -2, /* (395) bufsize_opt ::= BUFSIZE NK_INTEGER */ + 0, /* (396) language_opt ::= */ + -2, /* (397) language_opt ::= LANGUAGE NK_STRING */ + 0, /* (398) or_replace_opt ::= */ + -2, /* (399) or_replace_opt ::= OR REPLACE */ + -6, /* (400) cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */ + -4, /* (401) cmd ::= DROP VIEW exists_opt full_view_name */ + -1, /* (402) full_view_name ::= view_name */ + -3, /* (403) full_view_name ::= db_name NK_DOT view_name */ + -12, /* (404) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */ + -4, /* (405) cmd ::= DROP STREAM exists_opt stream_name */ + -4, /* (406) cmd ::= PAUSE STREAM exists_opt stream_name */ + -5, /* (407) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ + 0, /* (408) col_list_opt ::= */ + -3, /* (409) col_list_opt ::= NK_LP column_stream_def_list NK_RP */ + -1, /* (410) column_stream_def_list ::= column_stream_def */ + -3, /* (411) column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def */ + -2, /* (412) column_stream_def ::= column_name stream_col_options */ + 0, /* (413) stream_col_options ::= */ + -3, /* (414) stream_col_options ::= stream_col_options PRIMARY KEY */ + 0, /* (415) tag_def_or_ref_opt ::= */ + -1, /* (416) tag_def_or_ref_opt ::= tags_def */ + -4, /* (417) tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP */ + 0, /* (418) stream_options ::= */ + -3, /* (419) stream_options ::= stream_options TRIGGER AT_ONCE */ + -3, /* (420) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ + -4, /* (421) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ + -3, /* (422) stream_options ::= stream_options WATERMARK duration_literal */ + -4, /* (423) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ + -3, /* (424) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ + -3, /* (425) stream_options ::= stream_options DELETE_MARK duration_literal */ + -4, /* (426) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ + 0, /* (427) subtable_opt ::= */ + -4, /* (428) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + 0, /* (429) ignore_opt ::= */ + -2, /* (430) ignore_opt ::= IGNORE UNTREATED */ + -3, /* (431) cmd ::= KILL CONNECTION NK_INTEGER */ + -3, /* (432) cmd ::= KILL QUERY NK_STRING */ + -3, /* (433) cmd ::= KILL TRANSACTION NK_INTEGER */ + -3, /* (434) cmd ::= KILL COMPACT NK_INTEGER */ + -2, /* (435) cmd ::= BALANCE VGROUP */ + -4, /* (436) cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ + -5, /* (437) cmd ::= BALANCE VGROUP LEADER DATABASE db_name */ + -4, /* (438) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + -4, /* (439) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ + -3, /* (440) cmd ::= SPLIT VGROUP NK_INTEGER */ + 0, /* (441) on_vgroup_id ::= */ + -2, /* (442) on_vgroup_id ::= ON NK_INTEGER */ + -2, /* (443) dnode_list ::= DNODE NK_INTEGER */ + -3, /* (444) dnode_list ::= dnode_list DNODE NK_INTEGER */ + -4, /* (445) cmd ::= DELETE FROM full_table_name where_clause_opt */ + -1, /* (446) cmd ::= query_or_subquery */ + -1, /* (447) cmd ::= insert_query */ + -7, /* (448) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ + -4, /* (449) insert_query ::= INSERT INTO full_table_name query_or_subquery */ + -1, /* (450) tags_literal ::= NK_INTEGER */ + -3, /* (451) tags_literal ::= NK_INTEGER NK_PLUS duration_literal */ + -3, /* (452) tags_literal ::= NK_INTEGER NK_MINUS duration_literal */ + -2, /* (453) tags_literal ::= NK_PLUS NK_INTEGER */ + -4, /* (454) tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal */ + -4, /* (455) tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal */ + -2, /* (456) tags_literal ::= NK_MINUS NK_INTEGER */ + -4, /* (457) tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal */ + -4, /* (458) tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal */ + -1, /* (459) tags_literal ::= NK_FLOAT */ + -2, /* (460) tags_literal ::= NK_PLUS NK_FLOAT */ + -2, /* (461) tags_literal ::= NK_MINUS NK_FLOAT */ + -1, /* (462) tags_literal ::= NK_BIN */ + -3, /* (463) tags_literal ::= NK_BIN NK_PLUS duration_literal */ + -3, /* (464) tags_literal ::= NK_BIN NK_MINUS duration_literal */ + -2, /* (465) tags_literal ::= NK_PLUS NK_BIN */ + -4, /* (466) tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal */ + -4, /* (467) tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal */ + -2, /* (468) tags_literal ::= NK_MINUS NK_BIN */ + -4, /* (469) tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal */ + -4, /* (470) tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal */ + -1, /* (471) tags_literal ::= NK_HEX */ + -3, /* (472) tags_literal ::= NK_HEX NK_PLUS duration_literal */ + -3, /* (473) tags_literal ::= NK_HEX NK_MINUS duration_literal */ + -2, /* (474) tags_literal ::= NK_PLUS NK_HEX */ + -4, /* (475) tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal */ + -4, /* (476) tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal */ + -2, /* (477) tags_literal ::= NK_MINUS NK_HEX */ + -4, /* (478) tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal */ + -4, /* (479) tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal */ + -1, /* (480) tags_literal ::= NK_STRING */ + -3, /* (481) tags_literal ::= NK_STRING NK_PLUS duration_literal */ + -3, /* (482) tags_literal ::= NK_STRING NK_MINUS duration_literal */ + -1, /* (483) tags_literal ::= NK_BOOL */ + -1, /* (484) tags_literal ::= NULL */ + -1, /* (485) tags_literal ::= literal_func */ + -3, /* (486) tags_literal ::= literal_func NK_PLUS duration_literal */ + -3, /* (487) tags_literal ::= literal_func NK_MINUS duration_literal */ + -1, /* (488) tags_literal_list ::= tags_literal */ + -3, /* (489) tags_literal_list ::= tags_literal_list NK_COMMA tags_literal */ + -1, /* (490) literal ::= NK_INTEGER */ + -1, /* (491) literal ::= NK_FLOAT */ + -1, /* (492) literal ::= NK_STRING */ + -1, /* (493) literal ::= NK_BOOL */ + -2, /* (494) literal ::= TIMESTAMP NK_STRING */ + -1, /* (495) literal ::= duration_literal */ + -1, /* (496) literal ::= NULL */ + -1, /* (497) literal ::= NK_QUESTION */ + -1, /* (498) duration_literal ::= NK_VARIABLE */ + -1, /* (499) signed ::= NK_INTEGER */ + -2, /* (500) signed ::= NK_PLUS NK_INTEGER */ + -2, /* (501) signed ::= NK_MINUS NK_INTEGER */ + -1, /* (502) signed ::= NK_FLOAT */ + -2, /* (503) signed ::= NK_PLUS NK_FLOAT */ + -2, /* (504) signed ::= NK_MINUS NK_FLOAT */ + -1, /* (505) signed_literal ::= signed */ + -1, /* (506) signed_literal ::= NK_STRING */ + -1, /* (507) signed_literal ::= NK_BOOL */ + -2, /* (508) signed_literal ::= TIMESTAMP NK_STRING */ + -1, /* (509) signed_literal ::= duration_literal */ + -1, /* (510) signed_literal ::= NULL */ + -1, /* (511) signed_literal ::= literal_func */ + -1, /* (512) signed_literal ::= NK_QUESTION */ + -1, /* (513) literal_list ::= signed_literal */ + -3, /* (514) literal_list ::= literal_list NK_COMMA signed_literal */ + -1, /* (515) db_name ::= NK_ID */ + -1, /* (516) table_name ::= NK_ID */ + -1, /* (517) column_name ::= NK_ID */ + -1, /* (518) function_name ::= NK_ID */ + -1, /* (519) view_name ::= NK_ID */ + -1, /* (520) table_alias ::= NK_ID */ + -1, /* (521) column_alias ::= NK_ID */ + -1, /* (522) column_alias ::= NK_ALIAS */ + -1, /* (523) user_name ::= NK_ID */ + -1, /* (524) topic_name ::= NK_ID */ + -1, /* (525) stream_name ::= NK_ID */ + -1, /* (526) cgroup_name ::= NK_ID */ + -1, /* (527) index_name ::= NK_ID */ + -1, /* (528) tsma_name ::= NK_ID */ + -1, /* (529) expr_or_subquery ::= expression */ + -1, /* (530) expression ::= literal */ + -1, /* (531) expression ::= pseudo_column */ + -1, /* (532) expression ::= column_reference */ + -1, /* (533) expression ::= function_expression */ + -1, /* (534) expression ::= case_when_expression */ + -3, /* (535) expression ::= NK_LP expression NK_RP */ + -2, /* (536) expression ::= NK_PLUS expr_or_subquery */ + -2, /* (537) expression ::= NK_MINUS expr_or_subquery */ + -3, /* (538) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ + -3, /* (539) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ + -3, /* (540) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ + -3, /* (541) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ + -3, /* (542) expression ::= expr_or_subquery NK_REM expr_or_subquery */ + -3, /* (543) expression ::= column_reference NK_ARROW NK_STRING */ + -3, /* (544) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ + -3, /* (545) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ + -1, /* (546) expression_list ::= expr_or_subquery */ + -3, /* (547) expression_list ::= expression_list NK_COMMA expr_or_subquery */ + -1, /* (548) column_reference ::= column_name */ + -3, /* (549) column_reference ::= table_name NK_DOT column_name */ + -1, /* (550) column_reference ::= NK_ALIAS */ + -3, /* (551) column_reference ::= table_name NK_DOT NK_ALIAS */ + -1, /* (552) pseudo_column ::= ROWTS */ + -1, /* (553) pseudo_column ::= TBNAME */ + -3, /* (554) pseudo_column ::= table_name NK_DOT TBNAME */ + -1, /* (555) pseudo_column ::= QSTART */ + -1, /* (556) pseudo_column ::= QEND */ + -1, /* (557) pseudo_column ::= QDURATION */ + -1, /* (558) pseudo_column ::= WSTART */ + -1, /* (559) pseudo_column ::= WEND */ + -1, /* (560) pseudo_column ::= WDURATION */ + -1, /* (561) pseudo_column ::= IROWTS */ + -1, /* (562) pseudo_column ::= ISFILLED */ + -1, /* (563) pseudo_column ::= QTAGS */ + -4, /* (564) function_expression ::= function_name NK_LP expression_list NK_RP */ + -4, /* (565) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ + -6, /* (566) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ + -6, /* (567) function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP */ + -1, /* (568) function_expression ::= literal_func */ + -3, /* (569) literal_func ::= noarg_func NK_LP NK_RP */ + -1, /* (570) literal_func ::= NOW */ + -1, /* (571) literal_func ::= TODAY */ + -1, /* (572) noarg_func ::= NOW */ + -1, /* (573) noarg_func ::= TODAY */ + -1, /* (574) noarg_func ::= TIMEZONE */ + -1, /* (575) noarg_func ::= DATABASE */ + -1, /* (576) noarg_func ::= CLIENT_VERSION */ + -1, /* (577) noarg_func ::= SERVER_VERSION */ + -1, /* (578) noarg_func ::= SERVER_STATUS */ + -1, /* (579) noarg_func ::= CURRENT_USER */ + -1, /* (580) noarg_func ::= USER */ + -1, /* (581) star_func ::= COUNT */ + -1, /* (582) star_func ::= FIRST */ + -1, /* (583) star_func ::= LAST */ + -1, /* (584) star_func ::= LAST_ROW */ + -1, /* (585) star_func_para_list ::= NK_STAR */ + -1, /* (586) star_func_para_list ::= other_para_list */ + -1, /* (587) other_para_list ::= star_func_para */ + -3, /* (588) other_para_list ::= other_para_list NK_COMMA star_func_para */ + -1, /* (589) star_func_para ::= expr_or_subquery */ + -3, /* (590) star_func_para ::= table_name NK_DOT NK_STAR */ + -4, /* (591) case_when_expression ::= CASE when_then_list case_when_else_opt END */ + -5, /* (592) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ + -1, /* (593) when_then_list ::= when_then_expr */ + -2, /* (594) when_then_list ::= when_then_list when_then_expr */ + -4, /* (595) when_then_expr ::= WHEN common_expression THEN common_expression */ + 0, /* (596) case_when_else_opt ::= */ + -2, /* (597) case_when_else_opt ::= ELSE common_expression */ + -3, /* (598) predicate ::= expr_or_subquery compare_op expr_or_subquery */ + -5, /* (599) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ + -6, /* (600) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ + -3, /* (601) predicate ::= expr_or_subquery IS NULL */ + -4, /* (602) predicate ::= expr_or_subquery IS NOT NULL */ + -3, /* (603) predicate ::= expr_or_subquery in_op in_predicate_value */ + -1, /* (604) compare_op ::= NK_LT */ + -1, /* (605) compare_op ::= NK_GT */ + -1, /* (606) compare_op ::= NK_LE */ + -1, /* (607) compare_op ::= NK_GE */ + -1, /* (608) compare_op ::= NK_NE */ + -1, /* (609) compare_op ::= NK_EQ */ + -1, /* (610) compare_op ::= LIKE */ + -2, /* (611) compare_op ::= NOT LIKE */ + -1, /* (612) compare_op ::= MATCH */ + -1, /* (613) compare_op ::= NMATCH */ + -1, /* (614) compare_op ::= CONTAINS */ + -1, /* (615) in_op ::= IN */ + -2, /* (616) in_op ::= NOT IN */ + -3, /* (617) in_predicate_value ::= NK_LP literal_list NK_RP */ + -1, /* (618) boolean_value_expression ::= boolean_primary */ + -2, /* (619) boolean_value_expression ::= NOT boolean_primary */ + -3, /* (620) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + -3, /* (621) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + -1, /* (622) boolean_primary ::= predicate */ + -3, /* (623) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + -1, /* (624) common_expression ::= expr_or_subquery */ + -1, /* (625) common_expression ::= boolean_value_expression */ + 0, /* (626) from_clause_opt ::= */ + -2, /* (627) from_clause_opt ::= FROM table_reference_list */ + -1, /* (628) table_reference_list ::= table_reference */ + -3, /* (629) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + -1, /* (630) table_reference ::= table_primary */ + -1, /* (631) table_reference ::= joined_table */ + -2, /* (632) table_primary ::= table_name alias_opt */ + -4, /* (633) table_primary ::= db_name NK_DOT table_name alias_opt */ + -2, /* (634) table_primary ::= subquery alias_opt */ + -1, /* (635) table_primary ::= parenthesized_joined_table */ + 0, /* (636) alias_opt ::= */ + -1, /* (637) alias_opt ::= table_alias */ + -2, /* (638) alias_opt ::= AS table_alias */ + -3, /* (639) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + -3, /* (640) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + -8, /* (641) joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */ + 0, /* (642) join_type ::= */ + -1, /* (643) join_type ::= INNER */ + -1, /* (644) join_type ::= LEFT */ + -1, /* (645) join_type ::= RIGHT */ + -1, /* (646) join_type ::= FULL */ + 0, /* (647) join_subtype ::= */ + -1, /* (648) join_subtype ::= OUTER */ + -1, /* (649) join_subtype ::= SEMI */ + -1, /* (650) join_subtype ::= ANTI */ + -1, /* (651) join_subtype ::= ASOF */ + -1, /* (652) join_subtype ::= WINDOW */ + 0, /* (653) join_on_clause_opt ::= */ + -2, /* (654) join_on_clause_opt ::= ON search_condition */ + 0, /* (655) window_offset_clause_opt ::= */ + -6, /* (656) window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */ + -1, /* (657) window_offset_literal ::= NK_VARIABLE */ + -2, /* (658) window_offset_literal ::= NK_MINUS NK_VARIABLE */ + 0, /* (659) jlimit_clause_opt ::= */ + -2, /* (660) jlimit_clause_opt ::= JLIMIT NK_INTEGER */ + -14, /* (661) query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ + 0, /* (662) hint_list ::= */ + -1, /* (663) hint_list ::= NK_HINT */ + 0, /* (664) tag_mode_opt ::= */ + -1, /* (665) tag_mode_opt ::= TAGS */ + 0, /* (666) set_quantifier_opt ::= */ + -1, /* (667) set_quantifier_opt ::= DISTINCT */ + -1, /* (668) set_quantifier_opt ::= ALL */ + -1, /* (669) select_list ::= select_item */ + -3, /* (670) select_list ::= select_list NK_COMMA select_item */ + -1, /* (671) select_item ::= NK_STAR */ + -1, /* (672) select_item ::= common_expression */ + -2, /* (673) select_item ::= common_expression column_alias */ + -3, /* (674) select_item ::= common_expression AS column_alias */ + -3, /* (675) select_item ::= table_name NK_DOT NK_STAR */ + 0, /* (676) where_clause_opt ::= */ + -2, /* (677) where_clause_opt ::= WHERE search_condition */ + 0, /* (678) partition_by_clause_opt ::= */ + -3, /* (679) partition_by_clause_opt ::= PARTITION BY partition_list */ + -1, /* (680) partition_list ::= partition_item */ + -3, /* (681) partition_list ::= partition_list NK_COMMA partition_item */ + -1, /* (682) partition_item ::= expr_or_subquery */ + -2, /* (683) partition_item ::= expr_or_subquery column_alias */ + -3, /* (684) partition_item ::= expr_or_subquery AS column_alias */ + 0, /* (685) twindow_clause_opt ::= */ + -6, /* (686) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ + -4, /* (687) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ + -6, /* (688) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ + -8, /* (689) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ + -7, /* (690) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ + -4, /* (691) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */ + -6, /* (692) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + 0, /* (693) sliding_opt ::= */ + -4, /* (694) sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ + -1, /* (695) interval_sliding_duration_literal ::= NK_VARIABLE */ + -1, /* (696) interval_sliding_duration_literal ::= NK_STRING */ + -1, /* (697) interval_sliding_duration_literal ::= NK_INTEGER */ + 0, /* (698) fill_opt ::= */ + -4, /* (699) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + -6, /* (700) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ + -6, /* (701) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ + -1, /* (702) fill_mode ::= NONE */ + -1, /* (703) fill_mode ::= PREV */ + -1, /* (704) fill_mode ::= NULL */ + -1, /* (705) fill_mode ::= NULL_F */ + -1, /* (706) fill_mode ::= LINEAR */ + -1, /* (707) fill_mode ::= NEXT */ + 0, /* (708) group_by_clause_opt ::= */ + -3, /* (709) group_by_clause_opt ::= GROUP BY group_by_list */ + -1, /* (710) group_by_list ::= expr_or_subquery */ + -3, /* (711) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ + 0, /* (712) having_clause_opt ::= */ + -2, /* (713) having_clause_opt ::= HAVING search_condition */ + 0, /* (714) range_opt ::= */ + -6, /* (715) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ + -4, /* (716) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ + 0, /* (717) every_opt ::= */ + -4, /* (718) every_opt ::= EVERY NK_LP duration_literal NK_RP */ + -4, /* (719) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ + -1, /* (720) query_simple ::= query_specification */ + -1, /* (721) query_simple ::= union_query_expression */ + -4, /* (722) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ + -3, /* (723) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ + -1, /* (724) query_simple_or_subquery ::= query_simple */ + -1, /* (725) query_simple_or_subquery ::= subquery */ + -1, /* (726) query_or_subquery ::= query_expression */ + -1, /* (727) query_or_subquery ::= subquery */ + 0, /* (728) order_by_clause_opt ::= */ + -3, /* (729) order_by_clause_opt ::= ORDER BY sort_specification_list */ + 0, /* (730) slimit_clause_opt ::= */ + -2, /* (731) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + -4, /* (732) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + -4, /* (733) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + 0, /* (734) limit_clause_opt ::= */ + -2, /* (735) limit_clause_opt ::= LIMIT NK_INTEGER */ + -4, /* (736) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + -4, /* (737) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + -3, /* (738) subquery ::= NK_LP query_expression NK_RP */ + -3, /* (739) subquery ::= NK_LP subquery NK_RP */ + -1, /* (740) search_condition ::= common_expression */ + -1, /* (741) sort_specification_list ::= sort_specification */ + -3, /* (742) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + -3, /* (743) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ + 0, /* (744) ordering_specification_opt ::= */ + -1, /* (745) ordering_specification_opt ::= ASC */ + -1, /* (746) ordering_specification_opt ::= DESC */ + 0, /* (747) null_ordering_opt ::= */ + -2, /* (748) null_ordering_opt ::= NULLS FIRST */ + -2, /* (749) null_ordering_opt ::= NULLS LAST */ + 0, /* (750) column_options ::= */ + -3, /* (751) column_options ::= column_options PRIMARY KEY */ + -3, /* (752) column_options ::= column_options ENCODE NK_STRING */ + -3, /* (753) column_options ::= column_options COMPRESS NK_STRING */ + -3, /* (754) column_options ::= column_options LEVEL NK_STRING */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -5587,19 +5564,19 @@ static YYACTIONTYPE yy_reduce( case 0: /* cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ #line 50 "sql.y" { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } -#line 5590 "sql.c" +#line 5567 "sql.c" yy_destructor(yypParser,379,&yymsp[0].minor); break; case 1: /* cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ #line 51 "sql.y" { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } -#line 5596 "sql.c" +#line 5573 "sql.c" yy_destructor(yypParser,380,&yymsp[0].minor); break; case 2: /* account_options ::= */ #line 55 "sql.y" { } -#line 5602 "sql.c" +#line 5579 "sql.c" break; case 3: /* account_options ::= account_options PPS literal */ case 4: /* account_options ::= account_options TSERIES literal */ yytestcase(yyruleno==4); @@ -5613,7 +5590,7 @@ static YYACTIONTYPE yy_reduce( { yy_destructor(yypParser,379,&yymsp[-2].minor); #line 56 "sql.y" { } -#line 5616 "sql.c" +#line 5593 "sql.c" yy_destructor(yypParser,381,&yymsp[0].minor); } break; @@ -5621,14 +5598,14 @@ static YYACTIONTYPE yy_reduce( { yy_destructor(yypParser,382,&yymsp[0].minor); #line 68 "sql.y" { } -#line 5624 "sql.c" +#line 5601 "sql.c" } break; case 13: /* alter_account_options ::= alter_account_options alter_account_option */ { yy_destructor(yypParser,380,&yymsp[-1].minor); #line 69 "sql.y" { } -#line 5631 "sql.c" +#line 5608 "sql.c" yy_destructor(yypParser,382,&yymsp[0].minor); } break; @@ -5644,3054 +5621,3052 @@ static YYACTIONTYPE yy_reduce( case 23: /* alter_account_option ::= STATE literal */ yytestcase(yyruleno==23); #line 73 "sql.y" { } -#line 5647 "sql.c" +#line 5624 "sql.c" yy_destructor(yypParser,381,&yymsp[0].minor); break; case 24: /* ip_range_list ::= NK_STRING */ #line 86 "sql.y" -{ yylhsminor.yy652 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } -#line 5653 "sql.c" - yymsp[0].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy316 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } +#line 5630 "sql.c" + yymsp[0].minor.yy316 = yylhsminor.yy316; break; case 25: /* ip_range_list ::= ip_range_list NK_COMMA NK_STRING */ #line 87 "sql.y" -{ yylhsminor.yy652 = addNodeToList(pCxt, yymsp[-2].minor.yy652, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } -#line 5659 "sql.c" - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy316 = addNodeToList(pCxt, yymsp[-2].minor.yy316, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } +#line 5636 "sql.c" + yymsp[-2].minor.yy316 = yylhsminor.yy316; break; case 26: /* white_list ::= HOST ip_range_list */ #line 91 "sql.y" -{ yymsp[-1].minor.yy652 = yymsp[0].minor.yy652; } -#line 5665 "sql.c" +{ yymsp[-1].minor.yy316 = yymsp[0].minor.yy316; } +#line 5642 "sql.c" break; case 27: /* white_list_opt ::= */ - case 207: /* specific_cols_opt ::= */ yytestcase(yyruleno==207); - case 245: /* tags_def_opt ::= */ yytestcase(yyruleno==245); - case 336: /* tag_list_opt ::= */ yytestcase(yyruleno==336); - case 409: /* col_list_opt ::= */ yytestcase(yyruleno==409); - case 416: /* tag_def_or_ref_opt ::= */ yytestcase(yyruleno==416); - case 679: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==679); - case 709: /* group_by_clause_opt ::= */ yytestcase(yyruleno==709); - case 729: /* order_by_clause_opt ::= */ yytestcase(yyruleno==729); + case 206: /* specific_cols_opt ::= */ yytestcase(yyruleno==206); + case 244: /* tags_def_opt ::= */ yytestcase(yyruleno==244); + case 335: /* tag_list_opt ::= */ yytestcase(yyruleno==335); + case 408: /* col_list_opt ::= */ yytestcase(yyruleno==408); + case 415: /* tag_def_or_ref_opt ::= */ yytestcase(yyruleno==415); + case 678: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==678); + case 708: /* group_by_clause_opt ::= */ yytestcase(yyruleno==708); + case 728: /* order_by_clause_opt ::= */ yytestcase(yyruleno==728); #line 95 "sql.y" -{ yymsp[1].minor.yy652 = NULL; } -#line 5678 "sql.c" +{ yymsp[1].minor.yy316 = NULL; } +#line 5655 "sql.c" break; case 28: /* white_list_opt ::= white_list */ - case 246: /* tags_def_opt ::= tags_def */ yytestcase(yyruleno==246); - case 417: /* tag_def_or_ref_opt ::= tags_def */ yytestcase(yyruleno==417); - case 587: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==587); + case 245: /* tags_def_opt ::= tags_def */ yytestcase(yyruleno==245); + case 416: /* tag_def_or_ref_opt ::= tags_def */ yytestcase(yyruleno==416); + case 586: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==586); #line 96 "sql.y" -{ yylhsminor.yy652 = yymsp[0].minor.yy652; } -#line 5686 "sql.c" - yymsp[0].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy316 = yymsp[0].minor.yy316; } +#line 5663 "sql.c" + yymsp[0].minor.yy316 = yylhsminor.yy316; break; case 29: /* is_import_opt ::= */ case 31: /* is_createdb_opt ::= */ yytestcase(yyruleno==31); #line 100 "sql.y" -{ yymsp[1].minor.yy535 = 0; } -#line 5693 "sql.c" +{ yymsp[1].minor.yy1043 = 0; } +#line 5670 "sql.c" break; case 30: /* is_import_opt ::= IS_IMPORT NK_INTEGER */ case 32: /* is_createdb_opt ::= CREATEDB NK_INTEGER */ yytestcase(yyruleno==32); case 42: /* sysinfo_opt ::= SYSINFO NK_INTEGER */ yytestcase(yyruleno==42); #line 101 "sql.y" -{ yymsp[-1].minor.yy535 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } -#line 5700 "sql.c" +{ yymsp[-1].minor.yy1043 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } +#line 5677 "sql.c" break; case 33: /* cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt is_createdb_opt is_import_opt white_list_opt */ #line 109 "sql.y" { - pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-6].minor.yy837, &yymsp[-4].minor.yy0, yymsp[-3].minor.yy535, yymsp[-1].minor.yy535, yymsp[-2].minor.yy535); - pCxt->pRootNode = addCreateUserStmtWhiteList(pCxt, pCxt->pRootNode, yymsp[0].minor.yy652); + pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-6].minor.yy1109, &yymsp[-4].minor.yy0, yymsp[-3].minor.yy1043, yymsp[-1].minor.yy1043, yymsp[-2].minor.yy1043); + pCxt->pRootNode = addCreateUserStmtWhiteList(pCxt, pCxt->pRootNode, yymsp[0].minor.yy316); } -#line 5708 "sql.c" +#line 5685 "sql.c" break; case 34: /* cmd ::= ALTER USER user_name PASS NK_STRING */ #line 113 "sql.y" -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy837, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } -#line 5713 "sql.c" +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy1109, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } +#line 5690 "sql.c" break; case 35: /* cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ #line 114 "sql.y" -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy837, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); } -#line 5718 "sql.c" +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy1109, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); } +#line 5695 "sql.c" break; case 36: /* cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ #line 115 "sql.y" -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy837, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } -#line 5723 "sql.c" +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy1109, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } +#line 5700 "sql.c" break; case 37: /* cmd ::= ALTER USER user_name CREATEDB NK_INTEGER */ #line 116 "sql.y" -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy837, TSDB_ALTER_USER_CREATEDB, &yymsp[0].minor.yy0); } -#line 5728 "sql.c" +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy1109, TSDB_ALTER_USER_CREATEDB, &yymsp[0].minor.yy0); } +#line 5705 "sql.c" break; case 38: /* cmd ::= ALTER USER user_name ADD white_list */ #line 117 "sql.y" -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy837, TSDB_ALTER_USER_ADD_WHITE_LIST, yymsp[0].minor.yy652); } -#line 5733 "sql.c" +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy1109, TSDB_ALTER_USER_ADD_WHITE_LIST, yymsp[0].minor.yy316); } +#line 5710 "sql.c" break; case 39: /* cmd ::= ALTER USER user_name DROP white_list */ #line 118 "sql.y" -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy837, TSDB_ALTER_USER_DROP_WHITE_LIST, yymsp[0].minor.yy652); } -#line 5738 "sql.c" +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy1109, TSDB_ALTER_USER_DROP_WHITE_LIST, yymsp[0].minor.yy316); } +#line 5715 "sql.c" break; case 40: /* cmd ::= DROP USER user_name */ #line 119 "sql.y" -{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy837); } -#line 5743 "sql.c" +{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy1109); } +#line 5720 "sql.c" break; case 41: /* sysinfo_opt ::= */ #line 123 "sql.y" -{ yymsp[1].minor.yy535 = 1; } -#line 5748 "sql.c" +{ yymsp[1].minor.yy1043 = 1; } +#line 5725 "sql.c" break; case 43: /* cmd ::= GRANT privileges ON priv_level with_opt TO user_name */ #line 127 "sql.y" -{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-5].minor.yy909, &yymsp[-3].minor.yy495, &yymsp[0].minor.yy837, yymsp[-2].minor.yy54); } -#line 5753 "sql.c" +{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-5].minor.yy1089, &yymsp[-3].minor.yy849, &yymsp[0].minor.yy1109, yymsp[-2].minor.yy416); } +#line 5730 "sql.c" break; case 44: /* cmd ::= REVOKE privileges ON priv_level with_opt FROM user_name */ #line 128 "sql.y" -{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-5].minor.yy909, &yymsp[-3].minor.yy495, &yymsp[0].minor.yy837, yymsp[-2].minor.yy54); } -#line 5758 "sql.c" +{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-5].minor.yy1089, &yymsp[-3].minor.yy849, &yymsp[0].minor.yy1109, yymsp[-2].minor.yy416); } +#line 5735 "sql.c" break; case 45: /* privileges ::= ALL */ #line 132 "sql.y" -{ yymsp[0].minor.yy909 = PRIVILEGE_TYPE_ALL; } -#line 5763 "sql.c" +{ yymsp[0].minor.yy1089 = PRIVILEGE_TYPE_ALL; } +#line 5740 "sql.c" break; case 46: /* privileges ::= priv_type_list */ case 48: /* priv_type_list ::= priv_type */ yytestcase(yyruleno==48); #line 133 "sql.y" -{ yylhsminor.yy909 = yymsp[0].minor.yy909; } -#line 5769 "sql.c" - yymsp[0].minor.yy909 = yylhsminor.yy909; +{ yylhsminor.yy1089 = yymsp[0].minor.yy1089; } +#line 5746 "sql.c" + yymsp[0].minor.yy1089 = yylhsminor.yy1089; break; case 47: /* privileges ::= SUBSCRIBE */ #line 134 "sql.y" -{ yymsp[0].minor.yy909 = PRIVILEGE_TYPE_SUBSCRIBE; } -#line 5775 "sql.c" +{ yymsp[0].minor.yy1089 = PRIVILEGE_TYPE_SUBSCRIBE; } +#line 5752 "sql.c" break; case 49: /* priv_type_list ::= priv_type_list NK_COMMA priv_type */ #line 139 "sql.y" -{ yylhsminor.yy909 = yymsp[-2].minor.yy909 | yymsp[0].minor.yy909; } -#line 5780 "sql.c" - yymsp[-2].minor.yy909 = yylhsminor.yy909; +{ yylhsminor.yy1089 = yymsp[-2].minor.yy1089 | yymsp[0].minor.yy1089; } +#line 5757 "sql.c" + yymsp[-2].minor.yy1089 = yylhsminor.yy1089; break; case 50: /* priv_type ::= READ */ #line 143 "sql.y" -{ yymsp[0].minor.yy909 = PRIVILEGE_TYPE_READ; } -#line 5786 "sql.c" +{ yymsp[0].minor.yy1089 = PRIVILEGE_TYPE_READ; } +#line 5763 "sql.c" break; case 51: /* priv_type ::= WRITE */ #line 144 "sql.y" -{ yymsp[0].minor.yy909 = PRIVILEGE_TYPE_WRITE; } -#line 5791 "sql.c" +{ yymsp[0].minor.yy1089 = PRIVILEGE_TYPE_WRITE; } +#line 5768 "sql.c" break; case 52: /* priv_type ::= ALTER */ #line 145 "sql.y" -{ yymsp[0].minor.yy909 = PRIVILEGE_TYPE_ALTER; } -#line 5796 "sql.c" +{ yymsp[0].minor.yy1089 = PRIVILEGE_TYPE_ALTER; } +#line 5773 "sql.c" break; case 53: /* priv_level ::= NK_STAR NK_DOT NK_STAR */ #line 149 "sql.y" -{ yylhsminor.yy495.first = yymsp[-2].minor.yy0; yylhsminor.yy495.second = yymsp[0].minor.yy0; } -#line 5801 "sql.c" - yymsp[-2].minor.yy495 = yylhsminor.yy495; +{ yylhsminor.yy849.first = yymsp[-2].minor.yy0; yylhsminor.yy849.second = yymsp[0].minor.yy0; } +#line 5778 "sql.c" + yymsp[-2].minor.yy849 = yylhsminor.yy849; break; case 54: /* priv_level ::= db_name NK_DOT NK_STAR */ #line 150 "sql.y" -{ yylhsminor.yy495.first = yymsp[-2].minor.yy837; yylhsminor.yy495.second = yymsp[0].minor.yy0; } -#line 5807 "sql.c" - yymsp[-2].minor.yy495 = yylhsminor.yy495; +{ yylhsminor.yy849.first = yymsp[-2].minor.yy1109; yylhsminor.yy849.second = yymsp[0].minor.yy0; } +#line 5784 "sql.c" + yymsp[-2].minor.yy849 = yylhsminor.yy849; break; case 55: /* priv_level ::= db_name NK_DOT table_name */ #line 151 "sql.y" -{ yylhsminor.yy495.first = yymsp[-2].minor.yy837; yylhsminor.yy495.second = yymsp[0].minor.yy837; } -#line 5813 "sql.c" - yymsp[-2].minor.yy495 = yylhsminor.yy495; +{ yylhsminor.yy849.first = yymsp[-2].minor.yy1109; yylhsminor.yy849.second = yymsp[0].minor.yy1109; } +#line 5790 "sql.c" + yymsp[-2].minor.yy849 = yylhsminor.yy849; break; case 56: /* priv_level ::= topic_name */ #line 152 "sql.y" -{ yylhsminor.yy495.first = yymsp[0].minor.yy837; yylhsminor.yy495.second = nil_token; } -#line 5819 "sql.c" - yymsp[0].minor.yy495 = yylhsminor.yy495; +{ yylhsminor.yy849.first = yymsp[0].minor.yy1109; yylhsminor.yy849.second = nil_token; } +#line 5796 "sql.c" + yymsp[0].minor.yy849 = yylhsminor.yy849; break; case 57: /* with_opt ::= */ case 173: /* start_opt ::= */ yytestcase(yyruleno==173); case 177: /* end_opt ::= */ yytestcase(yyruleno==177); - case 331: /* like_pattern_opt ::= */ yytestcase(yyruleno==331); - case 428: /* subtable_opt ::= */ yytestcase(yyruleno==428); - case 597: /* case_when_else_opt ::= */ yytestcase(yyruleno==597); - case 627: /* from_clause_opt ::= */ yytestcase(yyruleno==627); - case 654: /* join_on_clause_opt ::= */ yytestcase(yyruleno==654); - case 656: /* window_offset_clause_opt ::= */ yytestcase(yyruleno==656); - case 660: /* jlimit_clause_opt ::= */ yytestcase(yyruleno==660); - case 677: /* where_clause_opt ::= */ yytestcase(yyruleno==677); - case 686: /* twindow_clause_opt ::= */ yytestcase(yyruleno==686); - case 694: /* sliding_opt ::= */ yytestcase(yyruleno==694); - case 699: /* fill_opt ::= */ yytestcase(yyruleno==699); - case 713: /* having_clause_opt ::= */ yytestcase(yyruleno==713); - case 715: /* range_opt ::= */ yytestcase(yyruleno==715); - case 718: /* every_opt ::= */ yytestcase(yyruleno==718); - case 731: /* slimit_clause_opt ::= */ yytestcase(yyruleno==731); - case 735: /* limit_clause_opt ::= */ yytestcase(yyruleno==735); + case 330: /* like_pattern_opt ::= */ yytestcase(yyruleno==330); + case 427: /* subtable_opt ::= */ yytestcase(yyruleno==427); + case 596: /* case_when_else_opt ::= */ yytestcase(yyruleno==596); + case 626: /* from_clause_opt ::= */ yytestcase(yyruleno==626); + case 653: /* join_on_clause_opt ::= */ yytestcase(yyruleno==653); + case 655: /* window_offset_clause_opt ::= */ yytestcase(yyruleno==655); + case 659: /* jlimit_clause_opt ::= */ yytestcase(yyruleno==659); + case 676: /* where_clause_opt ::= */ yytestcase(yyruleno==676); + case 685: /* twindow_clause_opt ::= */ yytestcase(yyruleno==685); + case 693: /* sliding_opt ::= */ yytestcase(yyruleno==693); + case 698: /* fill_opt ::= */ yytestcase(yyruleno==698); + case 712: /* having_clause_opt ::= */ yytestcase(yyruleno==712); + case 714: /* range_opt ::= */ yytestcase(yyruleno==714); + case 717: /* every_opt ::= */ yytestcase(yyruleno==717); + case 730: /* slimit_clause_opt ::= */ yytestcase(yyruleno==730); + case 734: /* limit_clause_opt ::= */ yytestcase(yyruleno==734); #line 154 "sql.y" -{ yymsp[1].minor.yy54 = NULL; } -#line 5843 "sql.c" +{ yymsp[1].minor.yy416 = NULL; } +#line 5820 "sql.c" break; case 58: /* with_opt ::= WITH search_condition */ - case 628: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==628); - case 655: /* join_on_clause_opt ::= ON search_condition */ yytestcase(yyruleno==655); - case 678: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==678); - case 714: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==714); + case 627: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==627); + case 654: /* join_on_clause_opt ::= ON search_condition */ yytestcase(yyruleno==654); + case 677: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==677); + case 713: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==713); #line 155 "sql.y" -{ yymsp[-1].minor.yy54 = yymsp[0].minor.yy54; } -#line 5852 "sql.c" +{ yymsp[-1].minor.yy416 = yymsp[0].minor.yy416; } +#line 5829 "sql.c" break; case 59: /* cmd ::= CREATE ENCRYPT_KEY NK_STRING */ #line 158 "sql.y" { pCxt->pRootNode = createEncryptKeyStmt(pCxt, &yymsp[0].minor.yy0); } -#line 5857 "sql.c" +#line 5834 "sql.c" break; case 60: /* cmd ::= CREATE DNODE dnode_endpoint */ #line 161 "sql.y" -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy837, NULL); } -#line 5862 "sql.c" +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy1109, NULL); } +#line 5839 "sql.c" break; case 61: /* cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ #line 162 "sql.y" -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy837, &yymsp[0].minor.yy0); } -#line 5867 "sql.c" +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy1109, &yymsp[0].minor.yy0); } +#line 5844 "sql.c" break; case 62: /* cmd ::= DROP DNODE NK_INTEGER force_opt */ #line 163 "sql.y" -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy325, false); } -#line 5872 "sql.c" +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy209, false); } +#line 5849 "sql.c" break; case 63: /* cmd ::= DROP DNODE dnode_endpoint force_opt */ #line 164 "sql.y" -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy837, yymsp[0].minor.yy325, false); } -#line 5877 "sql.c" +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy1109, yymsp[0].minor.yy209, false); } +#line 5854 "sql.c" break; case 64: /* cmd ::= DROP DNODE NK_INTEGER unsafe_opt */ #line 165 "sql.y" -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, false, yymsp[0].minor.yy325); } -#line 5882 "sql.c" +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, false, yymsp[0].minor.yy209); } +#line 5859 "sql.c" break; case 65: /* cmd ::= DROP DNODE dnode_endpoint unsafe_opt */ #line 166 "sql.y" -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy837, false, yymsp[0].minor.yy325); } -#line 5887 "sql.c" +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy1109, false, yymsp[0].minor.yy209); } +#line 5864 "sql.c" break; case 66: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ #line 167 "sql.y" { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); } -#line 5892 "sql.c" +#line 5869 "sql.c" break; case 67: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ #line 168 "sql.y" { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-2].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } -#line 5897 "sql.c" +#line 5874 "sql.c" break; case 68: /* cmd ::= ALTER ALL DNODES NK_STRING */ #line 169 "sql.y" { pCxt->pRootNode = createAlterDnodeStmt(pCxt, NULL, &yymsp[0].minor.yy0, NULL); } -#line 5902 "sql.c" +#line 5879 "sql.c" break; case 69: /* cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ #line 170 "sql.y" { pCxt->pRootNode = createAlterDnodeStmt(pCxt, NULL, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } -#line 5907 "sql.c" +#line 5884 "sql.c" break; case 70: /* cmd ::= RESTORE DNODE NK_INTEGER */ #line 171 "sql.y" { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_DNODE_STMT, &yymsp[0].minor.yy0); } -#line 5912 "sql.c" +#line 5889 "sql.c" break; case 71: /* dnode_endpoint ::= NK_STRING */ case 72: /* dnode_endpoint ::= NK_ID */ yytestcase(yyruleno==72); case 73: /* dnode_endpoint ::= NK_IPTOKEN */ yytestcase(yyruleno==73); - case 365: /* sma_func_name ::= COUNT */ yytestcase(yyruleno==365); - case 366: /* sma_func_name ::= FIRST */ yytestcase(yyruleno==366); - case 367: /* sma_func_name ::= LAST */ yytestcase(yyruleno==367); - case 368: /* sma_func_name ::= LAST_ROW */ yytestcase(yyruleno==368); - case 516: /* db_name ::= NK_ID */ yytestcase(yyruleno==516); - case 517: /* table_name ::= NK_ID */ yytestcase(yyruleno==517); - case 518: /* column_name ::= NK_ID */ yytestcase(yyruleno==518); - case 519: /* function_name ::= NK_ID */ yytestcase(yyruleno==519); - case 520: /* view_name ::= NK_ID */ yytestcase(yyruleno==520); - case 521: /* table_alias ::= NK_ID */ yytestcase(yyruleno==521); - case 522: /* column_alias ::= NK_ID */ yytestcase(yyruleno==522); - case 523: /* column_alias ::= NK_ALIAS */ yytestcase(yyruleno==523); - case 524: /* user_name ::= NK_ID */ yytestcase(yyruleno==524); - case 525: /* topic_name ::= NK_ID */ yytestcase(yyruleno==525); - case 526: /* stream_name ::= NK_ID */ yytestcase(yyruleno==526); - case 527: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==527); - case 528: /* index_name ::= NK_ID */ yytestcase(yyruleno==528); - case 529: /* tsma_name ::= NK_ID */ yytestcase(yyruleno==529); - case 573: /* noarg_func ::= NOW */ yytestcase(yyruleno==573); - case 574: /* noarg_func ::= TODAY */ yytestcase(yyruleno==574); - case 575: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==575); - case 576: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==576); - case 577: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==577); - case 578: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==578); - case 579: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==579); - case 580: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==580); - case 581: /* noarg_func ::= USER */ yytestcase(yyruleno==581); - case 582: /* star_func ::= COUNT */ yytestcase(yyruleno==582); - case 583: /* star_func ::= FIRST */ yytestcase(yyruleno==583); - case 584: /* star_func ::= LAST */ yytestcase(yyruleno==584); - case 585: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==585); + case 364: /* sma_func_name ::= COUNT */ yytestcase(yyruleno==364); + case 365: /* sma_func_name ::= FIRST */ yytestcase(yyruleno==365); + case 366: /* sma_func_name ::= LAST */ yytestcase(yyruleno==366); + case 367: /* sma_func_name ::= LAST_ROW */ yytestcase(yyruleno==367); + case 515: /* db_name ::= NK_ID */ yytestcase(yyruleno==515); + case 516: /* table_name ::= NK_ID */ yytestcase(yyruleno==516); + case 517: /* column_name ::= NK_ID */ yytestcase(yyruleno==517); + case 518: /* function_name ::= NK_ID */ yytestcase(yyruleno==518); + case 519: /* view_name ::= NK_ID */ yytestcase(yyruleno==519); + case 520: /* table_alias ::= NK_ID */ yytestcase(yyruleno==520); + case 521: /* column_alias ::= NK_ID */ yytestcase(yyruleno==521); + case 522: /* column_alias ::= NK_ALIAS */ yytestcase(yyruleno==522); + case 523: /* user_name ::= NK_ID */ yytestcase(yyruleno==523); + case 524: /* topic_name ::= NK_ID */ yytestcase(yyruleno==524); + case 525: /* stream_name ::= NK_ID */ yytestcase(yyruleno==525); + case 526: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==526); + case 527: /* index_name ::= NK_ID */ yytestcase(yyruleno==527); + case 528: /* tsma_name ::= NK_ID */ yytestcase(yyruleno==528); + case 572: /* noarg_func ::= NOW */ yytestcase(yyruleno==572); + case 573: /* noarg_func ::= TODAY */ yytestcase(yyruleno==573); + case 574: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==574); + case 575: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==575); + case 576: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==576); + case 577: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==577); + case 578: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==578); + case 579: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==579); + case 580: /* noarg_func ::= USER */ yytestcase(yyruleno==580); + case 581: /* star_func ::= COUNT */ yytestcase(yyruleno==581); + case 582: /* star_func ::= FIRST */ yytestcase(yyruleno==582); + case 583: /* star_func ::= LAST */ yytestcase(yyruleno==583); + case 584: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==584); #line 175 "sql.y" -{ yylhsminor.yy837 = yymsp[0].minor.yy0; } -#line 5950 "sql.c" - yymsp[0].minor.yy837 = yylhsminor.yy837; +{ yylhsminor.yy1109 = yymsp[0].minor.yy0; } +#line 5927 "sql.c" + yymsp[0].minor.yy1109 = yylhsminor.yy1109; break; case 74: /* force_opt ::= */ case 101: /* not_exists_opt ::= */ yytestcase(yyruleno==101); case 103: /* exists_opt ::= */ yytestcase(yyruleno==103); - case 386: /* analyze_opt ::= */ yytestcase(yyruleno==386); - case 393: /* agg_func_opt ::= */ yytestcase(yyruleno==393); - case 399: /* or_replace_opt ::= */ yytestcase(yyruleno==399); - case 430: /* ignore_opt ::= */ yytestcase(yyruleno==430); - case 665: /* tag_mode_opt ::= */ yytestcase(yyruleno==665); - case 667: /* set_quantifier_opt ::= */ yytestcase(yyruleno==667); + case 385: /* analyze_opt ::= */ yytestcase(yyruleno==385); + case 392: /* agg_func_opt ::= */ yytestcase(yyruleno==392); + case 398: /* or_replace_opt ::= */ yytestcase(yyruleno==398); + case 429: /* ignore_opt ::= */ yytestcase(yyruleno==429); + case 664: /* tag_mode_opt ::= */ yytestcase(yyruleno==664); + case 666: /* set_quantifier_opt ::= */ yytestcase(yyruleno==666); #line 181 "sql.y" -{ yymsp[1].minor.yy325 = false; } -#line 5964 "sql.c" +{ yymsp[1].minor.yy209 = false; } +#line 5941 "sql.c" break; case 75: /* force_opt ::= FORCE */ case 76: /* unsafe_opt ::= UNSAFE */ yytestcase(yyruleno==76); - case 387: /* analyze_opt ::= ANALYZE */ yytestcase(yyruleno==387); - case 394: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==394); - case 666: /* tag_mode_opt ::= TAGS */ yytestcase(yyruleno==666); - case 668: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==668); + case 386: /* analyze_opt ::= ANALYZE */ yytestcase(yyruleno==386); + case 393: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==393); + case 665: /* tag_mode_opt ::= TAGS */ yytestcase(yyruleno==665); + case 667: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==667); #line 182 "sql.y" -{ yymsp[0].minor.yy325 = true; } -#line 5974 "sql.c" +{ yymsp[0].minor.yy209 = true; } +#line 5951 "sql.c" break; case 77: /* cmd ::= ALTER CLUSTER NK_STRING */ #line 189 "sql.y" { pCxt->pRootNode = createAlterClusterStmt(pCxt, &yymsp[0].minor.yy0, NULL); } -#line 5979 "sql.c" +#line 5956 "sql.c" break; case 78: /* cmd ::= ALTER CLUSTER NK_STRING NK_STRING */ #line 190 "sql.y" { pCxt->pRootNode = createAlterClusterStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } -#line 5984 "sql.c" +#line 5961 "sql.c" break; case 79: /* cmd ::= ALTER LOCAL NK_STRING */ #line 193 "sql.y" { pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[0].minor.yy0, NULL); } -#line 5989 "sql.c" +#line 5966 "sql.c" break; case 80: /* cmd ::= ALTER LOCAL NK_STRING NK_STRING */ #line 194 "sql.y" { pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } -#line 5994 "sql.c" +#line 5971 "sql.c" break; case 81: /* cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ #line 197 "sql.y" { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_QNODE_STMT, &yymsp[0].minor.yy0); } -#line 5999 "sql.c" +#line 5976 "sql.c" break; case 82: /* cmd ::= DROP QNODE ON DNODE NK_INTEGER */ #line 198 "sql.y" { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_QNODE_STMT, &yymsp[0].minor.yy0); } -#line 6004 "sql.c" +#line 5981 "sql.c" break; case 83: /* cmd ::= RESTORE QNODE ON DNODE NK_INTEGER */ #line 199 "sql.y" { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_QNODE_STMT, &yymsp[0].minor.yy0); } -#line 6009 "sql.c" +#line 5986 "sql.c" break; case 84: /* cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ #line 202 "sql.y" { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_BNODE_STMT, &yymsp[0].minor.yy0); } -#line 6014 "sql.c" +#line 5991 "sql.c" break; case 85: /* cmd ::= DROP BNODE ON DNODE NK_INTEGER */ #line 203 "sql.y" { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_BNODE_STMT, &yymsp[0].minor.yy0); } -#line 6019 "sql.c" +#line 5996 "sql.c" break; case 86: /* cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ #line 206 "sql.y" { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_SNODE_STMT, &yymsp[0].minor.yy0); } -#line 6024 "sql.c" +#line 6001 "sql.c" break; case 87: /* cmd ::= DROP SNODE ON DNODE NK_INTEGER */ #line 207 "sql.y" { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_SNODE_STMT, &yymsp[0].minor.yy0); } -#line 6029 "sql.c" +#line 6006 "sql.c" break; case 88: /* cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ #line 210 "sql.y" { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_MNODE_STMT, &yymsp[0].minor.yy0); } -#line 6034 "sql.c" +#line 6011 "sql.c" break; case 89: /* cmd ::= DROP MNODE ON DNODE NK_INTEGER */ #line 211 "sql.y" { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_MNODE_STMT, &yymsp[0].minor.yy0); } -#line 6039 "sql.c" +#line 6016 "sql.c" break; case 90: /* cmd ::= RESTORE MNODE ON DNODE NK_INTEGER */ #line 212 "sql.y" { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_MNODE_STMT, &yymsp[0].minor.yy0); } -#line 6044 "sql.c" +#line 6021 "sql.c" break; case 91: /* cmd ::= RESTORE VNODE ON DNODE NK_INTEGER */ #line 215 "sql.y" { pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_VNODE_STMT, &yymsp[0].minor.yy0); } -#line 6049 "sql.c" +#line 6026 "sql.c" break; case 92: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ #line 218 "sql.y" -{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy325, &yymsp[-1].minor.yy837, yymsp[0].minor.yy54); } -#line 6054 "sql.c" +{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy209, &yymsp[-1].minor.yy1109, yymsp[0].minor.yy416); } +#line 6031 "sql.c" break; case 93: /* cmd ::= DROP DATABASE exists_opt db_name */ #line 219 "sql.y" -{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy325, &yymsp[0].minor.yy837); } -#line 6059 "sql.c" +{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy209, &yymsp[0].minor.yy1109); } +#line 6036 "sql.c" break; case 94: /* cmd ::= USE db_name */ #line 220 "sql.y" -{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy837); } -#line 6064 "sql.c" +{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy1109); } +#line 6041 "sql.c" break; case 95: /* cmd ::= ALTER DATABASE db_name alter_db_options */ #line 221 "sql.y" -{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy837, yymsp[0].minor.yy54); } -#line 6069 "sql.c" +{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy1109, yymsp[0].minor.yy416); } +#line 6046 "sql.c" break; case 96: /* cmd ::= FLUSH DATABASE db_name */ #line 222 "sql.y" -{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy837); } -#line 6074 "sql.c" +{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy1109); } +#line 6051 "sql.c" break; case 97: /* cmd ::= TRIM DATABASE db_name speed_opt */ #line 223 "sql.y" -{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy837, yymsp[0].minor.yy332); } -#line 6079 "sql.c" +{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy1109, yymsp[0].minor.yy820); } +#line 6056 "sql.c" break; case 98: /* cmd ::= S3MIGRATE DATABASE db_name */ #line 224 "sql.y" -{ pCxt->pRootNode = createS3MigrateDatabaseStmt(pCxt, &yymsp[0].minor.yy837); } -#line 6084 "sql.c" +{ pCxt->pRootNode = createS3MigrateDatabaseStmt(pCxt, &yymsp[0].minor.yy1109); } +#line 6061 "sql.c" break; case 99: /* cmd ::= COMPACT DATABASE db_name start_opt end_opt */ #line 225 "sql.y" -{ pCxt->pRootNode = createCompactStmt(pCxt, &yymsp[-2].minor.yy837, yymsp[-1].minor.yy54, yymsp[0].minor.yy54); } -#line 6089 "sql.c" +{ pCxt->pRootNode = createCompactStmt(pCxt, &yymsp[-2].minor.yy1109, yymsp[-1].minor.yy416, yymsp[0].minor.yy416); } +#line 6066 "sql.c" break; case 100: /* not_exists_opt ::= IF NOT EXISTS */ #line 229 "sql.y" -{ yymsp[-2].minor.yy325 = true; } -#line 6094 "sql.c" +{ yymsp[-2].minor.yy209 = true; } +#line 6071 "sql.c" break; case 102: /* exists_opt ::= IF EXISTS */ - case 400: /* or_replace_opt ::= OR REPLACE */ yytestcase(yyruleno==400); - case 431: /* ignore_opt ::= IGNORE UNTREATED */ yytestcase(yyruleno==431); + case 399: /* or_replace_opt ::= OR REPLACE */ yytestcase(yyruleno==399); + case 430: /* ignore_opt ::= IGNORE UNTREATED */ yytestcase(yyruleno==430); #line 234 "sql.y" -{ yymsp[-1].minor.yy325 = true; } -#line 6101 "sql.c" +{ yymsp[-1].minor.yy209 = true; } +#line 6078 "sql.c" break; case 104: /* db_options ::= */ #line 237 "sql.y" -{ yymsp[1].minor.yy54 = createDefaultDatabaseOptions(pCxt); } -#line 6106 "sql.c" +{ yymsp[1].minor.yy416 = createDefaultDatabaseOptions(pCxt); } +#line 6083 "sql.c" break; case 105: /* db_options ::= db_options BUFFER NK_INTEGER */ #line 238 "sql.y" -{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } -#line 6111 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } +#line 6088 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; case 106: /* db_options ::= db_options CACHEMODEL NK_STRING */ #line 239 "sql.y" -{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); } -#line 6117 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); } +#line 6094 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; case 107: /* db_options ::= db_options CACHESIZE NK_INTEGER */ #line 240 "sql.y" -{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); } -#line 6123 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); } +#line 6100 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; case 108: /* db_options ::= db_options COMP NK_INTEGER */ #line 241 "sql.y" -{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_COMP, &yymsp[0].minor.yy0); } -#line 6129 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_COMP, &yymsp[0].minor.yy0); } +#line 6106 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; case 109: /* db_options ::= db_options DURATION NK_INTEGER */ case 110: /* db_options ::= db_options DURATION NK_VARIABLE */ yytestcase(yyruleno==110); #line 242 "sql.y" -{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } -#line 6136 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } +#line 6113 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; case 111: /* db_options ::= db_options MAXROWS NK_INTEGER */ #line 244 "sql.y" -{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } -#line 6142 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } +#line 6119 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; case 112: /* db_options ::= db_options MINROWS NK_INTEGER */ #line 245 "sql.y" -{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } -#line 6148 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } +#line 6125 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; case 113: /* db_options ::= db_options KEEP integer_list */ case 114: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==114); #line 246 "sql.y" -{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_KEEP, yymsp[0].minor.yy652); } -#line 6155 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_KEEP, yymsp[0].minor.yy316); } +#line 6132 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; case 115: /* db_options ::= db_options PAGES NK_INTEGER */ #line 248 "sql.y" -{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } -#line 6161 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } +#line 6138 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; case 116: /* db_options ::= db_options PAGESIZE NK_INTEGER */ #line 249 "sql.y" -{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } -#line 6167 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } +#line 6144 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; case 117: /* db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ #line 250 "sql.y" -{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); } -#line 6173 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); } +#line 6150 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; case 118: /* db_options ::= db_options PRECISION NK_STRING */ #line 251 "sql.y" -{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } -#line 6179 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } +#line 6156 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; case 119: /* db_options ::= db_options REPLICA NK_INTEGER */ #line 252 "sql.y" -{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } -#line 6185 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } +#line 6162 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; case 120: /* db_options ::= db_options VGROUPS NK_INTEGER */ #line 254 "sql.y" -{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } -#line 6191 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } +#line 6168 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; case 121: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */ #line 255 "sql.y" -{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } -#line 6197 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } +#line 6174 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; case 122: /* db_options ::= db_options RETENTIONS retention_list */ #line 256 "sql.y" -{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_RETENTIONS, yymsp[0].minor.yy652); } -#line 6203 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_RETENTIONS, yymsp[0].minor.yy316); } +#line 6180 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; case 123: /* db_options ::= db_options SCHEMALESS NK_INTEGER */ #line 257 "sql.y" -{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } -#line 6209 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } +#line 6186 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; case 124: /* db_options ::= db_options WAL_LEVEL NK_INTEGER */ #line 258 "sql.y" -{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_WAL, &yymsp[0].minor.yy0); } -#line 6215 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_WAL, &yymsp[0].minor.yy0); } +#line 6192 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; case 125: /* db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ #line 259 "sql.y" -{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } -#line 6221 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } +#line 6198 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; case 126: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ #line 260 "sql.y" -{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); } -#line 6227 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); } +#line 6204 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; case 127: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ #line 261 "sql.y" { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-3].minor.yy54, DB_OPTION_WAL_RETENTION_PERIOD, &t); + yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-3].minor.yy416, DB_OPTION_WAL_RETENTION_PERIOD, &t); } -#line 6237 "sql.c" - yymsp[-3].minor.yy54 = yylhsminor.yy54; +#line 6214 "sql.c" + yymsp[-3].minor.yy416 = yylhsminor.yy416; break; case 128: /* db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ #line 266 "sql.y" -{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); } -#line 6243 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); } +#line 6220 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; case 129: /* db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ #line 267 "sql.y" { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-3].minor.yy54, DB_OPTION_WAL_RETENTION_SIZE, &t); + yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-3].minor.yy416, DB_OPTION_WAL_RETENTION_SIZE, &t); } -#line 6253 "sql.c" - yymsp[-3].minor.yy54 = yylhsminor.yy54; +#line 6230 "sql.c" + yymsp[-3].minor.yy416 = yylhsminor.yy416; break; case 130: /* db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ #line 272 "sql.y" -{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); } -#line 6259 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); } +#line 6236 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; case 131: /* db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ #line 273 "sql.y" -{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); } -#line 6265 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); } +#line 6242 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; case 132: /* db_options ::= db_options STT_TRIGGER NK_INTEGER */ #line 274 "sql.y" -{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); } -#line 6271 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); } +#line 6248 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; case 133: /* db_options ::= db_options TABLE_PREFIX signed */ #line 275 "sql.y" -{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_TABLE_PREFIX, yymsp[0].minor.yy54); } -#line 6277 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_TABLE_PREFIX, yymsp[0].minor.yy416); } +#line 6254 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; case 134: /* db_options ::= db_options TABLE_SUFFIX signed */ #line 276 "sql.y" -{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_TABLE_SUFFIX, yymsp[0].minor.yy54); } -#line 6283 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_TABLE_SUFFIX, yymsp[0].minor.yy416); } +#line 6260 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; case 135: /* db_options ::= db_options S3_CHUNKSIZE NK_INTEGER */ #line 277 "sql.y" -{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_S3_CHUNKSIZE, &yymsp[0].minor.yy0); } -#line 6289 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_S3_CHUNKSIZE, &yymsp[0].minor.yy0); } +#line 6266 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; case 136: /* db_options ::= db_options S3_KEEPLOCAL NK_INTEGER */ case 137: /* db_options ::= db_options S3_KEEPLOCAL NK_VARIABLE */ yytestcase(yyruleno==137); #line 278 "sql.y" -{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_S3_KEEPLOCAL, &yymsp[0].minor.yy0); } -#line 6296 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_S3_KEEPLOCAL, &yymsp[0].minor.yy0); } +#line 6273 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; case 138: /* db_options ::= db_options S3_COMPACT NK_INTEGER */ #line 280 "sql.y" -{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_S3_COMPACT, &yymsp[0].minor.yy0); } -#line 6302 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_S3_COMPACT, &yymsp[0].minor.yy0); } +#line 6279 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; case 139: /* db_options ::= db_options KEEP_TIME_OFFSET NK_INTEGER */ #line 281 "sql.y" -{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_KEEP_TIME_OFFSET, &yymsp[0].minor.yy0); } -#line 6308 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_KEEP_TIME_OFFSET, &yymsp[0].minor.yy0); } +#line 6285 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; case 140: /* db_options ::= db_options ENCRYPT_ALGORITHM NK_STRING */ #line 282 "sql.y" -{ yylhsminor.yy54 = setDatabaseOption(pCxt, yymsp[-2].minor.yy54, DB_OPTION_ENCRYPT_ALGORITHM, &yymsp[0].minor.yy0); } -#line 6314 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = setDatabaseOption(pCxt, yymsp[-2].minor.yy416, DB_OPTION_ENCRYPT_ALGORITHM, &yymsp[0].minor.yy0); } +#line 6291 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; case 141: /* alter_db_options ::= alter_db_option */ #line 284 "sql.y" -{ yylhsminor.yy54 = createAlterDatabaseOptions(pCxt); yylhsminor.yy54 = setAlterDatabaseOption(pCxt, yylhsminor.yy54, &yymsp[0].minor.yy663); } -#line 6320 "sql.c" - yymsp[0].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = createAlterDatabaseOptions(pCxt); yylhsminor.yy416 = setAlterDatabaseOption(pCxt, yylhsminor.yy416, &yymsp[0].minor.yy101); } +#line 6297 "sql.c" + yymsp[0].minor.yy416 = yylhsminor.yy416; break; case 142: /* alter_db_options ::= alter_db_options alter_db_option */ #line 285 "sql.y" -{ yylhsminor.yy54 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy54, &yymsp[0].minor.yy663); } -#line 6326 "sql.c" - yymsp[-1].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy416, &yymsp[0].minor.yy101); } +#line 6303 "sql.c" + yymsp[-1].minor.yy416 = yylhsminor.yy416; break; case 143: /* alter_db_option ::= BUFFER NK_INTEGER */ #line 289 "sql.y" -{ yymsp[-1].minor.yy663.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy663.val = yymsp[0].minor.yy0; } -#line 6332 "sql.c" +{ yymsp[-1].minor.yy101.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } +#line 6309 "sql.c" break; case 144: /* alter_db_option ::= CACHEMODEL NK_STRING */ #line 290 "sql.y" -{ yymsp[-1].minor.yy663.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy663.val = yymsp[0].minor.yy0; } -#line 6337 "sql.c" +{ yymsp[-1].minor.yy101.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } +#line 6314 "sql.c" break; case 145: /* alter_db_option ::= CACHESIZE NK_INTEGER */ #line 291 "sql.y" -{ yymsp[-1].minor.yy663.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy663.val = yymsp[0].minor.yy0; } -#line 6342 "sql.c" +{ yymsp[-1].minor.yy101.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } +#line 6319 "sql.c" break; case 146: /* alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ #line 292 "sql.y" -{ yymsp[-1].minor.yy663.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy663.val = yymsp[0].minor.yy0; } -#line 6347 "sql.c" +{ yymsp[-1].minor.yy101.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } +#line 6324 "sql.c" break; case 147: /* alter_db_option ::= KEEP integer_list */ case 148: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==148); #line 293 "sql.y" -{ yymsp[-1].minor.yy663.type = DB_OPTION_KEEP; yymsp[-1].minor.yy663.pList = yymsp[0].minor.yy652; } -#line 6353 "sql.c" +{ yymsp[-1].minor.yy101.type = DB_OPTION_KEEP; yymsp[-1].minor.yy101.pList = yymsp[0].minor.yy316; } +#line 6330 "sql.c" break; case 149: /* alter_db_option ::= PAGES NK_INTEGER */ #line 295 "sql.y" -{ yymsp[-1].minor.yy663.type = DB_OPTION_PAGES; yymsp[-1].minor.yy663.val = yymsp[0].minor.yy0; } -#line 6358 "sql.c" +{ yymsp[-1].minor.yy101.type = DB_OPTION_PAGES; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } +#line 6335 "sql.c" break; case 150: /* alter_db_option ::= REPLICA NK_INTEGER */ #line 296 "sql.y" -{ yymsp[-1].minor.yy663.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy663.val = yymsp[0].minor.yy0; } -#line 6363 "sql.c" +{ yymsp[-1].minor.yy101.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } +#line 6340 "sql.c" break; case 151: /* alter_db_option ::= WAL_LEVEL NK_INTEGER */ #line 298 "sql.y" -{ yymsp[-1].minor.yy663.type = DB_OPTION_WAL; yymsp[-1].minor.yy663.val = yymsp[0].minor.yy0; } -#line 6368 "sql.c" +{ yymsp[-1].minor.yy101.type = DB_OPTION_WAL; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } +#line 6345 "sql.c" break; case 152: /* alter_db_option ::= STT_TRIGGER NK_INTEGER */ #line 299 "sql.y" -{ yymsp[-1].minor.yy663.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy663.val = yymsp[0].minor.yy0; } -#line 6373 "sql.c" +{ yymsp[-1].minor.yy101.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } +#line 6350 "sql.c" break; case 153: /* alter_db_option ::= MINROWS NK_INTEGER */ #line 300 "sql.y" -{ yymsp[-1].minor.yy663.type = DB_OPTION_MINROWS; yymsp[-1].minor.yy663.val = yymsp[0].minor.yy0; } -#line 6378 "sql.c" +{ yymsp[-1].minor.yy101.type = DB_OPTION_MINROWS; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } +#line 6355 "sql.c" break; case 154: /* alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */ #line 301 "sql.y" -{ yymsp[-1].minor.yy663.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-1].minor.yy663.val = yymsp[0].minor.yy0; } -#line 6383 "sql.c" +{ yymsp[-1].minor.yy101.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } +#line 6360 "sql.c" break; case 155: /* alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ #line 302 "sql.y" { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yymsp[-2].minor.yy663.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-2].minor.yy663.val = t; + yymsp[-2].minor.yy101.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-2].minor.yy101.val = t; } -#line 6392 "sql.c" +#line 6369 "sql.c" break; case 156: /* alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */ #line 307 "sql.y" -{ yymsp[-1].minor.yy663.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-1].minor.yy663.val = yymsp[0].minor.yy0; } -#line 6397 "sql.c" +{ yymsp[-1].minor.yy101.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } +#line 6374 "sql.c" break; case 157: /* alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ #line 308 "sql.y" { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yymsp[-2].minor.yy663.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-2].minor.yy663.val = t; + yymsp[-2].minor.yy101.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-2].minor.yy101.val = t; } -#line 6406 "sql.c" +#line 6383 "sql.c" break; case 158: /* alter_db_option ::= S3_KEEPLOCAL NK_INTEGER */ case 159: /* alter_db_option ::= S3_KEEPLOCAL NK_VARIABLE */ yytestcase(yyruleno==159); #line 313 "sql.y" -{ yymsp[-1].minor.yy663.type = DB_OPTION_S3_KEEPLOCAL; yymsp[-1].minor.yy663.val = yymsp[0].minor.yy0; } -#line 6412 "sql.c" +{ yymsp[-1].minor.yy101.type = DB_OPTION_S3_KEEPLOCAL; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } +#line 6389 "sql.c" break; case 160: /* alter_db_option ::= S3_COMPACT NK_INTEGER */ #line 315 "sql.y" -{ yymsp[-1].minor.yy663.type = DB_OPTION_S3_COMPACT, yymsp[-1].minor.yy663.val = yymsp[0].minor.yy0; } -#line 6417 "sql.c" +{ yymsp[-1].minor.yy101.type = DB_OPTION_S3_COMPACT, yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } +#line 6394 "sql.c" break; case 161: /* alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER */ #line 316 "sql.y" -{ yymsp[-1].minor.yy663.type = DB_OPTION_KEEP_TIME_OFFSET; yymsp[-1].minor.yy663.val = yymsp[0].minor.yy0; } -#line 6422 "sql.c" +{ yymsp[-1].minor.yy101.type = DB_OPTION_KEEP_TIME_OFFSET; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } +#line 6399 "sql.c" break; case 162: /* alter_db_option ::= ENCRYPT_ALGORITHM NK_STRING */ #line 317 "sql.y" -{ yymsp[-1].minor.yy663.type = DB_OPTION_ENCRYPT_ALGORITHM; yymsp[-1].minor.yy663.val = yymsp[0].minor.yy0; } -#line 6427 "sql.c" +{ yymsp[-1].minor.yy101.type = DB_OPTION_ENCRYPT_ALGORITHM; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } +#line 6404 "sql.c" break; case 163: /* integer_list ::= NK_INTEGER */ #line 321 "sql.y" -{ yylhsminor.yy652 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } -#line 6432 "sql.c" - yymsp[0].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy316 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } +#line 6409 "sql.c" + yymsp[0].minor.yy316 = yylhsminor.yy316; break; case 164: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */ - case 445: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==445); + case 444: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==444); #line 322 "sql.y" -{ yylhsminor.yy652 = addNodeToList(pCxt, yymsp[-2].minor.yy652, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } -#line 6439 "sql.c" - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy316 = addNodeToList(pCxt, yymsp[-2].minor.yy316, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } +#line 6416 "sql.c" + yymsp[-2].minor.yy316 = yylhsminor.yy316; break; case 165: /* variable_list ::= NK_VARIABLE */ #line 326 "sql.y" -{ yylhsminor.yy652 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } -#line 6445 "sql.c" - yymsp[0].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy316 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } +#line 6422 "sql.c" + yymsp[0].minor.yy316 = yylhsminor.yy316; break; case 166: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */ #line 327 "sql.y" -{ yylhsminor.yy652 = addNodeToList(pCxt, yymsp[-2].minor.yy652, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } -#line 6451 "sql.c" - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy316 = addNodeToList(pCxt, yymsp[-2].minor.yy316, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } +#line 6428 "sql.c" + yymsp[-2].minor.yy316 = yylhsminor.yy316; break; case 167: /* retention_list ::= retention */ - case 199: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==199); - case 201: /* multi_create_clause ::= create_from_file_clause */ yytestcase(yyruleno==201); - case 204: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==204); - case 211: /* tag_def_list ::= tag_def */ yytestcase(yyruleno==211); - case 214: /* column_def_list ::= column_def */ yytestcase(yyruleno==214); - case 262: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==262); - case 267: /* col_name_list ::= col_name */ yytestcase(yyruleno==267); - case 337: /* tag_list_opt ::= tag_item */ yytestcase(yyruleno==337); - case 361: /* func_list ::= func */ yytestcase(yyruleno==361); - case 411: /* column_stream_def_list ::= column_stream_def */ yytestcase(yyruleno==411); - case 489: /* tags_literal_list ::= tags_literal */ yytestcase(yyruleno==489); - case 514: /* literal_list ::= signed_literal */ yytestcase(yyruleno==514); - case 588: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==588); - case 594: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==594); - case 670: /* select_list ::= select_item */ yytestcase(yyruleno==670); - case 681: /* partition_list ::= partition_item */ yytestcase(yyruleno==681); - case 742: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==742); + case 200: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==200); + case 203: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==203); + case 210: /* tag_def_list ::= tag_def */ yytestcase(yyruleno==210); + case 213: /* column_def_list ::= column_def */ yytestcase(yyruleno==213); + case 261: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==261); + case 266: /* col_name_list ::= col_name */ yytestcase(yyruleno==266); + case 336: /* tag_list_opt ::= tag_item */ yytestcase(yyruleno==336); + case 360: /* func_list ::= func */ yytestcase(yyruleno==360); + case 410: /* column_stream_def_list ::= column_stream_def */ yytestcase(yyruleno==410); + case 488: /* tags_literal_list ::= tags_literal */ yytestcase(yyruleno==488); + case 513: /* literal_list ::= signed_literal */ yytestcase(yyruleno==513); + case 587: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==587); + case 593: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==593); + case 669: /* select_list ::= select_item */ yytestcase(yyruleno==669); + case 680: /* partition_list ::= partition_item */ yytestcase(yyruleno==680); + case 741: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==741); #line 331 "sql.y" -{ yylhsminor.yy652 = createNodeList(pCxt, yymsp[0].minor.yy54); } -#line 6474 "sql.c" - yymsp[0].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy316 = createNodeList(pCxt, yymsp[0].minor.yy416); } +#line 6450 "sql.c" + yymsp[0].minor.yy316 = yylhsminor.yy316; break; case 168: /* retention_list ::= retention_list NK_COMMA retention */ - case 205: /* multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ yytestcase(yyruleno==205); - case 212: /* tag_def_list ::= tag_def_list NK_COMMA tag_def */ yytestcase(yyruleno==212); - case 215: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==215); - case 263: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==263); - case 268: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==268); - case 338: /* tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ yytestcase(yyruleno==338); - case 362: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==362); - case 412: /* column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def */ yytestcase(yyruleno==412); - case 490: /* tags_literal_list ::= tags_literal_list NK_COMMA tags_literal */ yytestcase(yyruleno==490); - case 515: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==515); - case 589: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==589); - case 671: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==671); - case 682: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==682); - case 743: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==743); + case 204: /* multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ yytestcase(yyruleno==204); + case 211: /* tag_def_list ::= tag_def_list NK_COMMA tag_def */ yytestcase(yyruleno==211); + case 214: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==214); + case 262: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==262); + case 267: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==267); + case 337: /* tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ yytestcase(yyruleno==337); + case 361: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==361); + case 411: /* column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def */ yytestcase(yyruleno==411); + case 489: /* tags_literal_list ::= tags_literal_list NK_COMMA tags_literal */ yytestcase(yyruleno==489); + case 514: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==514); + case 588: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==588); + case 670: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==670); + case 681: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==681); + case 742: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==742); #line 332 "sql.y" -{ yylhsminor.yy652 = addNodeToList(pCxt, yymsp[-2].minor.yy652, yymsp[0].minor.yy54); } -#line 6494 "sql.c" - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy316 = addNodeToList(pCxt, yymsp[-2].minor.yy316, yymsp[0].minor.yy416); } +#line 6470 "sql.c" + yymsp[-2].minor.yy316 = yylhsminor.yy316; break; case 169: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ case 170: /* retention ::= NK_MINUS NK_COLON NK_VARIABLE */ yytestcase(yyruleno==170); #line 334 "sql.y" -{ yylhsminor.yy54 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } -#line 6501 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } +#line 6477 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; case 171: /* speed_opt ::= */ - case 395: /* bufsize_opt ::= */ yytestcase(yyruleno==395); + case 394: /* bufsize_opt ::= */ yytestcase(yyruleno==394); #line 339 "sql.y" -{ yymsp[1].minor.yy332 = 0; } -#line 6508 "sql.c" +{ yymsp[1].minor.yy820 = 0; } +#line 6484 "sql.c" break; case 172: /* speed_opt ::= BWLIMIT NK_INTEGER */ - case 396: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==396); + case 395: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==395); #line 340 "sql.y" -{ yymsp[-1].minor.yy332 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } -#line 6514 "sql.c" +{ yymsp[-1].minor.yy820 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } +#line 6490 "sql.c" break; case 174: /* start_opt ::= START WITH NK_INTEGER */ case 178: /* end_opt ::= END WITH NK_INTEGER */ yytestcase(yyruleno==178); #line 343 "sql.y" -{ yymsp[-2].minor.yy54 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } -#line 6520 "sql.c" +{ yymsp[-2].minor.yy416 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } +#line 6496 "sql.c" break; case 175: /* start_opt ::= START WITH NK_STRING */ case 179: /* end_opt ::= END WITH NK_STRING */ yytestcase(yyruleno==179); #line 344 "sql.y" -{ yymsp[-2].minor.yy54 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } -#line 6526 "sql.c" +{ yymsp[-2].minor.yy416 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } +#line 6502 "sql.c" break; case 176: /* start_opt ::= START WITH TIMESTAMP NK_STRING */ case 180: /* end_opt ::= END WITH TIMESTAMP NK_STRING */ yytestcase(yyruleno==180); #line 345 "sql.y" -{ yymsp[-3].minor.yy54 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } -#line 6532 "sql.c" +{ yymsp[-3].minor.yy416 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } +#line 6508 "sql.c" break; case 181: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ - case 183: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==183); + case 184: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==184); #line 354 "sql.y" -{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy325, yymsp[-5].minor.yy54, yymsp[-3].minor.yy652, yymsp[-1].minor.yy652, yymsp[0].minor.yy54); } -#line 6538 "sql.c" +{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy209, yymsp[-5].minor.yy416, yymsp[-3].minor.yy316, yymsp[-1].minor.yy316, yymsp[0].minor.yy416); } +#line 6514 "sql.c" break; case 182: /* cmd ::= CREATE TABLE multi_create_clause */ #line 355 "sql.y" -{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy652); } -#line 6543 "sql.c" +{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy316); } +#line 6519 "sql.c" break; - case 184: /* cmd ::= DROP TABLE multi_drop_clause */ -#line 358 "sql.y" -{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy652); } -#line 6548 "sql.c" + case 183: /* cmd ::= CREATE TABLE not_exists_opt USING full_table_name NK_LP tag_list_opt NK_RP FILE NK_STRING */ +#line 357 "sql.y" +{ pCxt->pRootNode = createCreateSubTableFromFileClause(pCxt, yymsp[-7].minor.yy209, yymsp[-5].minor.yy416, yymsp[-3].minor.yy316, &yymsp[0].minor.yy0); } +#line 6524 "sql.c" break; - case 185: /* cmd ::= DROP STABLE exists_opt full_table_name */ -#line 359 "sql.y" -{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy325, yymsp[0].minor.yy54); } -#line 6553 "sql.c" + case 185: /* cmd ::= DROP TABLE multi_drop_clause */ +#line 360 "sql.y" +{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy316); } +#line 6529 "sql.c" break; - case 186: /* cmd ::= ALTER TABLE alter_table_clause */ - case 447: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==447); - case 448: /* cmd ::= insert_query */ yytestcase(yyruleno==448); + case 186: /* cmd ::= DROP STABLE exists_opt full_table_name */ #line 361 "sql.y" -{ pCxt->pRootNode = yymsp[0].minor.yy54; } -#line 6560 "sql.c" +{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy209, yymsp[0].minor.yy416); } +#line 6534 "sql.c" break; - case 187: /* cmd ::= ALTER STABLE alter_table_clause */ -#line 362 "sql.y" -{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy54); } -#line 6565 "sql.c" + case 187: /* cmd ::= ALTER TABLE alter_table_clause */ + case 446: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==446); + case 447: /* cmd ::= insert_query */ yytestcase(yyruleno==447); +#line 363 "sql.y" +{ pCxt->pRootNode = yymsp[0].minor.yy416; } +#line 6541 "sql.c" break; - case 188: /* alter_table_clause ::= full_table_name alter_table_options */ + case 188: /* cmd ::= ALTER STABLE alter_table_clause */ #line 364 "sql.y" -{ yylhsminor.yy54 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy54, yymsp[0].minor.yy54); } -#line 6570 "sql.c" - yymsp[-1].minor.yy54 = yylhsminor.yy54; +{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy416); } +#line 6546 "sql.c" break; - case 189: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name column_options */ + case 189: /* alter_table_clause ::= full_table_name alter_table_options */ #line 366 "sql.y" -{ yylhsminor.yy54 = createAlterTableAddModifyColOptions2(pCxt, yymsp[-5].minor.yy54, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-2].minor.yy837, yymsp[-1].minor.yy84, yymsp[0].minor.yy54); } -#line 6576 "sql.c" - yymsp[-5].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy416, yymsp[0].minor.yy416); } +#line 6551 "sql.c" + yymsp[-1].minor.yy416 = yylhsminor.yy416; break; - case 190: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ -#line 367 "sql.y" -{ yylhsminor.yy54 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy54, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy837); } -#line 6582 "sql.c" - yymsp[-3].minor.yy54 = yylhsminor.yy54; + case 190: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name column_options */ +#line 368 "sql.y" +{ yylhsminor.yy416 = createAlterTableAddModifyColOptions2(pCxt, yymsp[-5].minor.yy416, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-2].minor.yy1109, yymsp[-1].minor.yy952, yymsp[0].minor.yy416); } +#line 6557 "sql.c" + yymsp[-5].minor.yy416 = yylhsminor.yy416; break; - case 191: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ + case 191: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ #line 369 "sql.y" -{ yylhsminor.yy54 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy54, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy837, yymsp[0].minor.yy84); } -#line 6588 "sql.c" - yymsp[-4].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy416, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy1109); } +#line 6563 "sql.c" + yymsp[-3].minor.yy416 = yylhsminor.yy416; break; - case 192: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name column_options */ + case 192: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ #line 371 "sql.y" -{ yylhsminor.yy54 = createAlterTableAddModifyColOptions(pCxt, yymsp[-4].minor.yy54, TSDB_ALTER_TABLE_UPDATE_COLUMN_COMPRESS, &yymsp[-1].minor.yy837, yymsp[0].minor.yy54); } -#line 6594 "sql.c" - yymsp[-4].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy416, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy1109, yymsp[0].minor.yy952); } +#line 6569 "sql.c" + yymsp[-4].minor.yy416 = yylhsminor.yy416; break; - case 193: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ + case 193: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name column_options */ #line 373 "sql.y" -{ yylhsminor.yy54 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy54, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy837, &yymsp[0].minor.yy837); } -#line 6600 "sql.c" - yymsp[-4].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = createAlterTableAddModifyColOptions(pCxt, yymsp[-4].minor.yy416, TSDB_ALTER_TABLE_UPDATE_COLUMN_COMPRESS, &yymsp[-1].minor.yy1109, yymsp[0].minor.yy416); } +#line 6575 "sql.c" + yymsp[-4].minor.yy416 = yylhsminor.yy416; break; - case 194: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ + case 194: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ #line 375 "sql.y" -{ yylhsminor.yy54 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy54, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy837, yymsp[0].minor.yy84); } -#line 6606 "sql.c" - yymsp[-4].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy416, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy1109, &yymsp[0].minor.yy1109); } +#line 6581 "sql.c" + yymsp[-4].minor.yy416 = yylhsminor.yy416; break; - case 195: /* alter_table_clause ::= full_table_name DROP TAG column_name */ -#line 376 "sql.y" -{ yylhsminor.yy54 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy54, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy837); } -#line 6612 "sql.c" - yymsp[-3].minor.yy54 = yylhsminor.yy54; + case 195: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ +#line 377 "sql.y" +{ yylhsminor.yy416 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy416, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy1109, yymsp[0].minor.yy952); } +#line 6587 "sql.c" + yymsp[-4].minor.yy416 = yylhsminor.yy416; break; - case 196: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ + case 196: /* alter_table_clause ::= full_table_name DROP TAG column_name */ #line 378 "sql.y" -{ yylhsminor.yy54 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy54, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy837, yymsp[0].minor.yy84); } -#line 6618 "sql.c" - yymsp[-4].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy416, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy1109); } +#line 6593 "sql.c" + yymsp[-3].minor.yy416 = yylhsminor.yy416; break; - case 197: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ + case 197: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ #line 380 "sql.y" -{ yylhsminor.yy54 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy54, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy837, &yymsp[0].minor.yy837); } -#line 6624 "sql.c" - yymsp[-4].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy416, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy1109, yymsp[0].minor.yy952); } +#line 6599 "sql.c" + yymsp[-4].minor.yy416 = yylhsminor.yy416; break; - case 198: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ tags_literal */ + case 198: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ #line 382 "sql.y" -{ yylhsminor.yy54 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy54, &yymsp[-2].minor.yy837, yymsp[0].minor.yy54); } -#line 6630 "sql.c" - yymsp[-5].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy416, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy1109, &yymsp[0].minor.yy1109); } +#line 6605 "sql.c" + yymsp[-4].minor.yy416 = yylhsminor.yy416; break; - case 200: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ - case 595: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==595); -#line 387 "sql.y" -{ yylhsminor.yy652 = addNodeToList(pCxt, yymsp[-1].minor.yy652, yymsp[0].minor.yy54); } -#line 6637 "sql.c" - yymsp[-1].minor.yy652 = yylhsminor.yy652; + case 199: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ tags_literal */ +#line 384 "sql.y" +{ yylhsminor.yy416 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy416, &yymsp[-2].minor.yy1109, yymsp[0].minor.yy416); } +#line 6611 "sql.c" + yymsp[-5].minor.yy416 = yylhsminor.yy416; + break; + case 201: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ + case 594: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==594); +#line 389 "sql.y" +{ yylhsminor.yy316 = addNodeToList(pCxt, yymsp[-1].minor.yy316, yymsp[0].minor.yy416); } +#line 6618 "sql.c" + yymsp[-1].minor.yy316 = yylhsminor.yy316; break; case 202: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP tags_literal_list NK_RP table_options */ -#line 392 "sql.y" -{ yylhsminor.yy54 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy325, yymsp[-8].minor.yy54, yymsp[-6].minor.yy54, yymsp[-5].minor.yy652, yymsp[-2].minor.yy652, yymsp[0].minor.yy54); } -#line 6643 "sql.c" - yymsp[-9].minor.yy54 = yylhsminor.yy54; +#line 393 "sql.y" +{ yylhsminor.yy416 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy209, yymsp[-8].minor.yy416, yymsp[-6].minor.yy416, yymsp[-5].minor.yy316, yymsp[-2].minor.yy316, yymsp[0].minor.yy416); } +#line 6624 "sql.c" + yymsp[-9].minor.yy416 = yylhsminor.yy416; break; - case 203: /* create_from_file_clause ::= not_exists_opt USING full_table_name NK_LP tag_list_opt NK_RP FILE NK_STRING */ -#line 395 "sql.y" -{ yylhsminor.yy54 = createCreateSubTableFromFileClause(pCxt, yymsp[-7].minor.yy325, yymsp[-5].minor.yy54, yymsp[-3].minor.yy652, &yymsp[0].minor.yy0); } -#line 6649 "sql.c" - yymsp[-7].minor.yy54 = yylhsminor.yy54; + case 205: /* drop_table_clause ::= exists_opt full_table_name */ +#line 400 "sql.y" +{ yylhsminor.yy416 = createDropTableClause(pCxt, yymsp[-1].minor.yy209, yymsp[0].minor.yy416); } +#line 6630 "sql.c" + yymsp[-1].minor.yy416 = yylhsminor.yy416; break; - case 206: /* drop_table_clause ::= exists_opt full_table_name */ -#line 402 "sql.y" -{ yylhsminor.yy54 = createDropTableClause(pCxt, yymsp[-1].minor.yy325, yymsp[0].minor.yy54); } -#line 6655 "sql.c" - yymsp[-1].minor.yy54 = yylhsminor.yy54; + case 207: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */ + case 409: /* col_list_opt ::= NK_LP column_stream_def_list NK_RP */ yytestcase(yyruleno==409); +#line 405 "sql.y" +{ yymsp[-2].minor.yy316 = yymsp[-1].minor.yy316; } +#line 6637 "sql.c" break; - case 208: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */ - case 410: /* col_list_opt ::= NK_LP column_stream_def_list NK_RP */ yytestcase(yyruleno==410); + case 208: /* full_table_name ::= table_name */ + case 350: /* full_tsma_name ::= tsma_name */ yytestcase(yyruleno==350); #line 407 "sql.y" -{ yymsp[-2].minor.yy652 = yymsp[-1].minor.yy652; } +{ yylhsminor.yy416 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy1109, NULL); } +#line 6643 "sql.c" + yymsp[0].minor.yy416 = yylhsminor.yy416; + break; + case 209: /* full_table_name ::= db_name NK_DOT table_name */ + case 351: /* full_tsma_name ::= db_name NK_DOT tsma_name */ yytestcase(yyruleno==351); +#line 408 "sql.y" +{ yylhsminor.yy416 = createRealTableNode(pCxt, &yymsp[-2].minor.yy1109, &yymsp[0].minor.yy1109, NULL); } +#line 6650 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; + break; + case 212: /* tag_def ::= column_name type_name */ +#line 414 "sql.y" +{ yylhsminor.yy416 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy1109, yymsp[0].minor.yy952, NULL); } +#line 6656 "sql.c" + yymsp[-1].minor.yy416 = yylhsminor.yy416; + break; + case 215: /* column_def ::= column_name type_name column_options */ +#line 422 "sql.y" +{ yylhsminor.yy416 = createColumnDefNode(pCxt, &yymsp[-2].minor.yy1109, yymsp[-1].minor.yy952, yymsp[0].minor.yy416); } #line 6662 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; - case 209: /* full_table_name ::= table_name */ - case 351: /* full_tsma_name ::= tsma_name */ yytestcase(yyruleno==351); -#line 409 "sql.y" -{ yylhsminor.yy54 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy837, NULL); } + case 216: /* type_name ::= BOOL */ +#line 426 "sql.y" +{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_BOOL); } #line 6668 "sql.c" - yymsp[0].minor.yy54 = yylhsminor.yy54; break; - case 210: /* full_table_name ::= db_name NK_DOT table_name */ - case 352: /* full_tsma_name ::= db_name NK_DOT tsma_name */ yytestcase(yyruleno==352); -#line 410 "sql.y" -{ yylhsminor.yy54 = createRealTableNode(pCxt, &yymsp[-2].minor.yy837, &yymsp[0].minor.yy837, NULL); } -#line 6675 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; + case 217: /* type_name ::= TINYINT */ +#line 427 "sql.y" +{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_TINYINT); } +#line 6673 "sql.c" break; - case 213: /* tag_def ::= column_name type_name */ -#line 416 "sql.y" -{ yylhsminor.yy54 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy837, yymsp[0].minor.yy84, NULL); } -#line 6681 "sql.c" - yymsp[-1].minor.yy54 = yylhsminor.yy54; - break; - case 216: /* column_def ::= column_name type_name column_options */ -#line 424 "sql.y" -{ yylhsminor.yy54 = createColumnDefNode(pCxt, &yymsp[-2].minor.yy837, yymsp[-1].minor.yy84, yymsp[0].minor.yy54); } -#line 6687 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; - break; - case 217: /* type_name ::= BOOL */ + case 218: /* type_name ::= SMALLINT */ #line 428 "sql.y" -{ yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_BOOL); } -#line 6693 "sql.c" +{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_SMALLINT); } +#line 6678 "sql.c" break; - case 218: /* type_name ::= TINYINT */ + case 219: /* type_name ::= INT */ + case 220: /* type_name ::= INTEGER */ yytestcase(yyruleno==220); #line 429 "sql.y" -{ yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_TINYINT); } -#line 6698 "sql.c" +{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_INT); } +#line 6684 "sql.c" break; - case 219: /* type_name ::= SMALLINT */ -#line 430 "sql.y" -{ yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_SMALLINT); } -#line 6703 "sql.c" - break; - case 220: /* type_name ::= INT */ - case 221: /* type_name ::= INTEGER */ yytestcase(yyruleno==221); + case 221: /* type_name ::= BIGINT */ #line 431 "sql.y" -{ yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_INT); } +{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_BIGINT); } +#line 6689 "sql.c" + break; + case 222: /* type_name ::= FLOAT */ +#line 432 "sql.y" +{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_FLOAT); } +#line 6694 "sql.c" + break; + case 223: /* type_name ::= DOUBLE */ +#line 433 "sql.y" +{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_DOUBLE); } +#line 6699 "sql.c" + break; + case 224: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ +#line 434 "sql.y" +{ yymsp[-3].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } +#line 6704 "sql.c" + break; + case 225: /* type_name ::= TIMESTAMP */ +#line 435 "sql.y" +{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } #line 6709 "sql.c" break; - case 222: /* type_name ::= BIGINT */ -#line 433 "sql.y" -{ yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_BIGINT); } + case 226: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ +#line 436 "sql.y" +{ yymsp[-3].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } #line 6714 "sql.c" break; - case 223: /* type_name ::= FLOAT */ -#line 434 "sql.y" -{ yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_FLOAT); } + case 227: /* type_name ::= TINYINT UNSIGNED */ +#line 437 "sql.y" +{ yymsp[-1].minor.yy952 = createDataType(TSDB_DATA_TYPE_UTINYINT); } #line 6719 "sql.c" break; - case 224: /* type_name ::= DOUBLE */ -#line 435 "sql.y" -{ yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_DOUBLE); } + case 228: /* type_name ::= SMALLINT UNSIGNED */ +#line 438 "sql.y" +{ yymsp[-1].minor.yy952 = createDataType(TSDB_DATA_TYPE_USMALLINT); } #line 6724 "sql.c" break; - case 225: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ -#line 436 "sql.y" -{ yymsp[-3].minor.yy84 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } + case 229: /* type_name ::= INT UNSIGNED */ +#line 439 "sql.y" +{ yymsp[-1].minor.yy952 = createDataType(TSDB_DATA_TYPE_UINT); } #line 6729 "sql.c" break; - case 226: /* type_name ::= TIMESTAMP */ -#line 437 "sql.y" -{ yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } + case 230: /* type_name ::= BIGINT UNSIGNED */ +#line 440 "sql.y" +{ yymsp[-1].minor.yy952 = createDataType(TSDB_DATA_TYPE_UBIGINT); } #line 6734 "sql.c" break; - case 227: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ -#line 438 "sql.y" -{ yymsp[-3].minor.yy84 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } + case 231: /* type_name ::= JSON */ +#line 441 "sql.y" +{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_JSON); } #line 6739 "sql.c" break; - case 228: /* type_name ::= TINYINT UNSIGNED */ -#line 439 "sql.y" -{ yymsp[-1].minor.yy84 = createDataType(TSDB_DATA_TYPE_UTINYINT); } + case 232: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ +#line 442 "sql.y" +{ yymsp[-3].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } #line 6744 "sql.c" break; - case 229: /* type_name ::= SMALLINT UNSIGNED */ -#line 440 "sql.y" -{ yymsp[-1].minor.yy84 = createDataType(TSDB_DATA_TYPE_USMALLINT); } + case 233: /* type_name ::= MEDIUMBLOB */ +#line 443 "sql.y" +{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } #line 6749 "sql.c" break; - case 230: /* type_name ::= INT UNSIGNED */ -#line 441 "sql.y" -{ yymsp[-1].minor.yy84 = createDataType(TSDB_DATA_TYPE_UINT); } + case 234: /* type_name ::= BLOB */ +#line 444 "sql.y" +{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_BLOB); } #line 6754 "sql.c" break; - case 231: /* type_name ::= BIGINT UNSIGNED */ -#line 442 "sql.y" -{ yymsp[-1].minor.yy84 = createDataType(TSDB_DATA_TYPE_UBIGINT); } + case 235: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ +#line 445 "sql.y" +{ yymsp[-3].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } #line 6759 "sql.c" break; - case 232: /* type_name ::= JSON */ -#line 443 "sql.y" -{ yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_JSON); } + case 236: /* type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ +#line 446 "sql.y" +{ yymsp[-3].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_GEOMETRY, &yymsp[-1].minor.yy0); } #line 6764 "sql.c" break; - case 233: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ -#line 444 "sql.y" -{ yymsp[-3].minor.yy84 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } + case 237: /* type_name ::= DECIMAL */ +#line 447 "sql.y" +{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_DECIMAL); } #line 6769 "sql.c" break; - case 234: /* type_name ::= MEDIUMBLOB */ -#line 445 "sql.y" -{ yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } + case 238: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ +#line 448 "sql.y" +{ yymsp[-3].minor.yy952 = createDataType(TSDB_DATA_TYPE_DECIMAL); } #line 6774 "sql.c" break; - case 235: /* type_name ::= BLOB */ -#line 446 "sql.y" -{ yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_BLOB); } + case 239: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ +#line 449 "sql.y" +{ yymsp[-5].minor.yy952 = createDataType(TSDB_DATA_TYPE_DECIMAL); } #line 6779 "sql.c" break; - case 236: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ -#line 447 "sql.y" -{ yymsp[-3].minor.yy84 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } + case 240: /* type_name_default_len ::= BINARY */ +#line 453 "sql.y" +{ yymsp[0].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, NULL); } #line 6784 "sql.c" break; - case 237: /* type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */ -#line 448 "sql.y" -{ yymsp[-3].minor.yy84 = createVarLenDataType(TSDB_DATA_TYPE_GEOMETRY, &yymsp[-1].minor.yy0); } + case 241: /* type_name_default_len ::= NCHAR */ +#line 454 "sql.y" +{ yymsp[0].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, NULL); } #line 6789 "sql.c" break; - case 238: /* type_name ::= DECIMAL */ -#line 449 "sql.y" -{ yymsp[0].minor.yy84 = createDataType(TSDB_DATA_TYPE_DECIMAL); } + case 242: /* type_name_default_len ::= VARCHAR */ +#line 455 "sql.y" +{ yymsp[0].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, NULL); } #line 6794 "sql.c" break; - case 239: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ -#line 450 "sql.y" -{ yymsp[-3].minor.yy84 = createDataType(TSDB_DATA_TYPE_DECIMAL); } + case 243: /* type_name_default_len ::= VARBINARY */ +#line 456 "sql.y" +{ yymsp[0].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, NULL); } #line 6799 "sql.c" break; - case 240: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ -#line 451 "sql.y" -{ yymsp[-5].minor.yy84 = createDataType(TSDB_DATA_TYPE_DECIMAL); } -#line 6804 "sql.c" + case 246: /* tags_def ::= TAGS NK_LP tag_def_list NK_RP */ + case 417: /* tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP */ yytestcase(yyruleno==417); +#line 465 "sql.y" +{ yymsp[-3].minor.yy316 = yymsp[-1].minor.yy316; } +#line 6805 "sql.c" break; - case 241: /* type_name_default_len ::= BINARY */ -#line 455 "sql.y" -{ yymsp[0].minor.yy84 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, NULL); } -#line 6809 "sql.c" - break; - case 242: /* type_name_default_len ::= NCHAR */ -#line 456 "sql.y" -{ yymsp[0].minor.yy84 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, NULL); } -#line 6814 "sql.c" - break; - case 243: /* type_name_default_len ::= VARCHAR */ -#line 457 "sql.y" -{ yymsp[0].minor.yy84 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, NULL); } -#line 6819 "sql.c" - break; - case 244: /* type_name_default_len ::= VARBINARY */ -#line 458 "sql.y" -{ yymsp[0].minor.yy84 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, NULL); } -#line 6824 "sql.c" - break; - case 247: /* tags_def ::= TAGS NK_LP tag_def_list NK_RP */ - case 418: /* tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP */ yytestcase(yyruleno==418); + case 247: /* table_options ::= */ #line 467 "sql.y" -{ yymsp[-3].minor.yy652 = yymsp[-1].minor.yy652; } -#line 6830 "sql.c" +{ yymsp[1].minor.yy416 = createDefaultTableOptions(pCxt); } +#line 6810 "sql.c" break; - case 248: /* table_options ::= */ + case 248: /* table_options ::= table_options COMMENT NK_STRING */ +#line 468 "sql.y" +{ yylhsminor.yy416 = setTableOption(pCxt, yymsp[-2].minor.yy416, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } +#line 6815 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; + break; + case 249: /* table_options ::= table_options MAX_DELAY duration_list */ #line 469 "sql.y" -{ yymsp[1].minor.yy54 = createDefaultTableOptions(pCxt); } -#line 6835 "sql.c" +{ yylhsminor.yy416 = setTableOption(pCxt, yymsp[-2].minor.yy416, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy316); } +#line 6821 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; - case 249: /* table_options ::= table_options COMMENT NK_STRING */ + case 250: /* table_options ::= table_options WATERMARK duration_list */ #line 470 "sql.y" -{ yylhsminor.yy54 = setTableOption(pCxt, yymsp[-2].minor.yy54, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } -#line 6840 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = setTableOption(pCxt, yymsp[-2].minor.yy416, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy316); } +#line 6827 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; - case 250: /* table_options ::= table_options MAX_DELAY duration_list */ + case 251: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ #line 471 "sql.y" -{ yylhsminor.yy54 = setTableOption(pCxt, yymsp[-2].minor.yy54, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy652); } -#line 6846 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = setTableOption(pCxt, yymsp[-4].minor.yy416, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy316); } +#line 6833 "sql.c" + yymsp[-4].minor.yy416 = yylhsminor.yy416; break; - case 251: /* table_options ::= table_options WATERMARK duration_list */ + case 252: /* table_options ::= table_options TTL NK_INTEGER */ #line 472 "sql.y" -{ yylhsminor.yy54 = setTableOption(pCxt, yymsp[-2].minor.yy54, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy652); } -#line 6852 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = setTableOption(pCxt, yymsp[-2].minor.yy416, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } +#line 6839 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; - case 252: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ + case 253: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ #line 473 "sql.y" -{ yylhsminor.yy54 = setTableOption(pCxt, yymsp[-4].minor.yy54, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy652); } -#line 6858 "sql.c" - yymsp[-4].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = setTableOption(pCxt, yymsp[-4].minor.yy416, TABLE_OPTION_SMA, yymsp[-1].minor.yy316); } +#line 6845 "sql.c" + yymsp[-4].minor.yy416 = yylhsminor.yy416; break; - case 253: /* table_options ::= table_options TTL NK_INTEGER */ + case 254: /* table_options ::= table_options DELETE_MARK duration_list */ #line 474 "sql.y" -{ yylhsminor.yy54 = setTableOption(pCxt, yymsp[-2].minor.yy54, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } -#line 6864 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = setTableOption(pCxt, yymsp[-2].minor.yy416, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy316); } +#line 6851 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; - case 254: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ -#line 475 "sql.y" -{ yylhsminor.yy54 = setTableOption(pCxt, yymsp[-4].minor.yy54, TABLE_OPTION_SMA, yymsp[-1].minor.yy652); } -#line 6870 "sql.c" - yymsp[-4].minor.yy54 = yylhsminor.yy54; - break; - case 255: /* table_options ::= table_options DELETE_MARK duration_list */ + case 255: /* alter_table_options ::= alter_table_option */ #line 476 "sql.y" -{ yylhsminor.yy54 = setTableOption(pCxt, yymsp[-2].minor.yy54, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy652); } -#line 6876 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = createAlterTableOptions(pCxt); yylhsminor.yy416 = setTableOption(pCxt, yylhsminor.yy416, yymsp[0].minor.yy101.type, &yymsp[0].minor.yy101.val); } +#line 6857 "sql.c" + yymsp[0].minor.yy416 = yylhsminor.yy416; break; - case 256: /* alter_table_options ::= alter_table_option */ -#line 478 "sql.y" -{ yylhsminor.yy54 = createAlterTableOptions(pCxt); yylhsminor.yy54 = setTableOption(pCxt, yylhsminor.yy54, yymsp[0].minor.yy663.type, &yymsp[0].minor.yy663.val); } -#line 6882 "sql.c" - yymsp[0].minor.yy54 = yylhsminor.yy54; + case 256: /* alter_table_options ::= alter_table_options alter_table_option */ +#line 477 "sql.y" +{ yylhsminor.yy416 = setTableOption(pCxt, yymsp[-1].minor.yy416, yymsp[0].minor.yy101.type, &yymsp[0].minor.yy101.val); } +#line 6863 "sql.c" + yymsp[-1].minor.yy416 = yylhsminor.yy416; break; - case 257: /* alter_table_options ::= alter_table_options alter_table_option */ -#line 479 "sql.y" -{ yylhsminor.yy54 = setTableOption(pCxt, yymsp[-1].minor.yy54, yymsp[0].minor.yy663.type, &yymsp[0].minor.yy663.val); } -#line 6888 "sql.c" - yymsp[-1].minor.yy54 = yylhsminor.yy54; + case 257: /* alter_table_option ::= COMMENT NK_STRING */ +#line 481 "sql.y" +{ yymsp[-1].minor.yy101.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } +#line 6869 "sql.c" break; - case 258: /* alter_table_option ::= COMMENT NK_STRING */ -#line 483 "sql.y" -{ yymsp[-1].minor.yy663.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy663.val = yymsp[0].minor.yy0; } -#line 6894 "sql.c" + case 258: /* alter_table_option ::= TTL NK_INTEGER */ +#line 482 "sql.y" +{ yymsp[-1].minor.yy101.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy101.val = yymsp[0].minor.yy0; } +#line 6874 "sql.c" break; - case 259: /* alter_table_option ::= TTL NK_INTEGER */ -#line 484 "sql.y" -{ yymsp[-1].minor.yy663.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy663.val = yymsp[0].minor.yy0; } -#line 6899 "sql.c" + case 259: /* duration_list ::= duration_literal */ + case 546: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==546); +#line 486 "sql.y" +{ yylhsminor.yy316 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy416)); } +#line 6880 "sql.c" + yymsp[0].minor.yy316 = yylhsminor.yy316; break; - case 260: /* duration_list ::= duration_literal */ - case 547: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==547); -#line 488 "sql.y" -{ yylhsminor.yy652 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy54)); } -#line 6905 "sql.c" - yymsp[0].minor.yy652 = yylhsminor.yy652; + case 260: /* duration_list ::= duration_list NK_COMMA duration_literal */ + case 547: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==547); +#line 487 "sql.y" +{ yylhsminor.yy316 = addNodeToList(pCxt, yymsp[-2].minor.yy316, releaseRawExprNode(pCxt, yymsp[0].minor.yy416)); } +#line 6887 "sql.c" + yymsp[-2].minor.yy316 = yylhsminor.yy316; break; - case 261: /* duration_list ::= duration_list NK_COMMA duration_literal */ - case 548: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==548); -#line 489 "sql.y" -{ yylhsminor.yy652 = addNodeToList(pCxt, yymsp[-2].minor.yy652, releaseRawExprNode(pCxt, yymsp[0].minor.yy54)); } -#line 6912 "sql.c" - yymsp[-2].minor.yy652 = yylhsminor.yy652; + case 263: /* rollup_func_name ::= function_name */ +#line 494 "sql.y" +{ yylhsminor.yy416 = createFunctionNode(pCxt, &yymsp[0].minor.yy1109, NULL); } +#line 6893 "sql.c" + yymsp[0].minor.yy416 = yylhsminor.yy416; break; - case 264: /* rollup_func_name ::= function_name */ -#line 496 "sql.y" -{ yylhsminor.yy54 = createFunctionNode(pCxt, &yymsp[0].minor.yy837, NULL); } -#line 6918 "sql.c" - yymsp[0].minor.yy54 = yylhsminor.yy54; + case 264: /* rollup_func_name ::= FIRST */ + case 265: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==265); + case 339: /* tag_item ::= QTAGS */ yytestcase(yyruleno==339); +#line 495 "sql.y" +{ yylhsminor.yy416 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } +#line 6901 "sql.c" + yymsp[0].minor.yy416 = yylhsminor.yy416; break; - case 265: /* rollup_func_name ::= FIRST */ - case 266: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==266); - case 340: /* tag_item ::= QTAGS */ yytestcase(yyruleno==340); -#line 497 "sql.y" -{ yylhsminor.yy54 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } -#line 6926 "sql.c" - yymsp[0].minor.yy54 = yylhsminor.yy54; + case 268: /* col_name ::= column_name */ + case 340: /* tag_item ::= column_name */ yytestcase(yyruleno==340); +#line 503 "sql.y" +{ yylhsminor.yy416 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy1109); } +#line 6908 "sql.c" + yymsp[0].minor.yy416 = yylhsminor.yy416; break; - case 269: /* col_name ::= column_name */ - case 341: /* tag_item ::= column_name */ yytestcase(yyruleno==341); -#line 505 "sql.y" -{ yylhsminor.yy54 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy837); } -#line 6933 "sql.c" - yymsp[0].minor.yy54 = yylhsminor.yy54; - break; - case 270: /* cmd ::= SHOW DNODES */ -#line 508 "sql.y" + case 269: /* cmd ::= SHOW DNODES */ +#line 506 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT); } -#line 6939 "sql.c" +#line 6914 "sql.c" break; - case 271: /* cmd ::= SHOW USERS */ -#line 509 "sql.y" + case 270: /* cmd ::= SHOW USERS */ +#line 507 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USERS_STMT); } -#line 6944 "sql.c" +#line 6919 "sql.c" break; - case 272: /* cmd ::= SHOW USERS FULL */ -#line 510 "sql.y" + case 271: /* cmd ::= SHOW USERS FULL */ +#line 508 "sql.y" { pCxt->pRootNode = createShowStmtWithFull(pCxt, QUERY_NODE_SHOW_USERS_FULL_STMT); } -#line 6949 "sql.c" +#line 6924 "sql.c" break; - case 273: /* cmd ::= SHOW USER PRIVILEGES */ -#line 511 "sql.y" + case 272: /* cmd ::= SHOW USER PRIVILEGES */ +#line 509 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USER_PRIVILEGES_STMT); } -#line 6954 "sql.c" +#line 6929 "sql.c" break; - case 274: /* cmd ::= SHOW db_kind_opt DATABASES */ -#line 512 "sql.y" + case 273: /* cmd ::= SHOW db_kind_opt DATABASES */ +#line 510 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT); - setShowKind(pCxt, pCxt->pRootNode, yymsp[-1].minor.yy719); + setShowKind(pCxt, pCxt->pRootNode, yymsp[-1].minor.yy681); } -#line 6962 "sql.c" +#line 6937 "sql.c" break; - case 275: /* cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */ -#line 516 "sql.y" + case 274: /* cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */ +#line 514 "sql.y" { - pCxt->pRootNode = createShowTablesStmt(pCxt, yymsp[-2].minor.yy579, yymsp[0].minor.yy54, OP_TYPE_LIKE); + pCxt->pRootNode = createShowTablesStmt(pCxt, yymsp[-2].minor.yy925, yymsp[0].minor.yy416, OP_TYPE_LIKE); } +#line 6944 "sql.c" + break; + case 275: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ +#line 517 "sql.y" +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy416, yymsp[0].minor.yy416, OP_TYPE_LIKE); } +#line 6949 "sql.c" + break; + case 276: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ +#line 518 "sql.y" +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy416, NULL, OP_TYPE_LIKE); } +#line 6954 "sql.c" + break; + case 277: /* cmd ::= SHOW MNODES */ +#line 519 "sql.y" +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT); } +#line 6959 "sql.c" + break; + case 278: /* cmd ::= SHOW QNODES */ +#line 521 "sql.y" +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QNODES_STMT); } +#line 6964 "sql.c" + break; + case 279: /* cmd ::= SHOW ARBGROUPS */ +#line 522 "sql.y" +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_ARBGROUPS_STMT); } #line 6969 "sql.c" break; - case 276: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ -#line 519 "sql.y" -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy54, yymsp[0].minor.yy54, OP_TYPE_LIKE); } + case 280: /* cmd ::= SHOW FUNCTIONS */ +#line 523 "sql.y" +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT); } #line 6974 "sql.c" break; - case 277: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ -#line 520 "sql.y" -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy54, NULL, OP_TYPE_LIKE); } + case 281: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ +#line 524 "sql.y" +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy416, yymsp[-1].minor.yy416, OP_TYPE_EQUAL); } #line 6979 "sql.c" break; - case 278: /* cmd ::= SHOW MNODES */ -#line 521 "sql.y" -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT); } + case 282: /* cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ +#line 525 "sql.y" +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy1109), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy1109), OP_TYPE_EQUAL); } #line 6984 "sql.c" break; - case 279: /* cmd ::= SHOW QNODES */ -#line 523 "sql.y" -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QNODES_STMT); } + case 283: /* cmd ::= SHOW STREAMS */ +#line 526 "sql.y" +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT); } #line 6989 "sql.c" break; - case 280: /* cmd ::= SHOW ARBGROUPS */ -#line 524 "sql.y" -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_ARBGROUPS_STMT); } + case 284: /* cmd ::= SHOW ACCOUNTS */ +#line 527 "sql.y" +{ pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } #line 6994 "sql.c" break; - case 281: /* cmd ::= SHOW FUNCTIONS */ -#line 525 "sql.y" -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT); } + case 285: /* cmd ::= SHOW APPS */ +#line 528 "sql.y" +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_APPS_STMT); } #line 6999 "sql.c" break; - case 282: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ -#line 526 "sql.y" -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy54, yymsp[-1].minor.yy54, OP_TYPE_EQUAL); } + case 286: /* cmd ::= SHOW CONNECTIONS */ +#line 529 "sql.y" +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONNECTIONS_STMT); } #line 7004 "sql.c" break; - case 283: /* cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */ -#line 527 "sql.y" -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy837), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy837), OP_TYPE_EQUAL); } -#line 7009 "sql.c" - break; - case 284: /* cmd ::= SHOW STREAMS */ -#line 528 "sql.y" -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT); } -#line 7014 "sql.c" - break; - case 285: /* cmd ::= SHOW ACCOUNTS */ -#line 529 "sql.y" -{ pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } -#line 7019 "sql.c" - break; - case 286: /* cmd ::= SHOW APPS */ + case 287: /* cmd ::= SHOW LICENCES */ + case 288: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==288); #line 530 "sql.y" -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_APPS_STMT); } -#line 7024 "sql.c" - break; - case 287: /* cmd ::= SHOW CONNECTIONS */ -#line 531 "sql.y" -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONNECTIONS_STMT); } -#line 7029 "sql.c" - break; - case 288: /* cmd ::= SHOW LICENCES */ - case 289: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==289); -#line 532 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCES_STMT); } +#line 7010 "sql.c" + break; + case 289: /* cmd ::= SHOW GRANTS FULL */ +#line 532 "sql.y" +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_GRANTS_FULL_STMT); } +#line 7015 "sql.c" + break; + case 290: /* cmd ::= SHOW GRANTS LOGS */ +#line 533 "sql.y" +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_GRANTS_LOGS_STMT); } +#line 7020 "sql.c" + break; + case 291: /* cmd ::= SHOW CLUSTER MACHINES */ +#line 534 "sql.y" +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_MACHINES_STMT); } +#line 7025 "sql.c" + break; + case 292: /* cmd ::= SHOW CREATE DATABASE db_name */ +#line 535 "sql.y" +{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy1109); } +#line 7030 "sql.c" + break; + case 293: /* cmd ::= SHOW CREATE TABLE full_table_name */ +#line 536 "sql.y" +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy416); } #line 7035 "sql.c" break; - case 290: /* cmd ::= SHOW GRANTS FULL */ -#line 534 "sql.y" -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_GRANTS_FULL_STMT); } -#line 7040 "sql.c" - break; - case 291: /* cmd ::= SHOW GRANTS LOGS */ -#line 535 "sql.y" -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_GRANTS_LOGS_STMT); } -#line 7045 "sql.c" - break; - case 292: /* cmd ::= SHOW CLUSTER MACHINES */ -#line 536 "sql.y" -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_MACHINES_STMT); } -#line 7050 "sql.c" - break; - case 293: /* cmd ::= SHOW CREATE DATABASE db_name */ + case 294: /* cmd ::= SHOW CREATE STABLE full_table_name */ #line 537 "sql.y" -{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy837); } -#line 7055 "sql.c" - break; - case 294: /* cmd ::= SHOW CREATE TABLE full_table_name */ -#line 538 "sql.y" -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy54); } -#line 7060 "sql.c" - break; - case 295: /* cmd ::= SHOW CREATE STABLE full_table_name */ -#line 539 "sql.y" { pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, -yymsp[0].minor.yy54); } -#line 7066 "sql.c" +yymsp[0].minor.yy416); } +#line 7041 "sql.c" break; - case 296: /* cmd ::= SHOW ENCRYPTIONS */ -#line 541 "sql.y" + case 295: /* cmd ::= SHOW ENCRYPTIONS */ +#line 539 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_ENCRYPTIONS_STMT); } -#line 7071 "sql.c" +#line 7046 "sql.c" break; - case 297: /* cmd ::= SHOW QUERIES */ -#line 542 "sql.y" + case 296: /* cmd ::= SHOW QUERIES */ +#line 540 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT); } -#line 7076 "sql.c" +#line 7051 "sql.c" break; - case 298: /* cmd ::= SHOW SCORES */ -#line 543 "sql.y" + case 297: /* cmd ::= SHOW SCORES */ +#line 541 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SCORES_STMT); } -#line 7081 "sql.c" +#line 7056 "sql.c" break; - case 299: /* cmd ::= SHOW TOPICS */ -#line 544 "sql.y" + case 298: /* cmd ::= SHOW TOPICS */ +#line 542 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TOPICS_STMT); } -#line 7086 "sql.c" +#line 7061 "sql.c" break; - case 300: /* cmd ::= SHOW VARIABLES */ - case 301: /* cmd ::= SHOW CLUSTER VARIABLES */ yytestcase(yyruleno==301); -#line 545 "sql.y" + case 299: /* cmd ::= SHOW VARIABLES */ + case 300: /* cmd ::= SHOW CLUSTER VARIABLES */ yytestcase(yyruleno==300); +#line 543 "sql.y" { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VARIABLES_STMT); } +#line 7067 "sql.c" + break; + case 301: /* cmd ::= SHOW LOCAL VARIABLES */ +#line 545 "sql.y" +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT); } +#line 7072 "sql.c" + break; + case 302: /* cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ +#line 546 "sql.y" +{ pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[-2].minor.yy0), yymsp[0].minor.yy416); } +#line 7077 "sql.c" + break; + case 303: /* cmd ::= SHOW BNODES */ +#line 547 "sql.y" +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_BNODES_STMT); } +#line 7082 "sql.c" + break; + case 304: /* cmd ::= SHOW SNODES */ +#line 548 "sql.y" +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SNODES_STMT); } +#line 7087 "sql.c" + break; + case 305: /* cmd ::= SHOW CLUSTER */ +#line 549 "sql.y" +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_STMT); } #line 7092 "sql.c" break; - case 302: /* cmd ::= SHOW LOCAL VARIABLES */ -#line 547 "sql.y" -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT); } + case 306: /* cmd ::= SHOW TRANSACTIONS */ +#line 550 "sql.y" +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TRANSACTIONS_STMT); } #line 7097 "sql.c" break; - case 303: /* cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ -#line 548 "sql.y" -{ pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[-2].minor.yy0), yymsp[0].minor.yy54); } + case 307: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ +#line 551 "sql.y" +{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy416); } #line 7102 "sql.c" break; - case 304: /* cmd ::= SHOW BNODES */ -#line 549 "sql.y" -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_BNODES_STMT); } + case 308: /* cmd ::= SHOW CONSUMERS */ +#line 552 "sql.y" +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); } #line 7107 "sql.c" break; - case 305: /* cmd ::= SHOW SNODES */ -#line 550 "sql.y" -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SNODES_STMT); } + case 309: /* cmd ::= SHOW SUBSCRIPTIONS */ +#line 553 "sql.y" +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT); } #line 7112 "sql.c" break; - case 306: /* cmd ::= SHOW CLUSTER */ -#line 551 "sql.y" -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_STMT); } + case 310: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ +#line 554 "sql.y" +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy416, yymsp[-1].minor.yy416, OP_TYPE_EQUAL); } #line 7117 "sql.c" break; - case 307: /* cmd ::= SHOW TRANSACTIONS */ -#line 552 "sql.y" -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TRANSACTIONS_STMT); } + case 311: /* cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ +#line 555 "sql.y" +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy1109), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy1109), OP_TYPE_EQUAL); } #line 7122 "sql.c" break; - case 308: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ -#line 553 "sql.y" -{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy54); } + case 312: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ +#line 556 "sql.y" +{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy416, yymsp[0].minor.yy416, yymsp[-3].minor.yy316); } #line 7127 "sql.c" break; - case 309: /* cmd ::= SHOW CONSUMERS */ -#line 554 "sql.y" -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); } + case 313: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ +#line 557 "sql.y" +{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, createIdentifierValueNode(pCxt, &yymsp[0].minor.yy1109), createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy1109), yymsp[-4].minor.yy316); } #line 7132 "sql.c" break; - case 310: /* cmd ::= SHOW SUBSCRIPTIONS */ -#line 555 "sql.y" -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT); } + case 314: /* cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ +#line 558 "sql.y" +{ pCxt->pRootNode = createShowVnodesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0), NULL); } #line 7137 "sql.c" break; - case 311: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ -#line 556 "sql.y" -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy54, yymsp[-1].minor.yy54, OP_TYPE_EQUAL); } + case 315: /* cmd ::= SHOW VNODES */ +#line 559 "sql.y" +{ pCxt->pRootNode = createShowVnodesStmt(pCxt, NULL, NULL); } #line 7142 "sql.c" break; - case 312: /* cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */ -#line 557 "sql.y" -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy837), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy837), OP_TYPE_EQUAL); } + case 316: /* cmd ::= SHOW db_name_cond_opt ALIVE */ +#line 561 "sql.y" +{ pCxt->pRootNode = createShowAliveStmt(pCxt, yymsp[-1].minor.yy416, QUERY_NODE_SHOW_DB_ALIVE_STMT); } #line 7147 "sql.c" break; - case 313: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ -#line 558 "sql.y" -{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy54, yymsp[0].minor.yy54, yymsp[-3].minor.yy652); } + case 317: /* cmd ::= SHOW CLUSTER ALIVE */ +#line 562 "sql.y" +{ pCxt->pRootNode = createShowAliveStmt(pCxt, NULL, QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT); } #line 7152 "sql.c" break; - case 314: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */ -#line 559 "sql.y" -{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, createIdentifierValueNode(pCxt, &yymsp[0].minor.yy837), createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy837), yymsp[-4].minor.yy652); } + case 318: /* cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt */ +#line 563 "sql.y" +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VIEWS_STMT, yymsp[-2].minor.yy416, yymsp[0].minor.yy416, OP_TYPE_LIKE); } #line 7157 "sql.c" break; - case 315: /* cmd ::= SHOW VNODES ON DNODE NK_INTEGER */ -#line 560 "sql.y" -{ pCxt->pRootNode = createShowVnodesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0), NULL); } + case 319: /* cmd ::= SHOW CREATE VIEW full_table_name */ +#line 564 "sql.y" +{ pCxt->pRootNode = createShowCreateViewStmt(pCxt, QUERY_NODE_SHOW_CREATE_VIEW_STMT, yymsp[0].minor.yy416); } #line 7162 "sql.c" break; - case 316: /* cmd ::= SHOW VNODES */ -#line 561 "sql.y" -{ pCxt->pRootNode = createShowVnodesStmt(pCxt, NULL, NULL); } + case 320: /* cmd ::= SHOW COMPACTS */ +#line 565 "sql.y" +{ pCxt->pRootNode = createShowCompactsStmt(pCxt, QUERY_NODE_SHOW_COMPACTS_STMT); } #line 7167 "sql.c" break; - case 317: /* cmd ::= SHOW db_name_cond_opt ALIVE */ -#line 563 "sql.y" -{ pCxt->pRootNode = createShowAliveStmt(pCxt, yymsp[-1].minor.yy54, QUERY_NODE_SHOW_DB_ALIVE_STMT); } + case 321: /* cmd ::= SHOW COMPACT NK_INTEGER */ +#line 566 "sql.y" +{ pCxt->pRootNode = createShowCompactDetailsStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } #line 7172 "sql.c" break; - case 318: /* cmd ::= SHOW CLUSTER ALIVE */ -#line 564 "sql.y" -{ pCxt->pRootNode = createShowAliveStmt(pCxt, NULL, QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT); } + case 322: /* table_kind_db_name_cond_opt ::= */ +#line 570 "sql.y" +{ yymsp[1].minor.yy925.kind = SHOW_KIND_ALL; yymsp[1].minor.yy925.dbName = nil_token; } #line 7177 "sql.c" break; - case 319: /* cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt */ -#line 565 "sql.y" -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VIEWS_STMT, yymsp[-2].minor.yy54, yymsp[0].minor.yy54, OP_TYPE_LIKE); } + case 323: /* table_kind_db_name_cond_opt ::= table_kind */ +#line 571 "sql.y" +{ yylhsminor.yy925.kind = yymsp[0].minor.yy681; yylhsminor.yy925.dbName = nil_token; } #line 7182 "sql.c" + yymsp[0].minor.yy925 = yylhsminor.yy925; break; - case 320: /* cmd ::= SHOW CREATE VIEW full_table_name */ -#line 566 "sql.y" -{ pCxt->pRootNode = createShowCreateViewStmt(pCxt, QUERY_NODE_SHOW_CREATE_VIEW_STMT, yymsp[0].minor.yy54); } -#line 7187 "sql.c" - break; - case 321: /* cmd ::= SHOW COMPACTS */ -#line 567 "sql.y" -{ pCxt->pRootNode = createShowCompactsStmt(pCxt, QUERY_NODE_SHOW_COMPACTS_STMT); } -#line 7192 "sql.c" - break; - case 322: /* cmd ::= SHOW COMPACT NK_INTEGER */ -#line 568 "sql.y" -{ pCxt->pRootNode = createShowCompactDetailsStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } -#line 7197 "sql.c" - break; - case 323: /* table_kind_db_name_cond_opt ::= */ + case 324: /* table_kind_db_name_cond_opt ::= db_name NK_DOT */ #line 572 "sql.y" -{ yymsp[1].minor.yy579.kind = SHOW_KIND_ALL; yymsp[1].minor.yy579.dbName = nil_token; } -#line 7202 "sql.c" +{ yylhsminor.yy925.kind = SHOW_KIND_ALL; yylhsminor.yy925.dbName = yymsp[-1].minor.yy1109; } +#line 7188 "sql.c" + yymsp[-1].minor.yy925 = yylhsminor.yy925; break; - case 324: /* table_kind_db_name_cond_opt ::= table_kind */ + case 325: /* table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ #line 573 "sql.y" -{ yylhsminor.yy579.kind = yymsp[0].minor.yy719; yylhsminor.yy579.dbName = nil_token; } -#line 7207 "sql.c" - yymsp[0].minor.yy579 = yylhsminor.yy579; +{ yylhsminor.yy925.kind = yymsp[-2].minor.yy681; yylhsminor.yy925.dbName = yymsp[-1].minor.yy1109; } +#line 7194 "sql.c" + yymsp[-2].minor.yy925 = yylhsminor.yy925; break; - case 325: /* table_kind_db_name_cond_opt ::= db_name NK_DOT */ -#line 574 "sql.y" -{ yylhsminor.yy579.kind = SHOW_KIND_ALL; yylhsminor.yy579.dbName = yymsp[-1].minor.yy837; } -#line 7213 "sql.c" - yymsp[-1].minor.yy579 = yylhsminor.yy579; + case 326: /* table_kind ::= NORMAL */ +#line 577 "sql.y" +{ yymsp[0].minor.yy681 = SHOW_KIND_TABLES_NORMAL; } +#line 7200 "sql.c" break; - case 326: /* table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */ -#line 575 "sql.y" -{ yylhsminor.yy579.kind = yymsp[-2].minor.yy719; yylhsminor.yy579.dbName = yymsp[-1].minor.yy837; } -#line 7219 "sql.c" - yymsp[-2].minor.yy579 = yylhsminor.yy579; + case 327: /* table_kind ::= CHILD */ +#line 578 "sql.y" +{ yymsp[0].minor.yy681 = SHOW_KIND_TABLES_CHILD; } +#line 7205 "sql.c" break; - case 327: /* table_kind ::= NORMAL */ -#line 579 "sql.y" -{ yymsp[0].minor.yy719 = SHOW_KIND_TABLES_NORMAL; } -#line 7225 "sql.c" - break; - case 328: /* table_kind ::= CHILD */ + case 328: /* db_name_cond_opt ::= */ + case 333: /* from_db_opt ::= */ yytestcase(yyruleno==333); #line 580 "sql.y" -{ yymsp[0].minor.yy719 = SHOW_KIND_TABLES_CHILD; } -#line 7230 "sql.c" +{ yymsp[1].minor.yy416 = createDefaultDatabaseCondValue(pCxt); } +#line 7211 "sql.c" break; - case 329: /* db_name_cond_opt ::= */ - case 334: /* from_db_opt ::= */ yytestcase(yyruleno==334); -#line 582 "sql.y" -{ yymsp[1].minor.yy54 = createDefaultDatabaseCondValue(pCxt); } -#line 7236 "sql.c" + case 329: /* db_name_cond_opt ::= db_name NK_DOT */ +#line 581 "sql.y" +{ yylhsminor.yy416 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy1109); } +#line 7216 "sql.c" + yymsp[-1].minor.yy416 = yylhsminor.yy416; break; - case 330: /* db_name_cond_opt ::= db_name NK_DOT */ -#line 583 "sql.y" -{ yylhsminor.yy54 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy837); } -#line 7241 "sql.c" - yymsp[-1].minor.yy54 = yylhsminor.yy54; + case 331: /* like_pattern_opt ::= LIKE NK_STRING */ +#line 584 "sql.y" +{ yymsp[-1].minor.yy416 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } +#line 7222 "sql.c" break; - case 332: /* like_pattern_opt ::= LIKE NK_STRING */ + case 332: /* table_name_cond ::= table_name */ #line 586 "sql.y" -{ yymsp[-1].minor.yy54 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } -#line 7247 "sql.c" +{ yylhsminor.yy416 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy1109); } +#line 7227 "sql.c" + yymsp[0].minor.yy416 = yylhsminor.yy416; break; - case 333: /* table_name_cond ::= table_name */ -#line 588 "sql.y" -{ yylhsminor.yy54 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy837); } -#line 7252 "sql.c" - yymsp[0].minor.yy54 = yylhsminor.yy54; + case 334: /* from_db_opt ::= FROM db_name */ +#line 589 "sql.y" +{ yymsp[-1].minor.yy416 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy1109); } +#line 7233 "sql.c" break; - case 335: /* from_db_opt ::= FROM db_name */ -#line 591 "sql.y" -{ yymsp[-1].minor.yy54 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy837); } -#line 7258 "sql.c" + case 338: /* tag_item ::= TBNAME */ +#line 597 "sql.y" +{ yylhsminor.yy416 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); } +#line 7238 "sql.c" + yymsp[0].minor.yy416 = yylhsminor.yy416; break; - case 339: /* tag_item ::= TBNAME */ -#line 599 "sql.y" -{ yylhsminor.yy54 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); } -#line 7263 "sql.c" - yymsp[0].minor.yy54 = yylhsminor.yy54; + case 341: /* tag_item ::= column_name column_alias */ +#line 600 "sql.y" +{ yylhsminor.yy416 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy1109), &yymsp[0].minor.yy1109); } +#line 7244 "sql.c" + yymsp[-1].minor.yy416 = yylhsminor.yy416; break; - case 342: /* tag_item ::= column_name column_alias */ -#line 602 "sql.y" -{ yylhsminor.yy54 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy837), &yymsp[0].minor.yy837); } -#line 7269 "sql.c" - yymsp[-1].minor.yy54 = yylhsminor.yy54; + case 342: /* tag_item ::= column_name AS column_alias */ +#line 601 "sql.y" +{ yylhsminor.yy416 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy1109), &yymsp[0].minor.yy1109); } +#line 7250 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; - case 343: /* tag_item ::= column_name AS column_alias */ -#line 603 "sql.y" -{ yylhsminor.yy54 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy837), &yymsp[0].minor.yy837); } -#line 7275 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; + case 343: /* db_kind_opt ::= */ +#line 605 "sql.y" +{ yymsp[1].minor.yy681 = SHOW_KIND_ALL; } +#line 7256 "sql.c" break; - case 344: /* db_kind_opt ::= */ + case 344: /* db_kind_opt ::= USER */ +#line 606 "sql.y" +{ yymsp[0].minor.yy681 = SHOW_KIND_DATABASES_USER; } +#line 7261 "sql.c" + break; + case 345: /* db_kind_opt ::= SYSTEM */ #line 607 "sql.y" -{ yymsp[1].minor.yy719 = SHOW_KIND_ALL; } +{ yymsp[0].minor.yy681 = SHOW_KIND_DATABASES_SYSTEM; } +#line 7266 "sql.c" + break; + case 346: /* cmd ::= CREATE TSMA not_exists_opt tsma_name ON full_table_name tsma_func_list INTERVAL NK_LP duration_literal NK_RP */ +#line 613 "sql.y" +{ pCxt->pRootNode = createCreateTSMAStmt(pCxt, yymsp[-8].minor.yy209, &yymsp[-7].minor.yy1109, yymsp[-4].minor.yy416, yymsp[-5].minor.yy416, releaseRawExprNode(pCxt, yymsp[-1].minor.yy416)); } +#line 7271 "sql.c" + break; + case 347: /* cmd ::= CREATE RECURSIVE TSMA not_exists_opt tsma_name ON full_table_name INTERVAL NK_LP duration_literal NK_RP */ +#line 615 "sql.y" +{ pCxt->pRootNode = createCreateTSMAStmt(pCxt, yymsp[-7].minor.yy209, &yymsp[-6].minor.yy1109, NULL, yymsp[-4].minor.yy416, releaseRawExprNode(pCxt, yymsp[-1].minor.yy416)); } +#line 7276 "sql.c" + break; + case 348: /* cmd ::= DROP TSMA exists_opt full_tsma_name */ +#line 616 "sql.y" +{ pCxt->pRootNode = createDropTSMAStmt(pCxt, yymsp[-1].minor.yy209, yymsp[0].minor.yy416); } #line 7281 "sql.c" break; - case 345: /* db_kind_opt ::= USER */ -#line 608 "sql.y" -{ yymsp[0].minor.yy719 = SHOW_KIND_DATABASES_USER; } + case 349: /* cmd ::= SHOW db_name_cond_opt TSMAS */ +#line 617 "sql.y" +{ pCxt->pRootNode = createShowTSMASStmt(pCxt, yymsp[-1].minor.yy416); } #line 7286 "sql.c" break; - case 346: /* db_kind_opt ::= SYSTEM */ -#line 609 "sql.y" -{ yymsp[0].minor.yy719 = SHOW_KIND_DATABASES_SYSTEM; } + case 352: /* tsma_func_list ::= FUNCTION NK_LP func_list NK_RP */ +#line 624 "sql.y" +{ yymsp[-3].minor.yy416 = createTSMAOptions(pCxt, yymsp[-1].minor.yy316); } #line 7291 "sql.c" break; - case 347: /* cmd ::= CREATE TSMA not_exists_opt tsma_name ON full_table_name tsma_func_list INTERVAL NK_LP duration_literal NK_RP */ -#line 615 "sql.y" -{ pCxt->pRootNode = createCreateTSMAStmt(pCxt, yymsp[-8].minor.yy325, &yymsp[-7].minor.yy837, yymsp[-4].minor.yy54, yymsp[-5].minor.yy54, releaseRawExprNode(pCxt, yymsp[-1].minor.yy54)); } + case 353: /* cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ +#line 628 "sql.y" +{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy209, yymsp[-3].minor.yy416, yymsp[-1].minor.yy416, NULL, yymsp[0].minor.yy416); } #line 7296 "sql.c" break; - case 348: /* cmd ::= CREATE RECURSIVE TSMA not_exists_opt tsma_name ON full_table_name INTERVAL NK_LP duration_literal NK_RP */ -#line 617 "sql.y" -{ pCxt->pRootNode = createCreateTSMAStmt(pCxt, yymsp[-7].minor.yy325, &yymsp[-6].minor.yy837, NULL, yymsp[-4].minor.yy54, releaseRawExprNode(pCxt, yymsp[-1].minor.yy54)); } + case 354: /* cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ +#line 630 "sql.y" +{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_NORMAL, yymsp[-6].minor.yy209, yymsp[-5].minor.yy416, yymsp[-3].minor.yy416, yymsp[-1].minor.yy316, NULL); } #line 7301 "sql.c" break; - case 349: /* cmd ::= DROP TSMA exists_opt full_tsma_name */ -#line 618 "sql.y" -{ pCxt->pRootNode = createDropTSMAStmt(pCxt, yymsp[-1].minor.yy325, yymsp[0].minor.yy54); } + case 355: /* cmd ::= DROP INDEX exists_opt full_index_name */ +#line 631 "sql.y" +{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy209, yymsp[0].minor.yy416); } #line 7306 "sql.c" break; - case 350: /* cmd ::= SHOW db_name_cond_opt TSMAS */ -#line 619 "sql.y" -{ pCxt->pRootNode = createShowTSMASStmt(pCxt, yymsp[-1].minor.yy54); } -#line 7311 "sql.c" - break; - case 353: /* tsma_func_list ::= FUNCTION NK_LP func_list NK_RP */ -#line 626 "sql.y" -{ yymsp[-3].minor.yy54 = createTSMAOptions(pCxt, yymsp[-1].minor.yy652); } -#line 7316 "sql.c" - break; - case 354: /* cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */ -#line 630 "sql.y" -{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy325, yymsp[-3].minor.yy54, yymsp[-1].minor.yy54, NULL, yymsp[0].minor.yy54); } -#line 7321 "sql.c" - break; - case 355: /* cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */ -#line 632 "sql.y" -{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_NORMAL, yymsp[-6].minor.yy325, yymsp[-5].minor.yy54, yymsp[-3].minor.yy54, yymsp[-1].minor.yy652, NULL); } -#line 7326 "sql.c" - break; - case 356: /* cmd ::= DROP INDEX exists_opt full_index_name */ + case 356: /* full_index_name ::= index_name */ #line 633 "sql.y" -{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy325, yymsp[0].minor.yy54); } -#line 7331 "sql.c" +{ yylhsminor.yy416 = createRealTableNodeForIndexName(pCxt, NULL, &yymsp[0].minor.yy1109); } +#line 7311 "sql.c" + yymsp[0].minor.yy416 = yylhsminor.yy416; break; - case 357: /* full_index_name ::= index_name */ -#line 635 "sql.y" -{ yylhsminor.yy54 = createRealTableNodeForIndexName(pCxt, NULL, &yymsp[0].minor.yy837); } -#line 7336 "sql.c" - yymsp[0].minor.yy54 = yylhsminor.yy54; + case 357: /* full_index_name ::= db_name NK_DOT index_name */ +#line 634 "sql.y" +{ yylhsminor.yy416 = createRealTableNodeForIndexName(pCxt, &yymsp[-2].minor.yy1109, &yymsp[0].minor.yy1109); } +#line 7317 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; - case 358: /* full_index_name ::= db_name NK_DOT index_name */ -#line 636 "sql.y" -{ yylhsminor.yy54 = createRealTableNodeForIndexName(pCxt, &yymsp[-2].minor.yy837, &yymsp[0].minor.yy837); } -#line 7342 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; + case 358: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ +#line 637 "sql.y" +{ yymsp[-9].minor.yy416 = createIndexOption(pCxt, yymsp[-7].minor.yy316, releaseRawExprNode(pCxt, yymsp[-3].minor.yy416), NULL, yymsp[-1].minor.yy416, yymsp[0].minor.yy416); } +#line 7323 "sql.c" break; - case 359: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ -#line 639 "sql.y" -{ yymsp[-9].minor.yy54 = createIndexOption(pCxt, yymsp[-7].minor.yy652, releaseRawExprNode(pCxt, yymsp[-3].minor.yy54), NULL, yymsp[-1].minor.yy54, yymsp[0].minor.yy54); } -#line 7348 "sql.c" + case 359: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */ +#line 640 "sql.y" +{ yymsp[-11].minor.yy416 = createIndexOption(pCxt, yymsp[-9].minor.yy316, releaseRawExprNode(pCxt, yymsp[-5].minor.yy416), releaseRawExprNode(pCxt, yymsp[-3].minor.yy416), yymsp[-1].minor.yy416, yymsp[0].minor.yy416); } +#line 7328 "sql.c" break; - case 360: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */ -#line 642 "sql.y" -{ yymsp[-11].minor.yy54 = createIndexOption(pCxt, yymsp[-9].minor.yy652, releaseRawExprNode(pCxt, yymsp[-5].minor.yy54), releaseRawExprNode(pCxt, yymsp[-3].minor.yy54), yymsp[-1].minor.yy54, yymsp[0].minor.yy54); } -#line 7353 "sql.c" + case 362: /* func ::= sma_func_name NK_LP expression_list NK_RP */ +#line 647 "sql.y" +{ yylhsminor.yy416 = createFunctionNode(pCxt, &yymsp[-3].minor.yy1109, yymsp[-1].minor.yy316); } +#line 7333 "sql.c" + yymsp[-3].minor.yy416 = yylhsminor.yy416; break; - case 363: /* func ::= sma_func_name NK_LP expression_list NK_RP */ -#line 649 "sql.y" -{ yylhsminor.yy54 = createFunctionNode(pCxt, &yymsp[-3].minor.yy837, yymsp[-1].minor.yy652); } -#line 7358 "sql.c" - yymsp[-3].minor.yy54 = yylhsminor.yy54; + case 363: /* sma_func_name ::= function_name */ + case 637: /* alias_opt ::= table_alias */ yytestcase(yyruleno==637); +#line 651 "sql.y" +{ yylhsminor.yy1109 = yymsp[0].minor.yy1109; } +#line 7340 "sql.c" + yymsp[0].minor.yy1109 = yylhsminor.yy1109; break; - case 364: /* sma_func_name ::= function_name */ - case 638: /* alias_opt ::= table_alias */ yytestcase(yyruleno==638); -#line 653 "sql.y" -{ yylhsminor.yy837 = yymsp[0].minor.yy837; } -#line 7365 "sql.c" - yymsp[0].minor.yy837 = yylhsminor.yy837; + case 368: /* sma_stream_opt ::= */ + case 418: /* stream_options ::= */ yytestcase(yyruleno==418); +#line 657 "sql.y" +{ yymsp[1].minor.yy416 = createStreamOptions(pCxt); } +#line 7347 "sql.c" break; - case 369: /* sma_stream_opt ::= */ - case 419: /* stream_options ::= */ yytestcase(yyruleno==419); + case 369: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ +#line 658 "sql.y" +{ ((SStreamOptions*)yymsp[-2].minor.yy416)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy416); yylhsminor.yy416 = yymsp[-2].minor.yy416; } +#line 7352 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; + break; + case 370: /* sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ #line 659 "sql.y" -{ yymsp[1].minor.yy54 = createStreamOptions(pCxt); } -#line 7372 "sql.c" +{ ((SStreamOptions*)yymsp[-2].minor.yy416)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy416); yylhsminor.yy416 = yymsp[-2].minor.yy416; } +#line 7358 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; - case 370: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ + case 371: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ #line 660 "sql.y" -{ ((SStreamOptions*)yymsp[-2].minor.yy54)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy54); yylhsminor.yy54 = yymsp[-2].minor.yy54; } -#line 7377 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; +{ ((SStreamOptions*)yymsp[-2].minor.yy416)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy416); yylhsminor.yy416 = yymsp[-2].minor.yy416; } +#line 7364 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; - case 371: /* sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ -#line 661 "sql.y" -{ ((SStreamOptions*)yymsp[-2].minor.yy54)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy54); yylhsminor.yy54 = yymsp[-2].minor.yy54; } -#line 7383 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; + case 372: /* with_meta ::= AS */ +#line 665 "sql.y" +{ yymsp[0].minor.yy820 = 0; } +#line 7370 "sql.c" break; - case 372: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ -#line 662 "sql.y" -{ ((SStreamOptions*)yymsp[-2].minor.yy54)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy54); yylhsminor.yy54 = yymsp[-2].minor.yy54; } -#line 7389 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; + case 373: /* with_meta ::= WITH META AS */ +#line 666 "sql.y" +{ yymsp[-2].minor.yy820 = 1; } +#line 7375 "sql.c" break; - case 373: /* with_meta ::= AS */ + case 374: /* with_meta ::= ONLY META AS */ #line 667 "sql.y" -{ yymsp[0].minor.yy332 = 0; } +{ yymsp[-2].minor.yy820 = 2; } +#line 7380 "sql.c" + break; + case 375: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ +#line 669 "sql.y" +{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy209, &yymsp[-2].minor.yy1109, yymsp[0].minor.yy416); } +#line 7385 "sql.c" + break; + case 376: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ +#line 671 "sql.y" +{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy209, &yymsp[-3].minor.yy1109, &yymsp[0].minor.yy1109, yymsp[-2].minor.yy820); } +#line 7390 "sql.c" + break; + case 377: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ +#line 673 "sql.y" +{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-5].minor.yy209, &yymsp[-4].minor.yy1109, yymsp[-1].minor.yy416, yymsp[-3].minor.yy820, yymsp[0].minor.yy416); } #line 7395 "sql.c" break; - case 374: /* with_meta ::= WITH META AS */ -#line 668 "sql.y" -{ yymsp[-2].minor.yy332 = 1; } + case 378: /* cmd ::= DROP TOPIC exists_opt topic_name */ +#line 675 "sql.y" +{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy209, &yymsp[0].minor.yy1109); } #line 7400 "sql.c" break; - case 375: /* with_meta ::= ONLY META AS */ -#line 669 "sql.y" -{ yymsp[-2].minor.yy332 = 2; } + case 379: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ +#line 676 "sql.y" +{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy209, &yymsp[-2].minor.yy1109, &yymsp[0].minor.yy1109); } #line 7405 "sql.c" break; - case 376: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ -#line 671 "sql.y" -{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy325, &yymsp[-2].minor.yy837, yymsp[0].minor.yy54); } -#line 7410 "sql.c" + case 380: /* cmd ::= DESC full_table_name */ + case 381: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==381); +#line 679 "sql.y" +{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy416); } +#line 7411 "sql.c" break; - case 377: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */ -#line 673 "sql.y" -{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy325, &yymsp[-3].minor.yy837, &yymsp[0].minor.yy837, yymsp[-2].minor.yy332); } -#line 7415 "sql.c" - break; - case 378: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */ -#line 675 "sql.y" -{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-5].minor.yy325, &yymsp[-4].minor.yy837, yymsp[-1].minor.yy54, yymsp[-3].minor.yy332, yymsp[0].minor.yy54); } -#line 7420 "sql.c" - break; - case 379: /* cmd ::= DROP TOPIC exists_opt topic_name */ -#line 677 "sql.y" -{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy325, &yymsp[0].minor.yy837); } -#line 7425 "sql.c" - break; - case 380: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ -#line 678 "sql.y" -{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy325, &yymsp[-2].minor.yy837, &yymsp[0].minor.yy837); } -#line 7430 "sql.c" - break; - case 381: /* cmd ::= DESC full_table_name */ - case 382: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==382); -#line 681 "sql.y" -{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy54); } -#line 7436 "sql.c" - break; - case 383: /* cmd ::= RESET QUERY CACHE */ -#line 685 "sql.y" + case 382: /* cmd ::= RESET QUERY CACHE */ +#line 683 "sql.y" { pCxt->pRootNode = createResetQueryCacheStmt(pCxt); } -#line 7441 "sql.c" +#line 7416 "sql.c" break; - case 384: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ - case 385: /* cmd ::= EXPLAIN analyze_opt explain_options insert_query */ yytestcase(yyruleno==385); -#line 688 "sql.y" -{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy325, yymsp[-1].minor.yy54, yymsp[0].minor.yy54); } -#line 7447 "sql.c" + case 383: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ + case 384: /* cmd ::= EXPLAIN analyze_opt explain_options insert_query */ yytestcase(yyruleno==384); +#line 686 "sql.y" +{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy209, yymsp[-1].minor.yy416, yymsp[0].minor.yy416); } +#line 7422 "sql.c" break; - case 388: /* explain_options ::= */ + case 387: /* explain_options ::= */ +#line 694 "sql.y" +{ yymsp[1].minor.yy416 = createDefaultExplainOptions(pCxt); } +#line 7427 "sql.c" + break; + case 388: /* explain_options ::= explain_options VERBOSE NK_BOOL */ +#line 695 "sql.y" +{ yylhsminor.yy416 = setExplainVerbose(pCxt, yymsp[-2].minor.yy416, &yymsp[0].minor.yy0); } +#line 7432 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; + break; + case 389: /* explain_options ::= explain_options RATIO NK_FLOAT */ #line 696 "sql.y" -{ yymsp[1].minor.yy54 = createDefaultExplainOptions(pCxt); } -#line 7452 "sql.c" +{ yylhsminor.yy416 = setExplainRatio(pCxt, yymsp[-2].minor.yy416, &yymsp[0].minor.yy0); } +#line 7438 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; - case 389: /* explain_options ::= explain_options VERBOSE NK_BOOL */ -#line 697 "sql.y" -{ yylhsminor.yy54 = setExplainVerbose(pCxt, yymsp[-2].minor.yy54, &yymsp[0].minor.yy0); } -#line 7457 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; + case 390: /* cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ +#line 701 "sql.y" +{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-7].minor.yy209, yymsp[-9].minor.yy209, &yymsp[-6].minor.yy1109, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy952, yymsp[-1].minor.yy820, &yymsp[0].minor.yy1109, yymsp[-10].minor.yy209); } +#line 7444 "sql.c" break; - case 390: /* explain_options ::= explain_options RATIO NK_FLOAT */ -#line 698 "sql.y" -{ yylhsminor.yy54 = setExplainRatio(pCxt, yymsp[-2].minor.yy54, &yymsp[0].minor.yy0); } -#line 7463 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; + case 391: /* cmd ::= DROP FUNCTION exists_opt function_name */ +#line 702 "sql.y" +{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy209, &yymsp[0].minor.yy1109); } +#line 7449 "sql.c" break; - case 391: /* cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */ -#line 703 "sql.y" -{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-7].minor.yy325, yymsp[-9].minor.yy325, &yymsp[-6].minor.yy837, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy84, yymsp[-1].minor.yy332, &yymsp[0].minor.yy837, yymsp[-10].minor.yy325); } -#line 7469 "sql.c" + case 396: /* language_opt ::= */ + case 441: /* on_vgroup_id ::= */ yytestcase(yyruleno==441); +#line 716 "sql.y" +{ yymsp[1].minor.yy1109 = nil_token; } +#line 7455 "sql.c" break; - case 392: /* cmd ::= DROP FUNCTION exists_opt function_name */ -#line 704 "sql.y" -{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy325, &yymsp[0].minor.yy837); } -#line 7474 "sql.c" + case 397: /* language_opt ::= LANGUAGE NK_STRING */ + case 442: /* on_vgroup_id ::= ON NK_INTEGER */ yytestcase(yyruleno==442); +#line 717 "sql.y" +{ yymsp[-1].minor.yy1109 = yymsp[0].minor.yy0; } +#line 7461 "sql.c" break; - case 397: /* language_opt ::= */ - case 442: /* on_vgroup_id ::= */ yytestcase(yyruleno==442); -#line 718 "sql.y" -{ yymsp[1].minor.yy837 = nil_token; } -#line 7480 "sql.c" + case 400: /* cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */ +#line 726 "sql.y" +{ pCxt->pRootNode = createCreateViewStmt(pCxt, yymsp[-4].minor.yy209, yymsp[-2].minor.yy416, &yymsp[-1].minor.yy0, yymsp[0].minor.yy416); } +#line 7466 "sql.c" break; - case 398: /* language_opt ::= LANGUAGE NK_STRING */ - case 443: /* on_vgroup_id ::= ON NK_INTEGER */ yytestcase(yyruleno==443); -#line 719 "sql.y" -{ yymsp[-1].minor.yy837 = yymsp[0].minor.yy0; } -#line 7486 "sql.c" + case 401: /* cmd ::= DROP VIEW exists_opt full_view_name */ +#line 727 "sql.y" +{ pCxt->pRootNode = createDropViewStmt(pCxt, yymsp[-1].minor.yy209, yymsp[0].minor.yy416); } +#line 7471 "sql.c" break; - case 401: /* cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */ -#line 728 "sql.y" -{ pCxt->pRootNode = createCreateViewStmt(pCxt, yymsp[-4].minor.yy325, yymsp[-2].minor.yy54, &yymsp[-1].minor.yy0, yymsp[0].minor.yy54); } -#line 7491 "sql.c" - break; - case 402: /* cmd ::= DROP VIEW exists_opt full_view_name */ + case 402: /* full_view_name ::= view_name */ #line 729 "sql.y" -{ pCxt->pRootNode = createDropViewStmt(pCxt, yymsp[-1].minor.yy325, yymsp[0].minor.yy54); } -#line 7496 "sql.c" +{ yylhsminor.yy416 = createViewNode(pCxt, NULL, &yymsp[0].minor.yy1109); } +#line 7476 "sql.c" + yymsp[0].minor.yy416 = yylhsminor.yy416; break; - case 403: /* full_view_name ::= view_name */ -#line 731 "sql.y" -{ yylhsminor.yy54 = createViewNode(pCxt, NULL, &yymsp[0].minor.yy837); } -#line 7501 "sql.c" - yymsp[0].minor.yy54 = yylhsminor.yy54; + case 403: /* full_view_name ::= db_name NK_DOT view_name */ +#line 730 "sql.y" +{ yylhsminor.yy416 = createViewNode(pCxt, &yymsp[-2].minor.yy1109, &yymsp[0].minor.yy1109); } +#line 7482 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; - case 404: /* full_view_name ::= db_name NK_DOT view_name */ -#line 732 "sql.y" -{ yylhsminor.yy54 = createViewNode(pCxt, &yymsp[-2].minor.yy837, &yymsp[0].minor.yy837); } -#line 7507 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; + case 404: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */ +#line 735 "sql.y" +{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-9].minor.yy209, &yymsp[-8].minor.yy1109, yymsp[-5].minor.yy416, yymsp[-7].minor.yy416, yymsp[-3].minor.yy316, yymsp[-2].minor.yy416, yymsp[0].minor.yy416, yymsp[-4].minor.yy316); } +#line 7488 "sql.c" break; - case 405: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */ + case 405: /* cmd ::= DROP STREAM exists_opt stream_name */ +#line 736 "sql.y" +{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy209, &yymsp[0].minor.yy1109); } +#line 7493 "sql.c" + break; + case 406: /* cmd ::= PAUSE STREAM exists_opt stream_name */ #line 737 "sql.y" -{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-9].minor.yy325, &yymsp[-8].minor.yy837, yymsp[-5].minor.yy54, yymsp[-7].minor.yy54, yymsp[-3].minor.yy652, yymsp[-2].minor.yy54, yymsp[0].minor.yy54, yymsp[-4].minor.yy652); } -#line 7513 "sql.c" +{ pCxt->pRootNode = createPauseStreamStmt(pCxt, yymsp[-1].minor.yy209, &yymsp[0].minor.yy1109); } +#line 7498 "sql.c" break; - case 406: /* cmd ::= DROP STREAM exists_opt stream_name */ + case 407: /* cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ #line 738 "sql.y" -{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy325, &yymsp[0].minor.yy837); } -#line 7518 "sql.c" +{ pCxt->pRootNode = createResumeStreamStmt(pCxt, yymsp[-2].minor.yy209, yymsp[-1].minor.yy209, &yymsp[0].minor.yy1109); } +#line 7503 "sql.c" break; - case 407: /* cmd ::= PAUSE STREAM exists_opt stream_name */ -#line 739 "sql.y" -{ pCxt->pRootNode = createPauseStreamStmt(pCxt, yymsp[-1].minor.yy325, &yymsp[0].minor.yy837); } -#line 7523 "sql.c" + case 412: /* column_stream_def ::= column_name stream_col_options */ +#line 751 "sql.y" +{ yylhsminor.yy416 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy1109, createDataType(TSDB_DATA_TYPE_NULL), yymsp[0].minor.yy416); } +#line 7508 "sql.c" + yymsp[-1].minor.yy416 = yylhsminor.yy416; break; - case 408: /* cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */ -#line 740 "sql.y" -{ pCxt->pRootNode = createResumeStreamStmt(pCxt, yymsp[-2].minor.yy325, yymsp[-1].minor.yy325, &yymsp[0].minor.yy837); } -#line 7528 "sql.c" + case 413: /* stream_col_options ::= */ + case 750: /* column_options ::= */ yytestcase(yyruleno==750); +#line 752 "sql.y" +{ yymsp[1].minor.yy416 = createDefaultColumnOptions(pCxt); } +#line 7515 "sql.c" break; - case 413: /* column_stream_def ::= column_name stream_col_options */ + case 414: /* stream_col_options ::= stream_col_options PRIMARY KEY */ + case 751: /* column_options ::= column_options PRIMARY KEY */ yytestcase(yyruleno==751); #line 753 "sql.y" -{ yylhsminor.yy54 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy837, createDataType(TSDB_DATA_TYPE_NULL), yymsp[0].minor.yy54); } -#line 7533 "sql.c" - yymsp[-1].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = setColumnOptions(pCxt, yymsp[-2].minor.yy416, COLUMN_OPTION_PRIMARYKEY, NULL); } +#line 7521 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; - case 414: /* stream_col_options ::= */ - case 751: /* column_options ::= */ yytestcase(yyruleno==751); -#line 754 "sql.y" -{ yymsp[1].minor.yy54 = createDefaultColumnOptions(pCxt); } -#line 7540 "sql.c" + case 419: /* stream_options ::= stream_options TRIGGER AT_ONCE */ + case 420: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ yytestcase(yyruleno==420); +#line 763 "sql.y" +{ yylhsminor.yy416 = setStreamOptions(pCxt, yymsp[-2].minor.yy416, SOPT_TRIGGER_TYPE_SET, &yymsp[0].minor.yy0, NULL); } +#line 7528 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; - case 415: /* stream_col_options ::= stream_col_options PRIMARY KEY */ - case 752: /* column_options ::= column_options PRIMARY KEY */ yytestcase(yyruleno==752); -#line 755 "sql.y" -{ yylhsminor.yy54 = setColumnOptions(pCxt, yymsp[-2].minor.yy54, COLUMN_OPTION_PRIMARYKEY, NULL); } -#line 7546 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; - break; - case 420: /* stream_options ::= stream_options TRIGGER AT_ONCE */ - case 421: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ yytestcase(yyruleno==421); + case 421: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ #line 765 "sql.y" -{ yylhsminor.yy54 = setStreamOptions(pCxt, yymsp[-2].minor.yy54, SOPT_TRIGGER_TYPE_SET, &yymsp[0].minor.yy0, NULL); } -#line 7553 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = setStreamOptions(pCxt, yymsp[-3].minor.yy416, SOPT_TRIGGER_TYPE_SET, &yymsp[-1].minor.yy0, releaseRawExprNode(pCxt, yymsp[0].minor.yy416)); } +#line 7534 "sql.c" + yymsp[-3].minor.yy416 = yylhsminor.yy416; break; - case 422: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ + case 422: /* stream_options ::= stream_options WATERMARK duration_literal */ +#line 766 "sql.y" +{ yylhsminor.yy416 = setStreamOptions(pCxt, yymsp[-2].minor.yy416, SOPT_WATERMARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy416)); } +#line 7540 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; + break; + case 423: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ #line 767 "sql.y" -{ yylhsminor.yy54 = setStreamOptions(pCxt, yymsp[-3].minor.yy54, SOPT_TRIGGER_TYPE_SET, &yymsp[-1].minor.yy0, releaseRawExprNode(pCxt, yymsp[0].minor.yy54)); } -#line 7559 "sql.c" - yymsp[-3].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = setStreamOptions(pCxt, yymsp[-3].minor.yy416, SOPT_IGNORE_EXPIRED_SET, &yymsp[0].minor.yy0, NULL); } +#line 7546 "sql.c" + yymsp[-3].minor.yy416 = yylhsminor.yy416; break; - case 423: /* stream_options ::= stream_options WATERMARK duration_literal */ + case 424: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ #line 768 "sql.y" -{ yylhsminor.yy54 = setStreamOptions(pCxt, yymsp[-2].minor.yy54, SOPT_WATERMARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy54)); } -#line 7565 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = setStreamOptions(pCxt, yymsp[-2].minor.yy416, SOPT_FILL_HISTORY_SET, &yymsp[0].minor.yy0, NULL); } +#line 7552 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; - case 424: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ + case 425: /* stream_options ::= stream_options DELETE_MARK duration_literal */ #line 769 "sql.y" -{ yylhsminor.yy54 = setStreamOptions(pCxt, yymsp[-3].minor.yy54, SOPT_IGNORE_EXPIRED_SET, &yymsp[0].minor.yy0, NULL); } -#line 7571 "sql.c" - yymsp[-3].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = setStreamOptions(pCxt, yymsp[-2].minor.yy416, SOPT_DELETE_MARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy416)); } +#line 7558 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; - case 425: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ + case 426: /* stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ #line 770 "sql.y" -{ yylhsminor.yy54 = setStreamOptions(pCxt, yymsp[-2].minor.yy54, SOPT_FILL_HISTORY_SET, &yymsp[0].minor.yy0, NULL); } +{ yylhsminor.yy416 = setStreamOptions(pCxt, yymsp[-3].minor.yy416, SOPT_IGNORE_UPDATE_SET, &yymsp[0].minor.yy0, NULL); } +#line 7564 "sql.c" + yymsp[-3].minor.yy416 = yylhsminor.yy416; + break; + case 428: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + case 694: /* sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ yytestcase(yyruleno==694); + case 718: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==718); +#line 773 "sql.y" +{ yymsp[-3].minor.yy416 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy416); } +#line 7572 "sql.c" + break; + case 431: /* cmd ::= KILL CONNECTION NK_INTEGER */ +#line 781 "sql.y" +{ pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); } #line 7577 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; break; - case 426: /* stream_options ::= stream_options DELETE_MARK duration_literal */ -#line 771 "sql.y" -{ yylhsminor.yy54 = setStreamOptions(pCxt, yymsp[-2].minor.yy54, SOPT_DELETE_MARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy54)); } -#line 7583 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; + case 432: /* cmd ::= KILL QUERY NK_STRING */ +#line 782 "sql.y" +{ pCxt->pRootNode = createKillQueryStmt(pCxt, &yymsp[0].minor.yy0); } +#line 7582 "sql.c" break; - case 427: /* stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ -#line 772 "sql.y" -{ yylhsminor.yy54 = setStreamOptions(pCxt, yymsp[-3].minor.yy54, SOPT_IGNORE_UPDATE_SET, &yymsp[0].minor.yy0, NULL); } -#line 7589 "sql.c" - yymsp[-3].minor.yy54 = yylhsminor.yy54; + case 433: /* cmd ::= KILL TRANSACTION NK_INTEGER */ +#line 783 "sql.y" +{ pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_TRANSACTION_STMT, &yymsp[0].minor.yy0); } +#line 7587 "sql.c" break; - case 429: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - case 695: /* sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ yytestcase(yyruleno==695); - case 719: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==719); -#line 775 "sql.y" -{ yymsp[-3].minor.yy54 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy54); } + case 434: /* cmd ::= KILL COMPACT NK_INTEGER */ +#line 784 "sql.y" +{ pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_COMPACT_STMT, &yymsp[0].minor.yy0); } +#line 7592 "sql.c" + break; + case 435: /* cmd ::= BALANCE VGROUP */ +#line 787 "sql.y" +{ pCxt->pRootNode = createBalanceVgroupStmt(pCxt); } #line 7597 "sql.c" break; - case 432: /* cmd ::= KILL CONNECTION NK_INTEGER */ -#line 783 "sql.y" -{ pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); } + case 436: /* cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ +#line 788 "sql.y" +{ pCxt->pRootNode = createBalanceVgroupLeaderStmt(pCxt, &yymsp[0].minor.yy1109); } #line 7602 "sql.c" break; - case 433: /* cmd ::= KILL QUERY NK_STRING */ -#line 784 "sql.y" -{ pCxt->pRootNode = createKillQueryStmt(pCxt, &yymsp[0].minor.yy0); } + case 437: /* cmd ::= BALANCE VGROUP LEADER DATABASE db_name */ +#line 789 "sql.y" +{ pCxt->pRootNode = createBalanceVgroupLeaderDBNameStmt(pCxt, &yymsp[0].minor.yy1109); } #line 7607 "sql.c" break; - case 434: /* cmd ::= KILL TRANSACTION NK_INTEGER */ -#line 785 "sql.y" -{ pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_TRANSACTION_STMT, &yymsp[0].minor.yy0); } + case 438: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ +#line 790 "sql.y" +{ pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } #line 7612 "sql.c" break; - case 435: /* cmd ::= KILL COMPACT NK_INTEGER */ -#line 786 "sql.y" -{ pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_COMPACT_STMT, &yymsp[0].minor.yy0); } + case 439: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ +#line 791 "sql.y" +{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy316); } #line 7617 "sql.c" break; - case 436: /* cmd ::= BALANCE VGROUP */ -#line 789 "sql.y" -{ pCxt->pRootNode = createBalanceVgroupStmt(pCxt); } + case 440: /* cmd ::= SPLIT VGROUP NK_INTEGER */ +#line 792 "sql.y" +{ pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); } #line 7622 "sql.c" break; - case 437: /* cmd ::= BALANCE VGROUP LEADER on_vgroup_id */ -#line 790 "sql.y" -{ pCxt->pRootNode = createBalanceVgroupLeaderStmt(pCxt, &yymsp[0].minor.yy837); } + case 443: /* dnode_list ::= DNODE NK_INTEGER */ +#line 801 "sql.y" +{ yymsp[-1].minor.yy316 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } #line 7627 "sql.c" break; - case 438: /* cmd ::= BALANCE VGROUP LEADER DATABASE db_name */ -#line 791 "sql.y" -{ pCxt->pRootNode = createBalanceVgroupLeaderDBNameStmt(pCxt, &yymsp[0].minor.yy837); } + case 445: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ +#line 808 "sql.y" +{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy416, yymsp[0].minor.yy416); } #line 7632 "sql.c" break; - case 439: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ -#line 792 "sql.y" -{ pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } + case 448: /* insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ +#line 817 "sql.y" +{ yymsp[-6].minor.yy416 = createInsertStmt(pCxt, yymsp[-4].minor.yy416, yymsp[-2].minor.yy316, yymsp[0].minor.yy416); } #line 7637 "sql.c" break; - case 440: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ -#line 793 "sql.y" -{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy652); } + case 449: /* insert_query ::= INSERT INTO full_table_name query_or_subquery */ +#line 818 "sql.y" +{ yymsp[-3].minor.yy416 = createInsertStmt(pCxt, yymsp[-1].minor.yy416, NULL, yymsp[0].minor.yy416); } #line 7642 "sql.c" break; - case 441: /* cmd ::= SPLIT VGROUP NK_INTEGER */ -#line 794 "sql.y" -{ pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); } -#line 7647 "sql.c" + case 450: /* tags_literal ::= NK_INTEGER */ + case 462: /* tags_literal ::= NK_BIN */ yytestcase(yyruleno==462); + case 471: /* tags_literal ::= NK_HEX */ yytestcase(yyruleno==471); +#line 821 "sql.y" +{ yylhsminor.yy416 = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0, NULL); } +#line 7649 "sql.c" + yymsp[0].minor.yy416 = yylhsminor.yy416; break; - case 444: /* dnode_list ::= DNODE NK_INTEGER */ -#line 803 "sql.y" -{ yymsp[-1].minor.yy652 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } -#line 7652 "sql.c" - break; - case 446: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ -#line 810 "sql.y" -{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy54, yymsp[0].minor.yy54); } -#line 7657 "sql.c" - break; - case 449: /* insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ -#line 819 "sql.y" -{ yymsp[-6].minor.yy54 = createInsertStmt(pCxt, yymsp[-4].minor.yy54, yymsp[-2].minor.yy652, yymsp[0].minor.yy54); } -#line 7662 "sql.c" - break; - case 450: /* insert_query ::= INSERT INTO full_table_name query_or_subquery */ -#line 820 "sql.y" -{ yymsp[-3].minor.yy54 = createInsertStmt(pCxt, yymsp[-1].minor.yy54, NULL, yymsp[0].minor.yy54); } -#line 7667 "sql.c" - break; - case 451: /* tags_literal ::= NK_INTEGER */ - case 463: /* tags_literal ::= NK_BIN */ yytestcase(yyruleno==463); - case 472: /* tags_literal ::= NK_HEX */ yytestcase(yyruleno==472); -#line 823 "sql.y" -{ yylhsminor.yy54 = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0, NULL); } -#line 7674 "sql.c" - yymsp[0].minor.yy54 = yylhsminor.yy54; - break; - case 452: /* tags_literal ::= NK_INTEGER NK_PLUS duration_literal */ - case 453: /* tags_literal ::= NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==453); - case 464: /* tags_literal ::= NK_BIN NK_PLUS duration_literal */ yytestcase(yyruleno==464); - case 465: /* tags_literal ::= NK_BIN NK_MINUS duration_literal */ yytestcase(yyruleno==465); - case 473: /* tags_literal ::= NK_HEX NK_PLUS duration_literal */ yytestcase(yyruleno==473); - case 474: /* tags_literal ::= NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==474); - case 482: /* tags_literal ::= NK_STRING NK_PLUS duration_literal */ yytestcase(yyruleno==482); - case 483: /* tags_literal ::= NK_STRING NK_MINUS duration_literal */ yytestcase(yyruleno==483); -#line 824 "sql.y" + case 451: /* tags_literal ::= NK_INTEGER NK_PLUS duration_literal */ + case 452: /* tags_literal ::= NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==452); + case 463: /* tags_literal ::= NK_BIN NK_PLUS duration_literal */ yytestcase(yyruleno==463); + case 464: /* tags_literal ::= NK_BIN NK_MINUS duration_literal */ yytestcase(yyruleno==464); + case 472: /* tags_literal ::= NK_HEX NK_PLUS duration_literal */ yytestcase(yyruleno==472); + case 473: /* tags_literal ::= NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==473); + case 481: /* tags_literal ::= NK_STRING NK_PLUS duration_literal */ yytestcase(yyruleno==481); + case 482: /* tags_literal ::= NK_STRING NK_MINUS duration_literal */ yytestcase(yyruleno==482); +#line 822 "sql.y" { SToken l = yymsp[-2].minor.yy0; - SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy54); + SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); l.n = (r.z + r.n) - l.z; - yylhsminor.yy54 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, yymsp[0].minor.yy54); + yylhsminor.yy416 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, yymsp[0].minor.yy416); } -#line 7692 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; +#line 7667 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; - case 454: /* tags_literal ::= NK_PLUS NK_INTEGER */ - case 457: /* tags_literal ::= NK_MINUS NK_INTEGER */ yytestcase(yyruleno==457); - case 466: /* tags_literal ::= NK_PLUS NK_BIN */ yytestcase(yyruleno==466); - case 469: /* tags_literal ::= NK_MINUS NK_BIN */ yytestcase(yyruleno==469); - case 475: /* tags_literal ::= NK_PLUS NK_HEX */ yytestcase(yyruleno==475); - case 478: /* tags_literal ::= NK_MINUS NK_HEX */ yytestcase(yyruleno==478); -#line 836 "sql.y" + case 453: /* tags_literal ::= NK_PLUS NK_INTEGER */ + case 456: /* tags_literal ::= NK_MINUS NK_INTEGER */ yytestcase(yyruleno==456); + case 465: /* tags_literal ::= NK_PLUS NK_BIN */ yytestcase(yyruleno==465); + case 468: /* tags_literal ::= NK_MINUS NK_BIN */ yytestcase(yyruleno==468); + case 474: /* tags_literal ::= NK_PLUS NK_HEX */ yytestcase(yyruleno==474); + case 477: /* tags_literal ::= NK_MINUS NK_HEX */ yytestcase(yyruleno==477); +#line 834 "sql.y" { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy54 = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &t, NULL); + yylhsminor.yy416 = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &t, NULL); } -#line 7707 "sql.c" - yymsp[-1].minor.yy54 = yylhsminor.yy54; +#line 7682 "sql.c" + yymsp[-1].minor.yy416 = yylhsminor.yy416; break; - case 455: /* tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal */ - case 456: /* tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==456); - case 458: /* tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal */ yytestcase(yyruleno==458); - case 459: /* tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==459); - case 467: /* tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal */ yytestcase(yyruleno==467); - case 468: /* tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal */ yytestcase(yyruleno==468); - case 470: /* tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal */ yytestcase(yyruleno==470); - case 471: /* tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal */ yytestcase(yyruleno==471); - case 476: /* tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal */ yytestcase(yyruleno==476); - case 477: /* tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==477); - case 479: /* tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal */ yytestcase(yyruleno==479); - case 480: /* tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==480); -#line 841 "sql.y" + case 454: /* tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal */ + case 455: /* tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==455); + case 457: /* tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal */ yytestcase(yyruleno==457); + case 458: /* tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==458); + case 466: /* tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal */ yytestcase(yyruleno==466); + case 467: /* tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal */ yytestcase(yyruleno==467); + case 469: /* tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal */ yytestcase(yyruleno==469); + case 470: /* tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal */ yytestcase(yyruleno==470); + case 475: /* tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal */ yytestcase(yyruleno==475); + case 476: /* tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==476); + case 478: /* tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal */ yytestcase(yyruleno==478); + case 479: /* tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==479); +#line 839 "sql.y" { SToken l = yymsp[-3].minor.yy0; - SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy54); + SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); l.n = (r.z + r.n) - l.z; - yylhsminor.yy54 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, yymsp[0].minor.yy54); + yylhsminor.yy416 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, yymsp[0].minor.yy416); } -#line 7729 "sql.c" - yymsp[-3].minor.yy54 = yylhsminor.yy54; +#line 7704 "sql.c" + yymsp[-3].minor.yy416 = yylhsminor.yy416; break; - case 460: /* tags_literal ::= NK_FLOAT */ -#line 870 "sql.y" -{ yylhsminor.yy54 = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0, NULL); } -#line 7735 "sql.c" - yymsp[0].minor.yy54 = yylhsminor.yy54; + case 459: /* tags_literal ::= NK_FLOAT */ +#line 868 "sql.y" +{ yylhsminor.yy416 = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0, NULL); } +#line 7710 "sql.c" + yymsp[0].minor.yy416 = yylhsminor.yy416; break; - case 461: /* tags_literal ::= NK_PLUS NK_FLOAT */ - case 462: /* tags_literal ::= NK_MINUS NK_FLOAT */ yytestcase(yyruleno==462); -#line 871 "sql.y" + case 460: /* tags_literal ::= NK_PLUS NK_FLOAT */ + case 461: /* tags_literal ::= NK_MINUS NK_FLOAT */ yytestcase(yyruleno==461); +#line 869 "sql.y" { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy54 = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t, NULL); + yylhsminor.yy416 = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t, NULL); } -#line 7746 "sql.c" - yymsp[-1].minor.yy54 = yylhsminor.yy54; +#line 7721 "sql.c" + yymsp[-1].minor.yy416 = yylhsminor.yy416; break; - case 481: /* tags_literal ::= NK_STRING */ -#line 977 "sql.y" -{ yylhsminor.yy54 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0, NULL); } -#line 7752 "sql.c" - yymsp[0].minor.yy54 = yylhsminor.yy54; + case 480: /* tags_literal ::= NK_STRING */ +#line 975 "sql.y" +{ yylhsminor.yy416 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0, NULL); } +#line 7727 "sql.c" + yymsp[0].minor.yy416 = yylhsminor.yy416; break; - case 484: /* tags_literal ::= NK_BOOL */ -#line 990 "sql.y" -{ yylhsminor.yy54 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0, NULL); } -#line 7758 "sql.c" - yymsp[0].minor.yy54 = yylhsminor.yy54; + case 483: /* tags_literal ::= NK_BOOL */ +#line 988 "sql.y" +{ yylhsminor.yy416 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0, NULL); } +#line 7733 "sql.c" + yymsp[0].minor.yy416 = yylhsminor.yy416; break; - case 485: /* tags_literal ::= NULL */ + case 484: /* tags_literal ::= NULL */ +#line 989 "sql.y" +{ yylhsminor.yy416 = createRawValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0, NULL); } +#line 7739 "sql.c" + yymsp[0].minor.yy416 = yylhsminor.yy416; + break; + case 485: /* tags_literal ::= literal_func */ #line 991 "sql.y" -{ yylhsminor.yy54 = createRawValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0, NULL); } -#line 7764 "sql.c" - yymsp[0].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BINARY, NULL, yymsp[0].minor.yy416); } +#line 7745 "sql.c" + yymsp[0].minor.yy416 = yylhsminor.yy416; break; - case 486: /* tags_literal ::= literal_func */ -#line 993 "sql.y" -{ yylhsminor.yy54 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BINARY, NULL, yymsp[0].minor.yy54); } -#line 7770 "sql.c" - yymsp[0].minor.yy54 = yylhsminor.yy54; - break; - case 487: /* tags_literal ::= literal_func NK_PLUS duration_literal */ - case 488: /* tags_literal ::= literal_func NK_MINUS duration_literal */ yytestcase(yyruleno==488); -#line 994 "sql.y" + case 486: /* tags_literal ::= literal_func NK_PLUS duration_literal */ + case 487: /* tags_literal ::= literal_func NK_MINUS duration_literal */ yytestcase(yyruleno==487); +#line 992 "sql.y" { - SToken l = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy54); - SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy54); + SToken l = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy416); + SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); l.n = (r.z + r.n) - l.z; - yylhsminor.yy54 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, yymsp[-2].minor.yy54, yymsp[0].minor.yy54); + yylhsminor.yy416 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, yymsp[-2].minor.yy416, yymsp[0].minor.yy416); } -#line 7782 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; +#line 7757 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; - case 491: /* literal ::= NK_INTEGER */ + case 490: /* literal ::= NK_INTEGER */ +#line 1011 "sql.y" +{ yylhsminor.yy416 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); } +#line 7763 "sql.c" + yymsp[0].minor.yy416 = yylhsminor.yy416; + break; + case 491: /* literal ::= NK_FLOAT */ +#line 1012 "sql.y" +{ yylhsminor.yy416 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } +#line 7769 "sql.c" + yymsp[0].minor.yy416 = yylhsminor.yy416; + break; + case 492: /* literal ::= NK_STRING */ #line 1013 "sql.y" -{ yylhsminor.yy54 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); } -#line 7788 "sql.c" - yymsp[0].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } +#line 7775 "sql.c" + yymsp[0].minor.yy416 = yylhsminor.yy416; break; - case 492: /* literal ::= NK_FLOAT */ + case 493: /* literal ::= NK_BOOL */ #line 1014 "sql.y" -{ yylhsminor.yy54 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } -#line 7794 "sql.c" - yymsp[0].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } +#line 7781 "sql.c" + yymsp[0].minor.yy416 = yylhsminor.yy416; break; - case 493: /* literal ::= NK_STRING */ + case 494: /* literal ::= TIMESTAMP NK_STRING */ #line 1015 "sql.y" -{ yylhsminor.yy54 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } -#line 7800 "sql.c" - yymsp[0].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } +#line 7787 "sql.c" + yymsp[-1].minor.yy416 = yylhsminor.yy416; break; - case 494: /* literal ::= NK_BOOL */ + case 495: /* literal ::= duration_literal */ + case 505: /* signed_literal ::= signed */ yytestcase(yyruleno==505); + case 529: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==529); + case 530: /* expression ::= literal */ yytestcase(yyruleno==530); + case 532: /* expression ::= column_reference */ yytestcase(yyruleno==532); + case 533: /* expression ::= function_expression */ yytestcase(yyruleno==533); + case 534: /* expression ::= case_when_expression */ yytestcase(yyruleno==534); + case 568: /* function_expression ::= literal_func */ yytestcase(yyruleno==568); + case 618: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==618); + case 622: /* boolean_primary ::= predicate */ yytestcase(yyruleno==622); + case 624: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==624); + case 625: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==625); + case 628: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==628); + case 630: /* table_reference ::= table_primary */ yytestcase(yyruleno==630); + case 631: /* table_reference ::= joined_table */ yytestcase(yyruleno==631); + case 635: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==635); + case 720: /* query_simple ::= query_specification */ yytestcase(yyruleno==720); + case 721: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==721); + case 724: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==724); + case 726: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==726); #line 1016 "sql.y" -{ yylhsminor.yy54 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } -#line 7806 "sql.c" - yymsp[0].minor.yy54 = yylhsminor.yy54; - break; - case 495: /* literal ::= TIMESTAMP NK_STRING */ -#line 1017 "sql.y" -{ yylhsminor.yy54 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } +{ yylhsminor.yy416 = yymsp[0].minor.yy416; } #line 7812 "sql.c" - yymsp[-1].minor.yy54 = yylhsminor.yy54; + yymsp[0].minor.yy416 = yylhsminor.yy416; break; - case 496: /* literal ::= duration_literal */ - case 506: /* signed_literal ::= signed */ yytestcase(yyruleno==506); - case 530: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==530); - case 531: /* expression ::= literal */ yytestcase(yyruleno==531); - case 533: /* expression ::= column_reference */ yytestcase(yyruleno==533); - case 534: /* expression ::= function_expression */ yytestcase(yyruleno==534); - case 535: /* expression ::= case_when_expression */ yytestcase(yyruleno==535); - case 569: /* function_expression ::= literal_func */ yytestcase(yyruleno==569); - case 619: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==619); - case 623: /* boolean_primary ::= predicate */ yytestcase(yyruleno==623); - case 625: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==625); - case 626: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==626); - case 629: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==629); - case 631: /* table_reference ::= table_primary */ yytestcase(yyruleno==631); - case 632: /* table_reference ::= joined_table */ yytestcase(yyruleno==632); - case 636: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==636); - case 721: /* query_simple ::= query_specification */ yytestcase(yyruleno==721); - case 722: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==722); - case 725: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==725); - case 727: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==727); + case 496: /* literal ::= NULL */ +#line 1017 "sql.y" +{ yylhsminor.yy416 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } +#line 7818 "sql.c" + yymsp[0].minor.yy416 = yylhsminor.yy416; + break; + case 497: /* literal ::= NK_QUESTION */ #line 1018 "sql.y" -{ yylhsminor.yy54 = yymsp[0].minor.yy54; } -#line 7837 "sql.c" - yymsp[0].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } +#line 7824 "sql.c" + yymsp[0].minor.yy416 = yylhsminor.yy416; break; - case 497: /* literal ::= NULL */ -#line 1019 "sql.y" -{ yylhsminor.yy54 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } -#line 7843 "sql.c" - yymsp[0].minor.yy54 = yylhsminor.yy54; - break; - case 498: /* literal ::= NK_QUESTION */ + case 498: /* duration_literal ::= NK_VARIABLE */ + case 695: /* interval_sliding_duration_literal ::= NK_VARIABLE */ yytestcase(yyruleno==695); + case 696: /* interval_sliding_duration_literal ::= NK_STRING */ yytestcase(yyruleno==696); + case 697: /* interval_sliding_duration_literal ::= NK_INTEGER */ yytestcase(yyruleno==697); #line 1020 "sql.y" -{ yylhsminor.yy54 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } -#line 7849 "sql.c" - yymsp[0].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } +#line 7833 "sql.c" + yymsp[0].minor.yy416 = yylhsminor.yy416; break; - case 499: /* duration_literal ::= NK_VARIABLE */ - case 696: /* interval_sliding_duration_literal ::= NK_VARIABLE */ yytestcase(yyruleno==696); - case 697: /* interval_sliding_duration_literal ::= NK_STRING */ yytestcase(yyruleno==697); - case 698: /* interval_sliding_duration_literal ::= NK_INTEGER */ yytestcase(yyruleno==698); + case 499: /* signed ::= NK_INTEGER */ #line 1022 "sql.y" -{ yylhsminor.yy54 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } -#line 7858 "sql.c" - yymsp[0].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } +#line 7839 "sql.c" + yymsp[0].minor.yy416 = yylhsminor.yy416; break; - case 500: /* signed ::= NK_INTEGER */ + case 500: /* signed ::= NK_PLUS NK_INTEGER */ +#line 1023 "sql.y" +{ yymsp[-1].minor.yy416 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } +#line 7845 "sql.c" + break; + case 501: /* signed ::= NK_MINUS NK_INTEGER */ #line 1024 "sql.y" -{ yylhsminor.yy54 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } -#line 7864 "sql.c" - yymsp[0].minor.yy54 = yylhsminor.yy54; - break; - case 501: /* signed ::= NK_PLUS NK_INTEGER */ -#line 1025 "sql.y" -{ yymsp[-1].minor.yy54 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } -#line 7870 "sql.c" - break; - case 502: /* signed ::= NK_MINUS NK_INTEGER */ -#line 1026 "sql.y" { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy54 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); + yylhsminor.yy416 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); } -#line 7879 "sql.c" - yymsp[-1].minor.yy54 = yylhsminor.yy54; +#line 7854 "sql.c" + yymsp[-1].minor.yy416 = yylhsminor.yy416; break; - case 503: /* signed ::= NK_FLOAT */ + case 502: /* signed ::= NK_FLOAT */ +#line 1029 "sql.y" +{ yylhsminor.yy416 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } +#line 7860 "sql.c" + yymsp[0].minor.yy416 = yylhsminor.yy416; + break; + case 503: /* signed ::= NK_PLUS NK_FLOAT */ +#line 1030 "sql.y" +{ yymsp[-1].minor.yy416 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } +#line 7866 "sql.c" + break; + case 504: /* signed ::= NK_MINUS NK_FLOAT */ #line 1031 "sql.y" -{ yylhsminor.yy54 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } -#line 7885 "sql.c" - yymsp[0].minor.yy54 = yylhsminor.yy54; - break; - case 504: /* signed ::= NK_PLUS NK_FLOAT */ -#line 1032 "sql.y" -{ yymsp[-1].minor.yy54 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } -#line 7891 "sql.c" - break; - case 505: /* signed ::= NK_MINUS NK_FLOAT */ -#line 1033 "sql.y" { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy54 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); + yylhsminor.yy416 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); } -#line 7900 "sql.c" - yymsp[-1].minor.yy54 = yylhsminor.yy54; +#line 7875 "sql.c" + yymsp[-1].minor.yy416 = yylhsminor.yy416; break; - case 507: /* signed_literal ::= NK_STRING */ + case 506: /* signed_literal ::= NK_STRING */ +#line 1038 "sql.y" +{ yylhsminor.yy416 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } +#line 7881 "sql.c" + yymsp[0].minor.yy416 = yylhsminor.yy416; + break; + case 507: /* signed_literal ::= NK_BOOL */ +#line 1039 "sql.y" +{ yylhsminor.yy416 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } +#line 7887 "sql.c" + yymsp[0].minor.yy416 = yylhsminor.yy416; + break; + case 508: /* signed_literal ::= TIMESTAMP NK_STRING */ #line 1040 "sql.y" -{ yylhsminor.yy54 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } -#line 7906 "sql.c" - yymsp[0].minor.yy54 = yylhsminor.yy54; +{ yymsp[-1].minor.yy416 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } +#line 7893 "sql.c" break; - case 508: /* signed_literal ::= NK_BOOL */ + case 509: /* signed_literal ::= duration_literal */ + case 511: /* signed_literal ::= literal_func */ yytestcase(yyruleno==511); + case 589: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==589); + case 672: /* select_item ::= common_expression */ yytestcase(yyruleno==672); + case 682: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==682); + case 725: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==725); + case 727: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==727); + case 740: /* search_condition ::= common_expression */ yytestcase(yyruleno==740); #line 1041 "sql.y" -{ yylhsminor.yy54 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } -#line 7912 "sql.c" - yymsp[0].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = releaseRawExprNode(pCxt, yymsp[0].minor.yy416); } +#line 7905 "sql.c" + yymsp[0].minor.yy416 = yylhsminor.yy416; break; - case 509: /* signed_literal ::= TIMESTAMP NK_STRING */ + case 510: /* signed_literal ::= NULL */ #line 1042 "sql.y" -{ yymsp[-1].minor.yy54 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } -#line 7918 "sql.c" +{ yylhsminor.yy416 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } +#line 7911 "sql.c" + yymsp[0].minor.yy416 = yylhsminor.yy416; break; - case 510: /* signed_literal ::= duration_literal */ - case 512: /* signed_literal ::= literal_func */ yytestcase(yyruleno==512); - case 590: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==590); - case 673: /* select_item ::= common_expression */ yytestcase(yyruleno==673); - case 683: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==683); - case 726: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==726); - case 728: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==728); - case 741: /* search_condition ::= common_expression */ yytestcase(yyruleno==741); -#line 1043 "sql.y" -{ yylhsminor.yy54 = releaseRawExprNode(pCxt, yymsp[0].minor.yy54); } -#line 7930 "sql.c" - yymsp[0].minor.yy54 = yylhsminor.yy54; - break; - case 511: /* signed_literal ::= NULL */ + case 512: /* signed_literal ::= NK_QUESTION */ #line 1044 "sql.y" -{ yylhsminor.yy54 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } -#line 7936 "sql.c" - yymsp[0].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } +#line 7917 "sql.c" + yymsp[0].minor.yy416 = yylhsminor.yy416; break; - case 513: /* signed_literal ::= NK_QUESTION */ -#line 1046 "sql.y" -{ yylhsminor.yy54 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } -#line 7942 "sql.c" - yymsp[0].minor.yy54 = yylhsminor.yy54; + case 531: /* expression ::= pseudo_column */ +#line 1110 "sql.y" +{ yylhsminor.yy416 = yymsp[0].minor.yy416; setRawExprNodeIsPseudoColumn(pCxt, yylhsminor.yy416, true); } +#line 7923 "sql.c" + yymsp[0].minor.yy416 = yylhsminor.yy416; break; - case 532: /* expression ::= pseudo_column */ -#line 1112 "sql.y" -{ yylhsminor.yy54 = yymsp[0].minor.yy54; setRawExprNodeIsPseudoColumn(pCxt, yylhsminor.yy54, true); } -#line 7948 "sql.c" - yymsp[0].minor.yy54 = yylhsminor.yy54; + case 535: /* expression ::= NK_LP expression NK_RP */ + case 623: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==623); + case 739: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==739); +#line 1114 "sql.y" +{ yylhsminor.yy416 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy416)); } +#line 7931 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; - case 536: /* expression ::= NK_LP expression NK_RP */ - case 624: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==624); - case 740: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==740); -#line 1116 "sql.y" -{ yylhsminor.yy54 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy54)); } -#line 7956 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; - break; - case 537: /* expression ::= NK_PLUS expr_or_subquery */ -#line 1117 "sql.y" + case 536: /* expression ::= NK_PLUS expr_or_subquery */ +#line 1115 "sql.y" { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy54); - yylhsminor.yy54 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy54)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); + yylhsminor.yy416 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy416)); } -#line 7965 "sql.c" - yymsp[-1].minor.yy54 = yylhsminor.yy54; +#line 7940 "sql.c" + yymsp[-1].minor.yy416 = yylhsminor.yy416; break; - case 538: /* expression ::= NK_MINUS expr_or_subquery */ -#line 1121 "sql.y" + case 537: /* expression ::= NK_MINUS expr_or_subquery */ +#line 1119 "sql.y" { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy54); - yylhsminor.yy54 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy54), NULL)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); + yylhsminor.yy416 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy416), NULL)); } -#line 7974 "sql.c" - yymsp[-1].minor.yy54 = yylhsminor.yy54; +#line 7949 "sql.c" + yymsp[-1].minor.yy416 = yylhsminor.yy416; break; - case 539: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ -#line 1125 "sql.y" + case 538: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ +#line 1123 "sql.y" { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy54); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy54); - yylhsminor.yy54 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy54), releaseRawExprNode(pCxt, yymsp[0].minor.yy54))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy416); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); + yylhsminor.yy416 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), releaseRawExprNode(pCxt, yymsp[0].minor.yy416))); } -#line 7984 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; +#line 7959 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; - case 540: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ -#line 1130 "sql.y" + case 539: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ +#line 1128 "sql.y" { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy54); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy54); - yylhsminor.yy54 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy54), releaseRawExprNode(pCxt, yymsp[0].minor.yy54))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy416); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); + yylhsminor.yy416 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), releaseRawExprNode(pCxt, yymsp[0].minor.yy416))); } -#line 7994 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; +#line 7969 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; - case 541: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */ -#line 1135 "sql.y" + case 540: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */ +#line 1133 "sql.y" { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy54); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy54); - yylhsminor.yy54 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy54), releaseRawExprNode(pCxt, yymsp[0].minor.yy54))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy416); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); + yylhsminor.yy416 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), releaseRawExprNode(pCxt, yymsp[0].minor.yy416))); } -#line 8004 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; +#line 7979 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; - case 542: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ -#line 1140 "sql.y" + case 541: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ +#line 1138 "sql.y" { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy54); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy54); - yylhsminor.yy54 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy54), releaseRawExprNode(pCxt, yymsp[0].minor.yy54))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy416); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); + yylhsminor.yy416 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), releaseRawExprNode(pCxt, yymsp[0].minor.yy416))); } -#line 8014 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; +#line 7989 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; - case 543: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */ -#line 1145 "sql.y" + case 542: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */ +#line 1143 "sql.y" { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy54); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy54); - yylhsminor.yy54 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy54), releaseRawExprNode(pCxt, yymsp[0].minor.yy54))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy416); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); + yylhsminor.yy416 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), releaseRawExprNode(pCxt, yymsp[0].minor.yy416))); } -#line 8024 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; +#line 7999 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; - case 544: /* expression ::= column_reference NK_ARROW NK_STRING */ -#line 1150 "sql.y" + case 543: /* expression ::= column_reference NK_ARROW NK_STRING */ +#line 1148 "sql.y" { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy54); - yylhsminor.yy54 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy54), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy416); + yylhsminor.yy416 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); } -#line 8033 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; +#line 8008 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; - case 545: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ -#line 1154 "sql.y" + case 544: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ +#line 1152 "sql.y" { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy54); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy54); - yylhsminor.yy54 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy54), releaseRawExprNode(pCxt, yymsp[0].minor.yy54))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy416); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); + yylhsminor.yy416 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), releaseRawExprNode(pCxt, yymsp[0].minor.yy416))); } -#line 8043 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; +#line 8018 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; - case 546: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ -#line 1159 "sql.y" + case 545: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ +#line 1157 "sql.y" { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy54); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy54); - yylhsminor.yy54 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy54), releaseRawExprNode(pCxt, yymsp[0].minor.yy54))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy416); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); + yylhsminor.yy416 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), releaseRawExprNode(pCxt, yymsp[0].minor.yy416))); } -#line 8053 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; +#line 8028 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; - case 549: /* column_reference ::= column_name */ + case 548: /* column_reference ::= column_name */ +#line 1168 "sql.y" +{ yylhsminor.yy416 = createRawExprNode(pCxt, &yymsp[0].minor.yy1109, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy1109)); } +#line 8034 "sql.c" + yymsp[0].minor.yy416 = yylhsminor.yy416; + break; + case 549: /* column_reference ::= table_name NK_DOT column_name */ +#line 1169 "sql.y" +{ yylhsminor.yy416 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy1109, &yymsp[0].minor.yy1109, createColumnNode(pCxt, &yymsp[-2].minor.yy1109, &yymsp[0].minor.yy1109)); } +#line 8040 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; + break; + case 550: /* column_reference ::= NK_ALIAS */ #line 1170 "sql.y" -{ yylhsminor.yy54 = createRawExprNode(pCxt, &yymsp[0].minor.yy837, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy837)); } -#line 8059 "sql.c" - yymsp[0].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } +#line 8046 "sql.c" + yymsp[0].minor.yy416 = yylhsminor.yy416; break; - case 550: /* column_reference ::= table_name NK_DOT column_name */ + case 551: /* column_reference ::= table_name NK_DOT NK_ALIAS */ #line 1171 "sql.y" -{ yylhsminor.yy54 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy837, &yymsp[0].minor.yy837, createColumnNode(pCxt, &yymsp[-2].minor.yy837, &yymsp[0].minor.yy837)); } -#line 8065 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy1109, &yymsp[0].minor.yy0, createColumnNode(pCxt, &yymsp[-2].minor.yy1109, &yymsp[0].minor.yy0)); } +#line 8052 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; - case 551: /* column_reference ::= NK_ALIAS */ -#line 1172 "sql.y" -{ yylhsminor.yy54 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } -#line 8071 "sql.c" - yymsp[0].minor.yy54 = yylhsminor.yy54; - break; - case 552: /* column_reference ::= table_name NK_DOT NK_ALIAS */ + case 552: /* pseudo_column ::= ROWTS */ + case 553: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==553); + case 555: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==555); + case 556: /* pseudo_column ::= QEND */ yytestcase(yyruleno==556); + case 557: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==557); + case 558: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==558); + case 559: /* pseudo_column ::= WEND */ yytestcase(yyruleno==559); + case 560: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==560); + case 561: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==561); + case 562: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==562); + case 563: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==563); + case 570: /* literal_func ::= NOW */ yytestcase(yyruleno==570); + case 571: /* literal_func ::= TODAY */ yytestcase(yyruleno==571); #line 1173 "sql.y" -{ yylhsminor.yy54 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy837, &yymsp[0].minor.yy0, createColumnNode(pCxt, &yymsp[-2].minor.yy837, &yymsp[0].minor.yy0)); } -#line 8077 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } +#line 8070 "sql.c" + yymsp[0].minor.yy416 = yylhsminor.yy416; break; - case 553: /* pseudo_column ::= ROWTS */ - case 554: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==554); - case 556: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==556); - case 557: /* pseudo_column ::= QEND */ yytestcase(yyruleno==557); - case 558: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==558); - case 559: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==559); - case 560: /* pseudo_column ::= WEND */ yytestcase(yyruleno==560); - case 561: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==561); - case 562: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==562); - case 563: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==563); - case 564: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==564); - case 571: /* literal_func ::= NOW */ yytestcase(yyruleno==571); - case 572: /* literal_func ::= TODAY */ yytestcase(yyruleno==572); + case 554: /* pseudo_column ::= table_name NK_DOT TBNAME */ #line 1175 "sql.y" -{ yylhsminor.yy54 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } -#line 8095 "sql.c" - yymsp[0].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy1109, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy1109)))); } +#line 8076 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; - case 555: /* pseudo_column ::= table_name NK_DOT TBNAME */ -#line 1177 "sql.y" -{ yylhsminor.yy54 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy837, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy837)))); } -#line 8101 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; + case 564: /* function_expression ::= function_name NK_LP expression_list NK_RP */ + case 565: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==565); +#line 1186 "sql.y" +{ yylhsminor.yy416 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy1109, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy1109, yymsp[-1].minor.yy316)); } +#line 8083 "sql.c" + yymsp[-3].minor.yy416 = yylhsminor.yy416; break; - case 565: /* function_expression ::= function_name NK_LP expression_list NK_RP */ - case 566: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==566); -#line 1188 "sql.y" -{ yylhsminor.yy54 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy837, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy837, yymsp[-1].minor.yy652)); } -#line 8108 "sql.c" - yymsp[-3].minor.yy54 = yylhsminor.yy54; + case 566: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ + case 567: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP */ yytestcase(yyruleno==567); +#line 1189 "sql.y" +{ yylhsminor.yy416 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy416), yymsp[-1].minor.yy952)); } +#line 8090 "sql.c" + yymsp[-5].minor.yy416 = yylhsminor.yy416; break; - case 567: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ - case 568: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP */ yytestcase(yyruleno==568); -#line 1191 "sql.y" -{ yylhsminor.yy54 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy54), yymsp[-1].minor.yy84)); } + case 569: /* literal_func ::= noarg_func NK_LP NK_RP */ +#line 1195 "sql.y" +{ yylhsminor.yy416 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy1109, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy1109, NULL)); } +#line 8096 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; + break; + case 585: /* star_func_para_list ::= NK_STAR */ +#line 1220 "sql.y" +{ yylhsminor.yy316 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } +#line 8102 "sql.c" + yymsp[0].minor.yy316 = yylhsminor.yy316; + break; + case 590: /* star_func_para ::= table_name NK_DOT NK_STAR */ + case 675: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==675); +#line 1229 "sql.y" +{ yylhsminor.yy416 = createColumnNode(pCxt, &yymsp[-2].minor.yy1109, &yymsp[0].minor.yy0); } +#line 8109 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; + break; + case 591: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ +#line 1232 "sql.y" +{ yylhsminor.yy416 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy316, yymsp[-1].minor.yy416)); } #line 8115 "sql.c" - yymsp[-5].minor.yy54 = yylhsminor.yy54; + yymsp[-3].minor.yy416 = yylhsminor.yy416; break; - case 570: /* literal_func ::= noarg_func NK_LP NK_RP */ -#line 1197 "sql.y" -{ yylhsminor.yy54 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy837, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy837, NULL)); } -#line 8121 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; - break; - case 586: /* star_func_para_list ::= NK_STAR */ -#line 1222 "sql.y" -{ yylhsminor.yy652 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } -#line 8127 "sql.c" - yymsp[0].minor.yy652 = yylhsminor.yy652; - break; - case 591: /* star_func_para ::= table_name NK_DOT NK_STAR */ - case 676: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==676); -#line 1231 "sql.y" -{ yylhsminor.yy54 = createColumnNode(pCxt, &yymsp[-2].minor.yy837, &yymsp[0].minor.yy0); } -#line 8134 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; - break; - case 592: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ + case 592: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ #line 1234 "sql.y" -{ yylhsminor.yy54 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy652, yymsp[-1].minor.yy54)); } -#line 8140 "sql.c" - yymsp[-3].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy416), yymsp[-2].minor.yy316, yymsp[-1].minor.yy416)); } +#line 8121 "sql.c" + yymsp[-4].minor.yy416 = yylhsminor.yy416; break; - case 593: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ -#line 1236 "sql.y" -{ yylhsminor.yy54 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy54), yymsp[-2].minor.yy652, yymsp[-1].minor.yy54)); } -#line 8146 "sql.c" - yymsp[-4].minor.yy54 = yylhsminor.yy54; + case 595: /* when_then_expr ::= WHEN common_expression THEN common_expression */ +#line 1241 "sql.y" +{ yymsp[-3].minor.yy416 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), releaseRawExprNode(pCxt, yymsp[0].minor.yy416)); } +#line 8127 "sql.c" break; - case 596: /* when_then_expr ::= WHEN common_expression THEN common_expression */ -#line 1243 "sql.y" -{ yymsp[-3].minor.yy54 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy54), releaseRawExprNode(pCxt, yymsp[0].minor.yy54)); } + case 597: /* case_when_else_opt ::= ELSE common_expression */ +#line 1244 "sql.y" +{ yymsp[-1].minor.yy416 = releaseRawExprNode(pCxt, yymsp[0].minor.yy416); } +#line 8132 "sql.c" + break; + case 598: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ + case 603: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==603); +#line 1247 "sql.y" +{ + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy416); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); + yylhsminor.yy416 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy848, releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), releaseRawExprNode(pCxt, yymsp[0].minor.yy416))); + } +#line 8142 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; + break; + case 599: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ +#line 1254 "sql.y" +{ + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy416); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); + yylhsminor.yy416 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy416), releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), releaseRawExprNode(pCxt, yymsp[0].minor.yy416))); + } #line 8152 "sql.c" + yymsp[-4].minor.yy416 = yylhsminor.yy416; break; - case 598: /* case_when_else_opt ::= ELSE common_expression */ -#line 1246 "sql.y" -{ yymsp[-1].minor.yy54 = releaseRawExprNode(pCxt, yymsp[0].minor.yy54); } -#line 8157 "sql.c" - break; - case 599: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ - case 604: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==604); -#line 1249 "sql.y" + case 600: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ +#line 1260 "sql.y" { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy54); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy54); - yylhsminor.yy54 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy922, releaseRawExprNode(pCxt, yymsp[-2].minor.yy54), releaseRawExprNode(pCxt, yymsp[0].minor.yy54))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy416); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); + yylhsminor.yy416 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy416), releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), releaseRawExprNode(pCxt, yymsp[0].minor.yy416))); } -#line 8167 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; +#line 8162 "sql.c" + yymsp[-5].minor.yy416 = yylhsminor.yy416; break; - case 600: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ -#line 1256 "sql.y" + case 601: /* predicate ::= expr_or_subquery IS NULL */ +#line 1265 "sql.y" { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy54); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy54); - yylhsminor.yy54 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy54), releaseRawExprNode(pCxt, yymsp[-2].minor.yy54), releaseRawExprNode(pCxt, yymsp[0].minor.yy54))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy416); + yylhsminor.yy416 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), NULL)); } -#line 8177 "sql.c" - yymsp[-4].minor.yy54 = yylhsminor.yy54; +#line 8171 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; - case 601: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ -#line 1262 "sql.y" + case 602: /* predicate ::= expr_or_subquery IS NOT NULL */ +#line 1269 "sql.y" { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy54); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy54); - yylhsminor.yy54 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy54), releaseRawExprNode(pCxt, yymsp[-2].minor.yy54), releaseRawExprNode(pCxt, yymsp[0].minor.yy54))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy416); + yylhsminor.yy416 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy416), NULL)); } -#line 8187 "sql.c" - yymsp[-5].minor.yy54 = yylhsminor.yy54; +#line 8180 "sql.c" + yymsp[-3].minor.yy416 = yylhsminor.yy416; break; - case 602: /* predicate ::= expr_or_subquery IS NULL */ -#line 1267 "sql.y" -{ - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy54); - yylhsminor.yy54 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy54), NULL)); - } -#line 8196 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; + case 604: /* compare_op ::= NK_LT */ +#line 1281 "sql.y" +{ yymsp[0].minor.yy848 = OP_TYPE_LOWER_THAN; } +#line 8186 "sql.c" break; - case 603: /* predicate ::= expr_or_subquery IS NOT NULL */ -#line 1271 "sql.y" -{ - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy54); - yylhsminor.yy54 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy54), NULL)); - } -#line 8205 "sql.c" - yymsp[-3].minor.yy54 = yylhsminor.yy54; + case 605: /* compare_op ::= NK_GT */ +#line 1282 "sql.y" +{ yymsp[0].minor.yy848 = OP_TYPE_GREATER_THAN; } +#line 8191 "sql.c" break; - case 605: /* compare_op ::= NK_LT */ + case 606: /* compare_op ::= NK_LE */ #line 1283 "sql.y" -{ yymsp[0].minor.yy922 = OP_TYPE_LOWER_THAN; } +{ yymsp[0].minor.yy848 = OP_TYPE_LOWER_EQUAL; } +#line 8196 "sql.c" + break; + case 607: /* compare_op ::= NK_GE */ +#line 1284 "sql.y" +{ yymsp[0].minor.yy848 = OP_TYPE_GREATER_EQUAL; } +#line 8201 "sql.c" + break; + case 608: /* compare_op ::= NK_NE */ +#line 1285 "sql.y" +{ yymsp[0].minor.yy848 = OP_TYPE_NOT_EQUAL; } +#line 8206 "sql.c" + break; + case 609: /* compare_op ::= NK_EQ */ +#line 1286 "sql.y" +{ yymsp[0].minor.yy848 = OP_TYPE_EQUAL; } #line 8211 "sql.c" break; - case 606: /* compare_op ::= NK_GT */ -#line 1284 "sql.y" -{ yymsp[0].minor.yy922 = OP_TYPE_GREATER_THAN; } + case 610: /* compare_op ::= LIKE */ +#line 1287 "sql.y" +{ yymsp[0].minor.yy848 = OP_TYPE_LIKE; } #line 8216 "sql.c" break; - case 607: /* compare_op ::= NK_LE */ -#line 1285 "sql.y" -{ yymsp[0].minor.yy922 = OP_TYPE_LOWER_EQUAL; } + case 611: /* compare_op ::= NOT LIKE */ +#line 1288 "sql.y" +{ yymsp[-1].minor.yy848 = OP_TYPE_NOT_LIKE; } #line 8221 "sql.c" break; - case 608: /* compare_op ::= NK_GE */ -#line 1286 "sql.y" -{ yymsp[0].minor.yy922 = OP_TYPE_GREATER_EQUAL; } + case 612: /* compare_op ::= MATCH */ +#line 1289 "sql.y" +{ yymsp[0].minor.yy848 = OP_TYPE_MATCH; } #line 8226 "sql.c" break; - case 609: /* compare_op ::= NK_NE */ -#line 1287 "sql.y" -{ yymsp[0].minor.yy922 = OP_TYPE_NOT_EQUAL; } + case 613: /* compare_op ::= NMATCH */ +#line 1290 "sql.y" +{ yymsp[0].minor.yy848 = OP_TYPE_NMATCH; } #line 8231 "sql.c" break; - case 610: /* compare_op ::= NK_EQ */ -#line 1288 "sql.y" -{ yymsp[0].minor.yy922 = OP_TYPE_EQUAL; } + case 614: /* compare_op ::= CONTAINS */ +#line 1291 "sql.y" +{ yymsp[0].minor.yy848 = OP_TYPE_JSON_CONTAINS; } #line 8236 "sql.c" break; - case 611: /* compare_op ::= LIKE */ -#line 1289 "sql.y" -{ yymsp[0].minor.yy922 = OP_TYPE_LIKE; } + case 615: /* in_op ::= IN */ +#line 1295 "sql.y" +{ yymsp[0].minor.yy848 = OP_TYPE_IN; } #line 8241 "sql.c" break; - case 612: /* compare_op ::= NOT LIKE */ -#line 1290 "sql.y" -{ yymsp[-1].minor.yy922 = OP_TYPE_NOT_LIKE; } + case 616: /* in_op ::= NOT IN */ +#line 1296 "sql.y" +{ yymsp[-1].minor.yy848 = OP_TYPE_NOT_IN; } #line 8246 "sql.c" break; - case 613: /* compare_op ::= MATCH */ -#line 1291 "sql.y" -{ yymsp[0].minor.yy922 = OP_TYPE_MATCH; } -#line 8251 "sql.c" - break; - case 614: /* compare_op ::= NMATCH */ -#line 1292 "sql.y" -{ yymsp[0].minor.yy922 = OP_TYPE_NMATCH; } -#line 8256 "sql.c" - break; - case 615: /* compare_op ::= CONTAINS */ -#line 1293 "sql.y" -{ yymsp[0].minor.yy922 = OP_TYPE_JSON_CONTAINS; } -#line 8261 "sql.c" - break; - case 616: /* in_op ::= IN */ -#line 1297 "sql.y" -{ yymsp[0].minor.yy922 = OP_TYPE_IN; } -#line 8266 "sql.c" - break; - case 617: /* in_op ::= NOT IN */ + case 617: /* in_predicate_value ::= NK_LP literal_list NK_RP */ #line 1298 "sql.y" -{ yymsp[-1].minor.yy922 = OP_TYPE_NOT_IN; } -#line 8271 "sql.c" +{ yylhsminor.yy416 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy316)); } +#line 8251 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; - case 618: /* in_predicate_value ::= NK_LP literal_list NK_RP */ -#line 1300 "sql.y" -{ yylhsminor.yy54 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy652)); } -#line 8276 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; - break; - case 620: /* boolean_value_expression ::= NOT boolean_primary */ -#line 1304 "sql.y" + case 619: /* boolean_value_expression ::= NOT boolean_primary */ +#line 1302 "sql.y" { - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy54); - yylhsminor.yy54 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy54), NULL)); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); + yylhsminor.yy416 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy416), NULL)); } -#line 8285 "sql.c" - yymsp[-1].minor.yy54 = yylhsminor.yy54; +#line 8260 "sql.c" + yymsp[-1].minor.yy416 = yylhsminor.yy416; break; - case 621: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ -#line 1309 "sql.y" + case 620: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ +#line 1307 "sql.y" { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy54); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy54); - yylhsminor.yy54 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy54), releaseRawExprNode(pCxt, yymsp[0].minor.yy54))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy416); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); + yylhsminor.yy416 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), releaseRawExprNode(pCxt, yymsp[0].minor.yy416))); } -#line 8295 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; +#line 8270 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; - case 622: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ -#line 1315 "sql.y" + case 621: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ +#line 1313 "sql.y" { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy54); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy54); - yylhsminor.yy54 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy54), releaseRawExprNode(pCxt, yymsp[0].minor.yy54))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy416); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy416); + yylhsminor.yy416 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), releaseRawExprNode(pCxt, yymsp[0].minor.yy416))); } -#line 8305 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; +#line 8280 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; - case 630: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ -#line 1333 "sql.y" -{ yylhsminor.yy54 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, JOIN_STYPE_NONE, yymsp[-2].minor.yy54, yymsp[0].minor.yy54, NULL); } -#line 8311 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; + case 629: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ +#line 1331 "sql.y" +{ yylhsminor.yy416 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, JOIN_STYPE_NONE, yymsp[-2].minor.yy416, yymsp[0].minor.yy416, NULL); } +#line 8286 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; - case 633: /* table_primary ::= table_name alias_opt */ + case 632: /* table_primary ::= table_name alias_opt */ +#line 1337 "sql.y" +{ yylhsminor.yy416 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy1109, &yymsp[0].minor.yy1109); } +#line 8292 "sql.c" + yymsp[-1].minor.yy416 = yylhsminor.yy416; + break; + case 633: /* table_primary ::= db_name NK_DOT table_name alias_opt */ +#line 1338 "sql.y" +{ yylhsminor.yy416 = createRealTableNode(pCxt, &yymsp[-3].minor.yy1109, &yymsp[-1].minor.yy1109, &yymsp[0].minor.yy1109); } +#line 8298 "sql.c" + yymsp[-3].minor.yy416 = yylhsminor.yy416; + break; + case 634: /* table_primary ::= subquery alias_opt */ #line 1339 "sql.y" -{ yylhsminor.yy54 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy837, &yymsp[0].minor.yy837); } -#line 8317 "sql.c" - yymsp[-1].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy416), &yymsp[0].minor.yy1109); } +#line 8304 "sql.c" + yymsp[-1].minor.yy416 = yylhsminor.yy416; break; - case 634: /* table_primary ::= db_name NK_DOT table_name alias_opt */ -#line 1340 "sql.y" -{ yylhsminor.yy54 = createRealTableNode(pCxt, &yymsp[-3].minor.yy837, &yymsp[-1].minor.yy837, &yymsp[0].minor.yy837); } -#line 8323 "sql.c" - yymsp[-3].minor.yy54 = yylhsminor.yy54; + case 636: /* alias_opt ::= */ +#line 1344 "sql.y" +{ yymsp[1].minor.yy1109 = nil_token; } +#line 8310 "sql.c" break; - case 635: /* table_primary ::= subquery alias_opt */ -#line 1341 "sql.y" -{ yylhsminor.yy54 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy54), &yymsp[0].minor.yy837); } -#line 8329 "sql.c" - yymsp[-1].minor.yy54 = yylhsminor.yy54; - break; - case 637: /* alias_opt ::= */ + case 638: /* alias_opt ::= AS table_alias */ #line 1346 "sql.y" -{ yymsp[1].minor.yy837 = nil_token; } -#line 8335 "sql.c" +{ yymsp[-1].minor.yy1109 = yymsp[0].minor.yy1109; } +#line 8315 "sql.c" break; - case 639: /* alias_opt ::= AS table_alias */ + case 639: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + case 640: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==640); #line 1348 "sql.y" -{ yymsp[-1].minor.yy837 = yymsp[0].minor.yy837; } -#line 8340 "sql.c" +{ yymsp[-2].minor.yy416 = yymsp[-1].minor.yy416; } +#line 8321 "sql.c" break; - case 640: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - case 641: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==641); -#line 1350 "sql.y" -{ yymsp[-2].minor.yy54 = yymsp[-1].minor.yy54; } + case 641: /* joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */ +#line 1354 "sql.y" +{ + yylhsminor.yy416 = createJoinTableNode(pCxt, yymsp[-6].minor.yy972, yymsp[-5].minor.yy630, yymsp[-7].minor.yy416, yymsp[-3].minor.yy416, yymsp[-2].minor.yy416); + yylhsminor.yy416 = addWindowOffsetClause(pCxt, yylhsminor.yy416, yymsp[-1].minor.yy416); + yylhsminor.yy416 = addJLimitClause(pCxt, yylhsminor.yy416, yymsp[0].minor.yy416); + } +#line 8330 "sql.c" + yymsp[-7].minor.yy416 = yylhsminor.yy416; + break; + case 642: /* join_type ::= */ +#line 1362 "sql.y" +{ yymsp[1].minor.yy972 = JOIN_TYPE_INNER; } +#line 8336 "sql.c" + break; + case 643: /* join_type ::= INNER */ +#line 1363 "sql.y" +{ yymsp[0].minor.yy972 = JOIN_TYPE_INNER; } +#line 8341 "sql.c" + break; + case 644: /* join_type ::= LEFT */ +#line 1364 "sql.y" +{ yymsp[0].minor.yy972 = JOIN_TYPE_LEFT; } #line 8346 "sql.c" break; - case 642: /* joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */ -#line 1356 "sql.y" -{ - yylhsminor.yy54 = createJoinTableNode(pCxt, yymsp[-6].minor.yy230, yymsp[-5].minor.yy948, yymsp[-7].minor.yy54, yymsp[-3].minor.yy54, yymsp[-2].minor.yy54); - yylhsminor.yy54 = addWindowOffsetClause(pCxt, yylhsminor.yy54, yymsp[-1].minor.yy54); - yylhsminor.yy54 = addJLimitClause(pCxt, yylhsminor.yy54, yymsp[0].minor.yy54); - } -#line 8355 "sql.c" - yymsp[-7].minor.yy54 = yylhsminor.yy54; + case 645: /* join_type ::= RIGHT */ +#line 1365 "sql.y" +{ yymsp[0].minor.yy972 = JOIN_TYPE_RIGHT; } +#line 8351 "sql.c" break; - case 643: /* join_type ::= */ -#line 1364 "sql.y" -{ yymsp[1].minor.yy230 = JOIN_TYPE_INNER; } + case 646: /* join_type ::= FULL */ +#line 1366 "sql.y" +{ yymsp[0].minor.yy972 = JOIN_TYPE_FULL; } +#line 8356 "sql.c" + break; + case 647: /* join_subtype ::= */ +#line 1370 "sql.y" +{ yymsp[1].minor.yy630 = JOIN_STYPE_NONE; } #line 8361 "sql.c" break; - case 644: /* join_type ::= INNER */ -#line 1365 "sql.y" -{ yymsp[0].minor.yy230 = JOIN_TYPE_INNER; } + case 648: /* join_subtype ::= OUTER */ +#line 1371 "sql.y" +{ yymsp[0].minor.yy630 = JOIN_STYPE_OUTER; } #line 8366 "sql.c" break; - case 645: /* join_type ::= LEFT */ -#line 1366 "sql.y" -{ yymsp[0].minor.yy230 = JOIN_TYPE_LEFT; } + case 649: /* join_subtype ::= SEMI */ +#line 1372 "sql.y" +{ yymsp[0].minor.yy630 = JOIN_STYPE_SEMI; } #line 8371 "sql.c" break; - case 646: /* join_type ::= RIGHT */ -#line 1367 "sql.y" -{ yymsp[0].minor.yy230 = JOIN_TYPE_RIGHT; } + case 650: /* join_subtype ::= ANTI */ +#line 1373 "sql.y" +{ yymsp[0].minor.yy630 = JOIN_STYPE_ANTI; } #line 8376 "sql.c" break; - case 647: /* join_type ::= FULL */ -#line 1368 "sql.y" -{ yymsp[0].minor.yy230 = JOIN_TYPE_FULL; } + case 651: /* join_subtype ::= ASOF */ +#line 1374 "sql.y" +{ yymsp[0].minor.yy630 = JOIN_STYPE_ASOF; } #line 8381 "sql.c" break; - case 648: /* join_subtype ::= */ -#line 1372 "sql.y" -{ yymsp[1].minor.yy948 = JOIN_STYPE_NONE; } + case 652: /* join_subtype ::= WINDOW */ +#line 1375 "sql.y" +{ yymsp[0].minor.yy630 = JOIN_STYPE_WIN; } #line 8386 "sql.c" break; - case 649: /* join_subtype ::= OUTER */ -#line 1373 "sql.y" -{ yymsp[0].minor.yy948 = JOIN_STYPE_OUTER; } + case 656: /* window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */ +#line 1382 "sql.y" +{ yymsp[-5].minor.yy416 = createWindowOffsetNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy416), releaseRawExprNode(pCxt, yymsp[-1].minor.yy416)); } #line 8391 "sql.c" break; - case 650: /* join_subtype ::= SEMI */ -#line 1374 "sql.y" -{ yymsp[0].minor.yy948 = JOIN_STYPE_SEMI; } -#line 8396 "sql.c" - break; - case 651: /* join_subtype ::= ANTI */ -#line 1375 "sql.y" -{ yymsp[0].minor.yy948 = JOIN_STYPE_ANTI; } -#line 8401 "sql.c" - break; - case 652: /* join_subtype ::= ASOF */ -#line 1376 "sql.y" -{ yymsp[0].minor.yy948 = JOIN_STYPE_ASOF; } -#line 8406 "sql.c" - break; - case 653: /* join_subtype ::= WINDOW */ -#line 1377 "sql.y" -{ yymsp[0].minor.yy948 = JOIN_STYPE_WIN; } -#line 8411 "sql.c" - break; - case 657: /* window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */ + case 657: /* window_offset_literal ::= NK_VARIABLE */ #line 1384 "sql.y" -{ yymsp[-5].minor.yy54 = createWindowOffsetNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy54), releaseRawExprNode(pCxt, yymsp[-1].minor.yy54)); } -#line 8416 "sql.c" +{ yylhsminor.yy416 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createTimeOffsetValueNode(pCxt, &yymsp[0].minor.yy0)); } +#line 8396 "sql.c" + yymsp[0].minor.yy416 = yylhsminor.yy416; break; - case 658: /* window_offset_literal ::= NK_VARIABLE */ -#line 1386 "sql.y" -{ yylhsminor.yy54 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createTimeOffsetValueNode(pCxt, &yymsp[0].minor.yy0)); } -#line 8421 "sql.c" - yymsp[0].minor.yy54 = yylhsminor.yy54; - break; - case 659: /* window_offset_literal ::= NK_MINUS NK_VARIABLE */ -#line 1387 "sql.y" + case 658: /* window_offset_literal ::= NK_MINUS NK_VARIABLE */ +#line 1385 "sql.y" { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy54 = createRawExprNode(pCxt, &t, createTimeOffsetValueNode(pCxt, &t)); + yylhsminor.yy416 = createRawExprNode(pCxt, &t, createTimeOffsetValueNode(pCxt, &t)); } -#line 8431 "sql.c" - yymsp[-1].minor.yy54 = yylhsminor.yy54; +#line 8406 "sql.c" + yymsp[-1].minor.yy416 = yylhsminor.yy416; break; - case 661: /* jlimit_clause_opt ::= JLIMIT NK_INTEGER */ - case 732: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ yytestcase(yyruleno==732); - case 736: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==736); -#line 1394 "sql.y" -{ yymsp[-1].minor.yy54 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } -#line 8439 "sql.c" + case 660: /* jlimit_clause_opt ::= JLIMIT NK_INTEGER */ + case 731: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ yytestcase(yyruleno==731); + case 735: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==735); +#line 1392 "sql.y" +{ yymsp[-1].minor.yy416 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } +#line 8414 "sql.c" break; - case 662: /* query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ -#line 1400 "sql.y" + case 661: /* query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ +#line 1398 "sql.y" { - yymsp[-13].minor.yy54 = createSelectStmt(pCxt, yymsp[-11].minor.yy325, yymsp[-9].minor.yy652, yymsp[-8].minor.yy54, yymsp[-12].minor.yy652); - yymsp[-13].minor.yy54 = setSelectStmtTagMode(pCxt, yymsp[-13].minor.yy54, yymsp[-10].minor.yy325); - yymsp[-13].minor.yy54 = addWhereClause(pCxt, yymsp[-13].minor.yy54, yymsp[-7].minor.yy54); - yymsp[-13].minor.yy54 = addPartitionByClause(pCxt, yymsp[-13].minor.yy54, yymsp[-6].minor.yy652); - yymsp[-13].minor.yy54 = addWindowClauseClause(pCxt, yymsp[-13].minor.yy54, yymsp[-2].minor.yy54); - yymsp[-13].minor.yy54 = addGroupByClause(pCxt, yymsp[-13].minor.yy54, yymsp[-1].minor.yy652); - yymsp[-13].minor.yy54 = addHavingClause(pCxt, yymsp[-13].minor.yy54, yymsp[0].minor.yy54); - yymsp[-13].minor.yy54 = addRangeClause(pCxt, yymsp[-13].minor.yy54, yymsp[-5].minor.yy54); - yymsp[-13].minor.yy54 = addEveryClause(pCxt, yymsp[-13].minor.yy54, yymsp[-4].minor.yy54); - yymsp[-13].minor.yy54 = addFillClause(pCxt, yymsp[-13].minor.yy54, yymsp[-3].minor.yy54); + yymsp[-13].minor.yy416 = createSelectStmt(pCxt, yymsp[-11].minor.yy209, yymsp[-9].minor.yy316, yymsp[-8].minor.yy416, yymsp[-12].minor.yy316); + yymsp[-13].minor.yy416 = setSelectStmtTagMode(pCxt, yymsp[-13].minor.yy416, yymsp[-10].minor.yy209); + yymsp[-13].minor.yy416 = addWhereClause(pCxt, yymsp[-13].minor.yy416, yymsp[-7].minor.yy416); + yymsp[-13].minor.yy416 = addPartitionByClause(pCxt, yymsp[-13].minor.yy416, yymsp[-6].minor.yy316); + yymsp[-13].minor.yy416 = addWindowClauseClause(pCxt, yymsp[-13].minor.yy416, yymsp[-2].minor.yy416); + yymsp[-13].minor.yy416 = addGroupByClause(pCxt, yymsp[-13].minor.yy416, yymsp[-1].minor.yy316); + yymsp[-13].minor.yy416 = addHavingClause(pCxt, yymsp[-13].minor.yy416, yymsp[0].minor.yy416); + yymsp[-13].minor.yy416 = addRangeClause(pCxt, yymsp[-13].minor.yy416, yymsp[-5].minor.yy416); + yymsp[-13].minor.yy416 = addEveryClause(pCxt, yymsp[-13].minor.yy416, yymsp[-4].minor.yy416); + yymsp[-13].minor.yy416 = addFillClause(pCxt, yymsp[-13].minor.yy416, yymsp[-3].minor.yy416); } -#line 8455 "sql.c" +#line 8430 "sql.c" break; - case 663: /* hint_list ::= */ -#line 1415 "sql.y" -{ yymsp[1].minor.yy652 = createHintNodeList(pCxt, NULL); } -#line 8460 "sql.c" + case 662: /* hint_list ::= */ +#line 1413 "sql.y" +{ yymsp[1].minor.yy316 = createHintNodeList(pCxt, NULL); } +#line 8435 "sql.c" break; - case 664: /* hint_list ::= NK_HINT */ -#line 1416 "sql.y" -{ yylhsminor.yy652 = createHintNodeList(pCxt, &yymsp[0].minor.yy0); } -#line 8465 "sql.c" - yymsp[0].minor.yy652 = yylhsminor.yy652; + case 663: /* hint_list ::= NK_HINT */ +#line 1414 "sql.y" +{ yylhsminor.yy316 = createHintNodeList(pCxt, &yymsp[0].minor.yy0); } +#line 8440 "sql.c" + yymsp[0].minor.yy316 = yylhsminor.yy316; break; - case 669: /* set_quantifier_opt ::= ALL */ -#line 1427 "sql.y" -{ yymsp[0].minor.yy325 = false; } -#line 8471 "sql.c" + case 668: /* set_quantifier_opt ::= ALL */ +#line 1425 "sql.y" +{ yymsp[0].minor.yy209 = false; } +#line 8446 "sql.c" break; - case 672: /* select_item ::= NK_STAR */ + case 671: /* select_item ::= NK_STAR */ +#line 1432 "sql.y" +{ yylhsminor.yy416 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } +#line 8451 "sql.c" + yymsp[0].minor.yy416 = yylhsminor.yy416; + break; + case 673: /* select_item ::= common_expression column_alias */ + case 683: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==683); #line 1434 "sql.y" -{ yylhsminor.yy54 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } -#line 8476 "sql.c" - yymsp[0].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy416), &yymsp[0].minor.yy1109); } +#line 8458 "sql.c" + yymsp[-1].minor.yy416 = yylhsminor.yy416; break; - case 674: /* select_item ::= common_expression column_alias */ - case 684: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==684); -#line 1436 "sql.y" -{ yylhsminor.yy54 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy54), &yymsp[0].minor.yy837); } + case 674: /* select_item ::= common_expression AS column_alias */ + case 684: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==684); +#line 1435 "sql.y" +{ yylhsminor.yy416 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), &yymsp[0].minor.yy1109); } +#line 8465 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; + break; + case 679: /* partition_by_clause_opt ::= PARTITION BY partition_list */ + case 709: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==709); + case 729: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==729); +#line 1444 "sql.y" +{ yymsp[-2].minor.yy316 = yymsp[0].minor.yy316; } +#line 8473 "sql.c" + break; + case 686: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ +#line 1457 "sql.y" +{ yymsp[-5].minor.yy416 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy416), releaseRawExprNode(pCxt, yymsp[-1].minor.yy416)); } +#line 8478 "sql.c" + break; + case 687: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ +#line 1458 "sql.y" +{ yymsp[-3].minor.yy416 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy416)); } #line 8483 "sql.c" - yymsp[-1].minor.yy54 = yylhsminor.yy54; break; - case 675: /* select_item ::= common_expression AS column_alias */ - case 685: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==685); -#line 1437 "sql.y" -{ yylhsminor.yy54 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy54), &yymsp[0].minor.yy837); } -#line 8490 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; + case 688: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ +#line 1460 "sql.y" +{ yymsp[-5].minor.yy416 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy416), NULL, yymsp[-1].minor.yy416, yymsp[0].minor.yy416); } +#line 8488 "sql.c" break; - case 680: /* partition_by_clause_opt ::= PARTITION BY partition_list */ - case 710: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==710); - case 730: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==730); -#line 1446 "sql.y" -{ yymsp[-2].minor.yy652 = yymsp[0].minor.yy652; } + case 689: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ +#line 1464 "sql.y" +{ yymsp[-7].minor.yy416 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy416), releaseRawExprNode(pCxt, yymsp[-3].minor.yy416), yymsp[-1].minor.yy416, yymsp[0].minor.yy416); } +#line 8493 "sql.c" + break; + case 690: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ +#line 1466 "sql.y" +{ yymsp[-6].minor.yy416 = createEventWindowNode(pCxt, yymsp[-3].minor.yy416, yymsp[0].minor.yy416); } #line 8498 "sql.c" break; - case 687: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */ -#line 1459 "sql.y" -{ yymsp[-5].minor.yy54 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy54), releaseRawExprNode(pCxt, yymsp[-1].minor.yy54)); } + case 691: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */ +#line 1468 "sql.y" +{ yymsp[-3].minor.yy416 = createCountWindowNode(pCxt, &yymsp[-1].minor.yy0, &yymsp[-1].minor.yy0); } #line 8503 "sql.c" break; - case 688: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ -#line 1460 "sql.y" -{ yymsp[-3].minor.yy54 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy54)); } + case 692: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ +#line 1470 "sql.y" +{ yymsp[-5].minor.yy416 = createCountWindowNode(pCxt, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0); } #line 8508 "sql.c" break; - case 689: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ -#line 1462 "sql.y" -{ yymsp[-5].minor.yy54 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy54), NULL, yymsp[-1].minor.yy54, yymsp[0].minor.yy54); } + case 699: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ +#line 1480 "sql.y" +{ yymsp[-3].minor.yy416 = createFillNode(pCxt, yymsp[-1].minor.yy882, NULL); } #line 8513 "sql.c" break; - case 690: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */ -#line 1466 "sql.y" -{ yymsp[-7].minor.yy54 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy54), releaseRawExprNode(pCxt, yymsp[-3].minor.yy54), yymsp[-1].minor.yy54, yymsp[0].minor.yy54); } + case 700: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ +#line 1481 "sql.y" +{ yymsp[-5].minor.yy416 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy316)); } #line 8518 "sql.c" break; - case 691: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ -#line 1468 "sql.y" -{ yymsp[-6].minor.yy54 = createEventWindowNode(pCxt, yymsp[-3].minor.yy54, yymsp[0].minor.yy54); } + case 701: /* fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ +#line 1482 "sql.y" +{ yymsp[-5].minor.yy416 = createFillNode(pCxt, FILL_MODE_VALUE_F, createNodeListNode(pCxt, yymsp[-1].minor.yy316)); } #line 8523 "sql.c" break; - case 692: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */ -#line 1470 "sql.y" -{ yymsp[-3].minor.yy54 = createCountWindowNode(pCxt, &yymsp[-1].minor.yy0, &yymsp[-1].minor.yy0); } + case 702: /* fill_mode ::= NONE */ +#line 1486 "sql.y" +{ yymsp[0].minor.yy882 = FILL_MODE_NONE; } #line 8528 "sql.c" break; - case 693: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ -#line 1472 "sql.y" -{ yymsp[-5].minor.yy54 = createCountWindowNode(pCxt, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0); } + case 703: /* fill_mode ::= PREV */ +#line 1487 "sql.y" +{ yymsp[0].minor.yy882 = FILL_MODE_PREV; } #line 8533 "sql.c" break; - case 700: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ -#line 1482 "sql.y" -{ yymsp[-3].minor.yy54 = createFillNode(pCxt, yymsp[-1].minor.yy478, NULL); } + case 704: /* fill_mode ::= NULL */ +#line 1488 "sql.y" +{ yymsp[0].minor.yy882 = FILL_MODE_NULL; } #line 8538 "sql.c" break; - case 701: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */ -#line 1483 "sql.y" -{ yymsp[-5].minor.yy54 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy652)); } + case 705: /* fill_mode ::= NULL_F */ +#line 1489 "sql.y" +{ yymsp[0].minor.yy882 = FILL_MODE_NULL_F; } #line 8543 "sql.c" break; - case 702: /* fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */ -#line 1484 "sql.y" -{ yymsp[-5].minor.yy54 = createFillNode(pCxt, FILL_MODE_VALUE_F, createNodeListNode(pCxt, yymsp[-1].minor.yy652)); } + case 706: /* fill_mode ::= LINEAR */ +#line 1490 "sql.y" +{ yymsp[0].minor.yy882 = FILL_MODE_LINEAR; } #line 8548 "sql.c" break; - case 703: /* fill_mode ::= NONE */ -#line 1488 "sql.y" -{ yymsp[0].minor.yy478 = FILL_MODE_NONE; } + case 707: /* fill_mode ::= NEXT */ +#line 1491 "sql.y" +{ yymsp[0].minor.yy882 = FILL_MODE_NEXT; } #line 8553 "sql.c" break; - case 704: /* fill_mode ::= PREV */ -#line 1489 "sql.y" -{ yymsp[0].minor.yy478 = FILL_MODE_PREV; } + case 710: /* group_by_list ::= expr_or_subquery */ +#line 1500 "sql.y" +{ yylhsminor.yy316 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy416))); } #line 8558 "sql.c" + yymsp[0].minor.yy316 = yylhsminor.yy316; break; - case 705: /* fill_mode ::= NULL */ -#line 1490 "sql.y" -{ yymsp[0].minor.yy478 = FILL_MODE_NULL; } -#line 8563 "sql.c" + case 711: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ +#line 1501 "sql.y" +{ yylhsminor.yy316 = addNodeToList(pCxt, yymsp[-2].minor.yy316, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy416))); } +#line 8564 "sql.c" + yymsp[-2].minor.yy316 = yylhsminor.yy316; break; - case 706: /* fill_mode ::= NULL_F */ -#line 1491 "sql.y" -{ yymsp[0].minor.yy478 = FILL_MODE_NULL_F; } -#line 8568 "sql.c" + case 715: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ +#line 1508 "sql.y" +{ yymsp[-5].minor.yy416 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy416), releaseRawExprNode(pCxt, yymsp[-1].minor.yy416)); } +#line 8570 "sql.c" break; - case 707: /* fill_mode ::= LINEAR */ -#line 1492 "sql.y" -{ yymsp[0].minor.yy478 = FILL_MODE_LINEAR; } -#line 8573 "sql.c" - break; - case 708: /* fill_mode ::= NEXT */ -#line 1493 "sql.y" -{ yymsp[0].minor.yy478 = FILL_MODE_NEXT; } -#line 8578 "sql.c" - break; - case 711: /* group_by_list ::= expr_or_subquery */ -#line 1502 "sql.y" -{ yylhsminor.yy652 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy54))); } -#line 8583 "sql.c" - yymsp[0].minor.yy652 = yylhsminor.yy652; - break; - case 712: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ -#line 1503 "sql.y" -{ yylhsminor.yy652 = addNodeToList(pCxt, yymsp[-2].minor.yy652, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy54))); } -#line 8589 "sql.c" - yymsp[-2].minor.yy652 = yylhsminor.yy652; - break; - case 716: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ + case 716: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ #line 1510 "sql.y" -{ yymsp[-5].minor.yy54 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy54), releaseRawExprNode(pCxt, yymsp[-1].minor.yy54)); } -#line 8595 "sql.c" +{ yymsp[-3].minor.yy416 = createInterpTimePoint(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy416)); } +#line 8575 "sql.c" break; - case 717: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */ -#line 1512 "sql.y" -{ yymsp[-3].minor.yy54 = createInterpTimePoint(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy54)); } -#line 8600 "sql.c" - break; - case 720: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ -#line 1519 "sql.y" + case 719: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ +#line 1517 "sql.y" { - yylhsminor.yy54 = addOrderByClause(pCxt, yymsp[-3].minor.yy54, yymsp[-2].minor.yy652); - yylhsminor.yy54 = addSlimitClause(pCxt, yylhsminor.yy54, yymsp[-1].minor.yy54); - yylhsminor.yy54 = addLimitClause(pCxt, yylhsminor.yy54, yymsp[0].minor.yy54); + yylhsminor.yy416 = addOrderByClause(pCxt, yymsp[-3].minor.yy416, yymsp[-2].minor.yy316); + yylhsminor.yy416 = addSlimitClause(pCxt, yylhsminor.yy416, yymsp[-1].minor.yy416); + yylhsminor.yy416 = addLimitClause(pCxt, yylhsminor.yy416, yymsp[0].minor.yy416); } -#line 8609 "sql.c" - yymsp[-3].minor.yy54 = yylhsminor.yy54; +#line 8584 "sql.c" + yymsp[-3].minor.yy416 = yylhsminor.yy416; break; - case 723: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ + case 722: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ +#line 1527 "sql.y" +{ yylhsminor.yy416 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy416, yymsp[0].minor.yy416); } +#line 8590 "sql.c" + yymsp[-3].minor.yy416 = yylhsminor.yy416; + break; + case 723: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ #line 1529 "sql.y" -{ yylhsminor.yy54 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy54, yymsp[0].minor.yy54); } -#line 8615 "sql.c" - yymsp[-3].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy416, yymsp[0].minor.yy416); } +#line 8596 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; - case 724: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ -#line 1531 "sql.y" -{ yylhsminor.yy54 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy54, yymsp[0].minor.yy54); } -#line 8621 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; + case 732: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + case 736: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==736); +#line 1544 "sql.y" +{ yymsp[-3].minor.yy416 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } +#line 8603 "sql.c" break; - case 733: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - case 737: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==737); -#line 1546 "sql.y" -{ yymsp[-3].minor.yy54 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } -#line 8628 "sql.c" + case 733: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + case 737: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==737); +#line 1545 "sql.y" +{ yymsp[-3].minor.yy416 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } +#line 8609 "sql.c" break; - case 734: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - case 738: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==738); -#line 1547 "sql.y" -{ yymsp[-3].minor.yy54 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } -#line 8634 "sql.c" + case 738: /* subquery ::= NK_LP query_expression NK_RP */ +#line 1553 "sql.y" +{ yylhsminor.yy416 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy416); } +#line 8614 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; - case 739: /* subquery ::= NK_LP query_expression NK_RP */ -#line 1555 "sql.y" -{ yylhsminor.yy54 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy54); } -#line 8639 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; + case 743: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ +#line 1567 "sql.y" +{ yylhsminor.yy416 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy416), yymsp[-1].minor.yy506, yymsp[0].minor.yy1045); } +#line 8620 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; - case 744: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ -#line 1569 "sql.y" -{ yylhsminor.yy54 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy54), yymsp[-1].minor.yy760, yymsp[0].minor.yy503); } -#line 8645 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; + case 744: /* ordering_specification_opt ::= */ +#line 1571 "sql.y" +{ yymsp[1].minor.yy506 = ORDER_ASC; } +#line 8626 "sql.c" break; - case 745: /* ordering_specification_opt ::= */ + case 745: /* ordering_specification_opt ::= ASC */ +#line 1572 "sql.y" +{ yymsp[0].minor.yy506 = ORDER_ASC; } +#line 8631 "sql.c" + break; + case 746: /* ordering_specification_opt ::= DESC */ #line 1573 "sql.y" -{ yymsp[1].minor.yy760 = ORDER_ASC; } +{ yymsp[0].minor.yy506 = ORDER_DESC; } +#line 8636 "sql.c" + break; + case 747: /* null_ordering_opt ::= */ +#line 1577 "sql.y" +{ yymsp[1].minor.yy1045 = NULL_ORDER_DEFAULT; } +#line 8641 "sql.c" + break; + case 748: /* null_ordering_opt ::= NULLS FIRST */ +#line 1578 "sql.y" +{ yymsp[-1].minor.yy1045 = NULL_ORDER_FIRST; } +#line 8646 "sql.c" + break; + case 749: /* null_ordering_opt ::= NULLS LAST */ +#line 1579 "sql.y" +{ yymsp[-1].minor.yy1045 = NULL_ORDER_LAST; } #line 8651 "sql.c" break; - case 746: /* ordering_specification_opt ::= ASC */ -#line 1574 "sql.y" -{ yymsp[0].minor.yy760 = ORDER_ASC; } + case 752: /* column_options ::= column_options ENCODE NK_STRING */ +#line 1587 "sql.y" +{ yylhsminor.yy416 = setColumnOptions(pCxt, yymsp[-2].minor.yy416, COLUMN_OPTION_ENCODE, &yymsp[0].minor.yy0); } #line 8656 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; - case 747: /* ordering_specification_opt ::= DESC */ -#line 1575 "sql.y" -{ yymsp[0].minor.yy760 = ORDER_DESC; } -#line 8661 "sql.c" + case 753: /* column_options ::= column_options COMPRESS NK_STRING */ +#line 1588 "sql.y" +{ yylhsminor.yy416 = setColumnOptions(pCxt, yymsp[-2].minor.yy416, COLUMN_OPTION_COMPRESS, &yymsp[0].minor.yy0); } +#line 8662 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; - case 748: /* null_ordering_opt ::= */ -#line 1579 "sql.y" -{ yymsp[1].minor.yy503 = NULL_ORDER_DEFAULT; } -#line 8666 "sql.c" - break; - case 749: /* null_ordering_opt ::= NULLS FIRST */ -#line 1580 "sql.y" -{ yymsp[-1].minor.yy503 = NULL_ORDER_FIRST; } -#line 8671 "sql.c" - break; - case 750: /* null_ordering_opt ::= NULLS LAST */ -#line 1581 "sql.y" -{ yymsp[-1].minor.yy503 = NULL_ORDER_LAST; } -#line 8676 "sql.c" - break; - case 753: /* column_options ::= column_options ENCODE NK_STRING */ + case 754: /* column_options ::= column_options LEVEL NK_STRING */ #line 1589 "sql.y" -{ yylhsminor.yy54 = setColumnOptions(pCxt, yymsp[-2].minor.yy54, COLUMN_OPTION_ENCODE, &yymsp[0].minor.yy0); } -#line 8681 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; - break; - case 754: /* column_options ::= column_options COMPRESS NK_STRING */ -#line 1590 "sql.y" -{ yylhsminor.yy54 = setColumnOptions(pCxt, yymsp[-2].minor.yy54, COLUMN_OPTION_COMPRESS, &yymsp[0].minor.yy0); } -#line 8687 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; - break; - case 755: /* column_options ::= column_options LEVEL NK_STRING */ -#line 1591 "sql.y" -{ yylhsminor.yy54 = setColumnOptions(pCxt, yymsp[-2].minor.yy54, COLUMN_OPTION_LEVEL, &yymsp[0].minor.yy0); } -#line 8693 "sql.c" - yymsp[-2].minor.yy54 = yylhsminor.yy54; +{ yylhsminor.yy416 = setColumnOptions(pCxt, yymsp[-2].minor.yy416, COLUMN_OPTION_LEVEL, &yymsp[0].minor.yy0); } +#line 8668 "sql.c" + yymsp[-2].minor.yy416 = yylhsminor.yy416; break; default: break; @@ -8764,7 +8739,7 @@ static void yy_syntax_error( } else if (TSDB_CODE_PAR_DB_NOT_SPECIFIED == pCxt->errCode && TK_NK_FLOAT == TOKEN.type) { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR, TOKEN.z); } -#line 8767 "sql.c" +#line 8742 "sql.c" /************ End %syntax_error code ******************************************/ ParseARG_STORE /* Suppress warning about unused %extra_argument variable */ ParseCTX_STORE diff --git a/source/libs/planner/src/planLogicCreater.c b/source/libs/planner/src/planLogicCreater.c index 66fa405a3a..0cba28e254 100644 --- a/source/libs/planner/src/planLogicCreater.c +++ b/source/libs/planner/src/planLogicCreater.c @@ -539,7 +539,7 @@ static int32_t createJoinLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect pJoin->pJLimit = nodesCloneNode(pJoinTable->pJLimit); pJoin->addPrimEqCond = nodesCloneNode(pJoinTable->addPrimCond); pJoin->node.pChildren = nodesMakeList(); - pJoin->seqWinGroup = (JOIN_STYPE_WIN == pJoinTable->subType) && (pSelect->hasAggFuncs || pSelect->hasIndefiniteRowsFunc); + pJoin->seqWinGroup = (JOIN_STYPE_WIN == pJoinTable->subType) && (pSelect->hasAggFuncs || pSelect->hasIndefiniteRowsFunc); if (NULL == pJoin->node.pChildren) { code = TSDB_CODE_OUT_OF_MEMORY; @@ -619,7 +619,7 @@ static int32_t createJoinLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect } } -#else +#else // set the output if (TSDB_CODE_SUCCESS == code) { SNodeList* pColList = NULL; @@ -762,7 +762,7 @@ static int32_t addWinJoinPrimKeyToAggFuncs(SSelectStmt* pSelect, SNodeList** pLi pCol->hasIndex = (pColSchema != NULL && IS_IDX_ON(pColSchema)); pCol->node.resType.type = pColSchema->type; pCol->node.resType.bytes = pColSchema->bytes; - pCol->node.resType.precision = pProbeTable->pMeta->tableInfo.precision; + pCol->node.resType.precision = pProbeTable->pMeta->tableInfo.precision; SNode* pFunc = (SNode*)createGroupKeyAggFunc(pCol); @@ -841,7 +841,7 @@ static int32_t createAggLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect, pAgg->isGroupTb = pAgg->pGroupKeys ? keysHasTbname(pAgg->pGroupKeys) : 0; pAgg->isPartTb = pSelect->pPartitionByList ? keysHasTbname(pSelect->pPartitionByList) : 0; pAgg->hasGroup = pAgg->pGroupKeys || pSelect->pPartitionByList; - + if (TSDB_CODE_SUCCESS == code) { *pLogicNode = (SLogicNode*)pAgg; } else { @@ -1708,6 +1708,7 @@ static int32_t getMsgType(ENodeType sqlType) { switch (sqlType) { case QUERY_NODE_CREATE_TABLE_STMT: case QUERY_NODE_CREATE_MULTI_TABLES_STMT: + case QUERY_NODE_CREATE_SUBTABLE_FROM_FILE_CLAUSE: return TDMT_VND_CREATE_TABLE; case QUERY_NODE_DROP_TABLE_STMT: return TDMT_VND_DROP_TABLE; diff --git a/source/libs/qworker/inc/qwInt.h b/source/libs/qworker/inc/qwInt.h index 2222f9cb31..93bbc44a25 100644 --- a/source/libs/qworker/inc/qwInt.h +++ b/source/libs/qworker/inc/qwInt.h @@ -218,8 +218,8 @@ typedef struct SQWorkerMgmt { #define QW_IDS() sId, qId, tId, rId, eId #define QW_FPARAMS() mgmt, QW_IDS() -#define QW_STAT_INC(_item, _n) atomic_add_fetch_64(&(_item), _n) -#define QW_STAT_DEC(_item, _n) atomic_sub_fetch_64(&(_item), _n) +#define QW_STAT_INC(_item, _n) (void)atomic_add_fetch_64(&(_item), _n) +#define QW_STAT_DEC(_item, _n) (void)atomic_sub_fetch_64(&(_item), _n) #define QW_STAT_GET(_item) atomic_load_64(&(_item)) #define QW_GET_EVENT(ctx, event) atomic_load_8(&(ctx)->events[event]) @@ -250,7 +250,7 @@ typedef struct SQWorkerMgmt { } while (0) #define QW_SET_RSP_CODE(ctx, code) atomic_store_32(&(ctx)->rspCode, code) -#define QW_UPDATE_RSP_CODE(ctx, code) atomic_val_compare_exchange_32(&(ctx)->rspCode, 0, code) +#define QW_UPDATE_RSP_CODE(ctx, code) (void)atomic_val_compare_exchange_32(&(ctx)->rspCode, 0, code) #define QW_QUERY_RUNNING(ctx) (QW_GET_PHASE(ctx) == QW_PHASE_PRE_QUERY || QW_GET_PHASE(ctx) == QW_PHASE_PRE_CQUERY) #define QW_FETCH_RUNNING(ctx) ((ctx)->inFetch) @@ -391,7 +391,7 @@ void qwReleaseTaskCtx(SQWorker *mgmt, void *ctx); int32_t qwKillTaskHandle(SQWTaskCtx *ctx, int32_t rspCode); int32_t qwUpdateTaskStatus(QW_FPARAMS_DEF, int8_t status, bool dynamicTask); int32_t qwDropTask(QW_FPARAMS_DEF); -void qwSaveTbVersionInfo(qTaskInfo_t pTaskInfo, SQWTaskCtx *ctx); +int32_t qwSaveTbVersionInfo(qTaskInfo_t pTaskInfo, SQWTaskCtx *ctx); int32_t qwOpenRef(void); void qwSetHbParam(int64_t refId, SQWHbParam **pParam); int32_t qwUpdateTimeInQueue(SQWorker *mgmt, int64_t ts, EQueueType type); diff --git a/source/libs/qworker/src/qwDbg.c b/source/libs/qworker/src/qwDbg.c index d28667d247..d3b8d36b25 100644 --- a/source/libs/qworker/src/qwDbg.c +++ b/source/libs/qworker/src/qwDbg.c @@ -173,8 +173,21 @@ int32_t qwDbgBuildAndSendRedirectRsp(int32_t rspType, SRpcHandleInfo *pConn, int if (pEpSet) { contLen = tSerializeSEpSet(NULL, 0, pEpSet); + if (contLen < 0) { + qError("tSerializeSEpSet failed, code:%x", terrno); + return terrno; + } rsp = rpcMallocCont(contLen); - tSerializeSEpSet(rsp, contLen, pEpSet); + if (NULL == rsp) { + qError("rpcMallocCont %d failed, code:%x", contLen, terrno); + return terrno; + } + + contLen = tSerializeSEpSet(rsp, contLen, pEpSet); + if (contLen < 0) { + qError("tSerializeSEpSet second failed, code:%x", terrno); + return terrno; + } } SRpcMsg rpcRsp = { @@ -208,28 +221,28 @@ void qwDbgSimulateRedirect(SQWMsg *qwMsg, SQWTaskCtx *ctx, bool *rsped) { SEpSet epSet = {0}; epSet.inUse = 1; epSet.numOfEps = 3; - strcpy(epSet.eps[0].fqdn, "localhost"); + TAOS_STRCPY(epSet.eps[0].fqdn, "localhost"); epSet.eps[0].port = 7100; - strcpy(epSet.eps[1].fqdn, "localhost"); + TAOS_STRCPY(epSet.eps[1].fqdn, "localhost"); epSet.eps[1].port = 7200; - strcpy(epSet.eps[2].fqdn, "localhost"); + TAOS_STRCPY(epSet.eps[2].fqdn, "localhost"); epSet.eps[2].port = 7300; ctx->phase = QW_PHASE_POST_QUERY; - qwDbgBuildAndSendRedirectRsp(qwMsg->msgType + 1, &qwMsg->connInfo, TSDB_CODE_SYN_NOT_LEADER, &epSet); + (void)qwDbgBuildAndSendRedirectRsp(qwMsg->msgType + 1, &qwMsg->connInfo, TSDB_CODE_SYN_NOT_LEADER, &epSet); // ignore error *rsped = true; return; } if (TDMT_SCH_MERGE_QUERY == qwMsg->msgType && (0 == taosRand() % 3)) { QW_SET_PHASE(ctx, QW_PHASE_POST_QUERY); - qwDbgBuildAndSendRedirectRsp(qwMsg->msgType + 1, &qwMsg->connInfo, TSDB_CODE_SYN_NOT_LEADER, NULL); + (void)qwDbgBuildAndSendRedirectRsp(qwMsg->msgType + 1, &qwMsg->connInfo, TSDB_CODE_SYN_NOT_LEADER, NULL); // ignore error *rsped = true; return; } if ((TDMT_SCH_FETCH == qwMsg->msgType) && (0 == taosRand() % 9)) { - qwDbgBuildAndSendRedirectRsp(qwMsg->msgType + 1, &qwMsg->connInfo, TSDB_CODE_SYN_NOT_LEADER, NULL); + (void)qwDbgBuildAndSendRedirectRsp(qwMsg->msgType + 1, &qwMsg->connInfo, TSDB_CODE_SYN_NOT_LEADER, NULL); // ignore error *rsped = true; return; } @@ -260,8 +273,8 @@ void qwDbgSimulateDead(QW_FPARAMS_DEF, SQWTaskCtx *ctx, bool *rsped) { if (++ignoreTime > 10 && 0 == taosRand() % 9) { if (ctx->fetchMsgType == TDMT_SCH_FETCH) { - qwBuildAndSendErrorRsp(TDMT_SCH_LINK_BROKEN, &ctx->ctrlConnInfo, TSDB_CODE_RPC_BROKEN_LINK); - qwBuildAndSendErrorRsp(ctx->fetchMsgType + 1, &ctx->dataConnInfo, TSDB_CODE_QRY_TASK_CTX_NOT_EXIST); + (void)qwBuildAndSendErrorRsp(TDMT_SCH_LINK_BROKEN, &ctx->ctrlConnInfo, TSDB_CODE_RPC_BROKEN_LINK); // ignore error + (void)qwBuildAndSendErrorRsp(ctx->fetchMsgType + 1, &ctx->dataConnInfo, TSDB_CODE_QRY_TASK_CTX_NOT_EXIST); // ignore error *rsped = true; taosSsleep(3); diff --git a/source/libs/qworker/src/qwMsg.c b/source/libs/qworker/src/qwMsg.c index d30b100147..f84e5e463e 100644 --- a/source/libs/qworker/src/qwMsg.c +++ b/source/libs/qworker/src/qwMsg.c @@ -21,7 +21,7 @@ int32_t qwMallocFetchRsp(int8_t rpcMalloc, int32_t length, SRetrieveTableRsp **r } if (NULL == *rsp) { - memset(pRsp, 0, sizeof(SRetrieveTableRsp)); + TAOS_MEMSET(pRsp, 0, sizeof(SRetrieveTableRsp)); } *rsp = pRsp; @@ -105,8 +105,19 @@ int32_t qwBuildAndSendExplainRsp(SRpcHandleInfo *pConn, SArray *pExecList) { SExplainRsp rsp = {.numOfPlans = taosArrayGetSize(pExecList), .subplanInfo = pInfo}; int32_t contLen = tSerializeSExplainRsp(NULL, 0, &rsp); + if (contLen < 0) { + qError("tSerializeSExplainRsp failed, error: %x", terrno); + QW_RET(terrno); + } void *pRsp = rpcMallocCont(contLen); - tSerializeSExplainRsp(pRsp, contLen, &rsp); + if (NULL == pRsp) { + QW_RET(terrno); + } + contLen = tSerializeSExplainRsp(pRsp, contLen, &rsp); + if (contLen < 0) { + qError("tSerializeSExplainRsp second failed, error: %x", terrno); + QW_RET(terrno); + } SRpcMsg rpcRsp = { .msgType = TDMT_SCH_EXPLAIN_RSP, @@ -123,8 +134,20 @@ int32_t qwBuildAndSendExplainRsp(SRpcHandleInfo *pConn, SArray *pExecList) { int32_t qwBuildAndSendHbRsp(SRpcHandleInfo *pConn, SSchedulerHbRsp *pStatus, int32_t code) { int32_t contLen = tSerializeSSchedulerHbRsp(NULL, 0, pStatus); + if (contLen < 0) { + qError("tSerializeSSchedulerHbRsp failed, error: %x", terrno); + QW_RET(terrno); + } + void *pRsp = rpcMallocCont(contLen); - tSerializeSSchedulerHbRsp(pRsp, contLen, pStatus); + if (NULL == pRsp) { + QW_RET(terrno); + } + contLen = tSerializeSSchedulerHbRsp(pRsp, contLen, pStatus); + if (contLen < 0) { + qError("tSerializeSSchedulerHbRsp second failed, error: %x", terrno); + QW_RET(terrno); + } SRpcMsg rpcRsp = { .msgType = TDMT_SCH_QUERY_HEARTBEAT_RSP, @@ -143,7 +166,10 @@ int32_t qwBuildAndSendFetchRsp(int32_t rspType, SRpcHandleInfo *pConn, SRetrieve int32_t code) { if (NULL == pRsp) { pRsp = (SRetrieveTableRsp *)rpcMallocCont(sizeof(SRetrieveTableRsp)); - memset(pRsp, 0, sizeof(SRetrieveTableRsp)); + if (NULL == pRsp) { + QW_RET(terrno); + } + TAOS_MEMSET(pRsp, 0, sizeof(SRetrieveTableRsp)); dataLength = 0; } @@ -164,6 +190,9 @@ int32_t qwBuildAndSendFetchRsp(int32_t rspType, SRpcHandleInfo *pConn, SRetrieve #if 0 int32_t qwBuildAndSendCancelRsp(SRpcHandleInfo *pConn, int32_t code) { STaskCancelRsp *pRsp = (STaskCancelRsp *)rpcMallocCont(sizeof(STaskCancelRsp)); + if (NULL == pRsp) { + QW_RET(terrno); + } pRsp->code = code; SRpcMsg rpcRsp = { @@ -180,6 +209,9 @@ int32_t qwBuildAndSendCancelRsp(SRpcHandleInfo *pConn, int32_t code) { int32_t qwBuildAndSendDropRsp(SRpcHandleInfo *pConn, int32_t code) { STaskDropRsp *pRsp = (STaskDropRsp *)rpcMallocCont(sizeof(STaskDropRsp)); + if (NULL == pRsp) { + QW_RET(terrno); + } pRsp->code = code; SRpcMsg rpcRsp = { @@ -405,6 +437,7 @@ int32_t qWorkerAbortPreprocessQueryMsg(void *qWorkerMgmt, SRpcMsg *pMsg) { QW_ERR_RET(TSDB_CODE_QRY_INVALID_INPUT); } + int32_t code = 0; SQWorker *mgmt = (SQWorker *)qWorkerMgmt; SSubQueryMsg msg = {0}; if (tDeserializeSSubQueryMsg(pMsg->pCont, pMsg->contLen, &msg) < 0) { @@ -419,8 +452,8 @@ int32_t qWorkerAbortPreprocessQueryMsg(void *qWorkerMgmt, SRpcMsg *pMsg) { int32_t eId = msg.execId; QW_SCH_TASK_DLOG("Abort prerocessQuery start, handle:%p", pMsg->info.handle); - qwAbortPrerocessQuery(QW_FPARAMS()); - QW_SCH_TASK_DLOG("Abort prerocessQuery end, handle:%p", pMsg->info.handle); + code = qwAbortPrerocessQuery(QW_FPARAMS()); + QW_SCH_TASK_DLOG("Abort prerocessQuery end, handle:%p, code:%x", pMsg->info.handle, code); tFreeSSubQueryMsg(&msg); @@ -435,7 +468,7 @@ int32_t qWorkerProcessQueryMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, int int32_t code = 0; SQWorker *mgmt = (SQWorker *)qWorkerMgmt; - qwUpdateTimeInQueue(mgmt, ts, QUERY_QUEUE); + QW_ERR_RET(qwUpdateTimeInQueue(mgmt, ts, QUERY_QUEUE)); QW_STAT_INC(mgmt->stat.msgStat.queryProcessed, 1); SSubQueryMsg msg = {0}; @@ -477,7 +510,7 @@ int32_t qWorkerProcessCQueryMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, in SQWTaskCtx *handles = NULL; SQWorker *mgmt = (SQWorker *)qWorkerMgmt; - qwUpdateTimeInQueue(mgmt, ts, QUERY_QUEUE); + QW_ERR_RET(qwUpdateTimeInQueue(mgmt, ts, QUERY_QUEUE)); QW_STAT_INC(mgmt->stat.msgStat.cqueryProcessed, 1); if (NULL == msg || pMsg->contLen < sizeof(*msg)) { @@ -495,9 +528,9 @@ int32_t qWorkerProcessCQueryMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, in QW_SCH_TASK_DLOG("processCQuery start, node:%p, handle:%p", node, pMsg->info.handle); - QW_ERR_RET(qwProcessCQuery(QW_FPARAMS(), &qwMsg)); + code = qwProcessCQuery(QW_FPARAMS(), &qwMsg); - QW_SCH_TASK_DLOG("processCQuery end, node:%p", node); + QW_SCH_TASK_DLOG("processCQuery end, node:%p, code:0x%x", node, code); return TSDB_CODE_SUCCESS; } @@ -510,7 +543,7 @@ int32_t qWorkerProcessFetchMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, int SResFetchReq req = {0}; SQWorker *mgmt = (SQWorker *)qWorkerMgmt; - qwUpdateTimeInQueue(mgmt, ts, FETCH_QUEUE); + QW_ERR_RET(qwUpdateTimeInQueue(mgmt, ts, FETCH_QUEUE)); QW_STAT_INC(mgmt->stat.msgStat.fetchProcessed, 1); if (tDeserializeSResFetchReq(pMsg->pCont, pMsg->contLen, &req) < 0) { @@ -528,9 +561,9 @@ int32_t qWorkerProcessFetchMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, int QW_SCH_TASK_DLOG("processFetch start, node:%p, handle:%p", node, pMsg->info.handle); - QW_ERR_RET(qwProcessFetch(QW_FPARAMS(), &qwMsg)); + int32_t code = qwProcessFetch(QW_FPARAMS(), &qwMsg); - QW_SCH_TASK_DLOG("processFetch end, node:%p", node); + QW_SCH_TASK_DLOG("processFetch end, node:%p, code:%x", node, code); return TSDB_CODE_SUCCESS; } @@ -538,7 +571,7 @@ int32_t qWorkerProcessFetchMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, int int32_t qWorkerProcessRspMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, int64_t ts) { SQWorker *mgmt = (SQWorker *)qWorkerMgmt; if (mgmt) { - qwUpdateTimeInQueue(mgmt, ts, FETCH_QUEUE); + QW_ERR_RET(qwUpdateTimeInQueue(mgmt, ts, FETCH_QUEUE)); QW_STAT_INC(mgmt->stat.msgStat.rspProcessed, 1); } @@ -557,7 +590,7 @@ int32_t qWorkerProcessCancelMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, in int32_t code = 0; STaskCancelReq *msg = pMsg->pCont; - qwUpdateTimeInQueue(mgmt, ts, FETCH_QUEUE); + QW_ERR_RET(qwUpdateTimeInQueue(mgmt, ts, FETCH_QUEUE)); QW_STAT_INC(mgmt->stat.msgStat.cancelProcessed, 1); if (NULL == msg || pMsg->contLen < sizeof(*msg)) { @@ -598,7 +631,7 @@ int32_t qWorkerProcessDropMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, int6 int32_t code = 0; SQWorker *mgmt = (SQWorker *)qWorkerMgmt; - qwUpdateTimeInQueue(mgmt, ts, FETCH_QUEUE); + QW_ERR_RET(qwUpdateTimeInQueue(mgmt, ts, FETCH_QUEUE)); QW_STAT_INC(mgmt->stat.msgStat.dropProcessed, 1); STaskDropReq msg = {0}; @@ -621,9 +654,9 @@ int32_t qWorkerProcessDropMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, int6 QW_SCH_TASK_DLOG("processDrop start, node:%p, handle:%p", node, pMsg->info.handle); - QW_ERR_RET(qwProcessDrop(QW_FPARAMS(), &qwMsg)); + code = qwProcessDrop(QW_FPARAMS(), &qwMsg); - QW_SCH_TASK_DLOG("processDrop end, node:%p", node); + QW_SCH_TASK_DLOG("processDrop end, node:%p, code:%x", node, code); return TSDB_CODE_SUCCESS; } @@ -636,7 +669,7 @@ int32_t qWorkerProcessNotifyMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, in int32_t code = 0; SQWorker *mgmt = (SQWorker *)qWorkerMgmt; - qwUpdateTimeInQueue(mgmt, ts, FETCH_QUEUE); + QW_ERR_RET(qwUpdateTimeInQueue(mgmt, ts, FETCH_QUEUE)); QW_STAT_INC(mgmt->stat.msgStat.notifyProcessed, 1); STaskNotifyReq msg = {0}; @@ -655,9 +688,9 @@ int32_t qWorkerProcessNotifyMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, in QW_SCH_TASK_DLOG("processNotify start, node:%p, handle:%p", node, pMsg->info.handle); - QW_ERR_RET(qwProcessNotify(QW_FPARAMS(), &qwMsg)); + code = qwProcessNotify(QW_FPARAMS(), &qwMsg); - QW_SCH_TASK_DLOG("processNotify end, node:%p", node); + QW_SCH_TASK_DLOG("processNotify end, node:%p, code:%x", node, code); return TSDB_CODE_SUCCESS; } @@ -672,7 +705,7 @@ int32_t qWorkerProcessHbMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, int64_ SSchedulerHbReq req = {0}; SQWorker *mgmt = (SQWorker *)qWorkerMgmt; - qwUpdateTimeInQueue(mgmt, ts, FETCH_QUEUE); + QW_ERR_RET(qwUpdateTimeInQueue(mgmt, ts, FETCH_QUEUE)); QW_STAT_INC(mgmt->stat.msgStat.hbProcessed, 1); if (NULL == pMsg->pCont) { @@ -694,9 +727,9 @@ int32_t qWorkerProcessHbMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, int64_ QW_SCH_DLOG("processHb start, node:%p, handle:%p", node, pMsg->info.handle); - QW_ERR_RET(qwProcessHb(mgmt, &qwMsg, &req)); + code = qwProcessHb(mgmt, &qwMsg, &req); - QW_SCH_DLOG("processHb end, node:%p", node); + QW_SCH_DLOG("processHb end, node:%p, code:%x", node, code); return TSDB_CODE_SUCCESS; } @@ -712,7 +745,7 @@ int32_t qWorkerProcessDeleteMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, SD QW_STAT_INC(mgmt->stat.msgStat.deleteProcessed, 1); - tDeserializeSVDeleteReq(pMsg->pCont, pMsg->contLen, &req); + QW_ERR_RET(tDeserializeSVDeleteReq(pMsg->pCont, pMsg->contLen, &req)); uint64_t sId = req.sId; uint64_t qId = req.queryId; diff --git a/source/libs/qworker/src/qwUtil.c b/source/libs/qworker/src/qwUtil.c index f00c4aef30..0b404ec176 100644 --- a/source/libs/qworker/src/qwUtil.c +++ b/source/libs/qworker/src/qwUtil.c @@ -323,34 +323,52 @@ static void freeExplainExecItem(void *param) { int32_t qwSendExplainResponse(QW_FPARAMS_DEF, SQWTaskCtx *ctx) { + int32_t code = TSDB_CODE_SUCCESS; qTaskInfo_t taskHandle = ctx->taskHandle; ctx->explainRsped = true; SArray *execInfoList = taosArrayInit(4, sizeof(SExplainExecInfo)); - QW_ERR_RET(qGetExplainExecInfo(taskHandle, execInfoList)); + if (NULL == execInfoList) { + QW_ERR_JRET(terrno); + } + + QW_ERR_JRET(qGetExplainExecInfo(taskHandle, execInfoList)); if (ctx->localExec) { SExplainLocalRsp localRsp = {0}; localRsp.rsp.numOfPlans = taosArrayGetSize(execInfoList); SExplainExecInfo *pExec = taosMemoryCalloc(localRsp.rsp.numOfPlans, sizeof(SExplainExecInfo)); - memcpy(pExec, taosArrayGet(execInfoList, 0), localRsp.rsp.numOfPlans * sizeof(SExplainExecInfo)); + if (NULL == pExec) { + QW_ERR_JRET(terrno); + } + (void)memcpy(pExec, taosArrayGet(execInfoList, 0), localRsp.rsp.numOfPlans * sizeof(SExplainExecInfo)); localRsp.rsp.subplanInfo = pExec; localRsp.qId = qId; localRsp.tId = tId; localRsp.rId = rId; localRsp.eId = eId; - taosArrayPush(ctx->explainRes, &localRsp); + if (NULL == taosArrayPush(ctx->explainRes, &localRsp)) { + QW_ERR_JRET(terrno); + } + taosArrayDestroy(execInfoList); + execInfoList = NULL; } else { SRpcHandleInfo connInfo = ctx->ctrlConnInfo; connInfo.ahandle = NULL; int32_t code = qwBuildAndSendExplainRsp(&connInfo, execInfoList); taosArrayDestroyEx(execInfoList, freeExplainExecItem); + execInfoList = NULL; + QW_ERR_RET(code); } - return TSDB_CODE_SUCCESS; +_return: + + taosArrayDestroyEx(execInfoList, freeExplainExecItem); + + return code; } @@ -503,37 +521,48 @@ void qwSetHbParam(int64_t refId, SQWHbParam **pParam) { *pParam = &gQwMgmt.param[paramIdx]; } -void qwSaveTbVersionInfo(qTaskInfo_t pTaskInfo, SQWTaskCtx *ctx) { +int32_t qwSaveTbVersionInfo(qTaskInfo_t pTaskInfo, SQWTaskCtx *ctx) { char dbFName[TSDB_DB_FNAME_LEN]; char tbName[TSDB_TABLE_NAME_LEN]; STbVerInfo tbInfo; int32_t i = 0; + int32_t code = TSDB_CODE_SUCCESS; + bool tbGet = false; while (true) { - if (qGetQueryTableSchemaVersion(pTaskInfo, dbFName, tbName, &tbInfo.sversion, &tbInfo.tversion, i) < 0) { + tbGet = false; + code = qGetQueryTableSchemaVersion(pTaskInfo, dbFName, tbName, &tbInfo.sversion, &tbInfo.tversion, i, &tbGet); + if (TSDB_CODE_SUCCESS != code || !tbGet) { break; } if (dbFName[0] && tbName[0]) { - sprintf(tbInfo.tbFName, "%s.%s", dbFName, tbName); + (void)sprintf(tbInfo.tbFName, "%s.%s", dbFName, tbName); } else { tbInfo.tbFName[0] = 0; } if (NULL == ctx->tbInfo) { ctx->tbInfo = taosArrayInit(1, sizeof(tbInfo)); + if (NULL == ctx->tbInfo) { + QW_ERR_RET(terrno); + } } - taosArrayPush(ctx->tbInfo, &tbInfo); + if (NULL == taosArrayPush(ctx->tbInfo, &tbInfo)) { + QW_ERR_RET(terrno); + } i++; } + + QW_RET(code); } void qwCloseRef(void) { taosWLockLatch(&gQwMgmt.lock); if (atomic_load_32(&gQwMgmt.qwNum) <= 0 && gQwMgmt.qwRef >= 0) { - taosCloseRef(gQwMgmt.qwRef); + (void)taosCloseRef(gQwMgmt.qwRef); // ignore error gQwMgmt.qwRef = -1; } taosWUnLockLatch(&gQwMgmt.lock); @@ -550,7 +579,7 @@ void qwDestroyImpl(void *pMgmt) { int32_t schStatusCount = 0; qDebug("start to destroy qworker, type:%d, id:%d, handle:%p", nodeType, nodeId, mgmt); - taosTmrStop(mgmt->hbTimer); + (void)taosTmrStop(mgmt->hbTimer); //ignore error mgmt->hbTimer = NULL; taosTmrCleanUp(mgmt->timer); @@ -584,7 +613,7 @@ void qwDestroyImpl(void *pMgmt) { taosMemoryFree(mgmt); - atomic_sub_fetch_32(&gQwMgmt.qwNum, 1); + (void)atomic_sub_fetch_32(&gQwMgmt.qwNum, 1); qwCloseRef(); @@ -641,24 +670,33 @@ int64_t qwGetTimeInQueue(SQWorker *mgmt, EQueueType type) { return pStat->num ? (pStat->total / pStat->num) : 0; default: qError("unsupported queue type %d", type); + break; } return -1; } void qwClearExpiredSch(SQWorker *mgmt, SArray *pExpiredSch) { + int32_t code = TSDB_CODE_SUCCESS; int32_t num = taosArrayGetSize(pExpiredSch); for (int32_t i = 0; i < num; ++i) { uint64_t *sId = taosArrayGet(pExpiredSch, i); SQWSchStatus *pSch = NULL; - if (qwAcquireScheduler(mgmt, *sId, QW_WRITE, &pSch)) { + if (NULL == sId) { + qError("get the %dth sch failed, code:%x", i, terrno); + break; + } + + code = qwAcquireScheduler(mgmt, *sId, QW_WRITE, &pSch); + if (TSDB_CODE_SUCCESS != code) { + qError("acquire sch %" PRIx64 " failed, code:%x", *sId, code); continue; } if (taosHashGetSize(pSch->tasksHash) <= 0) { qwDestroySchStatus(pSch); - taosHashRemove(mgmt->schHash, sId, sizeof(*sId)); - qDebug("sch %" PRIx64 " destroyed", *sId); + code = taosHashRemove(mgmt->schHash, sId, sizeof(*sId)); + qDebug("sch %" PRIx64 " destroy result code:%x", *sId, code); } qwReleaseScheduler(QW_WRITE, mgmt); diff --git a/source/libs/qworker/src/qworker.c b/source/libs/qworker/src/qworker.c index c2cd07e9ed..6e684545f7 100644 --- a/source/libs/qworker/src/qworker.c +++ b/source/libs/qworker/src/qworker.c @@ -18,10 +18,11 @@ SQWorkerMgmt gQwMgmt = { .qwNum = 0, }; -int32_t qwStopAllTasks(SQWorker *mgmt) { +void qwStopAllTasks(SQWorker *mgmt) { uint64_t qId, tId, sId; int32_t eId; int64_t rId = 0; + int32_t code = TSDB_CODE_SUCCESS; void *pIter = taosHashIterate(mgmt->ctxHash, NULL); while (pIter) { @@ -44,22 +45,29 @@ int32_t qwStopAllTasks(SQWorker *mgmt) { } if (QW_QUERY_RUNNING(ctx)) { - qwKillTaskHandle(ctx, TSDB_CODE_VND_STOPPED); - QW_TASK_DLOG_E("task running, async killed"); + code = qwKillTaskHandle(ctx, TSDB_CODE_VND_STOPPED); + if (TSDB_CODE_SUCCESS != code) { + QW_TASK_ELOG("task running, async kill failed, error: %x", code); + } else { + QW_TASK_DLOG_E("task running, async killed"); + } } else if (QW_FETCH_RUNNING(ctx)) { QW_UPDATE_RSP_CODE(ctx, TSDB_CODE_VND_STOPPED); QW_SET_EVENT_RECEIVED(ctx, QW_EVENT_DROP); QW_TASK_DLOG_E("task fetching, update drop received"); } else { - qwDropTask(QW_FPARAMS()); + code = qwDropTask(QW_FPARAMS()); + if (TSDB_CODE_SUCCESS != code) { + QW_TASK_ELOG("task drop failed, error: %x", code); + } else { + QW_TASK_DLOG_E("task dropped"); + } } QW_UNLOCK(QW_WRITE, &ctx->lock); pIter = taosHashIterate(mgmt->ctxHash, pIter); } - - return TSDB_CODE_SUCCESS; } int32_t qwProcessHbLinkBroken(SQWorker *mgmt, SQWMsg *qwMsg, SSchedulerHbReq *req) { @@ -111,7 +119,7 @@ int32_t qwHandleTaskComplete(QW_FPARAMS_DEF, SQWTaskCtx *ctx) { int32_t qwSendQueryRsp(QW_FPARAMS_DEF, int32_t msgType, SQWTaskCtx *ctx, int32_t rspCode, bool quickRsp) { if ((!quickRsp) || QUERY_RSP_POLICY_QUICK == tsQueryRspPolicy) { if (!ctx->localExec) { - qwBuildAndSendQueryRsp(msgType, &ctx->ctrlConnInfo, rspCode, ctx); + QW_ERR_RET(qwBuildAndSendQueryRsp(msgType, &ctx->ctrlConnInfo, rspCode, ctx)); QW_TASK_DLOG("query msg rsped, handle:%p, code:%x - %s", ctx->ctrlConnInfo.handle, rspCode, tstrerror(rspCode)); } @@ -140,6 +148,10 @@ int32_t qwExecTask(QW_FPARAMS_DEF, SQWTaskCtx *ctx, bool *queryStop) { } SArray *pResList = taosArrayInit(4, POINTER_BYTES); + if (NULL == pResList) { + QW_ERR_RET(terrno); + } + while (true) { QW_TASK_DLOG("start to execTask, loopIdx:%d", i++); @@ -165,6 +177,9 @@ int32_t qwExecTask(QW_FPARAMS_DEF, SQWTaskCtx *ctx, bool *queryStop) { size_t numOfResBlock = taosArrayGetSize(pResList); for (int32_t j = 0; j < numOfResBlock; ++j) { SSDataBlock *pRes = taosArrayGetP(pResList, j); + if (NULL == pRes) { + QW_ERR_JRET(TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR); + } SInputData inputData = {.pData = pRes}; code = dsPutDataBlock(sinkHandle, &inputData, &qcontinue); @@ -226,7 +241,9 @@ int32_t qwExecTask(QW_FPARAMS_DEF, SQWTaskCtx *ctx, bool *queryStop) { } _return: + taosArrayDestroy(pResList); + QW_RET(code); } @@ -241,7 +258,8 @@ bool qwTaskNotInExec(SQWTaskCtx *ctx) { int32_t qwGenerateSchHbRsp(SQWorker *mgmt, SQWSchStatus *sch, SQWHbInfo *hbInfo) { int32_t taskNum = 0; - + int32_t code = TSDB_CODE_SUCCESS; + hbInfo->connInfo = sch->hbConnInfo; hbInfo->rsp.epId = sch->hbEpId; @@ -272,7 +290,11 @@ int32_t qwGenerateSchHbRsp(SQWorker *mgmt, SQWSchStatus *sch, SQWHbInfo *hbInfo) status.status = taskStatus->status; status.refId = taskStatus->refId; - taosArrayPush(hbInfo->rsp.taskStatus, &status); + if (NULL == taosArrayPush(hbInfo->rsp.taskStatus, &status)) { + taosHashCancelIterate(sch->tasksHash, pIter); + code = terrno; + break; + } ++i; pIter = taosHashIterate(sch->tasksHash, pIter); @@ -280,7 +302,7 @@ int32_t qwGenerateSchHbRsp(SQWorker *mgmt, SQWSchStatus *sch, SQWHbInfo *hbInfo) QW_UNLOCK(QW_READ, &sch->tasksLock); - return TSDB_CODE_SUCCESS; + return code; } int32_t qwGetQueryResFromSink(QW_FPARAMS_DEF, SQWTaskCtx *ctx, int32_t *dataLen, int32_t *pRawDataLen, void **rspMsg, @@ -320,7 +342,7 @@ int32_t qwGetQueryResFromSink(QW_FPARAMS_DEF, SQWTaskCtx *ctx, int32_t *dataLen, pOutput->numOfRows); if (!ctx->dynamicTask) { - qwUpdateTaskStatus(QW_FPARAMS(), JOB_TASK_STATUS_SUCC, ctx->dynamicTask); + QW_ERR_RET(qwUpdateTaskStatus(QW_FPARAMS(), JOB_TASK_STATUS_SUCC, ctx->dynamicTask)); } if (NULL == pRsp) { @@ -375,7 +397,7 @@ int32_t qwGetQueryResFromSink(QW_FPARAMS_DEF, SQWTaskCtx *ctx, int32_t *dataLen, if (DS_BUF_EMPTY == pOutput->bufStatus && pOutput->queryEnd) { QW_TASK_DLOG("task all data fetched and done, fetched blocks %d rows %" PRId64, pOutput->numOfBlocks, pOutput->numOfRows); - qwUpdateTaskStatus(QW_FPARAMS(), JOB_TASK_STATUS_SUCC, ctx->dynamicTask); + QW_ERR_RET(qwUpdateTaskStatus(QW_FPARAMS(), JOB_TASK_STATUS_SUCC, ctx->dynamicTask)); break; } @@ -430,8 +452,8 @@ int32_t qwGetDeleteResFromSink(QW_FPARAMS_DEF, SQWTaskCtx *ctx, SDeleteRes *pRes pRes->skey = pDelRes->skey; pRes->ekey = pDelRes->ekey; pRes->affectedRows = pDelRes->affectedRows; - strcpy(pRes->tableFName, pDelRes->tableName); - strcpy(pRes->tsColName, pDelRes->tsColName); + TAOS_STRCPY(pRes->tableFName, pDelRes->tableName); + TAOS_STRCPY(pRes->tsColName, pDelRes->tsColName); taosMemoryFree(output.pData); return TSDB_CODE_SUCCESS; @@ -464,7 +486,7 @@ int32_t qwQuickRspFetchReq(QW_FPARAMS_DEF, SQWTaskCtx *ctx, SQWMsg *qwMsg, int32 qwMsg->connInfo = ctx->dataConnInfo; QW_SET_EVENT_PROCESSED(ctx, QW_EVENT_FETCH); - qwBuildAndSendFetchRsp(ctx->fetchMsgType + 1, &qwMsg->connInfo, rsp, dataLen, code); + QW_ERR_RET(qwBuildAndSendFetchRsp(ctx->fetchMsgType + 1, &qwMsg->connInfo, rsp, dataLen, code)); rsp = NULL; QW_TASK_DLOG("fetch rsp send, handle:%p, code:%x - %s, dataLen:%d", qwMsg->connInfo.handle, code, tstrerror(code), @@ -650,7 +672,7 @@ int32_t qwHandlePostPhaseEvents(QW_FPARAMS_DEF, int8_t phase, SQWPhaseInput *inp _return: if (TSDB_CODE_SUCCESS == code && QW_PHASE_POST_QUERY == phase) { - qwUpdateTaskStatus(QW_FPARAMS(), JOB_TASK_STATUS_PART_SUCC, ctx->dynamicTask); + code = qwUpdateTaskStatus(QW_FPARAMS(), JOB_TASK_STATUS_PART_SUCC, ctx->dynamicTask); ctx->queryGotData = true; } @@ -660,7 +682,10 @@ _return: qwDbgSimulateRedirect(&qwMsg, ctx, &rsped); qwDbgSimulateDead(QW_FPARAMS(), ctx, &rsped); if (!rsped) { - qwSendQueryRsp(QW_FPARAMS(), input->msgType + 1, ctx, code, false); + int32_t newCode = qwSendQueryRsp(QW_FPARAMS(), input->msgType + 1, ctx, code, false); + if (TSDB_CODE_SUCCESS != newCode && TSDB_CODE_SUCCESS == code) { + code = newCode; + } } } @@ -672,7 +697,7 @@ _return: } if (code) { - qwUpdateTaskStatus(QW_FPARAMS(), JOB_TASK_STATUS_FAIL, ctx->dynamicTask); + (void)qwUpdateTaskStatus(QW_FPARAMS(), JOB_TASK_STATUS_FAIL, ctx->dynamicTask); // already in error, ignore new error } QW_UNLOCK(QW_WRITE, &ctx->lock); @@ -687,11 +712,11 @@ _return: int32_t qwAbortPrerocessQuery(QW_FPARAMS_DEF) { QW_ERR_RET(qwDropTask(QW_FPARAMS())); - QW_RET(TSDB_CODE_SUCCESS); + return TSDB_CODE_SUCCESS; } int32_t qwPreprocessQuery(QW_FPARAMS_DEF, SQWMsg *qwMsg) { - int32_t code = 0; + int32_t code = TSDB_CODE_SUCCESS; SQWTaskCtx *ctx = NULL; QW_ERR_JRET(qwRegisterQueryBrokenLinkArg(QW_FPARAMS(), &qwMsg->connInfo)); @@ -706,7 +731,7 @@ int32_t qwPreprocessQuery(QW_FPARAMS_DEF, SQWMsg *qwMsg) { QW_ERR_JRET(qwAddTaskStatus(QW_FPARAMS(), JOB_TASK_STATUS_INIT)); - qwSendQueryRsp(QW_FPARAMS(), qwMsg->msgType + 1, ctx, code, true); + QW_ERR_JRET(qwSendQueryRsp(QW_FPARAMS(), qwMsg->msgType + 1, ctx, code, true)); _return: @@ -715,7 +740,7 @@ _return: qwReleaseTaskCtx(mgmt, ctx); } - QW_RET(TSDB_CODE_SUCCESS); + return TSDB_CODE_SUCCESS; } int32_t qwProcessQuery(QW_FPARAMS_DEF, SQWMsg *qwMsg, char *sql) { @@ -761,7 +786,7 @@ int32_t qwProcessQuery(QW_FPARAMS_DEF, SQWMsg *qwMsg, char *sql) { atomic_store_ptr(&ctx->taskHandle, pTaskInfo); atomic_store_ptr(&ctx->sinkHandle, sinkHandle); - qwSaveTbVersionInfo(pTaskInfo, ctx); + QW_ERR_JRET(qwSaveTbVersionInfo(pTaskInfo, ctx)); if (!ctx->dynamicTask) { QW_ERR_JRET(qwExecTask(QW_FPARAMS(), ctx, NULL)); @@ -778,7 +803,7 @@ _return: input.msgType = qwMsg->msgType; code = qwHandlePostPhaseEvents(QW_FPARAMS(), QW_PHASE_POST_QUERY, &input, NULL); - qwQuickRspFetchReq(QW_FPARAMS(), ctx, qwMsg, code); + QW_ERR_RET(qwQuickRspFetchReq(QW_FPARAMS(), ctx, qwMsg, code)); QW_RET(TSDB_CODE_SUCCESS); } @@ -829,7 +854,7 @@ int32_t qwProcessCQuery(QW_FPARAMS_DEF, SQWMsg *qwMsg) { qwMsg->connInfo = ctx->dataConnInfo; QW_SET_EVENT_PROCESSED(ctx, QW_EVENT_FETCH); - qwBuildAndSendFetchRsp(ctx->fetchMsgType + 1, &qwMsg->connInfo, rsp, dataLen, code); + QW_ERR_JRET(qwBuildAndSendFetchRsp(ctx->fetchMsgType + 1, &qwMsg->connInfo, rsp, dataLen, code)); rsp = NULL; QW_TASK_DLOG("fetch rsp send, handle:%p, code:%x - %s, dataLen:%d", qwMsg->connInfo.handle, code, @@ -851,9 +876,14 @@ int32_t qwProcessCQuery(QW_FPARAMS_DEF, SQWMsg *qwMsg) { rsp = NULL; qwMsg->connInfo = ctx->dataConnInfo; - qwBuildAndSendFetchRsp(ctx->fetchMsgType + 1, &qwMsg->connInfo, NULL, 0, code); - QW_TASK_DLOG("fetch rsp send, handle:%p, code:%x - %s, dataLen:%d", qwMsg->connInfo.handle, code, tstrerror(code), - 0); + code = qwBuildAndSendFetchRsp(ctx->fetchMsgType + 1, &qwMsg->connInfo, NULL, 0, code); + if (TSDB_CODE_SUCCESS != code) { + QW_TASK_ELOG("fetch rsp send fail, handle:%p, code:%x - %s, dataLen:%d", qwMsg->connInfo.handle, code, tstrerror(code), + 0); + } else { + QW_TASK_DLOG("fetch rsp send, handle:%p, code:%x - %s, dataLen:%d", qwMsg->connInfo.handle, code, tstrerror(code), + 0); + } } QW_LOCK(QW_WRITE, &ctx->lock); @@ -869,7 +899,7 @@ int32_t qwProcessCQuery(QW_FPARAMS_DEF, SQWMsg *qwMsg) { } while (true); input.code = code; - qwHandlePostPhaseEvents(QW_FPARAMS(), QW_PHASE_POST_CQUERY, &input, NULL); + QW_ERR_RET(qwHandlePostPhaseEvents(QW_FPARAMS(), QW_PHASE_POST_CQUERY, &input, NULL)); QW_RET(TSDB_CODE_SUCCESS); } @@ -922,7 +952,7 @@ int32_t qwProcessFetch(QW_FPARAMS_DEF, SQWMsg *qwMsg) { } else if (QW_QUERY_RUNNING(ctx)) { atomic_store_8((int8_t *)&ctx->queryContinue, 1); } else if (0 == atomic_load_8((int8_t *)&ctx->queryInQueue)) { - qwUpdateTaskStatus(QW_FPARAMS(), JOB_TASK_STATUS_EXEC, ctx->dynamicTask); + QW_ERR_JRET(qwUpdateTaskStatus(QW_FPARAMS(), JOB_TASK_STATUS_EXEC, ctx->dynamicTask)); atomic_store_8((int8_t *)&ctx->queryInQueue, 1); QW_ERR_JRET(qwBuildAndSendCQueryMsg(QW_FPARAMS(), &qwMsg->connInfo)); @@ -952,9 +982,14 @@ _return: } if (!rsped) { - qwBuildAndSendFetchRsp(qwMsg->msgType + 1, &qwMsg->connInfo, rsp, dataLen, code); - QW_TASK_DLOG("fetch rsp send, msgType:%s, handle:%p, code:%x - %s, dataLen:%d", TMSG_INFO(qwMsg->msgType + 1), - qwMsg->connInfo.handle, code, tstrerror(code), dataLen); + code = qwBuildAndSendFetchRsp(qwMsg->msgType + 1, &qwMsg->connInfo, rsp, dataLen, code); + if (TSDB_CODE_SUCCESS != code) { + QW_TASK_ELOG("fetch rsp send fail, msgType:%s, handle:%p, code:%x - %s, dataLen:%d", TMSG_INFO(qwMsg->msgType + 1), + qwMsg->connInfo.handle, code, tstrerror(code), dataLen); + } else { + QW_TASK_DLOG("fetch rsp send, msgType:%s, handle:%p, code:%x - %s, dataLen:%d", TMSG_INFO(qwMsg->msgType + 1), + qwMsg->connInfo.handle, code, tstrerror(code), dataLen); + } } else { qwFreeFetchRsp(rsp); rsp = NULL; @@ -985,7 +1020,7 @@ int32_t qwProcessDrop(QW_FPARAMS_DEF, SQWMsg *qwMsg) { if (QW_QUERY_RUNNING(ctx)) { QW_ERR_JRET(qwKillTaskHandle(ctx, TSDB_CODE_TSC_QUERY_CANCELLED)); - qwUpdateTaskStatus(QW_FPARAMS(), JOB_TASK_STATUS_DROP, ctx->dynamicTask); + QW_ERR_JRET(qwUpdateTaskStatus(QW_FPARAMS(), JOB_TASK_STATUS_DROP, ctx->dynamicTask)); } else { QW_ERR_JRET(qwDropTask(QW_FPARAMS())); dropped = true; @@ -1001,7 +1036,7 @@ _return: if (code) { if (ctx) { QW_UPDATE_RSP_CODE(ctx, code); - qwUpdateTaskStatus(QW_FPARAMS(), JOB_TASK_STATUS_FAIL, ctx->dynamicTask); + (void)qwUpdateTaskStatus(QW_FPARAMS(), JOB_TASK_STATUS_FAIL, ctx->dynamicTask); // task already failed, no more error handling } else { tmsgReleaseHandle(&qwMsg->connInfo, TAOS_CONN_SERVER); } @@ -1035,7 +1070,7 @@ int32_t qwProcessNotify(QW_FPARAMS_DEF, SQWMsg *qwMsg) { if (QW_QUERY_RUNNING(ctx)) { QW_ERR_JRET(qwKillTaskHandle(ctx, TSDB_CODE_TSC_QUERY_CANCELLED)); - qwUpdateTaskStatus(QW_FPARAMS(), JOB_TASK_STATUS_SUCC, ctx->dynamicTask); + QW_ERR_JRET(qwUpdateTaskStatus(QW_FPARAMS(), JOB_TASK_STATUS_SUCC, ctx->dynamicTask)); } switch (qwMsg->msgType) { @@ -1055,7 +1090,7 @@ _return: if (code) { if (ctx) { QW_UPDATE_RSP_CODE(ctx, code); - qwUpdateTaskStatus(QW_FPARAMS(), JOB_TASK_STATUS_FAIL, ctx->dynamicTask); + (void)qwUpdateTaskStatus(QW_FPARAMS(), JOB_TASK_STATUS_FAIL, ctx->dynamicTask); // task already failed, no more error handling } } @@ -1091,8 +1126,8 @@ int32_t qwProcessHb(SQWorker *mgmt, SQWMsg *qwMsg, SSchedulerHbReq *req) { sch->hbConnInfo.handle = NULL; } - memcpy(&sch->hbConnInfo, &qwMsg->connInfo, sizeof(qwMsg->connInfo)); - memcpy(&sch->hbEpId, &req->epId, sizeof(req->epId)); + (void)memcpy(&sch->hbConnInfo, &qwMsg->connInfo, sizeof(qwMsg->connInfo)); + (void)memcpy(&sch->hbEpId, &req->epId, sizeof(req->epId)); QW_UNLOCK(QW_WRITE, &sch->hbConnLock); @@ -1103,8 +1138,8 @@ int32_t qwProcessHb(SQWorker *mgmt, SQWMsg *qwMsg, SSchedulerHbReq *req) { _return: - memcpy(&rsp.epId, &req->epId, sizeof(req->epId)); - qwBuildAndSendHbRsp(&qwMsg->connInfo, &rsp, code); + (void)memcpy(&rsp.epId, &req->epId, sizeof(req->epId)); + code = qwBuildAndSendHbRsp(&qwMsg->connInfo, &rsp, code); if (code) { tmsgReleaseHandle(&qwMsg->connInfo, TAOS_CONN_SERVER); @@ -1125,7 +1160,7 @@ void qwProcessHbTimerEvent(void *param, void *tmrId) { int64_t refId = hbParam->refId; SQWorker *mgmt = qwAcquire(refId); if (NULL == mgmt) { - QW_DLOG("qwAcquire %" PRIx64 "failed", refId); + QW_DLOG("qwAcquire %" PRIx64 "failed, code:0x%x", refId, terrno); return; } @@ -1137,7 +1172,7 @@ void qwProcessHbTimerEvent(void *param, void *tmrId) { qwDbgDumpMgmtInfo(mgmt); if (gQWDebug.forceStop) { - (void)qwStopAllTasks(mgmt); + qwStopAllTasks(mgmt); } QW_LOCK(QW_READ, &mgmt->schLock); @@ -1145,8 +1180,8 @@ void qwProcessHbTimerEvent(void *param, void *tmrId) { int32_t schNum = taosHashGetSize(mgmt->schHash); if (schNum <= 0) { QW_UNLOCK(QW_READ, &mgmt->schLock); - taosTmrReset(qwProcessHbTimerEvent, QW_DEFAULT_HEARTBEAT_MSEC, param, mgmt->timer, &mgmt->hbTimer); - qwRelease(refId); + (void)taosTmrReset(qwProcessHbTimerEvent, QW_DEFAULT_HEARTBEAT_MSEC, param, mgmt->timer, &mgmt->hbTimer); // ignore error + (void)qwRelease(refId); // ignore error return; } @@ -1156,9 +1191,9 @@ void qwProcessHbTimerEvent(void *param, void *tmrId) { QW_UNLOCK(QW_READ, &mgmt->schLock); taosMemoryFree(rspList); taosArrayDestroy(pExpiredSch); - QW_ELOG("calloc %d SQWHbInfo failed", schNum); - taosTmrReset(qwProcessHbTimerEvent, QW_DEFAULT_HEARTBEAT_MSEC, param, mgmt->timer, &mgmt->hbTimer); - qwRelease(refId); + QW_ELOG("calloc %d SQWHbInfo failed, code:%x", schNum, terrno); + (void)taosTmrReset(qwProcessHbTimerEvent, QW_DEFAULT_HEARTBEAT_MSEC, param, mgmt->timer, &mgmt->hbTimer); // ignore error + (void)qwRelease(refId); // ignore error return; } @@ -1174,7 +1209,11 @@ void qwProcessHbTimerEvent(void *param, void *tmrId) { if (sch1->hbBrokenTs > 0 && ((currentMs - sch1->hbBrokenTs) > QW_SCH_TIMEOUT_MSEC) && taosHashGetSize(sch1->tasksHash) <= 0) { - taosArrayPush(pExpiredSch, sId); + if (NULL == taosArrayPush(pExpiredSch, sId)) { + QW_ELOG("add sId 0x%" PRIx64 " to expiredSch failed, code:%x", *sId, terrno); + taosHashCancelIterate(mgmt->schHash, pIter); + break; + } } pIter = taosHashIterate(mgmt->schHash, pIter); @@ -1196,7 +1235,7 @@ _return: QW_UNLOCK(QW_READ, &mgmt->schLock); for (int32_t j = 0; j < i; ++j) { - qwBuildAndSendHbRsp(&rspList[j].connInfo, &rspList[j].rsp, code); + (void)qwBuildAndSendHbRsp(&rspList[j].connInfo, &rspList[j].rsp, code); // ignore error /*QW_DLOG("hb rsp send, handle:%p, code:%x - %s, taskNum:%d", rspList[j].connInfo.handle, code, tstrerror(code),*/ /*(rspList[j].rsp.taskStatus ? (int32_t)taosArrayGetSize(rspList[j].rsp.taskStatus) : 0));*/ tFreeSSchedulerHbRsp(&rspList[j].rsp); @@ -1209,8 +1248,8 @@ _return: taosMemoryFreeClear(rspList); taosArrayDestroy(pExpiredSch); - taosTmrReset(qwProcessHbTimerEvent, QW_DEFAULT_HEARTBEAT_MSEC, param, mgmt->timer, &mgmt->hbTimer); - qwRelease(refId); + (void)taosTmrReset(qwProcessHbTimerEvent, QW_DEFAULT_HEARTBEAT_MSEC, param, mgmt->timer, &mgmt->hbTimer); // ignore error + (void)qwRelease(refId); // ignore error } int32_t qwProcessDelete(QW_FPARAMS_DEF, SQWMsg *qwMsg, SDeleteRes *pRes) { @@ -1260,19 +1299,19 @@ int32_t qWorkerInit(int8_t nodeType, int32_t nodeId, void **qWorkerMgmt, const S int32_t qwNum = atomic_add_fetch_32(&gQwMgmt.qwNum, 1); if (1 == qwNum) { - memset(gQwMgmt.param, 0, sizeof(gQwMgmt.param)); + TAOS_MEMSET(gQwMgmt.param, 0, sizeof(gQwMgmt.param)); } int32_t code = qwOpenRef(); if (code) { - atomic_sub_fetch_32(&gQwMgmt.qwNum, 1); + (void)atomic_sub_fetch_32(&gQwMgmt.qwNum, 1); QW_RET(code); } SQWorker *mgmt = taosMemoryCalloc(1, sizeof(SQWorker)); if (NULL == mgmt) { qError("calloc %d failed", (int32_t)sizeof(SQWorker)); - atomic_sub_fetch_32(&gQwMgmt.qwNum, 1); + (void)atomic_sub_fetch_32(&gQwMgmt.qwNum, 1); QW_RET(TSDB_CODE_OUT_OF_MEMORY); } @@ -1306,7 +1345,7 @@ int32_t qWorkerInit(int8_t nodeType, int32_t nodeId, void **qWorkerMgmt, const S if (pMsgCb) { mgmt->msgCb = *pMsgCb; } else { - memset(&mgmt->msgCb, 0, sizeof(mgmt->msgCb)); + TAOS_MEMSET(&mgmt->msgCb, 0, sizeof(mgmt->msgCb)); } mgmt->refId = taosAddRef(gQwMgmt.qwRef, mgmt); @@ -1333,14 +1372,14 @@ int32_t qWorkerInit(int8_t nodeType, int32_t nodeId, void **qWorkerMgmt, const S _return: if (mgmt->refId >= 0) { - qwRelease(mgmt->refId); + (void)qwRelease(mgmt->refId); // ignore error } else { taosHashCleanup(mgmt->schHash); taosHashCleanup(mgmt->ctxHash); taosTmrCleanUp(mgmt->timer); taosMemoryFreeClear(mgmt); - atomic_sub_fetch_32(&gQwMgmt.qwNum, 1); + (void)atomic_sub_fetch_32(&gQwMgmt.qwNum, 1); } QW_RET(code); @@ -1353,7 +1392,7 @@ void qWorkerStopAllTasks(void *qWorkerMgmt) { atomic_store_8(&mgmt->nodeStopped, 1); - (void)qwStopAllTasks(mgmt); + qwStopAllTasks(mgmt); } void qWorkerDestroy(void **qWorkerMgmt) { @@ -1383,7 +1422,7 @@ int32_t qWorkerGetStat(SReadHandle *handle, void *qWorkerMgmt, SQWorkerStat *pSt SQWorker *mgmt = (SQWorker *)qWorkerMgmt; SDataSinkStat sinkStat = {0}; - dsDataSinkGetCacheSize(&sinkStat); + QW_ERR_RET(dsDataSinkGetCacheSize(&sinkStat)); pStat->cacheDataSize = sinkStat.cachedSize; pStat->queryProcessed = QW_STAT_GET(mgmt->stat.msgStat.queryProcessed); @@ -1427,6 +1466,10 @@ int32_t qWorkerProcessLocalQuery(void *pMgmt, uint64_t sId, uint64_t qId, uint64 ctx->explainRes = explainRes; rHandle.pMsgCb = taosMemoryCalloc(1, sizeof(SMsgCb)); + if (NULL == rHandle.pMsgCb) { + QW_ERR_JRET(terrno); + } + rHandle.pMsgCb->clientRpc = qwMsg->connInfo.handle; code = qCreateExecTask(&rHandle, mgmt->nodeId, tId, plan, &pTaskInfo, &sinkHandle, 0, NULL, OPTR_EXEC_MODEL_BATCH); diff --git a/source/libs/qworker/test/qworkerTests.cpp b/source/libs/qworker/test/qworkerTests.cpp index 4a0d74a6e3..91e1dda2ac 100644 --- a/source/libs/qworker/test/qworkerTests.cpp +++ b/source/libs/qworker/test/qworkerTests.cpp @@ -130,30 +130,32 @@ void qwtBuildFetchReqMsg(SResFetchReq *fetchMsg, SRpcMsg *fetchRpc) { fetchRpc->contLen = sizeof(SResFetchReq); } -void qwtBuildDropReqMsg(STaskDropReq *dropMsg, SRpcMsg *dropRpc) { +int qwtBuildDropReqMsg(STaskDropReq *dropMsg, SRpcMsg *dropRpc) { dropMsg->sId = 1; dropMsg->queryId = atomic_load_64(&qwtTestQueryId); dropMsg->taskId = 1; int32_t msgSize = tSerializeSTaskDropReq(NULL, 0, dropMsg); if (msgSize < 0) { - return; + return terrno; } char *msg = (char*)taosMemoryCalloc(1, msgSize); if (NULL == msg) { - return; + return terrno; } if (tSerializeSTaskDropReq(msg, msgSize, dropMsg) < 0) { taosMemoryFree(msg); - return; + return terrno; } dropRpc->msgType = TDMT_SCH_DROP_TASK; dropRpc->pCont = msg; dropRpc->contLen = msgSize; + + return TSDB_CODE_SUCCESS; } int32_t qwtStringToPlan(const char *str, SSubplan **subplan) { @@ -164,7 +166,11 @@ int32_t qwtStringToPlan(const char *str, SSubplan **subplan) { int32_t qwtPutReqToFetchQueue(void *node, struct SRpcMsg *pMsg) { taosWLockLatch(&qwtTestFetchQueueLock); struct SRpcMsg *newMsg = (struct SRpcMsg *)taosMemoryCalloc(1, sizeof(struct SRpcMsg)); - memcpy(newMsg, pMsg, sizeof(struct SRpcMsg)); + if (NULL == newMsg) { + printf("malloc failed"); + assert(0); + } + (void)memcpy(newMsg, pMsg, sizeof(struct SRpcMsg)); qwtTestFetchQueue[qwtTestFetchQueueWIdx++] = newMsg; if (qwtTestFetchQueueWIdx >= qwtTestFetchQueueSize) { qwtTestFetchQueueWIdx = 0; @@ -178,7 +184,10 @@ int32_t qwtPutReqToFetchQueue(void *node, struct SRpcMsg *pMsg) { } taosWUnLockLatch(&qwtTestFetchQueueLock); - tsem_post(&qwtTestFetchSem); + if (tsem_post(&qwtTestFetchSem) < 0) { + printf("tsem_post failed, errno:%d", errno); + assert(0); + } return 0; } @@ -186,7 +195,11 @@ int32_t qwtPutReqToFetchQueue(void *node, struct SRpcMsg *pMsg) { int32_t qwtPutReqToQueue(void *node, EQueueType qtype, struct SRpcMsg *pMsg) { taosWLockLatch(&qwtTestQueryQueueLock); struct SRpcMsg *newMsg = (struct SRpcMsg *)taosMemoryCalloc(1, sizeof(struct SRpcMsg)); - memcpy(newMsg, pMsg, sizeof(struct SRpcMsg)); + if (NULL == newMsg) { + printf("malloc failed"); + assert(0); + } + (void)memcpy(newMsg, pMsg, sizeof(struct SRpcMsg)); qwtTestQueryQueue[qwtTestQueryQueueWIdx++] = newMsg; if (qwtTestQueryQueueWIdx >= qwtTestQueryQueueSize) { qwtTestQueryQueueWIdx = 0; @@ -200,22 +213,34 @@ int32_t qwtPutReqToQueue(void *node, EQueueType qtype, struct SRpcMsg *pMsg) { } taosWUnLockLatch(&qwtTestQueryQueueLock); - tsem_post(&qwtTestQuerySem); + if (tsem_post(&qwtTestQuerySem) < 0) { + printf("tsem_post failed, errno:%d", errno); + assert(0); + } return 0; } void qwtSendReqToDnode(void *pVnode, struct SEpSet *epSet, struct SRpcMsg *pReq) {} -void qwtRpcSendResponse(const SRpcMsg *pRsp) { +int qwtRpcSendResponse(const SRpcMsg *pRsp) { + int32_t code = 0; switch (pRsp->msgType) { case TDMT_SCH_QUERY_RSP: case TDMT_SCH_MERGE_QUERY_RSP: { SQueryTableRsp *rsp = (SQueryTableRsp *)pRsp->pCont; if (pRsp->code) { - qwtBuildDropReqMsg(&qwtdropMsg, &qwtdropRpc); - qwtPutReqToFetchQueue((void *)0x1, &qwtdropRpc); + code = qwtBuildDropReqMsg(&qwtdropMsg, &qwtdropRpc); + if (code) { + assert(0); + return code; + } + code = qwtPutReqToFetchQueue((void *)0x1, &qwtdropRpc); + if (code) { + assert(0); + return code; + } } rpcFreeCont(rsp); @@ -227,13 +252,25 @@ void qwtRpcSendResponse(const SRpcMsg *pRsp) { if (0 == pRsp->code && 0 == rsp->completed) { qwtBuildFetchReqMsg(&qwtfetchMsg, &qwtfetchRpc); - qwtPutReqToFetchQueue((void *)0x1, &qwtfetchRpc); + code = qwtPutReqToFetchQueue((void *)0x1, &qwtfetchRpc); + if (code) { + assert(0); + return code; + } rpcFreeCont(rsp); - return; + return code; } - qwtBuildDropReqMsg(&qwtdropMsg, &qwtdropRpc); - qwtPutReqToFetchQueue((void *)0x1, &qwtdropRpc); + code = qwtBuildDropReqMsg(&qwtdropMsg, &qwtdropRpc); + if (code) { + assert(0); + return code; + } + code = qwtPutReqToFetchQueue((void *)0x1, &qwtdropRpc); + if (code) { + assert(0); + return code; + } rpcFreeCont(rsp); break; @@ -245,9 +282,11 @@ void qwtRpcSendResponse(const SRpcMsg *pRsp) { qwtTestCaseFinished = true; break; } + default: + break; } - return; + return code; } int32_t qwtCreateExecTask(void *tsdb, int32_t vgId, uint64_t taskId, struct SSubplan *pPlan, qTaskInfo_t *pTaskInfo, @@ -292,6 +331,9 @@ int32_t qwtExecTask(qTaskInfo_t tinfo, SSDataBlock **pRes, uint64_t *useconds) { if (endExec) { *pRes = (SSDataBlock *)taosMemoryCalloc(1, sizeof(SSDataBlock)); + if (NULL == *pRes) { + return terrno; + } (*pRes)->info.rows = taosRand() % 1000 + 1; } else { *pRes = NULL; @@ -631,7 +673,7 @@ void *queryThread(void *param) { while (!qwtTestStop) { qwtBuildQueryReqMsg(&queryRpc); - qWorkerProcessQueryMsg(mockPointer, mgmt, &queryRpc, 0); + (void)qWorkerProcessQueryMsg(mockPointer, mgmt, &queryRpc, 0); // ignore error if (qwtTestEnableSleep) { taosUsleep(taosRand() % 5); } @@ -653,7 +695,7 @@ void *fetchThread(void *param) { while (!qwtTestStop) { qwtBuildFetchReqMsg(&fetchMsg, &fetchRpc); - code = qWorkerProcessFetchMsg(mockPointer, mgmt, &fetchRpc, 0); + (void)qWorkerProcessFetchMsg(mockPointer, mgmt, &fetchRpc, 0); // ignore error if (qwtTestEnableSleep) { taosUsleep(taosRand() % 5); } @@ -674,8 +716,11 @@ void *dropThread(void *param) { STaskDropReq dropMsg = {0}; while (!qwtTestStop) { - qwtBuildDropReqMsg(&dropMsg, &dropRpc); - code = qWorkerProcessDropMsg(mockPointer, mgmt, &dropRpc, 0); + if (0 != qwtBuildDropReqMsg(&dropMsg, &dropRpc)) { + break; + } + (void)qWorkerProcessDropMsg(mockPointer, mgmt, &dropRpc, 0); // ignore error + if (qwtTestEnableSleep) { taosUsleep(taosRand() % 5); } @@ -700,7 +745,7 @@ void *qwtclientThread(void *param) { qwtTestCaseFinished = false; qwtBuildQueryReqMsg(&queryRpc); - qwtPutReqToQueue((void *)0x1, QUERY_QUEUE, &queryRpc); + (void)qwtPutReqToQueue((void *)0x1, QUERY_QUEUE, &queryRpc); //ignore error while (!qwtTestCaseFinished) { taosUsleep(1); @@ -752,9 +797,9 @@ void *queryQueueThread(void *param) { } if (TDMT_SCH_QUERY == queryRpc->msgType) { - qWorkerProcessQueryMsg(mockPointer, mgmt, queryRpc, 0); + (void)qWorkerProcessQueryMsg(mockPointer, mgmt, queryRpc, 0); //ignore error } else if (TDMT_SCH_QUERY_CONTINUE == queryRpc->msgType) { - qWorkerProcessCQueryMsg(mockPointer, mgmt, queryRpc, 0); + (void)qWorkerProcessCQueryMsg(mockPointer, mgmt, queryRpc, 0); //ignore error } else { printf("unknown msg in query queue, type:%d\n", queryRpc->msgType); assert(0); @@ -810,16 +855,16 @@ void *fetchQueueThread(void *param) { switch (fetchRpc->msgType) { case TDMT_SCH_FETCH: case TDMT_SCH_MERGE_FETCH: - qWorkerProcessFetchMsg(mockPointer, mgmt, fetchRpc, 0); + (void)qWorkerProcessFetchMsg(mockPointer, mgmt, fetchRpc, 0); //ignore error break; case TDMT_SCH_CANCEL_TASK: //qWorkerProcessCancelMsg(mockPointer, mgmt, fetchRpc, 0); break; case TDMT_SCH_DROP_TASK: - qWorkerProcessDropMsg(mockPointer, mgmt, fetchRpc, 0); + (void)qWorkerProcessDropMsg(mockPointer, mgmt, fetchRpc, 0); //ignore error break; case TDMT_SCH_TASK_NOTIFY: - qWorkerProcessNotifyMsg(mockPointer, mgmt, fetchRpc, 0); + (void)qWorkerProcessNotifyMsg(mockPointer, mgmt, fetchRpc, 0); //ignore error break; default: printf("unknown msg type:%d in fetch queue", fetchRpc->msgType); @@ -853,7 +898,7 @@ TEST(seqTest, normalCase) { qwtBuildQueryReqMsg(&queryRpc); qwtBuildFetchReqMsg(&qwtfetchMsg, &fetchRpc); - qwtBuildDropReqMsg(&qwtdropMsg, &dropRpc); + (void)qwtBuildDropReqMsg(&qwtdropMsg, &dropRpc); //ignore error stubSetStringToPlan(); stubSetRpcSendResponse(); @@ -898,7 +943,7 @@ TEST(seqTest, cancelFirst) { qwtInitLogFile(); qwtBuildQueryReqMsg(&queryRpc); - qwtBuildDropReqMsg(&qwtdropMsg, &dropRpc); + (void)qwtBuildDropReqMsg(&qwtdropMsg, &dropRpc); //ignore error stubSetStringToPlan(); stubSetRpcSendResponse(); @@ -954,7 +999,7 @@ TEST(seqTest, randCase) { if (r >= 0 && r < maxr / 5) { printf("Query,%d\n", t++); qwtBuildQueryReqMsg(&queryRpc); - code = qWorkerProcessQueryMsg(mockPointer, mgmt, &queryRpc, 0); + (void)qWorkerProcessQueryMsg(mockPointer, mgmt, &queryRpc, 0); //ignore error } else if (r >= maxr / 5 && r < maxr * 2 / 5) { // printf("Ready,%d\n", t++); // qwtBuildReadyReqMsg(&readyMsg, &readyRpc); @@ -965,14 +1010,14 @@ TEST(seqTest, randCase) { } else if (r >= maxr * 2 / 5 && r < maxr * 3 / 5) { printf("Fetch,%d\n", t++); qwtBuildFetchReqMsg(&fetchMsg, &fetchRpc); - code = qWorkerProcessFetchMsg(mockPointer, mgmt, &fetchRpc, 0); + (void)qWorkerProcessFetchMsg(mockPointer, mgmt, &fetchRpc, 0); //ignore error if (qwtTestEnableSleep) { taosUsleep(1); } } else if (r >= maxr * 3 / 5 && r < maxr * 4 / 5) { printf("Drop,%d\n", t++); - qwtBuildDropReqMsg(&dropMsg, &dropRpc); - code = qWorkerProcessDropMsg(mockPointer, mgmt, &dropRpc, 0); + (void)qwtBuildDropReqMsg(&dropMsg, &dropRpc); //ignore error + (void)qWorkerProcessDropMsg(mockPointer, mgmt, &dropRpc, 0); //ignore error if (qwtTestEnableSleep) { taosUsleep(1); } @@ -1018,14 +1063,14 @@ TEST(seqTest, multithreadRand) { ASSERT_EQ(code, 0); TdThreadAttr thattr; - taosThreadAttrInit(&thattr); + (void)taosThreadAttrInit(&thattr); //ignore error TdThread t1, t2, t3, t4, t5, t6; - taosThreadCreate(&(t1), &thattr, queryThread, mgmt); - // taosThreadCreate(&(t2), &thattr, readyThread, NULL); - taosThreadCreate(&(t3), &thattr, fetchThread, NULL); - taosThreadCreate(&(t4), &thattr, dropThread, NULL); - taosThreadCreate(&(t6), &thattr, fetchQueueThread, mgmt); + (void)taosThreadCreate(&(t1), &thattr, queryThread, mgmt); //ignore error + // (void)taosThreadCreate(&(t2), &thattr, readyThread, NULL); //ignore error + (void)taosThreadCreate(&(t3), &thattr, fetchThread, NULL); //ignore error + (void)taosThreadCreate(&(t4), &thattr, dropThread, NULL); //ignore error + (void)taosThreadCreate(&(t6), &thattr, fetchQueueThread, mgmt); //ignore error while (true) { if (qwtTestDeadLoop) { @@ -1083,16 +1128,16 @@ TEST(rcTest, shortExecshortDelay) { qwtTestMaxExecTaskUsec = 0; qwtTestReqMaxDelayUsec = 0; - tsem_init(&qwtTestQuerySem, 0, 0); - tsem_init(&qwtTestFetchSem, 0, 0); + (void)tsem_init(&qwtTestQuerySem, 0, 0); //ignore error + (void)tsem_init(&qwtTestFetchSem, 0, 0); //ignore error TdThreadAttr thattr; - taosThreadAttrInit(&thattr); + (void)taosThreadAttrInit(&thattr); //ignore error TdThread t1, t2, t3, t4, t5; - taosThreadCreate(&(t1), &thattr, qwtclientThread, mgmt); - taosThreadCreate(&(t2), &thattr, queryQueueThread, mgmt); - taosThreadCreate(&(t3), &thattr, fetchQueueThread, mgmt); + (void)taosThreadCreate(&(t1), &thattr, qwtclientThread, mgmt); //ignore error + (void)taosThreadCreate(&(t2), &thattr, queryQueueThread, mgmt); //ignore error + (void)taosThreadCreate(&(t3), &thattr, fetchQueueThread, mgmt); //ignore error while (true) { if (qwtTestDeadLoop) { @@ -1114,8 +1159,8 @@ TEST(rcTest, shortExecshortDelay) { if (qwtTestCaseFinished) { if (qwtTestQuitThreadNum < 3) { - tsem_post(&qwtTestQuerySem); - tsem_post(&qwtTestFetchSem); + (void)tsem_post(&qwtTestQuerySem); //ignore error + (void)tsem_post(&qwtTestFetchSem); //ignore error taosUsleep(10); } @@ -1166,16 +1211,16 @@ TEST(rcTest, longExecshortDelay) { qwtTestMaxExecTaskUsec = 1000000; qwtTestReqMaxDelayUsec = 0; - tsem_init(&qwtTestQuerySem, 0, 0); - tsem_init(&qwtTestFetchSem, 0, 0); + (void)tsem_init(&qwtTestQuerySem, 0, 0); //ignore error + (void)tsem_init(&qwtTestFetchSem, 0, 0); //ignore error TdThreadAttr thattr; - taosThreadAttrInit(&thattr); + (void)taosThreadAttrInit(&thattr); //ignore error TdThread t1, t2, t3, t4, t5; - taosThreadCreate(&(t1), &thattr, qwtclientThread, mgmt); - taosThreadCreate(&(t2), &thattr, queryQueueThread, mgmt); - taosThreadCreate(&(t3), &thattr, fetchQueueThread, mgmt); + (void)taosThreadCreate(&(t1), &thattr, qwtclientThread, mgmt); //ignore error + (void)taosThreadCreate(&(t2), &thattr, queryQueueThread, mgmt); //ignore error + (void)taosThreadCreate(&(t3), &thattr, fetchQueueThread, mgmt); //ignore error while (true) { if (qwtTestDeadLoop) { @@ -1197,8 +1242,8 @@ TEST(rcTest, longExecshortDelay) { if (qwtTestCaseFinished) { if (qwtTestQuitThreadNum < 3) { - tsem_post(&qwtTestQuerySem); - tsem_post(&qwtTestFetchSem); + (void)tsem_post(&qwtTestQuerySem); //ignore error + (void)tsem_post(&qwtTestFetchSem); //ignore error taosUsleep(10); } @@ -1249,16 +1294,16 @@ TEST(rcTest, shortExeclongDelay) { qwtTestMaxExecTaskUsec = 0; qwtTestReqMaxDelayUsec = 1000000; - tsem_init(&qwtTestQuerySem, 0, 0); - tsem_init(&qwtTestFetchSem, 0, 0); + (void)tsem_init(&qwtTestQuerySem, 0, 0); //ignore error + (void)tsem_init(&qwtTestFetchSem, 0, 0); //ignore error TdThreadAttr thattr; - taosThreadAttrInit(&thattr); + (void)taosThreadAttrInit(&thattr); //ignore error TdThread t1, t2, t3, t4, t5; - taosThreadCreate(&(t1), &thattr, qwtclientThread, mgmt); - taosThreadCreate(&(t2), &thattr, queryQueueThread, mgmt); - taosThreadCreate(&(t3), &thattr, fetchQueueThread, mgmt); + (void)taosThreadCreate(&(t1), &thattr, qwtclientThread, mgmt); //ignore error + (void)taosThreadCreate(&(t2), &thattr, queryQueueThread, mgmt); //ignore error + (void)taosThreadCreate(&(t3), &thattr, fetchQueueThread, mgmt); //ignore error while (true) { if (qwtTestDeadLoop) { @@ -1280,8 +1325,8 @@ TEST(rcTest, shortExeclongDelay) { if (qwtTestCaseFinished) { if (qwtTestQuitThreadNum < 3) { - tsem_post(&qwtTestQuerySem); - tsem_post(&qwtTestFetchSem); + (void)tsem_post(&qwtTestQuerySem); //ignore error + (void)tsem_post(&qwtTestFetchSem); //ignore error taosUsleep(10); } @@ -1327,16 +1372,16 @@ TEST(rcTest, dropTest) { code = qWorkerInit(NODE_TYPE_VNODE, 1, &mgmt, &msgCb); ASSERT_EQ(code, 0); - tsem_init(&qwtTestQuerySem, 0, 0); - tsem_init(&qwtTestFetchSem, 0, 0); + (void)tsem_init(&qwtTestQuerySem, 0, 0); //ignore error + (void)tsem_init(&qwtTestFetchSem, 0, 0); //ignore error TdThreadAttr thattr; - taosThreadAttrInit(&thattr); + (void)taosThreadAttrInit(&thattr); //ignore error TdThread t1, t2, t3, t4, t5; - taosThreadCreate(&(t1), &thattr, qwtclientThread, mgmt); - taosThreadCreate(&(t2), &thattr, queryQueueThread, mgmt); - taosThreadCreate(&(t3), &thattr, fetchQueueThread, mgmt); + (void)taosThreadCreate(&(t1), &thattr, qwtclientThread, mgmt); //ignore error + (void)taosThreadCreate(&(t2), &thattr, queryQueueThread, mgmt); //ignore error + (void)taosThreadCreate(&(t3), &thattr, fetchQueueThread, mgmt); //ignore error while (true) { if (qwtTestDeadLoop) { diff --git a/source/libs/scalar/src/scalar.c b/source/libs/scalar/src/scalar.c index 50de5e760d..8f9ea4d36c 100644 --- a/source/libs/scalar/src/scalar.c +++ b/source/libs/scalar/src/scalar.c @@ -1654,6 +1654,12 @@ static int32_t sclGetCompOperatorResType(SOperatorNode *pOp) { (!IS_STR_DATA_TYPE(rdt.type) && (rdt.type != TSDB_DATA_TYPE_NULL))) { return TSDB_CODE_TSC_INVALID_OPERATION; } + if (nodesIsMatchRegularOp(pOp)) { + SValueNode* node = (SValueNode*)(pOp->pRight); + if(checkRegexPattern(node->literal) != TSDB_CODE_SUCCESS){ + return TSDB_CODE_PAR_REGULAR_EXPRESSION_ERROR; + } + } } pOp->node.resType.type = TSDB_DATA_TYPE_BOOL; pOp->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_BOOL].bytes; diff --git a/source/libs/scalar/src/sclvector.c b/source/libs/scalar/src/sclvector.c index c5789a65ca..16c06c2452 100644 --- a/source/libs/scalar/src/sclvector.c +++ b/source/libs/scalar/src/sclvector.c @@ -1675,10 +1675,8 @@ int32_t doVectorCompareImpl(SScalarParam *pLeft, SScalarParam *pRight, SScalarPa pRes[i] = false; continue; } - char *pLeftData = colDataGetData(pLeft->columnData, leftIndex); char *pRightData = colDataGetData(pRight->columnData, rightIndex); - pRes[i] = filterDoCompare(fp, optr, pLeftData, pRightData); if (pRes[i]) { ++num; @@ -1714,7 +1712,6 @@ int32_t doVectorCompareImpl(SScalarParam *pLeft, SScalarParam *pRight, SScalarPa if (!pLeftData || !pRightData) { result = false; } - if (!result) { colDataSetInt8(pOut->columnData, i, (int8_t *)&result); } else { diff --git a/source/libs/scalar/test/scalar/scalarTests.cpp b/source/libs/scalar/test/scalar/scalarTests.cpp index fe86e18ce3..dd88344962 100644 --- a/source/libs/scalar/test/scalar/scalarTests.cpp +++ b/source/libs/scalar/test/scalar/scalarTests.cpp @@ -43,6 +43,7 @@ #include "tglobal.h" #include "tlog.h" #include "tvariant.h" +#include "tcompare.h" #define _DEBUG_PRINT_ 0 @@ -52,6 +53,12 @@ #define PRINTF(...) #endif +class constantTest { + public: + constantTest() { InitRegexCache(); } + ~constantTest() { DestroyRegexCache(); } +}; +static constantTest test; namespace { SColumnInfo createColumnInfo(int32_t colId, int32_t type, int32_t bytes) { diff --git a/source/libs/scheduler/inc/schInt.h b/source/libs/scheduler/inc/schInt.h index c7f6c20b7d..17476072bb 100644 --- a/source/libs/scheduler/inc/schInt.h +++ b/source/libs/scheduler/inc/schInt.h @@ -583,7 +583,7 @@ char *schGetOpStr(SCH_OP_TYPE type); int32_t schBeginOperation(SSchJob *pJob, SCH_OP_TYPE type, bool sync); int32_t schInitJob(int64_t *pJobId, SSchedulerReq *pReq); int32_t schExecJob(SSchJob *pJob, SSchedulerReq *pReq); -int32_t schDumpJobExecRes(SSchJob *pJob, SExecResult *pRes); +void schDumpJobExecRes(SSchJob *pJob, SExecResult *pRes); int32_t schUpdateTaskCandidateAddr(SSchJob *pJob, SSchTask *pTask, SEpSet *pEpSet); int32_t schHandleTaskSetRetry(SSchJob *pJob, SSchTask *pTask, SDataBuf *pData, int32_t rspCode); void schProcessOnOpEnd(SSchJob *pJob, SCH_OP_TYPE type, SSchedulerReq *pReq, int32_t errCode); @@ -606,7 +606,7 @@ void schFreeTask(SSchJob *pJob, SSchTask *pTask); void schDropTaskInHashList(SSchJob *pJob, SHashObj *list); int32_t schNotifyTaskInHashList(SSchJob *pJob, SHashObj *list, ETaskNotifyType type, SSchTask *pTask); int32_t schLaunchLevelTasks(SSchJob *pJob, SSchLevel *level); -int32_t schGetTaskFromList(SHashObj *pTaskList, uint64_t taskId, SSchTask **pTask); +void schGetTaskFromList(SHashObj *pTaskList, uint64_t taskId, SSchTask **pTask); int32_t schInitTask(SSchJob *pJob, SSchTask *pTask, SSubplan *pPlan, SSchLevel *pLevel); int32_t schSwitchTaskCandidateAddr(SSchJob *pJob, SSchTask *pTask); void schDirectPostJobRes(SSchedulerReq *pReq, int32_t errCode); diff --git a/source/libs/scheduler/src/schDbg.c b/source/libs/scheduler/src/schDbg.c index d6c2b638b8..deaaaec7c1 100644 --- a/source/libs/scheduler/src/schDbg.c +++ b/source/libs/scheduler/src/schDbg.c @@ -16,17 +16,5 @@ #include "query.h" #include "schInt.h" -tsem_t schdRspSem; SSchDebug gSCHDebug = {0}; -void schdExecCallback(SExecResult* pResult, void* param, int32_t code) { - if (code) { - pResult->code = code; - } - - *(SExecResult*)param = *pResult; - - taosMemoryFree(pResult); - - tsem_post(&schdRspSem); -} diff --git a/source/libs/scheduler/src/schFlowCtrl.c b/source/libs/scheduler/src/schFlowCtrl.c index 8c2b65e125..20e1600737 100644 --- a/source/libs/scheduler/src/schFlowCtrl.c +++ b/source/libs/scheduler/src/schFlowCtrl.c @@ -50,6 +50,10 @@ int32_t schChkJobNeedFlowCtrl(SSchJob *pJob, SSchLevel *pLevel) { int32_t taskNum = taosArrayGetSize(pJob->dataSrcTasks); for (int32_t i = 0; i < taskNum; ++i) { SSchTask *pTask = *(SSchTask **)taosArrayGet(pJob->dataSrcTasks, i); + if (NULL == pTask) { + SCH_JOB_DLOG("fail to get the %dth task", i); + SCH_ERR_RET(TSDB_CODE_SCH_INTERNAL_ERROR); + } sum += pTask->plan->execNodeStat.tableNum; } @@ -214,6 +218,10 @@ int32_t schLaunchTasksInFlowCtrlListImpl(SSchJob *pJob, SSchFlowControl *ctrl) { for (int32_t i = 0; i < taskNum; ++i) { pTask = *(SSchTask **)taosArrayGet(ctrl->taskList, i); + if (NULL == pTask) { + SCH_JOB_ELOG("fail to get the %dth task", i); + SCH_ERR_JRET(TSDB_CODE_SCH_INTERNAL_ERROR); + } SEp *ep = SCH_GET_CUR_EP(&pTask->plan->execNode); if (pTask->plan->execNodeStat.tableNum > remainNum && ctrl->execTaskNum > 0) { @@ -243,6 +251,11 @@ int32_t schLaunchTasksInFlowCtrlListImpl(SSchJob *pJob, SSchFlowControl *ctrl) { if (i < (taskNum - 1)) { SSchTask *pLastTask = *(SSchTask **)taosArrayGetLast(ctrl->taskList); + if (NULL == pLastTask) { + SCH_JOB_ELOG("fail to get the last task, num:%d", (int32_t)taosArrayGetSize(ctrl->taskList)); + SCH_ERR_JRET(TSDB_CODE_SCH_INTERNAL_ERROR); + } + if (remainNum < pLastTask->plan->execNodeStat.tableNum) { SCH_TASK_DLOG("no more task to launch, fqdn:%s, port:%d, remainNum:%" PRId64 ", remainExecTaskNum:%d, smallestInList:%d", ep->fqdn, ep->port, ctrl->tableNumSum, ctrl->execTaskNum, pLastTask->plan->execNodeStat.tableNum); diff --git a/source/libs/scheduler/src/schJob.c b/source/libs/scheduler/src/schJob.c index 278768981a..a8e2e79aee 100644 --- a/source/libs/scheduler/src/schJob.c +++ b/source/libs/scheduler/src/schJob.c @@ -47,6 +47,7 @@ void schUpdateJobErrCode(SSchJob *pJob, int32_t errCode) { return; _return: + SCH_JOB_DLOG("job errCode updated to %s", tstrerror(errCode)); } @@ -166,9 +167,18 @@ _return: int32_t schBuildTaskRalation(SSchJob *pJob, SHashObj *planToTask) { for (int32_t i = 0; i < pJob->levelNum; ++i) { SSchLevel *pLevel = taosArrayGet(pJob->levels, i); - + if (NULL == pLevel) { + SCH_JOB_ELOG("fail to get the %dth level, levelNum: %d", i, pJob->levelNum); + SCH_ERR_RET(TSDB_CODE_SCH_INTERNAL_ERROR); + } + for (int32_t m = 0; m < pLevel->taskNum; ++m) { SSchTask *pTask = taosArrayGet(pLevel->subTasks, m); + if (NULL == pTask) { + SCH_JOB_ELOG("fail to get the %dth task in level %d, taskNum: %d", m, pLevel->level, pLevel->taskNum); + SCH_ERR_RET(TSDB_CODE_SCH_INTERNAL_ERROR); + } + SSubplan *pPlan = pTask->plan; int32_t childNum = pPlan->pChildren ? (int32_t)LIST_LENGTH(pPlan->pChildren) : 0; int32_t parentNum = pPlan->pParents ? (int32_t)LIST_LENGTH(pPlan->pParents) : 0; @@ -188,6 +198,11 @@ int32_t schBuildTaskRalation(SSchJob *pJob, SHashObj *planToTask) { for (int32_t n = 0; n < childNum; ++n) { SSubplan *child = (SSubplan *)nodesListGetNode(pPlan->pChildren, n); + if (NULL == child) { + SCH_JOB_ELOG("fail to get the %dth child subplan, childNum: %d", n, childNum); + SCH_ERR_RET(TSDB_CODE_SCH_INTERNAL_ERROR); + } + SSchTask **childTask = taosHashGet(planToTask, &child, POINTER_BYTES); if (NULL == childTask || NULL == *childTask) { SCH_TASK_ELOG("subplan children relationship error, level:%d, taskIdx:%d, childIdx:%d", i, m, n); @@ -222,6 +237,11 @@ int32_t schBuildTaskRalation(SSchJob *pJob, SHashObj *planToTask) { for (int32_t n = 0; n < parentNum; ++n) { SSubplan *parent = (SSubplan *)nodesListGetNode(pPlan->pParents, n); + if (NULL == parent) { + SCH_JOB_ELOG("fail to get the %dth parent subplan, parentNum: %d", n, parentNum); + SCH_ERR_RET(TSDB_CODE_SCH_INTERNAL_ERROR); + } + SSchTask **parentTask = taosHashGet(planToTask, &parent, POINTER_BYTES); if (NULL == parentTask || NULL == *parentTask) { SCH_TASK_ELOG("subplan parent relationship error, level:%d, taskIdx:%d, childIdx:%d", i, m, n); @@ -241,6 +261,11 @@ int32_t schBuildTaskRalation(SSchJob *pJob, SHashObj *planToTask) { } SSchLevel *pLevel = taosArrayGet(pJob->levels, 0); + if (NULL == pLevel) { + SCH_JOB_ELOG("fail to get level 0 level, levelNum:%d", (int32_t)taosArrayGetSize(pJob->levels)); + SCH_ERR_RET(TSDB_CODE_SCH_INTERNAL_ERROR); + } + if (SCH_IS_QUERY_JOB(pJob)) { if (pLevel->taskNum > 1) { SCH_JOB_ELOG("invalid query plan, level:0, taskNum:%d", pLevel->taskNum); @@ -248,6 +273,11 @@ int32_t schBuildTaskRalation(SSchJob *pJob, SHashObj *planToTask) { } SSchTask *pTask = taosArrayGet(pLevel->subTasks, 0); + if (NULL == pLevel) { + SCH_JOB_ELOG("fail to get the first task in level 0, taskNum:%d", (int32_t)taosArrayGetSize(pLevel->subTasks)); + SCH_ERR_RET(TSDB_CODE_SCH_INTERNAL_ERROR); + } + if (SUBPLAN_TYPE_MODIFY != pTask->plan->subplanType || EXPLAIN_MODE_DISABLE != pJob->attr.explainMode) { pJob->attr.needFetch = true; } @@ -261,7 +291,9 @@ int32_t schAppendJobDataSrc(SSchJob *pJob, SSchTask *pTask) { return TSDB_CODE_SUCCESS; } - taosArrayPush(pJob->dataSrcTasks, &pTask); + if (NULL == taosArrayPush(pJob->dataSrcTasks, &pTask)) { + SCH_ERR_RET(terrno); + } return TSDB_CODE_SUCCESS; } @@ -318,6 +350,11 @@ int32_t schValidateAndBuildJob(SQueryPlan *pDag, SSchJob *pJob) { } pLevel = taosArrayGet(pJob->levels, i); + if (NULL == pLevel) { + SCH_JOB_ELOG("fail to get the %dth level, levelNum: %d", i, levelNum); + SCH_ERR_RET(TSDB_CODE_SCH_INTERNAL_ERROR); + } + pLevel->level = i; plans = (SNodeListNode *)nodesListGetNode(pDag->pSubplans, i); @@ -342,6 +379,10 @@ int32_t schValidateAndBuildJob(SQueryPlan *pDag, SSchJob *pJob) { for (int32_t n = 0; n < taskNum; ++n) { SSubplan *plan = (SSubplan *)nodesListGetNode(plans->pNodeList, n); + if (NULL == plan) { + SCH_JOB_ELOG("fail to get the %dth subplan, taskNum: %d", n, taskNum); + SCH_ERR_RET(TSDB_CODE_SCH_INTERNAL_ERROR); + } SCH_SET_JOB_TYPE(pJob, plan->subplanType); @@ -383,7 +424,7 @@ _return: SCH_RET(code); } -int32_t schDumpJobExecRes(SSchJob *pJob, SExecResult *pRes) { +void schDumpJobExecRes(SSchJob *pJob, SExecResult *pRes) { pRes->code = atomic_load_32(&pJob->errCode); pRes->numOfRows = pJob->resNumOfRows; @@ -395,8 +436,6 @@ int32_t schDumpJobExecRes(SSchJob *pJob, SExecResult *pRes) { SCH_UNLOCK(SCH_WRITE, &pJob->resLock); SCH_JOB_DLOG("execRes dumped, code: %s", tstrerror(pRes->code)); - - return TSDB_CODE_SUCCESS; } int32_t schDumpJobFetchRes(SSchJob *pJob, void **pData) { @@ -421,10 +460,13 @@ int32_t schDumpJobFetchRes(SSchJob *pJob, void **pData) { if (NULL == *pData) { SRetrieveTableRsp *rsp = (SRetrieveTableRsp *)taosMemoryCalloc(1, sizeof(SRetrieveTableRsp)); - if (rsp) { - rsp->completed = 1; + if (NULL == rsp) { + SCH_JOB_ELOG("malloc SRetrieveTableRsp %d failed, code:%x", (int32_t)sizeof(SRetrieveTableRsp), terrno); + SCH_ERR_JRET(terrno); } + rsp->completed = 1; + *pData = rsp; SCH_JOB_DLOG("empty res and set query complete, code:%x", code); } @@ -440,10 +482,13 @@ _return: int32_t schNotifyUserExecRes(SSchJob *pJob) { SExecResult *pRes = taosMemoryCalloc(1, sizeof(SExecResult)); - if (pRes) { - schDumpJobExecRes(pJob, pRes); + if (NULL == pRes) { + qError("malloc execResult %d failed, error: %x", (int32_t)sizeof(SExecResult), terrno); + SCH_RET(terrno); } + schDumpJobExecRes(pJob, pRes); + SCH_JOB_DLOG("sch start to invoke exec cb, code: %s", tstrerror(pJob->errCode)); (*pJob->userRes.execFp)(pRes, pJob->userRes.cbParam, atomic_load_32(&pJob->errCode)); SCH_JOB_DLOG("sch end from exec cb, code: %s", tstrerror(pJob->errCode)); @@ -454,7 +499,10 @@ int32_t schNotifyUserExecRes(SSchJob *pJob) { int32_t schNotifyUserFetchRes(SSchJob *pJob) { void *pRes = NULL; - schDumpJobFetchRes(pJob, &pRes); + int32_t code = schDumpJobFetchRes(pJob, &pRes); + if (TSDB_CODE_SUCCESS != code && TSDB_CODE_SUCCESS == atomic_load_32(&pJob->errCode)) { + atomic_store_32(&pJob->errCode, code); + } SCH_JOB_DLOG("sch start to invoke fetch cb, code: %s", tstrerror(pJob->errCode)); (*pJob->userRes.fetchFp)(pRes, pJob->userRes.cbParam, atomic_load_32(&pJob->errCode)); @@ -478,13 +526,13 @@ void schPostJobRes(SSchJob *pJob, SCH_OP_TYPE op) { if (SCH_JOB_IN_SYNC_OP(pJob)) { SCH_UNLOCK(SCH_WRITE, &pJob->opStatus.lock); - tsem_post(&pJob->rspSem); + (void)tsem_post(&pJob->rspSem); // ignore error } else if (SCH_JOB_IN_ASYNC_EXEC_OP(pJob)) { SCH_UNLOCK(SCH_WRITE, &pJob->opStatus.lock); - schNotifyUserExecRes(pJob); + (void)schNotifyUserExecRes(pJob); // ignore error } else if (SCH_JOB_IN_ASYNC_FETCH_OP(pJob)) { SCH_UNLOCK(SCH_WRITE, &pJob->opStatus.lock); - schNotifyUserFetchRes(pJob); + (void)schNotifyUserFetchRes(pJob); // ignore error } else { SCH_UNLOCK(SCH_WRITE, &pJob->opStatus.lock); SCH_JOB_ELOG("job not in any operation, status:%s", jobTaskStatusStr(pJob->status)); @@ -519,7 +567,8 @@ int32_t schHandleJobFailure(SSchJob *pJob, int32_t errCode) { return TSDB_CODE_SCH_IGNORE_ERROR; } - schSwitchJobStatus(pJob, JOB_TASK_STATUS_FAIL, &errCode); + (void)schSwitchJobStatus(pJob, JOB_TASK_STATUS_FAIL, &errCode); // ignore error + return TSDB_CODE_SCH_IGNORE_ERROR; } @@ -530,7 +579,8 @@ int32_t schHandleJobDrop(SSchJob *pJob, int32_t errCode) { return TSDB_CODE_SCH_IGNORE_ERROR; } - schSwitchJobStatus(pJob, JOB_TASK_STATUS_DROP, &errCode); + (void)schSwitchJobStatus(pJob, JOB_TASK_STATUS_DROP, &errCode); // ignore error + return TSDB_CODE_SCH_IGNORE_ERROR; } @@ -569,12 +619,21 @@ int32_t schLaunchJobLowerLevel(SSchJob *pJob, SSchTask *pTask) { SSchLevel *pLevel = pTask->level; int32_t doneNum = atomic_load_32(&pLevel->taskExecDoneNum); if (doneNum == pLevel->taskNum) { - atomic_sub_fetch_32(&pJob->levelIdx, 1); + (void)atomic_sub_fetch_32(&pJob->levelIdx, 1); pLevel = taosArrayGet(pJob->levels, pJob->levelIdx); + if (NULL == pLevel) { + SCH_JOB_ELOG("fail to get the %dth level, levelNum:%d", pJob->levelIdx, (int32_t)taosArrayGetSize(pJob->levels)); + SCH_ERR_RET(TSDB_CODE_SCH_INTERNAL_ERROR); + } + for (int32_t i = 0; i < pLevel->taskNum; ++i) { SSchTask *pTask = taosArrayGet(pLevel->subTasks, i); - + if (NULL == pTask) { + SCH_JOB_ELOG("fail to get the %dth task in level %d, taskNum:%d", i, pLevel->level, pLevel->taskNum); + SCH_ERR_RET(TSDB_CODE_SCH_INTERNAL_ERROR); + } + if (pTask->children && taosArrayGetSize(pTask->children) > 0) { continue; } @@ -602,7 +661,11 @@ int32_t schSaveJobExecRes(SSchJob *pJob, SQueryTableRsp *rsp) { } } - taosArrayAddBatch((SArray *)pJob->execRes.res, taosArrayGet(rsp->tbVerInfo, 0), taosArrayGetSize(rsp->tbVerInfo)); + if (NULL == taosArrayAddBatch((SArray *)pJob->execRes.res, taosArrayGet(rsp->tbVerInfo, 0), taosArrayGetSize(rsp->tbVerInfo))) { + SCH_UNLOCK(SCH_WRITE, &pJob->resLock); + SCH_ERR_RET(terrno); + } + taosArrayDestroy(rsp->tbVerInfo); pJob->execRes.msgType = TDMT_SCH_QUERY; @@ -629,6 +692,11 @@ int32_t schLaunchJob(SSchJob *pJob) { SCH_ERR_RET(schSwitchJobStatus(pJob, JOB_TASK_STATUS_PART_SUCC, NULL)); } else { SSchLevel *level = taosArrayGet(pJob->levels, pJob->levelIdx); + if (NULL == level) { + SCH_JOB_ELOG("fail to get the %dth level, levelNum:%d", pJob->levelIdx, (int32_t)taosArrayGetSize(pJob->levels)); + SCH_ERR_RET(TSDB_CODE_SCH_INTERNAL_ERROR); + } + SCH_ERR_RET(schLaunchLevelTasks(pJob, level)); } @@ -661,10 +729,19 @@ void schFreeJobImpl(void *job) { int32_t numOfLevels = taosArrayGetSize(pJob->levels); for (int32_t i = 0; i < numOfLevels; ++i) { SSchLevel *pLevel = taosArrayGet(pJob->levels, i); + if (NULL == pLevel) { + SCH_JOB_ELOG("fail to get the %dth level, levelNum:%d", i, numOfLevels); + continue; + } int32_t numOfTasks = taosArrayGetSize(pLevel->subTasks); for (int32_t j = 0; j < numOfTasks; ++j) { SSchTask *pTask = taosArrayGet(pLevel->subTasks, j); + if (NULL == pLevel) { + SCH_JOB_ELOG("fail to get the %dth task, taskNum:%d", j, numOfTasks); + continue; + } + schFreeTask(pJob, pTask); } @@ -687,12 +764,12 @@ void schFreeJobImpl(void *job) { destroyQueryExecRes(&pJob->execRes); qDestroyQueryPlan(pJob->pDag); - nodesReleaseAllocatorWeakRef(pJob->allocatorRefId); + (void)nodesReleaseAllocatorWeakRef(pJob->allocatorRefId); // ignore error taosMemoryFreeClear(pJob->userRes.execRes); taosMemoryFreeClear(pJob->fetchRes); taosMemoryFreeClear(pJob->sql); - tsem_destroy(&pJob->rspSem); + (void)tsem_destroy(&pJob->rspSem); // ignore error taosMemoryFree(pJob); int32_t jobNum = atomic_sub_fetch_32(&schMgmt.jobNum, 1); @@ -711,7 +788,7 @@ int32_t schJobFetchRows(SSchJob *pJob) { if (schChkCurrentOp(pJob, SCH_OP_FETCH, true)) { SCH_JOB_DLOG("sync wait for rsp now, job status:%s", SCH_GET_JOB_STATUS_STR(pJob)); - tsem_wait(&pJob->rspSem); + (void)tsem_wait(&pJob->rspSem); // ignore error SCH_RET(schDumpJobFetchRes(pJob, pJob->userRes.fetchRes)); } } else { @@ -739,9 +816,19 @@ int32_t schInitJob(int64_t *pJobId, SSchedulerReq *pReq) { pJob->conn = *pReq->pConn; if (pReq->sql) { pJob->sql = taosStrdup(pReq->sql); + if (NULL == pJob->sql) { + qError("QID:0x%" PRIx64 " strdup sql %s failed", pReq->pDag->queryId, pReq->sql); + SCH_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); + } } pJob->pDag = pReq->pDag; - pJob->allocatorRefId = nodesMakeAllocatorWeakRef(pReq->allocatorRefId); + if (pReq->allocatorRefId > 0) { + pJob->allocatorRefId = nodesMakeAllocatorWeakRef(pReq->allocatorRefId); + if (pJob->allocatorRefId <= 0) { + qError("QID:0x%" PRIx64 " nodesMakeAllocatorWeakRef failed", pReq->pDag->queryId); + SCH_ERR_JRET(terrno); + } + } pJob->chkKillFp = pReq->chkKillFp; pJob->chkKillParam = pReq->chkKillParam; pJob->userRes.execFp = pReq->execFp; @@ -752,6 +839,10 @@ int32_t schInitJob(int64_t *pJobId, SSchedulerReq *pReq) { qDebug("QID:0x%" PRIx64 " input exec nodeList is empty", pReq->pDag->queryId); } else { pJob->nodeList = taosArrayDup(pReq->pNodeList, NULL); + if (NULL == pJob->nodeList) { + qError("QID:0x%" PRIx64 " taosArrayDup failed, origNum:%d", pReq->pDag->queryId, (int32_t)taosArrayGetSize(pReq->pNodeList)); + SCH_ERR_JRET(terrno); + } } pJob->taskList = taosHashInit(pReq->pDag->numOfSubplans, taosGetDefaultHashFunction(TSDB_DATA_TYPE_UBIGINT), false, @@ -785,7 +876,7 @@ int32_t schInitJob(int64_t *pJobId, SSchedulerReq *pReq) { SCH_ERR_JRET(terrno); } - atomic_add_fetch_32(&schMgmt.jobNum, 1); + (void)atomic_add_fetch_32(&schMgmt.jobNum, 1); *pJobId = pJob->refId; @@ -800,7 +891,7 @@ _return: } else if (pJob->refId < 0) { schFreeJobImpl(pJob); } else { - taosRemoveRef(schMgmt.jobRef, pJob->refId); + (void)taosRemoveRef(schMgmt.jobRef, pJob->refId); // ignore error } SCH_RET(code); @@ -814,7 +905,7 @@ int32_t schExecJob(SSchJob *pJob, SSchedulerReq *pReq) { if (pReq->syncReq) { SCH_JOB_DLOG("sync wait for rsp now, job status:%s", SCH_GET_JOB_STATUS_STR(pJob)); - tsem_wait(&pJob->rspSem); + (void)tsem_wait(&pJob->rspSem); // ignore error } SCH_JOB_DLOG("job exec done, job status:%s, jobId:0x%" PRIx64, SCH_GET_JOB_STATUS_STR(pJob), pJob->refId); @@ -845,7 +936,7 @@ int32_t schChkResetJobRetry(SSchJob *pJob, int32_t rspCode) { } SCH_UNLOCK(SCH_WRITE, &pJob->resLock); - schUpdateJobStatus(pJob, JOB_TASK_STATUS_EXEC); + SCH_ERR_RET(schUpdateJobStatus(pJob, JOB_TASK_STATUS_EXEC)); } return TSDB_CODE_SUCCESS; @@ -866,6 +957,10 @@ int32_t schResetJobForRetry(SSchJob *pJob, int32_t rspCode, bool *inRetry) { int32_t numOfLevels = taosArrayGetSize(pJob->levels); for (int32_t i = 0; i < numOfLevels; ++i) { SSchLevel *pLevel = taosArrayGet(pJob->levels, i); + if (NULL == pLevel) { + SCH_JOB_ELOG("fail to get the %dth level, levelNum:%d", i, numOfLevels); + SCH_ERR_RET(TSDB_CODE_SCH_INTERNAL_ERROR); + } pLevel->taskExecDoneNum = 0; pLevel->taskLaunchedNum = 0; @@ -873,6 +968,11 @@ int32_t schResetJobForRetry(SSchJob *pJob, int32_t rspCode, bool *inRetry) { int32_t numOfTasks = taosArrayGetSize(pLevel->subTasks); for (int32_t j = 0; j < numOfTasks; ++j) { SSchTask *pTask = taosArrayGet(pLevel->subTasks, j); + if (NULL == pTask) { + SCH_JOB_ELOG("fail to get the %dth task in level %d, taskNum:%d", j, i, numOfTasks); + SCH_ERR_RET(TSDB_CODE_SCH_INTERNAL_ERROR); + } + SCH_LOCK_TASK(pTask); code = schChkUpdateRedirectCtx(pJob, pTask, NULL, rspCode); if (TSDB_CODE_SUCCESS != code) { @@ -973,7 +1073,7 @@ void schProcessOnOpEnd(SSchJob *pJob, SCH_OP_TYPE type, SSchedulerReq *pReq, int } if (errCode) { - schHandleJobFailure(pJob, errCode); + (void)schHandleJobFailure(pJob, errCode); // handle internal } SCH_JOB_DLOG("job end %s operation with code %s", schGetOpStr(type), tstrerror(errCode)); @@ -1052,11 +1152,11 @@ void schProcessOnCbEnd(SSchJob *pJob, SSchTask *pTask, int32_t errCode) { } if (errCode) { - schHandleJobFailure(pJob, errCode); + (void)schHandleJobFailure(pJob, errCode); // ignore error } if (pJob) { - schReleaseJob(pJob->refId); + (void)schReleaseJob(pJob->refId); // ignore error } } @@ -1091,7 +1191,7 @@ _return: SCH_UNLOCK_TASK(pTask); } if (pJob) { - schReleaseJob(rId); + (void)schReleaseJob(rId); // ignore error } SCH_RET(code); diff --git a/source/libs/scheduler/src/schUtil.c b/source/libs/scheduler/src/schUtil.c index 82b2e021af..689c98d395 100644 --- a/source/libs/scheduler/src/schUtil.c +++ b/source/libs/scheduler/src/schUtil.c @@ -316,18 +316,18 @@ void schFreeRpcCtx(SRpcCtx *pCtx) { } } -int32_t schGetTaskFromList(SHashObj *pTaskList, uint64_t taskId, SSchTask **pTask) { +void schGetTaskFromList(SHashObj *pTaskList, uint64_t taskId, SSchTask **pTask) { + *pTask = NULL; + int32_t s = taosHashGetSize(pTaskList); if (s <= 0) { - return TSDB_CODE_SUCCESS; + return; } SSchTask **task = taosHashGet(pTaskList, &taskId, sizeof(taskId)); if (NULL == task || NULL == (*task)) { - return TSDB_CODE_SUCCESS; + return; } *pTask = *task; - - return TSDB_CODE_SUCCESS; } diff --git a/source/libs/scheduler/src/scheduler.c b/source/libs/scheduler/src/scheduler.c index fc92be8214..8f85e066cd 100644 --- a/source/libs/scheduler/src/scheduler.c +++ b/source/libs/scheduler/src/scheduler.c @@ -108,14 +108,26 @@ int32_t schedulerGetTasksStatus(int64_t jobId, SArray *pSub) { for (int32_t i = pJob->levelNum - 1; i >= 0; --i) { SSchLevel *pLevel = taosArrayGet(pJob->levels, i); + if (NULL == pLevel) { + qError("failed to get level %d", i); + SCH_ERR_JRET(TSDB_CODE_SCH_INTERNAL_ERROR); + } for (int32_t m = 0; m < pLevel->taskNum; ++m) { SSchTask *pTask = taosArrayGet(pLevel->subTasks, m); + if (NULL == pTask) { + qError("failed to get task %d, total: %d", m, pLevel->taskNum); + SCH_ERR_JRET(TSDB_CODE_SCH_INTERNAL_ERROR); + } + SQuerySubDesc subDesc = {0}; subDesc.tid = pTask->taskId; - strcpy(subDesc.status, jobTaskStatusStr(pTask->status)); + TAOS_STRCPY(subDesc.status, jobTaskStatusStr(pTask->status)); - taosArrayPush(pSub, &subDesc); + if (NULL == taosArrayPush(pSub, &subDesc)) { + qError("taosArrayPush task %d failed, error: %x, ", m, terrno); + SCH_ERR_JRET(terrno); + } } } @@ -141,7 +153,7 @@ int32_t schedulerUpdatePolicy(int32_t policy) { qDebug("schedule policy updated to %d", schMgmt.cfg.schPolicy); break; default: - return TSDB_CODE_TSC_INVALID_INPUT; + SCH_RET(TSDB_CODE_TSC_INVALID_INPUT); } return TSDB_CODE_SUCCESS; @@ -159,14 +171,14 @@ void schedulerFreeJob(int64_t *jobId, int32_t errCode) { SSchJob *pJob = schAcquireJob(*jobId); if (NULL == pJob) { - qDebug("Acquire sch job failed, may be dropped, jobId:0x%" PRIx64, *jobId); + qWarn("Acquire sch job failed, may be dropped, jobId:0x%" PRIx64, *jobId); return; } SCH_JOB_DLOG("start to free job 0x%" PRIx64 ", code:%s", *jobId, tstrerror(errCode)); - schHandleJobDrop(pJob, errCode); + (void)schHandleJobDrop(pJob, errCode); // ignore any error - schReleaseJob(*jobId); + (void)schReleaseJob(*jobId); // ignore error *jobId = 0; } @@ -182,7 +194,7 @@ void schedulerDestroy(void) { if (refId == 0) { break; } - taosRemoveRef(schMgmt.jobRef, pJob->refId); + (void)taosRemoveRef(schMgmt.jobRef, pJob->refId); // ignore error pJob = taosIterateRef(schMgmt.jobRef, refId); } diff --git a/source/libs/stream/src/streamCheckStatus.c b/source/libs/stream/src/streamCheckStatus.c index 226a06be7e..3ea3e814ed 100644 --- a/source/libs/stream/src/streamCheckStatus.c +++ b/source/libs/stream/src/streamCheckStatus.c @@ -308,7 +308,9 @@ int32_t streamTaskStopMonitorCheckRsp(STaskCheckInfo* pInfo, const char* id) { void streamTaskCleanupCheckInfo(STaskCheckInfo* pInfo) { ASSERT(pInfo->inCheckProcess == 0); - pInfo->pList = taosArrayDestroy(pInfo->pList); + taosArrayDestroy(pInfo->pList); + pInfo->pList = NULL; + if (pInfo->checkRspTmr != NULL) { /*bool ret = */ taosTmrStop(pInfo->checkRspTmr); pInfo->checkRspTmr = NULL; diff --git a/source/libs/stream/src/streamMsg.c b/source/libs/stream/src/streamMsg.c index 40582b5144..1cc48f02b6 100644 --- a/source/libs/stream/src/streamMsg.c +++ b/source/libs/stream/src/streamMsg.c @@ -438,11 +438,13 @@ void tCleanupStreamHbMsg(SStreamHbMsg* pMsg) { } if (pMsg->pUpdateNodes != NULL) { - pMsg->pUpdateNodes = taosArrayDestroy(pMsg->pUpdateNodes); + taosArrayDestroy(pMsg->pUpdateNodes); + pMsg->pUpdateNodes = NULL; } if (pMsg->pTaskStatus != NULL) { - pMsg->pTaskStatus = taosArrayDestroy(pMsg->pTaskStatus); + taosArrayDestroy(pMsg->pTaskStatus); + pMsg->pTaskStatus = NULL; } pMsg->msgId = -1; diff --git a/source/libs/stream/src/streamTask.c b/source/libs/stream/src/streamTask.c index 9bcad87264..4cbe0cb136 100644 --- a/source/libs/stream/src/streamTask.c +++ b/source/libs/stream/src/streamTask.c @@ -280,10 +280,12 @@ void tFreeStreamTask(SStreamTask* pTask) { taosMemoryFree(pTask->outputInfo.pTokenBucket); taosThreadMutexDestroy(&pTask->lock); - pTask->msgInfo.pSendInfo = taosArrayDestroy(pTask->msgInfo.pSendInfo); + taosArrayDestroy(pTask->msgInfo.pSendInfo); + pTask->msgInfo.pSendInfo = NULL; taosThreadMutexDestroy(&pTask->msgInfo.lock); - pTask->outputInfo.pNodeEpsetUpdateList = taosArrayDestroy(pTask->outputInfo.pNodeEpsetUpdateList); + taosArrayDestroy(pTask->outputInfo.pNodeEpsetUpdateList); + pTask->outputInfo.pNodeEpsetUpdateList = NULL; if ((pTask->status.removeBackendFiles) && (pTask->pMeta != NULL)) { char* path = taosMemoryCalloc(1, strlen(pTask->pMeta->path) + 128); @@ -1055,9 +1057,12 @@ void streamTaskDestroyActiveChkptInfo(SActiveCheckpointInfo* pInfo) { } taosThreadMutexDestroy(&pInfo->lock); - pInfo->pDispatchTriggerList = taosArrayDestroy(pInfo->pDispatchTriggerList); - pInfo->pReadyMsgList = taosArrayDestroy(pInfo->pReadyMsgList); - pInfo->pCheckpointReadyRecvList = taosArrayDestroy(pInfo->pCheckpointReadyRecvList); + taosArrayDestroy(pInfo->pDispatchTriggerList); + pInfo->pDispatchTriggerList = NULL; + taosArrayDestroy(pInfo->pReadyMsgList); + pInfo->pReadyMsgList = NULL; + taosArrayDestroy(pInfo->pCheckpointReadyRecvList); + pInfo->pCheckpointReadyRecvList = NULL; if (pInfo->pChkptTriggerTmr != NULL) { taosTmrStop(pInfo->pChkptTriggerTmr); diff --git a/source/libs/stream/src/streamUpdate.c b/source/libs/stream/src/streamUpdate.c index 0adb7050c6..61b7e02a4c 100644 --- a/source/libs/stream/src/streamUpdate.c +++ b/source/libs/stream/src/streamUpdate.c @@ -18,6 +18,7 @@ #include "tencode.h" #include "tstreamUpdate.h" #include "ttime.h" +#include "tutil.h" #define DEFAULT_FALSE_POSITIVE 0.01 #define DEFAULT_BUCKET_SIZE 131072 @@ -34,7 +35,8 @@ static int64_t adjustExpEntries(int64_t entries) { return TMIN(DEFAULT_EXPECTED_ENTRIES, entries); } int compareKeyTs(void* pTs1, void* pTs2, void* pPkVal, __compar_fn_t cmpPkFn) { - return compareInt64Val(pTs1, pTs2);; + return compareInt64Val(pTs1, pTs2); + ; } int compareKeyTsAndPk(void* pValue1, void* pTs, void* pPkVal, __compar_fn_t cmpPkFn) { @@ -49,7 +51,7 @@ int compareKeyTsAndPk(void* pValue1, void* pTs, void* pPkVal, __compar_fn_t cmpP int32_t getKeyBuff(TSKEY ts, int64_t tbUid, void* pVal, int32_t len, char* buff) { *(TSKEY*)buff = ts; - memcpy(buff+ sizeof(TSKEY), &tbUid, sizeof(int64_t)); + memcpy(buff + sizeof(TSKEY), &tbUid, sizeof(int64_t)); if (len == 0) { return sizeof(TSKEY) + sizeof(int64_t); } @@ -66,26 +68,40 @@ int32_t getValueBuff(TSKEY ts, char* pVal, int32_t len, char* buff) { return sizeof(TSKEY) + len; } -void windowSBfAdd(SUpdateInfo *pInfo, uint64_t count) { +int32_t windowSBfAdd(SUpdateInfo* pInfo, uint64_t count) { + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; if (pInfo->numSBFs < count) { count = pInfo->numSBFs; } for (uint64_t i = 0; i < count; ++i) { int64_t rows = adjustExpEntries(pInfo->interval * ROWS_PER_MILLISECOND); - SScalableBf *tsSBF = tScalableBfInit(rows, DEFAULT_FALSE_POSITIVE); - taosArrayPush(pInfo->pTsSBFs, &tsSBF); + SScalableBf* tsSBF = NULL; + code = tScalableBfInit(rows, DEFAULT_FALSE_POSITIVE, &tsSBF); + TSDB_CHECK_CODE(code, lino, _error); + void* res = taosArrayPush(pInfo->pTsSBFs, &tsSBF); + if (!res) { + code = TSDB_CODE_OUT_OF_MEMORY; + TSDB_CHECK_CODE(code, lino, _error); + } } + +_error: + if (code != TSDB_CODE_SUCCESS) { + uError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } + return code; } -static void clearItemHelper(void *p) { - SScalableBf **pBf = p; +static void clearItemHelper(void* p) { + SScalableBf** pBf = p; tScalableBfDestroy(*pBf); } -void windowSBfDelete(SUpdateInfo *pInfo, uint64_t count) { +void windowSBfDelete(SUpdateInfo* pInfo, uint64_t count) { if (count < pInfo->numSBFs) { for (uint64_t i = 0; i < count; ++i) { - SScalableBf *pTsSBFs = taosArrayGetP(pInfo->pTsSBFs, 0); + SScalableBf* pTsSBFs = taosArrayGetP(pInfo->pTsSBFs, 0); tScalableBfDestroy(pTsSBFs); taosArrayRemove(pInfo->pTsSBFs, 0); } @@ -124,14 +140,19 @@ static int64_t adjustWatermark(int64_t adjInterval, int64_t originInt, int64_t w return watermark; } -SUpdateInfo *updateInfoInitP(SInterval *pInterval, int64_t watermark, bool igUp, int8_t pkType, int32_t pkLen) { - return updateInfoInit(pInterval->interval, pInterval->precision, watermark, igUp, pkType, pkLen); +int32_t updateInfoInitP(SInterval* pInterval, int64_t watermark, bool igUp, int8_t pkType, int32_t pkLen, + SUpdateInfo** ppInfo) { + return updateInfoInit(pInterval->interval, pInterval->precision, watermark, igUp, pkType, pkLen, ppInfo); } -SUpdateInfo *updateInfoInit(int64_t interval, int32_t precision, int64_t watermark, bool igUp, int8_t pkType, int32_t pkLen) { - SUpdateInfo *pInfo = taosMemoryCalloc(1, sizeof(SUpdateInfo)); +int32_t updateInfoInit(int64_t interval, int32_t precision, int64_t watermark, bool igUp, int8_t pkType, int32_t pkLen, + SUpdateInfo** ppInfo) { + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; + SUpdateInfo* pInfo = taosMemoryCalloc(1, sizeof(SUpdateInfo)); if (pInfo == NULL) { - return NULL; + code = TSDB_CODE_OUT_OF_MEMORY; + TSDB_CHECK_CODE(code, lino, _end); } pInfo->pTsBuckets = NULL; pInfo->pTsSBFs = NULL; @@ -145,17 +166,19 @@ SUpdateInfo *updateInfoInit(int64_t interval, int32_t precision, int64_t waterma bfSize = (uint64_t)(pInfo->watermark / pInfo->interval); pInfo->numSBFs = bfSize; - pInfo->pTsSBFs = taosArrayInit(bfSize, sizeof(void *)); + pInfo->pTsSBFs = taosArrayInit(bfSize, sizeof(void*)); if (pInfo->pTsSBFs == NULL) { updateInfoDestroy(pInfo); - return NULL; + code = TSDB_CODE_OUT_OF_MEMORY; + TSDB_CHECK_CODE(code, lino, _end); } windowSBfAdd(pInfo, bfSize); pInfo->pTsBuckets = taosArrayInit(DEFAULT_BUCKET_SIZE, sizeof(TSKEY)); if (pInfo->pTsBuckets == NULL) { updateInfoDestroy(pInfo); - return NULL; + code = TSDB_CODE_OUT_OF_MEMORY; + TSDB_CHECK_CODE(code, lino, _end); } TSKEY dumy = 0; @@ -167,31 +190,54 @@ SUpdateInfo *updateInfoInit(int64_t interval, int32_t precision, int64_t waterma } _hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_UBIGINT); pInfo->pMap = taosHashInit(DEFAULT_MAP_CAPACITY, hashFn, true, HASH_NO_LOCK); + if (!pInfo->pMap) { + code = TSDB_CODE_OUT_OF_MEMORY; + TSDB_CHECK_CODE(code, lino, _end); + } pInfo->maxDataVersion = 0; pInfo->pkColLen = pkLen; pInfo->pkColType = pkType; pInfo->pKeyBuff = taosMemoryCalloc(1, sizeof(TSKEY) + sizeof(int64_t) + pkLen); + if (!pInfo->pKeyBuff) { + code = TSDB_CODE_OUT_OF_MEMORY; + TSDB_CHECK_CODE(code, lino, _end); + } pInfo->pValueBuff = taosMemoryCalloc(1, sizeof(TSKEY) + pkLen); + if (!pInfo->pValueBuff) { + code = TSDB_CODE_OUT_OF_MEMORY; + TSDB_CHECK_CODE(code, lino, _end); + } if (pkLen != 0) { pInfo->comparePkRowFn = compareKeyTsAndPk; - pInfo->comparePkCol = getKeyComparFunc(pkType, TSDB_ORDER_ASC);; + pInfo->comparePkCol = getKeyComparFunc(pkType, TSDB_ORDER_ASC); + ; } else { pInfo->comparePkRowFn = compareKeyTs; pInfo->comparePkCol = NULL; } - return pInfo; + (*ppInfo) = pInfo; + +_end: + if (code != TSDB_CODE_SUCCESS) { + uError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } + return code; } -static SScalableBf *getSBf(SUpdateInfo *pInfo, TSKEY ts) { +static int32_t getSBf(SUpdateInfo* pInfo, TSKEY ts, SScalableBf** ppSBf) { + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; if (ts <= 0) { - return NULL; + code = TSDB_CODE_FAILED; + TSDB_CHECK_CODE(code, lino, _end); } if (pInfo->minTS < 0) { pInfo->minTS = (TSKEY)(ts / pInfo->interval * pInfo->interval); } int64_t index = (int64_t)((ts - pInfo->minTS) / pInfo->interval); if (index < 0) { - return NULL; + code = TSDB_CODE_FAILED; + TSDB_CHECK_CODE(code, lino, _end); } if (index >= pInfo->numSBFs) { uint64_t count = index + 1 - pInfo->numSBFs; @@ -199,22 +245,31 @@ static SScalableBf *getSBf(SUpdateInfo *pInfo, TSKEY ts) { windowSBfAdd(pInfo, count); index = pInfo->numSBFs - 1; } - SScalableBf *res = taosArrayGetP(pInfo->pTsSBFs, index); + SScalableBf* res = taosArrayGetP(pInfo->pTsSBFs, index); if (res == NULL) { int64_t rows = adjustExpEntries(pInfo->interval * ROWS_PER_MILLISECOND); - res = tScalableBfInit(rows, DEFAULT_FALSE_POSITIVE); + code = tScalableBfInit(rows, DEFAULT_FALSE_POSITIVE, &res); + TSDB_CHECK_CODE(code, lino, _end); + taosArrayPush(pInfo->pTsSBFs, &res); } - return res; + (*ppSBf) = res; + +_end: + if (code != TSDB_CODE_SUCCESS) { + uError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } + return code; } -bool updateInfoIsTableInserted(SUpdateInfo *pInfo, int64_t tbUid) { - void *pVal = taosHashGet(pInfo->pMap, &tbUid, sizeof(int64_t)); +bool updateInfoIsTableInserted(SUpdateInfo* pInfo, int64_t tbUid) { + void* pVal = taosHashGet(pInfo->pMap, &tbUid, sizeof(int64_t)); if (pVal || taosHashGetSize(pInfo->pMap) >= DEFAULT_MAP_SIZE) return true; return false; } -TSKEY updateInfoFillBlockData(SUpdateInfo *pInfo, SSDataBlock *pBlock, int32_t primaryTsCol, int32_t primaryKeyCol) { +TSKEY updateInfoFillBlockData(SUpdateInfo* pInfo, SSDataBlock* pBlock, int32_t primaryTsCol, int32_t primaryKeyCol) { + int32_t code = TSDB_CODE_SUCCESS; if (pBlock == NULL || pBlock->info.rows == 0) return INT64_MIN; TSKEY maxTs = INT64_MIN; void* pPkVal = NULL; @@ -223,14 +278,14 @@ TSKEY updateInfoFillBlockData(SUpdateInfo *pInfo, SSDataBlock *pBlock, int32_t p int32_t len = 0; int64_t tbUid = pBlock->info.id.uid; - SColumnInfoData *pColDataInfo = taosArrayGet(pBlock->pDataBlock, primaryTsCol); - SColumnInfoData *pPkDataInfo = NULL; + SColumnInfoData* pColDataInfo = taosArrayGet(pBlock->pDataBlock, primaryTsCol); + SColumnInfoData* pPkDataInfo = NULL; if (primaryKeyCol >= 0) { pPkDataInfo = taosArrayGet(pBlock->pDataBlock, primaryKeyCol); } for (int32_t i = 0; i < pBlock->info.rows; i++) { - TSKEY ts = ((TSKEY *)pColDataInfo->pData)[i]; + TSKEY ts = ((TSKEY*)pColDataInfo->pData)[i]; if (maxTs < ts) { maxTs = ts; if (primaryKeyCol >= 0) { @@ -238,17 +293,22 @@ TSKEY updateInfoFillBlockData(SUpdateInfo *pInfo, SSDataBlock *pBlock, int32_t p maxLen = colDataGetRowLength(pPkDataInfo, i); } } - SScalableBf *pSBf = getSBf(pInfo, ts); + SScalableBf* pSBf = NULL; + int32_t code = getSBf(pInfo, ts, &pSBf); + if (code != TSDB_CODE_SUCCESS) { + uWarn("%s failed at line %d since %s", __func__, __LINE__, tstrerror(code)); + } if (pSBf) { if (primaryKeyCol >= 0) { pPkVal = colDataGetData(pPkDataInfo, i); len = colDataGetRowLength(pPkDataInfo, i); } int32_t buffLen = getKeyBuff(ts, tbUid, pPkVal, len, pInfo->pKeyBuff); + // we don't care whether the data is updated or not tScalableBfPut(pSBf, pInfo->pKeyBuff, buffLen); } } - void *pMaxTs = taosHashGet(pInfo->pMap, &tbUid, sizeof(int64_t)); + void* pMaxTs = taosHashGet(pInfo->pMap, &tbUid, sizeof(int64_t)); if (pMaxTs == NULL || pInfo->comparePkRowFn(pMaxTs, &maxTs, pMaxPkVal, pInfo->comparePkCol) == -1) { int32_t valueLen = getValueBuff(maxTs, pMaxPkVal, maxLen, pInfo->pValueBuff); taosHashPut(pInfo->pMap, &tbUid, sizeof(int64_t), pInfo->pValueBuff, valueLen); @@ -256,14 +316,14 @@ TSKEY updateInfoFillBlockData(SUpdateInfo *pInfo, SSDataBlock *pBlock, int32_t p return maxTs; } -bool updateInfoIsUpdated(SUpdateInfo *pInfo, uint64_t tableId, TSKEY ts, void* pPkVal, int32_t len) { +bool updateInfoIsUpdated(SUpdateInfo* pInfo, uint64_t tableId, TSKEY ts, void* pPkVal, int32_t len) { int32_t res = TSDB_CODE_FAILED; int32_t buffLen = 0; buffLen = getKeyBuff(ts, tableId, pPkVal, len, pInfo->pKeyBuff); - void* *pMapMaxTs = taosHashGet(pInfo->pMap, &tableId, sizeof(uint64_t)); + void** pMapMaxTs = taosHashGet(pInfo->pMap, &tableId, sizeof(uint64_t)); uint64_t index = ((uint64_t)tableId) % pInfo->numBuckets; - TSKEY maxTs = *(TSKEY *)taosArrayGet(pInfo->pTsBuckets, index); + TSKEY maxTs = *(TSKEY*)taosArrayGet(pInfo->pTsBuckets, index); if (ts < maxTs - pInfo->watermark) { // this window has been closed. if (pInfo->pCloseWinSBF) { @@ -277,10 +337,15 @@ bool updateInfoIsUpdated(SUpdateInfo *pInfo, uint64_t tableId, TSKEY ts, void* p return true; } - SScalableBf *pSBf = getSBf(pInfo, ts); + SScalableBf* pSBf = NULL; + int32_t code = getSBf(pInfo, ts, &pSBf); + if (code != TSDB_CODE_SUCCESS) { + uWarn("%s failed at line %d since %s", __func__, __LINE__, tstrerror(code)); + } int32_t size = taosHashGetSize(pInfo->pMap); - if ((!pMapMaxTs && size < DEFAULT_MAP_SIZE) || (pMapMaxTs && pInfo->comparePkRowFn(pMapMaxTs, &ts, pPkVal, pInfo->comparePkCol) == -1 )) { + if ((!pMapMaxTs && size < DEFAULT_MAP_SIZE) || + (pMapMaxTs && pInfo->comparePkRowFn(pMapMaxTs, &ts, pPkVal, pInfo->comparePkCol) == -1)) { int32_t valueLen = getValueBuff(ts, pPkVal, len, pInfo->pValueBuff); taosHashPut(pInfo->pMap, &tableId, sizeof(uint64_t), pInfo->pValueBuff, valueLen); // pSBf may be a null pointer @@ -309,7 +374,7 @@ bool updateInfoIsUpdated(SUpdateInfo *pInfo, uint64_t tableId, TSKEY ts, void* p return true; } -void updateInfoDestroy(SUpdateInfo *pInfo) { +void updateInfoDestroy(SUpdateInfo* pInfo) { if (pInfo == NULL) { return; } @@ -317,7 +382,7 @@ void updateInfoDestroy(SUpdateInfo *pInfo) { uint64_t size = taosArrayGetSize(pInfo->pTsSBFs); for (uint64_t i = 0; i < size; i++) { - SScalableBf *pSBF = taosArrayGetP(pInfo->pTsSBFs, i); + SScalableBf* pSBF = taosArrayGetP(pInfo->pTsSBFs, i); tScalableBfDestroy(pSBF); } @@ -329,15 +394,19 @@ void updateInfoDestroy(SUpdateInfo *pInfo) { taosMemoryFree(pInfo); } -void updateInfoAddCloseWindowSBF(SUpdateInfo *pInfo) { +void updateInfoAddCloseWindowSBF(SUpdateInfo* pInfo) { if (pInfo->pCloseWinSBF) { return; } int64_t rows = adjustExpEntries(pInfo->interval * ROWS_PER_MILLISECOND); - pInfo->pCloseWinSBF = tScalableBfInit(rows, DEFAULT_FALSE_POSITIVE); + int32_t code = tScalableBfInit(rows, DEFAULT_FALSE_POSITIVE, &pInfo->pCloseWinSBF); + if (code != TSDB_CODE_SUCCESS) { + pInfo->pCloseWinSBF = NULL; + uError("%s failed to add close window SBF since %s", __func__, tstrerror(code)); + } } -void updateInfoDestoryColseWinSBF(SUpdateInfo *pInfo) { +void updateInfoDestoryColseWinSBF(SUpdateInfo* pInfo) { if (!pInfo || !pInfo->pCloseWinSBF) { return; } @@ -345,62 +414,124 @@ void updateInfoDestoryColseWinSBF(SUpdateInfo *pInfo) { pInfo->pCloseWinSBF = NULL; } -int32_t updateInfoSerialize(void *buf, int32_t bufLen, const SUpdateInfo *pInfo) { +int32_t updateInfoSerialize(void* buf, int32_t bufLen, const SUpdateInfo* pInfo, int32_t* pLen) { + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; if (!pInfo) { - return 0; + return TSDB_CODE_SUCCESS; } SEncoder encoder = {0}; tEncoderInit(&encoder, buf, bufLen); - if (tStartEncode(&encoder) < 0) return -1; + if (tStartEncode(&encoder) < 0) { + code = TSDB_CODE_FAILED; + TSDB_CHECK_CODE(code, lino, _end); + } int32_t size = taosArrayGetSize(pInfo->pTsBuckets); - if (tEncodeI32(&encoder, size) < 0) return -1; - for (int32_t i = 0; i < size; i++) { - TSKEY *pTs = (TSKEY *)taosArrayGet(pInfo->pTsBuckets, i); - if (tEncodeI64(&encoder, *pTs) < 0) return -1; + if (tEncodeI32(&encoder, size) < 0) { + code = TSDB_CODE_FAILED; + TSDB_CHECK_CODE(code, lino, _end); } - if (tEncodeU64(&encoder, pInfo->numBuckets) < 0) return -1; + for (int32_t i = 0; i < size; i++) { + TSKEY* pTs = (TSKEY*)taosArrayGet(pInfo->pTsBuckets, i); + if (tEncodeI64(&encoder, *pTs) < 0) { + code = TSDB_CODE_FAILED; + TSDB_CHECK_CODE(code, lino, _end); + } + } + + if (tEncodeU64(&encoder, pInfo->numBuckets) < 0) { + code = TSDB_CODE_FAILED; + TSDB_CHECK_CODE(code, lino, _end); + } int32_t sBfSize = taosArrayGetSize(pInfo->pTsSBFs); - if (tEncodeI32(&encoder, sBfSize) < 0) return -1; + if (tEncodeI32(&encoder, sBfSize) < 0) { + code = TSDB_CODE_FAILED; + TSDB_CHECK_CODE(code, lino, _end); + } for (int32_t i = 0; i < sBfSize; i++) { - SScalableBf *pSBf = taosArrayGetP(pInfo->pTsSBFs, i); - if (tScalableBfEncode(pSBf, &encoder) < 0) return -1; + SScalableBf* pSBf = taosArrayGetP(pInfo->pTsSBFs, i); + if (tScalableBfEncode(pSBf, &encoder) < 0) { + code = TSDB_CODE_FAILED; + TSDB_CHECK_CODE(code, lino, _end); + } } - if (tEncodeU64(&encoder, pInfo->numSBFs) < 0) return -1; - if (tEncodeI64(&encoder, pInfo->interval) < 0) return -1; - if (tEncodeI64(&encoder, pInfo->watermark) < 0) return -1; - if (tEncodeI64(&encoder, pInfo->minTS) < 0) return -1; + if (tEncodeU64(&encoder, pInfo->numSBFs) < 0) { + code = TSDB_CODE_FAILED; + TSDB_CHECK_CODE(code, lino, _end); + } + if (tEncodeI64(&encoder, pInfo->interval) < 0) { + code = TSDB_CODE_FAILED; + TSDB_CHECK_CODE(code, lino, _end); + } + if (tEncodeI64(&encoder, pInfo->watermark) < 0) { + code = TSDB_CODE_FAILED; + TSDB_CHECK_CODE(code, lino, _end); + } + if (tEncodeI64(&encoder, pInfo->minTS) < 0) { + code = TSDB_CODE_FAILED; + TSDB_CHECK_CODE(code, lino, _end); + } - if (tScalableBfEncode(pInfo->pCloseWinSBF, &encoder) < 0) return -1; + if (tScalableBfEncode(pInfo->pCloseWinSBF, &encoder) < 0) { + code = TSDB_CODE_FAILED; + TSDB_CHECK_CODE(code, lino, _end); + } int32_t mapSize = taosHashGetSize(pInfo->pMap); - if (tEncodeI32(&encoder, mapSize) < 0) return -1; - void *pIte = NULL; + if (tEncodeI32(&encoder, mapSize) < 0) { + code = TSDB_CODE_FAILED; + TSDB_CHECK_CODE(code, lino, _end); + } + void* pIte = NULL; size_t keyLen = 0; while ((pIte = taosHashIterate(pInfo->pMap, pIte)) != NULL) { - void *key = taosHashGetKey(pIte, &keyLen); - if (tEncodeU64(&encoder, *(uint64_t *)key) < 0) return -1; + void* key = taosHashGetKey(pIte, &keyLen); + if (tEncodeU64(&encoder, *(uint64_t*)key) < 0) { + code = TSDB_CODE_FAILED; + TSDB_CHECK_CODE(code, lino, _end); + } int32_t valueSize = taosHashGetValueSize(pIte); - if (tEncodeBinary(&encoder, (const uint8_t *)pIte, valueSize) < 0) return -1; + if (tEncodeBinary(&encoder, (const uint8_t*)pIte, valueSize) < 0) { + code = TSDB_CODE_FAILED; + TSDB_CHECK_CODE(code, lino, _end); + } } - if (tEncodeU64(&encoder, pInfo->maxDataVersion) < 0) return -1; + if (tEncodeU64(&encoder, pInfo->maxDataVersion) < 0) { + code = TSDB_CODE_FAILED; + TSDB_CHECK_CODE(code, lino, _end); + } - if (tEncodeI32(&encoder, pInfo->pkColLen) < 0) return -1; - if (tEncodeI8(&encoder, pInfo->pkColType) < 0) return -1; + if (tEncodeI32(&encoder, pInfo->pkColLen) < 0) { + code = TSDB_CODE_FAILED; + TSDB_CHECK_CODE(code, lino, _end); + } + if (tEncodeI8(&encoder, pInfo->pkColType) < 0) { + code = TSDB_CODE_FAILED; + TSDB_CHECK_CODE(code, lino, _end); + } tEndEncode(&encoder); int32_t tlen = encoder.pos; tEncoderClear(&encoder); - return tlen; + *pLen = tlen; + +_end: + if (code != TSDB_CODE_SUCCESS) { + uError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } + return code; } -int32_t updateInfoDeserialize(void *buf, int32_t bufLen, SUpdateInfo *pInfo) { +int32_t updateInfoDeserialize(void* buf, int32_t bufLen, SUpdateInfo* pInfo) { + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; ASSERT(pInfo); SDecoder decoder = {0}; tDecoderInit(&decoder, buf, bufLen); @@ -419,10 +550,12 @@ int32_t updateInfoDeserialize(void *buf, int32_t bufLen, SUpdateInfo *pInfo) { int32_t sBfSize = 0; if (tDecodeI32(&decoder, &sBfSize) < 0) return -1; - pInfo->pTsSBFs = taosArrayInit(sBfSize, sizeof(void *)); + pInfo->pTsSBFs = taosArrayInit(sBfSize, sizeof(void*)); for (int32_t i = 0; i < sBfSize; i++) { - SScalableBf *pSBf = tScalableBfDecode(&decoder); - if (!pSBf) return -1; + SScalableBf* pSBf = NULL; + code = tScalableBfDecode(&decoder, &pSBf); + TSDB_CHECK_CODE(code, lino, _error); + taosArrayPush(pInfo->pTsSBFs, &pSBf); } @@ -430,15 +563,20 @@ int32_t updateInfoDeserialize(void *buf, int32_t bufLen, SUpdateInfo *pInfo) { if (tDecodeI64(&decoder, &pInfo->interval) < 0) return -1; if (tDecodeI64(&decoder, &pInfo->watermark) < 0) return -1; if (tDecodeI64(&decoder, &pInfo->minTS) < 0) return -1; - pInfo->pCloseWinSBF = tScalableBfDecode(&decoder); + + code = tScalableBfDecode(&decoder, &pInfo->pCloseWinSBF); + if (code != TSDB_CODE_SUCCESS) { + pInfo->pCloseWinSBF = NULL; + code = TSDB_CODE_SUCCESS; + } int32_t mapSize = 0; if (tDecodeI32(&decoder, &mapSize) < 0) return -1; _hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_UBIGINT); pInfo->pMap = taosHashInit(mapSize, hashFn, true, HASH_NO_LOCK); uint64_t uid = 0; - void* pVal = NULL; - int32_t valSize = 0; + void* pVal = NULL; + int32_t valSize = 0; for (int32_t i = 0; i < mapSize; i++) { if (tDecodeU64(&decoder, &uid) < 0) return -1; if (tDecodeBinary(&decoder, (uint8_t**)&pVal, &valSize) < 0) return -1; @@ -454,7 +592,8 @@ int32_t updateInfoDeserialize(void *buf, int32_t bufLen, SUpdateInfo *pInfo) { pInfo->pValueBuff = taosMemoryCalloc(1, sizeof(TSKEY) + pInfo->pkColLen); if (pInfo->pkColLen != 0) { pInfo->comparePkRowFn = compareKeyTsAndPk; - pInfo->comparePkCol = getKeyComparFunc(pInfo->pkColType, TSDB_ORDER_ASC);; + pInfo->comparePkCol = getKeyComparFunc(pInfo->pkColType, TSDB_ORDER_ASC); + ; } else { pInfo->comparePkRowFn = compareKeyTs; pInfo->comparePkCol = NULL; @@ -463,11 +602,16 @@ int32_t updateInfoDeserialize(void *buf, int32_t bufLen, SUpdateInfo *pInfo) { tEndDecode(&decoder); tDecoderClear(&decoder); - return 0; + +_error: + if (code != TSDB_CODE_SUCCESS) { + uError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } + return code; } -bool isIncrementalTimeStamp(SUpdateInfo *pInfo, uint64_t tableId, TSKEY ts, void* pPkVal, int32_t len) { - TSKEY *pMapMaxTs = taosHashGet(pInfo->pMap, &tableId, sizeof(uint64_t)); +bool isIncrementalTimeStamp(SUpdateInfo* pInfo, uint64_t tableId, TSKEY ts, void* pPkVal, int32_t len) { + TSKEY* pMapMaxTs = taosHashGet(pInfo->pMap, &tableId, sizeof(uint64_t)); bool res = true; if (pMapMaxTs && pInfo->comparePkRowFn(pMapMaxTs, &ts, pPkVal, pInfo->comparePkCol) == 1) { res = false; diff --git a/source/libs/sync/inc/syncInt.h b/source/libs/sync/inc/syncInt.h index 3d8588a55a..009854b45b 100644 --- a/source/libs/sync/inc/syncInt.h +++ b/source/libs/sync/inc/syncInt.h @@ -74,16 +74,16 @@ typedef struct SRaftStore { TdThreadMutex mutex; } SRaftStore; -typedef struct SSyncHbTimerData { +struct SSyncHbTimerData { int64_t syncNodeRid; SSyncTimer* pTimer; SRaftId destId; uint64_t logicClock; int64_t execTime; int64_t rid; -} SSyncHbTimerData; +}; -typedef struct SSyncTimer { +struct SSyncTimer { void* pTimer; TAOS_TMR_CALLBACK timerCb; uint64_t logicClock; @@ -92,7 +92,7 @@ typedef struct SSyncTimer { int64_t timeStamp; SRaftId destId; int64_t hbDataRid; -} SSyncTimer; +}; typedef struct SElectTimerParam { uint64_t logicClock; @@ -106,7 +106,7 @@ typedef struct SPeerState { int64_t lastSendTime; } SPeerState; -typedef struct SSyncNode { +struct SSyncNode { // init by SSyncInfo SyncGroupId vgId; SRaftCfg raftCfg; @@ -116,7 +116,7 @@ typedef struct SSyncNode { // sync io SSyncLogBuffer* pLogBuf; - SWal* pWal; + struct SWal* pWal; const SMsgCb* msgcb; int32_t (*syncSendMSg)(const SEpSet* pEpSet, SRpcMsg* pMsg); int32_t (*syncEqMsg)(const SMsgCb* msgcb, SRpcMsg* pMsg); @@ -234,7 +234,7 @@ typedef struct SSyncNode { bool isStart; -} SSyncNode; +}; // open/close -------------- SSyncNode* syncNodeOpen(SSyncInfo* pSyncInfo, int32_t vnodeVersion); diff --git a/source/libs/transport/inc/transComm.h b/source/libs/transport/inc/transComm.h index e62ca7d69a..acb9bd20f3 100644 --- a/source/libs/transport/inc/transComm.h +++ b/source/libs/transport/inc/transComm.h @@ -103,7 +103,7 @@ typedef void* queue[2]; #define TRANS_MAGIC_NUM 0x5f375a86 #define TRANS_NOVALID_PACKET(src) ((src) != TRANS_MAGIC_NUM ? 1 : 0) -typedef SRpcMsg STransMsg; +typedef struct SRpcMsg STransMsg; typedef SRpcCtx STransCtx; typedef SRpcCtxVal STransCtxVal; typedef SRpcInfo STrans; diff --git a/source/libs/transport/src/thttp.c b/source/libs/transport/src/thttp.c index c4ca39c323..ba12774c18 100644 --- a/source/libs/transport/src/thttp.c +++ b/source/libs/transport/src/thttp.c @@ -19,7 +19,6 @@ #include "zlib.h" #include "thttp.h" #include "taoserror.h" -#include "tlog.h" #include "transComm.h" // clang-format on @@ -27,14 +26,18 @@ #define HTTP_RECV_BUF_SIZE 1024 static int32_t httpRefMgt = 0; -static int64_t httpRef = -1; static int32_t FAST_FAILURE_LIMIT = 1; + +static int64_t httpDefaultChanId = -1; + typedef struct SHttpModule { uv_loop_t* loop; SAsyncPool* asyncPool; TdThread thread; SHashObj* connStatusTable; + SHashObj* connPool; int8_t quit; + int16_t connNum; } SHttpModule; typedef struct SHttpMsg { @@ -46,7 +49,7 @@ typedef struct SHttpMsg { int32_t len; EHttpCompFlag flag; int8_t quit; - + int64_t chanId; } SHttpMsg; typedef struct SHttpClient { @@ -58,50 +61,73 @@ typedef struct SHttpClient { char* addr; uint16_t port; struct sockaddr_in dest; + int64_t chanId; } SHttpClient; +typedef struct SHttpConnList { + queue q; + +} SHttpConnList; + static TdThreadOnce transHttpInit = PTHREAD_ONCE_INIT; static void transHttpEnvInit(); static void httpHandleReq(SHttpMsg* msg); static void httpHandleQuit(SHttpMsg* msg); -static int32_t httpSendQuit(); +static int32_t httpSendQuit(SHttpModule* http, int64_t chanId); + +static int32_t httpCreateMsg(const char* server, const char* uri, uint16_t port, char* pCont, int32_t contLen, + EHttpCompFlag flag, int64_t chanId, SHttpMsg** httpMsg); +static void httpDestroyMsg(SHttpMsg* msg); static bool httpFailFastShoudIgnoreMsg(SHashObj* pTable, char* server, int16_t port); static void httpFailFastMayUpdate(SHashObj* pTable, char* server, int16_t port, int8_t succ); static int32_t taosSendHttpReportImpl(const char* server, const char* uri, uint16_t port, char* pCont, int32_t contLen, EHttpCompFlag flag); +static void httpModuleDestroy(SHttpModule* http); + +static int32_t taosSendHttpReportImplByChan(const char* server, const char* uri, uint16_t port, char* pCont, + int32_t contLen, EHttpCompFlag flag, int64_t chanId); static int32_t taosBuildHttpHeader(const char* server, const char* uri, int32_t contLen, char* pHead, int32_t headLen, - EHttpCompFlag flag) { + + EHttpCompFlag flag) { + int32_t code = 0; + int32_t len = 0; if (flag == HTTP_FLAT) { - return snprintf(pHead, headLen, + len = snprintf(pHead, headLen, "POST %s HTTP/1.1\n" "Host: %s\n" "Content-Type: application/json\n" "Content-Length: %d\n\n", uri, server, contLen); + if (len < 0 || len >= headLen) { + code = TSDB_CODE_OUT_OF_RANGE; + } } else if (flag == HTTP_GZIP) { - return snprintf(pHead, headLen, + len = snprintf(pHead, headLen, "POST %s HTTP/1.1\n" "Host: %s\n" "Content-Type: application/json\n" "Content-Encoding: gzip\n" "Content-Length: %d\n\n", uri, server, contLen); + if (len < 0 || len >= headLen) { + code = TSDB_CODE_OUT_OF_RANGE; + } } else { - terrno = TSDB_CODE_INVALID_CFG; - return -1; + code = TSDB_CODE_INVALID_PARA; } + return code; } static int32_t taosCompressHttpRport(char* pSrc, int32_t srcLen) { - int32_t code = -1; + int32_t code = 0; int32_t destLen = srcLen; void* pDest = taosMemoryMalloc(destLen); if (pDest == NULL) { - terrno = TSDB_CODE_OUT_OF_MEMORY; + code= TSDB_CODE_OUT_OF_MEMORY; goto _OVER; } @@ -110,7 +136,7 @@ static int32_t taosCompressHttpRport(char* pSrc, int32_t srcLen) { gzipStream.zfree = (free_func)0; gzipStream.opaque = (voidpf)0; if (deflateInit2(&gzipStream, Z_DEFAULT_COMPRESSION, Z_DEFLATED, MAX_WBITS + 16, 8, Z_DEFAULT_STRATEGY) != Z_OK) { - terrno = TSDB_CODE_OUT_OF_MEMORY; + code = TSDB_CODE_OUT_OF_MEMORY; goto _OVER; } @@ -121,13 +147,13 @@ static int32_t taosCompressHttpRport(char* pSrc, int32_t srcLen) { while (gzipStream.avail_in != 0 && gzipStream.total_out < (uLong)(destLen)) { if (deflate(&gzipStream, Z_FULL_FLUSH) != Z_OK) { - terrno = TSDB_CODE_COMPRESS_ERROR; + code = TSDB_CODE_COMPRESS_ERROR; goto _OVER; } } if (gzipStream.avail_in != 0) { - terrno = TSDB_CODE_COMPRESS_ERROR; + code = TSDB_CODE_COMPRESS_ERROR; goto _OVER; } @@ -137,18 +163,18 @@ static int32_t taosCompressHttpRport(char* pSrc, int32_t srcLen) { break; } if (err != Z_OK) { - terrno = TSDB_CODE_COMPRESS_ERROR; + code = TSDB_CODE_COMPRESS_ERROR; goto _OVER; } } if (deflateEnd(&gzipStream) != Z_OK) { - terrno = TSDB_CODE_COMPRESS_ERROR; + code = TSDB_CODE_COMPRESS_ERROR; goto _OVER; } if (gzipStream.total_out >= srcLen) { - terrno = TSDB_CODE_COMPRESS_ERROR; + code = TSDB_CODE_COMPRESS_ERROR; goto _OVER; } @@ -158,8 +184,7 @@ _OVER: if (code == 0) { memcpy(pSrc, pDest, gzipStream.total_out); code = gzipStream.total_out; - } - + } taosMemoryFree(pDest); return code; } @@ -168,11 +193,15 @@ static FORCE_INLINE int32_t taosBuildDstAddr(const char* server, uint16_t port, uint32_t ip = taosGetIpv4FromFqdn(server); if (ip == 0xffffffff) { tError("http-report failed to resolving domain names: %s", server); - return -1; + return TSDB_CODE_RPC_FQDN_ERROR; } - char buf[128] = {0}; + char buf[256] = {0}; tinet_ntoa(buf, ip); - uv_ip4_addr(buf, port, dest); + int ret = uv_ip4_addr(buf, port, dest); + if (ret != 0) { + tError("http-report failed to get addr %s", uv_err_name(ret)); + return TSDB_CODE_THIRDPARTY_ERROR; + } return 0; } @@ -183,6 +212,44 @@ static void* httpThread(void* arg) { return NULL; } +static int32_t httpCreateMsg(const char* server, const char* uri, uint16_t port, char* pCont, int32_t contLen, + EHttpCompFlag flag, int64_t chanId, SHttpMsg** httpMsg) { + if (server == NULL || uri == NULL) { + tError("http-report failed to report to invalid addr, chanId:%" PRId64 "", chanId); + *httpMsg = NULL; + return TSDB_CODE_INVALID_PARA; + } + + if (pCont == NULL || contLen == 0) { + tError("http-report failed to report empty packet, chanId:%" PRId64 "", chanId); + *httpMsg = NULL; + return TSDB_CODE_INVALID_PARA; + } + + SHttpMsg* msg = taosMemoryMalloc(sizeof(SHttpMsg)); + if (msg == NULL) { + *httpMsg = NULL; + return TSDB_CODE_OUT_OF_MEMORY; + } + + msg->port = port; + msg->server = taosStrdup(server); + msg->uri = taosStrdup(uri); + msg->cont = taosMemoryMalloc(contLen); + if (msg->server == NULL || msg->uri == NULL || msg->cont == NULL) { + httpDestroyMsg(msg); + *httpMsg = NULL; + return TSDB_CODE_OUT_OF_MEMORY; + } + + memcpy(msg->cont, pCont, contLen); + msg->len = contLen; + msg->flag = flag; + msg->quit = 0; + msg->chanId = chanId; + *httpMsg = msg; + return 0; +} static void httpDestroyMsg(SHttpMsg* msg) { if (msg == NULL) return; @@ -191,15 +258,7 @@ static void httpDestroyMsg(SHttpMsg* msg) { taosMemoryFree(msg->cont); taosMemoryFree(msg); } -static void httpDestroyMsgWrapper(void* cont, void* param) { - httpDestroyMsg((SHttpMsg*)cont); - // if (msg == NULL) return; - - // taosMemoryFree(msg->server); - // taosMemoryFree(msg->uri); - // taosMemoryFree(msg->cont); - // taosMemoryFree(msg); -} +static void httpDestroyMsgWrapper(void* cont, void* param) { httpDestroyMsg((SHttpMsg*)cont); } static void httpMayDiscardMsg(SHttpModule* http, SAsyncItem* item) { SHttpMsg *msg = NULL, *quitMsg = NULL; @@ -221,6 +280,7 @@ static void httpMayDiscardMsg(SHttpModule* http, SAsyncItem* item) { QUEUE_PUSH(&item->qmsg, &quitMsg->q); } } + static void httpAsyncCb(uv_async_t* handle) { SAsyncItem* item = handle->data; SHttpModule* http = item->pThrd; @@ -266,6 +326,14 @@ static FORCE_INLINE void destroyHttpClient(SHttpClient* cli) { static FORCE_INLINE void clientCloseCb(uv_handle_t* handle) { SHttpClient* cli = handle->data; + + int64_t chanId = cli->chanId; + SHttpModule* http = taosAcquireRef(httpRefMgt, cli->chanId); + if (http != NULL) { + http->connNum -= 1; + taosReleaseRef(httpRefMgt, chanId); + } + destroyHttpClient(cli); } @@ -278,7 +346,7 @@ static FORCE_INLINE void clientAllocBuffCb(uv_handle_t* handle, size_t suggested static FORCE_INLINE void clientRecvCb(uv_stream_t* handle, ssize_t nread, const uv_buf_t* buf) { SHttpClient* cli = handle->data; if (nread < 0) { - tError("http-report recv error:%s", uv_err_name(nread)); + tError("http-report recv error:%s", uv_strerror(nread)); } else { tTrace("http-report succ to recv %d bytes", (int32_t)nread); } @@ -289,92 +357,73 @@ static FORCE_INLINE void clientRecvCb(uv_stream_t* handle, ssize_t nread, const static void clientSentCb(uv_write_t* req, int32_t status) { SHttpClient* cli = req->data; if (status != 0) { - tError("http-report failed to send data, reason: %s, dst:%s:%d", uv_strerror(status), cli->addr, cli->port); + tError("http-report failed to send data, reason: %s, dst:%s:%d, chanId:%" PRId64 "", uv_strerror(status), cli->addr, + cli->port, cli->chanId); if (!uv_is_closing((uv_handle_t*)&cli->tcp)) { uv_close((uv_handle_t*)&cli->tcp, clientCloseCb); } return; } else { - tTrace("http-report succ to send data"); + tTrace("http-report succ to send data, chanId:%" PRId64 "", cli->chanId); } status = uv_read_start((uv_stream_t*)&cli->tcp, clientAllocBuffCb, clientRecvCb); if (status != 0) { - tError("http-report failed to recv data,reason:%s, dst:%s:%d", uv_strerror(status), cli->addr, cli->port); + tError("http-report failed to recv data,reason:%s, dst:%s:%d, chanId:%" PRId64 "", uv_strerror(status), cli->addr, + cli->port, cli->chanId); if (!uv_is_closing((uv_handle_t*)&cli->tcp)) { uv_close((uv_handle_t*)&cli->tcp, clientCloseCb); } } } static void clientConnCb(uv_connect_t* req, int32_t status) { - SHttpModule* http = taosAcquireRef(httpRefMgt, httpRef); SHttpClient* cli = req->data; + int64_t chanId = cli->chanId; + + SHttpModule* http = taosAcquireRef(httpRefMgt, chanId); if (status != 0) { httpFailFastMayUpdate(http->connStatusTable, cli->addr, cli->port, 0); - tError("http-report failed to conn to server, reason:%s, dst:%s:%d", uv_strerror(status), cli->addr, cli->port); + tError("http-report failed to conn to server, reason:%s, dst:%s:%d, chanId:%" PRId64 "", uv_strerror(status), + cli->addr, cli->port, chanId); if (!uv_is_closing((uv_handle_t*)&cli->tcp)) { uv_close((uv_handle_t*)&cli->tcp, clientCloseCb); } - taosReleaseRef(httpRefMgt, httpRef); + taosReleaseRef(httpRefMgt, chanId); return; } + http->connNum += 1; + httpFailFastMayUpdate(http->connStatusTable, cli->addr, cli->port, 1); status = uv_write(&cli->req, (uv_stream_t*)&cli->tcp, cli->wbuf, 2, clientSentCb); if (0 != status) { - tError("http-report failed to send data,reason:%s, dst:%s:%d", uv_strerror(status), cli->addr, cli->port); + tError("http-report failed to send data,reason:%s, dst:%s:%d, chanId:%" PRId64 "", uv_strerror(status), cli->addr, + cli->port, chanId); if (!uv_is_closing((uv_handle_t*)&cli->tcp)) { uv_close((uv_handle_t*)&cli->tcp, clientCloseCb); } } - taosReleaseRef(httpRefMgt, httpRef); + taosReleaseRef(httpRefMgt, chanId); } -int32_t httpSendQuit() { - SHttpModule* http = taosAcquireRef(httpRefMgt, httpRef); - if (http == NULL) return 0; - +int32_t httpSendQuit(SHttpModule* http, int64_t chanId) { SHttpMsg* msg = taosMemoryCalloc(1, sizeof(SHttpMsg)); + if (msg == NULL) { + return TSDB_CODE_OUT_OF_MEMORY; + } + msg->quit = 1; + msg->chanId = chanId; + + int ret = transAsyncSend(http->asyncPool, &(msg->q)); + if (ret != 0) { + taosMemoryFree(msg); + return TSDB_CODE_THIRDPARTY_ERROR; + } - transAsyncSend(http->asyncPool, &(msg->q)); - taosReleaseRef(httpRefMgt, httpRef); return 0; } -static int32_t taosSendHttpReportImpl(const char* server, const char* uri, uint16_t port, char* pCont, int32_t contLen, - EHttpCompFlag flag) { - if (server == NULL || uri == NULL) { - tError("http-report failed to report to invalid addr"); - return -1; - } - - if (pCont == NULL || contLen == 0) { - tError("http-report failed to report empty packet"); - return -1; - } - SHttpModule* load = taosAcquireRef(httpRefMgt, httpRef); - if (load == NULL) { - tError("http-report already released"); - return -1; - } - - SHttpMsg* msg = taosMemoryMalloc(sizeof(SHttpMsg)); - - msg->server = taosStrdup(server); - msg->uri = taosStrdup(uri); - msg->port = port; - msg->cont = taosMemoryMalloc(contLen); - memcpy(msg->cont, pCont, contLen); - msg->len = contLen; - msg->flag = flag; - msg->quit = 0; - - int ret = transAsyncSend(load->asyncPool, &(msg->q)); - taosReleaseRef(httpRefMgt, httpRef); - return ret; -} - static void httpDestroyClientCb(uv_handle_t* handle) { SHttpClient* http = handle->data; destroyHttpClient(http); @@ -392,13 +441,14 @@ static void httpWalkCb(uv_handle_t* handle, void* arg) { return; } static void httpHandleQuit(SHttpMsg* msg) { + int64_t chanId = msg->chanId; taosMemoryFree(msg); - SHttpModule* http = taosAcquireRef(httpRefMgt, httpRef); + tDebug("http-report receive quit, chanId:%" PRId64 "", chanId); + SHttpModule* http = taosAcquireRef(httpRefMgt, chanId); if (http == NULL) return; - uv_walk(http->loop, httpWalkCb, NULL); - taosReleaseRef(httpRefMgt, httpRef); + taosReleaseRef(httpRefMgt, chanId); } static bool httpFailFastShoudIgnoreMsg(SHashObj* pTable, char* server, int16_t port) { @@ -431,9 +481,14 @@ static void httpFailFastMayUpdate(SHashObj* pTable, char* server, int16_t port, return; } static void httpHandleReq(SHttpMsg* msg) { - int32_t ignore = false; - SHttpModule* http = taosAcquireRef(httpRefMgt, httpRef); + int64_t chanId = msg->chanId; + int32_t ignore = false; + char* header = NULL; + int32_t code = 0; + + SHttpModule* http = taosAcquireRef(httpRefMgt, chanId); if (http == NULL) { + code = terrno; goto END; } if (httpFailFastShoudIgnoreMsg(http->connStatusTable, msg->server, msg->port)) { @@ -453,123 +508,268 @@ static void httpHandleReq(SHttpMsg* msg) { msg->flag = HTTP_FLAT; } if (dstLen < 0) { + code = dstLen; goto END; } } - int32_t len = 2048; - char* header = taosMemoryCalloc(1, len); - int32_t headLen = taosBuildHttpHeader(msg->server, msg->uri, msg->len, header, len, msg->flag); + int32_t cap = 2048; + header = taosMemoryCalloc(1, cap); + if (header == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + goto END; + } + + int32_t headLen = taosBuildHttpHeader(msg->server, msg->uri, msg->len, header, cap, msg->flag); if (headLen < 0) { - taosMemoryFree(header); + code = headLen; goto END; } uv_buf_t* wb = taosMemoryCalloc(2, sizeof(uv_buf_t)); + if (wb == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + goto END; + } + wb[0] = uv_buf_init((char*)header, strlen(header)); // heap var wb[1] = uv_buf_init((char*)msg->cont, msg->len); // heap var SHttpClient* cli = taosMemoryCalloc(1, sizeof(SHttpClient)); + if (cli == NULL) { + taosMemoryFree(wb); + code = TSDB_CODE_OUT_OF_MEMORY; + goto END; + } + cli->conn.data = cli; cli->tcp.data = cli; cli->req.data = cli; - cli->wbuf = wb; - cli->rbuf = taosMemoryCalloc(1, HTTP_RECV_BUF_SIZE); + cli->dest = dest; + cli->chanId = chanId; cli->addr = msg->server; cli->port = msg->port; - cli->dest = dest; - taosMemoryFree(msg->uri); taosMemoryFree(msg); - uv_tcp_init(http->loop, &cli->tcp); + cli->wbuf = wb; + cli->rbuf = taosMemoryCalloc(1, HTTP_RECV_BUF_SIZE); + if (cli->rbuf == NULL) { + tError("http-report failed to alloc read buf, dst:%s:%d,chanId:%" PRId64 ", reason:%s", cli->addr, cli->port, + chanId, tstrerror(TSDB_CODE_OUT_OF_MEMORY)); + destroyHttpClient(cli); + taosReleaseRef(httpRefMgt, chanId); + return; + } + + int err = uv_tcp_init(http->loop, &cli->tcp); + if (err != 0) { + tError("http-report failed to init socket handle, dst:%s:%d,chanId:%" PRId64 ", reason:%s", cli->addr, cli->port, + chanId, uv_strerror(err)); + destroyHttpClient(cli); + taosReleaseRef(httpRefMgt, chanId); + return; + } // set up timeout to avoid stuck; int32_t fd = taosCreateSocketWithTimeout(5000); if (fd < 0) { - tError("http-report failed to open socket, dst:%s:%d", cli->addr, cli->port); + tError("http-report failed to open socket, dst:%s:%d, chanId:%" PRId64 ", reason:%s", cli->addr, cli->port, chanId, + tstrerror(TAOS_SYSTEM_ERROR(errno))); destroyHttpClient(cli); - taosReleaseRef(httpRefMgt, httpRef); + taosReleaseRef(httpRefMgt, chanId); return; } + int ret = uv_tcp_open((uv_tcp_t*)&cli->tcp, fd); if (ret != 0) { - tError("http-report failed to open socket, reason:%s, dst:%s:%d", uv_strerror(ret), cli->addr, cli->port); - taosReleaseRef(httpRefMgt, httpRef); + tError("http-report failed to open socket, reason:%s, dst:%s:%d, chanId:%" PRId64 ",reason:%s", uv_strerror(ret), + cli->addr, cli->port, chanId, uv_strerror(ret)); destroyHttpClient(cli); + taosReleaseRef(httpRefMgt, chanId); return; } ret = uv_tcp_connect(&cli->conn, &cli->tcp, (const struct sockaddr*)&cli->dest, clientConnCb); if (ret != 0) { - tError("http-report failed to connect to http-server, reason:%s, dst:%s:%d", uv_strerror(ret), cli->addr, - cli->port); + tError("http-report failed to connect to http-server,dst:%s:%d, chanId:%" PRId64 ",reson:%s", cli->addr, cli->port, + chanId, uv_strerror(ret)); httpFailFastMayUpdate(http->connStatusTable, cli->addr, cli->port, 0); destroyHttpClient(cli); } - taosReleaseRef(httpRefMgt, httpRef); + taosReleaseRef(httpRefMgt, chanId); return; END: if (ignore == false) { - tError("http-report failed to report, reason: %s, addr: %s:%d", terrstr(), msg->server, msg->port); + tError("http-report failed to report to addr: %s:%d, chanId:%" PRId64 ", reason:%s", msg->server, msg->port, chanId, + tstrerror(code)); } httpDestroyMsg(msg); - taosReleaseRef(httpRefMgt, httpRef); + taosMemoryFree(header); + taosReleaseRef(httpRefMgt, chanId); +} + +static void httpModuleDestroy(SHttpModule* http) { + if (http == NULL) return; + + if (http->asyncPool != NULL) { + TRANS_DESTROY_ASYNC_POOL_MSG(http->asyncPool, SHttpMsg, httpDestroyMsgWrapper, NULL); + transAsyncPoolDestroy(http->asyncPool); + } + if (http->loop) { + uv_loop_close(http->loop); + taosMemoryFree(http->loop); + } + + taosHashCleanup(http->connStatusTable); + // not free http, http freeed by ref +} + +void httpModuleDestroy2(SHttpModule* http) { + if (http == NULL) return; + httpModuleDestroy(http); + taosMemoryFree(http); +} + +static int32_t taosSendHttpReportImplByChan(const char* server, const char* uri, uint16_t port, char* pCont, + int32_t contLen, EHttpCompFlag flag, int64_t chanId) { + SHttpModule* load = NULL; + SHttpMsg *msg = NULL; + int32_t code = httpCreateMsg(server, uri, port, pCont, contLen, flag, chanId,&msg); + if (code != 0) { + goto _ERROR; + } + + load = taosAcquireRef(httpRefMgt, chanId); + if (load == NULL) { + code = terrno; + goto _ERROR; + } + + if (atomic_load_8(&load->quit)) { + code = TSDB_CODE_HTTP_MODULE_QUIT; + goto _ERROR; + } + + code = transAsyncSend(load->asyncPool, &(msg->q)); + if (code != 0) { + code = TSDB_CODE_HTTP_MODULE_QUIT; + goto _ERROR; + } + msg = NULL; + +_ERROR: + httpDestroyMsg(msg); + if (load != NULL) taosReleaseRef(httpRefMgt, chanId); + return code; +} + +int32_t taosSendHttpReportByChan(const char* server, const char* uri, uint16_t port, char* pCont, int32_t contLen, + EHttpCompFlag flag, int64_t chanId) { + return taosSendHttpReportImplByChan(server, uri, port, pCont, contLen, flag, chanId); } int32_t taosSendHttpReport(const char* server, const char* uri, uint16_t port, char* pCont, int32_t contLen, EHttpCompFlag flag) { taosThreadOnce(&transHttpInit, transHttpEnvInit); - return taosSendHttpReportImpl(server, uri, port, pCont, contLen, flag); + return taosSendHttpReportImplByChan(server, uri, port, pCont, contLen, flag, httpDefaultChanId); } static void transHttpDestroyHandle(void* handle) { taosMemoryFree(handle); } + +int64_t transInitHttpChanImpl(); + static void transHttpEnvInit() { - httpRefMgt = taosOpenRef(1, transHttpDestroyHandle); - - SHttpModule* http = taosMemoryCalloc(1, sizeof(SHttpModule)); - http->loop = taosMemoryMalloc(sizeof(uv_loop_t)); - http->connStatusTable = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK); - http->quit = 0; - - uv_loop_init(http->loop); - - http->asyncPool = transAsyncPoolCreate(http->loop, 1, http, httpAsyncCb); - if (NULL == http->asyncPool) { - taosMemoryFree(http->loop); - taosMemoryFree(http); - http = NULL; - return; - } - - int err = taosThreadCreate(&http->thread, NULL, httpThread, (void*)http); - if (err != 0) { - taosMemoryFree(http->loop); - taosMemoryFree(http); - http = NULL; - } - httpRef = taosAddRef(httpRefMgt, http); + httpRefMgt = taosOpenRef(64, transHttpDestroyHandle); + httpDefaultChanId = transInitHttpChanImpl(); } void transHttpEnvDestroy() { - // remove http - if (httpRef == -1) { + // remove default chanId + taosDestroyHttpChan(httpDefaultChanId); + httpDefaultChanId = -1; +} + +int64_t transInitHttpChanImpl() { + int32_t code = 0; + SHttpModule* http = taosMemoryCalloc(1, sizeof(SHttpModule)); + if (http == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + goto _ERROR; + } + + http->connStatusTable = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK); + if (http->connStatusTable == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + goto _ERROR; + } + + http->loop = taosMemoryMalloc(sizeof(uv_loop_t)); + if (http->loop == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + goto _ERROR; + } + + int err = uv_loop_init(http->loop); + if (err != 0) { + tError("http-report failed init uv, reason:%s", uv_strerror(err)); + code = TSDB_CODE_THIRDPARTY_ERROR; + goto _ERROR; + } + + http->asyncPool = transAsyncPoolCreate(http->loop, 1, http, httpAsyncCb); + if (http->asyncPool == NULL) { + code = terrno; + goto _ERROR; + } + + http->quit = 0; + + err = taosThreadCreate(&http->thread, NULL, httpThread, (void*)http); + if (err != 0) { + code = TAOS_SYSTEM_ERROR(errno); + goto _ERROR; + } + + int64_t ref = taosAddRef(httpRefMgt, http); + if (ref < 0) { + goto _ERROR; + } + return ref; + +_ERROR: + httpModuleDestroy2(http); + return code; +} +int64_t taosInitHttpChan() { + taosThreadOnce(&transHttpInit, transHttpEnvInit); + return transInitHttpChanImpl(); +} + +void taosDestroyHttpChan(int64_t chanId) { + tDebug("http-report send quit, chanId:%" PRId64 "", chanId); + + int ret = 0; + SHttpModule* load = taosAcquireRef(httpRefMgt, chanId); + if (load == NULL) { + tError("http-report failed to destroy chanId %" PRId64 ", reason:%s", chanId, tstrerror(terrno)); + ret = terrno; return; } - SHttpModule* load = taosAcquireRef(httpRefMgt, httpRef); atomic_store_8(&load->quit, 1); - httpSendQuit(); + ret = httpSendQuit(load, chanId); + if (ret != 0) { + tDebug("http-report already destroyed, chanId %" PRId64 ",reason:%s", chanId, tstrerror(ret)); + taosReleaseRef(httpRefMgt, chanId); + return; + } + taosThreadJoin(load->thread, NULL); - TRANS_DESTROY_ASYNC_POOL_MSG(load->asyncPool, SHttpMsg, httpDestroyMsgWrapper, NULL); - transAsyncPoolDestroy(load->asyncPool); - uv_loop_close(load->loop); - taosMemoryFree(load->loop); + httpModuleDestroy(load); - taosHashCleanup(load->connStatusTable); - - taosReleaseRef(httpRefMgt, httpRef); - taosRemoveRef(httpRefMgt, httpRef); -} + taosReleaseRef(httpRefMgt, chanId); + taosRemoveRef(httpRefMgt, chanId); +} \ No newline at end of file diff --git a/source/libs/transport/src/transComm.c b/source/libs/transport/src/transComm.c index 68ff5dc5e5..b9223e7b39 100644 --- a/source/libs/transport/src/transComm.c +++ b/source/libs/transport/src/transComm.c @@ -224,14 +224,28 @@ int transSetConnOption(uv_tcp_t* stream, int keepalive) { SAsyncPool* transAsyncPoolCreate(uv_loop_t* loop, int sz, void* arg, AsyncCB cb) { SAsyncPool* pool = taosMemoryCalloc(1, sizeof(SAsyncPool)); + if (pool == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + return NULL; + } + pool->nAsync = sz; pool->asyncs = taosMemoryCalloc(1, sizeof(uv_async_t) * pool->nAsync); + if (pool->asyncs == NULL) { + taosMemoryFree(pool); + terrno = TSDB_CODE_OUT_OF_MEMORY; + return NULL; + } int i = 0, err = 0; for (i = 0; i < pool->nAsync; i++) { uv_async_t* async = &(pool->asyncs[i]); SAsyncItem* item = taosMemoryCalloc(1, sizeof(SAsyncItem)); + if (item == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + break; + } item->pThrd = arg; QUEUE_INIT(&item->qmsg); taosThreadMutexInit(&item->mtx, NULL); @@ -240,6 +254,7 @@ SAsyncPool* transAsyncPoolCreate(uv_loop_t* loop, int sz, void* arg, AsyncCB cb) err = uv_async_init(loop, async, cb); if (err != 0) { tError("failed to init async, reason:%s", uv_err_name(err)); + terrno = TSDB_CODE_THIRDPARTY_ERROR; break; } } diff --git a/source/libs/transport/src/transSvr.c b/source/libs/transport/src/transSvr.c index 94d2aa4b00..674bb86fb5 100644 --- a/source/libs/transport/src/transSvr.c +++ b/source/libs/transport/src/transSvr.c @@ -431,6 +431,7 @@ static bool uvHandleReq(SSvrConn* pConn) { transMsg.info.traceId = pHead->traceId; transMsg.info.cliVer = htonl(pHead->compatibilityVer); transMsg.info.forbiddenIp = forbiddenIp; + transMsg.info.noResp = pHead->noResp == 1 ? 1 : 0; tGTrace("%s handle %p conn:%p translated to app, refId:%" PRIu64, transLabel(pTransInst), transMsg.info.handle, pConn, pConn->refId); diff --git a/source/util/src/talgo.c b/source/util/src/talgo.c index 3e5a86588d..d7cd0348f4 100644 --- a/source/util/src/talgo.c +++ b/source/util/src/talgo.c @@ -147,10 +147,14 @@ static void tqsortImpl(void *src, int32_t start, int32_t end, int64_t size, cons } } -void taosqsort(void *src, int64_t numOfElem, int64_t size, const void *param, __ext_compar_fn_t comparFn) { +int32_t taosqsort(void *src, int64_t numOfElem, int64_t size, const void *param, __ext_compar_fn_t comparFn) { char *buf = taosMemoryCalloc(1, size); // prepare the swap buffer + if (NULL == buf) { + return TSDB_CODE_OUT_OF_MEMORY; + } tqsortImpl(src, 0, (int32_t)numOfElem - 1, (int32_t)size, param, comparFn, buf); taosMemoryFreeClear(buf); + return 0; } #define DOSWAP(a, b, size) \ @@ -324,14 +328,17 @@ void *taosbsearch(const void *key, const void *base, int32_t nmemb, int32_t size } } -void taosheapadjust(void *base, int32_t size, int32_t start, int32_t end, const void *parcompar, - __ext_compar_fn_t compar, char *buf, bool maxroot) { +int32_t taosheapadjust(void *base, int32_t size, int32_t start, int32_t end, const void *parcompar, + __ext_compar_fn_t compar, char *buf, bool maxroot) { int32_t parent; int32_t child; char *tmp = NULL; if (buf == NULL) { tmp = taosMemoryMalloc(size); + if (NULL == tmp) { + return TSDB_CODE_OUT_OF_MEMORY; + } } else { tmp = buf; } @@ -378,24 +385,31 @@ void taosheapadjust(void *base, int32_t size, int32_t start, int32_t end, const if (buf == NULL) { taosMemoryFree(tmp); } + + return 0; } -void taosheapsort(void *base, int32_t size, int32_t len, const void *parcompar, __ext_compar_fn_t compar, - bool maxroot) { +int32_t taosheapsort(void *base, int32_t size, int32_t len, const void *parcompar, __ext_compar_fn_t compar, + bool maxroot) { int32_t i; char *buf = taosMemoryCalloc(1, size); if (buf == NULL) { - return; + return TSDB_CODE_OUT_OF_MEMORY; } if (base && size > 0) { for (i = len / 2 - 1; i >= 0; i--) { - taosheapadjust(base, size, i, len - 1, parcompar, compar, buf, maxroot); + int32_t code = taosheapadjust(base, size, i, len - 1, parcompar, compar, buf, maxroot); + if (code) { + taosMemoryFree(buf); + return code; + } } } taosMemoryFree(buf); + return 0; } static void taosMerge(void *src, int32_t start, int32_t leftend, int32_t end, int64_t size, const void *param, @@ -441,7 +455,10 @@ static int32_t taosMergeSortHelper(void *src, int64_t numOfElem, int64_t size, c // short array sort, instead of merge sort process const int32_t THRESHOLD_SIZE = 6; char *buf = taosMemoryCalloc(1, size); // prepare the swap buffer - if (buf == NULL) return TSDB_CODE_OUT_OF_MEMORY; + if (buf == NULL) { + return TSDB_CODE_OUT_OF_MEMORY; + } + for (int32_t start = 0; start < numOfElem - 1; start += THRESHOLD_SIZE) { int32_t end = (start + THRESHOLD_SIZE - 1) <= numOfElem - 1 ? (start + THRESHOLD_SIZE - 1) : numOfElem - 1; tInsertSort(src, size, start, end, param, comparFn, buf); @@ -451,7 +468,9 @@ static int32_t taosMergeSortHelper(void *src, int64_t numOfElem, int64_t size, c if (numOfElem > THRESHOLD_SIZE) { int32_t currSize; void *tmp = taosMemoryMalloc(numOfElem * size); - if (tmp == NULL) return TSDB_CODE_OUT_OF_MEMORY; + if (tmp == NULL) { + return TSDB_CODE_OUT_OF_MEMORY; + } for (currSize = THRESHOLD_SIZE; currSize <= numOfElem - 1; currSize = 2 * currSize) { int32_t leftStart; diff --git a/source/util/src/tarray.c b/source/util/src/tarray.c index d9686d77f8..ec5e41f256 100644 --- a/source/util/src/tarray.c +++ b/source/util/src/tarray.c @@ -34,14 +34,12 @@ SArray* taosArrayInit(size_t size, size_t elemSize) { SArray* pArray = taosMemoryMalloc(sizeof(SArray)); if (pArray == NULL) { - terrno = TSDB_CODE_OUT_OF_MEMORY; return NULL; } pArray->size = 0; pArray->pData = taosMemoryCalloc(size, elemSize); if (pArray->pData == NULL) { - terrno = TSDB_CODE_OUT_OF_MEMORY; taosMemoryFree(pArray); return NULL; } @@ -387,13 +385,11 @@ void taosArrayClearP(SArray* pArray, void (*fp)(void*)) { taosArrayClear(pArray); } -void* taosArrayDestroy(SArray* pArray) { +void taosArrayDestroy(SArray* pArray) { if (pArray) { taosMemoryFree(pArray->pData); taosMemoryFree(pArray); } - - return NULL; } void taosArrayDestroyP(SArray* pArray, FDelete fp) { @@ -522,9 +518,8 @@ void* taosDecodeArray(const void* buf, SArray** pArray, FDecode decode, int32_t // todo remove it // order array -void taosArraySortPWithExt(SArray* pArray, __ext_compar_fn_t fn, const void* param) { - taosqsort(pArray->pData, pArray->size, pArray->elemSize, param, fn); - // taosArrayGetSize(pArray) > 8 ? taosArrayQuickSort(pArray, fn, param) : taosArrayInsertSort(pArray, fn, param); +int32_t taosArraySortPWithExt(SArray* pArray, __ext_compar_fn_t fn, const void* param) { + return taosqsort(pArray->pData, pArray->size, pArray->elemSize, param, fn); } void taosArraySwap(SArray* a, SArray* b) { diff --git a/source/util/src/tbloomfilter.c b/source/util/src/tbloomfilter.c index 150faab571..1cf4ecf72e 100644 --- a/source/util/src/tbloomfilter.c +++ b/source/util/src/tbloomfilter.c @@ -22,26 +22,30 @@ #define UNIT_NUM_BITS 64ULL #define UNIT_ADDR_NUM_BITS 6ULL -static FORCE_INLINE bool setBit(uint64_t *buf, uint64_t index) { +static FORCE_INLINE bool setBit(uint64_t* buf, uint64_t index) { uint64_t unitIndex = index >> UNIT_ADDR_NUM_BITS; uint64_t old = buf[unitIndex]; buf[unitIndex] |= (1ULL << (index % UNIT_NUM_BITS)); return buf[unitIndex] != old; } -static FORCE_INLINE bool getBit(uint64_t *buf, uint64_t index) { +static FORCE_INLINE bool getBit(uint64_t* buf, uint64_t index) { uint64_t unitIndex = index >> UNIT_ADDR_NUM_BITS; uint64_t mask = 1ULL << (index % UNIT_NUM_BITS); return buf[unitIndex] & mask; } -SBloomFilter *tBloomFilterInit(uint64_t expectedEntries, double errorRate) { +int32_t tBloomFilterInit(uint64_t expectedEntries, double errorRate, SBloomFilter** ppBF) { + int32_t code = 0; + int32_t lino = 0; if (expectedEntries < 1 || errorRate <= 0 || errorRate >= 1.0) { - return NULL; + code = TSDB_CODE_FAILED; + TSDB_CHECK_CODE(code, lino, _error); } - SBloomFilter *pBF = taosMemoryCalloc(1, sizeof(SBloomFilter)); + SBloomFilter* pBF = taosMemoryCalloc(1, sizeof(SBloomFilter)); if (pBF == NULL) { - return NULL; + code = TSDB_CODE_OUT_OF_MEMORY; + TSDB_CHECK_CODE(code, lino, _error); } pBF->expectedEntries = expectedEntries; pBF->errorRate = errorRate; @@ -61,12 +65,19 @@ SBloomFilter *tBloomFilterInit(uint64_t expectedEntries, double errorRate) { pBF->buffer = taosMemoryCalloc(pBF->numUnits, sizeof(uint64_t)); if (pBF->buffer == NULL) { tBloomFilterDestroy(pBF); - return NULL; + code = TSDB_CODE_OUT_OF_MEMORY; + TSDB_CHECK_CODE(code, lino, _error); } - return pBF; + (*ppBF) = pBF; + +_error: + if (code != TSDB_CODE_SUCCESS) { + uError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } + return code; } -int32_t tBloomFilterPutHash(SBloomFilter *pBF, uint64_t hash1, uint64_t hash2) { +int32_t tBloomFilterPutHash(SBloomFilter* pBF, uint64_t hash1, uint64_t hash2) { ASSERT(!tBloomFilterIsFull(pBF)); bool hasChange = false; const register uint64_t size = pBF->numBits; @@ -82,7 +93,7 @@ int32_t tBloomFilterPutHash(SBloomFilter *pBF, uint64_t hash1, uint64_t hash2) { return TSDB_CODE_FAILED; } -int32_t tBloomFilterPut(SBloomFilter *pBF, const void *keyBuf, uint32_t len) { +int32_t tBloomFilterPut(SBloomFilter* pBF, const void* keyBuf, uint32_t len) { uint64_t h1 = (uint64_t)pBF->hashFn1(keyBuf, len); uint64_t h2 = (uint64_t)pBF->hashFn2(keyBuf, len); bool hasChange = false; @@ -99,7 +110,7 @@ int32_t tBloomFilterPut(SBloomFilter *pBF, const void *keyBuf, uint32_t len) { return TSDB_CODE_FAILED; } -int32_t tBloomFilterNoContain(const SBloomFilter *pBF, uint64_t hash1, uint64_t hash2) { +int32_t tBloomFilterNoContain(const SBloomFilter* pBF, uint64_t hash1, uint64_t hash2) { const register uint64_t size = pBF->numBits; uint64_t cbHash = hash1; for (uint32_t i = 0; i < pBF->hashFunctions; ++i) { @@ -111,7 +122,7 @@ int32_t tBloomFilterNoContain(const SBloomFilter *pBF, uint64_t hash1, uint64_t return TSDB_CODE_FAILED; } -void tBloomFilterDestroy(SBloomFilter *pBF) { +void tBloomFilterDestroy(SBloomFilter* pBF) { if (pBF == NULL) { return; } @@ -119,41 +130,70 @@ void tBloomFilterDestroy(SBloomFilter *pBF) { taosMemoryFree(pBF); } -int32_t tBloomFilterEncode(const SBloomFilter *pBF, SEncoder *pEncoder) { +int32_t tBloomFilterEncode(const SBloomFilter* pBF, SEncoder* pEncoder) { if (tEncodeU32(pEncoder, pBF->hashFunctions) < 0) return -1; if (tEncodeU64(pEncoder, pBF->expectedEntries) < 0) return -1; if (tEncodeU64(pEncoder, pBF->numUnits) < 0) return -1; if (tEncodeU64(pEncoder, pBF->numBits) < 0) return -1; if (tEncodeU64(pEncoder, pBF->size) < 0) return -1; for (uint64_t i = 0; i < pBF->numUnits; i++) { - uint64_t *pUnits = (uint64_t *)pBF->buffer; + uint64_t* pUnits = (uint64_t*)pBF->buffer; if (tEncodeU64(pEncoder, pUnits[i]) < 0) return -1; } if (tEncodeDouble(pEncoder, pBF->errorRate) < 0) return -1; return 0; } -SBloomFilter *tBloomFilterDecode(SDecoder *pDecoder) { - SBloomFilter *pBF = taosMemoryCalloc(1, sizeof(SBloomFilter)); +int32_t tBloomFilterDecode(SDecoder* pDecoder, SBloomFilter** ppBF) { + int32_t code = 0; + int32_t lino = 0; + SBloomFilter* pBF = taosMemoryCalloc(1, sizeof(SBloomFilter)); + if (!pBF) { + code = TSDB_CODE_OUT_OF_MEMORY; + TSDB_CHECK_CODE(code, lino, _error); + } pBF->buffer = NULL; - if (tDecodeU32(pDecoder, &pBF->hashFunctions) < 0) goto _error; - if (tDecodeU64(pDecoder, &pBF->expectedEntries) < 0) goto _error; - if (tDecodeU64(pDecoder, &pBF->numUnits) < 0) goto _error; - if (tDecodeU64(pDecoder, &pBF->numBits) < 0) goto _error; - if (tDecodeU64(pDecoder, &pBF->size) < 0) goto _error; + if (tDecodeU32(pDecoder, &pBF->hashFunctions) < 0) { + code = TSDB_CODE_FAILED; + TSDB_CHECK_CODE(code, lino, _error); + } + if (tDecodeU64(pDecoder, &pBF->expectedEntries) < 0) { + code = TSDB_CODE_FAILED; + TSDB_CHECK_CODE(code, lino, _error); + } + if (tDecodeU64(pDecoder, &pBF->numUnits) < 0) { + code = TSDB_CODE_FAILED; + TSDB_CHECK_CODE(code, lino, _error); + } + if (tDecodeU64(pDecoder, &pBF->numBits) < 0) { + code = TSDB_CODE_FAILED; + TSDB_CHECK_CODE(code, lino, _error); + } + if (tDecodeU64(pDecoder, &pBF->size) < 0) { + code = TSDB_CODE_FAILED; + TSDB_CHECK_CODE(code, lino, _error); + } pBF->buffer = taosMemoryCalloc(pBF->numUnits, sizeof(uint64_t)); for (int32_t i = 0; i < pBF->numUnits; i++) { - uint64_t *pUnits = (uint64_t *)pBF->buffer; - if (tDecodeU64(pDecoder, pUnits + i) < 0) goto _error; + uint64_t* pUnits = (uint64_t*)pBF->buffer; + if (tDecodeU64(pDecoder, pUnits + i) < 0) { + code = TSDB_CODE_FAILED; + TSDB_CHECK_CODE(code, lino, _error); + } + } + if (tDecodeDouble(pDecoder, &pBF->errorRate) < 0) { + code = TSDB_CODE_FAILED; + TSDB_CHECK_CODE(code, lino, _error); } - if (tDecodeDouble(pDecoder, &pBF->errorRate) < 0) goto _error; pBF->hashFn1 = HASH_FUNCTION_1; pBF->hashFn2 = HASH_FUNCTION_2; - return pBF; + (*ppBF) = pBF; + return TSDB_CODE_SUCCESS; _error: tBloomFilterDestroy(pBF); - return NULL; + uError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + return code; } -bool tBloomFilterIsFull(const SBloomFilter *pBF) { return pBF->size >= pBF->expectedEntries; } +bool tBloomFilterIsFull(const SBloomFilter* pBF) { return pBF->size >= pBF->expectedEntries; } diff --git a/source/util/src/tcompare.c b/source/util/src/tcompare.c index 26122a4a29..09599cead4 100644 --- a/source/util/src/tcompare.c +++ b/source/util/src/tcompare.c @@ -24,6 +24,7 @@ #include "tutil.h" #include "types.h" #include "osString.h" +#include "ttimer.h" int32_t setChkInBytes1(const void *pLeft, const void *pRight) { return NULL != taosHashGet((SHashObj *)pRight, pLeft, 1) ? 1 : 0; @@ -1203,54 +1204,153 @@ int32_t comparestrRegexNMatch(const void *pLeft, const void *pRight) { return comparestrRegexMatch(pLeft, pRight) ? 0 : 1; } -static threadlocal regex_t pRegex; -static threadlocal char *pOldPattern = NULL; -static regex_t *threadGetRegComp(const char *pPattern) { - if (NULL != pOldPattern) { - if( strcmp(pOldPattern, pPattern) == 0) { - return &pRegex; - } else { - DestoryThreadLocalRegComp(); +typedef struct UsingRegex { + regex_t pRegex; + int32_t lastUsedTime; +} UsingRegex; + +typedef struct RegexCache { + SHashObj *regexHash; + void *regexCacheTmr; + void *timer; +} RegexCache; +static RegexCache sRegexCache; +#define MAX_REGEX_CACHE_SIZE 20 +#define REGEX_CACHE_CLEAR_TIME 30 + +static void checkRegexCache(void* param, void* tmrId) { + taosTmrReset(checkRegexCache, REGEX_CACHE_CLEAR_TIME * 1000, param, sRegexCache.regexCacheTmr, &tmrId); + if (taosHashGetSize(sRegexCache.regexHash) < MAX_REGEX_CACHE_SIZE) { + return; + } + + if (taosHashGetSize(sRegexCache.regexHash) >= MAX_REGEX_CACHE_SIZE) { + UsingRegex **ppUsingRegex = taosHashIterate(sRegexCache.regexHash, NULL); + while ((ppUsingRegex != NULL)) { + if (taosGetTimestampSec() - (*ppUsingRegex)->lastUsedTime > REGEX_CACHE_CLEAR_TIME) { + size_t len = 0; + char* key = (char*)taosHashGetKey(ppUsingRegex, &len); + taosHashRemove(sRegexCache.regexHash, key, len); + } + ppUsingRegex = taosHashIterate(sRegexCache.regexHash, ppUsingRegex); } } - pOldPattern = taosMemoryMalloc(strlen(pPattern) + 1); - if (NULL == pOldPattern) { +} + +void regexCacheFree(void *ppUsingRegex) { + regfree(&(*(UsingRegex **)ppUsingRegex)->pRegex); + taosMemoryFree(*(UsingRegex **)ppUsingRegex); +} + +int32_t InitRegexCache() { + sRegexCache.regexHash = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_ENTRY_LOCK); + if (sRegexCache.regexHash == NULL) { + uError("failed to create RegexCache"); + return -1; + } + taosHashSetFreeFp(sRegexCache.regexHash, regexCacheFree); + sRegexCache.regexCacheTmr = taosTmrInit(0, 0, 0, "REGEXCACHE"); + if (sRegexCache.regexCacheTmr == NULL) { + uError("failed to create regex cache check timer"); + terrno = TSDB_CODE_OUT_OF_MEMORY; + return -1; + } + + sRegexCache.timer = taosTmrStart(checkRegexCache, REGEX_CACHE_CLEAR_TIME * 1000, NULL, sRegexCache.regexCacheTmr); + if (sRegexCache.timer == NULL) { + uError("failed to start regex cache timer"); + return -1; + } + + return 0; +} + +void DestroyRegexCache(){ + uInfo("[regex cache] destory regex cache"); + taosTmrStopA(&sRegexCache.timer); + taosHashCleanup(sRegexCache.regexHash); + taosTmrCleanUp(sRegexCache.regexCacheTmr); +} + +int32_t checkRegexPattern(const char *pPattern) { + if (pPattern == NULL) { + return TSDB_CODE_PAR_REGULAR_EXPRESSION_ERROR; + } + + regex_t regex; + int32_t cflags = REG_EXTENDED; + int32_t ret = regcomp(®ex, pPattern, cflags); + if (ret != 0) { + char msgbuf[256] = {0}; + regerror(ret, ®ex, msgbuf, tListLen(msgbuf)); + uError("Failed to compile regex pattern %s. reason %s", pPattern, msgbuf); + return TSDB_CODE_PAR_REGULAR_EXPRESSION_ERROR; + } + regfree(®ex); + return TSDB_CODE_SUCCESS; +} + +static UsingRegex **getRegComp(const char *pPattern) { + UsingRegex **ppUsingRegex = (UsingRegex **)taosHashAcquire(sRegexCache.regexHash, pPattern, strlen(pPattern)); + if (ppUsingRegex != NULL) { + (*ppUsingRegex)->lastUsedTime = taosGetTimestampSec(); + return ppUsingRegex; + } + + UsingRegex *pUsingRegex = taosMemoryMalloc(sizeof(UsingRegex)); + if (pUsingRegex == NULL) { uError("Failed to Malloc when compile regex pattern %s.", pPattern); return NULL; } - strcpy(pOldPattern, pPattern); int32_t cflags = REG_EXTENDED; - int32_t ret = regcomp(&pRegex, pPattern, cflags); + int32_t ret = regcomp(&pUsingRegex->pRegex, pPattern, cflags); if (ret != 0) { char msgbuf[256] = {0}; - regerror(ret, &pRegex, msgbuf, tListLen(msgbuf)); + regerror(ret, &pUsingRegex->pRegex, msgbuf, tListLen(msgbuf)); uError("Failed to compile regex pattern %s. reason %s", pPattern, msgbuf); - DestoryThreadLocalRegComp(); + taosMemoryFree(pUsingRegex); return NULL; } - return &pRegex; + + while (true) { + int code = taosHashPut(sRegexCache.regexHash, pPattern, strlen(pPattern), &pUsingRegex, sizeof(UsingRegex *)); + if (code != 0 && code != TSDB_CODE_DUP_KEY) { + regexCacheFree(&pUsingRegex); + uError("Failed to put regex pattern %s into cache, exception internal error.", pPattern); + return NULL; + } + ppUsingRegex = (UsingRegex **)taosHashAcquire(sRegexCache.regexHash, pPattern, strlen(pPattern)); + if (ppUsingRegex) { + if (*ppUsingRegex != pUsingRegex) { + regexCacheFree(&pUsingRegex); + } + pUsingRegex = (*ppUsingRegex); + break; + } else { + continue; + } + } + pUsingRegex->lastUsedTime = taosGetTimestampSec(); + return ppUsingRegex; } -void DestoryThreadLocalRegComp() { - if (NULL != pOldPattern) { - regfree(&pRegex); - taosMemoryFree(pOldPattern); - pOldPattern = NULL; - } +void releaseRegComp(UsingRegex **regex){ + taosHashRelease(sRegexCache.regexHash, regex); } static int32_t doExecRegexMatch(const char *pString, const char *pPattern) { int32_t ret = 0; char msgbuf[256] = {0}; - regex_t *regex = threadGetRegComp(pPattern); - if (regex == NULL) { + UsingRegex **pUsingRegex = getRegComp(pPattern); + if (pUsingRegex == NULL) { return 1; } regmatch_t pmatch[1]; - ret = regexec(regex, pString, 1, pmatch, 0); + ret = regexec(&(*pUsingRegex)->pRegex, pString, 1, pmatch, 0); + releaseRegComp(pUsingRegex); if (ret != 0 && ret != REG_NOMATCH) { - regerror(ret, regex, msgbuf, sizeof(msgbuf)); + regerror(ret, &(*pUsingRegex)->pRegex, msgbuf, sizeof(msgbuf)); uDebug("Failed to match %s with pattern %s, reason %s", pString, pPattern, msgbuf) } diff --git a/source/util/src/tconfig.c b/source/util/src/tconfig.c index adde3a3331..3ab0f83238 100644 --- a/source/util/src/tconfig.c +++ b/source/util/src/tconfig.c @@ -96,7 +96,8 @@ void cfgItemFreeVal(SConfigItem *pItem) { } if (pItem->array) { - pItem->array = taosArrayDestroy(pItem->array); + taosArrayDestroy(pItem->array); + pItem->array = NULL; } } diff --git a/source/util/src/tencode.c b/source/util/src/tencode.c index 7f8a0edfdd..aa9f157f3a 100644 --- a/source/util/src/tencode.c +++ b/source/util/src/tencode.c @@ -72,10 +72,14 @@ int32_t tStartEncode(SEncoder* pCoder) { SEncoderNode* pNode; if (pCoder->data) { - if (pCoder->size - pCoder->pos < sizeof(int32_t)) return -1; + if (pCoder->size - pCoder->pos < sizeof(int32_t)) { + TAOS_RETURN(TSDB_CODE_OUT_OF_RANGE); + } pNode = tEncoderMalloc(pCoder, sizeof(*pNode)); - if (pNode == NULL) return -1; + if (pNode == NULL) { + TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY); + } pNode->data = pCoder->data; pNode->pos = pCoder->pos; @@ -111,7 +115,7 @@ void tEndEncode(SEncoder* pCoder) { (void)tEncodeI32(pCoder, len); - TD_CODER_MOVE_POS(pCoder, len); + pCoder->pos += len; } } @@ -119,10 +123,12 @@ int32_t tStartDecode(SDecoder* pCoder) { SDecoderNode* pNode; int32_t len; - if (tDecodeI32(pCoder, &len) < 0) return -1; + TAOS_CHECK_RETURN(tDecodeI32(pCoder, &len)); pNode = tDecoderMalloc(pCoder, sizeof(*pNode)); - if (pNode == NULL) return -1; + if (pNode == NULL) { + TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY); + } pNode->data = pCoder->data; pNode->pos = pCoder->pos; diff --git a/source/util/src/terror.c b/source/util/src/terror.c index c7fd6f65c5..ab50b83937 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -56,6 +56,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_RPC_SOMENODE_NOT_CONNECTED, "some vnode/qnode/mnod TAOS_DEFINE_ERROR(TSDB_CODE_RPC_MAX_SESSIONS, "rpc open too many session") TAOS_DEFINE_ERROR(TSDB_CODE_RPC_NETWORK_ERROR, "rpc network error") TAOS_DEFINE_ERROR(TSDB_CODE_RPC_NETWORK_BUSY, "rpc network busy") +TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_MODULE_QUIT, "http-report already quit") //common & util TAOS_DEFINE_ERROR(TSDB_CODE_TIME_UNSYNCED, "Client and server's time is not synchronized") @@ -683,6 +684,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_PAR_TBNAME_ERROR, "Pseudo tag tbname n TAOS_DEFINE_ERROR(TSDB_CODE_PAR_TBNAME_DUPLICATED, "Table name duplicated") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_TAG_NAME_DUPLICATED, "Tag name duplicated") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_NOT_ALLOWED_DIFFERENT_BY_ROW_FUNC, "Some functions cannot appear in the select list at the same time") +TAOS_DEFINE_ERROR(TSDB_CODE_PAR_REGULAR_EXPRESSION_ERROR, "Syntax error in regular expression") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INTERNAL_ERROR, "Parser internal error") //planner @@ -787,6 +789,10 @@ TAOS_DEFINE_ERROR(TSDB_CODE_TDLITE_IVLD_OPEN_DIR, "Invalid TDLite open TAOS_DEFINE_ERROR(TSDB_CODE_UTIL_QUEUE_OUT_OF_MEMORY, "Queue out of memory") +//AUDIT +TAOS_DEFINE_ERROR(TSDB_CODE_AUDIT_NOT_FORMAT_TO_JSON, "can't format to json") +TAOS_DEFINE_ERROR(TSDB_CODE_AUDIT_FAIL_SEND_AUDIT_RECORD, "Failed to send out audit record") +TAOS_DEFINE_ERROR(TSDB_CODE_AUDIT_FAIL_GENERATE_JSON, "Failed to generate json") #ifdef TAOS_ERROR_C }; #endif diff --git a/source/util/src/tscalablebf.c b/source/util/src/tscalablebf.c index 7af794546b..4a4dfd2653 100644 --- a/source/util/src/tscalablebf.c +++ b/source/util/src/tscalablebf.c @@ -17,6 +17,7 @@ #include "tscalablebf.h" #include "taoserror.h" +#include "tutil.h" #define DEFAULT_GROWTH 2 #define DEFAULT_TIGHTENING_RATIO 0.5 @@ -24,82 +25,120 @@ #define SBF_INVALID -1 #define SBF_VALID 0 -static SBloomFilter *tScalableBfAddFilter(SScalableBf *pSBf, uint64_t expectedEntries, double errorRate); +static int32_t tScalableBfAddFilter(SScalableBf* pSBf, uint64_t expectedEntries, double errorRate, + SBloomFilter** ppNormalBf); -SScalableBf *tScalableBfInit(uint64_t expectedEntries, double errorRate) { +int32_t tScalableBfInit(uint64_t expectedEntries, double errorRate, SScalableBf** ppSBf) { + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; const uint32_t defaultSize = 8; if (expectedEntries < 1 || errorRate <= 0 || errorRate >= 1.0) { - return NULL; + code = TSDB_CODE_FAILED; + TSDB_CHECK_CODE(code, lino, _error); } - SScalableBf *pSBf = taosMemoryCalloc(1, sizeof(SScalableBf)); + SScalableBf* pSBf = taosMemoryCalloc(1, sizeof(SScalableBf)); if (pSBf == NULL) { - return NULL; + code = TSDB_CODE_OUT_OF_MEMORY; + TSDB_CHECK_CODE(code, lino, _error); } pSBf->maxBloomFilters = DEFAULT_MAX_BLOOMFILTERS; pSBf->status = SBF_VALID; pSBf->numBits = 0; - pSBf->bfArray = taosArrayInit(defaultSize, sizeof(void *)); - if (tScalableBfAddFilter(pSBf, expectedEntries, errorRate * DEFAULT_TIGHTENING_RATIO) == NULL) { + pSBf->bfArray = taosArrayInit(defaultSize, sizeof(void*)); + if (!pSBf->bfArray) { + code = TSDB_CODE_OUT_OF_MEMORY; + TSDB_CHECK_CODE(code, lino, _error); + } + + SBloomFilter* pNormalBf = NULL; + code = tScalableBfAddFilter(pSBf, expectedEntries, errorRate * DEFAULT_TIGHTENING_RATIO, &pNormalBf); + if (code != TSDB_CODE_SUCCESS) { tScalableBfDestroy(pSBf); - return NULL; + TSDB_CHECK_CODE(code, lino, _error); } pSBf->growth = DEFAULT_GROWTH; pSBf->hashFn1 = HASH_FUNCTION_1; pSBf->hashFn2 = HASH_FUNCTION_2; - return pSBf; + (*ppSBf) = pSBf; + return TSDB_CODE_SUCCESS; + +_error: + uError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + return code; } -int32_t tScalableBfPutNoCheck(SScalableBf *pSBf, const void *keyBuf, uint32_t len) { +int32_t tScalableBfPutNoCheck(SScalableBf* pSBf, const void* keyBuf, uint32_t len) { + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; if (pSBf->status == SBF_INVALID) { - return TSDB_CODE_FAILED; + code = TSDB_CODE_FAILED; + TSDB_CHECK_CODE(code, lino, _error); + } + int32_t size = taosArrayGetSize(pSBf->bfArray); + SBloomFilter* pNormalBf = taosArrayGetP(pSBf->bfArray, size - 1); + if (!pNormalBf) { + code = TSDB_CODE_OUT_OF_MEMORY; + TSDB_CHECK_CODE(code, lino, _error); } - int32_t size = taosArrayGetSize(pSBf->bfArray); - SBloomFilter *pNormalBf = taosArrayGetP(pSBf->bfArray, size - 1); - ASSERT(pNormalBf); if (tBloomFilterIsFull(pNormalBf)) { - pNormalBf = tScalableBfAddFilter(pSBf, pNormalBf->expectedEntries * pSBf->growth, - pNormalBf->errorRate * DEFAULT_TIGHTENING_RATIO); - if (pNormalBf == NULL) { + code = tScalableBfAddFilter(pSBf, pNormalBf->expectedEntries * pSBf->growth, + pNormalBf->errorRate * DEFAULT_TIGHTENING_RATIO, &pNormalBf); + if (code != TSDB_CODE_SUCCESS) { pSBf->status = SBF_INVALID; - return TSDB_CODE_OUT_OF_MEMORY; + TSDB_CHECK_CODE(code, lino, _error); } } return tBloomFilterPut(pNormalBf, keyBuf, len); + +_error: + if (code != TSDB_CODE_SUCCESS) { + uError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } + return code; } -int32_t tScalableBfPut(SScalableBf *pSBf, const void *keyBuf, uint32_t len) { +int32_t tScalableBfPut(SScalableBf* pSBf, const void* keyBuf, uint32_t len) { + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; if (pSBf->status == SBF_INVALID) { - return TSDB_CODE_FAILED; + code = TSDB_CODE_FAILED; + TSDB_CHECK_CODE(code, lino, _error); } uint64_t h1 = (uint64_t)pSBf->hashFn1(keyBuf, len); uint64_t h2 = (uint64_t)pSBf->hashFn2(keyBuf, len); - int32_t size = taosArrayGetSize(pSBf->bfArray); + int32_t size = taosArrayGetSize(pSBf->bfArray); for (int32_t i = size - 2; i >= 0; --i) { if (tBloomFilterNoContain(taosArrayGetP(pSBf->bfArray, i), h1, h2) != TSDB_CODE_SUCCESS) { return TSDB_CODE_FAILED; } } - SBloomFilter *pNormalBf = taosArrayGetP(pSBf->bfArray, size - 1); + SBloomFilter* pNormalBf = taosArrayGetP(pSBf->bfArray, size - 1); ASSERT(pNormalBf); if (tBloomFilterIsFull(pNormalBf)) { - pNormalBf = tScalableBfAddFilter(pSBf, pNormalBf->expectedEntries * pSBf->growth, - pNormalBf->errorRate * DEFAULT_TIGHTENING_RATIO); - if (pNormalBf == NULL) { + code = tScalableBfAddFilter(pSBf, pNormalBf->expectedEntries * pSBf->growth, + pNormalBf->errorRate * DEFAULT_TIGHTENING_RATIO, &pNormalBf); + if (code != TSDB_CODE_SUCCESS) { pSBf->status = SBF_INVALID; - return TSDB_CODE_OUT_OF_MEMORY; + TSDB_CHECK_CODE(code, lino, _error); } } return tBloomFilterPutHash(pNormalBf, h1, h2); + +_error: + if (code != TSDB_CODE_SUCCESS) { + uError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } + return code; } -int32_t tScalableBfNoContain(const SScalableBf *pSBf, const void *keyBuf, uint32_t len) { +int32_t tScalableBfNoContain(const SScalableBf* pSBf, const void* keyBuf, uint32_t len) { if (pSBf->status == SBF_INVALID) { return TSDB_CODE_FAILED; } uint64_t h1 = (uint64_t)pSBf->hashFn1(keyBuf, len); uint64_t h2 = (uint64_t)pSBf->hashFn2(keyBuf, len); - int32_t size = taosArrayGetSize(pSBf->bfArray); + int32_t size = taosArrayGetSize(pSBf->bfArray); for (int32_t i = size - 1; i >= 0; --i) { if (tBloomFilterNoContain(taosArrayGetP(pSBf->bfArray, i), h1, h2) != TSDB_CODE_SUCCESS) { return TSDB_CODE_FAILED; @@ -108,24 +147,35 @@ int32_t tScalableBfNoContain(const SScalableBf *pSBf, const void *keyBuf, uint32 return TSDB_CODE_SUCCESS; } -static SBloomFilter *tScalableBfAddFilter(SScalableBf *pSBf, uint64_t expectedEntries, double errorRate) { +static int32_t tScalableBfAddFilter(SScalableBf* pSBf, uint64_t expectedEntries, double errorRate, + SBloomFilter** ppNormalBf) { + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; if (taosArrayGetSize(pSBf->bfArray) >= pSBf->maxBloomFilters) { - return NULL; + code = TSDB_CODE_FAILED; + TSDB_CHECK_CODE(code, lino, _error); } - SBloomFilter *pNormalBf = tBloomFilterInit(expectedEntries, errorRate); - if (pNormalBf == NULL) { - return NULL; - } + SBloomFilter* pNormalBf = NULL; + code = tBloomFilterInit(expectedEntries, errorRate, &pNormalBf); + TSDB_CHECK_CODE(code, lino, _error); + if (taosArrayPush(pSBf->bfArray, &pNormalBf) == NULL) { tBloomFilterDestroy(pNormalBf); - return NULL; + code = TSDB_CODE_OUT_OF_MEMORY; + TSDB_CHECK_CODE(code, lino, _error); } pSBf->numBits += pNormalBf->numBits; - return pNormalBf; + (*ppNormalBf) = pNormalBf; + +_error: + if (code != TSDB_CODE_SUCCESS) { + uError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } + return code; } -void tScalableBfDestroy(SScalableBf *pSBf) { +void tScalableBfDestroy(SScalableBf* pSBf) { if (pSBf == NULL) { return; } @@ -135,7 +185,7 @@ void tScalableBfDestroy(SScalableBf *pSBf) { taosMemoryFree(pSBf); } -int32_t tScalableBfEncode(const SScalableBf *pSBf, SEncoder *pEncoder) { +int32_t tScalableBfEncode(const SScalableBf* pSBf, SEncoder* pEncoder) { if (!pSBf) { if (tEncodeI32(pEncoder, 0) < 0) return -1; return 0; @@ -143,7 +193,7 @@ int32_t tScalableBfEncode(const SScalableBf *pSBf, SEncoder *pEncoder) { int32_t size = taosArrayGetSize(pSBf->bfArray); if (tEncodeI32(pEncoder, size) < 0) return -1; for (int32_t i = 0; i < size; i++) { - SBloomFilter *pBF = taosArrayGetP(pSBf->bfArray, i); + SBloomFilter* pBF = taosArrayGetP(pSBf->bfArray, i); if (tBloomFilterEncode(pBF, pEncoder) < 0) return -1; } if (tEncodeU32(pEncoder, pSBf->growth) < 0) return -1; @@ -153,30 +203,61 @@ int32_t tScalableBfEncode(const SScalableBf *pSBf, SEncoder *pEncoder) { return 0; } -SScalableBf *tScalableBfDecode(SDecoder *pDecoder) { - SScalableBf *pSBf = taosMemoryCalloc(1, sizeof(SScalableBf)); +int32_t tScalableBfDecode(SDecoder* pDecoder, SScalableBf** ppSBf) { + int32_t code = TSDB_CODE_SUCCESS; + int32_t lino = 0; + SScalableBf* pSBf = taosMemoryCalloc(1, sizeof(SScalableBf)); + if (!pSBf) { + code = TSDB_CODE_OUT_OF_MEMORY; + TSDB_CHECK_CODE(code, lino, _error); + } pSBf->hashFn1 = HASH_FUNCTION_1; pSBf->hashFn2 = HASH_FUNCTION_2; pSBf->bfArray = NULL; int32_t size = 0; - if (tDecodeI32(pDecoder, &size) < 0) goto _error; - if (size == 0) { - tScalableBfDestroy(pSBf); - return NULL; + if (tDecodeI32(pDecoder, &size) < 0) { + code = TSDB_CODE_FAILED; + TSDB_CHECK_CODE(code, lino, _error); } - pSBf->bfArray = taosArrayInit(size * 2, sizeof(void *)); + if (size == 0) { + code = TSDB_CODE_FAILED; + TSDB_CHECK_CODE(code, lino, _error); + } + pSBf->bfArray = taosArrayInit(size * 2, POINTER_BYTES); + if (!pSBf->bfArray) { + code = TSDB_CODE_OUT_OF_MEMORY; + TSDB_CHECK_CODE(code, lino, _error); + } + for (int32_t i = 0; i < size; i++) { - SBloomFilter *pBF = tBloomFilterDecode(pDecoder); - if (!pBF) goto _error; + SBloomFilter* pBF = NULL; + code = tBloomFilterDecode(pDecoder, &pBF); + TSDB_CHECK_CODE(code, lino, _error); taosArrayPush(pSBf->bfArray, &pBF); } - if (tDecodeU32(pDecoder, &pSBf->growth) < 0) goto _error; - if (tDecodeU64(pDecoder, &pSBf->numBits) < 0) goto _error; - if (tDecodeU32(pDecoder, &pSBf->maxBloomFilters) < 0) goto _error; - if (tDecodeI8(pDecoder, &pSBf->status) < 0) goto _error; - return pSBf; + if (tDecodeU32(pDecoder, &pSBf->growth) < 0) { + code = TSDB_CODE_FAILED; + TSDB_CHECK_CODE(code, lino, _error); + } + if (tDecodeU64(pDecoder, &pSBf->numBits) < 0) { + code = TSDB_CODE_FAILED; + TSDB_CHECK_CODE(code, lino, _error); + } + if (tDecodeU32(pDecoder, &pSBf->maxBloomFilters) < 0) { + code = TSDB_CODE_FAILED; + TSDB_CHECK_CODE(code, lino, _error); + } + if (tDecodeI8(pDecoder, &pSBf->status) < 0) { + code = TSDB_CODE_FAILED; + TSDB_CHECK_CODE(code, lino, _error); + } + (*ppSBf) = pSBf; _error: - tScalableBfDestroy(pSBf); - return NULL; + + if (code != TSDB_CODE_SUCCESS) { + tScalableBfDestroy(pSBf); + uError("%s failed at line %d since %s", __func__, lino, tstrerror(code)); + } + return code; } diff --git a/source/util/src/tworker.c b/source/util/src/tworker.c index 4a8a0823b7..7a97dc3527 100644 --- a/source/util/src/tworker.c +++ b/source/util/src/tworker.c @@ -104,7 +104,6 @@ static void *tQWorkerThreadFp(SQueueWorker *worker) { } destroyThreadLocalGeosCtx(); - DestoryThreadLocalRegComp(); return NULL; } @@ -224,7 +223,6 @@ static void *tAutoQWorkerThreadFp(SQueueWorker *worker) { taosUpdateItemSize(qinfo.queue, 1); } - DestoryThreadLocalRegComp(); return NULL; } @@ -636,7 +634,6 @@ static void *tQueryAutoQWorkerThreadFp(SQueryAutoQWorker *worker) { } destroyThreadLocalGeosCtx(); - DestoryThreadLocalRegComp(); return NULL; } diff --git a/source/util/test/bloomFilterTest.cpp b/source/util/test/bloomFilterTest.cpp index c51de3c8a4..9d83cbf086 100644 --- a/source/util/test/bloomFilterTest.cpp +++ b/source/util/test/bloomFilterTest.cpp @@ -8,12 +8,15 @@ using namespace std; TEST(TD_UTIL_BLOOMFILTER_TEST, normal_bloomFilter) { int64_t ts1 = 1650803518000; - GTEST_ASSERT_EQ(NULL, tBloomFilterInit(100, 0)); - GTEST_ASSERT_EQ(NULL, tBloomFilterInit(100, 1)); - GTEST_ASSERT_EQ(NULL, tBloomFilterInit(100, -0.1)); - GTEST_ASSERT_EQ(NULL, tBloomFilterInit(0, 0.01)); + SBloomFilter* pBFTmp = NULL; + GTEST_ASSERT_NE(0, tBloomFilterInit(100, 0, &pBFTmp)); + GTEST_ASSERT_NE(0, tBloomFilterInit(100, 1, &pBFTmp)); + GTEST_ASSERT_NE(0, tBloomFilterInit(100, -0.1, &pBFTmp)); + GTEST_ASSERT_NE(0, tBloomFilterInit(0, 0.01, &pBFTmp)); - SBloomFilter *pBF1 = tBloomFilterInit(100, 0.005); + SBloomFilter *pBF1 = NULL; + int32_t code = tBloomFilterInit(100, 0.005, &pBF1); + GTEST_ASSERT_EQ(0, code); GTEST_ASSERT_EQ(pBF1->numBits, 1152); GTEST_ASSERT_EQ(pBF1->numUnits, 1152 / 64); int64_t count = 0; @@ -25,16 +28,19 @@ TEST(TD_UTIL_BLOOMFILTER_TEST, normal_bloomFilter) { } ASSERT_TRUE(tBloomFilterIsFull(pBF1)); - SBloomFilter *pBF2 = tBloomFilterInit(1000 * 10000, 0.1); + SBloomFilter* pBF2 = NULL; + GTEST_ASSERT_EQ(0, tBloomFilterInit(1000 * 10000, 0.1, &pBF2)); GTEST_ASSERT_EQ(pBF2->numBits, 47925312); GTEST_ASSERT_EQ(pBF2->numUnits, 47925312 / 64); - SBloomFilter *pBF3 = tBloomFilterInit(10000 * 10000, 0.001); + SBloomFilter* pBF3 = NULL; + GTEST_ASSERT_EQ(0, tBloomFilterInit(10000 * 10000, 0.001, &pBF3)); GTEST_ASSERT_EQ(pBF3->numBits, 1437758784); GTEST_ASSERT_EQ(pBF3->numUnits, 1437758784 / 64); int64_t size = 10000; - SBloomFilter *pBF4 = tBloomFilterInit(size, 0.001); + SBloomFilter* pBF4 = NULL; + GTEST_ASSERT_EQ(0, tBloomFilterInit(size, 0.001, &pBF4)); for (int64_t i = 0; i < 1000; i++) { int64_t ts = i + ts1; GTEST_ASSERT_EQ(tBloomFilterPut(pBF4, &ts, sizeof(int64_t)), TSDB_CODE_SUCCESS); @@ -42,17 +48,17 @@ TEST(TD_UTIL_BLOOMFILTER_TEST, normal_bloomFilter) { ASSERT_TRUE(!tBloomFilterIsFull(pBF4)); for (int64_t i = 0; i < 1000; i++) { - int64_t ts = i + ts1; - uint64_t h1 = (uint64_t) pBF4->hashFn1((const char*)&ts, sizeof(int64_t)); - uint64_t h2 = (uint64_t) pBF4->hashFn2((const char*)&ts, sizeof(int64_t)); + int64_t ts = i + ts1; + uint64_t h1 = (uint64_t)pBF4->hashFn1((const char*)&ts, sizeof(int64_t)); + uint64_t h2 = (uint64_t)pBF4->hashFn2((const char*)&ts, sizeof(int64_t)); GTEST_ASSERT_EQ(tBloomFilterNoContain(pBF4, h1, h2), TSDB_CODE_FAILED); } for (int64_t i = 2000; i < 3000; i++) { - int64_t ts = i + ts1; - uint64_t h1 = (uint64_t) pBF4->hashFn1((const char*)&ts, sizeof(int64_t)); - uint64_t h2 = (uint64_t) pBF4->hashFn2((const char*)&ts, sizeof(int64_t)); - GTEST_ASSERT_EQ(tBloomFilterNoContain(pBF4, h1, h2), TSDB_CODE_SUCCESS); + int64_t ts = i + ts1; + uint64_t h1 = (uint64_t)pBF4->hashFn1((const char*)&ts, sizeof(int64_t)); + uint64_t h2 = (uint64_t)pBF4->hashFn2((const char*)&ts, sizeof(int64_t)); + GTEST_ASSERT_EQ(tBloomFilterNoContain(pBF4, h1, h2), TSDB_CODE_SUCCESS); } tBloomFilterDestroy(pBF1); @@ -64,12 +70,14 @@ TEST(TD_UTIL_BLOOMFILTER_TEST, normal_bloomFilter) { TEST(TD_UTIL_BLOOMFILTER_TEST, scalable_bloomFilter) { int64_t ts1 = 1650803518000; - GTEST_ASSERT_EQ(NULL, tScalableBfInit(100, 0)); - GTEST_ASSERT_EQ(NULL, tScalableBfInit(100, 1)); - GTEST_ASSERT_EQ(NULL, tScalableBfInit(100, -0.1)); - GTEST_ASSERT_EQ(NULL, tScalableBfInit(0, 0.01)); + SScalableBf* tsSBF = NULL; + GTEST_ASSERT_NE(0, tScalableBfInit(100, 0, &tsSBF)); + GTEST_ASSERT_NE(0, tScalableBfInit(100, 1, &tsSBF)); + GTEST_ASSERT_NE(0, tScalableBfInit(100, -0.1, &tsSBF)); + GTEST_ASSERT_NE(0, tScalableBfInit(0, 0.01, &tsSBF)); - SScalableBf *pSBF1 = tScalableBfInit(100, 0.01); + SScalableBf* pSBF1 = NULL; + GTEST_ASSERT_EQ(0, tScalableBfInit(100, 0.01, &pSBF1)); GTEST_ASSERT_EQ(pSBF1->numBits, 1152); int64_t count = 0; int64_t index = 0; @@ -108,7 +116,7 @@ TEST(TD_UTIL_BLOOMFILTER_TEST, scalable_bloomFilter) { int32_t aSize = taosArrayGetSize(pSBF1->bfArray); int64_t totalBits = 0; for (int64_t i = 0; i < aSize; i++) { - SBloomFilter *pBF = (SBloomFilter *)taosArrayGetP(pSBF1->bfArray, i); + SBloomFilter* pBF = (SBloomFilter*)taosArrayGetP(pSBF1->bfArray, i); ASSERT_TRUE(tBloomFilterIsFull(pBF)); totalBits += pBF->numBits; } @@ -120,7 +128,8 @@ TEST(TD_UTIL_BLOOMFILTER_TEST, scalable_bloomFilter) { } int64_t size = 10000; - SScalableBf *pSBF4 = tScalableBfInit(size, 0.001); + SScalableBf* pSBF4 = NULL; + GTEST_ASSERT_EQ(0, tScalableBfInit(size, 0.001, &pSBF4)); for (int64_t i = 0; i < 1000; i++) { int64_t ts = i + ts1; GTEST_ASSERT_EQ(tScalableBfPut(pSBF4, &ts, sizeof(int64_t)), TSDB_CODE_SUCCESS); diff --git a/tests/army/query/function/cast.py b/tests/army/query/function/cast.py new file mode 100644 index 0000000000..66718ce715 --- /dev/null +++ b/tests/army/query/function/cast.py @@ -0,0 +1,183 @@ +# -*- coding: utf-8 -*- + +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame.caseBase import * +from frame import * + + +class TDTestCase(TBase): + def init(self, conn, logSql, replicaVar=1): + tdLog.debug(f"start to excute {__file__}") + tdSql.init(conn.cursor(), True) + self.dbname = "cast_db" + self._datetime_epoch = datetime.datetime.fromtimestamp(0) + + def cast_without_from(self): + # int + int_num = 2147483648 + tdSql.query(f"select cast({int_num} as int) re;") + tdSql.checkData(0, 0, -int_num) + + tdSql.query(f"select cast(2147483647 as int) re;") + tdSql.checkData(0, 0, 2147483647) + + tdSql.query(f"select cast({int_num} as int unsigned) re;") + tdSql.checkData(0, 0, int_num) + + tdSql.query(f"select cast({int_num} as bigint) re;") + tdSql.checkData(0, 0, int_num) + + tdSql.query(f"select cast({int_num} as bigint unsigned) re;") + tdSql.checkData(0, 0, int_num) + + tdSql.query(f"select cast({int_num} as smallint) re;") + tdSql.checkData(0, 0, 0) + + tdSql.query(f"select cast({int_num} as smallint unsigned) re;") + tdSql.checkData(0, 0, 0) + + tdSql.query(f"select cast({int_num} as tinyint) re;") + tdSql.checkData(0, 0, 0) + + tdSql.query(f"select cast({int_num} as tinyint unsigned) re;") + tdSql.checkData(0, 0, 0) + + tdSql.query(f"select cast({int_num} as float) re;") + tdSql.checkData(0, 0, '2147483648.0') + + tdSql.query(f"select cast({int_num} as double) re;") + tdSql.checkData(0, 0, '2147483648.0') + + tdSql.query(f"select cast({int_num} as bool) as re;") + tdSql.checkData(0, 0, True) + + tdSql.query(f"select cast({int_num} as timestamp) as re;") + tdSql.checkData(0, 0, self._datetime_epoch + datetime.timedelta(seconds=int(int_num) / 1000)) + + tdSql.query(f"select cast({int_num} as varchar(10)) as re;") + tdSql.checkData(0, 0, int_num) + + tdSql.query(f"select cast({int_num} as binary(10)) as re;") + tdSql.checkData(0, 0, int_num) + + sql = f"select cast({int_num} as nchar(10));" + tdSql.query(sql) + tdSql.checkData(0, 0, int_num) + + # float + float_1001 = 3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196442881097566593344612847564823378678316527120190914564856692346034861045432664821339360726024914127372458700660631558817488152092096282925409171536436789259036001133053054882046652138414695194151160943305727036575959195309218611738193261179310511854807446237996274956735188575272489122793818301194912983367336244065664308602139494639522473719070217986094370277053921717629317675238467481846766940513200056812714526356082778577134275778960917363717872146844090122495343014654958537105079227968925892354201995611212902196086403441815981362977477130996051870721134999999837297804995105973173281609631859502445945534690830264252230825334468503526193118817101000313783875288658753320838142061717766914730359825349042875546873115956286388235378759375195778185778053217122680661300192787661119590921642019 + + tdSql.query(f"select cast({float_1001} as int) as re;") + tdSql.checkData(0, 0, 3) + + tdSql.query(f"select cast({float_1001} as int unsigned) as re;") + tdSql.checkData(0, 0, 3) + + tdSql.query(f"select cast({float_1001} as tinyint) as re;") + tdSql.checkData(0, 0, 3) + + tdSql.query(f"select cast({float_1001} as tinyint unsigned) as re;") + tdSql.checkData(0, 0, 3) + + tdSql.query(f"select cast({float_1001} as smallint) as re;") + tdSql.checkData(0, 0, 3) + + tdSql.query(f"select cast({float_1001} as smallint unsigned) as re;") + tdSql.checkData(0, 0, 3) + + tdSql.query(f"select cast({float_1001} as bigint) as re;") + tdSql.checkData(0, 0, 3) + + tdSql.query(f"select cast({float_1001} as bigint unsigned) as re;") + tdSql.checkData(0, 0, 3) + + tdSql.query(f"select cast({float_1001} as double) as re;") + tdSql.checkData(0, 0, 3.141592653589793) + + tdSql.query(f"select cast({float_1001} as float) as re;") + tdSql.checkData(0, 0, 3.1415927) + + tdSql.query(f"select cast({float_1001} as bool) as re;") + tdSql.checkData(0, 0, True) + + tdSql.query(f"select cast({float_1001} as timestamp) as re;") + tdSql.checkData(0, 0, self._datetime_epoch + datetime.timedelta(seconds=int(float_1001) / 1000)) + + sql = f"select cast({float_1001} as varchar(5)) as re;" + tdSql.query(sql) + tdSql.checkData(0, 0, 3.141) + + sql = f"select cast({float_1001} as binary(10)) as re;" + tdSql.query(sql) + tdSql.checkData(0, 0, 3.141593) + + tdSql.query(f"select cast({float_1001} as nchar(5));") + tdSql.checkData(0, 0, 3.141) + + # str + str_410 = "bcdefghigk" * 41 + big_str = "bcdefghigk" * 6552 + + tdSql.query(f"select cast('{str_410}' as binary(3)) as re;") + tdSql.checkData(0, 0, "bcd") + + tdSql.query(f"select cast('{str_410}' as varchar(2)) as re;") + tdSql.checkData(0, 0, "bc") + + tdSql.query(f"select cast('{str_410}' as nchar(10));") + tdSql.checkData(0, 0, "bcdefghigk") + + tdSql.query(f"select cast('北京' as nchar(10));") + tdSql.checkData(0, 0, "北京") + + tdSql.query(f"select cast('{str_410}' as int) as re;") + tdSql.checkData(0, 0, 0) + + tdSql.query(f"select cast('{str_410}' as int unsigned) as re;") + tdSql.checkData(0, 0, 0) + + tdSql.query(f"select cast('{str_410}' as tinyint) as re") + tdSql.checkData(0, 0, 0) + + tdSql.query(f"select cast('{str_410}' as tinyint unsigned) as re") + tdSql.checkData(0, 0, 0) + + tdSql.query(f"select cast('{str_410}' as smallint) as re") + tdSql.checkData(0, 0, 0) + + tdSql.query(f"select cast('{str_410}' as smallint unsigned) as re") + tdSql.checkData(0, 0, 0) + + tdSql.query(f"select cast('{str_410}' as bigint) as re") + tdSql.checkData(0, 0, 0) + + tdSql.query(f"select cast('{str_410}' as bigint unsigned) as re") + tdSql.checkData(0, 0, 0) + + tdSql.query(f"select cast('{str_410}' as float) as re;") + tdSql.checkData(0, 0, 0.0000000) + + tdSql.query(f"select cast('{str_410}' as double) as re;") + tdSql.checkData(0, 0, 0.000000000000000) + + tdSql.query(f"select cast('{str_410}' as bool) as re") + tdSql.checkData(0, 0, False) + + tdSql.query( f"select cast('{str_410}' as timestamp) as re") + tdSql.checkData(0, 0, "1970-01-01 08:00:00.000") + + + def run(self): + # self.prepare_data() + # self.all_test() + # tdSql.execute(f"flush database {self.dbname}") + # self.all_test() + self.cast_without_from() + + tdLog.success(f"{__file__} successfully executed") + + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) diff --git a/tests/army/query/queryBugs.py b/tests/army/query/queryBugs.py index f6075f6063..20ecb23881 100644 --- a/tests/army/query/queryBugs.py +++ b/tests/army/query/queryBugs.py @@ -36,7 +36,7 @@ class TDTestCase(TBase): "create table db.st(ts timestamp, age int) tags(area tinyint);", "insert into db.t1 using db.st tags(100) values('2024-01-01 10:00:01', 1);", "insert into db.t2 using db.st tags(110) values('2024-01-01 10:00:02', 2);", - "insert into db.t3 using db.st tags(3) values('2024-01-01 10:00:03', 3);" + "insert into db.t3 using db.st tags(3) values('2024-01-01 10:00:03', 3);", ] tdSql.executes(sqls) @@ -44,7 +44,7 @@ class TDTestCase(TBase): results = [ ["2024-01-01 10:00:01", 1, 100], ["2024-01-01 10:00:02", 2, 110], - ["2024-01-01 10:00:03", 3, 3] + ["2024-01-01 10:00:03", 3, 3], ] tdSql.checkDataMem(sql, results) @@ -99,11 +99,12 @@ class TDTestCase(TBase): for i in range(1, 10): new_ts = base_ts + i * 1000 num = i * 100 + v1, v2 = i * 10, i * 11 sqls = [ - f"insert into ntb1 values({new_ts}, 'nihao{num}', {10*i}, {10*i}, {10*i});", + f"insert into ntb1 values({new_ts}, 'nihao{num}', {v1}, {v1}, {v1});", f"insert into ntb1 values({new_ts + 1}, 'nihao{num + 1}', NULL, NULL, NULL);", f"delete from ntb1 where ts = {new_ts};", - f"insert into ntb1 values({new_ts + 2}, 'nihao{num + 2}', {11*i}, {11*i}, {11*i});", + f"insert into ntb1 values({new_ts + 2}, 'nihao{num + 2}', {v2}, {v2}, {v2});", ] tdSql.executes(sqls) diff --git a/tests/army/s3/s3Basic.json b/tests/army/s3/s3Basic.json index ef1585d2ba..c3fcdb567c 100644 --- a/tests/army/s3/s3Basic.json +++ b/tests/army/s3/s3Basic.json @@ -36,7 +36,7 @@ "insert_rows": 2000000, "childtable_prefix": "d", "insert_mode": "taosc", - "timestamp_step": 1000, + "timestamp_step": 100, "start_timestamp": 1600000000000, "columns": [ { "type": "bool", "name": "bc"}, diff --git a/tests/army/s3/s3Basic.py b/tests/army/s3/s3Basic.py index f94fe611a6..466cc5ab19 100644 --- a/tests/army/s3/s3Basic.py +++ b/tests/army/s3/s3Basic.py @@ -73,7 +73,7 @@ class TDTestCase(TBase): # come from s3_basic.json self.childtable_count = 6 self.insert_rows = 2000000 - self.timestamp_step = 1000 + self.timestamp_step = 100 def createStream(self, sname): sql = f"create stream {sname} fill_history 1 into stm1 as select count(*) from {self.db}.{self.stb} interval(10s);" @@ -262,7 +262,7 @@ class TDTestCase(TBase): # come from s3_basic.json self.insert_rows += self.insert_rows/4 - self.timestamp_step = 500 + self.timestamp_step = 50 # delete def checkDelete(self): diff --git a/tests/army/s3/s3Basic1.json b/tests/army/s3/s3Basic1.json index fb95c14e98..0618c341c9 100644 --- a/tests/army/s3/s3Basic1.json +++ b/tests/army/s3/s3Basic1.json @@ -36,7 +36,7 @@ "insert_rows": 1000000, "childtable_prefix": "d", "insert_mode": "taosc", - "timestamp_step": 500, + "timestamp_step": 50, "start_timestamp": 1600000000000, "columns": [ { "type": "bool", "name": "bc"}, diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 4338187791..848917ceb5 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -15,6 +15,7 @@ ,,n,army,python3 ./test.py -f s3/s3Basic.py -N 3 ,,y,army,./pytest.sh python3 ./test.py -f cluster/snapshot.py -N 3 -L 3 -D 2 ,,y,army,./pytest.sh python3 ./test.py -f query/function/test_func_elapsed.py +,,y,army,./pytest.sh python3 ./test.py -f query/function/cast.py ,,y,army,./pytest.sh python3 ./test.py -f query/test_join.py ,,y,army,./pytest.sh python3 ./test.py -f query/test_compare.py ,,y,army,./pytest.sh python3 ./test.py -f insert/test_column_tag_boundary.py @@ -192,6 +193,10 @@ ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/like.py -Q 2 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/like.py -Q 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/like.py -Q 4 +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/match.py +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/match.py -Q 2 +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/match.py -Q 3 +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/match.py -Q 4 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/td-28068.py ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/td-28068.py -Q 2 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/td-28068.py -Q 3 diff --git a/tests/script/tsim/insert/update2.sim b/tests/script/tsim/insert/update2.sim index d2b5b05267..8ea767da0e 100644 --- a/tests/script/tsim/insert/update2.sim +++ b/tests/script/tsim/insert/update2.sim @@ -120,7 +120,8 @@ endi if $data01 != 2 then return -1 endi -if $data02 != 1 then +if $data02 != 1 then + print expect 1 , actual $data02 return -1 endi if $data03 != 1 then diff --git a/tests/system-test/2-query/match.py b/tests/system-test/2-query/match.py new file mode 100644 index 0000000000..cd2ed5d96b --- /dev/null +++ b/tests/system-test/2-query/match.py @@ -0,0 +1,141 @@ +import taos +import sys +import datetime +import inspect +import threading +import time + +from util.log import * +from util.sql import * +from util.cases import * +from util.common import tdCom + +class TDTestCase: + + def init(self, conn, logSql, replicaVar=1): + self.replicaVar = int(replicaVar) + tdLog.debug(f"start to excute {__file__}") + tdSql.init(conn.cursor(), True) + + def initConnection(self): + self.records = 10000000 + self.numOfTherads = 50 + self.ts = 1537146000000 + self.host = "127.0.0.1" + self.user = "root" + self.password = "taosdata" + self.config = "/home/xp/git/TDengine/sim/dnode1/cfg" + self.conn = taos.connect( + self.host, + self.user, + self.password, + self.config) + + def initDB(self): + tdSql.execute("drop database if exists db") + tdSql.execute("create database if not exists db") + + def stopTest(self): + tdSql.execute("drop database if exists db") + + def threadTest(self, threadID): + print(f"Thread {threadID} starting...") + tdsqln = tdCom.newTdSql() + for i in range(2, 50): + tdsqln.query(f"select distinct table_name from information_schema.ins_columns where table_name match 't.*{i}dx'") + tdsqln.checkRows(0) + for i in range(100): + tdsqln.query(f"select distinct table_name from information_schema.ins_columns where table_name match 't.*1x'") + tdsqln.checkRows(2) + + tdsqln.query("select * from db.t1x") + tdsqln.checkRows(5) + + tdsqln.query("select * from db.t1x where c1 match '_c'") + tdsqln.checkRows(2) + + tdsqln.query("select * from db.t1x where c1 match '%__c'") + tdsqln.checkRows(0) + + tdsqln.error("select * from db.t1x where c1 match '*d'") + + print(f"Thread {threadID} finished.") + + def match_test(self): + tdSql.execute("create table db.t1x (ts timestamp, c1 varchar(100))") + tdSql.execute("create table db.t_1x (ts timestamp, c1 varchar(100))") + + tdSql.query(f"select distinct table_name from information_schema.ins_columns where table_name match 't.*1x'") + tdSql.checkRows(2) + for i in range(2, 50): + tdSql.query(f"select distinct table_name from information_schema.ins_columns where table_name match 't.*{i}x'") + tdSql.checkRows(0) + + tdSql.error("select * from db.t1x where c1 match '*d'") + tdSql.query("insert into db.t1x values(now, 'abc'), (now+1s, 'a%c'),(now+2s, 'a_c'),(now+3s, '_c'),(now+4s, '%c')") + + tdSql.query("select * from db.t1x") + tdSql.checkRows(5) + + tdSql.query("select * from db.t1x where c1 match '_c'") + tdSql.checkRows(2) + + tdSql.query("select * from db.t1x where c1 match '%__c'") + tdSql.checkRows(0) + tdSql.error("select * from db.t1x where c1 match '*d'") + threads = [] + for i in range(10): + t = threading.Thread(target=self.threadTest, args=(i,)) + threads.append(t) + t.start() + + time.sleep(31) + + tdSql.query(f"select distinct table_name from information_schema.ins_columns where table_name match 't.*1x'") + tdSql.checkRows(2) + for i in range(2, 50): + tdSql.query(f"select distinct table_name from information_schema.ins_columns where table_name match 't.*{i}x'") + tdSql.checkRows(0) + + tdSql.query("select * from db.t1x") + tdSql.checkRows(5) + + tdSql.query("select * from db.t1x where c1 match '_c'") + tdSql.checkRows(2) + + tdSql.query("select * from db.t1x where c1 match '%__c'") + tdSql.checkRows(0) + + tdSql.execute("create table db.t3x (ts timestamp, c1 varchar(100))") + + tdSql.execute("insert into db.t3x values(now, '我是中文'), (now+1s, '我是_中文'), (now+2s, '我是%中文'), (now+3s, '%中文'),(now+4s, '_中文')") + tdSql.query("select * from db.t3x where c1 match '%中文'") + tdSql.checkRows(2) + tdSql.query("select * from db.t3x where c1 match '中文'") + tdSql.checkRows(5) + tdSql.error("select * from db.t1x where c1 match '*d'") + + for thread in threads: + print(f"Thread waitting for finish...") + thread.join() + + print(f"Mutithread test finished.") + + def run(self): + tdLog.printNoPrefix("==========start match_test run ...............") + tdSql.prepare(replica = self.replicaVar) + + self.initConnection() + + self.initDB() + self.match_test() + + self.stopTest() + + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) diff --git a/tests/system-test/win-test-file b/tests/system-test/win-test-file index 96f9452827..cdc4e27f20 100644 --- a/tests/system-test/win-test-file +++ b/tests/system-test/win-test-file @@ -104,6 +104,10 @@ python3 ./test.py -f 2-query/like.py python3 ./test.py -f 2-query/like.py -Q 2 python3 ./test.py -f 2-query/like.py -Q 3 python3 ./test.py -f 2-query/like.py -Q 4 +python3 ./test.py -f 2-query/match.py +python3 ./test.py -f 2-query/match.py -Q 2 +python3 ./test.py -f 2-query/match.py -Q 3 +python3 ./test.py -f 2-query/match.py -Q 4 python3 ./test.py -f 3-enterprise/restore/restoreDnode.py -N 5 -M 3 -i False python3 ./test.py -f 3-enterprise/restore/restoreVnode.py -N 5 -M 3 -i False python3 ./test.py -f 3-enterprise/restore/restoreMnode.py -N 5 -M 3 -i False diff --git a/tools/shell/src/shellArguments.c b/tools/shell/src/shellArguments.c index 8368837cc4..1eb61d2394 100644 --- a/tools/shell/src/shellArguments.c +++ b/tools/shell/src/shellArguments.c @@ -311,7 +311,7 @@ static void shellInitArgs(int argc, char *argv[]) { if (strlen(argv[i]) == 2) { printf("Enter password: "); taosSetConsoleEcho(false); - if (scanf("%20s", shell.args.password) > 1) { + if (scanf("%128s", shell.args.password) > 1) { fprintf(stderr, "password reading error\n"); } taosSetConsoleEcho(true); diff --git a/utils/test/c/sml_test.c b/utils/test/c/sml_test.c index 2338674ae3..a3830d2518 100644 --- a/utils/test/c/sml_test.c +++ b/utils/test/c/sml_test.c @@ -121,7 +121,8 @@ int smlProcess_json1_Test() { char *sql1[1] = {0}; for (int i = 0; i < 1; i++) { sql1[i] = taosMemoryCalloc(1, 1024); - strncpy(sql1[i], sql[i], 1023); + ASSERT(sql1[i] != NULL); + (void)strncpy(sql1[i], sql[i], 1023); } pRes = taos_schemaless_insert(taos, (char **)sql1, sizeof(sql1) / sizeof(sql1[0]), TSDB_SML_JSON_PROTOCOL, @@ -149,7 +150,8 @@ int smlProcess_json1_Test() { char *sql3[1] = {0}; for (int i = 0; i < 1; i++) { sql3[i] = taosMemoryCalloc(1, 1024); - strncpy(sql3[i], sql2[i], 1023); + ASSERT(sql3[i] != NULL); + (void)strncpy(sql3[i], sql2[i], 1023); } pRes = taos_schemaless_insert(taos, (char **)sql3, sizeof(sql3) / sizeof(sql3[0]), TSDB_SML_JSON_PROTOCOL, @@ -176,7 +178,8 @@ int smlProcess_json1_Test() { char *sql5[1] = {0}; for (int i = 0; i < 1; i++) { sql5[i] = taosMemoryCalloc(1, 1024); - strncpy(sql5[i], sql4[i], 1023); + ASSERT(sql5[i] != NULL); + (void)strncpy(sql5[i], sql4[i], 1023); } pRes = taos_schemaless_insert(taos, (char **)sql5, sizeof(sql5) / sizeof(sql5[0]), TSDB_SML_JSON_PROTOCOL, @@ -215,7 +218,8 @@ int smlProcess_json2_Test() { char *sql1[1] = {0}; for (int i = 0; i < 1; i++) { sql1[i] = taosMemoryCalloc(1, 1024); - strncpy(sql1[i], sql[i], 1023); + ASSERT(sql1[i] != NULL); + (void)strncpy(sql1[i], sql[i], 1023); } pRes = taos_schemaless_insert(taos, (char **)sql1, sizeof(sql1) / sizeof(sql1[0]), TSDB_SML_JSON_PROTOCOL, @@ -249,7 +253,8 @@ int smlProcess_json3_Test() { char *sql1[1] = {0}; for (int i = 0; i < 1; i++) { sql1[i] = taosMemoryCalloc(1, 1024); - strncpy(sql1[i], sql[i], 1023); + ASSERT(sql1[i] != NULL); + (void)strncpy(sql1[i], sql[i], 1023); } pRes = taos_schemaless_insert(taos, (char **)sql1, sizeof(sql1) / sizeof(sql1[0]), TSDB_SML_JSON_PROTOCOL, @@ -286,7 +291,8 @@ int smlProcess_json_tag_not_same_Test() { char *sql1[1] = {0}; for (int i = 0; i < 1; i++) { sql1[i] = taosMemoryCalloc(1, 1024); - strncpy(sql1[i], sql[i], 1023); + ASSERT(sql1[i] != NULL); + (void)strncpy(sql1[i], sql[i], 1023); } pRes = taos_schemaless_insert(taos, (char **)sql1, sizeof(sql1) / sizeof(sql1[0]), TSDB_SML_JSON_PROTOCOL, @@ -312,7 +318,8 @@ int smlProcess_json_tag_not_same_Test() { char *sql3[1] = {0}; for (int i = 0; i < 1; i++) { sql3[i] = taosMemoryCalloc(1, 1024); - strncpy(sql3[i], sql2[i], 1023); + ASSERT(sql3[i] != NULL); + (void)strncpy(sql3[i], sql2[i], 1023); } pRes = taos_schemaless_insert(taos, (char **)sql3, sizeof(sql3) / sizeof(sql3[0]), TSDB_SML_JSON_PROTOCOL, @@ -338,7 +345,8 @@ int smlProcess_json_tag_not_same_Test() { char *sql5[1] = {0}; for (int i = 0; i < 1; i++) { sql5[i] = taosMemoryCalloc(1, 1024); - strncpy(sql5[i], sql4[i], 1023); + ASSERT(sql5[i] != NULL); + (void)strncpy(sql5[i], sql4[i], 1023); } pRes = taos_schemaless_insert(taos, (char **)sql5, sizeof(sql5) / sizeof(sql5[0]), TSDB_SML_JSON_PROTOCOL, @@ -1147,7 +1155,8 @@ int sml_19221_Test() { taos_free_result(pRes); char *tmp = (char *)taosMemoryCalloc(1024, 1); - memcpy(tmp, sql[0], strlen(sql[0])); + ASSERT(tmp != NULL); + (void)memcpy(tmp, sql[0], strlen(sql[0])); *(char *)(tmp + 44) = 0; int32_t totalRows = 0; pRes = taos_schemaless_insert_raw(taos, tmp, strlen(sql[0]), &totalRows, TSDB_SML_LINE_PROTOCOL, @@ -1218,7 +1227,8 @@ int sml_ts3116_Test() { taos_free_result(pRes); int32_t totalRows = 0; char *tmp = (char *)taosMemoryCalloc(1024, 1); - memcpy(tmp, sql, strlen(sql)); + ASSERT(tmp != NULL); + (void)memcpy(tmp, sql, strlen(sql)); totalRows = 0; pRes = taos_schemaless_insert_raw(taos, tmp, strlen(tmp), &totalRows, TSDB_SML_LINE_PROTOCOL, TSDB_SML_TIMESTAMP_MILLI_SECONDS); @@ -1235,7 +1245,8 @@ int sml_ts3116_Test() { taos_free_result(pRes); tmp = (char *)taosMemoryCalloc(1024, 1); - memcpy(tmp, sql1, strlen(sql1)); + ASSERT(tmp != NULL); + (void)memcpy(tmp, sql1, strlen(sql1)); totalRows = 0; pRes = taos_schemaless_insert_raw(taos, tmp, strlen(tmp), &totalRows, TSDB_SML_LINE_PROTOCOL, TSDB_SML_TIMESTAMP_MILLI_SECONDS); @@ -2049,7 +2060,8 @@ int sml_td29373_Test() { char *sql3[1] = {0}; for (int i = 0; i < 1; i++) { sql3[i] = taosMemoryCalloc(1, 1024); - strncpy(sql3[i], sql2[i], 1023); + ASSERT(sql3[i] != NULL); + (void)strncpy(sql3[i], sql2[i], 1023); } pRes = taos_schemaless_insert(taos, (char **)sql3, sizeof(sql3) / sizeof(sql3[0]), TSDB_SML_JSON_PROTOCOL,