diff --git a/docs/en/12-taos-sql/21-node.md b/docs/en/12-taos-sql/21-node.md index d9d06a00a4..a0d49ab208 100644 --- a/docs/en/12-taos-sql/21-node.md +++ b/docs/en/12-taos-sql/21-node.md @@ -40,25 +40,25 @@ ALTER ALL DNODES dnode_option dnode_option: { 'resetLog' - | 'balance' value - | 'monitor' value - | 'debugFlag' value - | 'monDebugFlag' value - | 'vDebugFlag' value - | 'mDebugFlag' value - | 'cDebugFlag' value - | 'httpDebugFlag' value - | 'qDebugflag' value - | 'sdbDebugFlag' value - | 'uDebugFlag' value - | 'tsdbDebugFlag' value - | 'sDebugflag' value - | 'rpcDebugFlag' value - | 'dDebugFlag' value - | 'mqttDebugFlag' value - | 'wDebugFlag' value - | 'tmrDebugFlag' value - | 'cqDebugFlag' value + | 'balance' 'value' + | 'monitor' 'value' + | 'debugFlag' 'value' + | 'monDebugFlag' 'value' + | 'vDebugFlag' 'value' + | 'mDebugFlag' 'value' + | 'cDebugFlag' 'value' + | 'httpDebugFlag' 'value' + | 'qDebugflag' 'value' + | 'sdbDebugFlag' 'value' + | 'uDebugFlag' 'value' + | 'tsdbDebugFlag' 'value' + | 'sDebugflag' 'value' + | 'rpcDebugFlag' 'value' + | 'dDebugFlag' 'value' + | 'mqttDebugFlag' 'value' + | 'wDebugFlag' 'value' + | 'tmrDebugFlag' 'value' + | 'cqDebugFlag' 'value' } ``` @@ -127,11 +127,11 @@ ALTER LOCAL local_option local_option: { 'resetLog' - | 'rpcDebugFlag' value - | 'tmrDebugFlag' value - | 'cDebugFlag' value - | 'uDebugFlag' value - | 'debugFlag' value + | 'rpcDebugFlag' 'value' + | 'tmrDebugFlag' 'value' + | 'cDebugFlag' 'value' + | 'uDebugFlag' 'value' + | 'debugFlag' 'value' } ``` diff --git a/docs/en/14-reference/02-rest-api/02-rest-api.mdx b/docs/en/14-reference/02-rest-api/02-rest-api.mdx index da26b34c6f..09e40b956f 100644 --- a/docs/en/14-reference/02-rest-api/02-rest-api.mdx +++ b/docs/en/14-reference/02-rest-api/02-rest-api.mdx @@ -67,7 +67,7 @@ The following return value results indicate that the verification passed. ## HTTP request URL format ```text -http://:/rest/sql/[db_name] +http://:/rest/sql/[db_name][?tz=timezone] ``` Parameter Description: @@ -75,6 +75,7 @@ Parameter Description: - fqnd: FQDN or IP address of any host in the cluster. - port: httpPort configuration item in the configuration file, default is 6041. - db_name: Optional parameter that specifies the default database name for the executed SQL command. +- tz: Optional parameter that specifies the timezone of the returned time, following the IANA Time Zone rules, e.g. `America/New_York`. For example, `http://h1.taos.com:6041/rest/sql/test` is a URL to `h1.taos.com:6041` and sets the default database name to `test`. @@ -97,13 +98,13 @@ The HTTP request's BODY is a complete SQL command, and the data table in the SQL Use `curl` to initiate an HTTP request with a custom authentication method, with the following syntax. ```bash -curl -L -H "Authorization: Basic " -d "" :/rest/sql/[db_name] +curl -L -H "Authorization: Basic " -d "" :/rest/sql/[db_name][?tz=timezone] ``` or ```bash -curl -L -u username:password -d "" :/rest/sql/[db_name] +curl -L -u username:password -d "" :/rest/sql/[db_name][?tz=timezone] ``` where `TOKEN` is the string after Base64 encoding of `{username}:{password}`, e.g. `root:taosdata` is encoded as `cm9vdDp0YW9zZGF0YQ==`.. diff --git a/docs/en/27-train-faq/01-faq.md b/docs/en/27-train-faq/01-faq.md index 78794c1ca3..82e98b0d98 100644 --- a/docs/en/27-train-faq/01-faq.md +++ b/docs/en/27-train-faq/01-faq.md @@ -106,11 +106,11 @@ ALTER LOCAL local_option local_option: { 'resetLog' - | 'rpcDebugFlag' value - | 'tmrDebugFlag' value - | 'cDebugFlag' value - | 'uDebugFlag' value - | 'debugFlag' value + | 'rpcDebugFlag' 'value' + | 'tmrDebugFlag' 'value' + | 'cDebugFlag' 'value' + | 'uDebugFlag' 'value' + | 'debugFlag' 'value' } ``` diff --git a/docs/zh/08-connector/02-rest-api.mdx b/docs/zh/08-connector/02-rest-api.mdx index 68d73ff32f..af2ec1b1c2 100644 --- a/docs/zh/08-connector/02-rest-api.mdx +++ b/docs/zh/08-connector/02-rest-api.mdx @@ -69,7 +69,7 @@ curl -L -H "Authorization: Basic cm9vdDp0YW9zZGF0YQ==" \ ## HTTP 请求格式 ```text -http://:/rest/sql/[db_name] +http://:/rest/sql/[db_name][?tz=timezone] ``` 参数说明: @@ -77,6 +77,7 @@ http://:/rest/sql/[db_name] - fqdn: 集群中的任一台主机 FQDN 或 IP 地址。 - port: 配置文件中 httpPort 配置项,缺省为 6041。 - db_name: 可选参数,指定本次所执行的 SQL 语句的默认数据库库名。 +- tz: 可选参数,指定返回时间的时区,遵照 IANA Time Zone 规则,如 `America/New_York`。 例如:`http://h1.taos.com:6041/rest/sql/test` 是指向地址为 `h1.taos.com:6041` 的 URL,并将默认使用的数据库库名设置为 `test`。 @@ -99,13 +100,13 @@ HTTP 请求的 BODY 里就是一个完整的 SQL 语句,SQL 语句中的数据 使用 `curl` 通过自定义身份认证方式来发起一个 HTTP Request,语法如下: ```bash -curl -L -H "Authorization: Basic " -d "" :/rest/sql/[db_name] +curl -L -H "Authorization: Basic " -d "" :/rest/sql/[db_name][?tz=timezone] ``` 或者, ```bash -curl -L -u username:password -d "" :/rest/sql/[db_name] +curl -L -u username:password -d "" :/rest/sql/[db_name][?tz=timezone] ``` 其中,`TOKEN` 为 `{username}:{password}` 经过 Base64 编码之后的字符串,例如 `root:taosdata` 编码后为 `cm9vdDp0YW9zZGF0YQ==`。 diff --git a/docs/zh/12-taos-sql/21-node.md b/docs/zh/12-taos-sql/21-node.md index 5b9279406a..4116343730 100644 --- a/docs/zh/12-taos-sql/21-node.md +++ b/docs/zh/12-taos-sql/21-node.md @@ -41,25 +41,25 @@ ALTER ALL DNODES dnode_option dnode_option: { 'resetLog' - | 'balance' value - | 'monitor' value - | 'debugFlag' value - | 'monDebugFlag' value - | 'vDebugFlag' value - | 'mDebugFlag' value - | 'cDebugFlag' value - | 'httpDebugFlag' value - | 'qDebugflag' value - | 'sdbDebugFlag' value - | 'uDebugFlag' value - | 'tsdbDebugFlag' value - | 'sDebugflag' value - | 'rpcDebugFlag' value - | 'dDebugFlag' value - | 'mqttDebugFlag' value - | 'wDebugFlag' value - | 'tmrDebugFlag' value - | 'cqDebugFlag' value + | 'balance' 'value' + | 'monitor' 'value' + | 'debugFlag' 'value' + | 'monDebugFlag' 'value' + | 'vDebugFlag' 'value' + | 'mDebugFlag' 'value' + | 'cDebugFlag' 'value' + | 'httpDebugFlag' 'value' + | 'qDebugflag' 'value' + | 'sdbDebugFlag' 'value' + | 'uDebugFlag' 'value' + | 'tsdbDebugFlag' 'value' + | 'sDebugflag' 'value' + | 'rpcDebugFlag' 'value' + | 'dDebugFlag' 'value' + | 'mqttDebugFlag' 'value' + | 'wDebugFlag' 'value' + | 'tmrDebugFlag' 'value' + | 'cqDebugFlag' 'value' } ``` @@ -128,11 +128,11 @@ ALTER LOCAL local_option local_option: { 'resetLog' - | 'rpcDebugFlag' value - | 'tmrDebugFlag' value - | 'cDebugFlag' value - | 'uDebugFlag' value - | 'debugFlag' value + | 'rpcDebugFlag' 'value' + | 'tmrDebugFlag' 'value' + | 'cDebugFlag' 'value' + | 'uDebugFlag' 'value' + | 'debugFlag' 'value' } ``` diff --git a/docs/zh/27-train-faq/01-faq.md b/docs/zh/27-train-faq/01-faq.md index c84cda81a7..9c2f1e790c 100644 --- a/docs/zh/27-train-faq/01-faq.md +++ b/docs/zh/27-train-faq/01-faq.md @@ -135,11 +135,11 @@ ALTER LOCAL local_option local_option: { 'resetLog' - | 'rpcDebugFlag' value - | 'tmrDebugFlag' value - | 'cDebugFlag' value - | 'uDebugFlag' value - | 'debugFlag' value + | 'rpcDebugFlag' 'value' + | 'tmrDebugFlag' 'value' + | 'cDebugFlag' 'value' + | 'uDebugFlag' 'value' + | 'debugFlag' 'value' } ``` diff --git a/include/common/trow.h b/include/common/trow.h index c5293fa45f..9d183c8f80 100644 --- a/include/common/trow.h +++ b/include/common/trow.h @@ -169,7 +169,7 @@ typedef struct { // #define TD_ROW_VER(r) ((r)->ver) #define TD_ROW_KEY_ADDR(r) (r) -// N.B. If without STSchema, getExtendedRowSize() is used to get the rowMaxBytes and +// N.B. If without STSchema, insGetExtendedRowSize() is used to get the rowMaxBytes and // (int32_t)ceil((double)nCols/TD_VTYPE_PARTS) should be added if TD_SUPPORT_BITMAP defined. #define TD_ROW_MAX_BYTES_FROM_SCHEMA(s) ((s)->tlen + TD_ROW_HEAD_LEN) diff --git a/include/common/ttokendef.h b/include/common/ttokendef.h index 18da327663..64d0ecc211 100644 --- a/include/common/ttokendef.h +++ b/include/common/ttokendef.h @@ -164,9 +164,9 @@ #define TK_SCORES 146 #define TK_TOPICS 147 #define TK_VARIABLES 148 -#define TK_BNODES 149 -#define TK_SNODES 150 -#define TK_CLUSTER 151 +#define TK_CLUSTER 149 +#define TK_BNODES 150 +#define TK_SNODES 151 #define TK_TRANSACTIONS 152 #define TK_DISTRIBUTED 153 #define TK_CONSUMERS 154 diff --git a/include/common/ttypes.h b/include/common/ttypes.h index 9ff315fc2e..bfd6a75c3a 100644 --- a/include/common/ttypes.h +++ b/include/common/ttypes.h @@ -290,6 +290,7 @@ typedef struct { (IS_SIGNED_NUMERIC_TYPE(_t) || (_t) == (TSDB_DATA_TYPE_BOOL) || (_t) == (TSDB_DATA_TYPE_TIMESTAMP)) #define IS_CONVERT_AS_UNSIGNED(_t) (IS_UNSIGNED_NUMERIC_TYPE(_t) || (_t) == (TSDB_DATA_TYPE_BOOL)) +#if 0 // TODO remove this function static FORCE_INLINE bool isNull(const void *val, int32_t type) { switch (type) { @@ -325,6 +326,7 @@ static FORCE_INLINE bool isNull(const void *val, int32_t type) { return false; }; } +#endif typedef struct tDataTypeDescriptor { int16_t type; diff --git a/include/libs/nodes/cmdnodes.h b/include/libs/nodes/cmdnodes.h index ae550e0c08..295555594f 100644 --- a/include/libs/nodes/cmdnodes.h +++ b/include/libs/nodes/cmdnodes.h @@ -274,6 +274,7 @@ typedef struct SShowTableDistributedStmt { typedef struct SShowDnodeVariablesStmt { ENodeType type; SNode* pDnodeId; + SNode* pLikePattern; } SShowDnodeVariablesStmt; typedef struct SShowVnodesStmt { diff --git a/include/libs/nodes/querynodes.h b/include/libs/nodes/querynodes.h index 5f2ce66f25..837834f795 100644 --- a/include/libs/nodes/querynodes.h +++ b/include/libs/nodes/querynodes.h @@ -347,11 +347,6 @@ typedef struct SInsertStmt { uint8_t precision; } SInsertStmt; -typedef enum { - PAYLOAD_TYPE_KV = 0, - PAYLOAD_TYPE_RAW = 1, -} EPayloadType; - typedef struct SVgDataBlocks { SVgroupInfo vg; int32_t numOfTables; // number of tables in current submit block @@ -363,7 +358,6 @@ typedef struct SVnodeModifOpStmt { ENodeType nodeType; ENodeType sqlNodeType; SArray* pDataBlocks; // data block for each vgroup, SArray. - uint8_t payloadType; // EPayloadType. 0: K-V payload for non-prepare insert, 1: rawPayload for prepare insert uint32_t insertType; // insert data from [file|sql statement| bound statement] const char* sql; // current sql statement position } SVnodeModifOpStmt; diff --git a/source/client/inc/clientInt.h b/source/client/inc/clientInt.h index f815adfeaa..cf8b0babdd 100644 --- a/source/client/inc/clientInt.h +++ b/source/client/inc/clientInt.h @@ -46,7 +46,6 @@ extern "C" { #define ERROR_MSG_BUF_DEFAULT_SIZE 512 #define HEARTBEAT_INTERVAL 1500 // ms -#define SYNC_ON_TOP_OF_ASYNC 1 enum { RES_TYPE__QUERY = 1, @@ -271,9 +270,8 @@ void doFreeReqResultInfo(SReqResultInfo* pResInfo); int32_t transferTableNameList(const char* tbList, int32_t acctId, char* dbName, SArray** pReq); void syncCatalogFn(SMetaData* pResult, void* param, int32_t code); -SRequestObj* execQuery(uint64_t connId, const char* sql, int sqlLen, bool validateOnly); -TAOS_RES* taosQueryImpl(TAOS* taos, const char* sql, bool validateOnly); -void taosAsyncQueryImpl(uint64_t connId, const char* sql, __taos_async_fn_t fp, void* param, bool validateOnly); +TAOS_RES* taosQueryImpl(TAOS* taos, const char* sql, bool validateOnly); +void taosAsyncQueryImpl(uint64_t connId, const char* sql, __taos_async_fn_t fp, void* param, bool validateOnly); int32_t getVersion1BlockMetaSize(const char* p, int32_t numOfCols); @@ -349,8 +347,6 @@ void processMsgFromServer(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet); STscObj* taos_connect_internal(const char* ip, const char* user, const char* pass, const char* auth, const char* db, uint16_t port, int connType); -SRequestObj* launchQuery(uint64_t connId, const char* sql, int sqlLen, bool validateOnly, bool inRetry); - int32_t parseSql(SRequestObj* pRequest, bool topicQuery, SQuery** pQuery, SStmtCallback* pStmtCb); int32_t getPlan(SRequestObj* pRequest, SQuery* pQuery, SQueryPlan** pPlan, SArray* pNodeList); diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index 0bf254e455..0c12d78c18 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -1013,28 +1013,6 @@ SRequestObj* launchQueryImpl(SRequestObj* pRequest, SQuery* pQuery, bool keepQue return pRequest; } -SRequestObj* launchQuery(uint64_t connId, const char* sql, int sqlLen, bool validateOnly, bool inRetry) { - SRequestObj* pRequest = NULL; - SQuery* pQuery = NULL; - - int32_t code = buildRequest(connId, sql, sqlLen, NULL, validateOnly, &pRequest); - if (code != TSDB_CODE_SUCCESS) { - terrno = code; - return NULL; - } - - code = parseSql(pRequest, false, &pQuery, NULL); - if (code != TSDB_CODE_SUCCESS) { - pRequest->code = code; - return pRequest; - } - - pRequest->inRetry = inRetry; - pRequest->stableQuery = pQuery->stableQuery; - - return launchQueryImpl(pRequest, pQuery, false, NULL); -} - static int32_t asyncExecSchQuery(SRequestObj* pRequest, SQuery* pQuery, SMetaData* pResultMeta, SSqlCallbackWrapper* pWrapper) { pRequest->type = pQuery->msgType; @@ -1197,32 +1175,6 @@ int32_t removeMeta(STscObj* pTscObj, SArray* tbList) { return TSDB_CODE_SUCCESS; } -// todo remove it soon -SRequestObj* execQuery(uint64_t connId, const char* sql, int sqlLen, bool validateOnly) { - SRequestObj* pRequest = NULL; - int32_t retryNum = 0; - int32_t code = 0; - bool inRetry = false; - - do { - destroyRequest(pRequest); - pRequest = launchQuery(connId, sql, sqlLen, validateOnly, inRetry); - if (pRequest == NULL || TSDB_CODE_SUCCESS == pRequest->code || !NEED_CLIENT_HANDLE_ERROR(pRequest->code)) { - break; - } - - code = refreshMeta(pRequest->pTscObj, pRequest); - if (code) { - pRequest->code = code; - break; - } - - inRetry = true; - } while (retryNum++ < REQUEST_TOTAL_EXEC_TIMES); - - return pRequest; -} - int initEpSetFromCfg(const char* firstEp, const char* secondEp, SCorEpSet* pEpSet) { pEpSet->version = 0; @@ -2291,7 +2243,6 @@ TAOS_RES* taosQueryImpl(TAOS* taos, const char* sql, bool validateOnly) { return NULL; } -#if SYNC_ON_TOP_OF_ASYNC SSyncQueryParam* param = taosMemoryCalloc(1, sizeof(SSyncQueryParam)); tsem_init(¶m->sem, 0, 0); @@ -2301,15 +2252,4 @@ TAOS_RES* taosQueryImpl(TAOS* taos, const char* sql, bool validateOnly) { param->pRequest->syncQuery = true; } return param->pRequest; -#else - size_t sqlLen = strlen(sql); - if (sqlLen > (size_t)TSDB_MAX_ALLOWED_SQL_LEN) { - tscError("sql string exceeds max length:%d", TSDB_MAX_ALLOWED_SQL_LEN); - terrno = TSDB_CODE_TSC_EXCEED_SQL_LIMIT; - return NULL; - } - - TAOS_RES* pRes = execQuery(*(int64_t*)taos, sql, sqlLen, validateOnly); - return pRes; -#endif } diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c index 8036e50545..b03576ff01 100644 --- a/source/client/src/clientMain.c +++ b/source/client/src/clientMain.c @@ -261,12 +261,7 @@ TAOS_ROW taos_fetch_row(TAOS_RES *res) { return NULL; } -#if SYNC_ON_TOP_OF_ASYNC return doAsyncFetchRows(pRequest, true, true); -#else - return doFetchRows(pRequest, true, true); -#endif - } else if (TD_RES_TMQ(res) || TD_RES_TMQ_METADATA(res)) { SMqRspObj *msg = ((SMqRspObj *)res); SReqResultInfo *pResultInfo; @@ -549,11 +544,7 @@ int taos_fetch_block_s(TAOS_RES *res, int *numOfRows, TAOS_ROW *rows) { return 0; } -#if SYNC_ON_TOP_OF_ASYNC doAsyncFetchRows(pRequest, false, true); -#else - doFetchRows(pRequest, true, true); -#endif // TODO refactor SReqResultInfo *pResultInfo = &pRequest->body.resInfo; @@ -601,11 +592,7 @@ int taos_fetch_raw_block(TAOS_RES *res, int *numOfRows, void **pData) { return 0; } -#if SYNC_ON_TOP_OF_ASYNC doAsyncFetchRows(pRequest, false, false); -#else - doFetchRows(pRequest, false, false); -#endif SReqResultInfo *pResultInfo = &pRequest->body.resInfo; @@ -989,7 +976,7 @@ const void *taos_get_raw_block(TAOS_RES *res) { return pRequest->body.resInfo.pData; } -int taos_get_db_route_info(TAOS* taos, const char* db, TAOS_DB_ROUTE_INFO* dbInfo) { +int taos_get_db_route_info(TAOS *taos, const char *db, TAOS_DB_ROUTE_INFO *dbInfo) { if (NULL == taos) { terrno = TSDB_CODE_TSC_DISCONNECTED; return terrno; @@ -1001,16 +988,16 @@ int taos_get_db_route_info(TAOS* taos, const char* db, TAOS_DB_ROUTE_INFO* dbInf return terrno; } - int64_t connId = *(int64_t *)taos; - SRequestObj *pRequest = NULL; - char *sql = "taos_get_db_route_info"; - int32_t code = buildRequest(connId, sql, strlen(sql), NULL, false, &pRequest); + int64_t connId = *(int64_t *)taos; + SRequestObj *pRequest = NULL; + char *sql = "taos_get_db_route_info"; + int32_t code = buildRequest(connId, sql, strlen(sql), NULL, false, &pRequest); if (code != TSDB_CODE_SUCCESS) { terrno = code; return terrno; } - STscObj *pTscObj = pRequest->pTscObj; + STscObj *pTscObj = pRequest->pTscObj; SCatalog *pCtg = NULL; code = catalogGetHandle(pTscObj->pAppInfo->clusterId, &pCtg); if (code != TSDB_CODE_SUCCESS) { @@ -1024,7 +1011,7 @@ int taos_get_db_route_info(TAOS* taos, const char* db, TAOS_DB_ROUTE_INFO* dbInf char dbFName[TSDB_DB_FNAME_LEN] = {0}; snprintf(dbFName, sizeof(dbFName), "%d.%s", pTscObj->acctId, db); - + code = catalogGetDBVgInfo(pCtg, &conn, dbFName, dbInfo); if (code) { goto _return; @@ -1038,7 +1025,7 @@ _return: return code; } -int taos_get_table_vgId(TAOS* taos, const char* db, const char* table, int* vgId) { +int taos_get_table_vgId(TAOS *taos, const char *db, const char *table, int *vgId) { if (NULL == taos) { terrno = TSDB_CODE_TSC_DISCONNECTED; return terrno; @@ -1050,15 +1037,15 @@ int taos_get_table_vgId(TAOS* taos, const char* db, const char* table, int* vgId return terrno; } - int64_t connId = *(int64_t *)taos; - SRequestObj *pRequest = NULL; - char *sql = "taos_get_table_vgId"; - int32_t code = buildRequest(connId, sql, strlen(sql), NULL, false, &pRequest); + int64_t connId = *(int64_t *)taos; + SRequestObj *pRequest = NULL; + char *sql = "taos_get_table_vgId"; + int32_t code = buildRequest(connId, sql, strlen(sql), NULL, false, &pRequest); if (code != TSDB_CODE_SUCCESS) { return terrno; } - STscObj *pTscObj = pRequest->pTscObj; + STscObj *pTscObj = pRequest->pTscObj; SCatalog *pCtg = NULL; code = catalogGetHandle(pTscObj->pAppInfo->clusterId, &pCtg); if (code != TSDB_CODE_SUCCESS) { diff --git a/source/client/src/clientRawBlockWrite.c b/source/client/src/clientRawBlockWrite.c index dfcd8c4a79..f05d37765d 100644 --- a/source/client/src/clientRawBlockWrite.c +++ b/source/client/src/clientRawBlockWrite.c @@ -1369,7 +1369,6 @@ int taos_write_raw_block(TAOS* taos, int rows, char* pData, const char* tbname) goto end; } SVnodeModifOpStmt* nodeStmt = (SVnodeModifOpStmt*)(pQuery->pRoot); - nodeStmt->payloadType = PAYLOAD_TYPE_KV; nodeStmt->pDataBlocks = taosArrayInit(1, POINTER_BYTES); SVgDataBlocks* dst = taosMemoryCalloc(1, sizeof(SVgDataBlocks)); @@ -1625,7 +1624,6 @@ static int32_t tmqWriteRawDataImpl(TAOS* taos, void* data, int32_t dataLen) { goto end; } SVnodeModifOpStmt* nodeStmt = (SVnodeModifOpStmt*)(pQuery->pRoot); - nodeStmt->payloadType = PAYLOAD_TYPE_KV; int32_t numOfVg = taosHashGetSize(pVgHash); nodeStmt->pDataBlocks = taosArrayInit(numOfVg, POINTER_BYTES); @@ -1929,7 +1927,6 @@ static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen) goto end; } SVnodeModifOpStmt* nodeStmt = (SVnodeModifOpStmt*)(pQuery->pRoot); - nodeStmt->payloadType = PAYLOAD_TYPE_KV; int32_t numOfVg = taosHashGetSize(pVgHash); nodeStmt->pDataBlocks = taosArrayInit(numOfVg, POINTER_BYTES); diff --git a/source/client/src/clientSml.c b/source/client/src/clientSml.c index 5b8266b1cb..5da7bebf2a 100644 --- a/source/client/src/clientSml.c +++ b/source/client/src/clientSml.c @@ -1531,7 +1531,6 @@ static SSmlHandle *smlBuildSmlInfo(STscObj *pTscObj, SRequestObj *request, SMLPr uError("SML:0x%" PRIx64 " create info->pQuery->pRoot error", info->id); goto cleanup; } - ((SVnodeModifOpStmt *)(info->pQuery->pRoot))->payloadType = PAYLOAD_TYPE_KV; if (pTscObj) { info->taos = pTscObj; diff --git a/source/common/src/systable.c b/source/common/src/systable.c index 28a4732abd..24f71a47c0 100644 --- a/source/common/src/systable.c +++ b/source/common/src/systable.c @@ -230,8 +230,8 @@ static const SSysDbTableSchema transSchema[] = { }; static const SSysDbTableSchema configSchema[] = { - {.name = "name", .bytes = TSDB_CONFIG_OPTION_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, - {.name = "value", .bytes = TSDB_CONFIG_VALUE_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, + {.name = "name", .bytes = TSDB_CONFIG_OPTION_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false}, + {.name = "value", .bytes = TSDB_CONFIG_VALUE_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false}, }; static const SSysDbTableSchema variablesSchema[] = { @@ -282,7 +282,7 @@ static const SSysTableMeta infosMeta[] = { {TSDB_INS_TABLE_USERS, userUsersSchema, tListLen(userUsersSchema), false}, {TSDB_INS_TABLE_LICENCES, grantsSchema, tListLen(grantsSchema), true}, {TSDB_INS_TABLE_VGROUPS, vgroupsSchema, tListLen(vgroupsSchema), true}, - {TSDB_INS_TABLE_CONFIGS, configSchema, tListLen(configSchema), true}, + {TSDB_INS_TABLE_CONFIGS, configSchema, tListLen(configSchema), false}, {TSDB_INS_TABLE_DNODE_VARIABLES, variablesSchema, tListLen(variablesSchema), true}, {TSDB_INS_TABLE_TOPICS, topicSchema, tListLen(topicSchema), false}, {TSDB_INS_TABLE_SUBSCRIPTIONS, subscriptionSchema, tListLen(subscriptionSchema), false}, diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index 4fd1187fef..47a260c147 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -5158,7 +5158,7 @@ int tDecodeSVCreateTbReq(SDecoder *pCoder, SVCreateTbReq *pReq) { char name[TSDB_COL_NAME_LEN] = {0}; char *tmp = NULL; if (tDecodeCStr(pCoder, &tmp) < 0) return -1; - strcpy(name, tmp); + strncpy(name, tmp, TSDB_COL_NAME_LEN - 1); taosArrayPush(pReq->ctb.tagName, name); } } else if (pReq->type == TSDB_NORMAL_TABLE) { diff --git a/source/common/src/ttszip.c b/source/common/src/ttszip.c index aeb9292b41..fe5c599d53 100644 --- a/source/common/src/ttszip.c +++ b/source/common/src/ttszip.c @@ -187,7 +187,9 @@ void* tsBufDestroy(STSBuf* pTSBuf) { if (pTSBuf->autoDelete) { // ("tsBuf %p destroyed, delete tmp file:%s", pTSBuf, pTSBuf->path); - taosRemoveFile(pTSBuf->path); + if (taosRemoveFile(pTSBuf->path) != 0) { + // tscError("tsBuf %p destroyed, failed to remove tmp file:%s", pTSBuf, pTSBuf->path); + } } else { // tscDebug("tsBuf %p destroyed, tmp file:%s, remains", pTSBuf, pTSBuf->path); } diff --git a/source/dnode/mnode/impl/src/mndGrant.c b/source/dnode/mnode/impl/src/mndGrant.c index 7262f23657..396de7eed3 100644 --- a/source/dnode/mnode/impl/src/mndGrant.c +++ b/source/dnode/mnode/impl/src/mndGrant.c @@ -21,10 +21,8 @@ static int32_t mndRetrieveGrant(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows) { int32_t numOfRows = 0; - char *pWrite; int32_t cols = 0; char tmp[32]; - char tmp1[32]; if (pShow->numOfRows < 1) { cols = 0; diff --git a/source/dnode/vnode/src/tsdb/tsdbCacheRead.c b/source/dnode/vnode/src/tsdb/tsdbCacheRead.c index 83dcbc60c7..905150cab0 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCacheRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbCacheRead.c @@ -37,6 +37,8 @@ static void saveOneRow(SArray* pRow, SSDataBlock* pBlock, SCacheRowsReader* pRea int32_t numOfRows = pBlock->info.rows; if (HASTYPE(pReader->type, CACHESCAN_RETRIEVE_LAST)) { + bool allNullRow = true; + for (int32_t i = 0; i < pReader->numOfCols; ++i) { SColumnInfoData* pColInfoData = taosArrayGet(pBlock->pDataBlock, i); SFirstLastRes* p = (SFirstLastRes*)varDataVal(pRes[i]); @@ -46,12 +48,15 @@ static void saveOneRow(SArray* pRow, SSDataBlock* pBlock, SCacheRowsReader* pRea p->ts = pColVal->ts; p->bytes = TSDB_KEYSIZE; *(int64_t*)p->buf = pColVal->ts; + allNullRow = false; } else { int32_t slotId = slotIds[i]; SLastCol* pColVal = (SLastCol*)taosArrayGet(pRow, slotId); p->ts = pColVal->ts; p->isNull = !COL_VAL_IS_VALUE(&pColVal->colVal); + allNullRow = p->isNull & allNullRow; + if (!p->isNull) { if (IS_VAR_DATA_TYPE(pColVal->colVal.type)) { varDataSetLen(p->buf, pColVal->colVal.value.nData); @@ -69,6 +74,8 @@ static void saveOneRow(SArray* pRow, SSDataBlock* pBlock, SCacheRowsReader* pRea varDataSetLen(pRes[i], pColInfoData->info.bytes - VARSTR_HEADER_SIZE); colDataAppend(pColInfoData, numOfRows, (const char*)pRes[i], false); } + + pBlock->info.rows += allNullRow? 0:1; } else { ASSERT(HASTYPE(pReader->type, CACHESCAN_RETRIEVE_LAST_ROW)); @@ -96,9 +103,9 @@ static void saveOneRow(SArray* pRow, SSDataBlock* pBlock, SCacheRowsReader* pRea } } } - } - pBlock->info.rows += 1; + pBlock->info.rows += 1; + } } int32_t tsdbCacherowsReaderOpen(void* pVnode, int32_t type, SArray* pTableIdList, int32_t numOfCols, void** pReader) { diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c index 257a7d0baa..ca877f599f 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead.c @@ -1910,6 +1910,10 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo* if (minKey == k.ts) { if (init) { + if (merge.pTSchema == NULL) { + return code; + } + tRowMerge(&merge, pRow); } else { STSchema* pSchema = doGetSchemaForTSRow(TSDBROW_SVERSION(pRow), pReader, pBlockScanInfo->uid); @@ -1964,7 +1968,7 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo* tRowMerge(&merge, &fRow1); } else { init = true; - int32_t code = tRowMergerInit(&merge, &fRow1, pReader->pSchema); + code = tRowMergerInit(&merge, &fRow1, pReader->pSchema); if (code != TSDB_CODE_SUCCESS) { return code; } @@ -1975,17 +1979,24 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo* if (minKey == key) { TSDBROW fRow = tsdbRowFromBlockData(pBlockData, pDumpInfo->rowIndex); if (!init) { - int32_t code = tRowMergerInit(&merge, &fRow, pReader->pSchema); + code = tRowMergerInit(&merge, &fRow, pReader->pSchema); if (code != TSDB_CODE_SUCCESS) { return code; } } else { + if (merge.pTSchema == NULL) { + return code; + } tRowMerge(&merge, &fRow); } doMergeRowsInFileBlocks(pBlockData, pBlockScanInfo, pReader, &merge); } } + if (merge.pTSchema == NULL) { + return code; + } + code = tRowMergerGetRow(&merge, &pTSRow); if (code != TSDB_CODE_SUCCESS) { return code; @@ -3232,7 +3243,7 @@ int32_t doMergeMemIMemRows(TSDBROW* pRow, TSDBROW* piRow, STableBlockScanInfo* p STSchema* pSchema = doGetSchemaForTSRow(TSDBROW_SVERSION(pRow), pReader, pBlockScanInfo->uid); int32_t code = tRowMergerInit(&merge, pRow, pSchema); - if (code != TSDB_CODE_SUCCESS) { + if (code != TSDB_CODE_SUCCESS || merge.pTSchema == NULL) { return code; } diff --git a/source/libs/executor/inc/executil.h b/source/libs/executor/inc/executil.h index 4e960afdb1..0cfef7dc24 100644 --- a/source/libs/executor/inc/executil.h +++ b/source/libs/executor/inc/executil.h @@ -74,7 +74,6 @@ typedef struct SResultRowPosition { typedef struct SResKeyPos { SResultRowPosition pos; uint64_t groupId; - // char parTbName[TSDB_TABLE_NAME_LEN]; char key[]; } SResKeyPos; @@ -84,6 +83,18 @@ typedef struct SResultRowInfo { SList* openWindow; } SResultRowInfo; +typedef struct SColMatchItem { + int32_t colId; + int32_t srcSlotId; + int32_t dstSlotId; + bool needOutput; +} SColMatchItem; + +typedef struct SColMatchInfo { + SArray* pList; // SArray + int32_t matchType; // determinate the source according to col id or slot id +} SColMatchInfo; + struct SqlFunctionCtx; size_t getResultRowSize(struct SqlFunctionCtx* pCtx, int32_t numOfOutput); @@ -121,8 +132,8 @@ size_t getTableTagsBufLen(const SNodeList* pGroups); SArray* createSortInfo(SNodeList* pNodeList); SArray* extractPartitionColInfo(SNodeList* pNodeList); -SArray* extractColMatchInfo(SNodeList* pNodeList, SDataBlockDescNode* pOutputNodeList, int32_t* numOfOutputCols, - int32_t type); +int32_t extractColMatchInfo(SNodeList* pNodeList, SDataBlockDescNode* pOutputNodeList, int32_t* numOfOutputCols, + int32_t type, SColMatchInfo* pMatchInfo); void createExprFromOneNode(SExprInfo* pExp, SNode* pNode, int16_t slotId); void createExprFromTargetNode(SExprInfo* pExp, STargetNode* pTargetNode); diff --git a/source/libs/executor/inc/executorimpl.h b/source/libs/executor/inc/executorimpl.h index d94eb80994..7755bd88db 100644 --- a/source/libs/executor/inc/executorimpl.h +++ b/source/libs/executor/inc/executorimpl.h @@ -47,12 +47,7 @@ extern "C" { typedef int32_t (*__block_search_fn_t)(char* data, int32_t num, int64_t key, int32_t order); -#define IS_QUERY_KILLED(_q) ((_q)->code == TSDB_CODE_TSC_QUERY_CANCELLED) #define Q_STATUS_EQUAL(p, s) (((p) & (s)) != 0u) -#define QUERY_IS_ASC_QUERY(q) (GET_FORWARD_DIRECTION_FACTOR((q)->order.order) == QUERY_ASC_FORWARD_STEP) - -#define NEEDTO_COMPRESS_QUERY(size) ((size) > tsCompressColData ? 1 : 0) - #define IS_VALID_SESSION_WIN(winInfo) ((winInfo).sessionWin.win.skey > 0) #define SET_SESSION_WIN_INVALID(winInfo) ((winInfo).sessionWin.win.skey = INT64_MIN) #define IS_INVALID_SESSION_WIN_KEY(winKey) ((winKey).win.skey <= 0) @@ -240,7 +235,7 @@ typedef struct SOperatorInfo { typedef enum { EX_SOURCE_DATA_NOT_READY = 0x1, - EX_SOURCE_DATA_READY = 0x2, + EX_SOURCE_DATA_READY = 0x2, EX_SOURCE_DATA_EXHAUSTED = 0x3, } EX_SOURCE_STATUS; @@ -289,15 +284,6 @@ typedef struct SExchangeInfo { SLimitInfo limitInfo; } SExchangeInfo; -typedef struct SColMatchInfo { - int32_t srcSlotId; // source slot id - int32_t colId; - int32_t targetSlotId; - bool output; // todo remove this? - bool reserved; - int32_t matchType; // determinate the source according to col id or slot id -} SColMatchInfo; - typedef struct SScanInfo { int32_t numOfAsc; int32_t numOfDesc; @@ -339,7 +325,7 @@ typedef struct STableScanInfo { SNode* pFilterNode; // filter info, which is push down by optimizer SSDataBlock* pResBlock; - SArray* pColMatchInfo; + SColMatchInfo matchInfo; SExprSupp pseudoSup; SQueryTableDataCond cond; int32_t scanFlag; // table scan flag to denote if it is a repeat/reverse/main scan @@ -365,10 +351,9 @@ typedef struct STableMergeScanInfo { uint32_t sortBufSize; // max buffer size for in-memory sort SArray* pSortInfo; SSortHandle* pSortHandle; - - SSDataBlock* pSortInputBlock; - int64_t startTs; // sort start time - SArray* sortSourceParams; + SSDataBlock* pSortInputBlock; + int64_t startTs; // sort start time + SArray* sortSourceParams; SFileBlockLoadRecorder readRecorder; int64_t numOfRows; @@ -380,43 +365,40 @@ typedef struct STableMergeScanInfo { int32_t* rowEntryInfoOffset; SExprInfo* pExpr; SSDataBlock* pResBlock; - SArray* pColMatchInfo; + SColMatchInfo matchInfo; int32_t numOfOutput; - - SExprSupp pseudoSup; - - SQueryTableDataCond cond; - int32_t scanFlag; // table scan flag to denote if it is a repeat/reverse/main scan - int32_t dataBlockLoadFlag; + SExprSupp pseudoSup; + SQueryTableDataCond cond; + int32_t scanFlag; // table scan flag to denote if it is a repeat/reverse/main scan + int32_t dataBlockLoadFlag; // if the upstream is an interval operator, the interval info is also kept here to get the time // window to check if current data block needs to be loaded. - SInterval interval; - SSampleExecInfo sample; // sample execution info - - SSortExecInfo sortExecInfo; + SInterval interval; + SSampleExecInfo sample; // sample execution info + SSortExecInfo sortExecInfo; } STableMergeScanInfo; typedef struct STagScanInfo { SColumnInfo* pCols; SSDataBlock* pRes; - SArray* pColMatchInfo; + SColMatchInfo matchInfo; int32_t curPos; SReadHandle readHandle; STableListInfo* pTableList; } STagScanInfo; typedef struct SLastrowScanInfo { - SSDataBlock* pRes; - SReadHandle readHandle; - void* pLastrowReader; - SArray* pColMatchInfo; - int32_t* pSlotIds; - SExprSupp pseudoExprSup; - int32_t retrieveType; - int32_t currentGroupIndex; - SSDataBlock* pBufferredRes; - SArray* pUidList; - int32_t indexOfBufferedRes; + SSDataBlock* pRes; + SReadHandle readHandle; + void* pLastrowReader; + SColMatchInfo matchInfo; + int32_t* pSlotIds; + SExprSupp pseudoExprSup; + int32_t retrieveType; + int32_t currentGroupIndex; + SSDataBlock* pBufferredRes; + SArray* pUidList; + int32_t indexOfBufferedRes; } SLastrowScanInfo; typedef enum EStreamScanMode { @@ -483,28 +465,28 @@ typedef struct STimeWindowAggSupp { } STimeWindowAggSupp; typedef struct SStreamScanInfo { - uint64_t tableUid; // queried super table uid - SExprInfo* pPseudoExpr; - int32_t numOfPseudoExpr; - SExprSupp tbnameCalSup; - SExprSupp tagCalSup; - int32_t primaryTsIndex; // primary time stamp slot id - SReadHandle readHandle; - SInterval interval; // if the upstream is an interval operator, the interval info is also kept here. - SArray* pColMatchInfo; // - SNode* pCondition; + uint64_t tableUid; // queried super table uid + SExprInfo* pPseudoExpr; + int32_t numOfPseudoExpr; + SExprSupp tbnameCalSup; + SExprSupp tagCalSup; + int32_t primaryTsIndex; // primary time stamp slot id + SReadHandle readHandle; + SInterval interval; // if the upstream is an interval operator, the interval info is also kept here. + SColMatchInfo matchInfo; + SNode* pCondition; + + SArray* pBlockLists; // multiple SSDatablock. + SSDataBlock* pRes; // result SSDataBlock + SSDataBlock* pUpdateRes; // update SSDataBlock + int32_t updateResIndex; + int32_t blockType; // current block type + int32_t validBlockIndex; // Is current data has returned? + uint64_t numOfExec; // execution times + STqReader* tqReader; - SArray* pBlockLists; // multiple SSDatablock. - SSDataBlock* pRes; // result SSDataBlock - SSDataBlock* pUpdateRes; // update SSDataBlock - int32_t updateResIndex; - int32_t blockType; // current block type - int32_t validBlockIndex; // Is current data has returned? - uint64_t numOfExec; // execution times - STqReader* tqReader; - - uint64_t groupId; - SUpdateInfo* pUpdateInfo; + uint64_t groupId; + SUpdateInfo* pUpdateInfo; EStreamScanMode scanMode; SOperatorInfo* pStreamScanOp; @@ -559,8 +541,8 @@ typedef struct SSysTableScanInfo { bool showRewrite; SNode* pCondition; // db_name filter condition, to discard data that are not in current database SMTbCursor* pCur; // cursor for iterate the local table meta store. - SSysTableIndex* pIdx; // idx for local table meta - SArray* scanCols; // SArray scan column id list + SSysTableIndex* pIdx; // idx for local table meta + SColMatchInfo matchInfo; SName name; SSDataBlock* pRes; int64_t numOfBlocks; // extract basic running information. @@ -680,7 +662,7 @@ typedef struct SFillOperatorInfo { SSDataBlock* existNewGroupBlock; STimeWindow win; SNode* pCondition; - SArray* pColMatchColInfo; + SColMatchInfo matchInfo; int32_t primaryTsCol; int32_t primarySrcSlotId; uint64_t curGroupId; // current handled group id @@ -819,7 +801,7 @@ typedef struct SStreamFillOperatorInfo { int32_t srcDelRowIndex; SSDataBlock* pDelRes; SNode* pCondition; - SArray* pColMatchColInfo; + SColMatchInfo matchInfo; int32_t primaryTsCol; int32_t primarySrcSlotId; SStreamFillInfo* pFillInfo; @@ -863,7 +845,7 @@ typedef struct SSortOperatorInfo { uint32_t sortBufSize; // max buffer size for in-memory sort SArray* pSortInfo; SSortHandle* pSortHandle; - SArray* pColMatchInfo; // for index map from table scan output + SColMatchInfo matchInfo; int32_t bufPageSize; int64_t startTs; // sort start time uint64_t sortElapsed; // sort elapsed time, time to flush to disk not included. @@ -896,8 +878,7 @@ typedef struct SJoinOperatorInfo { void doDestroyExchangeOperatorInfo(void* param); SOperatorFpSet createOperatorFpSet(__optr_open_fn_t openFn, __optr_fn_t nextFn, __optr_fn_t streamFn, - __optr_fn_t cleanup, __optr_close_fn_t closeFn, __optr_encode_fn_t encode, - __optr_decode_fn_t decode, __optr_explain_fn_t explain); + __optr_fn_t cleanup, __optr_close_fn_t closeFn, __optr_explain_fn_t explain); int32_t operatorDummyOpenFn(SOperatorInfo* pOperator); int32_t appendDownstream(SOperatorInfo* p, SOperatorInfo** pDownstream, int32_t num); @@ -933,7 +914,7 @@ int32_t getTableScanInfo(SOperatorInfo* pOperator, int32_t* order, int32_t* scan int32_t getBufferPgSize(int32_t rowSize, uint32_t* defaultPgsz, uint32_t* defaultBufsz); void doSetOperatorCompleted(SOperatorInfo* pOperator); -void doFilter(const SNode* pFilterNode, SSDataBlock* pBlock, const SArray* pColMatchInfo, SFilterInfo* pFilterInfo); +void doFilter(const SNode* pFilterNode, SSDataBlock* pBlock, SColMatchInfo* pColMatchInfo, SFilterInfo* pFilterInfo); int32_t addTagPseudoColumnData(SReadHandle* pHandle, SExprInfo* pPseudoExpr, int32_t numOfPseudoExpr, SSDataBlock* pBlock, const char* idStr); diff --git a/source/libs/executor/src/cachescanoperator.c b/source/libs/executor/src/cachescanoperator.c index 8c76a3f69b..22a685230a 100644 --- a/source/libs/executor/src/cachescanoperator.c +++ b/source/libs/executor/src/cachescanoperator.c @@ -27,7 +27,8 @@ static SSDataBlock* doScanCache(SOperatorInfo* pOperator); static void destroyLastrowScanOperator(void* param); -static int32_t extractTargetSlotId(const SArray* pColMatchInfo, SExecTaskInfo* pTaskInfo, int32_t** pSlotIds); +static int32_t extractCacheScanSlotId(const SArray* pColMatchInfo, SExecTaskInfo* pTaskInfo, int32_t** pSlotIds); +static int32_t removeRedundantTsCol(SLastRowScanPhysiNode* pScanNode, SColMatchInfo* pColMatchInfo); SOperatorInfo* createCacherowsScanOperator(SLastRowScanPhysiNode* pScanNode, SReadHandle* readHandle, SExecTaskInfo* pTaskInfo) { @@ -40,12 +41,15 @@ SOperatorInfo* createCacherowsScanOperator(SLastRowScanPhysiNode* pScanNode, SRe } pInfo->readHandle = *readHandle; - pInfo->pRes = createResDataBlock(pScanNode->scan.node.pOutputDataBlockDesc); + + SDataBlockDescNode* pDescNode = pScanNode->scan.node.pOutputDataBlockDesc; + pInfo->pRes = createResDataBlock(pDescNode); int32_t numOfCols = 0; - pInfo->pColMatchInfo = extractColMatchInfo(pScanNode->scan.pScanCols, pScanNode->scan.node.pOutputDataBlockDesc, - &numOfCols, COL_MATCH_FROM_COL_ID); - code = extractTargetSlotId(pInfo->pColMatchInfo, pTaskInfo, &pInfo->pSlotIds); + code = extractColMatchInfo(pScanNode->scan.pScanCols, pDescNode, &numOfCols, COL_MATCH_FROM_COL_ID, &pInfo->matchInfo); + removeRedundantTsCol(pScanNode, &pInfo->matchInfo); + + code = extractCacheScanSlotId(pInfo->matchInfo.pList, pTaskInfo, &pInfo->pSlotIds); if (code != TSDB_CODE_SUCCESS) { goto _error; } @@ -60,7 +64,7 @@ SOperatorInfo* createCacherowsScanOperator(SLastRowScanPhysiNode* pScanNode, SRe if (taosArrayGetSize(pTableList->pGroupList) == taosArrayGetSize(pTableList->pTableList)) { pInfo->retrieveType = CACHESCAN_RETRIEVE_TYPE_ALL|(pScanNode->ignoreNull? CACHESCAN_RETRIEVE_LAST:CACHESCAN_RETRIEVE_LAST_ROW); code = tsdbCacherowsReaderOpen(pInfo->readHandle.vnode, pInfo->retrieveType, pTableList->pTableList, - taosArrayGetSize(pInfo->pColMatchInfo), &pInfo->pLastrowReader); + taosArrayGetSize(pInfo->matchInfo.pList), &pInfo->pLastrowReader); if (code != TSDB_CODE_SUCCESS) { goto _error; } @@ -72,11 +76,9 @@ SOperatorInfo* createCacherowsScanOperator(SLastRowScanPhysiNode* pScanNode, SRe } if (pScanNode->scan.pScanPseudoCols != NULL) { - SExprSupp* pPseudoExpr = &pInfo->pseudoExprSup; - - pPseudoExpr->pExprInfo = createExprInfo(pScanNode->scan.pScanPseudoCols, NULL, &pPseudoExpr->numOfExprs); - pPseudoExpr->pCtx = - createSqlFunctionCtx(pPseudoExpr->pExprInfo, pPseudoExpr->numOfExprs, &pPseudoExpr->rowEntryInfoOffset); + SExprSupp* p = &pInfo->pseudoExprSup; + p->pExprInfo = createExprInfo(pScanNode->scan.pScanPseudoCols, NULL, &p->numOfExprs); + p->pCtx = createSqlFunctionCtx(p->pExprInfo, p->numOfExprs, &p->rowEntryInfoOffset); } pOperator->name = "LastrowScanOperator"; @@ -88,7 +90,7 @@ SOperatorInfo* createCacherowsScanOperator(SLastRowScanPhysiNode* pScanNode, SRe pOperator->exprSupp.numOfExprs = taosArrayGetSize(pInfo->pRes->pDataBlock); pOperator->fpSet = - createOperatorFpSet(operatorDummyOpenFn, doScanCache, NULL, NULL, destroyLastrowScanOperator, NULL, NULL, NULL); + createOperatorFpSet(operatorDummyOpenFn, doScanCache, NULL, NULL, destroyLastrowScanOperator, NULL); pOperator->cost.openCost = 0; return pOperator; @@ -130,14 +132,16 @@ SSDataBlock* doScanCache(SOperatorInfo* pOperator) { // check for tag values int32_t resultRows = pInfo->pBufferredRes->info.rows; - ASSERT(resultRows == taosArrayGetSize(pInfo->pUidList)); + + // the results may be null, if last values are all null + ASSERT(resultRows == 0 || resultRows == taosArrayGetSize(pInfo->pUidList)); pInfo->indexOfBufferedRes = 0; } if (pInfo->indexOfBufferedRes < pInfo->pBufferredRes->info.rows) { - for (int32_t i = 0; i < taosArrayGetSize(pInfo->pColMatchInfo); ++i) { - SColMatchInfo* pMatchInfo = taosArrayGet(pInfo->pColMatchInfo, i); - int32_t slotId = pMatchInfo->targetSlotId; + for (int32_t i = 0; i < taosArrayGetSize(pInfo->matchInfo.pList); ++i) { + SColMatchItem* pMatchInfo = taosArrayGet(pInfo->matchInfo.pList, i); + int32_t slotId = pMatchInfo->dstSlotId; SColumnInfoData* pSrc = taosArrayGet(pInfo->pBufferredRes->pDataBlock, slotId); SColumnInfoData* pDst = taosArrayGet(pInfo->pRes->pDataBlock, slotId); @@ -184,7 +188,7 @@ SSDataBlock* doScanCache(SOperatorInfo* pOperator) { SArray* pGroupTableList = taosArrayGetP(pTableList->pGroupList, pInfo->currentGroupIndex); tsdbCacherowsReaderOpen(pInfo->readHandle.vnode, pInfo->retrieveType, pGroupTableList, - taosArrayGetSize(pInfo->pColMatchInfo), &pInfo->pLastrowReader); + taosArrayGetSize(pInfo->matchInfo.pList), &pInfo->pLastrowReader); taosArrayClear(pInfo->pUidList); int32_t code = tsdbRetrieveCacheRows(pInfo->pLastrowReader, pInfo->pRes, pInfo->pSlotIds, pInfo->pUidList); @@ -231,7 +235,7 @@ void destroyLastrowScanOperator(void* param) { blockDataDestroy(pInfo->pBufferredRes); taosMemoryFree(pInfo->pSlotIds); taosArrayDestroy(pInfo->pUidList); - taosArrayDestroy(pInfo->pColMatchInfo); + taosArrayDestroy(pInfo->matchInfo.pList); if (pInfo->pLastrowReader != NULL) { pInfo->pLastrowReader = tsdbCacherowsReaderClose(pInfo->pLastrowReader); @@ -240,7 +244,7 @@ void destroyLastrowScanOperator(void* param) { taosMemoryFreeClear(param); } -int32_t extractTargetSlotId(const SArray* pColMatchInfo, SExecTaskInfo* pTaskInfo, int32_t** pSlotIds) { +int32_t extractCacheScanSlotId(const SArray* pColMatchInfo, SExecTaskInfo* pTaskInfo, int32_t** pSlotIds) { size_t numOfCols = taosArrayGetSize(pColMatchInfo); *pSlotIds = taosMemoryMalloc(numOfCols * sizeof(int32_t)); @@ -248,21 +252,48 @@ int32_t extractTargetSlotId(const SArray* pColMatchInfo, SExecTaskInfo* pTaskInf return TSDB_CODE_OUT_OF_MEMORY; } + SSchemaWrapper* pWrapper = pTaskInfo->schemaInfo.sw; + for (int32_t i = 0; i < numOfCols; ++i) { - SColMatchInfo* pColMatch = taosArrayGet(pColMatchInfo, i); - for (int32_t j = 0; j < pTaskInfo->schemaInfo.sw->nCols; ++j) { - if (pColMatch->colId == pTaskInfo->schemaInfo.sw->pSchema[j].colId && + SColMatchItem* pColMatch = taosArrayGet(pColMatchInfo, i); + for (int32_t j = 0; j < pWrapper->nCols; ++j) { + if (pColMatch->colId == pWrapper->pSchema[j].colId && pColMatch->colId == PRIMARYKEY_TIMESTAMP_COL_ID) { - (*pSlotIds)[pColMatch->targetSlotId] = -1; + (*pSlotIds)[pColMatch->dstSlotId] = -1; break; } - if (pColMatch->colId == pTaskInfo->schemaInfo.sw->pSchema[j].colId) { - (*pSlotIds)[pColMatch->targetSlotId] = j; + if (pColMatch->colId == pWrapper->pSchema[j].colId) { + (*pSlotIds)[pColMatch->dstSlotId] = j; break; } } } + return TSDB_CODE_SUCCESS; +} + +int32_t removeRedundantTsCol(SLastRowScanPhysiNode* pScanNode, SColMatchInfo* pColMatchInfo) { + if (!pScanNode->ignoreNull) { // retrieve cached last value + return TSDB_CODE_SUCCESS; + } + + size_t size = taosArrayGetSize(pColMatchInfo->pList); + SArray* pMatchInfo = taosArrayInit(size, sizeof(SColMatchInfo)); + + for (int32_t i = 0; i < size; ++i) { + SColMatchItem* pColInfo = taosArrayGet(pColMatchInfo->pList, i); + + int32_t slotId = pColInfo->dstSlotId; + SNodeList* pList = pScanNode->scan.node.pOutputDataBlockDesc->pSlots; + + SSlotDescNode* pDesc = (SSlotDescNode*)nodesListGetNode(pList, slotId); + if (pDesc->dataType.type != TSDB_DATA_TYPE_TIMESTAMP) { + taosArrayPush(pMatchInfo, pColInfo); + } + } + + taosArrayDestroy(pColMatchInfo->pList); + pColMatchInfo->pList = pMatchInfo; return TSDB_CODE_SUCCESS; } \ No newline at end of file diff --git a/source/libs/executor/src/dataDeleter.c b/source/libs/executor/src/dataDeleter.c index 2ed83a6469..c7a2480204 100644 --- a/source/libs/executor/src/dataDeleter.c +++ b/source/libs/executor/src/dataDeleter.c @@ -53,22 +53,6 @@ typedef struct SDataDeleterHandle { TdThreadMutex mutex; } SDataDeleterHandle; -static bool needCompress(const SSDataBlock* pData, int32_t numOfCols) { - if (tsCompressColData < 0 || 0 == pData->info.rows) { - return false; - } - - for (int32_t col = 0; col < numOfCols; ++col) { - SColumnInfoData* pColRes = taosArrayGet(pData->pDataBlock, col); - int32_t colSize = pColRes->info.bytes * pData->info.rows; - if (NEEDTO_COMPRESS_QUERY(colSize)) { - return true; - } - } - - return false; -} - static void toDataCacheEntry(SDataDeleterHandle* pHandle, const SInputData* pInput, SDataDeleterBuf* pBuf) { int32_t numOfCols = LIST_LENGTH(pHandle->pSchema->pSlots); diff --git a/source/libs/executor/src/dataDispatcher.c b/source/libs/executor/src/dataDispatcher.c index b758e4b1dd..bc4ab9c468 100644 --- a/source/libs/executor/src/dataDispatcher.c +++ b/source/libs/executor/src/dataDispatcher.c @@ -51,22 +51,6 @@ typedef struct SDataDispatchHandle { TdThreadMutex mutex; } SDataDispatchHandle; -static bool needCompress(const SSDataBlock* pData, int32_t numOfCols) { - if (tsCompressColData < 0 || 0 == pData->info.rows) { - return false; - } - - for (int32_t col = 0; col < numOfCols; ++col) { - SColumnInfoData* pColRes = taosArrayGet(pData->pDataBlock, col); - int32_t colSize = pColRes->info.bytes * pData->info.rows; - if (NEEDTO_COMPRESS_QUERY(colSize)) { - return true; - } - } - - return false; -} - // clang-format off // data format: // +----------------+------------------+--------------+--------------+------------------+--------------------------------------------+------------------------------------+-------------+-----------+-------------+-----------+ @@ -86,7 +70,7 @@ static void toDataCacheEntry(SDataDispatchHandle* pHandle, const SInputData* pIn } } SDataCacheEntry* pEntry = (SDataCacheEntry*)pBuf->pData; - pEntry->compressed = (int8_t)needCompress(pInput->pData, numOfCols); + pEntry->compressed = 0; pEntry->numOfRows = pInput->pData->info.rows; pEntry->numOfCols = numOfCols; pEntry->dataLen = 0; diff --git a/source/libs/executor/src/executil.c b/source/libs/executor/src/executil.c index 11d6665614..f58c2a0e34 100644 --- a/source/libs/executor/src/executil.c +++ b/source/libs/executor/src/executil.c @@ -1066,13 +1066,17 @@ SArray* extractPartitionColInfo(SNodeList* pNodeList) { return pList; } -SArray* extractColMatchInfo(SNodeList* pNodeList, SDataBlockDescNode* pOutputNodeList, int32_t* numOfOutputCols, - int32_t type) { - size_t numOfCols = LIST_LENGTH(pNodeList); +int32_t extractColMatchInfo(SNodeList* pNodeList, SDataBlockDescNode* pOutputNodeList, int32_t* numOfOutputCols, + int32_t type, SColMatchInfo* pMatchInfo) { + size_t numOfCols = LIST_LENGTH(pNodeList); + int32_t code = 0; + + pMatchInfo->matchType = type; + SArray* pList = taosArrayInit(numOfCols, sizeof(SColMatchInfo)); if (pList == NULL) { - terrno = TSDB_CODE_OUT_OF_MEMORY; - return NULL; + code = TSDB_CODE_OUT_OF_MEMORY; + return code; } for (int32_t i = 0; i < numOfCols; ++i) { @@ -1080,12 +1084,10 @@ SArray* extractColMatchInfo(SNodeList* pNodeList, SDataBlockDescNode* pOutputNod if (nodeType(pNode->pExpr) == QUERY_NODE_COLUMN) { SColumnNode* pColNode = (SColumnNode*)pNode->pExpr; - SColMatchInfo c = {0}; - c.output = true; + SColMatchItem c = {.needOutput = true}; c.colId = pColNode->colId; c.srcSlotId = pColNode->slotId; - c.matchType = type; - c.targetSlotId = pNode->slotId; + c.dstSlotId = pNode->slotId; taosArrayPush(pList, &c); } } @@ -1102,10 +1104,10 @@ SArray* extractColMatchInfo(SNodeList* pNodeList, SDataBlockDescNode* pOutputNod continue; } - SColMatchInfo* info = NULL; + SColMatchItem* info = NULL; for (int32_t j = 0; j < taosArrayGetSize(pList); ++j) { info = taosArrayGet(pList, j); - if (info->targetSlotId == pNode->slotId) { + if (info->dstSlotId == pNode->slotId) { break; } } @@ -1114,11 +1116,12 @@ SArray* extractColMatchInfo(SNodeList* pNodeList, SDataBlockDescNode* pOutputNod (*numOfOutputCols) += 1; } else if (info != NULL) { // select distinct tbname from stb where tbname='abc'; - info->output = false; + info->needOutput = false; } } - return pList; + pMatchInfo->pList = pList; + return code; } static SResSchema createResSchema(int32_t type, int32_t bytes, int32_t slotId, int32_t scale, int32_t precision, @@ -1407,14 +1410,14 @@ void relocateColumnData(SSDataBlock* pBlock, const SArray* pColMatchInfo, SArray int32_t i = 0, j = 0; while (i < numOfSrcCols && j < taosArrayGetSize(pColMatchInfo)) { SColumnInfoData* p = taosArrayGet(pCols, i); - SColMatchInfo* pmInfo = taosArrayGet(pColMatchInfo, j); - if (!outputEveryColumn && pmInfo->reserved) { + SColMatchItem* pmInfo = taosArrayGet(pColMatchInfo, j); +/* if (!outputEveryColumn && pmInfo->reserved) { j++; continue; - } + }*/ if (p->info.colId == pmInfo->colId) { - SColumnInfoData* pDst = taosArrayGet(pBlock->pDataBlock, pmInfo->targetSlotId); + SColumnInfoData* pDst = taosArrayGet(pBlock->pDataBlock, pmInfo->dstSlotId); colDataAssign(pDst, p, pBlock->info.rows, &pBlock->info); i++; j++; diff --git a/source/libs/executor/src/executor.c b/source/libs/executor/src/executor.c index fb4248e886..0312105ca8 100644 --- a/source/libs/executor/src/executor.c +++ b/source/libs/executor/src/executor.c @@ -355,7 +355,7 @@ int32_t qCreateExecTask(SReadHandle* readHandle, int32_t vgId, uint64_t taskId, goto _error; } - SDataSinkMgtCfg cfg = {.maxDataBlockNum = 10000, .maxDataBlockNumPerQuery = 5000}; + SDataSinkMgtCfg cfg = {.maxDataBlockNum = 500, .maxDataBlockNumPerQuery = 50}; code = dsDataSinkMgtInit(&cfg); if (code != TSDB_CODE_SUCCESS) { qError("failed to dsDataSinkMgtInit, code:%s, %s", tstrerror(code), (*pTask)->id.str); diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index e55404935c..2432944928 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -110,16 +110,13 @@ int32_t operatorDummyOpenFn(SOperatorInfo* pOperator) { } SOperatorFpSet createOperatorFpSet(__optr_open_fn_t openFn, __optr_fn_t nextFn, __optr_fn_t streamFn, - __optr_fn_t cleanup, __optr_close_fn_t closeFn, __optr_encode_fn_t encode, - __optr_decode_fn_t decode, __optr_explain_fn_t explain) { + __optr_fn_t cleanup, __optr_close_fn_t closeFn, __optr_explain_fn_t explain) { SOperatorFpSet fpSet = { ._openFn = openFn, .getNextFn = nextFn, .getStreamResFn = streamFn, .cleanupFn = cleanup, .closeFn = closeFn, - .encodeResultRow = encode, - .decodeResultRow = decode, .getExplainFn = explain, }; @@ -1089,7 +1086,7 @@ void setResultRowInitCtx(SResultRow* pResult, SqlFunctionCtx* pCtx, int32_t numO static void extractQualifiedTupleByFilterResult(SSDataBlock* pBlock, const SColumnInfoData* p, bool keep, int32_t status); -void doFilter(const SNode* pFilterNode, SSDataBlock* pBlock, const SArray* pColMatchInfo, SFilterInfo* pFilterInfo) { +void doFilter(const SNode* pFilterNode, SSDataBlock* pBlock, SColMatchInfo* pColMatchInfo, SFilterInfo* pFilterInfo) { if (pFilterNode == NULL || pBlock->info.rows == 0) { return; } @@ -1123,12 +1120,12 @@ void doFilter(const SNode* pFilterNode, SSDataBlock* pBlock, const SArray* pColM extractQualifiedTupleByFilterResult(pBlock, p, keep, status); if (pColMatchInfo != NULL) { - for (int32_t i = 0; i < taosArrayGetSize(pColMatchInfo); ++i) { - SColMatchInfo* pInfo = taosArrayGet(pColMatchInfo, i); + for (int32_t i = 0; i < taosArrayGetSize(pColMatchInfo->pList); ++i) { + SColMatchItem* pInfo = taosArrayGet(pColMatchInfo->pList, i); if (pInfo->colId == PRIMARYKEY_TIMESTAMP_COL_ID) { - SColumnInfoData* pColData = taosArrayGet(pBlock->pDataBlock, pInfo->targetSlotId); + SColumnInfoData* pColData = taosArrayGet(pBlock->pDataBlock, pInfo->dstSlotId); if (pColData->info.type == TSDB_DATA_TYPE_TIMESTAMP) { - blockDataUpdateTsWindow(pBlock, pInfo->targetSlotId); + blockDataUpdateTsWindow(pBlock, pInfo->dstSlotId); break; } } @@ -2305,7 +2302,7 @@ SOperatorInfo* createExchangeOperatorInfo(void* pTransporter, SExchangePhysiNode pOperator->pTaskInfo = pTaskInfo; pOperator->fpSet = createOperatorFpSet(prepareLoadRemoteData, doLoadRemoteData, NULL, NULL, - destroyExchangeOperatorInfo, NULL, NULL, NULL); + destroyExchangeOperatorInfo, NULL); return pOperator; _error: @@ -2563,57 +2560,6 @@ int32_t aggEncodeResultRow(SOperatorInfo* pOperator, char** result, int32_t* len return TDB_CODE_SUCCESS; } -int32_t aggDecodeResultRow(SOperatorInfo* pOperator, char* result) { - if (result == NULL) { - return TSDB_CODE_TSC_INVALID_INPUT; - } - SOptrBasicInfo* pInfo = (SOptrBasicInfo*)(pOperator->info); - SAggSupporter* pSup = (SAggSupporter*)POINTER_SHIFT(pOperator->info, sizeof(SOptrBasicInfo)); - - // int32_t size = taosHashGetSize(pSup->pResultRowHashTable); - int32_t length = *(int32_t*)(result); - int32_t offset = sizeof(int32_t); - - int32_t count = *(int32_t*)(result + offset); - offset += sizeof(int32_t); - - while (count-- > 0 && length > offset) { - int32_t keyLen = *(int32_t*)(result + offset); - offset += sizeof(int32_t); - - uint64_t tableGroupId = *(uint64_t*)(result + offset); - SResultRow* resultRow = getNewResultRow(pSup->pResultBuf, &pSup->currentPageId, pSup->resultRowSize); - if (!resultRow) { - return TSDB_CODE_TSC_INVALID_INPUT; - } - - // add a new result set for a new group - SResultRowPosition pos = {.pageId = resultRow->pageId, .offset = resultRow->offset}; - tSimpleHashPut(pSup->pResultRowHashTable, result + offset, keyLen, &pos, sizeof(SResultRowPosition)); - - offset += keyLen; - int32_t valueLen = *(int32_t*)(result + offset); - if (valueLen != pSup->resultRowSize) { - return TSDB_CODE_TSC_INVALID_INPUT; - } - offset += sizeof(int32_t); - int32_t pageId = resultRow->pageId; - int32_t pOffset = resultRow->offset; - memcpy(resultRow, result + offset, valueLen); - resultRow->pageId = pageId; - resultRow->offset = pOffset; - offset += valueLen; - - pInfo->resultRowInfo.cur = (SResultRowPosition){.pageId = resultRow->pageId, .offset = resultRow->offset}; - // releaseBufPage(pSup->pResultBuf, getBufPage(pSup->pResultBuf, pageId)); - } - - if (offset != length) { - return TSDB_CODE_TSC_INVALID_INPUT; - } - return TDB_CODE_SUCCESS; -} - int32_t handleLimitOffset(SOperatorInfo* pOperator, SLimitInfo* pLimitInfo, SSDataBlock* pBlock, bool holdDataInBuf) { if (pLimitInfo->remainGroupOffset > 0) { if (pLimitInfo->currentGroupId == 0) { // it is the first group @@ -2853,7 +2799,7 @@ static SSDataBlock* doFill(SOperatorInfo* pOperator) { break; } - doFilter(pInfo->pCondition, fillResult, pInfo->pColMatchColInfo, NULL); + doFilter(pInfo->pCondition, fillResult, &pInfo->matchInfo, NULL); if (fillResult->info.rows > 0) { break; } @@ -3081,7 +3027,7 @@ SOperatorInfo* createAggregateOperatorInfo(SOperatorInfo* downstream, SAggPhysiN pOperator->pTaskInfo = pTaskInfo; pOperator->fpSet = createOperatorFpSet(doOpenAggregateOptr, getAggregateResult, NULL, NULL, destroyAggOperatorInfo, - aggEncodeResultRow, aggDecodeResultRow, NULL); + NULL); if (downstream->operatorType == QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN) { STableScanInfo* pTableScanInfo = downstream->info; @@ -3101,9 +3047,11 @@ _error: destroyAggOperatorInfo(pInfo); } - cleanupExprSupp(&pOperator->exprSupp); - taosMemoryFreeClear(pOperator); + if (pOperator != NULL) { + cleanupExprSupp(&pOperator->exprSupp); + } + taosMemoryFreeClear(pOperator); pTaskInfo->code = TSDB_CODE_OUT_OF_MEMORY; return NULL; } @@ -3139,7 +3087,7 @@ void destroyFillOperatorInfo(void* param) { cleanupExprSupp(&pInfo->noFillExprSupp); taosMemoryFreeClear(pInfo->p); - taosArrayDestroy(pInfo->pColMatchColInfo); + taosArrayDestroy(pInfo->matchInfo.pList); taosMemoryFreeClear(param); } @@ -3283,8 +3231,8 @@ SOperatorInfo* createFillOperatorInfo(SOperatorInfo* downstream, SFillPhysiNode* pInfo->primarySrcSlotId = ((SColumnNode*)((STargetNode*)pPhyFillNode->pWStartTs)->pExpr)->slotId; int32_t numOfOutputCols = 0; - pInfo->pColMatchColInfo = extractColMatchInfo(pPhyFillNode->pFillExprs, pPhyFillNode->node.pOutputDataBlockDesc, - &numOfOutputCols, COL_MATCH_FROM_SLOT_ID); + code = extractColMatchInfo(pPhyFillNode->pFillExprs, pPhyFillNode->node.pOutputDataBlockDesc, &numOfOutputCols, + COL_MATCH_FROM_SLOT_ID, &pInfo->matchInfo); code = initFillInfo(pInfo, pExprInfo, pInfo->numOfExpr, pNoFillSupp->pExprInfo, pNoFillSupp->numOfExprs, (SNodeListNode*)pPhyFillNode->pValues, pPhyFillNode->timeRange, pResultInfo->capacity, @@ -3306,7 +3254,7 @@ SOperatorInfo* createFillOperatorInfo(SOperatorInfo* downstream, SFillPhysiNode* pOperator->pTaskInfo = pTaskInfo; pOperator->fpSet = - createOperatorFpSet(operatorDummyOpenFn, doFill, NULL, NULL, destroyFillOperatorInfo, NULL, NULL, NULL); + createOperatorFpSet(operatorDummyOpenFn, doFill, NULL, NULL, destroyFillOperatorInfo, NULL); code = appendDownstream(pOperator, &downstream, 1); return pOperator; diff --git a/source/libs/executor/src/groupoperator.c b/source/libs/executor/src/groupoperator.c index 60794fc22a..644f02f60d 100644 --- a/source/libs/executor/src/groupoperator.c +++ b/source/libs/executor/src/groupoperator.c @@ -443,7 +443,7 @@ SOperatorInfo* createGroupOperatorInfo(SOperatorInfo* downstream, SAggPhysiNode pOperator->pTaskInfo = pTaskInfo; pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, hashGroupbyAggregate, NULL, NULL, - destroyGroupOperatorInfo, aggEncodeResultRow, aggDecodeResultRow, NULL); + destroyGroupOperatorInfo, NULL); code = appendDownstream(pOperator, &downstream, 1); if (code != TSDB_CODE_SUCCESS) { goto _error; @@ -820,7 +820,7 @@ SOperatorInfo* createPartitionOperatorInfo(SOperatorInfo* downstream, SPartition pOperator->pTaskInfo = pTaskInfo; pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, hashPartition, NULL, NULL, destroyPartitionOperatorInfo, - NULL, NULL, NULL); + NULL); code = appendDownstream(pOperator, &downstream, 1); return pOperator; @@ -1095,7 +1095,7 @@ SOperatorInfo* createStreamPartitionOperatorInfo(SOperatorInfo* downstream, SStr pOperator->info = pInfo; pOperator->pTaskInfo = pTaskInfo; pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, doStreamHashPartition, NULL, NULL, - destroyStreamPartitionOperatorInfo, NULL, NULL, NULL); + destroyStreamPartitionOperatorInfo, NULL); initParDownStream(downstream, &pInfo->partitionSup, &pInfo->scalarSup); code = appendDownstream(pOperator, &downstream, 1); diff --git a/source/libs/executor/src/joinoperator.c b/source/libs/executor/src/joinoperator.c index eab0307e01..8dac44684f 100644 --- a/source/libs/executor/src/joinoperator.c +++ b/source/libs/executor/src/joinoperator.c @@ -116,7 +116,7 @@ SOperatorInfo* createMergeJoinOperatorInfo(SOperatorInfo** pDownstream, int32_t } pOperator->fpSet = - createOperatorFpSet(operatorDummyOpenFn, doMergeJoin, NULL, NULL, destroyMergeJoinOperator, NULL, NULL, NULL); + createOperatorFpSet(operatorDummyOpenFn, doMergeJoin, NULL, NULL, destroyMergeJoinOperator, NULL); code = appendDownstream(pOperator, pDownstream, numOfDownstream); if (code != TSDB_CODE_SUCCESS) { goto _error; diff --git a/source/libs/executor/src/projectoperator.c b/source/libs/executor/src/projectoperator.c index 56fd6a99ef..b3ea7a5573 100644 --- a/source/libs/executor/src/projectoperator.c +++ b/source/libs/executor/src/projectoperator.c @@ -105,7 +105,7 @@ SOperatorInfo* createProjectOperatorInfo(SOperatorInfo* downstream, SProjectPhys pOperator->info = pInfo; pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, doProjectOperation, NULL, NULL, - destroyProjectOperatorInfo, NULL, NULL, NULL); + destroyProjectOperatorInfo, NULL); code = appendDownstream(pOperator, &downstream, 1); if (code != TSDB_CODE_SUCCESS) { @@ -405,7 +405,7 @@ SOperatorInfo* createIndefinitOutputOperatorInfo(SOperatorInfo* downstream, SPhy pOperator->info = pInfo; pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, doApplyIndefinitFunction, NULL, NULL, - destroyIndefinitOperatorInfo, NULL, NULL, NULL); + destroyIndefinitOperatorInfo, NULL); code = appendDownstream(pOperator, &downstream, 1); if (code != TSDB_CODE_SUCCESS) { diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index b782313688..9773a0c8e7 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -331,12 +331,13 @@ static bool doLoadBlockSMA(STableScanInfo* pTableScanInfo, SSDataBlock* pBlock, } } - for (int32_t i = 0; i < taosArrayGetSize(pTableScanInfo->pColMatchInfo); ++i) { - SColMatchInfo* pColMatchInfo = taosArrayGet(pTableScanInfo->pColMatchInfo, i); - if (!pColMatchInfo->output) { + for (int32_t i = 0; i < taosArrayGetSize(pTableScanInfo->matchInfo.pList); ++i) { + SColMatchItem* pColMatchInfo = taosArrayGet(pTableScanInfo->matchInfo.pList, i); + if (!pColMatchInfo->needOutput) { continue; } - pBlock->pBlockAgg[pColMatchInfo->targetSlotId] = pColAgg[i]; + + pBlock->pBlockAgg[pColMatchInfo->dstSlotId] = pColAgg[i]; } return true; @@ -442,12 +443,12 @@ static int32_t loadDataBlock(SOperatorInfo* pOperator, STableScanInfo* pTableSca return terrno; } - relocateColumnData(pBlock, pTableScanInfo->pColMatchInfo, pCols, true); + relocateColumnData(pBlock, pTableScanInfo->matchInfo.pList, pCols, true); doSetTagColumnData(pTableScanInfo, pBlock, pTaskInfo); if (pTableScanInfo->pFilterNode != NULL) { int64_t st = taosGetTimestampUs(); - doFilter(pTableScanInfo->pFilterNode, pBlock, pTableScanInfo->pColMatchInfo, pOperator->exprSupp.pFilterInfo); + doFilter(pTableScanInfo->pFilterNode, pBlock, &pTableScanInfo->matchInfo, pOperator->exprSupp.pFilterInfo); double el = (taosGetTimestampUs() - st) / 1000.0; pTableScanInfo->readRecorder.filterTime += el; @@ -780,8 +781,8 @@ static void destroyTableScanOperatorInfo(void* param) { tsdbReaderClose(pTableScanInfo->dataReader); pTableScanInfo->dataReader = NULL; - if (pTableScanInfo->pColMatchInfo != NULL) { - taosArrayDestroy(pTableScanInfo->pColMatchInfo); + if (pTableScanInfo->matchInfo.pList != NULL) { + taosArrayDestroy(pTableScanInfo->matchInfo.pList); } cleanupExprSupp(&pTableScanInfo->pseudoSup); @@ -798,10 +799,10 @@ SOperatorInfo* createTableScanOperatorInfo(STableScanPhysiNode* pTableScanNode, SDataBlockDescNode* pDescNode = pTableScanNode->scan.node.pOutputDataBlockDesc; int32_t numOfCols = 0; - pInfo->pColMatchInfo = - extractColMatchInfo(pTableScanNode->scan.pScanCols, pDescNode, &numOfCols, COL_MATCH_FROM_COL_ID); + int32_t code = extractColMatchInfo(pTableScanNode->scan.pScanCols, pDescNode, &numOfCols, COL_MATCH_FROM_COL_ID, + &pInfo->matchInfo); - int32_t code = initQueryTableDataCond(&pInfo->cond, pTableScanNode); + code = initQueryTableDataCond(&pInfo->cond, pTableScanNode); if (code != TSDB_CODE_SUCCESS) { goto _error; } @@ -839,7 +840,7 @@ SOperatorInfo* createTableScanOperatorInfo(STableScanPhysiNode* pTableScanNode, pOperator->pTaskInfo = pTaskInfo; pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, doTableScan, NULL, NULL, destroyTableScanOperatorInfo, - NULL, NULL, getTableScannerExecInfo); + getTableScannerExecInfo); // for non-blocking operator, the open cost is always 0 pOperator->cost.openCost = 0; @@ -867,7 +868,7 @@ SOperatorInfo* createTableSeqScanOperatorInfo(void* pReadHandle, SExecTaskInfo* pOperator->info = pInfo; pOperator->pTaskInfo = pTaskInfo; - pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, doTableScanImpl, NULL, NULL, NULL, NULL, NULL, NULL); + pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, doTableScanImpl, NULL, NULL, NULL, NULL); return pOperator; } @@ -988,7 +989,7 @@ SOperatorInfo* createDataBlockInfoScanOperator(void* dataReader, SReadHandle* re pOperator->pTaskInfo = pTaskInfo; pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, doBlockInfoScan, NULL, NULL, - destroyBlockDistScanOperatorInfo, NULL, NULL, NULL); + destroyBlockDistScanOperatorInfo, NULL); return pOperator; _error: @@ -1512,9 +1513,9 @@ static int32_t setBlockIntoRes(SStreamScanInfo* pInfo, const SSDataBlock* pBlock } // todo extract method - for (int32_t i = 0; i < taosArrayGetSize(pInfo->pColMatchInfo); ++i) { - SColMatchInfo* pColMatchInfo = taosArrayGet(pInfo->pColMatchInfo, i); - if (!pColMatchInfo->output) { + for (int32_t i = 0; i < taosArrayGetSize(pInfo->matchInfo.pList); ++i) { + SColMatchItem* pColMatchInfo = taosArrayGet(pInfo->matchInfo.pList, i); + if (!pColMatchInfo->needOutput) { continue; } @@ -1522,7 +1523,7 @@ static int32_t setBlockIntoRes(SStreamScanInfo* pInfo, const SSDataBlock* pBlock for (int32_t j = 0; j < blockDataGetNumOfCols(pBlock); ++j) { SColumnInfoData* pResCol = bdGetColumnInfoData(pBlock, j); if (pResCol->info.colId == pColMatchInfo->colId) { - SColumnInfoData* pDst = taosArrayGet(pInfo->pRes->pDataBlock, pColMatchInfo->targetSlotId); + SColumnInfoData* pDst = taosArrayGet(pInfo->pRes->pDataBlock, pColMatchInfo->dstSlotId); colDataAssign(pDst, pResCol, pBlock->info.rows, &pInfo->pRes->info); colExists = true; break; @@ -1531,7 +1532,7 @@ static int32_t setBlockIntoRes(SStreamScanInfo* pInfo, const SSDataBlock* pBlock // the required column does not exists in submit block, let's set it to be all null value if (!colExists) { - SColumnInfoData* pDst = taosArrayGet(pInfo->pRes->pDataBlock, pColMatchInfo->targetSlotId); + SColumnInfoData* pDst = taosArrayGet(pInfo->pRes->pDataBlock, pColMatchInfo->dstSlotId); colDataAppendNNULL(pDst, 0, pBlockInfo->rows); } } @@ -2173,7 +2174,7 @@ SOperatorInfo* createRawScanOperatorInfo(SReadHandle* pHandle, SExecTaskInfo* pT pOperator->info = pInfo; pOperator->pTaskInfo = pTaskInfo; - pOperator->fpSet = createOperatorFpSet(NULL, doRawScan, NULL, NULL, destroyRawScanOperatorInfo, NULL, NULL, NULL); + pOperator->fpSet = createOperatorFpSet(NULL, doRawScan, NULL, NULL, destroyRawScanOperatorInfo, NULL); return pOperator; _end: @@ -2193,8 +2194,8 @@ static void destroyStreamScanOperatorInfo(void* param) { if (pStreamScan->tqReader) { tqCloseReader(pStreamScan->tqReader); } - if (pStreamScan->pColMatchInfo) { - taosArrayDestroy(pStreamScan->pColMatchInfo); + if (pStreamScan->matchInfo.pList) { + taosArrayDestroy(pStreamScan->matchInfo.pList); } if (pStreamScan->pPseudoExpr) { destroyExprInfo(pStreamScan->pPseudoExpr, pStreamScan->numOfPseudoExpr); @@ -2228,17 +2229,17 @@ SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhys pInfo->pGroupTags = pTableScanNode->pGroupTags; int32_t numOfCols = 0; - pInfo->pColMatchInfo = extractColMatchInfo(pScanPhyNode->pScanCols, pDescNode, &numOfCols, COL_MATCH_FROM_COL_ID); + int32_t code = extractColMatchInfo(pScanPhyNode->pScanCols, pDescNode, &numOfCols, COL_MATCH_FROM_COL_ID, &pInfo->matchInfo); - int32_t numOfOutput = taosArrayGetSize(pInfo->pColMatchInfo); + int32_t numOfOutput = taosArrayGetSize(pInfo->matchInfo.pList); SArray* pColIds = taosArrayInit(numOfOutput, sizeof(int16_t)); for (int32_t i = 0; i < numOfOutput; ++i) { - SColMatchInfo* id = taosArrayGet(pInfo->pColMatchInfo, i); + SColMatchItem* id = taosArrayGet(pInfo->matchInfo.pList, i); int16_t colId = id->colId; taosArrayPush(pColIds, &colId); if (id->colId == PRIMARYKEY_TIMESTAMP_COL_ID) { - pInfo->primaryTsIndex = id->targetSlotId; + pInfo->primaryTsIndex = id->dstSlotId; } } @@ -2353,7 +2354,7 @@ SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhys __optr_fn_t nextFn = pTaskInfo->execModel == OPTR_EXEC_MODEL_STREAM ? doStreamScan : doQueueScan; pOperator->fpSet = - createOperatorFpSet(operatorDummyOpenFn, nextFn, NULL, NULL, destroyStreamScanOperatorInfo, NULL, NULL, NULL); + createOperatorFpSet(operatorDummyOpenFn, nextFn, NULL, NULL, destroyStreamScanOperatorInfo, NULL); return pOperator; @@ -2387,7 +2388,7 @@ static void destroySysScanOperator(void* param) { pInfo->pIdx = NULL; } - taosArrayDestroy(pInfo->scanCols); + taosArrayDestroy(pInfo->matchInfo.pList); taosMemoryFreeClear(pInfo->pUser); taosMemoryFreeClear(param); @@ -2752,7 +2753,7 @@ static void relocateAndFilterSysTagsScanResult(SSysTableScanInfo* pInfo, int32_t dataBlock->info.rows = numOfRows; pInfo->pRes->info.rows = numOfRows; - relocateColumnData(pInfo->pRes, pInfo->scanCols, dataBlock->pDataBlock, false); + relocateColumnData(pInfo->pRes, pInfo->matchInfo.pList, dataBlock->pDataBlock, false); doFilterResult(pInfo); blockDataCleanup(dataBlock); @@ -3441,7 +3442,7 @@ static SSDataBlock* sysTableBuildUserTablesByUids(SOperatorInfo* pOperator) { p->info.rows = numOfRows; pInfo->pRes->info.rows = numOfRows; - relocateColumnData(pInfo->pRes, pInfo->scanCols, p->pDataBlock, false); + relocateColumnData(pInfo->pRes, pInfo->matchInfo.pList, p->pDataBlock, false); doFilterResult(pInfo); blockDataCleanup(p); @@ -3457,7 +3458,7 @@ static SSDataBlock* sysTableBuildUserTablesByUids(SOperatorInfo* pOperator) { p->info.rows = numOfRows; pInfo->pRes->info.rows = numOfRows; - relocateColumnData(pInfo->pRes, pInfo->scanCols, p->pDataBlock, false); + relocateColumnData(pInfo->pRes, pInfo->matchInfo.pList, p->pDataBlock, false); doFilterResult(pInfo); blockDataCleanup(p); @@ -3618,7 +3619,7 @@ static SSDataBlock* sysTableBuildUserTables(SOperatorInfo* pOperator) { p->info.rows = numOfRows; pInfo->pRes->info.rows = numOfRows; - relocateColumnData(pInfo->pRes, pInfo->scanCols, p->pDataBlock, false); + relocateColumnData(pInfo->pRes, pInfo->matchInfo.pList, p->pDataBlock, false); doFilterResult(pInfo); blockDataCleanup(p); @@ -3634,7 +3635,7 @@ static SSDataBlock* sysTableBuildUserTables(SOperatorInfo* pOperator) { p->info.rows = numOfRows; pInfo->pRes->info.rows = numOfRows; - relocateColumnData(pInfo->pRes, pInfo->scanCols, p->pDataBlock, false); + relocateColumnData(pInfo->pRes, pInfo->matchInfo.pList, p->pDataBlock, false); doFilterResult(pInfo); blockDataCleanup(p); @@ -3798,7 +3799,7 @@ static SSDataBlock* doSysTableScan(SOperatorInfo* pOperator) { } char* pStart = pRsp->data; - extractDataBlockFromFetchRsp(pInfo->pRes, pRsp->data, pInfo->scanCols, &pStart); + extractDataBlockFromFetchRsp(pInfo->pRes, pRsp->data, pInfo->matchInfo.pList, &pStart); updateLoadRemoteInfo(&pInfo->loadInfo, pRsp->numOfRows, pRsp->compLen, startTs, pOperator); // todo log the filter info @@ -3827,7 +3828,7 @@ int32_t buildSysDbTableInfo(const SSysTableScanInfo* pInfo, int32_t capacity) { p->info.rows = buildDbTableInfoBlock(pInfo->sysInfo, p, pSysDbTableMeta, size, TSDB_PERFORMANCE_SCHEMA_DB); pInfo->pRes->info.rows = p->info.rows; - relocateColumnData(pInfo->pRes, pInfo->scanCols, p->pDataBlock, false); + relocateColumnData(pInfo->pRes, pInfo->matchInfo.pList, p->pDataBlock, false); blockDataDestroy(p); return pInfo->pRes->info.rows; @@ -3889,18 +3890,16 @@ SOperatorInfo* createSysTableScanOperatorInfo(void* readHandle, SSystemTableScan SScanPhysiNode* pScanNode = &pScanPhyNode->scan; SDataBlockDescNode* pDescNode = pScanNode->node.pOutputDataBlockDesc; - SSDataBlock* pResBlock = createResDataBlock(pDescNode); int32_t num = 0; - SArray* colList = extractColMatchInfo(pScanNode->pScanCols, pDescNode, &num, COL_MATCH_FROM_COL_ID); + int32_t code = extractColMatchInfo(pScanNode->pScanCols, pDescNode, &num, COL_MATCH_FROM_COL_ID, &pInfo->matchInfo); pInfo->accountId = pScanPhyNode->accountId; pInfo->pUser = taosMemoryStrDup((void*)pUser); pInfo->sysInfo = pScanPhyNode->sysInfo; pInfo->showRewrite = pScanPhyNode->showRewrite; - pInfo->pRes = pResBlock; + pInfo->pRes = createResDataBlock(pDescNode); pInfo->pCondition = pScanNode->node.pConditions; - pInfo->scanCols = colList; initResultSizeInfo(&pOperator->resultInfo, 4096); @@ -3922,11 +3921,11 @@ SOperatorInfo* createSysTableScanOperatorInfo(void* readHandle, SSystemTableScan pOperator->blocking = false; pOperator->status = OP_NOT_OPENED; pOperator->info = pInfo; - pOperator->exprSupp.numOfExprs = taosArrayGetSize(pResBlock->pDataBlock); + pOperator->exprSupp.numOfExprs = taosArrayGetSize(pInfo->pRes->pDataBlock); pOperator->pTaskInfo = pTaskInfo; pOperator->fpSet = - createOperatorFpSet(operatorDummyOpenFn, doSysTableScan, NULL, NULL, destroySysScanOperator, NULL, NULL, NULL); + createOperatorFpSet(operatorDummyOpenFn, doSysTableScan, NULL, NULL, destroySysScanOperator, NULL); return pOperator; @@ -4021,7 +4020,7 @@ static SSDataBlock* doTagScan(SOperatorInfo* pOperator) { static void destroyTagScanOperatorInfo(void* param) { STagScanInfo* pInfo = (STagScanInfo*)param; pInfo->pRes = blockDataDestroy(pInfo->pRes); - taosArrayDestroy(pInfo->pColMatchInfo); + taosArrayDestroy(pInfo->matchInfo.pList); taosMemoryFreeClear(param); } @@ -4038,15 +4037,14 @@ SOperatorInfo* createTagScanOperatorInfo(SReadHandle* pReadHandle, STagScanPhysi int32_t num = 0; int32_t numOfExprs = 0; SExprInfo* pExprInfo = createExprInfo(pPhyNode->pScanPseudoCols, NULL, &numOfExprs); - SArray* colList = extractColMatchInfo(pPhyNode->pScanPseudoCols, pDescNode, &num, COL_MATCH_FROM_COL_ID); + int32_t code = extractColMatchInfo(pPhyNode->pScanPseudoCols, pDescNode, &num, COL_MATCH_FROM_COL_ID, &pInfo->matchInfo); - int32_t code = initExprSupp(&pOperator->exprSupp, pExprInfo, numOfExprs); + code = initExprSupp(&pOperator->exprSupp, pExprInfo, numOfExprs); if (code != TSDB_CODE_SUCCESS) { goto _error; } pInfo->pTableList = pTableListInfo; - pInfo->pColMatchInfo = colList; pInfo->pRes = createResDataBlock(pDescNode); pInfo->readHandle = *pReadHandle; pInfo->curPos = 0; @@ -4063,7 +4061,7 @@ SOperatorInfo* createTagScanOperatorInfo(SReadHandle* pReadHandle, STagScanPhysi blockDataEnsureCapacity(pInfo->pRes, pOperator->resultInfo.capacity); pOperator->fpSet = - createOperatorFpSet(operatorDummyOpenFn, doTagScan, NULL, NULL, destroyTagScanOperatorInfo, NULL, NULL, NULL); + createOperatorFpSet(operatorDummyOpenFn, doTagScan, NULL, NULL, destroyTagScanOperatorInfo, NULL); return pOperator; @@ -4180,11 +4178,11 @@ static int32_t loadDataBlockFromOneTable(SOperatorInfo* pOperator, STableMergeSc } for (int32_t i = 0; i < numOfCols; ++i) { - SColMatchInfo* pColMatchInfo = taosArrayGet(pTableScanInfo->pColMatchInfo, i); - if (!pColMatchInfo->output) { + SColMatchItem* pColMatchInfo = taosArrayGet(pTableScanInfo->matchInfo.pList, i); + if (!pColMatchInfo->needOutput) { continue; } - pBlock->pBlockAgg[pColMatchInfo->targetSlotId] = pColAgg[i]; + pBlock->pBlockAgg[pColMatchInfo->dstSlotId] = pColAgg[i]; } return TSDB_CODE_SUCCESS; @@ -4215,7 +4213,7 @@ static int32_t loadDataBlockFromOneTable(SOperatorInfo* pOperator, STableMergeSc return terrno; } - relocateColumnData(pBlock, pTableScanInfo->pColMatchInfo, pCols, true); + relocateColumnData(pBlock, pTableScanInfo->matchInfo.pList, pCols, true); // currently only the tbname pseudo column if (pTableScanInfo->pseudoSup.numOfExprs > 0) { @@ -4228,7 +4226,7 @@ static int32_t loadDataBlockFromOneTable(SOperatorInfo* pOperator, STableMergeSc if (pTableScanInfo->pFilterNode != NULL) { int64_t st = taosGetTimestampMs(); - doFilter(pTableScanInfo->pFilterNode, pBlock, pTableScanInfo->pColMatchInfo, NULL); + doFilter(pTableScanInfo->pFilterNode, pBlock, &pTableScanInfo->matchInfo, NULL); double el = (taosGetTimestampUs() - st) / 1000.0; pTableScanInfo->readRecorder.filterTime += el; @@ -4312,9 +4310,9 @@ static SSDataBlock* getTableDataBlock(void* param) { SArray* generateSortByTsInfo(SArray* colMatchInfo, int32_t order) { int32_t tsTargetSlotId = 0; for (int32_t i = 0; i < taosArrayGetSize(colMatchInfo); ++i) { - SColMatchInfo* colInfo = taosArrayGet(colMatchInfo, i); + SColMatchItem* colInfo = taosArrayGet(colMatchInfo, i); if (colInfo->colId == PRIMARYKEY_TIMESTAMP_COL_ID) { - tsTargetSlotId = colInfo->targetSlotId; + tsTargetSlotId = colInfo->dstSlotId; } } @@ -4500,8 +4498,8 @@ void destroyTableMergeScanOperatorInfo(void* param) { } taosArrayDestroy(pTableScanInfo->dataReaders); - if (pTableScanInfo->pColMatchInfo != NULL) { - taosArrayDestroy(pTableScanInfo->pColMatchInfo); + if (pTableScanInfo->matchInfo.pList != NULL) { + taosArrayDestroy(pTableScanInfo->matchInfo.pList); } pTableScanInfo->pResBlock = blockDataDestroy(pTableScanInfo->pResBlock); @@ -4559,11 +4557,11 @@ SOperatorInfo* createTableMergeScanOperatorInfo(STableScanPhysiNode* pTableScanN SDataBlockDescNode* pDescNode = pTableScanNode->scan.node.pOutputDataBlockDesc; int32_t numOfCols = 0; - SArray* pColList = extractColMatchInfo(pTableScanNode->scan.pScanCols, pDescNode, &numOfCols, COL_MATCH_FROM_COL_ID); + int32_t code = extractColMatchInfo(pTableScanNode->scan.pScanCols, pDescNode, &numOfCols, COL_MATCH_FROM_COL_ID, &pInfo->matchInfo); - int32_t code = initQueryTableDataCond(&pInfo->cond, pTableScanNode); + code = initQueryTableDataCond(&pInfo->cond, pTableScanNode); if (code != TSDB_CODE_SUCCESS) { - taosArrayDestroy(pColList); + taosArrayDestroy(pInfo->matchInfo.pList); goto _error; } @@ -4583,12 +4581,11 @@ SOperatorInfo* createTableMergeScanOperatorInfo(STableScanPhysiNode* pTableScanN pInfo->pFilterNode = pTableScanNode->scan.node.pConditions; pInfo->tableListInfo = pTableListInfo; pInfo->scanFlag = MAIN_SCAN; - pInfo->pColMatchInfo = pColList; pInfo->pResBlock = createResDataBlock(pDescNode); pInfo->sortSourceParams = taosArrayInit(64, sizeof(STableMergeScanSortSourceParam)); - pInfo->pSortInfo = generateSortByTsInfo(pInfo->pColMatchInfo, pInfo->cond.order); + pInfo->pSortInfo = generateSortByTsInfo(pInfo->matchInfo.pList, pInfo->cond.order); pInfo->pSortInputBlock = createOneDataBlock(pInfo->pResBlock, false); int32_t rowSize = pInfo->pResBlock->info.rowSize; @@ -4603,9 +4600,8 @@ SOperatorInfo* createTableMergeScanOperatorInfo(STableScanPhysiNode* pTableScanN pOperator->pTaskInfo = pTaskInfo; initResultSizeInfo(&pOperator->resultInfo, 1024); - pOperator->fpSet = - createOperatorFpSet(operatorDummyOpenFn, doTableMergeScan, NULL, NULL, destroyTableMergeScanOperatorInfo, NULL, - NULL, getTableMergeScanExplainExecInfo); + pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, doTableMergeScan, NULL, NULL, + destroyTableMergeScanOperatorInfo, getTableMergeScanExplainExecInfo); pOperator->cost.openCost = 0; return pOperator; diff --git a/source/libs/executor/src/sortoperator.c b/source/libs/executor/src/sortoperator.c index c00b5c4802..04f86d90d5 100644 --- a/source/libs/executor/src/sortoperator.c +++ b/source/libs/executor/src/sortoperator.c @@ -38,8 +38,7 @@ SOperatorInfo* createSortOperatorInfo(SOperatorInfo* downstream, SSortPhysiNode* SExprInfo* pExprInfo = createExprInfo(pSortNode->pExprs, NULL, &numOfCols); int32_t numOfOutputCols = 0; - SArray* pColMatchColInfo = - extractColMatchInfo(pSortNode->pTargets, pDescNode, &numOfOutputCols, COL_MATCH_FROM_SLOT_ID); + int32_t code = extractColMatchInfo(pSortNode->pTargets, pDescNode, &numOfOutputCols, COL_MATCH_FROM_SLOT_ID, &pInfo->matchInfo); pOperator->exprSupp.pCtx = createSqlFunctionCtx(pExprInfo, numOfCols, &pOperator->exprSupp.rowEntryInfoOffset); @@ -48,7 +47,6 @@ SOperatorInfo* createSortOperatorInfo(SOperatorInfo* downstream, SSortPhysiNode* pInfo->binfo.pRes = pResBlock; pInfo->pSortInfo = createSortInfo(pSortNode->pSortKeys); pInfo->pCondition = pSortNode->node.pConditions; - pInfo->pColMatchInfo = pColMatchColInfo; initLimitInfo(pSortNode->node.pLimit, pSortNode->node.pSlimit, &pInfo->limitInfo); pOperator->name = "SortOperator"; @@ -64,10 +62,10 @@ SOperatorInfo* createSortOperatorInfo(SOperatorInfo* downstream, SSortPhysiNode* // there are headers, so pageSize = rowSize + header pInfo->sortBufSize = pInfo->bufPageSize * 16; // TODO dynamic set the available sort buffer - pOperator->fpSet = createOperatorFpSet(doOpenSortOperator, doSort, NULL, NULL, destroyOrderOperatorInfo, NULL, NULL, + pOperator->fpSet = createOperatorFpSet(doOpenSortOperator, doSort, NULL, NULL, destroyOrderOperatorInfo, getExplainExecInfo); - int32_t code = appendDownstream(pOperator, &downstream, 1); + code = appendDownstream(pOperator, &downstream, 1); if (code != TSDB_CODE_SUCCESS) { goto _error; } @@ -127,11 +125,11 @@ SSDataBlock* getSortedBlockData(SSortHandle* pHandle, SSDataBlock* pDataBlock, i // todo extract function to handle this int32_t numOfCols = taosArrayGetSize(pColMatchInfo); for (int32_t i = 0; i < numOfCols; ++i) { - SColMatchInfo* pmInfo = taosArrayGet(pColMatchInfo, i); - ASSERT(pmInfo->matchType == COL_MATCH_FROM_SLOT_ID); + SColMatchItem* pmInfo = taosArrayGet(pColMatchInfo, i); +// ASSERT(pmInfo->matchType == COL_MATCH_FROM_SLOT_ID); SColumnInfoData* pSrc = taosArrayGet(p->pDataBlock, pmInfo->srcSlotId); - SColumnInfoData* pDst = taosArrayGet(pDataBlock->pDataBlock, pmInfo->targetSlotId); + SColumnInfoData* pDst = taosArrayGet(pDataBlock->pDataBlock, pmInfo->dstSlotId); colDataAssign(pDst, pSrc, p->info.rows, &pDataBlock->info); } @@ -210,13 +208,13 @@ SSDataBlock* doSort(SOperatorInfo* pOperator) { SSDataBlock* pBlock = NULL; while (1) { pBlock = getSortedBlockData(pInfo->pSortHandle, pInfo->binfo.pRes, pOperator->resultInfo.capacity, - pInfo->pColMatchInfo, pInfo); + pInfo->matchInfo.pList, pInfo); if (pBlock == NULL) { doSetOperatorCompleted(pOperator); return NULL; } - doFilter(pInfo->pCondition, pBlock, pInfo->pColMatchInfo, NULL); + doFilter(pInfo->pCondition, pBlock, &pInfo->matchInfo, NULL); if (blockDataGetNumOfRows(pBlock) == 0) { continue; } @@ -256,7 +254,7 @@ void destroyOrderOperatorInfo(void* param) { tsortDestroySortHandle(pInfo->pSortHandle); taosArrayDestroy(pInfo->pSortInfo); - taosArrayDestroy(pInfo->pColMatchInfo); + taosArrayDestroy(pInfo->matchInfo.pList); taosMemoryFreeClear(param); } @@ -277,20 +275,17 @@ int32_t getExplainExecInfo(SOperatorInfo* pOptr, void** pOptrExplain, uint32_t* typedef enum EChildOperatorStatus { CHILD_OP_NEW_GROUP, CHILD_OP_SAME_GROUP, CHILD_OP_FINISHED } EChildOperatorStatus; typedef struct SGroupSortOperatorInfo { - SOptrBasicInfo binfo; - SArray* pSortInfo; - SArray* pColMatchInfo; - - int64_t startTs; - uint64_t sortElapsed; - bool hasGroupId; - uint64_t currGroupId; - + SOptrBasicInfo binfo; + SArray* pSortInfo; + SColMatchInfo matchInfo; + int64_t startTs; + uint64_t sortElapsed; + bool hasGroupId; + uint64_t currGroupId; SSDataBlock* prefetchedSortInput; SSortHandle* pCurrSortHandle; EChildOperatorStatus childOpStatus; - - SSortExecInfo sortExecInfo; + SSortExecInfo sortExecInfo; } SGroupSortOperatorInfo; SSDataBlock* getGroupSortedBlockData(SSortHandle* pHandle, SSDataBlock* pDataBlock, int32_t capacity, @@ -320,11 +315,11 @@ SSDataBlock* getGroupSortedBlockData(SSortHandle* pHandle, SSDataBlock* pDataBlo if (p->info.rows > 0) { int32_t numOfCols = taosArrayGetSize(pColMatchInfo); for (int32_t i = 0; i < numOfCols; ++i) { - SColMatchInfo* pmInfo = taosArrayGet(pColMatchInfo, i); - ASSERT(pmInfo->matchType == COL_MATCH_FROM_SLOT_ID); + SColMatchItem* pmInfo = taosArrayGet(pColMatchInfo, i); +// ASSERT(pmInfo->matchType == COL_MATCH_FROM_SLOT_ID); SColumnInfoData* pSrc = taosArrayGet(p->pDataBlock, pmInfo->srcSlotId); - SColumnInfoData* pDst = taosArrayGet(pDataBlock->pDataBlock, pmInfo->targetSlotId); + SColumnInfoData* pDst = taosArrayGet(pDataBlock->pDataBlock, pmInfo->dstSlotId); colDataAssign(pDst, pSrc, p->info.rows, &pDataBlock->info); } @@ -442,7 +437,7 @@ SSDataBlock* doGroupSort(SOperatorInfo* pOperator) { // beginSortGroup would fetch all child blocks of pInfo->currGroupId; ASSERT(pInfo->childOpStatus != CHILD_OP_SAME_GROUP); pBlock = getGroupSortedBlockData(pInfo->pCurrSortHandle, pInfo->binfo.pRes, pOperator->resultInfo.capacity, - pInfo->pColMatchInfo, pInfo); + pInfo->matchInfo.pList, pInfo); if (pBlock != NULL) { pBlock->info.groupId = pInfo->currGroupId; pOperator->resultInfo.totalRows += pBlock->info.rows; @@ -474,7 +469,7 @@ void destroyGroupSortOperatorInfo(void* param) { pInfo->binfo.pRes = blockDataDestroy(pInfo->binfo.pRes); taosArrayDestroy(pInfo->pSortInfo); - taosArrayDestroy(pInfo->pColMatchInfo); + taosArrayDestroy(pInfo->matchInfo.pList); taosMemoryFreeClear(param); } @@ -494,8 +489,8 @@ SOperatorInfo* createGroupSortOperatorInfo(SOperatorInfo* downstream, SGroupSort SExprInfo* pExprInfo = createExprInfo(pSortPhyNode->pExprs, NULL, &numOfCols); int32_t numOfOutputCols = 0; - SArray* pColMatchColInfo = - extractColMatchInfo(pSortPhyNode->pTargets, pDescNode, &numOfOutputCols, COL_MATCH_FROM_SLOT_ID); + int32_t code = extractColMatchInfo(pSortPhyNode->pTargets, pDescNode, &numOfOutputCols, COL_MATCH_FROM_SLOT_ID, + &pInfo->matchInfo); pOperator->exprSupp.pCtx = createSqlFunctionCtx(pExprInfo, numOfCols, &pOperator->exprSupp.rowEntryInfoOffset); pInfo->binfo.pRes = pResBlock; @@ -503,8 +498,7 @@ SOperatorInfo* createGroupSortOperatorInfo(SOperatorInfo* downstream, SGroupSort initResultSizeInfo(&pOperator->resultInfo, 1024); pInfo->pSortInfo = createSortInfo(pSortPhyNode->pSortKeys); - ; - pInfo->pColMatchInfo = pColMatchColInfo; + pOperator->name = "GroupSortOperator"; pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_GROUP_SORT; pOperator->blocking = false; @@ -515,9 +509,9 @@ SOperatorInfo* createGroupSortOperatorInfo(SOperatorInfo* downstream, SGroupSort pOperator->pTaskInfo = pTaskInfo; pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, doGroupSort, NULL, NULL, destroyGroupSortOperatorInfo, - NULL, NULL, getGroupSortExplainExecInfo); + getGroupSortExplainExecInfo); - int32_t code = appendDownstream(pOperator, &downstream, 1); + code = appendDownstream(pOperator, &downstream, 1); if (code != TSDB_CODE_SUCCESS) { goto _error; } @@ -535,20 +529,18 @@ _error: // Multiway Sort Merge operator typedef struct SMultiwayMergeOperatorInfo { SOptrBasicInfo binfo; + int32_t bufPageSize; + uint32_t sortBufSize; // max buffer size for in-memory sort - int32_t bufPageSize; - uint32_t sortBufSize; // max buffer size for in-memory sort - - SArray* pSortInfo; - SSortHandle* pSortHandle; - SArray* pColMatchInfo; // for index map from table scan output - - SSDataBlock* pInputBlock; - int64_t startTs; // sort start time - bool groupSort; - bool hasGroupId; - uint64_t groupId; - STupleHandle* prefetchedTuple; + SArray* pSortInfo; + SSortHandle* pSortHandle; + SColMatchInfo matchInfo; + SSDataBlock* pInputBlock; + int64_t startTs; // sort start time + bool groupSort; + bool hasGroupId; + uint64_t groupId; + STupleHandle* prefetchedTuple; } SMultiwayMergeOperatorInfo; int32_t doOpenMultiwayMergeOperator(SOperatorInfo* pOperator) { @@ -645,11 +637,11 @@ SSDataBlock* getMultiwaySortedBlockData(SSortHandle* pHandle, SSDataBlock* pData blockDataEnsureCapacity(pDataBlock, p->info.rows); int32_t numOfCols = taosArrayGetSize(pColMatchInfo); for (int32_t i = 0; i < numOfCols; ++i) { - SColMatchInfo* pmInfo = taosArrayGet(pColMatchInfo, i); - ASSERT(pmInfo->matchType == COL_MATCH_FROM_SLOT_ID); + SColMatchItem* pmInfo = taosArrayGet(pColMatchInfo, i); +// ASSERT(pColMatchInfo-> == COL_MATCH_FROM_SLOT_ID); SColumnInfoData* pSrc = taosArrayGet(p->pDataBlock, pmInfo->srcSlotId); - SColumnInfoData* pDst = taosArrayGet(pDataBlock->pDataBlock, pmInfo->targetSlotId); + SColumnInfoData* pDst = taosArrayGet(pDataBlock->pDataBlock, pmInfo->dstSlotId); colDataAssign(pDst, pSrc, p->info.rows, &pDataBlock->info); } @@ -678,7 +670,7 @@ SSDataBlock* doMultiwayMerge(SOperatorInfo* pOperator) { } SSDataBlock* pBlock = getMultiwaySortedBlockData(pInfo->pSortHandle, pInfo->binfo.pRes, - pOperator->resultInfo.capacity, pInfo->pColMatchInfo, pOperator); + pOperator->resultInfo.capacity, pInfo->matchInfo.pList, pOperator); if (pBlock != NULL) { pOperator->resultInfo.totalRows += pBlock->info.rows; } else { @@ -694,7 +686,7 @@ void destroyMultiwayMergeOperatorInfo(void* param) { tsortDestroySortHandle(pInfo->pSortHandle); taosArrayDestroy(pInfo->pSortInfo); - taosArrayDestroy(pInfo->pColMatchInfo); + taosArrayDestroy(pInfo->matchInfo.pList); taosMemoryFreeClear(param); } @@ -731,15 +723,14 @@ SOperatorInfo* createMultiwayMergeOperatorInfo(SOperatorInfo** downStreams, size SArray* pSortInfo = createSortInfo(pMergePhyNode->pMergeKeys); int32_t numOfOutputCols = 0; - SArray* pColMatchColInfo = - extractColMatchInfo(pMergePhyNode->pTargets, pDescNode, &numOfOutputCols, COL_MATCH_FROM_SLOT_ID); + + code = extractColMatchInfo(pMergePhyNode->pTargets, pDescNode, &numOfOutputCols, COL_MATCH_FROM_SLOT_ID, &pInfo->matchInfo); SPhysiNode* pChildNode = (SPhysiNode*)nodesListGetNode(pPhyNode->pChildren, 0); SSDataBlock* pInputBlock = createResDataBlock(pChildNode->pOutputDataBlockDesc); initResultSizeInfo(&pOperator->resultInfo, 1024); pInfo->groupSort = pMergePhyNode->groupSort; pInfo->pSortInfo = pSortInfo; - pInfo->pColMatchInfo = pColMatchColInfo; pInfo->pInputBlock = pInputBlock; pInfo->bufPageSize = getProperSortPageSize(rowSize); pInfo->sortBufSize = pInfo->bufPageSize * (numStreams + 1); // one additional is reserved for merged result. @@ -752,7 +743,7 @@ SOperatorInfo* createMultiwayMergeOperatorInfo(SOperatorInfo** downStreams, size pOperator->pTaskInfo = pTaskInfo; pOperator->fpSet = createOperatorFpSet(doOpenMultiwayMergeOperator, doMultiwayMerge, NULL, NULL, - destroyMultiwayMergeOperatorInfo, NULL, NULL, getMultiwayMergeExplainExecInfo); + destroyMultiwayMergeOperatorInfo, getMultiwayMergeExplainExecInfo); code = appendDownstream(pOperator, downStreams, numStreams); if (code != TSDB_CODE_SUCCESS) { diff --git a/source/libs/executor/src/tfill.c b/source/libs/executor/src/tfill.c index d1d22dc3e5..23847928da 100644 --- a/source/libs/executor/src/tfill.c +++ b/source/libs/executor/src/tfill.c @@ -722,7 +722,7 @@ void destroyStreamFillOperatorInfo(void* param) { pInfo->pSrcBlock = blockDataDestroy(pInfo->pSrcBlock); pInfo->pPrevSrcBlock = blockDataDestroy(pInfo->pPrevSrcBlock); pInfo->pDelRes = blockDataDestroy(pInfo->pDelRes); - pInfo->pColMatchColInfo = taosArrayDestroy(pInfo->pColMatchColInfo); + pInfo->matchInfo.pList = taosArrayDestroy(pInfo->matchInfo.pList); taosMemoryFree(pInfo); } @@ -1499,7 +1499,7 @@ static SSDataBlock* doStreamFill(SOperatorInfo* pOperator) { } doStreamFillImpl(pOperator); - doFilter(pInfo->pCondition, pInfo->pRes, pInfo->pColMatchColInfo, NULL); + doFilter(pInfo->pCondition, pInfo->pRes, &pInfo->matchInfo, NULL); memcpy(pInfo->pRes->info.parTbName, pInfo->pSrcBlock->info.parTbName, TSDB_TABLE_NAME_LEN); pOperator->resultInfo.totalRows += pInfo->pRes->info.rows; if (pInfo->pRes->info.rows > 0) { @@ -1624,7 +1624,6 @@ SOperatorInfo* createStreamFillOperatorInfo(SOperatorInfo* downstream, SStreamFi goto _error; } - SResultInfo* pResultInfo = &pOperator->resultInfo; initResultSizeInfo(&pOperator->resultInfo, 4096); pInfo->pRes = createResDataBlock(pPhyFillNode->node.pOutputDataBlockDesc); pInfo->pSrcBlock = createResDataBlock(pPhyFillNode->node.pOutputDataBlockDesc); @@ -1676,11 +1675,10 @@ SOperatorInfo* createStreamFillOperatorInfo(SOperatorInfo* downstream, SStreamFi pInfo->primarySrcSlotId = ((SColumnNode*)((STargetNode*)pPhyFillNode->pWStartTs)->pExpr)->slotId; int32_t numOfOutputCols = 0; - SArray* pColMatchColInfo = extractColMatchInfo(pPhyFillNode->pFillExprs, pPhyFillNode->node.pOutputDataBlockDesc, - &numOfOutputCols, COL_MATCH_FROM_SLOT_ID); + int32_t code = extractColMatchInfo(pPhyFillNode->pFillExprs, pPhyFillNode->node.pOutputDataBlockDesc, + &numOfOutputCols, COL_MATCH_FROM_SLOT_ID, &pInfo->matchInfo); pInfo->pCondition = pPhyFillNode->node.pConditions; - pInfo->pColMatchColInfo = pColMatchColInfo; - int32_t code = initExprSupp(&pOperator->exprSupp, pFillExprInfo, numOfFillCols); + code = initExprSupp(&pOperator->exprSupp, pFillExprInfo, numOfFillCols); if (code != TSDB_CODE_SUCCESS) { goto _error; } @@ -1694,7 +1692,7 @@ SOperatorInfo* createStreamFillOperatorInfo(SOperatorInfo* downstream, SStreamFi pOperator->info = pInfo; pOperator->pTaskInfo = pTaskInfo; pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, doStreamFill, NULL, NULL, destroyStreamFillOperatorInfo, - NULL, NULL, NULL); + NULL); code = appendDownstream(pOperator, &downstream, 1); if (code != TSDB_CODE_SUCCESS) { diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c index 6dda6488a0..8e5f03c4ac 100644 --- a/source/libs/executor/src/timewindowoperator.c +++ b/source/libs/executor/src/timewindowoperator.c @@ -1831,8 +1831,7 @@ SOperatorInfo* createIntervalOperatorInfo(SOperatorInfo* downstream, SIntervalPh pOperator->status = OP_NOT_OPENED; pOperator->info = pInfo; - pOperator->fpSet = createOperatorFpSet(doOpenIntervalAgg, doBuildIntervalResult, NULL, NULL, - destroyIntervalOperatorInfo, aggEncodeResultRow, aggDecodeResultRow, NULL); + pOperator->fpSet = createOperatorFpSet(doOpenIntervalAgg, doBuildIntervalResult, NULL, NULL, destroyIntervalOperatorInfo, NULL); code = appendDownstream(pOperator, &downstream, 1); if (code != TSDB_CODE_SUCCESS) { @@ -2638,8 +2637,7 @@ SOperatorInfo* createTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode pOperator->info = pInfo; pOperator->pTaskInfo = pTaskInfo; - pOperator->fpSet = - createOperatorFpSet(operatorDummyOpenFn, doTimeslice, NULL, NULL, destroyTimeSliceOperatorInfo, NULL, NULL, NULL); + pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, doTimeslice, NULL, NULL, destroyTimeSliceOperatorInfo, NULL); blockDataEnsureCapacity(pInfo->pRes, pOperator->resultInfo.capacity); @@ -2710,7 +2708,7 @@ SOperatorInfo* createStatewindowOperatorInfo(SOperatorInfo* downstream, SStateWi pOperator->info = pInfo; pOperator->fpSet = createOperatorFpSet(openStateWindowAggOptr, doStateWindowAgg, NULL, NULL, - destroyStateWindowOperatorInfo, aggEncodeResultRow, aggDecodeResultRow, NULL); + destroyStateWindowOperatorInfo, NULL); code = appendDownstream(pOperator, &downstream, 1); if (code != TSDB_CODE_SUCCESS) { @@ -2784,7 +2782,7 @@ SOperatorInfo* createSessionAggOperatorInfo(SOperatorInfo* downstream, SSessionW pOperator->info = pInfo; pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, doSessionWindowAgg, NULL, NULL, - destroySWindowOperatorInfo, aggEncodeResultRow, aggDecodeResultRow, NULL); + destroySWindowOperatorInfo, NULL); pOperator->pTaskInfo = pTaskInfo; code = appendDownstream(pOperator, &downstream, 1); if (code != TSDB_CODE_SUCCESS) { @@ -3465,8 +3463,7 @@ SOperatorInfo* createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream, pOperator->info = pInfo; pOperator->fpSet = - createOperatorFpSet(NULL, doStreamFinalIntervalAgg, NULL, NULL, destroyStreamFinalIntervalOperatorInfo, - aggEncodeResultRow, aggDecodeResultRow, NULL); + createOperatorFpSet(NULL, doStreamFinalIntervalAgg, NULL, NULL, destroyStreamFinalIntervalOperatorInfo, NULL); if (pPhyNode->type == QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL) { initIntervalDownStream(downstream, pPhyNode->type, &pInfo->aggSup, &pInfo->interval, &pInfo->twAggSup); } @@ -4261,7 +4258,7 @@ SOperatorInfo* createStreamSessionAggOperatorInfo(SOperatorInfo* downstream, SPh pOperator->info = pInfo; pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, doStreamSessionAgg, NULL, NULL, destroyStreamSessionAggOperatorInfo, - aggEncodeResultRow, aggDecodeResultRow, NULL); + NULL); if (downstream) { initDownStream(downstream, &pInfo->streamAggSup, pInfo->twAggSup.waterMark, pOperator->operatorType, pInfo->primaryTsIndex); @@ -4408,7 +4405,7 @@ SOperatorInfo* createStreamFinalSessionAggOperatorInfo(SOperatorInfo* downstream pOperator->name = "StreamSessionSemiAggOperator"; pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, doStreamSessionSemiAgg, NULL, NULL, - destroyStreamSessionAggOperatorInfo, aggEncodeResultRow, aggDecodeResultRow, NULL); + destroyStreamSessionAggOperatorInfo, NULL); } pInfo->pGroupIdTbNameMap = @@ -4777,7 +4774,7 @@ SOperatorInfo* createStreamStateAggOperatorInfo(SOperatorInfo* downstream, SPhys pOperator->pTaskInfo = pTaskInfo; pOperator->info = pInfo; pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, doStreamStateAgg, NULL, NULL, - destroyStreamStateOperatorInfo, aggEncodeResultRow, aggDecodeResultRow, NULL); + destroyStreamStateOperatorInfo, NULL); initDownStream(downstream, &pInfo->streamAggSup, pInfo->twAggSup.waterMark, pOperator->operatorType, pInfo->primaryTsIndex); code = appendDownstream(pOperator, &downstream, 1); @@ -5054,7 +5051,7 @@ SOperatorInfo* createMergeAlignedIntervalOperatorInfo(SOperatorInfo* downstream, pOperator->info = miaInfo; pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, mergeAlignedIntervalAgg, NULL, NULL, - destroyMAIOperatorInfo, NULL, NULL, NULL); + destroyMAIOperatorInfo, NULL); code = appendDownstream(pOperator, &downstream, 1); if (code != TSDB_CODE_SUCCESS) { @@ -5366,7 +5363,7 @@ SOperatorInfo* createMergeIntervalOperatorInfo(SOperatorInfo* downstream, SMerge pOperator->info = pMergeIntervalInfo; pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, doMergeIntervalAgg, NULL, NULL, - destroyMergeIntervalOperatorInfo, NULL, NULL, NULL); + destroyMergeIntervalOperatorInfo, NULL); code = appendDownstream(pOperator, &downstream, 1); if (code != TSDB_CODE_SUCCESS) { @@ -5599,7 +5596,7 @@ SOperatorInfo* createStreamIntervalOperatorInfo(SOperatorInfo* downstream, SPhys pOperator->info = pInfo; pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, doStreamIntervalAgg, NULL, NULL, destroyStreamFinalIntervalOperatorInfo, - aggEncodeResultRow, aggDecodeResultRow, NULL); + NULL); initIntervalDownStream(downstream, pPhyNode->type, &pInfo->aggSup, &pInfo->interval, &pInfo->twAggSup); code = appendDownstream(pOperator, &downstream, 1); diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index 2223954a5b..96a14be4cc 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -209,7 +209,7 @@ static int32_t countTrailingSpaces(const SValueNode* pVal, bool isLtrim) { return numOfSpaces; } -void static addTimezoneParam(SNodeList* pList) { +static int32_t addTimezoneParam(SNodeList* pList) { char buf[6] = {0}; time_t t = taosTime(NULL); struct tm tmInfo; @@ -218,6 +218,10 @@ void static addTimezoneParam(SNodeList* pList) { int32_t len = (int32_t)strlen(buf); SValueNode* pVal = (SValueNode*)nodesMakeNode(QUERY_NODE_VALUE); + if (pVal == NULL) { + return TSDB_CODE_OUT_OF_MEMORY; + } + pVal->literal = strndup(buf, len); pVal->isDuration = false; pVal->translate = true; @@ -229,10 +233,15 @@ void static addTimezoneParam(SNodeList* pList) { strncpy(varDataVal(pVal->datum.p), pVal->literal, len); nodesListAppend(pList, (SNode*)pVal); + return TSDB_CODE_SUCCESS; } -void static addDbPrecisonParam(SNodeList** pList, uint8_t precision) { +static int32_t addDbPrecisonParam(SNodeList** pList, uint8_t precision) { SValueNode* pVal = (SValueNode*)nodesMakeNode(QUERY_NODE_VALUE); + if (pVal == NULL) { + return TSDB_CODE_OUT_OF_MEMORY; + } + pVal->literal = NULL; pVal->isDuration = false; pVal->translate = true; @@ -244,6 +253,7 @@ void static addDbPrecisonParam(SNodeList** pList, uint8_t precision) { pVal->typeData = (int64_t)precision; nodesListMakeAppend(pList, (SNode*)pVal); + return TSDB_CODE_SUCCESS; } // There is only one parameter of numeric type, and the return type is parameter type @@ -465,7 +475,10 @@ static int32_t translateNowToday(SFunctionNode* pFunc, char* pErrBuf, int32_t le // add database precision as param uint8_t dbPrec = pFunc->node.resType.precision; - addDbPrecisonParam(&pFunc->pParameterList, dbPrec); + int32_t code = addDbPrecisonParam(&pFunc->pParameterList, dbPrec); + if (code != TSDB_CODE_SUCCESS) { + return code; + } pFunc->node.resType = (SDataType){.bytes = sizeof(int64_t), .type = TSDB_DATA_TYPE_TIMESTAMP}; return TSDB_CODE_SUCCESS; @@ -1487,7 +1500,10 @@ static int32_t translateIrate(SFunctionNode* pFunc, char* pErrBuf, int32_t len) // add database precision as param uint8_t dbPrec = pFunc->node.resType.precision; - addDbPrecisonParam(&pFunc->pParameterList, dbPrec); + int32_t code = addDbPrecisonParam(&pFunc->pParameterList, dbPrec); + if (code != TSDB_CODE_SUCCESS) { + return code; + } pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_DOUBLE].bytes, .type = TSDB_DATA_TYPE_DOUBLE}; return TSDB_CODE_SUCCESS; @@ -1810,7 +1826,10 @@ static int32_t translateCast(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { // add database precision as param uint8_t dbPrec = pFunc->node.resType.precision; - addDbPrecisonParam(&pFunc->pParameterList, dbPrec); + int32_t code = addDbPrecisonParam(&pFunc->pParameterList, dbPrec); + if (code != TSDB_CODE_SUCCESS) { + return code; + } return TSDB_CODE_SUCCESS; } @@ -1844,7 +1863,10 @@ static int32_t translateToIso8601(SFunctionNode* pFunc, char* pErrBuf, int32_t l return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_FUNTION_ERROR, "Invalid timzone format"); } } else { // add default client timezone - addTimezoneParam(pFunc->pParameterList); + int32_t code = addTimezoneParam(pFunc->pParameterList); + if (code != TSDB_CODE_SUCCESS) { + return code; + } } // set result type @@ -1863,7 +1885,10 @@ static int32_t translateToUnixtimestamp(SFunctionNode* pFunc, char* pErrBuf, int // add database precision as param uint8_t dbPrec = pFunc->node.resType.precision; - addDbPrecisonParam(&pFunc->pParameterList, dbPrec); + int32_t code = addDbPrecisonParam(&pFunc->pParameterList, dbPrec); + if (code != TSDB_CODE_SUCCESS) { + return code; + } pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes, .type = TSDB_DATA_TYPE_BIGINT}; return TSDB_CODE_SUCCESS; @@ -1894,7 +1919,10 @@ static int32_t translateTimeTruncate(SFunctionNode* pFunc, char* pErrBuf, int32_ "TIMETRUNCATE function time unit parameter should be one of the following: [1b, 1u, 1a, 1s, 1m, 1h, 1d, 1w]"); } - addDbPrecisonParam(&pFunc->pParameterList, dbPrec); + int32_t code = addDbPrecisonParam(&pFunc->pParameterList, dbPrec); + if (code != TSDB_CODE_SUCCESS) { + return code; + } pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_TIMESTAMP].bytes, .type = TSDB_DATA_TYPE_TIMESTAMP}; @@ -1935,7 +1963,10 @@ static int32_t translateTimeDiff(SFunctionNode* pFunc, char* pErrBuf, int32_t le } } - addDbPrecisonParam(&pFunc->pParameterList, dbPrec); + int32_t code = addDbPrecisonParam(&pFunc->pParameterList, dbPrec); + if (code != TSDB_CODE_SUCCESS) { + return code; + } pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes, .type = TSDB_DATA_TYPE_BIGINT}; return TSDB_CODE_SUCCESS; diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index dd5e4178bd..a093fe5116 100644 --- a/source/libs/function/src/builtinsimpl.c +++ b/source/libs/function/src/builtinsimpl.c @@ -1861,7 +1861,7 @@ int32_t stddevFunction(SqlFunctionCtx* pCtx) { numOfElem += 1; pStddevRes->count += 1; pStddevRes->usum += plist[i]; - pStddevRes->quadraticISum += plist[i] * plist[i]; + pStddevRes->quadraticUSum += plist[i] * plist[i]; } break; @@ -1877,7 +1877,7 @@ int32_t stddevFunction(SqlFunctionCtx* pCtx) { numOfElem += 1; pStddevRes->count += 1; pStddevRes->usum += plist[i]; - pStddevRes->quadraticISum += plist[i] * plist[i]; + pStddevRes->quadraticUSum += plist[i] * plist[i]; } break; } @@ -1892,7 +1892,7 @@ int32_t stddevFunction(SqlFunctionCtx* pCtx) { numOfElem += 1; pStddevRes->count += 1; pStddevRes->usum += plist[i]; - pStddevRes->quadraticISum += plist[i] * plist[i]; + pStddevRes->quadraticUSum += plist[i] * plist[i]; } break; @@ -1908,7 +1908,7 @@ int32_t stddevFunction(SqlFunctionCtx* pCtx) { numOfElem += 1; pStddevRes->count += 1; pStddevRes->usum += plist[i]; - pStddevRes->quadraticISum += plist[i] * plist[i]; + pStddevRes->quadraticUSum += plist[i] * plist[i]; } break; } @@ -5359,7 +5359,7 @@ int32_t modeFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { SColumnInfoData* pCol = taosArrayGet(pBlock->pDataBlock, slotId); int32_t currentRow = pBlock->info.rows; - int32_t resIndex; + int32_t resIndex = -1; int32_t maxCount = 0; for (int32_t i = 0; i < pInfo->numOfPoints; ++i) { SModeItem* pItem = (SModeItem*)(pInfo->pItems + i * (sizeof(SModeItem) + pInfo->colBytes)); @@ -5369,8 +5369,12 @@ int32_t modeFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { } } - SModeItem* pResItem = (SModeItem*)(pInfo->pItems + resIndex * (sizeof(SModeItem) + pInfo->colBytes)); - colDataAppend(pCol, currentRow, pResItem->data, (maxCount == 0) ? true : false); + if (maxCount != 0) { + SModeItem* pResItem = (SModeItem*)(pInfo->pItems + resIndex * (sizeof(SModeItem) + pInfo->colBytes)); + colDataAppend(pCol, currentRow, pResItem->data, false); + } else { + colDataAppendNULL(pCol, currentRow); + } return pResInfo->numOfRes; } diff --git a/source/libs/function/src/tpercentile.c b/source/libs/function/src/tpercentile.c index 6a1427c63f..0924106476 100644 --- a/source/libs/function/src/tpercentile.c +++ b/source/libs/function/src/tpercentile.c @@ -495,7 +495,7 @@ double getPercentileImpl(tMemBucket *pMemBucket, int32_t count, double fraction) int32_t groupId = getGroupId(pMemBucket->numOfSlots, i, pMemBucket->times - 1); SIDList list = taosHashGet(pMemBucket->groupPagesMap, &groupId, sizeof(groupId)); - assert(list->size > 0); + ASSERT(list != NULL && list->size > 0); for (int32_t f = 0; f < list->size; ++f) { SPageInfo *pgInfo = *(SPageInfo **)taosArrayGet(list, f); diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index aec4d0148a..0c13dd822b 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -203,7 +203,6 @@ int32_t nodesReleaseAllocator(int64_t allocatorId) { return taosReleaseRef(g_allocatorReqRefPool, allocatorId); } - int64_t nodesMakeAllocatorWeakRef(int64_t allocatorId) { if (allocatorId <= 0) { return 0; @@ -936,6 +935,7 @@ void nodesDestroyNode(SNode* pNode) { } case QUERY_NODE_SHOW_DNODE_VARIABLES_STMT: nodesDestroyNode(((SShowDnodeVariablesStmt*)pNode)->pDnodeId); + nodesDestroyNode(((SShowDnodeVariablesStmt*)pNode)->pLikePattern); break; case QUERY_NODE_SHOW_CREATE_DATABASE_STMT: taosMemoryFreeClear(((SShowCreateDatabaseStmt*)pNode)->pCfg); diff --git a/source/libs/parser/inc/parAst.h b/source/libs/parser/inc/parAst.h index 627ea093e4..09d1a5e772 100644 --- a/source/libs/parser/inc/parAst.h +++ b/source/libs/parser/inc/parAst.h @@ -176,7 +176,7 @@ SNode* createShowStmtWithCond(SAstCreateContext* pCxt, ENodeType type, SNode* pD SNode* createShowCreateDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName); SNode* createShowCreateTableStmt(SAstCreateContext* pCxt, ENodeType type, SNode* pRealTable); SNode* createShowTableDistributedStmt(SAstCreateContext* pCxt, SNode* pRealTable); -SNode* createShowDnodeVariablesStmt(SAstCreateContext* pCxt, SNode* pDnodeId); +SNode* createShowDnodeVariablesStmt(SAstCreateContext* pCxt, SNode* pDnodeId, SNode* pLikePattern); SNode* createShowVnodesStmt(SAstCreateContext* pCxt, SNode* pDnodeId, SNode* pDnodeEndpoint); SNode* createCreateUserStmt(SAstCreateContext* pCxt, SToken* pUserName, const SToken* pPassword, int8_t sysinfo); SNode* createAlterUserStmt(SAstCreateContext* pCxt, SToken* pUserName, int8_t alterType, const SToken* pVal); diff --git a/source/libs/parser/inc/parInsertData.h b/source/libs/parser/inc/parInsertData.h deleted file mode 100644 index 6d0ba29eb7..0000000000 --- a/source/libs/parser/inc/parInsertData.h +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (c) 2019 TAOS Data, Inc. - * - * This program is free software: you can use, redistribute, and/or modify - * it under the terms of the GNU Affero General Public License, version 3 - * or later ("AGPL"), as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -#ifndef TDENGINE_DATABLOCKMGT_H -#define TDENGINE_DATABLOCKMGT_H - -#include "catalog.h" -#include "os.h" -#include "query.h" -#include "tname.h" -#include "ttypes.h" - -#define IS_DATA_COL_ORDERED(spd) ((spd->orderStatus) == (int8_t)ORDER_STATUS_ORDERED) - -typedef enum EOrderStatus { - ORDER_STATUS_UNKNOWN = 0, - ORDER_STATUS_ORDERED = 1, - ORDER_STATUS_DISORDERED = 2, -} EOrderStatus; - -typedef enum EValStat { - VAL_STAT_HAS = 0x0, // 0 means has val - VAL_STAT_NONE = 0x01, // 1 means no val -} EValStat; - -typedef struct SBoundColumn { - int32_t offset; // all column offset value - int32_t toffset; // first part offset for SDataRow TODO: get offset from STSchema on future - uint8_t valStat; // EValStat. denote if current column bound or not(0 means has val, 1 means no val) -} SBoundColumn; - -typedef struct { - col_id_t schemaColIdx; - col_id_t boundIdx; - col_id_t finalIdx; -} SBoundIdxInfo; - -typedef struct SParsedDataColInfo { - col_id_t numOfCols; - col_id_t numOfBound; - uint16_t flen; // TODO: get from STSchema - uint16_t allNullLen; // TODO: get from STSchema(base on SDataRow) - uint16_t extendedVarLen; - uint16_t boundNullLen; // bound column len with all NULL value(without VarDataOffsetT/SColIdx part) - col_id_t *boundColumns; // bound column idx according to schema - SBoundColumn *cols; - SBoundIdxInfo *colIdxInfo; - int8_t orderStatus; // bound columns -} SParsedDataColInfo; - -typedef struct { - uint8_t rowType; // default is 0, that is SDataRow - int32_t rowSize; -} SMemRowBuilder; - -typedef struct STableDataBlocks { - int8_t tsSource; // where does the UNIX timestamp come from, server or client - bool ordered; // if current rows are ordered or not - int32_t vgId; // virtual group id - int64_t prevTS; // previous timestamp, recorded to decide if the records array is ts ascending - int32_t numOfTables; // number of tables in current submit block - int32_t rowSize; // row size for current table - uint32_t nAllocSize; - uint32_t headerSize; // header for table info (uid, tid, submit metadata) - uint32_t size; - STableMeta *pTableMeta; // the tableMeta of current table, the table meta will be used during submit, keep a ref to - // avoid to be removed from cache - char *pData; - bool cloned; - int32_t createTbReqLen; - SParsedDataColInfo boundColumnInfo; - SRowBuilder rowBuilder; -} STableDataBlocks; - -static FORCE_INLINE int32_t getExtendedRowSize(STableDataBlocks *pBlock) { - STableComInfo *pTableInfo = &pBlock->pTableMeta->tableInfo; - ASSERT(pBlock->rowSize == pTableInfo->rowSize); - return pBlock->rowSize + TD_ROW_HEAD_LEN - sizeof(TSKEY) + pBlock->boundColumnInfo.extendedVarLen + - (int32_t)TD_BITMAP_BYTES(pTableInfo->numOfColumns - 1); -} - -static FORCE_INLINE void getSTSRowAppendInfo(uint8_t rowType, SParsedDataColInfo *spd, col_id_t idx, int32_t *toffset, - col_id_t *colIdx) { - col_id_t schemaIdx = 0; - if (IS_DATA_COL_ORDERED(spd)) { - schemaIdx = spd->boundColumns[idx]; - if (TD_IS_TP_ROW_T(rowType)) { - *toffset = (spd->cols + schemaIdx)->toffset; // the offset of firstPart - *colIdx = schemaIdx; - } else { - *toffset = idx * sizeof(SKvRowIdx); // the offset of SKvRowIdx - *colIdx = idx; - } - } else { - ASSERT(idx == (spd->colIdxInfo + idx)->boundIdx); - schemaIdx = (spd->colIdxInfo + idx)->schemaColIdx; - if (TD_IS_TP_ROW_T(rowType)) { - *toffset = (spd->cols + schemaIdx)->toffset; - *colIdx = schemaIdx; - } else { - *toffset = ((spd->colIdxInfo + idx)->finalIdx) * sizeof(SKvRowIdx); - *colIdx = (spd->colIdxInfo + idx)->finalIdx; - } - } -} - -static FORCE_INLINE int32_t setBlockInfo(SSubmitBlk *pBlocks, STableDataBlocks *dataBuf, int32_t numOfRows) { - pBlocks->suid = (TSDB_NORMAL_TABLE == dataBuf->pTableMeta->tableType ? 0 : dataBuf->pTableMeta->suid); - pBlocks->uid = dataBuf->pTableMeta->uid; - pBlocks->sversion = dataBuf->pTableMeta->sversion; - pBlocks->schemaLen = dataBuf->createTbReqLen; - - if (pBlocks->numOfRows + numOfRows >= INT32_MAX) { - return TSDB_CODE_TSC_INVALID_OPERATION; - } else { - pBlocks->numOfRows += numOfRows; - return TSDB_CODE_SUCCESS; - } -} - -int32_t schemaIdxCompar(const void *lhs, const void *rhs); -int32_t boundIdxCompar(const void *lhs, const void *rhs); -void setBoundColumnInfo(SParsedDataColInfo *pColList, SSchema *pSchema, col_id_t numOfCols); -void destroyBlockArrayList(SArray *pDataBlockList); -void destroyBlockHashmap(SHashObj *pDataBlockHash); -int initRowBuilder(SRowBuilder *pBuilder, int16_t schemaVer, SParsedDataColInfo *pColInfo); -int32_t allocateMemIfNeed(STableDataBlocks *pDataBlock, int32_t rowSize, int32_t *numOfRows); -int32_t getDataBlockFromList(SHashObj *pHashList, void *id, int32_t idLen, int32_t size, int32_t startOffset, - int32_t rowSize, STableMeta *pTableMeta, STableDataBlocks **dataBlocks, SArray *pBlockList, - SVCreateTbReq *pCreateTbReq); -int32_t mergeTableDataBlocks(SHashObj *pHashObj, uint8_t payloadType, SArray **pVgDataBlocks); -int32_t buildCreateTbMsg(STableDataBlocks *pBlocks, SVCreateTbReq *pCreateTbReq); - -int32_t allocateMemForSize(STableDataBlocks *pDataBlock, int32_t allSize); - -#endif // TDENGINE_DATABLOCKMGT_H diff --git a/source/libs/parser/inc/parInsertUtil.h b/source/libs/parser/inc/parInsertUtil.h new file mode 100644 index 0000000000..1e941632e7 --- /dev/null +++ b/source/libs/parser/inc/parInsertUtil.h @@ -0,0 +1,167 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#ifndef TDENGINE_PAR_INSERT_UTIL_H +#define TDENGINE_PAR_INSERT_UTIL_H + +#include "parUtil.h" + +struct SToken; + +#define IS_DATA_COL_ORDERED(spd) ((spd->orderStatus) == (int8_t)ORDER_STATUS_ORDERED) + +#define NEXT_TOKEN(pSql, sToken) \ + do { \ + int32_t index = 0; \ + sToken = tStrGetToken(pSql, &index, false); \ + pSql += index; \ + } while (0) + +#define CHECK_CODE(expr) \ + do { \ + int32_t code = expr; \ + if (TSDB_CODE_SUCCESS != code) { \ + return code; \ + } \ + } while (0) + +typedef enum EOrderStatus { + ORDER_STATUS_UNKNOWN = 0, + ORDER_STATUS_ORDERED = 1, + ORDER_STATUS_DISORDERED = 2, +} EOrderStatus; + +typedef enum EValStat { + VAL_STAT_HAS = 0x0, // 0 means has val + VAL_STAT_NONE = 0x01, // 1 means no val +} EValStat; + +typedef struct SBoundColumn { + int32_t offset; // all column offset value + int32_t toffset; // first part offset for SDataRow TODO: get offset from STSchema on future + uint8_t valStat; // EValStat. denote if current column bound or not(0 means has val, 1 means no val) +} SBoundColumn; + +typedef struct { + col_id_t schemaColIdx; + col_id_t boundIdx; + col_id_t finalIdx; +} SBoundIdxInfo; + +typedef struct SParsedDataColInfo { + col_id_t numOfCols; + col_id_t numOfBound; + uint16_t flen; // TODO: get from STSchema + uint16_t allNullLen; // TODO: get from STSchema(base on SDataRow) + uint16_t extendedVarLen; + uint16_t boundNullLen; // bound column len with all NULL value(without VarDataOffsetT/SColIdx part) + col_id_t *boundColumns; // bound column idx according to schema + SBoundColumn *cols; + SBoundIdxInfo *colIdxInfo; + int8_t orderStatus; // bound columns +} SParsedDataColInfo; + +typedef struct SInsertParseBaseContext { + SParseContext *pComCxt; + char *pSql; + SMsgBuf msg; +} SInsertParseBaseContext; + +typedef struct SInsertParseContext { + SParseContext *pComCxt; // input + char *pSql; // input + SMsgBuf msg; // input + STableMeta *pTableMeta; // each table + SParsedDataColInfo tags; // each table + SVCreateTbReq createTblReq; // each table + SHashObj *pVgroupsHashObj; // global + SHashObj *pTableBlockHashObj; // global + SHashObj *pSubTableHashObj; // global + SArray *pVgDataBlocks; // global + SHashObj *pTableNameHashObj; // global + SHashObj *pDbFNameHashObj; // global + int32_t totalNum; + SVnodeModifOpStmt *pOutput; + SStmtCallback *pStmtCb; + SParseMetaCache *pMetaCache; + char sTableName[TSDB_TABLE_NAME_LEN]; + char tmpTokenBuf[TSDB_MAX_BYTES_PER_ROW]; + int64_t memElapsed; + int64_t parRowElapsed; +} SInsertParseContext; + +typedef struct SInsertParseSyntaxCxt { + SParseContext *pComCxt; + char *pSql; + SMsgBuf msg; + SParseMetaCache *pMetaCache; +} SInsertParseSyntaxCxt; + +typedef struct SMemParam { + SRowBuilder *rb; + SSchema *schema; + int32_t toffset; + col_id_t colIdx; +} SMemParam; + +typedef struct { + uint8_t rowType; // default is 0, that is SDataRow + int32_t rowSize; +} SMemRowBuilder; + +typedef struct STableDataBlocks { + int8_t tsSource; // where does the UNIX timestamp come from, server or client + bool ordered; // if current rows are ordered or not + int32_t vgId; // virtual group id + int64_t prevTS; // previous timestamp, recorded to decide if the records array is ts ascending + int32_t numOfTables; // number of tables in current submit block + int32_t rowSize; // row size for current table + uint32_t nAllocSize; + uint32_t headerSize; // header for table info (uid, tid, submit metadata) + uint32_t size; + STableMeta *pTableMeta; // the tableMeta of current table, the table meta will be used during submit, keep a ref to + // avoid to be removed from cache + char *pData; + bool cloned; + int32_t createTbReqLen; + SParsedDataColInfo boundColumnInfo; + SRowBuilder rowBuilder; +} STableDataBlocks; + +int32_t insGetExtendedRowSize(STableDataBlocks *pBlock); +void insGetSTSRowAppendInfo(uint8_t rowType, SParsedDataColInfo *spd, col_id_t idx, int32_t *toffset, col_id_t *colIdx); +int32_t insSetBlockInfo(SSubmitBlk *pBlocks, STableDataBlocks *dataBuf, int32_t numOfRows); +int32_t insSchemaIdxCompar(const void *lhs, const void *rhs); +int32_t insBoundIdxCompar(const void *lhs, const void *rhs); +void insSetBoundColumnInfo(SParsedDataColInfo *pColList, SSchema *pSchema, col_id_t numOfCols); +void insDestroyBlockArrayList(SArray *pDataBlockList); +void insDestroyBlockHashmap(SHashObj *pDataBlockHash); +int32_t insInitRowBuilder(SRowBuilder *pBuilder, int16_t schemaVer, SParsedDataColInfo *pColInfo); +int32_t insGetDataBlockFromList(SHashObj *pHashList, void *id, int32_t idLen, int32_t size, int32_t startOffset, + int32_t rowSize, STableMeta *pTableMeta, STableDataBlocks **dataBlocks, + SArray *pBlockList, SVCreateTbReq *pCreateTbReq); +int32_t insMergeTableDataBlocks(SHashObj *pHashObj, SArray **pVgDataBlocks); +int32_t insBuildCreateTbMsg(STableDataBlocks *pBlocks, SVCreateTbReq *pCreateTbReq); +int32_t insAllocateMemForSize(STableDataBlocks *pDataBlock, int32_t allSize); +int32_t insCreateSName(SName *pName, struct SToken *pTableName, int32_t acctId, const char *dbName, SMsgBuf *pMsgBuf); +int32_t insFindCol(struct SToken *pColname, int32_t start, int32_t end, SSchema *pSchema); +void insBuildCreateTbReq(SVCreateTbReq *pTbReq, const char *tname, STag *pTag, int64_t suid, const char *sname, + SArray *tagName, uint8_t tagNum); +int32_t insMemRowAppend(SMsgBuf *pMsgBuf, const void *value, int32_t len, void *param); +int32_t insCheckTimestamp(STableDataBlocks *pDataBlocks, const char *start); +int32_t insBuildOutput(SInsertParseContext *pCxt); +void insDestroyDataBlock(STableDataBlocks *pDataBlock); + +#endif // TDENGINE_PAR_INSERT_UTIL_H diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index 09dfa54df6..845fd4262f 100644 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -410,8 +410,9 @@ cmd ::= SHOW QUERIES. cmd ::= SHOW SCORES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SCORES_STMT); } cmd ::= SHOW TOPICS. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TOPICS_STMT); } cmd ::= SHOW VARIABLES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VARIABLES_STMT); } +cmd ::= SHOW CLUSTER VARIABLES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VARIABLES_STMT); } cmd ::= SHOW LOCAL VARIABLES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT); } -cmd ::= SHOW DNODE NK_INTEGER(A) VARIABLES. { pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &A)); } +cmd ::= SHOW DNODE NK_INTEGER(A) VARIABLES like_pattern_opt(B). { pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &A), B); } cmd ::= SHOW BNODES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_BNODES_STMT); } cmd ::= SHOW SNODES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SNODES_STMT); } cmd ::= SHOW CLUSTER. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_STMT); } diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c index 15b939f14b..f7c92cc944 100644 --- a/source/libs/parser/src/parAstCreater.c +++ b/source/libs/parser/src/parAstCreater.c @@ -1372,11 +1372,12 @@ SNode* createShowTableDistributedStmt(SAstCreateContext* pCxt, SNode* pRealTable return (SNode*)pStmt; } -SNode* createShowDnodeVariablesStmt(SAstCreateContext* pCxt, SNode* pDnodeId) { +SNode* createShowDnodeVariablesStmt(SAstCreateContext* pCxt, SNode* pDnodeId, SNode* pLikePattern) { CHECK_PARSER_STATUS(pCxt); SShowDnodeVariablesStmt* pStmt = (SShowDnodeVariablesStmt*)nodesMakeNode(QUERY_NODE_SHOW_DNODE_VARIABLES_STMT); CHECK_OUT_OF_MEM(pStmt); pStmt->pDnodeId = pDnodeId; + pStmt->pLikePattern = pLikePattern; return (SNode*)pStmt; } diff --git a/source/libs/parser/src/parAstParser.c b/source/libs/parser/src/parAstParser.c index 95db6b93c9..28dc6179f9 100644 --- a/source/libs/parser/src/parAstParser.c +++ b/source/libs/parser/src/parAstParser.c @@ -484,11 +484,6 @@ static int32_t collectMetaKeyFromShowQueries(SCollectMetaKeyCxt* pCxt, SShowStmt pCxt->pMetaCache); } -static int32_t collectMetaKeyFromShowConfigs(SCollectMetaKeyCxt* pCxt, SShowStmt* pStmt) { - return reserveTableMetaInCache(pCxt->pParseCxt->acctId, TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_CONFIGS, - pCxt->pMetaCache); -} - static int32_t collectMetaKeyFromShowVariables(SCollectMetaKeyCxt* pCxt, SShowStmt* pStmt) { return reserveTableMetaInCache(pCxt->pParseCxt->acctId, TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_CONFIGS, pCxt->pMetaCache); diff --git a/source/libs/parser/src/parAuthenticator.c b/source/libs/parser/src/parAuthenticator.c index 9d73be7454..f7ab4fccbe 100644 --- a/source/libs/parser/src/parAuthenticator.c +++ b/source/libs/parser/src/parAuthenticator.c @@ -125,7 +125,6 @@ static int32_t authQuery(SAuthCxt* pCxt, SNode* pStmt) { case QUERY_NODE_SHOW_CLUSTER_STMT: case QUERY_NODE_SHOW_LICENCES_STMT: case QUERY_NODE_SHOW_VGROUPS_STMT: - case QUERY_NODE_SHOW_VARIABLES_STMT: case QUERY_NODE_SHOW_CREATE_DATABASE_STMT: case QUERY_NODE_SHOW_TABLE_DISTRIBUTED_STMT: case QUERY_NODE_SHOW_VNODES_STMT: diff --git a/source/libs/parser/src/parInsertSml.c b/source/libs/parser/src/parInsertSml.c new file mode 100644 index 0000000000..8be5b86b37 --- /dev/null +++ b/source/libs/parser/src/parInsertSml.c @@ -0,0 +1,363 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#include "parInsertUtil.h" +#include "parInt.h" +#include "parToken.h" +#include "ttime.h" + +int32_t qCreateSName(SName* pName, const char* pTableName, int32_t acctId, char* dbName, char* msgBuf, + int32_t msgBufLen) { + SMsgBuf msg = {.buf = msgBuf, .len = msgBufLen}; + SToken sToken; + int32_t code = 0; + char* tbName = NULL; + + NEXT_TOKEN(pTableName, sToken); + + if (sToken.n == 0) { + return buildInvalidOperationMsg(&msg, "empty table name"); + } + + code = insCreateSName(pName, &sToken, acctId, dbName, &msg); + if (code) { + return code; + } + + NEXT_TOKEN(pTableName, sToken); + + if (sToken.n > 0) { + return buildInvalidOperationMsg(&msg, "table name format is wrong"); + } + + return TSDB_CODE_SUCCESS; +} + +typedef struct SmlExecTableHandle { + SParsedDataColInfo tags; // each table + SVCreateTbReq createTblReq; // each table +} SmlExecTableHandle; + +typedef struct SmlExecHandle { + SHashObj* pBlockHash; + SmlExecTableHandle tableExecHandle; + SQuery* pQuery; +} SSmlExecHandle; + +static void smlDestroyTableHandle(void* pHandle) { + SmlExecTableHandle* handle = (SmlExecTableHandle*)pHandle; + destroyBoundColumnInfo(&handle->tags); + tdDestroySVCreateTbReq(&handle->createTblReq); +} + +static int32_t smlBoundColumnData(SArray* cols, SParsedDataColInfo* pColList, SSchema* pSchema, bool isTag) { + col_id_t nCols = pColList->numOfCols; + + pColList->numOfBound = 0; + pColList->boundNullLen = 0; + memset(pColList->boundColumns, 0, sizeof(col_id_t) * nCols); + for (col_id_t i = 0; i < nCols; ++i) { + pColList->cols[i].valStat = VAL_STAT_NONE; + } + + bool isOrdered = true; + col_id_t lastColIdx = -1; // last column found + for (int i = 0; i < taosArrayGetSize(cols); ++i) { + SSmlKv* kv = taosArrayGetP(cols, i); + SToken sToken = {.n = kv->keyLen, .z = (char*)kv->key}; + col_id_t t = lastColIdx + 1; + col_id_t index = ((t == 0 && !isTag) ? 0 : insFindCol(&sToken, t, nCols, pSchema)); + uDebug("SML, index:%d, t:%d, ncols:%d", index, t, nCols); + if (index < 0 && t > 0) { + index = insFindCol(&sToken, 0, t, pSchema); + isOrdered = false; + } + if (index < 0) { + uError("smlBoundColumnData. index:%d", index); + return TSDB_CODE_SML_INVALID_DATA; + } + if (pColList->cols[index].valStat == VAL_STAT_HAS) { + uError("smlBoundColumnData. already set. index:%d", index); + return TSDB_CODE_SML_INVALID_DATA; + } + lastColIdx = index; + pColList->cols[index].valStat = VAL_STAT_HAS; + pColList->boundColumns[pColList->numOfBound] = index; + ++pColList->numOfBound; + switch (pSchema[t].type) { + case TSDB_DATA_TYPE_BINARY: + pColList->boundNullLen += (sizeof(VarDataOffsetT) + VARSTR_HEADER_SIZE + CHAR_BYTES); + break; + case TSDB_DATA_TYPE_NCHAR: + pColList->boundNullLen += (sizeof(VarDataOffsetT) + VARSTR_HEADER_SIZE + TSDB_NCHAR_SIZE); + break; + default: + pColList->boundNullLen += TYPE_BYTES[pSchema[t].type]; + break; + } + } + + pColList->orderStatus = isOrdered ? ORDER_STATUS_ORDERED : ORDER_STATUS_DISORDERED; + + if (!isOrdered) { + pColList->colIdxInfo = taosMemoryCalloc(pColList->numOfBound, sizeof(SBoundIdxInfo)); + if (NULL == pColList->colIdxInfo) { + return TSDB_CODE_TSC_OUT_OF_MEMORY; + } + SBoundIdxInfo* pColIdx = pColList->colIdxInfo; + for (col_id_t i = 0; i < pColList->numOfBound; ++i) { + pColIdx[i].schemaColIdx = pColList->boundColumns[i]; + pColIdx[i].boundIdx = i; + } + taosSort(pColIdx, pColList->numOfBound, sizeof(SBoundIdxInfo), insSchemaIdxCompar); + for (col_id_t i = 0; i < pColList->numOfBound; ++i) { + pColIdx[i].finalIdx = i; + } + taosSort(pColIdx, pColList->numOfBound, sizeof(SBoundIdxInfo), insBoundIdxCompar); + } + + if (pColList->numOfCols > pColList->numOfBound) { + memset(&pColList->boundColumns[pColList->numOfBound], 0, + sizeof(col_id_t) * (pColList->numOfCols - pColList->numOfBound)); + } + + return TSDB_CODE_SUCCESS; +} + +/** + * @brief No json tag for schemaless + * + * @param cols + * @param tags + * @param pSchema + * @param ppTag + * @param msg + * @return int32_t + */ +static int32_t smlBuildTagRow(SArray* cols, SParsedDataColInfo* tags, SSchema* pSchema, STag** ppTag, SArray** tagName, + SMsgBuf* msg) { + SArray* pTagArray = taosArrayInit(tags->numOfBound, sizeof(STagVal)); + if (!pTagArray) { + return TSDB_CODE_TSC_OUT_OF_MEMORY; + } + *tagName = taosArrayInit(8, TSDB_COL_NAME_LEN); + if (!*tagName) { + return TSDB_CODE_TSC_OUT_OF_MEMORY; + } + + int32_t code = TSDB_CODE_SUCCESS; + for (int i = 0; i < tags->numOfBound; ++i) { + SSchema* pTagSchema = &pSchema[tags->boundColumns[i]]; + SSmlKv* kv = taosArrayGetP(cols, i); + + taosArrayPush(*tagName, pTagSchema->name); + STagVal val = {.cid = pTagSchema->colId, .type = pTagSchema->type}; + // strcpy(val.colName, pTagSchema->name); + if (pTagSchema->type == TSDB_DATA_TYPE_BINARY) { + val.pData = (uint8_t*)kv->value; + val.nData = kv->length; + } else if (pTagSchema->type == TSDB_DATA_TYPE_NCHAR) { + int32_t output = 0; + void* p = taosMemoryCalloc(1, kv->length * TSDB_NCHAR_SIZE); + if (p == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + goto end; + } + if (!taosMbsToUcs4(kv->value, kv->length, (TdUcs4*)(p), kv->length * TSDB_NCHAR_SIZE, &output)) { + if (errno == E2BIG) { + taosMemoryFree(p); + code = generateSyntaxErrMsg(msg, TSDB_CODE_PAR_VALUE_TOO_LONG, pTagSchema->name); + goto end; + } + char buf[512] = {0}; + snprintf(buf, tListLen(buf), " taosMbsToUcs4 error:%s", strerror(errno)); + taosMemoryFree(p); + code = buildSyntaxErrMsg(msg, buf, kv->value); + goto end; + } + val.pData = p; + val.nData = output; + } else { + memcpy(&val.i64, &(kv->value), kv->length); + } + taosArrayPush(pTagArray, &val); + } + + code = tTagNew(pTagArray, 1, false, ppTag); +end: + for (int i = 0; i < taosArrayGetSize(pTagArray); ++i) { + STagVal* p = (STagVal*)taosArrayGet(pTagArray, i); + if (p->type == TSDB_DATA_TYPE_NCHAR) { + taosMemoryFree(p->pData); + } + } + taosArrayDestroy(pTagArray); + return code; +} + +int32_t smlBindData(void* handle, SArray* tags, SArray* colsSchema, SArray* cols, bool format, STableMeta* pTableMeta, + char* tableName, const char* sTableName, int32_t sTableNameLen, char* msgBuf, int16_t msgBufLen) { + SMsgBuf pBuf = {.buf = msgBuf, .len = msgBufLen}; + + SSmlExecHandle* smlHandle = (SSmlExecHandle*)handle; + smlDestroyTableHandle(&smlHandle->tableExecHandle); // free for each table + SSchema* pTagsSchema = getTableTagSchema(pTableMeta); + insSetBoundColumnInfo(&smlHandle->tableExecHandle.tags, pTagsSchema, getNumOfTags(pTableMeta)); + int ret = smlBoundColumnData(tags, &smlHandle->tableExecHandle.tags, pTagsSchema, true); + if (ret != TSDB_CODE_SUCCESS) { + buildInvalidOperationMsg(&pBuf, "bound tags error"); + return ret; + } + STag* pTag = NULL; + SArray* tagName = NULL; + ret = smlBuildTagRow(tags, &smlHandle->tableExecHandle.tags, pTagsSchema, &pTag, &tagName, &pBuf); + if (ret != TSDB_CODE_SUCCESS) { + taosArrayDestroy(tagName); + return ret; + } + + insBuildCreateTbReq(&smlHandle->tableExecHandle.createTblReq, tableName, pTag, pTableMeta->suid, NULL, tagName, + pTableMeta->tableInfo.numOfTags); + taosArrayDestroy(tagName); + + smlHandle->tableExecHandle.createTblReq.ctb.stbName = taosMemoryMalloc(sTableNameLen + 1); + memcpy(smlHandle->tableExecHandle.createTblReq.ctb.stbName, sTableName, sTableNameLen); + smlHandle->tableExecHandle.createTblReq.ctb.stbName[sTableNameLen] = 0; + + STableDataBlocks* pDataBlock = NULL; + ret = insGetDataBlockFromList(smlHandle->pBlockHash, &pTableMeta->uid, sizeof(pTableMeta->uid), + TSDB_DEFAULT_PAYLOAD_SIZE, sizeof(SSubmitBlk), getTableInfo(pTableMeta).rowSize, + pTableMeta, &pDataBlock, NULL, &smlHandle->tableExecHandle.createTblReq); + if (ret != TSDB_CODE_SUCCESS) { + buildInvalidOperationMsg(&pBuf, "create data block error"); + return ret; + } + + SSchema* pSchema = getTableColumnSchema(pTableMeta); + + ret = smlBoundColumnData(colsSchema, &pDataBlock->boundColumnInfo, pSchema, false); + if (ret != TSDB_CODE_SUCCESS) { + buildInvalidOperationMsg(&pBuf, "bound cols error"); + return ret; + } + int32_t extendedRowSize = insGetExtendedRowSize(pDataBlock); + SParsedDataColInfo* spd = &pDataBlock->boundColumnInfo; + SRowBuilder* pBuilder = &pDataBlock->rowBuilder; + SMemParam param = {.rb = pBuilder}; + + insInitRowBuilder(&pDataBlock->rowBuilder, pDataBlock->pTableMeta->sversion, &pDataBlock->boundColumnInfo); + + int32_t rowNum = taosArrayGetSize(cols); + if (rowNum <= 0) { + return buildInvalidOperationMsg(&pBuf, "cols size <= 0"); + } + ret = insAllocateMemForSize(pDataBlock, extendedRowSize * rowNum); + if (ret != TSDB_CODE_SUCCESS) { + buildInvalidOperationMsg(&pBuf, "allocate memory error"); + return ret; + } + for (int32_t r = 0; r < rowNum; ++r) { + STSRow* row = (STSRow*)(pDataBlock->pData + pDataBlock->size); // skip the SSubmitBlk header + tdSRowResetBuf(pBuilder, row); + void* rowData = taosArrayGetP(cols, r); + size_t rowDataSize = 0; + if (format) { + rowDataSize = taosArrayGetSize(rowData); + } + + // 1. set the parsed value from sql string + for (int c = 0, j = 0; c < spd->numOfBound; ++c) { + SSchema* pColSchema = &pSchema[spd->boundColumns[c]]; + + param.schema = pColSchema; + insGetSTSRowAppendInfo(pBuilder->rowType, spd, c, ¶m.toffset, ¶m.colIdx); + + SSmlKv* kv = NULL; + if (format) { + if (j < rowDataSize) { + kv = taosArrayGetP(rowData, j); + if (rowDataSize != spd->numOfBound && j != 0 && + (kv->keyLen != strlen(pColSchema->name) || strncmp(kv->key, pColSchema->name, kv->keyLen) != 0)) { + kv = NULL; + } else { + j++; + } + } + } else { + void** p = taosHashGet(rowData, pColSchema->name, strlen(pColSchema->name)); + if (p) kv = *p; + } + + if (kv) { + int32_t colLen = kv->length; + if (pColSchema->type == TSDB_DATA_TYPE_TIMESTAMP) { + // uError("SML:data before:%" PRId64 ", precision:%d", kv->i, pTableMeta->tableInfo.precision); + kv->i = convertTimePrecision(kv->i, TSDB_TIME_PRECISION_NANO, pTableMeta->tableInfo.precision); + // uError("SML:data after:%" PRId64 ", precision:%d", kv->i, pTableMeta->tableInfo.precision); + } + + if (IS_VAR_DATA_TYPE(kv->type)) { + insMemRowAppend(&pBuf, kv->value, colLen, ¶m); + } else { + insMemRowAppend(&pBuf, &(kv->value), colLen, ¶m); + } + } else { + pBuilder->hasNone = true; + } + + if (PRIMARYKEY_TIMESTAMP_COL_ID == pColSchema->colId) { + TSKEY tsKey = TD_ROW_KEY(row); + insCheckTimestamp(pDataBlock, (const char*)&tsKey); + } + } + + // set the null value for the columns that do not assign values + if ((spd->numOfBound < spd->numOfCols) && TD_IS_TP_ROW(row)) { + pBuilder->hasNone = true; + } + + tdSRowEnd(pBuilder); + pDataBlock->size += extendedRowSize; + } + + SSubmitBlk* pBlocks = (SSubmitBlk*)(pDataBlock->pData); + if (TSDB_CODE_SUCCESS != insSetBlockInfo(pBlocks, pDataBlock, rowNum)) { + return buildInvalidOperationMsg(&pBuf, "too many rows in sql, total number of rows should be less than INT32_MAX"); + } + + return TSDB_CODE_SUCCESS; +} + +void* smlInitHandle(SQuery* pQuery) { + SSmlExecHandle* handle = taosMemoryCalloc(1, sizeof(SSmlExecHandle)); + if (!handle) return NULL; + handle->pBlockHash = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), true, false); + handle->pQuery = pQuery; + + return handle; +} + +void smlDestroyHandle(void* pHandle) { + if (!pHandle) return; + SSmlExecHandle* handle = (SSmlExecHandle*)pHandle; + insDestroyBlockHashmap(handle->pBlockHash); + smlDestroyTableHandle(&handle->tableExecHandle); + taosMemoryFree(handle); +} + +int32_t smlBuildOutput(void* handle, SHashObj* pVgHash) { + SSmlExecHandle* smlHandle = (SSmlExecHandle*)handle; + return qBuildStmtOutput(smlHandle->pQuery, pVgHash, smlHandle->pBlockHash); +} diff --git a/source/libs/parser/src/parInsert.c b/source/libs/parser/src/parInsertSql.c similarity index 60% rename from source/libs/parser/src/parInsert.c rename to source/libs/parser/src/parInsertSql.c index 65cc44b1e9..1ccb34cd1f 100644 --- a/source/libs/parser/src/parInsert.c +++ b/source/libs/parser/src/parInsertSql.c @@ -13,22 +13,10 @@ * along with this program. If not, see . */ -#include "os.h" -#include "parInsertData.h" -#include "parInt.h" +#include "parInsertUtil.h" #include "parToken.h" -#include "parUtil.h" -#include "query.h" #include "tglobal.h" #include "ttime.h" -#include "ttypes.h" - -#define NEXT_TOKEN(pSql, sToken) \ - do { \ - int32_t index = 0; \ - sToken = tStrGetToken(pSql, &index, false); \ - pSql += index; \ - } while (0) #define NEXT_TOKEN_WITH_PREV(pSql, sToken) \ do { \ @@ -49,69 +37,11 @@ pSql += sToken.n; \ } while (TK_NK_SPACE == sToken.type) -typedef struct SInsertParseBaseContext { - SParseContext* pComCxt; - char* pSql; - SMsgBuf msg; -} SInsertParseBaseContext; - -typedef struct SInsertParseContext { - SParseContext* pComCxt; // input - char* pSql; // input - SMsgBuf msg; // input - STableMeta* pTableMeta; // each table - SParsedDataColInfo tags; // each table - SVCreateTbReq createTblReq; // each table - SHashObj* pVgroupsHashObj; // global - SHashObj* pTableBlockHashObj; // global - SHashObj* pSubTableHashObj; // global - SArray* pVgDataBlocks; // global - SHashObj* pTableNameHashObj; // global - SHashObj* pDbFNameHashObj; // global - int32_t totalNum; - SVnodeModifOpStmt* pOutput; - SStmtCallback* pStmtCb; - SParseMetaCache* pMetaCache; - char sTableName[TSDB_TABLE_NAME_LEN]; - char tmpTokenBuf[TSDB_MAX_BYTES_PER_ROW]; - int64_t memElapsed; - int64_t parRowElapsed; -} SInsertParseContext; - -typedef struct SInsertParseSyntaxCxt { - SParseContext* pComCxt; - char* pSql; - SMsgBuf msg; - SParseMetaCache* pMetaCache; -} SInsertParseSyntaxCxt; - typedef int32_t (*_row_append_fn_t)(SMsgBuf* pMsgBuf, const void* value, int32_t len, void* param); static uint8_t TRUE_VALUE = (uint8_t)TSDB_TRUE; static uint8_t FALSE_VALUE = (uint8_t)TSDB_FALSE; -typedef struct SKvParam { - int16_t pos; - SArray* pTagVals; - SSchema* schema; - char buf[TSDB_MAX_TAGS_LEN]; -} SKvParam; - -typedef struct SMemParam { - SRowBuilder* rb; - SSchema* schema; - int32_t toffset; - col_id_t colIdx; -} SMemParam; - -#define CHECK_CODE(expr) \ - do { \ - int32_t code = expr; \ - if (TSDB_CODE_SUCCESS != code) { \ - return code; \ - } \ - } while (0) - static int32_t skipInsertInto(char** pSql, SMsgBuf* pMsg) { SToken sToken; NEXT_TOKEN(*pSql, sToken); @@ -125,105 +55,6 @@ static int32_t skipInsertInto(char** pSql, SMsgBuf* pMsg) { return TSDB_CODE_SUCCESS; } -static char* tableNameGetPosition(SToken* pToken, char target) { - bool inEscape = false; - bool inQuote = false; - char quotaStr = 0; - - for (uint32_t i = 0; i < pToken->n; ++i) { - if (*(pToken->z + i) == target && (!inEscape) && (!inQuote)) { - return pToken->z + i; - } - - if (*(pToken->z + i) == TS_ESCAPE_CHAR) { - if (!inQuote) { - inEscape = !inEscape; - } - } - - if (*(pToken->z + i) == '\'' || *(pToken->z + i) == '"') { - if (!inEscape) { - if (!inQuote) { - quotaStr = *(pToken->z + i); - inQuote = !inQuote; - } else if (quotaStr == *(pToken->z + i)) { - inQuote = !inQuote; - } - } - } - } - - return NULL; -} - -static int32_t createSName(SName* pName, SToken* pTableName, int32_t acctId, const char* dbName, SMsgBuf* pMsgBuf) { - const char* msg1 = "name too long"; - const char* msg2 = "invalid database name"; - const char* msg3 = "db is not specified"; - const char* msg4 = "invalid table name"; - - int32_t code = TSDB_CODE_SUCCESS; - char* p = tableNameGetPosition(pTableName, TS_PATH_DELIMITER[0]); - - if (p != NULL) { // db has been specified in sql string so we ignore current db path - assert(*p == TS_PATH_DELIMITER[0]); - - int32_t dbLen = p - pTableName->z; - if (dbLen <= 0) { - return buildInvalidOperationMsg(pMsgBuf, msg2); - } - char name[TSDB_DB_FNAME_LEN] = {0}; - strncpy(name, pTableName->z, dbLen); - int32_t actualDbLen = strdequote(name); - - code = tNameSetDbName(pName, acctId, name, actualDbLen); - if (code != TSDB_CODE_SUCCESS) { - return buildInvalidOperationMsg(pMsgBuf, msg1); - } - - int32_t tbLen = pTableName->n - dbLen - 1; - if (tbLen <= 0) { - return buildInvalidOperationMsg(pMsgBuf, msg4); - } - - char tbname[TSDB_TABLE_FNAME_LEN] = {0}; - strncpy(tbname, p + 1, tbLen); - /*tbLen = */ strdequote(tbname); - - code = tNameFromString(pName, tbname, T_NAME_TABLE); - if (code != 0) { - return buildInvalidOperationMsg(pMsgBuf, msg1); - } - } else { // get current DB name first, and then set it into path - if (pTableName->n >= TSDB_TABLE_NAME_LEN) { - return buildInvalidOperationMsg(pMsgBuf, msg1); - } - - assert(pTableName->n < TSDB_TABLE_FNAME_LEN); - - char name[TSDB_TABLE_FNAME_LEN] = {0}; - strncpy(name, pTableName->z, pTableName->n); - strdequote(name); - - if (dbName == NULL) { - return buildInvalidOperationMsg(pMsgBuf, msg3); - } - - code = tNameSetDbName(pName, acctId, dbName, strlen(dbName)); - if (code != TSDB_CODE_SUCCESS) { - code = buildInvalidOperationMsg(pMsgBuf, msg2); - return code; - } - - code = tNameFromString(pName, name, T_NAME_TABLE); - if (code != 0) { - code = buildInvalidOperationMsg(pMsgBuf, msg1); - } - } - - return code; -} - static int32_t checkAuth(SInsertParseContext* pCxt, char* pDbFname, bool* pPass) { SParseContext* pBasicCtx = pCxt->pComCxt; if (pBasicCtx->async) { @@ -298,74 +129,6 @@ static int32_t getDBCfg(SInsertParseContext* pCxt, const char* pDbFName, SDbCfgI return TSDB_CODE_SUCCESS; } -static int32_t findCol(SToken* pColname, int32_t start, int32_t end, SSchema* pSchema) { - while (start < end) { - if (strlen(pSchema[start].name) == pColname->n && strncmp(pColname->z, pSchema[start].name, pColname->n) == 0) { - return start; - } - ++start; - } - return -1; -} - -static void buildMsgHeader(STableDataBlocks* src, SVgDataBlocks* blocks) { - SSubmitReq* submit = (SSubmitReq*)blocks->pData; - submit->header.vgId = htonl(blocks->vg.vgId); - submit->header.contLen = htonl(blocks->size); - submit->length = submit->header.contLen; - submit->numOfBlocks = htonl(blocks->numOfTables); - SSubmitBlk* blk = (SSubmitBlk*)(submit + 1); - int32_t numOfBlocks = blocks->numOfTables; - while (numOfBlocks--) { - int32_t dataLen = blk->dataLen; - int32_t schemaLen = blk->schemaLen; - blk->uid = htobe64(blk->uid); - blk->suid = htobe64(blk->suid); - blk->sversion = htonl(blk->sversion); - blk->dataLen = htonl(blk->dataLen); - blk->schemaLen = htonl(blk->schemaLen); - blk->numOfRows = htonl(blk->numOfRows); - blk = (SSubmitBlk*)(blk->data + schemaLen + dataLen); - } -} - -static int32_t buildOutput(SInsertParseContext* pCxt) { - size_t numOfVg = taosArrayGetSize(pCxt->pVgDataBlocks); - pCxt->pOutput->pDataBlocks = taosArrayInit(numOfVg, POINTER_BYTES); - if (NULL == pCxt->pOutput->pDataBlocks) { - return TSDB_CODE_TSC_OUT_OF_MEMORY; - } - for (size_t i = 0; i < numOfVg; ++i) { - STableDataBlocks* src = taosArrayGetP(pCxt->pVgDataBlocks, i); - SVgDataBlocks* dst = taosMemoryCalloc(1, sizeof(SVgDataBlocks)); - if (NULL == dst) { - return TSDB_CODE_TSC_OUT_OF_MEMORY; - } - taosHashGetDup(pCxt->pVgroupsHashObj, (const char*)&src->vgId, sizeof(src->vgId), &dst->vg); - dst->numOfTables = src->numOfTables; - dst->size = src->size; - TSWAP(dst->pData, src->pData); - buildMsgHeader(src, dst); - taosArrayPush(pCxt->pOutput->pDataBlocks, &dst); - } - return TSDB_CODE_SUCCESS; -} - -int32_t checkTimestamp(STableDataBlocks* pDataBlocks, const char* start) { - // once the data block is disordered, we do NOT keep previous timestamp any more - if (!pDataBlocks->ordered) { - return TSDB_CODE_SUCCESS; - } - - TSKEY k = *(TSKEY*)start; - if (k <= pDataBlocks->prevTS) { - pDataBlocks->ordered = false; - } - - pDataBlocks->prevTS = k; - return TSDB_CODE_SUCCESS; -} - static int parseTime(char** end, SToken* pToken, int16_t timePrec, int64_t* time, SMsgBuf* pMsgBuf) { int32_t index = 0; SToken sToken; @@ -659,40 +422,6 @@ static int32_t parseValueToken(char** end, SToken* pToken, SSchema* pSchema, int return TSDB_CODE_FAILED; } -static FORCE_INLINE int32_t MemRowAppend(SMsgBuf* pMsgBuf, const void* value, int32_t len, void* param) { - SMemParam* pa = (SMemParam*)param; - SRowBuilder* rb = pa->rb; - - if (value == NULL) { // it is a null data - tdAppendColValToRow(rb, pa->schema->colId, pa->schema->type, TD_VTYPE_NULL, value, false, pa->toffset, pa->colIdx); - return TSDB_CODE_SUCCESS; - } - - if (TSDB_DATA_TYPE_BINARY == pa->schema->type) { - const char* rowEnd = tdRowEnd(rb->pBuf); - STR_WITH_SIZE_TO_VARSTR(rowEnd, value, len); - tdAppendColValToRow(rb, pa->schema->colId, pa->schema->type, TD_VTYPE_NORM, rowEnd, false, pa->toffset, pa->colIdx); - } else if (TSDB_DATA_TYPE_NCHAR == pa->schema->type) { - // if the converted output len is over than pColumnModel->bytes, return error: 'Argument list too long' - int32_t output = 0; - const char* rowEnd = tdRowEnd(rb->pBuf); - if (!taosMbsToUcs4(value, len, (TdUcs4*)varDataVal(rowEnd), pa->schema->bytes - VARSTR_HEADER_SIZE, &output)) { - if (errno == E2BIG) { - return generateSyntaxErrMsg(pMsgBuf, TSDB_CODE_PAR_VALUE_TOO_LONG, pa->schema->name); - } - char buf[512] = {0}; - snprintf(buf, tListLen(buf), "%s", strerror(errno)); - return buildSyntaxErrMsg(pMsgBuf, buf, value); - } - varDataSetLen(rowEnd, output); - tdAppendColValToRow(rb, pa->schema->colId, pa->schema->type, TD_VTYPE_NORM, rowEnd, false, pa->toffset, pa->colIdx); - } else { - tdAppendColValToRow(rb, pa->schema->colId, pa->schema->type, TD_VTYPE_NORM, value, false, pa->toffset, pa->colIdx); - } - - return TSDB_CODE_SUCCESS; -} - // pSql -> tag1_name, ...) static int32_t parseBoundColumns(SInsertParseContext* pCxt, SParsedDataColInfo* pColList, SSchema* pSchema) { col_id_t nCols = pColList->numOfCols; @@ -720,9 +449,9 @@ static int32_t parseBoundColumns(SInsertParseContext* pCxt, SParsedDataColInfo* sToken.n = strdequote(sToken.z); col_id_t t = lastColIdx + 1; - col_id_t index = findCol(&sToken, t, nCols, pSchema); + col_id_t index = insFindCol(&sToken, t, nCols, pSchema); if (index < 0 && t > 0) { - index = findCol(&sToken, 0, t, pSchema); + index = insFindCol(&sToken, 0, t, pSchema); isOrdered = false; } if (index < 0) { @@ -760,11 +489,11 @@ static int32_t parseBoundColumns(SInsertParseContext* pCxt, SParsedDataColInfo* pColIdx[i].schemaColIdx = pColList->boundColumns[i]; pColIdx[i].boundIdx = i; } - taosSort(pColIdx, pColList->numOfBound, sizeof(SBoundIdxInfo), schemaIdxCompar); + taosSort(pColIdx, pColList->numOfBound, sizeof(SBoundIdxInfo), insSchemaIdxCompar); for (col_id_t i = 0; i < pColList->numOfBound; ++i) { pColIdx[i].finalIdx = i; } - taosSort(pColIdx, pColList->numOfBound, sizeof(SBoundIdxInfo), boundIdxCompar); + taosSort(pColIdx, pColList->numOfBound, sizeof(SBoundIdxInfo), insBoundIdxCompar); } if (pColList->numOfCols > pColList->numOfBound) { @@ -775,21 +504,6 @@ static int32_t parseBoundColumns(SInsertParseContext* pCxt, SParsedDataColInfo* return TSDB_CODE_SUCCESS; } -static void buildCreateTbReq(SVCreateTbReq* pTbReq, const char* tname, STag* pTag, int64_t suid, const char* sname, - SArray* tagName, uint8_t tagNum) { - pTbReq->type = TD_CHILD_TABLE; - pTbReq->name = strdup(tname); - pTbReq->ctb.suid = suid; - pTbReq->ctb.tagNum = tagNum; - if (sname) pTbReq->ctb.stbName = strdup(sname); - pTbReq->ctb.pTag = (uint8_t*)pTag; - pTbReq->ctb.tagName = taosArrayDup(tagName); - pTbReq->ttl = TSDB_DEFAULT_TABLE_TTL; - pTbReq->commentLen = -1; - - return; -} - static int32_t parseTagToken(char** end, SToken* pToken, SSchema* pSchema, int16_t timePrec, STagVal* val, SMsgBuf* pMsgBuf) { int64_t iv; @@ -1037,8 +751,8 @@ static int32_t parseTagsClause(SInsertParseContext* pCxt, SSchema* pSchema, uint } if (TSDB_CODE_SUCCESS == code && !isParseBindParam) { - buildCreateTbReq(&pCxt->createTblReq, tName, pTag, pCxt->pTableMeta->suid, pCxt->sTableName, tagName, - pCxt->pTableMeta->tableInfo.numOfTags); + insBuildCreateTbReq(&pCxt->createTblReq, tName, pTag, pCxt->pTableMeta->suid, pCxt->sTableName, tagName, + pCxt->pTableMeta->tableInfo.numOfTags); pTag = NULL; } @@ -1160,7 +874,7 @@ static int32_t parseUsingClause(SInsertParseContext* pCxt, int32_t tbNo, SName* NEXT_TOKEN(pCxt->pSql, sToken); SName sname; - CHECK_CODE(createSName(&sname, &sToken, pCxt->pComCxt->acctId, pCxt->pComCxt->db, &pCxt->msg)); + CHECK_CODE(insCreateSName(&sname, &sToken, pCxt->pComCxt->acctId, pCxt->pComCxt->db, &pCxt->msg)); char dbFName[TSDB_DB_FNAME_LEN]; tNameGetFullDbName(&sname, dbFName); strcpy(pCxt->sTableName, sname.tname); @@ -1172,7 +886,7 @@ static int32_t parseUsingClause(SInsertParseContext* pCxt, int32_t tbNo, SName* CHECK_CODE(storeTableMeta(pCxt, pCxt->pSubTableHashObj, tbNo, name, tbFName, len, pCxt->pTableMeta)); SSchema* pTagsSchema = getTableTagSchema(pCxt->pTableMeta); - setBoundColumnInfo(&pCxt->tags, pTagsSchema, getNumOfTags(pCxt->pTableMeta)); + insSetBoundColumnInfo(&pCxt->tags, pTagsSchema, getNumOfTags(pCxt->pTableMeta)); // pSql -> [(tag1_name, ...)] TAGS (tag1_value, ...) NEXT_TOKEN(pCxt->pSql, sToken); @@ -1235,8 +949,9 @@ static int parseOneRow(SInsertParseContext* pCxt, STableDataBlocks* pDataBlocks, } param.schema = pSchema; - getSTSRowAppendInfo(pBuilder->rowType, spd, i, ¶m.toffset, ¶m.colIdx); - CHECK_CODE(parseValueToken(&pCxt->pSql, &sToken, pSchema, timePrec, tmpTokenBuf, MemRowAppend, ¶m, &pCxt->msg)); + insGetSTSRowAppendInfo(pBuilder->rowType, spd, i, ¶m.toffset, ¶m.colIdx); + CHECK_CODE( + parseValueToken(&pCxt->pSql, &sToken, pSchema, timePrec, tmpTokenBuf, insMemRowAppend, ¶m, &pCxt->msg)); if (i < spd->numOfBound - 1) { NEXT_VALID_TOKEN(pCxt->pSql, sToken); @@ -1247,7 +962,7 @@ static int parseOneRow(SInsertParseContext* pCxt, STableDataBlocks* pDataBlocks, } TSKEY tsKey = TD_ROW_KEY(row); - checkTimestamp(pDataBlocks, (const char*)&tsKey); + insCheckTimestamp(pDataBlocks, (const char*)&tsKey); if (!isParseBindParam) { // set the null value for the columns that do not assign values @@ -1270,11 +985,40 @@ static int parseOneRow(SInsertParseContext* pCxt, STableDataBlocks* pDataBlocks, return TSDB_CODE_SUCCESS; } +static int32_t allocateMemIfNeed(STableDataBlocks* pDataBlock, int32_t rowSize, int32_t* numOfRows) { + size_t remain = pDataBlock->nAllocSize - pDataBlock->size; + const int factor = 5; + uint32_t nAllocSizeOld = pDataBlock->nAllocSize; + + // expand the allocated size + if (remain < rowSize * factor) { + while (remain < rowSize * factor) { + pDataBlock->nAllocSize = (uint32_t)(pDataBlock->nAllocSize * 1.5); + remain = pDataBlock->nAllocSize - pDataBlock->size; + } + + char* tmp = taosMemoryRealloc(pDataBlock->pData, (size_t)pDataBlock->nAllocSize); + if (tmp != NULL) { + pDataBlock->pData = tmp; + memset(pDataBlock->pData + pDataBlock->size, 0, pDataBlock->nAllocSize - pDataBlock->size); + } else { + // do nothing, if allocate more memory failed + pDataBlock->nAllocSize = nAllocSizeOld; + *numOfRows = (int32_t)(pDataBlock->nAllocSize - pDataBlock->headerSize) / rowSize; + return TSDB_CODE_TSC_OUT_OF_MEMORY; + } + } + + *numOfRows = (int32_t)(pDataBlock->nAllocSize - pDataBlock->headerSize) / rowSize; + return TSDB_CODE_SUCCESS; +} + // pSql -> (field1_value, ...) [(field1_value2, ...) ...] static int32_t parseValues(SInsertParseContext* pCxt, STableDataBlocks* pDataBlock, int maxRows, int32_t* numOfRows) { STableComInfo tinfo = getTableInfo(pDataBlock->pTableMeta); - int32_t extendedRowSize = getExtendedRowSize(pDataBlock); - CHECK_CODE(initRowBuilder(&pDataBlock->rowBuilder, pDataBlock->pTableMeta->sversion, &pDataBlock->boundColumnInfo)); + int32_t extendedRowSize = insGetExtendedRowSize(pDataBlock); + CHECK_CODE( + insInitRowBuilder(&pDataBlock->rowBuilder, pDataBlock->pTableMeta->sversion, &pDataBlock->boundColumnInfo)); (*numOfRows) = 0; // char tmpTokenBuf[TSDB_MAX_BYTES_PER_ROW] = {0}; // used for deleting Escape character: \\, \', \" @@ -1320,13 +1064,13 @@ static int32_t parseValues(SInsertParseContext* pCxt, STableDataBlocks* pDataBlo static int32_t parseValuesClause(SInsertParseContext* pCxt, STableDataBlocks* dataBuf) { int32_t maxNumOfRows; - CHECK_CODE(allocateMemIfNeed(dataBuf, getExtendedRowSize(dataBuf), &maxNumOfRows)); + CHECK_CODE(allocateMemIfNeed(dataBuf, insGetExtendedRowSize(dataBuf), &maxNumOfRows)); int32_t numOfRows = 0; CHECK_CODE(parseValues(pCxt, dataBuf, maxNumOfRows, &numOfRows)); SSubmitBlk* pBlocks = (SSubmitBlk*)(dataBuf->pData); - if (TSDB_CODE_SUCCESS != setBlockInfo(pBlocks, dataBuf, numOfRows)) { + if (TSDB_CODE_SUCCESS != insSetBlockInfo(pBlocks, dataBuf, numOfRows)) { return buildInvalidOperationMsg(&pCxt->msg, "too many rows in sql, total number of rows should be less than INT32_MAX"); } @@ -1339,8 +1083,9 @@ static int32_t parseValuesClause(SInsertParseContext* pCxt, STableDataBlocks* da static int32_t parseCsvFile(SInsertParseContext* pCxt, TdFilePtr fp, STableDataBlocks* pDataBlock, int maxRows, int32_t* numOfRows) { STableComInfo tinfo = getTableInfo(pDataBlock->pTableMeta); - int32_t extendedRowSize = getExtendedRowSize(pDataBlock); - CHECK_CODE(initRowBuilder(&pDataBlock->rowBuilder, pDataBlock->pTableMeta->sversion, &pDataBlock->boundColumnInfo)); + int32_t extendedRowSize = insGetExtendedRowSize(pDataBlock); + CHECK_CODE( + insInitRowBuilder(&pDataBlock->rowBuilder, pDataBlock->pTableMeta->sversion, &pDataBlock->boundColumnInfo)); (*numOfRows) = 0; char tmpTokenBuf[TSDB_MAX_BYTES_PER_ROW] = {0}; // used for deleting Escape character: \\, \', \" @@ -1391,13 +1136,13 @@ static int32_t parseCsvFile(SInsertParseContext* pCxt, TdFilePtr fp, STableDataB static int32_t parseDataFromFileAgain(SInsertParseContext* pCxt, int16_t tableNo, const SName* pTableName, STableDataBlocks* dataBuf) { int32_t maxNumOfRows; - CHECK_CODE(allocateMemIfNeed(dataBuf, getExtendedRowSize(dataBuf), &maxNumOfRows)); + CHECK_CODE(allocateMemIfNeed(dataBuf, insGetExtendedRowSize(dataBuf), &maxNumOfRows)); int32_t numOfRows = 0; CHECK_CODE(parseCsvFile(pCxt, pCxt->pComCxt->csvCxt.fp, dataBuf, maxNumOfRows, &numOfRows)); SSubmitBlk* pBlocks = (SSubmitBlk*)(dataBuf->pData); - if (TSDB_CODE_SUCCESS != setBlockInfo(pBlocks, dataBuf, numOfRows)) { + if (TSDB_CODE_SUCCESS != insSetBlockInfo(pBlocks, dataBuf, numOfRows)) { return buildInvalidOperationMsg(&pCxt->msg, "too many rows in sql, total number of rows should be less than INT32_MAX"); } @@ -1448,13 +1193,13 @@ static void destroyInsertParseContext(SInsertParseContext* pCxt) { taosHashCleanup(pCxt->pTableNameHashObj); taosHashCleanup(pCxt->pDbFNameHashObj); - destroyBlockHashmap(pCxt->pTableBlockHashObj); - destroyBlockArrayList(pCxt->pVgDataBlocks); + insDestroyBlockHashmap(pCxt->pTableBlockHashObj); + insDestroyBlockArrayList(pCxt->pVgDataBlocks); } static int32_t parseTableName(SInsertParseContext* pCxt, SToken* pTbnameToken, SName* pName, char* pDbFName, char* pTbFName) { - int32_t code = createSName(pName, pTbnameToken, pCxt->pComCxt->acctId, pCxt->pComCxt->db, &pCxt->msg); + int32_t code = insCreateSName(pName, pTbnameToken, pCxt->pComCxt->acctId, pCxt->pComCxt->db, &pCxt->msg); if (TSDB_CODE_SUCCESS == code) { tNameExtractFullName(pName, pTbFName); code = taosHashPut(pCxt->pTableNameHashObj, pTbFName, strlen(pTbFName), pName, sizeof(SName)); @@ -1556,14 +1301,14 @@ static int32_t parseInsertBody(SInsertParseContext* pCxt) { STableDataBlocks* dataBuf = NULL; if (pCxt->pComCxt->async) { - CHECK_CODE(getDataBlockFromList(pCxt->pTableBlockHashObj, &pCxt->pTableMeta->uid, sizeof(pCxt->pTableMeta->uid), - TSDB_DEFAULT_PAYLOAD_SIZE, sizeof(SSubmitBlk), - getTableInfo(pCxt->pTableMeta).rowSize, pCxt->pTableMeta, &dataBuf, NULL, - &pCxt->createTblReq)); + CHECK_CODE(insGetDataBlockFromList(pCxt->pTableBlockHashObj, &pCxt->pTableMeta->uid, + sizeof(pCxt->pTableMeta->uid), TSDB_DEFAULT_PAYLOAD_SIZE, sizeof(SSubmitBlk), + getTableInfo(pCxt->pTableMeta).rowSize, pCxt->pTableMeta, &dataBuf, NULL, + &pCxt->createTblReq)); } else { - CHECK_CODE(getDataBlockFromList(pCxt->pTableBlockHashObj, tbFName, strlen(tbFName), TSDB_DEFAULT_PAYLOAD_SIZE, - sizeof(SSubmitBlk), getTableInfo(pCxt->pTableMeta).rowSize, pCxt->pTableMeta, - &dataBuf, NULL, &pCxt->createTblReq)); + CHECK_CODE(insGetDataBlockFromList(pCxt->pTableBlockHashObj, tbFName, strlen(tbFName), TSDB_DEFAULT_PAYLOAD_SIZE, + sizeof(SSubmitBlk), getTableInfo(pCxt->pTableMeta).rowSize, pCxt->pTableMeta, + &dataBuf, NULL, &pCxt->createTblReq)); } if (NULL != pBoundColsStart) { @@ -1624,17 +1369,18 @@ static int32_t parseInsertBody(SInsertParseContext* pCxt) { // merge according to vgId if (taosHashGetSize(pCxt->pTableBlockHashObj) > 0) { - CHECK_CODE(mergeTableDataBlocks(pCxt->pTableBlockHashObj, pCxt->pOutput->payloadType, &pCxt->pVgDataBlocks)); + CHECK_CODE(insMergeTableDataBlocks(pCxt->pTableBlockHashObj, &pCxt->pVgDataBlocks)); } - return buildOutput(pCxt); + return insBuildOutput(pCxt); } static int32_t parseInsertBodyAgain(SInsertParseContext* pCxt) { STableDataBlocks* dataBuf = NULL; CHECK_CODE(getTableMeta(pCxt, pCxt->pComCxt->csvCxt.tableNo, &pCxt->pComCxt->csvCxt.tableName)); - CHECK_CODE(getDataBlockFromList(pCxt->pTableBlockHashObj, &pCxt->pTableMeta->uid, sizeof(pCxt->pTableMeta->uid), - TSDB_DEFAULT_PAYLOAD_SIZE, sizeof(SSubmitBlk), getTableInfo(pCxt->pTableMeta).rowSize, - pCxt->pTableMeta, &dataBuf, NULL, &pCxt->createTblReq)); + CHECK_CODE(insGetDataBlockFromList(pCxt->pTableBlockHashObj, &pCxt->pTableMeta->uid, sizeof(pCxt->pTableMeta->uid), + TSDB_DEFAULT_PAYLOAD_SIZE, sizeof(SSubmitBlk), + getTableInfo(pCxt->pTableMeta).rowSize, pCxt->pTableMeta, &dataBuf, NULL, + &pCxt->createTblReq)); CHECK_CODE(parseDataFromFileAgain(pCxt, pCxt->pComCxt->csvCxt.tableNo, &pCxt->pComCxt->csvCxt.tableName, dataBuf)); if (taosEOFFile(pCxt->pComCxt->csvCxt.fp)) { CHECK_CODE(parseInsertBody(pCxt)); @@ -1644,9 +1390,9 @@ static int32_t parseInsertBodyAgain(SInsertParseContext* pCxt) { parserDebug("0x%" PRIx64 " insert again input rows: %d", pCxt->pComCxt->requestId, pCxt->totalNum); // merge according to vgId if (taosHashGetSize(pCxt->pTableBlockHashObj) > 0) { - CHECK_CODE(mergeTableDataBlocks(pCxt->pTableBlockHashObj, pCxt->pOutput->payloadType, &pCxt->pVgDataBlocks)); + CHECK_CODE(insMergeTableDataBlocks(pCxt->pTableBlockHashObj, &pCxt->pVgDataBlocks)); } - return buildOutput(pCxt); + return insBuildOutput(pCxt); } // INSERT INTO @@ -1726,8 +1472,6 @@ int32_t parseInsertSql(SParseContext* pContext, SQuery** pQuery, SParseMetaCache } } - context.pOutput->payloadType = PAYLOAD_TYPE_KV; - int32_t code = TSDB_CODE_SUCCESS; if (!context.pComCxt->needMultiParse) { code = skipInsertInto(&context.pSql, &context.msg); @@ -1822,7 +1566,7 @@ static int32_t skipUsingClause(SInsertParseSyntaxCxt* pCxt) { static int32_t collectTableMetaKey(SInsertParseSyntaxCxt* pCxt, bool isStable, int32_t tableNo, SToken* pTbToken) { SName name = {0}; - CHECK_CODE(createSName(&name, pTbToken, pCxt->pComCxt->acctId, pCxt->pComCxt->db, &pCxt->msg)); + CHECK_CODE(insCreateSName(&name, pTbToken, pCxt->pComCxt->acctId, pCxt->pComCxt->db, &pCxt->msg)); CHECK_CODE(reserveTableMetaInCacheForInsert(&name, isStable ? CATALOG_REQ_TYPE_META : CATALOG_REQ_TYPE_BOTH, tableNo, pCxt->pMetaCache)); return TSDB_CODE_SUCCESS; @@ -1837,7 +1581,7 @@ static int32_t checkTableName(const char* pTableName, SMsgBuf* pMsgBuf) { static int32_t collectAutoCreateTableMetaKey(SInsertParseSyntaxCxt* pCxt, int32_t tableNo, SToken* pTbToken) { SName name = {0}; - CHECK_CODE(createSName(&name, pTbToken, pCxt->pComCxt->acctId, pCxt->pComCxt->db, &pCxt->msg)); + CHECK_CODE(insCreateSName(&name, pTbToken, pCxt->pComCxt->acctId, pCxt->pComCxt->db, &pCxt->msg)); CHECK_CODE(checkTableName(name.tname, &pCxt->msg)); CHECK_CODE(reserveTableMetaInCacheForInsert(&name, CATALOG_REQ_TYPE_VGROUP, tableNo, pCxt->pMetaCache)); return TSDB_CODE_SUCCESS; @@ -1941,704 +1685,3 @@ int32_t parseInsertSyntax(SParseContext* pContext, SQuery** pQuery, SParseMetaCa } return code; } - -int32_t qCreateSName(SName* pName, const char* pTableName, int32_t acctId, char* dbName, char* msgBuf, - int32_t msgBufLen) { - SMsgBuf msg = {.buf = msgBuf, .len = msgBufLen}; - SToken sToken; - int32_t code = 0; - char* tbName = NULL; - - NEXT_TOKEN(pTableName, sToken); - - if (sToken.n == 0) { - return buildInvalidOperationMsg(&msg, "empty table name"); - } - - code = createSName(pName, &sToken, acctId, dbName, &msg); - if (code) { - return code; - } - - NEXT_TOKEN(pTableName, sToken); - - if (sToken.n > 0) { - return buildInvalidOperationMsg(&msg, "table name format is wrong"); - } - - return TSDB_CODE_SUCCESS; -} - -int32_t qBuildStmtOutput(SQuery* pQuery, SHashObj* pVgHash, SHashObj* pBlockHash) { - SVnodeModifOpStmt* modifyNode = (SVnodeModifOpStmt*)pQuery->pRoot; - int32_t code = 0; - SInsertParseContext insertCtx = { - .pVgroupsHashObj = pVgHash, - .pTableBlockHashObj = pBlockHash, - .pOutput = (SVnodeModifOpStmt*)pQuery->pRoot, - }; - - // merge according to vgId - if (taosHashGetSize(insertCtx.pTableBlockHashObj) > 0) { - CHECK_CODE(mergeTableDataBlocks(insertCtx.pTableBlockHashObj, modifyNode->payloadType, &insertCtx.pVgDataBlocks)); - } - - CHECK_CODE(buildOutput(&insertCtx)); - - destroyBlockArrayList(insertCtx.pVgDataBlocks); - return TSDB_CODE_SUCCESS; -} - -int32_t qBindStmtTagsValue(void* pBlock, void* boundTags, int64_t suid, const char* sTableName, char* tName, - TAOS_MULTI_BIND* bind, char* msgBuf, int32_t msgBufLen) { - STableDataBlocks* pDataBlock = (STableDataBlocks*)pBlock; - SMsgBuf pBuf = {.buf = msgBuf, .len = msgBufLen}; - SParsedDataColInfo* tags = (SParsedDataColInfo*)boundTags; - if (NULL == tags) { - return TSDB_CODE_QRY_APP_ERROR; - } - - SArray* pTagArray = taosArrayInit(tags->numOfBound, sizeof(STagVal)); - if (!pTagArray) { - return buildInvalidOperationMsg(&pBuf, "out of memory"); - } - - SArray* tagName = taosArrayInit(8, TSDB_COL_NAME_LEN); - if (!tagName) { - return buildInvalidOperationMsg(&pBuf, "out of memory"); - } - - int32_t code = TSDB_CODE_SUCCESS; - SSchema* pSchema = getTableTagSchema(pDataBlock->pTableMeta); - - bool isJson = false; - STag* pTag = NULL; - - for (int c = 0; c < tags->numOfBound; ++c) { - if (bind[c].is_null && bind[c].is_null[0]) { - continue; - } - - SSchema* pTagSchema = &pSchema[tags->boundColumns[c]]; - int32_t colLen = pTagSchema->bytes; - if (IS_VAR_DATA_TYPE(pTagSchema->type)) { - colLen = bind[c].length[0]; - } - taosArrayPush(tagName, pTagSchema->name); - if (pTagSchema->type == TSDB_DATA_TYPE_JSON) { - if (colLen > (TSDB_MAX_JSON_TAG_LEN - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE) { - code = buildSyntaxErrMsg(&pBuf, "json string too long than 4095", bind[c].buffer); - goto end; - } - - isJson = true; - char* tmp = taosMemoryCalloc(1, colLen + 1); - memcpy(tmp, bind[c].buffer, colLen); - code = parseJsontoTagData(tmp, pTagArray, &pTag, &pBuf); - taosMemoryFree(tmp); - if (code != TSDB_CODE_SUCCESS) { - goto end; - } - } else { - STagVal val = {.cid = pTagSchema->colId, .type = pTagSchema->type}; - // strcpy(val.colName, pTagSchema->name); - if (pTagSchema->type == TSDB_DATA_TYPE_BINARY) { - val.pData = (uint8_t*)bind[c].buffer; - val.nData = colLen; - } else if (pTagSchema->type == TSDB_DATA_TYPE_NCHAR) { - int32_t output = 0; - void* p = taosMemoryCalloc(1, colLen * TSDB_NCHAR_SIZE); - if (p == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; - goto end; - } - if (!taosMbsToUcs4(bind[c].buffer, colLen, (TdUcs4*)(p), colLen * TSDB_NCHAR_SIZE, &output)) { - if (errno == E2BIG) { - taosMemoryFree(p); - code = generateSyntaxErrMsg(&pBuf, TSDB_CODE_PAR_VALUE_TOO_LONG, pTagSchema->name); - goto end; - } - char buf[512] = {0}; - snprintf(buf, tListLen(buf), " taosMbsToUcs4 error:%s", strerror(errno)); - taosMemoryFree(p); - code = buildSyntaxErrMsg(&pBuf, buf, bind[c].buffer); - goto end; - } - val.pData = p; - val.nData = output; - } else { - memcpy(&val.i64, bind[c].buffer, colLen); - } - taosArrayPush(pTagArray, &val); - } - } - - if (!isJson && (code = tTagNew(pTagArray, 1, false, &pTag)) != TSDB_CODE_SUCCESS) { - goto end; - } - - SVCreateTbReq tbReq = {0}; - buildCreateTbReq(&tbReq, tName, pTag, suid, sTableName, tagName, pDataBlock->pTableMeta->tableInfo.numOfTags); - code = buildCreateTbMsg(pDataBlock, &tbReq); - tdDestroySVCreateTbReq(&tbReq); - -end: - for (int i = 0; i < taosArrayGetSize(pTagArray); ++i) { - STagVal* p = (STagVal*)taosArrayGet(pTagArray, i); - if (p->type == TSDB_DATA_TYPE_NCHAR) { - taosMemoryFreeClear(p->pData); - } - } - taosArrayDestroy(pTagArray); - taosArrayDestroy(tagName); - - return code; -} - -int32_t qBindStmtColsValue(void* pBlock, TAOS_MULTI_BIND* bind, char* msgBuf, int32_t msgBufLen) { - STableDataBlocks* pDataBlock = (STableDataBlocks*)pBlock; - SSchema* pSchema = getTableColumnSchema(pDataBlock->pTableMeta); - int32_t extendedRowSize = getExtendedRowSize(pDataBlock); - SParsedDataColInfo* spd = &pDataBlock->boundColumnInfo; - SRowBuilder* pBuilder = &pDataBlock->rowBuilder; - SMemParam param = {.rb = pBuilder}; - SMsgBuf pBuf = {.buf = msgBuf, .len = msgBufLen}; - int32_t rowNum = bind->num; - - CHECK_CODE(initRowBuilder(&pDataBlock->rowBuilder, pDataBlock->pTableMeta->sversion, &pDataBlock->boundColumnInfo)); - - CHECK_CODE(allocateMemForSize(pDataBlock, extendedRowSize * bind->num)); - - for (int32_t r = 0; r < bind->num; ++r) { - STSRow* row = (STSRow*)(pDataBlock->pData + pDataBlock->size); // skip the SSubmitBlk header - tdSRowResetBuf(pBuilder, row); - - for (int c = 0; c < spd->numOfBound; ++c) { - SSchema* pColSchema = &pSchema[spd->boundColumns[c]]; - - if (bind[c].num != rowNum) { - return buildInvalidOperationMsg(&pBuf, "row number in each bind param should be the same"); - } - - param.schema = pColSchema; - getSTSRowAppendInfo(pBuilder->rowType, spd, c, ¶m.toffset, ¶m.colIdx); - - if (bind[c].is_null && bind[c].is_null[r]) { - if (pColSchema->colId == PRIMARYKEY_TIMESTAMP_COL_ID) { - return buildInvalidOperationMsg(&pBuf, "primary timestamp should not be NULL"); - } - - CHECK_CODE(MemRowAppend(&pBuf, NULL, 0, ¶m)); - } else { - if (bind[c].buffer_type != pColSchema->type) { - return buildInvalidOperationMsg(&pBuf, "column type mis-match with buffer type"); - } - - int32_t colLen = pColSchema->bytes; - if (IS_VAR_DATA_TYPE(pColSchema->type)) { - colLen = bind[c].length[r]; - } - - CHECK_CODE(MemRowAppend(&pBuf, (char*)bind[c].buffer + bind[c].buffer_length * r, colLen, ¶m)); - } - - if (PRIMARYKEY_TIMESTAMP_COL_ID == pColSchema->colId) { - TSKEY tsKey = TD_ROW_KEY(row); - checkTimestamp(pDataBlock, (const char*)&tsKey); - } - } - // set the null value for the columns that do not assign values - if ((spd->numOfBound < spd->numOfCols) && TD_IS_TP_ROW(row)) { - pBuilder->hasNone = true; - } - tdSRowEnd(pBuilder); -#ifdef TD_DEBUG_PRINT_ROW - STSchema* pSTSchema = tdGetSTSChemaFromSSChema(pSchema, spd->numOfCols, 1); - tdSRowPrint(row, pSTSchema, __func__); - taosMemoryFree(pSTSchema); -#endif - pDataBlock->size += extendedRowSize; - } - - SSubmitBlk* pBlocks = (SSubmitBlk*)(pDataBlock->pData); - if (TSDB_CODE_SUCCESS != setBlockInfo(pBlocks, pDataBlock, bind->num)) { - return buildInvalidOperationMsg(&pBuf, "too many rows in sql, total number of rows should be less than INT32_MAX"); - } - - return TSDB_CODE_SUCCESS; -} - -int32_t qBindStmtSingleColValue(void* pBlock, TAOS_MULTI_BIND* bind, char* msgBuf, int32_t msgBufLen, int32_t colIdx, - int32_t rowNum) { - STableDataBlocks* pDataBlock = (STableDataBlocks*)pBlock; - SSchema* pSchema = getTableColumnSchema(pDataBlock->pTableMeta); - int32_t extendedRowSize = getExtendedRowSize(pDataBlock); - SParsedDataColInfo* spd = &pDataBlock->boundColumnInfo; - SRowBuilder* pBuilder = &pDataBlock->rowBuilder; - SMemParam param = {.rb = pBuilder}; - SMsgBuf pBuf = {.buf = msgBuf, .len = msgBufLen}; - bool rowStart = (0 == colIdx); - bool rowEnd = ((colIdx + 1) == spd->numOfBound); - - if (rowStart) { - CHECK_CODE(initRowBuilder(&pDataBlock->rowBuilder, pDataBlock->pTableMeta->sversion, &pDataBlock->boundColumnInfo)); - CHECK_CODE(allocateMemForSize(pDataBlock, extendedRowSize * bind->num)); - } - - for (int32_t r = 0; r < bind->num; ++r) { - STSRow* row = (STSRow*)(pDataBlock->pData + pDataBlock->size + extendedRowSize * r); // skip the SSubmitBlk header - if (rowStart) { - tdSRowResetBuf(pBuilder, row); - } else { - tdSRowGetBuf(pBuilder, row); - } - - SSchema* pColSchema = &pSchema[spd->boundColumns[colIdx]]; - - if (bind->num != rowNum) { - return buildInvalidOperationMsg(&pBuf, "row number in each bind param should be the same"); - } - - param.schema = pColSchema; - getSTSRowAppendInfo(pBuilder->rowType, spd, colIdx, ¶m.toffset, ¶m.colIdx); - - if (bind->is_null && bind->is_null[r]) { - if (pColSchema->colId == PRIMARYKEY_TIMESTAMP_COL_ID) { - return buildInvalidOperationMsg(&pBuf, "primary timestamp should not be NULL"); - } - - CHECK_CODE(MemRowAppend(&pBuf, NULL, 0, ¶m)); - } else { - if (bind->buffer_type != pColSchema->type) { - return buildInvalidOperationMsg(&pBuf, "column type mis-match with buffer type"); - } - - int32_t colLen = pColSchema->bytes; - if (IS_VAR_DATA_TYPE(pColSchema->type)) { - colLen = bind->length[r]; - } - - CHECK_CODE(MemRowAppend(&pBuf, (char*)bind->buffer + bind->buffer_length * r, colLen, ¶m)); - } - - if (PRIMARYKEY_TIMESTAMP_COL_ID == pColSchema->colId) { - TSKEY tsKey = TD_ROW_KEY(row); - checkTimestamp(pDataBlock, (const char*)&tsKey); - } - - // set the null value for the columns that do not assign values - if (rowEnd && (spd->numOfBound < spd->numOfCols) && TD_IS_TP_ROW(row)) { - pBuilder->hasNone = true; - } - if (rowEnd) { - tdSRowEnd(pBuilder); - } -#ifdef TD_DEBUG_PRINT_ROW - if (rowEnd) { - STSchema* pSTSchema = tdGetSTSChemaFromSSChema(pSchema, spd->numOfCols, 1); - tdSRowPrint(row, pSTSchema, __func__); - taosMemoryFree(pSTSchema); - } -#endif - } - - if (rowEnd) { - pDataBlock->size += extendedRowSize * bind->num; - - SSubmitBlk* pBlocks = (SSubmitBlk*)(pDataBlock->pData); - if (TSDB_CODE_SUCCESS != setBlockInfo(pBlocks, pDataBlock, bind->num)) { - return buildInvalidOperationMsg(&pBuf, - "too many rows in sql, total number of rows should be less than INT32_MAX"); - } - } - - return TSDB_CODE_SUCCESS; -} - -int32_t buildBoundFields(SParsedDataColInfo* boundInfo, SSchema* pSchema, int32_t* fieldNum, TAOS_FIELD_E** fields, - uint8_t timePrec) { - if (fields) { - *fields = taosMemoryCalloc(boundInfo->numOfBound, sizeof(TAOS_FIELD)); - if (NULL == *fields) { - return TSDB_CODE_OUT_OF_MEMORY; - } - - SSchema* schema = &pSchema[boundInfo->boundColumns[0]]; - if (TSDB_DATA_TYPE_TIMESTAMP == schema->type) { - (*fields)[0].precision = timePrec; - } - - for (int32_t i = 0; i < boundInfo->numOfBound; ++i) { - schema = &pSchema[boundInfo->boundColumns[i]]; - strcpy((*fields)[i].name, schema->name); - (*fields)[i].type = schema->type; - (*fields)[i].bytes = schema->bytes; - } - } - - *fieldNum = boundInfo->numOfBound; - - return TSDB_CODE_SUCCESS; -} - -int32_t qBuildStmtTagFields(void* pBlock, void* boundTags, int32_t* fieldNum, TAOS_FIELD_E** fields) { - STableDataBlocks* pDataBlock = (STableDataBlocks*)pBlock; - SParsedDataColInfo* tags = (SParsedDataColInfo*)boundTags; - if (NULL == tags) { - return TSDB_CODE_QRY_APP_ERROR; - } - - if (pDataBlock->pTableMeta->tableType != TSDB_SUPER_TABLE && pDataBlock->pTableMeta->tableType != TSDB_CHILD_TABLE) { - return TSDB_CODE_TSC_STMT_API_ERROR; - } - - SSchema* pSchema = getTableTagSchema(pDataBlock->pTableMeta); - if (tags->numOfBound <= 0) { - *fieldNum = 0; - *fields = NULL; - - return TSDB_CODE_SUCCESS; - } - - CHECK_CODE(buildBoundFields(tags, pSchema, fieldNum, fields, 0)); - - return TSDB_CODE_SUCCESS; -} - -int32_t qBuildStmtColFields(void* pBlock, int32_t* fieldNum, TAOS_FIELD_E** fields) { - STableDataBlocks* pDataBlock = (STableDataBlocks*)pBlock; - SSchema* pSchema = getTableColumnSchema(pDataBlock->pTableMeta); - if (pDataBlock->boundColumnInfo.numOfBound <= 0) { - *fieldNum = 0; - if (fields) { - *fields = NULL; - } - - return TSDB_CODE_SUCCESS; - } - - CHECK_CODE(buildBoundFields(&pDataBlock->boundColumnInfo, pSchema, fieldNum, fields, - pDataBlock->pTableMeta->tableInfo.precision)); - - return TSDB_CODE_SUCCESS; -} - -// schemaless logic start - -typedef struct SmlExecTableHandle { - SParsedDataColInfo tags; // each table - SVCreateTbReq createTblReq; // each table -} SmlExecTableHandle; - -typedef struct SmlExecHandle { - SHashObj* pBlockHash; - SmlExecTableHandle tableExecHandle; - SQuery* pQuery; -} SSmlExecHandle; - -static void smlDestroyTableHandle(void* pHandle) { - SmlExecTableHandle* handle = (SmlExecTableHandle*)pHandle; - destroyBoundColumnInfo(&handle->tags); - tdDestroySVCreateTbReq(&handle->createTblReq); -} - -static int32_t smlBoundColumnData(SArray* cols, SParsedDataColInfo* pColList, SSchema* pSchema, bool isTag) { - col_id_t nCols = pColList->numOfCols; - - pColList->numOfBound = 0; - pColList->boundNullLen = 0; - memset(pColList->boundColumns, 0, sizeof(col_id_t) * nCols); - for (col_id_t i = 0; i < nCols; ++i) { - pColList->cols[i].valStat = VAL_STAT_NONE; - } - - bool isOrdered = true; - col_id_t lastColIdx = -1; // last column found - for (int i = 0; i < taosArrayGetSize(cols); ++i) { - SSmlKv* kv = taosArrayGetP(cols, i); - SToken sToken = {.n = kv->keyLen, .z = (char*)kv->key}; - col_id_t t = lastColIdx + 1; - col_id_t index = ((t == 0 && !isTag) ? 0 : findCol(&sToken, t, nCols, pSchema)); - uDebug("SML, index:%d, t:%d, ncols:%d", index, t, nCols); - if (index < 0 && t > 0) { - index = findCol(&sToken, 0, t, pSchema); - isOrdered = false; - } - if (index < 0) { - uError("smlBoundColumnData. index:%d", index); - return TSDB_CODE_SML_INVALID_DATA; - } - if (pColList->cols[index].valStat == VAL_STAT_HAS) { - uError("smlBoundColumnData. already set. index:%d", index); - return TSDB_CODE_SML_INVALID_DATA; - } - lastColIdx = index; - pColList->cols[index].valStat = VAL_STAT_HAS; - pColList->boundColumns[pColList->numOfBound] = index; - ++pColList->numOfBound; - switch (pSchema[t].type) { - case TSDB_DATA_TYPE_BINARY: - pColList->boundNullLen += (sizeof(VarDataOffsetT) + VARSTR_HEADER_SIZE + CHAR_BYTES); - break; - case TSDB_DATA_TYPE_NCHAR: - pColList->boundNullLen += (sizeof(VarDataOffsetT) + VARSTR_HEADER_SIZE + TSDB_NCHAR_SIZE); - break; - default: - pColList->boundNullLen += TYPE_BYTES[pSchema[t].type]; - break; - } - } - - pColList->orderStatus = isOrdered ? ORDER_STATUS_ORDERED : ORDER_STATUS_DISORDERED; - - if (!isOrdered) { - pColList->colIdxInfo = taosMemoryCalloc(pColList->numOfBound, sizeof(SBoundIdxInfo)); - if (NULL == pColList->colIdxInfo) { - return TSDB_CODE_TSC_OUT_OF_MEMORY; - } - SBoundIdxInfo* pColIdx = pColList->colIdxInfo; - for (col_id_t i = 0; i < pColList->numOfBound; ++i) { - pColIdx[i].schemaColIdx = pColList->boundColumns[i]; - pColIdx[i].boundIdx = i; - } - taosSort(pColIdx, pColList->numOfBound, sizeof(SBoundIdxInfo), schemaIdxCompar); - for (col_id_t i = 0; i < pColList->numOfBound; ++i) { - pColIdx[i].finalIdx = i; - } - taosSort(pColIdx, pColList->numOfBound, sizeof(SBoundIdxInfo), boundIdxCompar); - } - - if (pColList->numOfCols > pColList->numOfBound) { - memset(&pColList->boundColumns[pColList->numOfBound], 0, - sizeof(col_id_t) * (pColList->numOfCols - pColList->numOfBound)); - } - - return TSDB_CODE_SUCCESS; -} - -/** - * @brief No json tag for schemaless - * - * @param cols - * @param tags - * @param pSchema - * @param ppTag - * @param msg - * @return int32_t - */ -static int32_t smlBuildTagRow(SArray* cols, SParsedDataColInfo* tags, SSchema* pSchema, STag** ppTag, SArray** tagName, - SMsgBuf* msg) { - SArray* pTagArray = taosArrayInit(tags->numOfBound, sizeof(STagVal)); - if (!pTagArray) { - return TSDB_CODE_TSC_OUT_OF_MEMORY; - } - *tagName = taosArrayInit(8, TSDB_COL_NAME_LEN); - if (!*tagName) { - return TSDB_CODE_TSC_OUT_OF_MEMORY; - } - - int32_t code = TSDB_CODE_SUCCESS; - for (int i = 0; i < tags->numOfBound; ++i) { - SSchema* pTagSchema = &pSchema[tags->boundColumns[i]]; - SSmlKv* kv = taosArrayGetP(cols, i); - - taosArrayPush(*tagName, pTagSchema->name); - STagVal val = {.cid = pTagSchema->colId, .type = pTagSchema->type}; - // strcpy(val.colName, pTagSchema->name); - if (pTagSchema->type == TSDB_DATA_TYPE_BINARY) { - val.pData = (uint8_t*)kv->value; - val.nData = kv->length; - } else if (pTagSchema->type == TSDB_DATA_TYPE_NCHAR) { - int32_t output = 0; - void* p = taosMemoryCalloc(1, kv->length * TSDB_NCHAR_SIZE); - if (p == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; - goto end; - } - if (!taosMbsToUcs4(kv->value, kv->length, (TdUcs4*)(p), kv->length * TSDB_NCHAR_SIZE, &output)) { - if (errno == E2BIG) { - taosMemoryFree(p); - code = generateSyntaxErrMsg(msg, TSDB_CODE_PAR_VALUE_TOO_LONG, pTagSchema->name); - goto end; - } - char buf[512] = {0}; - snprintf(buf, tListLen(buf), " taosMbsToUcs4 error:%s", strerror(errno)); - taosMemoryFree(p); - code = buildSyntaxErrMsg(msg, buf, kv->value); - goto end; - } - val.pData = p; - val.nData = output; - } else { - memcpy(&val.i64, &(kv->value), kv->length); - } - taosArrayPush(pTagArray, &val); - } - - code = tTagNew(pTagArray, 1, false, ppTag); -end: - for (int i = 0; i < taosArrayGetSize(pTagArray); ++i) { - STagVal* p = (STagVal*)taosArrayGet(pTagArray, i); - if (p->type == TSDB_DATA_TYPE_NCHAR) { - taosMemoryFree(p->pData); - } - } - taosArrayDestroy(pTagArray); - return code; -} - -int32_t smlBindData(void* handle, SArray* tags, SArray* colsSchema, SArray* cols, bool format, STableMeta* pTableMeta, - char* tableName, const char* sTableName, int32_t sTableNameLen, char* msgBuf, int16_t msgBufLen) { - SMsgBuf pBuf = {.buf = msgBuf, .len = msgBufLen}; - - SSmlExecHandle* smlHandle = (SSmlExecHandle*)handle; - smlDestroyTableHandle(&smlHandle->tableExecHandle); // free for each table - SSchema* pTagsSchema = getTableTagSchema(pTableMeta); - setBoundColumnInfo(&smlHandle->tableExecHandle.tags, pTagsSchema, getNumOfTags(pTableMeta)); - int ret = smlBoundColumnData(tags, &smlHandle->tableExecHandle.tags, pTagsSchema, true); - if (ret != TSDB_CODE_SUCCESS) { - buildInvalidOperationMsg(&pBuf, "bound tags error"); - return ret; - } - STag* pTag = NULL; - SArray* tagName = NULL; - ret = smlBuildTagRow(tags, &smlHandle->tableExecHandle.tags, pTagsSchema, &pTag, &tagName, &pBuf); - if (ret != TSDB_CODE_SUCCESS) { - taosArrayDestroy(tagName); - return ret; - } - - buildCreateTbReq(&smlHandle->tableExecHandle.createTblReq, tableName, pTag, pTableMeta->suid, NULL, tagName, - pTableMeta->tableInfo.numOfTags); - taosArrayDestroy(tagName); - - smlHandle->tableExecHandle.createTblReq.ctb.stbName = taosMemoryMalloc(sTableNameLen + 1); - memcpy(smlHandle->tableExecHandle.createTblReq.ctb.stbName, sTableName, sTableNameLen); - smlHandle->tableExecHandle.createTblReq.ctb.stbName[sTableNameLen] = 0; - - STableDataBlocks* pDataBlock = NULL; - ret = getDataBlockFromList(smlHandle->pBlockHash, &pTableMeta->uid, sizeof(pTableMeta->uid), - TSDB_DEFAULT_PAYLOAD_SIZE, sizeof(SSubmitBlk), getTableInfo(pTableMeta).rowSize, - pTableMeta, &pDataBlock, NULL, &smlHandle->tableExecHandle.createTblReq); - if (ret != TSDB_CODE_SUCCESS) { - buildInvalidOperationMsg(&pBuf, "create data block error"); - return ret; - } - - SSchema* pSchema = getTableColumnSchema(pTableMeta); - - ret = smlBoundColumnData(colsSchema, &pDataBlock->boundColumnInfo, pSchema, false); - if (ret != TSDB_CODE_SUCCESS) { - buildInvalidOperationMsg(&pBuf, "bound cols error"); - return ret; - } - int32_t extendedRowSize = getExtendedRowSize(pDataBlock); - SParsedDataColInfo* spd = &pDataBlock->boundColumnInfo; - SRowBuilder* pBuilder = &pDataBlock->rowBuilder; - SMemParam param = {.rb = pBuilder}; - - initRowBuilder(&pDataBlock->rowBuilder, pDataBlock->pTableMeta->sversion, &pDataBlock->boundColumnInfo); - - int32_t rowNum = taosArrayGetSize(cols); - if (rowNum <= 0) { - return buildInvalidOperationMsg(&pBuf, "cols size <= 0"); - } - ret = allocateMemForSize(pDataBlock, extendedRowSize * rowNum); - if (ret != TSDB_CODE_SUCCESS) { - buildInvalidOperationMsg(&pBuf, "allocate memory error"); - return ret; - } - for (int32_t r = 0; r < rowNum; ++r) { - STSRow* row = (STSRow*)(pDataBlock->pData + pDataBlock->size); // skip the SSubmitBlk header - tdSRowResetBuf(pBuilder, row); - void* rowData = taosArrayGetP(cols, r); - size_t rowDataSize = 0; - if (format) { - rowDataSize = taosArrayGetSize(rowData); - } - - // 1. set the parsed value from sql string - for (int c = 0, j = 0; c < spd->numOfBound; ++c) { - SSchema* pColSchema = &pSchema[spd->boundColumns[c]]; - - param.schema = pColSchema; - getSTSRowAppendInfo(pBuilder->rowType, spd, c, ¶m.toffset, ¶m.colIdx); - - SSmlKv* kv = NULL; - if (format) { - if (j < rowDataSize) { - kv = taosArrayGetP(rowData, j); - if (rowDataSize != spd->numOfBound && j != 0 && - (kv->keyLen != strlen(pColSchema->name) || strncmp(kv->key, pColSchema->name, kv->keyLen) != 0)) { - kv = NULL; - } else { - j++; - } - } - } else { - void** p = taosHashGet(rowData, pColSchema->name, strlen(pColSchema->name)); - if (p) kv = *p; - } - - if (kv) { - int32_t colLen = kv->length; - if (pColSchema->type == TSDB_DATA_TYPE_TIMESTAMP) { - // uError("SML:data before:%" PRId64 ", precision:%d", kv->i, pTableMeta->tableInfo.precision); - kv->i = convertTimePrecision(kv->i, TSDB_TIME_PRECISION_NANO, pTableMeta->tableInfo.precision); - // uError("SML:data after:%" PRId64 ", precision:%d", kv->i, pTableMeta->tableInfo.precision); - } - - if (IS_VAR_DATA_TYPE(kv->type)) { - MemRowAppend(&pBuf, kv->value, colLen, ¶m); - } else { - MemRowAppend(&pBuf, &(kv->value), colLen, ¶m); - } - } else { - pBuilder->hasNone = true; - } - - if (PRIMARYKEY_TIMESTAMP_COL_ID == pColSchema->colId) { - TSKEY tsKey = TD_ROW_KEY(row); - checkTimestamp(pDataBlock, (const char*)&tsKey); - } - } - - // set the null value for the columns that do not assign values - if ((spd->numOfBound < spd->numOfCols) && TD_IS_TP_ROW(row)) { - pBuilder->hasNone = true; - } - - tdSRowEnd(pBuilder); - pDataBlock->size += extendedRowSize; - } - - SSubmitBlk* pBlocks = (SSubmitBlk*)(pDataBlock->pData); - if (TSDB_CODE_SUCCESS != setBlockInfo(pBlocks, pDataBlock, rowNum)) { - return buildInvalidOperationMsg(&pBuf, "too many rows in sql, total number of rows should be less than INT32_MAX"); - } - - return TSDB_CODE_SUCCESS; -} - -void* smlInitHandle(SQuery* pQuery) { - SSmlExecHandle* handle = taosMemoryCalloc(1, sizeof(SSmlExecHandle)); - if (!handle) return NULL; - handle->pBlockHash = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), true, false); - handle->pQuery = pQuery; - - return handle; -} - -void smlDestroyHandle(void* pHandle) { - if (!pHandle) return; - SSmlExecHandle* handle = (SSmlExecHandle*)pHandle; - destroyBlockHashmap(handle->pBlockHash); - smlDestroyTableHandle(&handle->tableExecHandle); - taosMemoryFree(handle); -} - -int32_t smlBuildOutput(void* handle, SHashObj* pVgHash) { - SSmlExecHandle* smlHandle = (SSmlExecHandle*)handle; - return qBuildStmtOutput(smlHandle->pQuery, pVgHash, smlHandle->pBlockHash); -} -// schemaless logic end diff --git a/source/libs/parser/src/parInsertStmt.c b/source/libs/parser/src/parInsertStmt.c new file mode 100644 index 0000000000..f85ceccf6e --- /dev/null +++ b/source/libs/parser/src/parInsertStmt.c @@ -0,0 +1,485 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#include "os.h" +#include "parInsertUtil.h" +#include "parInt.h" +#include "parToken.h" +#include "query.h" +#include "tglobal.h" +#include "ttime.h" +#include "ttypes.h" + +typedef struct SKvParam { + int16_t pos; + SArray* pTagVals; + SSchema* schema; + char buf[TSDB_MAX_TAGS_LEN]; +} SKvParam; + +int32_t qBuildStmtOutput(SQuery* pQuery, SHashObj* pVgHash, SHashObj* pBlockHash) { + SVnodeModifOpStmt* modifyNode = (SVnodeModifOpStmt*)pQuery->pRoot; + int32_t code = 0; + SInsertParseContext insertCtx = { + .pVgroupsHashObj = pVgHash, + .pTableBlockHashObj = pBlockHash, + .pOutput = (SVnodeModifOpStmt*)pQuery->pRoot, + }; + + // merge according to vgId + if (taosHashGetSize(insertCtx.pTableBlockHashObj) > 0) { + CHECK_CODE(insMergeTableDataBlocks(insertCtx.pTableBlockHashObj, &insertCtx.pVgDataBlocks)); + } + + CHECK_CODE(insBuildOutput(&insertCtx)); + + insDestroyBlockArrayList(insertCtx.pVgDataBlocks); + return TSDB_CODE_SUCCESS; +} + +int32_t qBindStmtTagsValue(void* pBlock, void* boundTags, int64_t suid, const char* sTableName, char* tName, + TAOS_MULTI_BIND* bind, char* msgBuf, int32_t msgBufLen) { + STableDataBlocks* pDataBlock = (STableDataBlocks*)pBlock; + SMsgBuf pBuf = {.buf = msgBuf, .len = msgBufLen}; + SParsedDataColInfo* tags = (SParsedDataColInfo*)boundTags; + if (NULL == tags) { + return TSDB_CODE_QRY_APP_ERROR; + } + + SArray* pTagArray = taosArrayInit(tags->numOfBound, sizeof(STagVal)); + if (!pTagArray) { + return buildInvalidOperationMsg(&pBuf, "out of memory"); + } + + SArray* tagName = taosArrayInit(8, TSDB_COL_NAME_LEN); + if (!tagName) { + return buildInvalidOperationMsg(&pBuf, "out of memory"); + } + + int32_t code = TSDB_CODE_SUCCESS; + SSchema* pSchema = getTableTagSchema(pDataBlock->pTableMeta); + + bool isJson = false; + STag* pTag = NULL; + + for (int c = 0; c < tags->numOfBound; ++c) { + if (bind[c].is_null && bind[c].is_null[0]) { + continue; + } + + SSchema* pTagSchema = &pSchema[tags->boundColumns[c]]; + int32_t colLen = pTagSchema->bytes; + if (IS_VAR_DATA_TYPE(pTagSchema->type)) { + colLen = bind[c].length[0]; + } + taosArrayPush(tagName, pTagSchema->name); + if (pTagSchema->type == TSDB_DATA_TYPE_JSON) { + if (colLen > (TSDB_MAX_JSON_TAG_LEN - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE) { + code = buildSyntaxErrMsg(&pBuf, "json string too long than 4095", bind[c].buffer); + goto end; + } + + isJson = true; + char* tmp = taosMemoryCalloc(1, colLen + 1); + memcpy(tmp, bind[c].buffer, colLen); + code = parseJsontoTagData(tmp, pTagArray, &pTag, &pBuf); + taosMemoryFree(tmp); + if (code != TSDB_CODE_SUCCESS) { + goto end; + } + } else { + STagVal val = {.cid = pTagSchema->colId, .type = pTagSchema->type}; + // strcpy(val.colName, pTagSchema->name); + if (pTagSchema->type == TSDB_DATA_TYPE_BINARY) { + val.pData = (uint8_t*)bind[c].buffer; + val.nData = colLen; + } else if (pTagSchema->type == TSDB_DATA_TYPE_NCHAR) { + int32_t output = 0; + void* p = taosMemoryCalloc(1, colLen * TSDB_NCHAR_SIZE); + if (p == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + goto end; + } + if (!taosMbsToUcs4(bind[c].buffer, colLen, (TdUcs4*)(p), colLen * TSDB_NCHAR_SIZE, &output)) { + if (errno == E2BIG) { + taosMemoryFree(p); + code = generateSyntaxErrMsg(&pBuf, TSDB_CODE_PAR_VALUE_TOO_LONG, pTagSchema->name); + goto end; + } + char buf[512] = {0}; + snprintf(buf, tListLen(buf), " taosMbsToUcs4 error:%s", strerror(errno)); + taosMemoryFree(p); + code = buildSyntaxErrMsg(&pBuf, buf, bind[c].buffer); + goto end; + } + val.pData = p; + val.nData = output; + } else { + memcpy(&val.i64, bind[c].buffer, colLen); + } + taosArrayPush(pTagArray, &val); + } + } + + if (!isJson && (code = tTagNew(pTagArray, 1, false, &pTag)) != TSDB_CODE_SUCCESS) { + goto end; + } + + SVCreateTbReq tbReq = {0}; + insBuildCreateTbReq(&tbReq, tName, pTag, suid, sTableName, tagName, pDataBlock->pTableMeta->tableInfo.numOfTags); + code = insBuildCreateTbMsg(pDataBlock, &tbReq); + tdDestroySVCreateTbReq(&tbReq); + +end: + for (int i = 0; i < taosArrayGetSize(pTagArray); ++i) { + STagVal* p = (STagVal*)taosArrayGet(pTagArray, i); + if (p->type == TSDB_DATA_TYPE_NCHAR) { + taosMemoryFreeClear(p->pData); + } + } + taosArrayDestroy(pTagArray); + taosArrayDestroy(tagName); + + return code; +} + +int32_t qBindStmtColsValue(void* pBlock, TAOS_MULTI_BIND* bind, char* msgBuf, int32_t msgBufLen) { + STableDataBlocks* pDataBlock = (STableDataBlocks*)pBlock; + SSchema* pSchema = getTableColumnSchema(pDataBlock->pTableMeta); + int32_t extendedRowSize = insGetExtendedRowSize(pDataBlock); + SParsedDataColInfo* spd = &pDataBlock->boundColumnInfo; + SRowBuilder* pBuilder = &pDataBlock->rowBuilder; + SMemParam param = {.rb = pBuilder}; + SMsgBuf pBuf = {.buf = msgBuf, .len = msgBufLen}; + int32_t rowNum = bind->num; + + CHECK_CODE( + insInitRowBuilder(&pDataBlock->rowBuilder, pDataBlock->pTableMeta->sversion, &pDataBlock->boundColumnInfo)); + + CHECK_CODE(insAllocateMemForSize(pDataBlock, extendedRowSize * bind->num)); + + for (int32_t r = 0; r < bind->num; ++r) { + STSRow* row = (STSRow*)(pDataBlock->pData + pDataBlock->size); // skip the SSubmitBlk header + tdSRowResetBuf(pBuilder, row); + + for (int c = 0; c < spd->numOfBound; ++c) { + SSchema* pColSchema = &pSchema[spd->boundColumns[c]]; + + if (bind[c].num != rowNum) { + return buildInvalidOperationMsg(&pBuf, "row number in each bind param should be the same"); + } + + param.schema = pColSchema; + insGetSTSRowAppendInfo(pBuilder->rowType, spd, c, ¶m.toffset, ¶m.colIdx); + + if (bind[c].is_null && bind[c].is_null[r]) { + if (pColSchema->colId == PRIMARYKEY_TIMESTAMP_COL_ID) { + return buildInvalidOperationMsg(&pBuf, "primary timestamp should not be NULL"); + } + + CHECK_CODE(insMemRowAppend(&pBuf, NULL, 0, ¶m)); + } else { + if (bind[c].buffer_type != pColSchema->type) { + return buildInvalidOperationMsg(&pBuf, "column type mis-match with buffer type"); + } + + int32_t colLen = pColSchema->bytes; + if (IS_VAR_DATA_TYPE(pColSchema->type)) { + colLen = bind[c].length[r]; + } + + CHECK_CODE(insMemRowAppend(&pBuf, (char*)bind[c].buffer + bind[c].buffer_length * r, colLen, ¶m)); + } + + if (PRIMARYKEY_TIMESTAMP_COL_ID == pColSchema->colId) { + TSKEY tsKey = TD_ROW_KEY(row); + insCheckTimestamp(pDataBlock, (const char*)&tsKey); + } + } + // set the null value for the columns that do not assign values + if ((spd->numOfBound < spd->numOfCols) && TD_IS_TP_ROW(row)) { + pBuilder->hasNone = true; + } + tdSRowEnd(pBuilder); +#ifdef TD_DEBUG_PRINT_ROW + STSchema* pSTSchema = tdGetSTSChemaFromSSChema(pSchema, spd->numOfCols, 1); + tdSRowPrint(row, pSTSchema, __func__); + taosMemoryFree(pSTSchema); +#endif + pDataBlock->size += extendedRowSize; + } + + SSubmitBlk* pBlocks = (SSubmitBlk*)(pDataBlock->pData); + if (TSDB_CODE_SUCCESS != insSetBlockInfo(pBlocks, pDataBlock, bind->num)) { + return buildInvalidOperationMsg(&pBuf, "too many rows in sql, total number of rows should be less than INT32_MAX"); + } + + return TSDB_CODE_SUCCESS; +} + +int32_t qBindStmtSingleColValue(void* pBlock, TAOS_MULTI_BIND* bind, char* msgBuf, int32_t msgBufLen, int32_t colIdx, + int32_t rowNum) { + STableDataBlocks* pDataBlock = (STableDataBlocks*)pBlock; + SSchema* pSchema = getTableColumnSchema(pDataBlock->pTableMeta); + int32_t extendedRowSize = insGetExtendedRowSize(pDataBlock); + SParsedDataColInfo* spd = &pDataBlock->boundColumnInfo; + SRowBuilder* pBuilder = &pDataBlock->rowBuilder; + SMemParam param = {.rb = pBuilder}; + SMsgBuf pBuf = {.buf = msgBuf, .len = msgBufLen}; + bool rowStart = (0 == colIdx); + bool rowEnd = ((colIdx + 1) == spd->numOfBound); + + if (rowStart) { + CHECK_CODE( + insInitRowBuilder(&pDataBlock->rowBuilder, pDataBlock->pTableMeta->sversion, &pDataBlock->boundColumnInfo)); + CHECK_CODE(insAllocateMemForSize(pDataBlock, extendedRowSize * bind->num)); + } + + for (int32_t r = 0; r < bind->num; ++r) { + STSRow* row = (STSRow*)(pDataBlock->pData + pDataBlock->size + extendedRowSize * r); // skip the SSubmitBlk header + if (rowStart) { + tdSRowResetBuf(pBuilder, row); + } else { + tdSRowGetBuf(pBuilder, row); + } + + SSchema* pColSchema = &pSchema[spd->boundColumns[colIdx]]; + + if (bind->num != rowNum) { + return buildInvalidOperationMsg(&pBuf, "row number in each bind param should be the same"); + } + + param.schema = pColSchema; + insGetSTSRowAppendInfo(pBuilder->rowType, spd, colIdx, ¶m.toffset, ¶m.colIdx); + + if (bind->is_null && bind->is_null[r]) { + if (pColSchema->colId == PRIMARYKEY_TIMESTAMP_COL_ID) { + return buildInvalidOperationMsg(&pBuf, "primary timestamp should not be NULL"); + } + + CHECK_CODE(insMemRowAppend(&pBuf, NULL, 0, ¶m)); + } else { + if (bind->buffer_type != pColSchema->type) { + return buildInvalidOperationMsg(&pBuf, "column type mis-match with buffer type"); + } + + int32_t colLen = pColSchema->bytes; + if (IS_VAR_DATA_TYPE(pColSchema->type)) { + colLen = bind->length[r]; + } + + CHECK_CODE(insMemRowAppend(&pBuf, (char*)bind->buffer + bind->buffer_length * r, colLen, ¶m)); + } + + if (PRIMARYKEY_TIMESTAMP_COL_ID == pColSchema->colId) { + TSKEY tsKey = TD_ROW_KEY(row); + insCheckTimestamp(pDataBlock, (const char*)&tsKey); + } + + // set the null value for the columns that do not assign values + if (rowEnd && (spd->numOfBound < spd->numOfCols) && TD_IS_TP_ROW(row)) { + pBuilder->hasNone = true; + } + if (rowEnd) { + tdSRowEnd(pBuilder); + } +#ifdef TD_DEBUG_PRINT_ROW + if (rowEnd) { + STSchema* pSTSchema = tdGetSTSChemaFromSSChema(pSchema, spd->numOfCols, 1); + tdSRowPrint(row, pSTSchema, __func__); + taosMemoryFree(pSTSchema); + } +#endif + } + + if (rowEnd) { + pDataBlock->size += extendedRowSize * bind->num; + + SSubmitBlk* pBlocks = (SSubmitBlk*)(pDataBlock->pData); + if (TSDB_CODE_SUCCESS != insSetBlockInfo(pBlocks, pDataBlock, bind->num)) { + return buildInvalidOperationMsg(&pBuf, + "too many rows in sql, total number of rows should be less than INT32_MAX"); + } + } + + return TSDB_CODE_SUCCESS; +} + +int32_t buildBoundFields(SParsedDataColInfo* boundInfo, SSchema* pSchema, int32_t* fieldNum, TAOS_FIELD_E** fields, + uint8_t timePrec) { + if (fields) { + *fields = taosMemoryCalloc(boundInfo->numOfBound, sizeof(TAOS_FIELD)); + if (NULL == *fields) { + return TSDB_CODE_OUT_OF_MEMORY; + } + + SSchema* schema = &pSchema[boundInfo->boundColumns[0]]; + if (TSDB_DATA_TYPE_TIMESTAMP == schema->type) { + (*fields)[0].precision = timePrec; + } + + for (int32_t i = 0; i < boundInfo->numOfBound; ++i) { + schema = &pSchema[boundInfo->boundColumns[i]]; + strcpy((*fields)[i].name, schema->name); + (*fields)[i].type = schema->type; + (*fields)[i].bytes = schema->bytes; + } + } + + *fieldNum = boundInfo->numOfBound; + + return TSDB_CODE_SUCCESS; +} + +int32_t qBuildStmtTagFields(void* pBlock, void* boundTags, int32_t* fieldNum, TAOS_FIELD_E** fields) { + STableDataBlocks* pDataBlock = (STableDataBlocks*)pBlock; + SParsedDataColInfo* tags = (SParsedDataColInfo*)boundTags; + if (NULL == tags) { + return TSDB_CODE_QRY_APP_ERROR; + } + + if (pDataBlock->pTableMeta->tableType != TSDB_SUPER_TABLE && pDataBlock->pTableMeta->tableType != TSDB_CHILD_TABLE) { + return TSDB_CODE_TSC_STMT_API_ERROR; + } + + SSchema* pSchema = getTableTagSchema(pDataBlock->pTableMeta); + if (tags->numOfBound <= 0) { + *fieldNum = 0; + *fields = NULL; + + return TSDB_CODE_SUCCESS; + } + + CHECK_CODE(buildBoundFields(tags, pSchema, fieldNum, fields, 0)); + + return TSDB_CODE_SUCCESS; +} + +int32_t qBuildStmtColFields(void* pBlock, int32_t* fieldNum, TAOS_FIELD_E** fields) { + STableDataBlocks* pDataBlock = (STableDataBlocks*)pBlock; + SSchema* pSchema = getTableColumnSchema(pDataBlock->pTableMeta); + if (pDataBlock->boundColumnInfo.numOfBound <= 0) { + *fieldNum = 0; + if (fields) { + *fields = NULL; + } + + return TSDB_CODE_SUCCESS; + } + + CHECK_CODE(buildBoundFields(&pDataBlock->boundColumnInfo, pSchema, fieldNum, fields, + pDataBlock->pTableMeta->tableInfo.precision)); + + return TSDB_CODE_SUCCESS; +} + +int32_t qResetStmtDataBlock(void* block, bool keepBuf) { + STableDataBlocks* pBlock = (STableDataBlocks*)block; + + if (keepBuf) { + taosMemoryFreeClear(pBlock->pData); + pBlock->pData = taosMemoryMalloc(TSDB_PAYLOAD_SIZE); + if (NULL == pBlock->pData) { + return TSDB_CODE_OUT_OF_MEMORY; + } + memset(pBlock->pData, 0, sizeof(SSubmitBlk)); + } else { + pBlock->pData = NULL; + } + + pBlock->ordered = true; + pBlock->prevTS = INT64_MIN; + pBlock->size = sizeof(SSubmitBlk); + pBlock->tsSource = -1; + pBlock->numOfTables = 1; + pBlock->nAllocSize = TSDB_PAYLOAD_SIZE; + pBlock->headerSize = pBlock->size; + pBlock->createTbReqLen = 0; + + memset(&pBlock->rowBuilder, 0, sizeof(pBlock->rowBuilder)); + + return TSDB_CODE_SUCCESS; +} + +int32_t qCloneStmtDataBlock(void** pDst, void* pSrc) { + *pDst = taosMemoryMalloc(sizeof(STableDataBlocks)); + if (NULL == *pDst) { + return TSDB_CODE_OUT_OF_MEMORY; + } + + memcpy(*pDst, pSrc, sizeof(STableDataBlocks)); + ((STableDataBlocks*)(*pDst))->cloned = true; + + STableDataBlocks* pBlock = (STableDataBlocks*)(*pDst); + if (pBlock->pTableMeta) { + void* pNewMeta = taosMemoryMalloc(TABLE_META_SIZE(pBlock->pTableMeta)); + if (NULL == pNewMeta) { + taosMemoryFreeClear(*pDst); + return TSDB_CODE_OUT_OF_MEMORY; + } + memcpy(pNewMeta, pBlock->pTableMeta, TABLE_META_SIZE(pBlock->pTableMeta)); + pBlock->pTableMeta = pNewMeta; + } + + return qResetStmtDataBlock(*pDst, false); +} + +int32_t qRebuildStmtDataBlock(void** pDst, void* pSrc, uint64_t uid, int32_t vgId) { + int32_t code = qCloneStmtDataBlock(pDst, pSrc); + if (code) { + return code; + } + + STableDataBlocks* pBlock = (STableDataBlocks*)*pDst; + pBlock->pData = taosMemoryMalloc(pBlock->nAllocSize); + if (NULL == pBlock->pData) { + qFreeStmtDataBlock(pBlock); + return TSDB_CODE_OUT_OF_MEMORY; + } + + pBlock->vgId = vgId; + + if (pBlock->pTableMeta) { + pBlock->pTableMeta->uid = uid; + pBlock->pTableMeta->vgId = vgId; + } + + memset(pBlock->pData, 0, sizeof(SSubmitBlk)); + + return TSDB_CODE_SUCCESS; +} + +STableMeta* qGetTableMetaInDataBlock(void* pDataBlock) { return ((STableDataBlocks*)pDataBlock)->pTableMeta; } + +void qFreeStmtDataBlock(void* pDataBlock) { + if (pDataBlock == NULL) { + return; + } + + taosMemoryFreeClear(((STableDataBlocks*)pDataBlock)->pTableMeta); + taosMemoryFreeClear(((STableDataBlocks*)pDataBlock)->pData); + taosMemoryFreeClear(pDataBlock); +} + +void qDestroyStmtDataBlock(void* pBlock) { + if (pBlock == NULL) { + return; + } + + STableDataBlocks* pDataBlock = (STableDataBlocks*)pBlock; + + pDataBlock->cloned = false; + insDestroyDataBlock(pDataBlock); +} diff --git a/source/libs/parser/src/parInsertData.c b/source/libs/parser/src/parInsertUtil.c similarity index 65% rename from source/libs/parser/src/parInsertData.c rename to source/libs/parser/src/parInsertUtil.c index 954c1b332a..570a6f9859 100644 --- a/source/libs/parser/src/parInsertData.c +++ b/source/libs/parser/src/parInsertUtil.c @@ -13,7 +13,7 @@ * along with this program. If not, see . */ -#include "parInsertData.h" +#include "parInsertUtil.h" #include "catalog.h" #include "parInt.h" @@ -21,9 +21,6 @@ #include "querynodes.h" #include "tRealloc.h" -#define IS_RAW_PAYLOAD(t) \ - (((int)(t)) == PAYLOAD_TYPE_RAW) // 0: K-V payload for non-prepare insert, 1: rawPayload for prepare insert - typedef struct SBlockKeyTuple { TSKEY skey; void* payloadAddr; @@ -81,7 +78,53 @@ static int32_t rowDataComparStable(const void* lhs, const void* rhs) { } } -void setBoundColumnInfo(SParsedDataColInfo* pColList, SSchema* pSchema, col_id_t numOfCols) { +int32_t insGetExtendedRowSize(STableDataBlocks* pBlock) { + STableComInfo* pTableInfo = &pBlock->pTableMeta->tableInfo; + ASSERT(pBlock->rowSize == pTableInfo->rowSize); + return pBlock->rowSize + TD_ROW_HEAD_LEN - sizeof(TSKEY) + pBlock->boundColumnInfo.extendedVarLen + + (int32_t)TD_BITMAP_BYTES(pTableInfo->numOfColumns - 1); +} + +void insGetSTSRowAppendInfo(uint8_t rowType, SParsedDataColInfo* spd, col_id_t idx, int32_t* toffset, + col_id_t* colIdx) { + col_id_t schemaIdx = 0; + if (IS_DATA_COL_ORDERED(spd)) { + schemaIdx = spd->boundColumns[idx]; + if (TD_IS_TP_ROW_T(rowType)) { + *toffset = (spd->cols + schemaIdx)->toffset; // the offset of firstPart + *colIdx = schemaIdx; + } else { + *toffset = idx * sizeof(SKvRowIdx); // the offset of SKvRowIdx + *colIdx = idx; + } + } else { + ASSERT(idx == (spd->colIdxInfo + idx)->boundIdx); + schemaIdx = (spd->colIdxInfo + idx)->schemaColIdx; + if (TD_IS_TP_ROW_T(rowType)) { + *toffset = (spd->cols + schemaIdx)->toffset; + *colIdx = schemaIdx; + } else { + *toffset = ((spd->colIdxInfo + idx)->finalIdx) * sizeof(SKvRowIdx); + *colIdx = (spd->colIdxInfo + idx)->finalIdx; + } + } +} + +int32_t insSetBlockInfo(SSubmitBlk* pBlocks, STableDataBlocks* dataBuf, int32_t numOfRows) { + pBlocks->suid = (TSDB_NORMAL_TABLE == dataBuf->pTableMeta->tableType ? 0 : dataBuf->pTableMeta->suid); + pBlocks->uid = dataBuf->pTableMeta->uid; + pBlocks->sversion = dataBuf->pTableMeta->sversion; + pBlocks->schemaLen = dataBuf->createTbReqLen; + + if (pBlocks->numOfRows + numOfRows >= INT32_MAX) { + return TSDB_CODE_TSC_INVALID_OPERATION; + } else { + pBlocks->numOfRows += numOfRows; + return TSDB_CODE_SUCCESS; + } +} + +void insSetBoundColumnInfo(SParsedDataColInfo* pColList, SSchema* pSchema, col_id_t numOfCols) { pColList->numOfCols = numOfCols; pColList->numOfBound = numOfCols; pColList->orderStatus = ORDER_STATUS_ORDERED; // default is ORDERED for non-bound mode @@ -118,7 +161,7 @@ void setBoundColumnInfo(SParsedDataColInfo* pColList, SSchema* pSchema, col_id_t pColList->extendedVarLen = (uint16_t)(nVar * sizeof(VarDataOffsetT)); } -int32_t schemaIdxCompar(const void* lhs, const void* rhs) { +int32_t insSchemaIdxCompar(const void* lhs, const void* rhs) { uint16_t left = *(uint16_t*)lhs; uint16_t right = *(uint16_t*)rhs; @@ -129,7 +172,7 @@ int32_t schemaIdxCompar(const void* lhs, const void* rhs) { } } -int32_t boundIdxCompar(const void* lhs, const void* rhs) { +int32_t insBoundIdxCompar(const void* lhs, const void* rhs) { uint16_t left = *(uint16_t*)POINTER_SHIFT(lhs, sizeof(uint16_t)); uint16_t right = *(uint16_t*)POINTER_SHIFT(rhs, sizeof(uint16_t)); @@ -178,7 +221,7 @@ static int32_t createDataBlock(size_t defaultSize, int32_t rowSize, int32_t star SParsedDataColInfo* pColInfo = &dataBuf->boundColumnInfo; SSchema* pSchema = getTableColumnSchema(dataBuf->pTableMeta); - setBoundColumnInfo(pColInfo, pSchema, dataBuf->pTableMeta->tableInfo.numOfColumns); + insSetBoundColumnInfo(pColInfo, pSchema, dataBuf->pTableMeta->tableInfo.numOfColumns); dataBuf->ordered = true; dataBuf->prevTS = INT64_MIN; @@ -192,7 +235,7 @@ static int32_t createDataBlock(size_t defaultSize, int32_t rowSize, int32_t star return TSDB_CODE_SUCCESS; } -int32_t buildCreateTbMsg(STableDataBlocks* pBlocks, SVCreateTbReq* pCreateTbReq) { +int32_t insBuildCreateTbMsg(STableDataBlocks* pBlocks, SVCreateTbReq* pCreateTbReq) { SEncoder coder = {0}; char* pBuf; int32_t len; @@ -222,7 +265,7 @@ int32_t buildCreateTbMsg(STableDataBlocks* pBlocks, SVCreateTbReq* pCreateTbReq) return code; } -static void destroyDataBlock(STableDataBlocks* pDataBlock) { +void insDestroyDataBlock(STableDataBlocks* pDataBlock) { if (pDataBlock == NULL) { return; } @@ -237,9 +280,9 @@ static void destroyDataBlock(STableDataBlocks* pDataBlock) { taosMemoryFreeClear(pDataBlock); } -int32_t getDataBlockFromList(SHashObj* pHashList, void* id, int32_t idLen, int32_t size, int32_t startOffset, - int32_t rowSize, STableMeta* pTableMeta, STableDataBlocks** dataBlocks, SArray* pBlockList, - SVCreateTbReq* pCreateTbReq) { +int32_t insGetDataBlockFromList(SHashObj* pHashList, void* id, int32_t idLen, int32_t size, int32_t startOffset, + int32_t rowSize, STableMeta* pTableMeta, STableDataBlocks** dataBlocks, + SArray* pBlockList, SVCreateTbReq* pCreateTbReq) { *dataBlocks = NULL; STableDataBlocks** t1 = (STableDataBlocks**)taosHashGet(pHashList, (const char*)id, idLen); if (t1 != NULL) { @@ -253,9 +296,9 @@ int32_t getDataBlockFromList(SHashObj* pHashList, void* id, int32_t idLen, int32 } if (NULL != pCreateTbReq && NULL != pCreateTbReq->ctb.pTag) { - ret = buildCreateTbMsg(*dataBlocks, pCreateTbReq); + ret = insBuildCreateTbMsg(*dataBlocks, pCreateTbReq); if (ret != TSDB_CODE_SUCCESS) { - destroyDataBlock(*dataBlocks); + insDestroyDataBlock(*dataBlocks); return ret; } } @@ -269,7 +312,7 @@ int32_t getDataBlockFromList(SHashObj* pHashList, void* id, int32_t idLen, int32 return TSDB_CODE_SUCCESS; } - +#if 0 static int32_t getRowExpandSize(STableMeta* pTableMeta) { int32_t result = TD_ROW_HEAD_LEN - sizeof(TSKEY); int32_t columns = getNumOfColumns(pTableMeta); @@ -282,8 +325,9 @@ static int32_t getRowExpandSize(STableMeta* pTableMeta) { result += (int32_t)TD_BITMAP_BYTES(columns - 1); return result; } +#endif -void destroyBlockArrayList(SArray* pDataBlockList) { +void insDestroyBlockArrayList(SArray* pDataBlockList) { if (pDataBlockList == NULL) { return; } @@ -291,13 +335,13 @@ void destroyBlockArrayList(SArray* pDataBlockList) { size_t size = taosArrayGetSize(pDataBlockList); for (int32_t i = 0; i < size; i++) { void* p = taosArrayGetP(pDataBlockList, i); - destroyDataBlock(p); + insDestroyDataBlock(p); } taosArrayDestroy(pDataBlockList); } -void destroyBlockHashmap(SHashObj* pDataBlockHash) { +void insDestroyBlockHashmap(SHashObj* pDataBlockHash) { if (pDataBlockHash == NULL) { return; } @@ -305,7 +349,7 @@ void destroyBlockHashmap(SHashObj* pDataBlockHash) { void** p1 = taosHashIterate(pDataBlockHash, NULL); while (p1) { STableDataBlocks* pBlocks = *p1; - destroyDataBlock(pBlocks); + insDestroyDataBlock(pBlocks); p1 = taosHashIterate(pDataBlockHash, p1); } @@ -313,6 +357,7 @@ void destroyBlockHashmap(SHashObj* pDataBlockHash) { taosHashCleanup(pDataBlockHash); } +#if 0 // data block is disordered, sort it in ascending order void sortRemoveDataBlockDupRowsRaw(STableDataBlocks* dataBuf) { SSubmitBlk* pBlocks = (SSubmitBlk*)dataBuf->pData; @@ -355,6 +400,7 @@ void sortRemoveDataBlockDupRowsRaw(STableDataBlocks* dataBuf) { dataBuf->prevTS = INT64_MIN; } +#endif // data block is disordered, sort it in ascending order static int sortRemoveDataBlockDupRows(STableDataBlocks* dataBuf, SBlockKeyInfo* pBlkKeyInfo) { @@ -375,7 +421,7 @@ static int sortRemoveDataBlockDupRows(STableDataBlocks* dataBuf, SBlockKeyInfo* } memset(pBlkKeyInfo->pKeyTuple, 0, nAlloc); - int32_t extendedRowSize = getExtendedRowSize(dataBuf); + int32_t extendedRowSize = insGetExtendedRowSize(dataBuf); SBlockKeyTuple* pBlkKeyTuple = pBlkKeyInfo->pKeyTuple; char* pBlockData = pBlocks->data + pBlocks->schemaLen; int n = 0; @@ -545,7 +591,7 @@ static int sortMergeDataBlockDupRows(STableDataBlocks* dataBuf, SBlockKeyInfo* p tdResetSBlockRowMerger(*ppBlkRowMerger); - int32_t extendedRowSize = getExtendedRowSize(dataBuf); + int32_t extendedRowSize = insGetExtendedRowSize(dataBuf); SBlockKeyTuple* pBlkKeyTuple = pBlkKeyInfo->pKeyTuple; char* pBlockData = pBlocks->data + pBlocks->schemaLen; int32_t n = 0; @@ -621,68 +667,31 @@ static int sortMergeDataBlockDupRows(STableDataBlocks* dataBuf, SBlockKeyInfo* p } // Erase the empty space reserved for binary data -static int trimDataBlock(void* pDataBlock, STableDataBlocks* pTableDataBlock, SBlockKeyTuple* blkKeyTuple, - bool isRawPayload) { +static int trimDataBlock(void* pDataBlock, STableDataBlocks* pTableDataBlock, SBlockKeyTuple* blkKeyTuple) { // TODO: optimize this function, handle the case while binary is not presented - STableMeta* pTableMeta = pTableDataBlock->pTableMeta; - STableComInfo tinfo = getTableInfo(pTableMeta); - SSchema* pSchema = getTableColumnSchema(pTableMeta); - int32_t nonDataLen = sizeof(SSubmitBlk) + pTableDataBlock->createTbReqLen; SSubmitBlk* pBlock = pDataBlock; memcpy(pDataBlock, pTableDataBlock->pData, nonDataLen); pDataBlock = (char*)pDataBlock + nonDataLen; - int32_t flen = 0; // original total length of row - if (isRawPayload) { - for (int32_t j = 0; j < tinfo.numOfColumns; ++j) { - flen += TYPE_BYTES[pSchema[j].type]; - } - } pBlock->schemaLen = pTableDataBlock->createTbReqLen; - - char* p = pTableDataBlock->pData + nonDataLen; pBlock->dataLen = 0; + int32_t numOfRows = pBlock->numOfRows; - - if (isRawPayload) { - SRowBuilder builder = {0}; - - tdSRowInit(&builder, pTableMeta->sversion); - tdSRowSetInfo(&builder, getNumOfColumns(pTableMeta), -1, flen); - - for (int32_t i = 0; i < numOfRows; ++i) { - tdSRowResetBuf(&builder, pDataBlock); - int toffset = 0; - for (int32_t j = 0; j < tinfo.numOfColumns; ++j) { - int8_t colType = pSchema[j].type; - uint8_t valType = isNull(p, colType) ? TD_VTYPE_NULL : TD_VTYPE_NORM; - tdAppendColValToRow(&builder, pSchema[j].colId, colType, valType, p, true, toffset, j); - toffset += TYPE_BYTES[colType]; - p += pSchema[j].bytes; - } - tdSRowEnd(&builder); - int32_t rowLen = TD_ROW_LEN((STSRow*)pDataBlock); - pDataBlock = (char*)pDataBlock + rowLen; - pBlock->dataLen += rowLen; - } - } else { - for (int32_t i = 0; i < numOfRows; ++i) { - void* payload = (blkKeyTuple + i)->payloadAddr; - TDRowLenT rowTLen = TD_ROW_LEN((STSRow*)payload); - memcpy(pDataBlock, payload, rowTLen); - pDataBlock = POINTER_SHIFT(pDataBlock, rowTLen); - pBlock->dataLen += rowTLen; - } + for (int32_t i = 0; i < numOfRows; ++i) { + void* payload = (blkKeyTuple + i)->payloadAddr; + TDRowLenT rowTLen = TD_ROW_LEN((STSRow*)payload); + memcpy(pDataBlock, payload, rowTLen); + pDataBlock = POINTER_SHIFT(pDataBlock, rowTLen); + pBlock->dataLen += rowTLen; } return pBlock->dataLen + pBlock->schemaLen; } -int32_t mergeTableDataBlocks(SHashObj* pHashObj, uint8_t payloadType, SArray** pVgDataBlocks) { +int32_t insMergeTableDataBlocks(SHashObj* pHashObj, SArray** pVgDataBlocks) { const int INSERT_HEAD_SIZE = sizeof(SSubmitReq); int code = 0; - bool isRawPayload = IS_RAW_PAYLOAD(payloadType); SHashObj* pVnodeDataBlockHashList = taosHashInit(128, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, false); SArray* pVnodeDataBlockList = taosArrayInit(8, POINTER_BYTES); @@ -696,20 +705,19 @@ int32_t mergeTableDataBlocks(SHashObj* pHashObj, uint8_t payloadType, SArray** p if (pBlocks->numOfRows > 0) { STableDataBlocks* dataBuf = NULL; pOneTableBlock->pTableMeta->vgId = pOneTableBlock->vgId; // for schemaless, restore origin vgId - int32_t ret = getDataBlockFromList(pVnodeDataBlockHashList, &pOneTableBlock->vgId, sizeof(pOneTableBlock->vgId), - TSDB_PAYLOAD_SIZE, INSERT_HEAD_SIZE, 0, pOneTableBlock->pTableMeta, &dataBuf, - pVnodeDataBlockList, NULL); + int32_t ret = insGetDataBlockFromList(pVnodeDataBlockHashList, &pOneTableBlock->vgId, + sizeof(pOneTableBlock->vgId), TSDB_PAYLOAD_SIZE, INSERT_HEAD_SIZE, 0, + pOneTableBlock->pTableMeta, &dataBuf, pVnodeDataBlockList, NULL); if (ret != TSDB_CODE_SUCCESS) { tdFreeSBlockRowMerger(pBlkRowMerger); taosHashCleanup(pVnodeDataBlockHashList); - destroyBlockArrayList(pVnodeDataBlockList); + insDestroyBlockArrayList(pVnodeDataBlockList); taosMemoryFreeClear(blkKeyInfo.pKeyTuple); return ret; } ASSERT(pOneTableBlock->pTableMeta->tableInfo.rowSize > 0); // the maximum expanded size in byte when a row-wise data is converted to SDataRow format - int32_t expandSize = isRawPayload ? getRowExpandSize(pOneTableBlock->pTableMeta) : 0; - int64_t destSize = dataBuf->size + pOneTableBlock->size + pBlocks->numOfRows * expandSize + + int64_t destSize = dataBuf->size + pOneTableBlock->size + sizeof(STColumn) * getNumOfColumns(pOneTableBlock->pTableMeta) + pOneTableBlock->createTbReqLen; @@ -721,30 +729,25 @@ int32_t mergeTableDataBlocks(SHashObj* pHashObj, uint8_t payloadType, SArray** p } else { // failed to allocate memory, free already allocated memory and return error code tdFreeSBlockRowMerger(pBlkRowMerger); taosHashCleanup(pVnodeDataBlockHashList); - destroyBlockArrayList(pVnodeDataBlockList); + insDestroyBlockArrayList(pVnodeDataBlockList); taosMemoryFreeClear(dataBuf->pData); taosMemoryFreeClear(blkKeyInfo.pKeyTuple); return TSDB_CODE_TSC_OUT_OF_MEMORY; } } - if (isRawPayload) { - sortRemoveDataBlockDupRowsRaw(pOneTableBlock); - } else { - if ((code = sortMergeDataBlockDupRows(pOneTableBlock, &blkKeyInfo, &pBlkRowMerger)) != 0) { - tdFreeSBlockRowMerger(pBlkRowMerger); - taosHashCleanup(pVnodeDataBlockHashList); - destroyBlockArrayList(pVnodeDataBlockList); - taosMemoryFreeClear(dataBuf->pData); - taosMemoryFreeClear(blkKeyInfo.pKeyTuple); - return code; - } - ASSERT(blkKeyInfo.pKeyTuple != NULL && pBlocks->numOfRows > 0); + if ((code = sortMergeDataBlockDupRows(pOneTableBlock, &blkKeyInfo, &pBlkRowMerger)) != 0) { + tdFreeSBlockRowMerger(pBlkRowMerger); + taosHashCleanup(pVnodeDataBlockHashList); + insDestroyBlockArrayList(pVnodeDataBlockList); + taosMemoryFreeClear(dataBuf->pData); + taosMemoryFreeClear(blkKeyInfo.pKeyTuple); + return code; } + ASSERT(blkKeyInfo.pKeyTuple != NULL && pBlocks->numOfRows > 0); // erase the empty space reserved for binary data - int32_t finalLen = - trimDataBlock(dataBuf->pData + dataBuf->size, pOneTableBlock, blkKeyInfo.pKeyTuple, isRawPayload); + int32_t finalLen = trimDataBlock(dataBuf->pData + dataBuf->size, pOneTableBlock, blkKeyInfo.pKeyTuple); dataBuf->size += (finalLen + sizeof(SSubmitBlk)); assert(dataBuf->size <= dataBuf->nAllocSize); @@ -767,7 +770,7 @@ int32_t mergeTableDataBlocks(SHashObj* pHashObj, uint8_t payloadType, SArray** p return TSDB_CODE_SUCCESS; } -int32_t allocateMemForSize(STableDataBlocks* pDataBlock, int32_t allSize) { +int32_t insAllocateMemForSize(STableDataBlocks* pDataBlock, int32_t allSize) { size_t remain = pDataBlock->nAllocSize - pDataBlock->size; uint32_t nAllocSizeOld = pDataBlock->nAllocSize; @@ -789,35 +792,7 @@ int32_t allocateMemForSize(STableDataBlocks* pDataBlock, int32_t allSize) { return TSDB_CODE_SUCCESS; } -int32_t allocateMemIfNeed(STableDataBlocks* pDataBlock, int32_t rowSize, int32_t* numOfRows) { - size_t remain = pDataBlock->nAllocSize - pDataBlock->size; - const int factor = 5; - uint32_t nAllocSizeOld = pDataBlock->nAllocSize; - - // expand the allocated size - if (remain < rowSize * factor) { - while (remain < rowSize * factor) { - pDataBlock->nAllocSize = (uint32_t)(pDataBlock->nAllocSize * 1.5); - remain = pDataBlock->nAllocSize - pDataBlock->size; - } - - char* tmp = taosMemoryRealloc(pDataBlock->pData, (size_t)pDataBlock->nAllocSize); - if (tmp != NULL) { - pDataBlock->pData = tmp; - memset(pDataBlock->pData + pDataBlock->size, 0, pDataBlock->nAllocSize - pDataBlock->size); - } else { - // do nothing, if allocate more memory failed - pDataBlock->nAllocSize = nAllocSizeOld; - *numOfRows = (int32_t)(pDataBlock->nAllocSize - pDataBlock->headerSize) / rowSize; - return TSDB_CODE_TSC_OUT_OF_MEMORY; - } - } - - *numOfRows = (int32_t)(pDataBlock->nAllocSize - pDataBlock->headerSize) / rowSize; - return TSDB_CODE_SUCCESS; -} - -int initRowBuilder(SRowBuilder* pBuilder, int16_t schemaVer, SParsedDataColInfo* pColInfo) { +int32_t insInitRowBuilder(SRowBuilder* pBuilder, int16_t schemaVer, SParsedDataColInfo* pColInfo) { ASSERT(pColInfo->numOfCols > 0 && (pColInfo->numOfBound <= pColInfo->numOfCols)); tdSRowInit(pBuilder, schemaVer); tdSRowSetExtendedInfo(pBuilder, pColInfo->numOfCols, pColInfo->numOfBound, pColInfo->flen, pColInfo->allNullLen, @@ -825,101 +800,218 @@ int initRowBuilder(SRowBuilder* pBuilder, int16_t schemaVer, SParsedDataColInfo* return TSDB_CODE_SUCCESS; } -int32_t qResetStmtDataBlock(void* block, bool keepBuf) { - STableDataBlocks* pBlock = (STableDataBlocks*)block; +static char* tableNameGetPosition(SToken* pToken, char target) { + bool inEscape = false; + bool inQuote = false; + char quotaStr = 0; - if (keepBuf) { - taosMemoryFreeClear(pBlock->pData); - pBlock->pData = taosMemoryMalloc(TSDB_PAYLOAD_SIZE); - if (NULL == pBlock->pData) { - return TSDB_CODE_OUT_OF_MEMORY; + for (uint32_t i = 0; i < pToken->n; ++i) { + if (*(pToken->z + i) == target && (!inEscape) && (!inQuote)) { + return pToken->z + i; } - memset(pBlock->pData, 0, sizeof(SSubmitBlk)); + + if (*(pToken->z + i) == TS_ESCAPE_CHAR) { + if (!inQuote) { + inEscape = !inEscape; + } + } + + if (*(pToken->z + i) == '\'' || *(pToken->z + i) == '"') { + if (!inEscape) { + if (!inQuote) { + quotaStr = *(pToken->z + i); + inQuote = !inQuote; + } else if (quotaStr == *(pToken->z + i)) { + inQuote = !inQuote; + } + } + } + } + + return NULL; +} + +int32_t insCreateSName(SName* pName, SToken* pTableName, int32_t acctId, const char* dbName, SMsgBuf* pMsgBuf) { + const char* msg1 = "name too long"; + const char* msg2 = "invalid database name"; + const char* msg3 = "db is not specified"; + const char* msg4 = "invalid table name"; + + int32_t code = TSDB_CODE_SUCCESS; + char* p = tableNameGetPosition(pTableName, TS_PATH_DELIMITER[0]); + + if (p != NULL) { // db has been specified in sql string so we ignore current db path + assert(*p == TS_PATH_DELIMITER[0]); + + int32_t dbLen = p - pTableName->z; + if (dbLen <= 0) { + return buildInvalidOperationMsg(pMsgBuf, msg2); + } + char name[TSDB_DB_FNAME_LEN] = {0}; + strncpy(name, pTableName->z, dbLen); + int32_t actualDbLen = strdequote(name); + + code = tNameSetDbName(pName, acctId, name, actualDbLen); + if (code != TSDB_CODE_SUCCESS) { + return buildInvalidOperationMsg(pMsgBuf, msg1); + } + + int32_t tbLen = pTableName->n - dbLen - 1; + if (tbLen <= 0) { + return buildInvalidOperationMsg(pMsgBuf, msg4); + } + + char tbname[TSDB_TABLE_FNAME_LEN] = {0}; + strncpy(tbname, p + 1, tbLen); + /*tbLen = */ strdequote(tbname); + + code = tNameFromString(pName, tbname, T_NAME_TABLE); + if (code != 0) { + return buildInvalidOperationMsg(pMsgBuf, msg1); + } + } else { // get current DB name first, and then set it into path + if (pTableName->n >= TSDB_TABLE_NAME_LEN) { + return buildInvalidOperationMsg(pMsgBuf, msg1); + } + + assert(pTableName->n < TSDB_TABLE_FNAME_LEN); + + char name[TSDB_TABLE_FNAME_LEN] = {0}; + strncpy(name, pTableName->z, pTableName->n); + strdequote(name); + + if (dbName == NULL) { + return buildInvalidOperationMsg(pMsgBuf, msg3); + } + + code = tNameSetDbName(pName, acctId, dbName, strlen(dbName)); + if (code != TSDB_CODE_SUCCESS) { + code = buildInvalidOperationMsg(pMsgBuf, msg2); + return code; + } + + code = tNameFromString(pName, name, T_NAME_TABLE); + if (code != 0) { + code = buildInvalidOperationMsg(pMsgBuf, msg1); + } + } + + return code; +} + +int32_t insFindCol(SToken* pColname, int32_t start, int32_t end, SSchema* pSchema) { + while (start < end) { + if (strlen(pSchema[start].name) == pColname->n && strncmp(pColname->z, pSchema[start].name, pColname->n) == 0) { + return start; + } + ++start; + } + return -1; +} + +void insBuildCreateTbReq(SVCreateTbReq* pTbReq, const char* tname, STag* pTag, int64_t suid, const char* sname, + SArray* tagName, uint8_t tagNum) { + pTbReq->type = TD_CHILD_TABLE; + pTbReq->name = strdup(tname); + pTbReq->ctb.suid = suid; + pTbReq->ctb.tagNum = tagNum; + if (sname) pTbReq->ctb.stbName = strdup(sname); + pTbReq->ctb.pTag = (uint8_t*)pTag; + pTbReq->ctb.tagName = taosArrayDup(tagName); + pTbReq->ttl = TSDB_DEFAULT_TABLE_TTL; + pTbReq->commentLen = -1; + + return; +} + +int32_t insMemRowAppend(SMsgBuf* pMsgBuf, const void* value, int32_t len, void* param) { + SMemParam* pa = (SMemParam*)param; + SRowBuilder* rb = pa->rb; + + if (value == NULL) { // it is a null data + tdAppendColValToRow(rb, pa->schema->colId, pa->schema->type, TD_VTYPE_NULL, value, false, pa->toffset, pa->colIdx); + return TSDB_CODE_SUCCESS; + } + + if (TSDB_DATA_TYPE_BINARY == pa->schema->type) { + const char* rowEnd = tdRowEnd(rb->pBuf); + STR_WITH_SIZE_TO_VARSTR(rowEnd, value, len); + tdAppendColValToRow(rb, pa->schema->colId, pa->schema->type, TD_VTYPE_NORM, rowEnd, false, pa->toffset, pa->colIdx); + } else if (TSDB_DATA_TYPE_NCHAR == pa->schema->type) { + // if the converted output len is over than pColumnModel->bytes, return error: 'Argument list too long' + int32_t output = 0; + const char* rowEnd = tdRowEnd(rb->pBuf); + if (!taosMbsToUcs4(value, len, (TdUcs4*)varDataVal(rowEnd), pa->schema->bytes - VARSTR_HEADER_SIZE, &output)) { + if (errno == E2BIG) { + return generateSyntaxErrMsg(pMsgBuf, TSDB_CODE_PAR_VALUE_TOO_LONG, pa->schema->name); + } + char buf[512] = {0}; + snprintf(buf, tListLen(buf), "%s", strerror(errno)); + return buildSyntaxErrMsg(pMsgBuf, buf, value); + } + varDataSetLen(rowEnd, output); + tdAppendColValToRow(rb, pa->schema->colId, pa->schema->type, TD_VTYPE_NORM, rowEnd, false, pa->toffset, pa->colIdx); } else { - pBlock->pData = NULL; + tdAppendColValToRow(rb, pa->schema->colId, pa->schema->type, TD_VTYPE_NORM, value, false, pa->toffset, pa->colIdx); } - pBlock->ordered = true; - pBlock->prevTS = INT64_MIN; - pBlock->size = sizeof(SSubmitBlk); - pBlock->tsSource = -1; - pBlock->numOfTables = 1; - pBlock->nAllocSize = TSDB_PAYLOAD_SIZE; - pBlock->headerSize = pBlock->size; - pBlock->createTbReqLen = 0; - - memset(&pBlock->rowBuilder, 0, sizeof(pBlock->rowBuilder)); - return TSDB_CODE_SUCCESS; } -int32_t qCloneStmtDataBlock(void** pDst, void* pSrc) { - *pDst = taosMemoryMalloc(sizeof(STableDataBlocks)); - if (NULL == *pDst) { - return TSDB_CODE_OUT_OF_MEMORY; +int32_t insCheckTimestamp(STableDataBlocks* pDataBlocks, const char* start) { + // once the data block is disordered, we do NOT keep previous timestamp any more + if (!pDataBlocks->ordered) { + return TSDB_CODE_SUCCESS; } - memcpy(*pDst, pSrc, sizeof(STableDataBlocks)); - ((STableDataBlocks*)(*pDst))->cloned = true; + TSKEY k = *(TSKEY*)start; + if (k <= pDataBlocks->prevTS) { + pDataBlocks->ordered = false; + } - STableDataBlocks* pBlock = (STableDataBlocks*)(*pDst); - if (pBlock->pTableMeta) { - void* pNewMeta = taosMemoryMalloc(TABLE_META_SIZE(pBlock->pTableMeta)); - if (NULL == pNewMeta) { - taosMemoryFreeClear(*pDst); - return TSDB_CODE_OUT_OF_MEMORY; + pDataBlocks->prevTS = k; + return TSDB_CODE_SUCCESS; +} + +static void buildMsgHeader(STableDataBlocks* src, SVgDataBlocks* blocks) { + SSubmitReq* submit = (SSubmitReq*)blocks->pData; + submit->header.vgId = htonl(blocks->vg.vgId); + submit->header.contLen = htonl(blocks->size); + submit->length = submit->header.contLen; + submit->numOfBlocks = htonl(blocks->numOfTables); + SSubmitBlk* blk = (SSubmitBlk*)(submit + 1); + int32_t numOfBlocks = blocks->numOfTables; + while (numOfBlocks--) { + int32_t dataLen = blk->dataLen; + int32_t schemaLen = blk->schemaLen; + blk->uid = htobe64(blk->uid); + blk->suid = htobe64(blk->suid); + blk->sversion = htonl(blk->sversion); + blk->dataLen = htonl(blk->dataLen); + blk->schemaLen = htonl(blk->schemaLen); + blk->numOfRows = htonl(blk->numOfRows); + blk = (SSubmitBlk*)(blk->data + schemaLen + dataLen); + } +} + +int32_t insBuildOutput(SInsertParseContext* pCxt) { + size_t numOfVg = taosArrayGetSize(pCxt->pVgDataBlocks); + pCxt->pOutput->pDataBlocks = taosArrayInit(numOfVg, POINTER_BYTES); + if (NULL == pCxt->pOutput->pDataBlocks) { + return TSDB_CODE_TSC_OUT_OF_MEMORY; + } + for (size_t i = 0; i < numOfVg; ++i) { + STableDataBlocks* src = taosArrayGetP(pCxt->pVgDataBlocks, i); + SVgDataBlocks* dst = taosMemoryCalloc(1, sizeof(SVgDataBlocks)); + if (NULL == dst) { + return TSDB_CODE_TSC_OUT_OF_MEMORY; } - memcpy(pNewMeta, pBlock->pTableMeta, TABLE_META_SIZE(pBlock->pTableMeta)); - pBlock->pTableMeta = pNewMeta; + taosHashGetDup(pCxt->pVgroupsHashObj, (const char*)&src->vgId, sizeof(src->vgId), &dst->vg); + dst->numOfTables = src->numOfTables; + dst->size = src->size; + TSWAP(dst->pData, src->pData); + buildMsgHeader(src, dst); + taosArrayPush(pCxt->pOutput->pDataBlocks, &dst); } - - return qResetStmtDataBlock(*pDst, false); -} - -int32_t qRebuildStmtDataBlock(void** pDst, void* pSrc, uint64_t uid, int32_t vgId) { - int32_t code = qCloneStmtDataBlock(pDst, pSrc); - if (code) { - return code; - } - - STableDataBlocks* pBlock = (STableDataBlocks*)*pDst; - pBlock->pData = taosMemoryMalloc(pBlock->nAllocSize); - if (NULL == pBlock->pData) { - qFreeStmtDataBlock(pBlock); - return TSDB_CODE_OUT_OF_MEMORY; - } - - pBlock->vgId = vgId; - - if (pBlock->pTableMeta) { - pBlock->pTableMeta->uid = uid; - pBlock->pTableMeta->vgId = vgId; - } - - memset(pBlock->pData, 0, sizeof(SSubmitBlk)); - return TSDB_CODE_SUCCESS; } - -STableMeta* qGetTableMetaInDataBlock(void* pDataBlock) { return ((STableDataBlocks*)pDataBlock)->pTableMeta; } - -void qFreeStmtDataBlock(void* pDataBlock) { - if (pDataBlock == NULL) { - return; - } - - taosMemoryFreeClear(((STableDataBlocks*)pDataBlock)->pTableMeta); - taosMemoryFreeClear(((STableDataBlocks*)pDataBlock)->pData); - taosMemoryFreeClear(pDataBlock); -} - -void qDestroyStmtDataBlock(void* pBlock) { - if (pBlock == NULL) { - return; - } - - STableDataBlocks* pDataBlock = (STableDataBlocks*)pBlock; - - pDataBlock->cloned = false; - destroyDataBlock(pDataBlock); -} diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index d942af9673..3f12d2aa66 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -6259,16 +6259,28 @@ static int32_t rewriteShowStableTags(STranslateContext* pCxt, SQuery* pQuery) { } static int32_t rewriteShowDnodeVariables(STranslateContext* pCxt, SQuery* pQuery) { - SSelectStmt* pStmt = NULL; - int32_t code = createSelectStmtForShow(nodeType(pQuery->pRoot), &pStmt); + SShowDnodeVariablesStmt* pStmt = (SShowDnodeVariablesStmt*)pQuery->pRoot; + SNode* pDnodeCond = NULL; + SNode* pLikeCond = NULL; + SSelectStmt* pSelect = NULL; + int32_t code = createSelectStmtForShow(nodeType(pQuery->pRoot), &pSelect); if (TSDB_CODE_SUCCESS == code) { - code = createOperatorNode(OP_TYPE_EQUAL, "dnode_id", ((SShowDnodeVariablesStmt*)pQuery->pRoot)->pDnodeId, - &pStmt->pWhere); + code = createOperatorNode(OP_TYPE_EQUAL, "dnode_id", pStmt->pDnodeId, &pDnodeCond); + } + if (TSDB_CODE_SUCCESS == code) { + code = createOperatorNode(OP_TYPE_LIKE, "name", pStmt->pLikePattern, &pLikeCond); + } + if (TSDB_CODE_SUCCESS == code) { + if (NULL != pLikeCond) { + code = createLogicCondNode(pDnodeCond, pLikeCond, &pSelect->pWhere); + } else { + pSelect->pWhere = pDnodeCond; + } } if (TSDB_CODE_SUCCESS == code) { pQuery->showRewrite = true; nodesDestroyNode(pQuery->pRoot); - pQuery->pRoot = (SNode*)pStmt; + pQuery->pRoot = (SNode*)pSelect; } return code; } diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index deb38a77e3..a7f335ee26 100644 --- a/source/libs/parser/src/sql.c +++ b/source/libs/parser/src/sql.c @@ -139,17 +139,17 @@ typedef union { #define ParseCTX_FETCH #define ParseCTX_STORE #define YYFALLBACK 1 -#define YYNSTATE 696 -#define YYNRULE 524 +#define YYNSTATE 698 +#define YYNRULE 525 #define YYNTOKEN 317 -#define YY_MAX_SHIFT 695 -#define YY_MIN_SHIFTREDUCE 1029 -#define YY_MAX_SHIFTREDUCE 1552 -#define YY_ERROR_ACTION 1553 -#define YY_ACCEPT_ACTION 1554 -#define YY_NO_ACTION 1555 -#define YY_MIN_REDUCE 1556 -#define YY_MAX_REDUCE 2079 +#define YY_MAX_SHIFT 697 +#define YY_MIN_SHIFTREDUCE 1031 +#define YY_MAX_SHIFTREDUCE 1555 +#define YY_ERROR_ACTION 1556 +#define YY_ACCEPT_ACTION 1557 +#define YY_NO_ACTION 1558 +#define YY_MIN_REDUCE 1559 +#define YY_MAX_REDUCE 2083 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -218,288 +218,288 @@ typedef union { *********** Begin parsing tables **********************************************/ #define YY_ACTTAB_COUNT (2819) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 1881, 34, 267, 1881, 157, 1062, 1568, 1895, 62, 534, - /* 10 */ 1698, 1877, 44, 42, 1877, 446, 334, 447, 1591, 1807, - /* 20 */ 349, 1877, 1333, 43, 41, 40, 39, 38, 588, 156, - /* 30 */ 167, 1554, 1358, 1413, 1660, 1331, 1913, 1873, 1879, 337, - /* 40 */ 1873, 1879, 343, 1746, 589, 1066, 1067, 1873, 1879, 1863, - /* 50 */ 595, 601, 30, 595, 445, 1579, 1408, 449, 37, 36, - /* 60 */ 595, 17, 43, 41, 40, 39, 38, 1895, 1339, 44, - /* 70 */ 42, 1483, 1893, 1578, 505, 588, 1929, 349, 573, 1333, - /* 80 */ 97, 1894, 1896, 605, 1898, 1899, 600, 77, 595, 515, - /* 90 */ 1413, 364, 1331, 168, 1, 1982, 1913, 1863, 58, 342, - /* 100 */ 1978, 125, 46, 218, 602, 585, 58, 2050, 530, 1863, - /* 110 */ 1702, 601, 173, 1408, 534, 1863, 692, 508, 17, 1577, - /* 120 */ 2008, 502, 572, 171, 1808, 1339, 217, 2051, 574, 1359, - /* 130 */ 1415, 1416, 603, 2055, 132, 585, 1929, 2050, 394, 1576, - /* 140 */ 98, 348, 1896, 605, 1898, 1899, 600, 454, 595, 447, - /* 150 */ 1591, 1, 2056, 171, 1079, 1982, 1078, 2051, 574, 314, - /* 160 */ 1978, 1863, 2050, 64, 132, 7, 63, 58, 1487, 482, - /* 170 */ 2050, 130, 335, 692, 1358, 1334, 310, 1332, 2054, 219, - /* 180 */ 154, 1863, 2051, 2053, 1080, 572, 171, 1415, 1416, 1709, - /* 190 */ 2051, 574, 587, 169, 1990, 1991, 1359, 1995, 463, 1337, - /* 200 */ 1338, 121, 1388, 1389, 1391, 1392, 1393, 1394, 1395, 1396, - /* 210 */ 1397, 1398, 597, 593, 1406, 1407, 1409, 1410, 1411, 1412, - /* 220 */ 1414, 1417, 3, 264, 1990, 584, 1684, 583, 1753, 1754, - /* 230 */ 2050, 1423, 1334, 383, 1332, 79, 312, 1358, 388, 537, - /* 240 */ 174, 1509, 496, 495, 174, 572, 171, 387, 174, 386, - /* 250 */ 2051, 574, 174, 385, 381, 530, 1337, 1338, 58, 1388, - /* 260 */ 1389, 1391, 1392, 1393, 1394, 1395, 1396, 1397, 1398, 597, - /* 270 */ 593, 1406, 1407, 1409, 1410, 1411, 1412, 1414, 1417, 3, - /* 280 */ 44, 42, 695, 181, 2050, 233, 234, 1358, 349, 77, - /* 290 */ 1333, 560, 1507, 1508, 1510, 1511, 274, 547, 1895, 2056, - /* 300 */ 171, 1413, 547, 1331, 2051, 574, 1228, 1229, 2055, 52, - /* 310 */ 165, 1882, 1703, 174, 120, 685, 681, 677, 673, 272, - /* 320 */ 74, 484, 1877, 73, 1408, 220, 1707, 1913, 1737, 17, - /* 330 */ 354, 1707, 636, 1752, 1754, 602, 1339, 44, 42, 1079, - /* 340 */ 1863, 1078, 601, 312, 588, 349, 537, 1333, 1873, 1879, - /* 350 */ 563, 145, 144, 633, 632, 631, 95, 1390, 1413, 240, - /* 360 */ 1331, 595, 1, 603, 451, 1476, 547, 1929, 636, 1080, - /* 370 */ 1356, 294, 348, 1896, 605, 1898, 1899, 600, 120, 595, - /* 380 */ 47, 1408, 1557, 395, 692, 489, 17, 145, 144, 633, - /* 390 */ 632, 631, 544, 1339, 453, 1707, 396, 449, 1415, 1416, - /* 400 */ 1542, 2050, 1333, 110, 174, 431, 109, 108, 107, 106, - /* 410 */ 105, 104, 103, 102, 101, 1331, 572, 171, 46, 1, - /* 420 */ 1390, 2051, 574, 110, 229, 547, 109, 108, 107, 106, - /* 430 */ 105, 104, 103, 102, 101, 569, 564, 176, 500, 499, - /* 440 */ 498, 692, 1305, 1334, 222, 1332, 126, 494, 1339, 1575, - /* 450 */ 154, 493, 492, 1759, 1707, 1415, 1416, 491, 497, 1710, - /* 460 */ 336, 185, 184, 490, 1146, 1066, 1067, 1337, 1338, 1757, - /* 470 */ 1388, 1389, 1391, 1392, 1393, 1394, 1395, 1396, 1397, 1398, - /* 480 */ 597, 593, 1406, 1407, 1409, 1410, 1411, 1412, 1414, 1417, - /* 490 */ 3, 1863, 11, 40, 39, 38, 692, 1148, 2002, 1476, - /* 500 */ 1334, 1621, 1332, 232, 568, 1444, 1186, 627, 626, 625, - /* 510 */ 1190, 624, 1192, 1193, 623, 1195, 620, 638, 1201, 617, - /* 520 */ 1203, 1204, 614, 611, 1337, 1338, 174, 1388, 1389, 1391, - /* 530 */ 1392, 1393, 1394, 1395, 1396, 1397, 1398, 597, 593, 1406, - /* 540 */ 1407, 1409, 1410, 1411, 1412, 1414, 1417, 3, 44, 42, - /* 550 */ 1800, 352, 1913, 2055, 1997, 1334, 349, 1332, 1333, 154, - /* 560 */ 567, 179, 1311, 1312, 500, 499, 498, 630, 1709, 1413, - /* 570 */ 1360, 1331, 126, 494, 547, 31, 227, 493, 492, 1337, - /* 580 */ 1338, 1895, 1994, 491, 497, 1449, 392, 1685, 1810, 490, - /* 590 */ 37, 36, 1408, 1357, 43, 41, 40, 39, 38, 566, - /* 600 */ 1895, 1759, 577, 1707, 1339, 44, 42, 1418, 353, 547, - /* 610 */ 1913, 48, 4, 349, 58, 1333, 81, 1757, 602, 547, - /* 620 */ 11, 393, 9, 1863, 355, 601, 1413, 1759, 1331, 1913, - /* 630 */ 8, 403, 154, 128, 319, 2055, 1953, 602, 1707, 547, - /* 640 */ 1574, 1709, 1863, 1757, 601, 1542, 1893, 463, 1707, 1408, - /* 650 */ 1929, 417, 692, 533, 158, 1894, 1896, 605, 1898, 1899, - /* 660 */ 600, 1339, 595, 1480, 2050, 1893, 1415, 1416, 1707, 1929, - /* 670 */ 530, 547, 573, 97, 1894, 1896, 605, 1898, 1899, 600, - /* 680 */ 2054, 595, 1863, 418, 2051, 2052, 2070, 8, 1982, 549, - /* 690 */ 514, 1954, 342, 1978, 1759, 552, 2019, 663, 661, 2050, - /* 700 */ 1707, 2050, 2016, 512, 1683, 510, 551, 11, 1954, 692, - /* 710 */ 1758, 1334, 266, 1332, 2056, 171, 572, 171, 1358, 2051, - /* 720 */ 574, 2051, 574, 1415, 1416, 37, 36, 13, 12, 43, - /* 730 */ 41, 40, 39, 38, 1850, 1337, 1338, 1361, 1388, 1389, - /* 740 */ 1391, 1392, 1393, 1394, 1395, 1396, 1397, 1398, 597, 593, - /* 750 */ 1406, 1407, 1409, 1410, 1411, 1412, 1414, 1417, 3, 1556, - /* 760 */ 174, 1339, 1360, 1800, 638, 1806, 1800, 307, 1334, 651, - /* 770 */ 1332, 1677, 87, 325, 180, 650, 174, 183, 1573, 525, - /* 780 */ 1805, 371, 307, 119, 118, 117, 116, 115, 114, 113, - /* 790 */ 112, 111, 1337, 1338, 1700, 1388, 1389, 1391, 1392, 1393, - /* 800 */ 1394, 1395, 1396, 1397, 1398, 597, 593, 1406, 1407, 1409, - /* 810 */ 1410, 1411, 1412, 1414, 1417, 3, 44, 42, 578, 547, - /* 820 */ 1863, 1456, 634, 362, 349, 1750, 1333, 1997, 1997, 635, - /* 830 */ 1696, 461, 1750, 326, 1572, 324, 323, 1413, 486, 1331, - /* 840 */ 530, 361, 488, 94, 488, 1361, 37, 36, 1707, 1895, - /* 850 */ 43, 41, 40, 39, 38, 1993, 1992, 127, 530, 547, - /* 860 */ 1408, 1692, 2054, 547, 487, 1699, 487, 1571, 1895, 2050, - /* 870 */ 547, 462, 1339, 44, 42, 1704, 1863, 1694, 1913, 243, - /* 880 */ 143, 349, 137, 1333, 2056, 171, 602, 2050, 1707, 2051, - /* 890 */ 574, 1863, 1707, 601, 1413, 1690, 1331, 1913, 8, 1707, - /* 900 */ 1479, 1390, 2056, 171, 266, 602, 580, 2051, 574, 1863, - /* 910 */ 1863, 223, 601, 279, 1893, 1570, 1737, 1408, 1929, 547, - /* 920 */ 692, 1895, 159, 1894, 1896, 605, 1898, 1899, 600, 1339, - /* 930 */ 595, 526, 51, 1893, 1415, 1416, 1567, 1929, 1566, 547, - /* 940 */ 1608, 97, 1894, 1896, 605, 1898, 1899, 600, 1707, 595, - /* 950 */ 1913, 531, 50, 529, 2070, 1, 1982, 1863, 602, 547, - /* 960 */ 342, 1978, 501, 1863, 547, 601, 210, 596, 1707, 208, - /* 970 */ 2044, 237, 547, 629, 575, 2071, 543, 692, 1863, 1334, - /* 980 */ 1863, 1332, 1682, 592, 545, 1661, 1893, 242, 1707, 402, - /* 990 */ 1929, 1415, 1416, 1707, 159, 1894, 1896, 605, 1898, 1899, - /* 1000 */ 600, 1707, 595, 1337, 1338, 1549, 1388, 1389, 1391, 1392, - /* 1010 */ 1393, 1394, 1395, 1396, 1397, 1398, 597, 593, 1406, 1407, - /* 1020 */ 1409, 1410, 1411, 1412, 1414, 1417, 3, 37, 36, 205, - /* 1030 */ 547, 43, 41, 40, 39, 38, 1334, 72, 1332, 1551, - /* 1040 */ 1552, 212, 546, 161, 211, 1565, 2022, 2072, 480, 476, - /* 1050 */ 472, 468, 204, 1564, 214, 13, 12, 213, 1342, 1707, - /* 1060 */ 1337, 1338, 1618, 1388, 1389, 1391, 1392, 1393, 1394, 1395, - /* 1070 */ 1396, 1397, 1398, 597, 593, 1406, 1407, 1409, 1410, 1411, - /* 1080 */ 1412, 1414, 1417, 3, 309, 1569, 1356, 1863, 636, 78, - /* 1090 */ 226, 216, 202, 425, 215, 1863, 436, 1603, 37, 36, - /* 1100 */ 1548, 481, 43, 41, 40, 39, 38, 145, 144, 633, - /* 1110 */ 632, 631, 261, 410, 1519, 437, 576, 412, 1563, 503, - /* 1120 */ 1341, 1434, 1562, 1561, 581, 669, 668, 667, 666, 359, - /* 1130 */ 80, 665, 664, 133, 659, 658, 657, 656, 655, 654, - /* 1140 */ 653, 652, 147, 648, 647, 646, 358, 357, 643, 642, - /* 1150 */ 641, 640, 639, 155, 201, 195, 1560, 200, 285, 322, - /* 1160 */ 1863, 459, 37, 36, 1863, 1863, 43, 41, 40, 39, - /* 1170 */ 38, 398, 283, 66, 1601, 45, 65, 193, 255, 231, - /* 1180 */ 561, 138, 142, 1914, 1559, 1499, 143, 360, 60, 1592, - /* 1190 */ 1747, 247, 189, 442, 440, 1895, 506, 26, 1863, 435, - /* 1200 */ 1345, 60, 430, 429, 428, 427, 424, 423, 422, 421, - /* 1210 */ 420, 416, 415, 414, 413, 407, 406, 405, 404, 2012, - /* 1220 */ 400, 399, 321, 547, 1913, 263, 1863, 1282, 45, 58, - /* 1230 */ 1106, 235, 602, 540, 239, 268, 1597, 1863, 1179, 601, - /* 1240 */ 1506, 37, 36, 250, 32, 43, 41, 40, 39, 38, - /* 1250 */ 37, 36, 1707, 1450, 43, 41, 40, 39, 38, 260, - /* 1260 */ 1893, 586, 1344, 1107, 1929, 1884, 547, 96, 97, 1894, - /* 1270 */ 1896, 605, 1898, 1899, 600, 2, 595, 1895, 356, 129, - /* 1280 */ 1399, 141, 1953, 1982, 687, 37, 36, 342, 1978, 43, - /* 1290 */ 41, 40, 39, 38, 315, 1707, 45, 609, 93, 5, - /* 1300 */ 365, 518, 71, 70, 391, 370, 1913, 178, 90, 142, - /* 1310 */ 1298, 332, 143, 1886, 602, 644, 645, 122, 530, 1863, - /* 1320 */ 320, 601, 142, 275, 308, 182, 1356, 379, 1895, 377, - /* 1330 */ 373, 369, 366, 363, 397, 401, 1442, 1126, 1124, 419, - /* 1340 */ 1802, 426, 1893, 433, 585, 432, 1929, 2050, 278, 1207, - /* 1350 */ 301, 1894, 1896, 605, 1898, 1899, 600, 1913, 595, 434, - /* 1360 */ 585, 1211, 2056, 171, 1218, 589, 186, 2051, 574, 1216, - /* 1370 */ 1863, 439, 601, 132, 146, 174, 438, 441, 443, 1362, - /* 1380 */ 444, 452, 1364, 455, 192, 456, 1363, 194, 1365, 132, - /* 1390 */ 1443, 457, 458, 1893, 460, 197, 199, 1929, 464, 75, - /* 1400 */ 76, 97, 1894, 1896, 605, 1898, 1899, 600, 203, 595, - /* 1410 */ 130, 483, 99, 311, 168, 1841, 1982, 517, 485, 519, - /* 1420 */ 342, 1978, 1697, 207, 1693, 276, 130, 209, 148, 149, - /* 1430 */ 1695, 1691, 170, 1990, 1991, 150, 1995, 151, 221, 153, - /* 1440 */ 520, 2009, 521, 224, 527, 532, 1895, 524, 172, 1990, - /* 1450 */ 1991, 228, 1995, 331, 559, 535, 1840, 1812, 538, 139, - /* 1460 */ 33, 346, 1437, 1438, 1439, 1440, 1441, 1445, 1446, 1447, - /* 1470 */ 1448, 140, 333, 541, 542, 1913, 84, 86, 277, 1708, - /* 1480 */ 1361, 555, 562, 602, 2013, 2028, 245, 557, 1863, 558, - /* 1490 */ 601, 338, 2023, 565, 2027, 249, 571, 6, 553, 259, - /* 1500 */ 556, 162, 554, 2004, 339, 582, 579, 1476, 131, 2073, - /* 1510 */ 1360, 1893, 57, 1895, 88, 1929, 607, 1751, 1963, 97, - /* 1520 */ 1894, 1896, 605, 1898, 1899, 600, 1678, 595, 257, 254, - /* 1530 */ 256, 258, 2070, 1998, 1982, 1895, 280, 688, 342, 1978, - /* 1540 */ 271, 689, 1913, 691, 49, 2049, 306, 262, 2001, 292, - /* 1550 */ 602, 282, 303, 284, 302, 1863, 68, 601, 1857, 1856, - /* 1560 */ 1855, 1854, 69, 1851, 1913, 367, 368, 1325, 1326, 177, - /* 1570 */ 372, 1849, 602, 374, 375, 376, 1848, 1863, 1893, 601, - /* 1580 */ 378, 1847, 1929, 380, 1846, 1845, 97, 1894, 1896, 605, - /* 1590 */ 1898, 1899, 600, 1895, 595, 1823, 382, 384, 1301, 1957, - /* 1600 */ 1893, 1982, 1300, 1822, 1929, 342, 1978, 389, 97, 1894, - /* 1610 */ 1896, 605, 1898, 1899, 600, 1895, 595, 390, 1821, 345, - /* 1620 */ 344, 1955, 1913, 1982, 1820, 1270, 1795, 342, 1978, 1347, - /* 1630 */ 602, 1794, 1792, 134, 1791, 1863, 135, 601, 1790, 1793, - /* 1640 */ 1413, 1789, 1340, 1788, 1913, 1787, 1786, 1785, 1784, 409, - /* 1650 */ 408, 1783, 602, 411, 1782, 1781, 1780, 1863, 1893, 601, - /* 1660 */ 1779, 1778, 1929, 1408, 1777, 1776, 97, 1894, 1896, 605, - /* 1670 */ 1898, 1899, 600, 1775, 595, 1339, 1774, 1773, 1772, 550, - /* 1680 */ 1893, 1982, 1771, 1770, 1929, 342, 1978, 1154, 98, 1894, - /* 1690 */ 1896, 605, 1898, 1899, 600, 1769, 595, 1768, 1767, 136, - /* 1700 */ 1766, 1765, 1764, 1982, 1763, 1762, 1272, 1981, 1978, 1761, - /* 1710 */ 1760, 1623, 1622, 1620, 187, 188, 1588, 190, 123, 1587, - /* 1720 */ 1069, 1068, 1895, 591, 166, 124, 448, 1836, 191, 1830, - /* 1730 */ 1819, 450, 196, 198, 1818, 1804, 1686, 1619, 1617, 466, - /* 1740 */ 1615, 470, 467, 465, 1613, 1611, 474, 1600, 1599, 469, - /* 1750 */ 1584, 1913, 1099, 473, 471, 477, 475, 1688, 1222, 602, - /* 1760 */ 1687, 479, 1609, 1221, 1863, 59, 601, 206, 478, 660, - /* 1770 */ 1604, 1143, 1602, 504, 1145, 662, 1136, 1144, 1142, 1583, - /* 1780 */ 1582, 1141, 1348, 327, 1343, 328, 1138, 1893, 1137, 1581, - /* 1790 */ 1895, 1929, 53, 1135, 507, 98, 1894, 1896, 605, 1898, - /* 1800 */ 1899, 600, 1835, 595, 329, 513, 1351, 1353, 509, 1895, - /* 1810 */ 1982, 511, 100, 1307, 590, 1978, 1829, 522, 152, 1913, - /* 1820 */ 593, 1406, 1407, 1409, 1410, 1411, 1412, 599, 1317, 523, - /* 1830 */ 225, 1817, 1863, 1815, 601, 2055, 330, 1816, 1913, 1814, - /* 1840 */ 1813, 1315, 1811, 1803, 83, 241, 602, 230, 1425, 25, - /* 1850 */ 18, 1863, 19, 601, 10, 1893, 536, 20, 236, 1929, - /* 1860 */ 528, 15, 82, 300, 1894, 1896, 605, 1898, 1899, 600, - /* 1870 */ 598, 595, 548, 1947, 1893, 85, 1895, 56, 1929, 90, - /* 1880 */ 27, 244, 98, 1894, 1896, 605, 1898, 1899, 600, 1521, - /* 1890 */ 595, 539, 246, 1895, 248, 1424, 1503, 1982, 1505, 1498, - /* 1900 */ 252, 160, 1979, 29, 251, 1913, 28, 253, 1884, 89, - /* 1910 */ 61, 22, 21, 599, 1541, 1542, 1536, 1535, 1863, 340, - /* 1920 */ 601, 1540, 1913, 238, 1539, 341, 265, 12, 55, 54, - /* 1930 */ 602, 1473, 1349, 16, 1883, 1863, 1895, 601, 163, 1472, - /* 1940 */ 1932, 1893, 164, 1403, 594, 1929, 1401, 35, 14, 300, - /* 1950 */ 1894, 1896, 605, 1898, 1899, 600, 1895, 595, 1893, 1948, - /* 1960 */ 1400, 23, 1929, 175, 1373, 1913, 158, 1894, 1896, 605, - /* 1970 */ 1898, 1899, 600, 602, 595, 1381, 1435, 24, 1863, 606, - /* 1980 */ 601, 608, 1208, 351, 612, 1913, 1205, 610, 613, 604, - /* 1990 */ 347, 615, 1202, 602, 616, 618, 1196, 619, 1863, 1194, - /* 2000 */ 601, 1893, 621, 622, 1185, 1929, 1217, 1895, 2020, 296, - /* 2010 */ 1894, 1896, 605, 1898, 1899, 600, 1200, 595, 628, 269, - /* 2020 */ 1199, 1893, 91, 1198, 1197, 1929, 92, 67, 1213, 301, - /* 2030 */ 1894, 1896, 605, 1898, 1899, 600, 1913, 595, 1132, 1097, - /* 2040 */ 637, 350, 1131, 1130, 602, 1129, 1128, 1127, 1125, 1863, - /* 2050 */ 1123, 601, 1122, 570, 1121, 1152, 649, 270, 1119, 1118, - /* 2060 */ 1117, 1116, 1115, 1114, 1113, 1112, 1149, 1147, 1109, 1108, - /* 2070 */ 1105, 1104, 1893, 1103, 1102, 1616, 1929, 670, 671, 1614, - /* 2080 */ 301, 1894, 1896, 605, 1898, 1899, 600, 1895, 595, 672, - /* 2090 */ 674, 675, 676, 1612, 678, 679, 680, 1610, 682, 683, - /* 2100 */ 684, 1598, 686, 1059, 1580, 1895, 273, 690, 1555, 1335, - /* 2110 */ 281, 693, 694, 1555, 1555, 1555, 1913, 1555, 1555, 1555, - /* 2120 */ 1555, 1555, 1555, 1555, 602, 1555, 1555, 1555, 1555, 1863, - /* 2130 */ 1555, 601, 1555, 1555, 1913, 1555, 1555, 1555, 1555, 1555, - /* 2140 */ 1555, 1555, 602, 1555, 1555, 1555, 1555, 1863, 1895, 601, - /* 2150 */ 1555, 1555, 516, 1555, 1555, 1555, 1929, 1555, 1555, 1555, - /* 2160 */ 294, 1894, 1896, 605, 1898, 1899, 600, 1895, 595, 1555, - /* 2170 */ 1893, 1555, 1555, 1555, 1929, 1555, 1555, 1913, 286, 1894, - /* 2180 */ 1896, 605, 1898, 1899, 600, 602, 595, 1555, 1555, 1555, - /* 2190 */ 1863, 1895, 601, 1555, 1555, 1555, 1913, 1555, 1555, 1555, - /* 2200 */ 1555, 1555, 1555, 1555, 602, 1555, 1555, 1555, 1555, 1863, - /* 2210 */ 1555, 601, 1555, 1893, 1555, 1555, 1555, 1929, 1555, 1555, - /* 2220 */ 1913, 287, 1894, 1896, 605, 1898, 1899, 600, 602, 595, - /* 2230 */ 1555, 1555, 1893, 1863, 1895, 601, 1929, 1555, 1555, 1555, - /* 2240 */ 288, 1894, 1896, 605, 1898, 1899, 600, 1555, 595, 1555, - /* 2250 */ 1555, 1895, 1555, 1555, 1555, 1555, 1893, 1555, 1555, 1555, - /* 2260 */ 1929, 1555, 1555, 1913, 295, 1894, 1896, 605, 1898, 1899, - /* 2270 */ 600, 602, 595, 1555, 1555, 1555, 1863, 1895, 601, 1555, - /* 2280 */ 1913, 1555, 1555, 1555, 1555, 1555, 1555, 1555, 602, 1555, - /* 2290 */ 1555, 1555, 1555, 1863, 1895, 601, 1555, 1555, 1555, 1893, - /* 2300 */ 1555, 1555, 1555, 1929, 1555, 1555, 1913, 297, 1894, 1896, - /* 2310 */ 605, 1898, 1899, 600, 602, 595, 1893, 1555, 1555, 1863, - /* 2320 */ 1929, 601, 1555, 1913, 289, 1894, 1896, 605, 1898, 1899, - /* 2330 */ 600, 602, 595, 1555, 1555, 1555, 1863, 1555, 601, 1555, - /* 2340 */ 1555, 1555, 1893, 1555, 1555, 1555, 1929, 1555, 1555, 1555, - /* 2350 */ 298, 1894, 1896, 605, 1898, 1899, 600, 1895, 595, 1893, - /* 2360 */ 1555, 1555, 1555, 1929, 1555, 1555, 1555, 290, 1894, 1896, - /* 2370 */ 605, 1898, 1899, 600, 1895, 595, 1555, 1555, 1555, 1555, - /* 2380 */ 1555, 1555, 1555, 1555, 1555, 1555, 1913, 1555, 1555, 1555, - /* 2390 */ 1555, 1555, 1555, 1555, 602, 1555, 1555, 1555, 1555, 1863, - /* 2400 */ 1555, 601, 1555, 1913, 1555, 1555, 1555, 1555, 1555, 1555, - /* 2410 */ 1555, 602, 1555, 1555, 1555, 1555, 1863, 1555, 601, 1555, - /* 2420 */ 1555, 1555, 1893, 1555, 1555, 1555, 1929, 1555, 1555, 1555, - /* 2430 */ 299, 1894, 1896, 605, 1898, 1899, 600, 1895, 595, 1893, - /* 2440 */ 1555, 1555, 1555, 1929, 1555, 1555, 1555, 291, 1894, 1896, - /* 2450 */ 605, 1898, 1899, 600, 1555, 595, 1555, 1555, 1555, 1555, - /* 2460 */ 1555, 1555, 1555, 1895, 1555, 1555, 1913, 1555, 1555, 1555, - /* 2470 */ 1555, 1555, 1555, 1555, 602, 1555, 1555, 1555, 1555, 1863, - /* 2480 */ 1555, 601, 1555, 1555, 1555, 1555, 1555, 1555, 1555, 1555, - /* 2490 */ 1555, 1555, 1913, 1555, 1555, 1555, 1555, 1555, 1555, 1555, - /* 2500 */ 602, 1555, 1893, 1555, 1555, 1863, 1929, 601, 1555, 1555, - /* 2510 */ 304, 1894, 1896, 605, 1898, 1899, 600, 1895, 595, 1555, - /* 2520 */ 1555, 1555, 1555, 1555, 1555, 1555, 1555, 1555, 1893, 1555, - /* 2530 */ 1555, 1555, 1929, 1555, 1895, 1555, 305, 1894, 1896, 605, - /* 2540 */ 1898, 1899, 600, 1555, 595, 1555, 1913, 1555, 1555, 1555, - /* 2550 */ 1555, 1555, 1555, 1555, 602, 1555, 1555, 1555, 1555, 1863, - /* 2560 */ 1555, 601, 1555, 1913, 1555, 1555, 1555, 1555, 1555, 1555, - /* 2570 */ 1555, 602, 1555, 1555, 1555, 1555, 1863, 1895, 601, 1555, - /* 2580 */ 1555, 1555, 1893, 1555, 1555, 1555, 1929, 1555, 1555, 1555, - /* 2590 */ 1907, 1894, 1896, 605, 1898, 1899, 600, 1895, 595, 1893, - /* 2600 */ 1555, 1555, 1555, 1929, 1555, 1555, 1913, 1906, 1894, 1896, - /* 2610 */ 605, 1898, 1899, 600, 602, 595, 1555, 1555, 1555, 1863, - /* 2620 */ 1555, 601, 1555, 1555, 1555, 1555, 1913, 1555, 1555, 1555, - /* 2630 */ 1555, 1555, 1555, 1555, 602, 1555, 1555, 1555, 1555, 1863, - /* 2640 */ 1895, 601, 1893, 1555, 1555, 1555, 1929, 1555, 1555, 1555, - /* 2650 */ 1905, 1894, 1896, 605, 1898, 1899, 600, 1895, 595, 1555, - /* 2660 */ 1555, 1555, 1893, 1555, 1555, 1555, 1929, 1555, 1555, 1913, - /* 2670 */ 316, 1894, 1896, 605, 1898, 1899, 600, 602, 595, 1555, - /* 2680 */ 1555, 1555, 1863, 1555, 601, 1555, 1913, 1555, 1555, 1555, - /* 2690 */ 1555, 1555, 1555, 1555, 602, 1555, 1555, 1555, 1555, 1863, - /* 2700 */ 1555, 601, 1555, 1555, 1555, 1893, 1555, 1555, 1555, 1929, - /* 2710 */ 1555, 1555, 1555, 317, 1894, 1896, 605, 1898, 1899, 600, - /* 2720 */ 1895, 595, 1893, 1555, 1555, 1555, 1929, 1555, 1555, 1555, - /* 2730 */ 313, 1894, 1896, 605, 1898, 1899, 600, 1895, 595, 1555, - /* 2740 */ 1555, 1555, 1555, 1555, 1555, 1555, 1555, 1555, 1555, 1913, - /* 2750 */ 1555, 1555, 1555, 1555, 1555, 1555, 1555, 602, 1555, 1555, - /* 2760 */ 1555, 1555, 1863, 1555, 601, 1555, 1913, 1555, 1555, 1555, - /* 2770 */ 1555, 1555, 1555, 1555, 602, 1555, 1555, 1555, 1555, 1863, - /* 2780 */ 1555, 601, 1555, 1555, 1555, 1893, 1555, 1555, 1555, 1929, - /* 2790 */ 1555, 1555, 1555, 318, 1894, 1896, 605, 1898, 1899, 600, - /* 2800 */ 1555, 595, 1893, 1555, 1555, 1555, 1929, 1555, 1555, 1555, - /* 2810 */ 293, 1894, 1896, 605, 1898, 1899, 600, 1555, 595, + /* 0 */ 1885, 34, 268, 1885, 157, 1064, 1571, 1899, 62, 536, + /* 10 */ 1701, 1881, 44, 42, 1881, 448, 336, 449, 1594, 1811, + /* 20 */ 351, 1881, 1336, 43, 41, 40, 39, 38, 590, 156, + /* 30 */ 167, 1557, 1361, 1416, 1663, 1334, 1917, 1877, 1883, 339, + /* 40 */ 1877, 1883, 345, 1749, 591, 1068, 1069, 1877, 1883, 1867, + /* 50 */ 597, 603, 30, 597, 447, 1582, 1411, 451, 37, 36, + /* 60 */ 597, 17, 43, 41, 40, 39, 38, 1899, 1342, 44, + /* 70 */ 42, 1486, 1897, 1581, 507, 590, 1933, 351, 575, 1336, + /* 80 */ 97, 1898, 1900, 607, 1902, 1903, 602, 77, 597, 517, + /* 90 */ 1416, 366, 1334, 168, 1, 1986, 1917, 1867, 58, 344, + /* 100 */ 1982, 125, 46, 219, 604, 587, 58, 2054, 532, 1867, + /* 110 */ 1705, 603, 173, 1411, 536, 1867, 694, 510, 17, 1580, + /* 120 */ 2012, 504, 574, 171, 1812, 1342, 218, 2055, 576, 1362, + /* 130 */ 1418, 1419, 605, 2059, 132, 587, 1933, 2054, 396, 1579, + /* 140 */ 98, 350, 1900, 607, 1902, 1903, 602, 456, 597, 449, + /* 150 */ 1594, 1, 2060, 171, 1081, 1986, 1080, 2055, 576, 315, + /* 160 */ 1982, 1867, 2054, 64, 132, 7, 63, 58, 1490, 484, + /* 170 */ 2054, 130, 337, 694, 1361, 1337, 311, 1335, 2058, 220, + /* 180 */ 154, 1867, 2055, 2057, 1082, 574, 171, 1418, 1419, 1712, + /* 190 */ 2055, 576, 589, 169, 1994, 1995, 1362, 1999, 465, 1340, + /* 200 */ 1341, 121, 1391, 1392, 1394, 1395, 1396, 1397, 1398, 1399, + /* 210 */ 1400, 1401, 599, 595, 1409, 1410, 1412, 1413, 1414, 1415, + /* 220 */ 1417, 1420, 3, 265, 1994, 586, 1687, 585, 1756, 1757, + /* 230 */ 2054, 1426, 1337, 385, 1335, 79, 313, 1361, 390, 539, + /* 240 */ 174, 1512, 498, 497, 174, 574, 171, 389, 174, 388, + /* 250 */ 2055, 576, 174, 387, 383, 532, 1340, 1341, 58, 1391, + /* 260 */ 1392, 1394, 1395, 1396, 1397, 1398, 1399, 1400, 1401, 599, + /* 270 */ 595, 1409, 1410, 1412, 1413, 1414, 1415, 1417, 1420, 3, + /* 280 */ 44, 42, 697, 182, 2054, 234, 235, 1361, 351, 77, + /* 290 */ 1336, 562, 1510, 1511, 1513, 1514, 275, 549, 1899, 2060, + /* 300 */ 171, 1416, 549, 1334, 2055, 576, 1230, 1231, 2059, 52, + /* 310 */ 165, 1886, 1706, 174, 120, 687, 683, 679, 675, 273, + /* 320 */ 74, 486, 1881, 73, 1411, 221, 1710, 1917, 1740, 17, + /* 330 */ 356, 1710, 638, 1755, 1757, 604, 1342, 44, 42, 1081, + /* 340 */ 1867, 1080, 603, 313, 590, 351, 539, 1336, 1877, 1883, + /* 350 */ 565, 145, 144, 635, 634, 633, 95, 1393, 1416, 241, + /* 360 */ 1334, 597, 1, 605, 453, 1479, 549, 1933, 638, 1082, + /* 370 */ 1359, 295, 350, 1900, 607, 1902, 1903, 602, 120, 597, + /* 380 */ 47, 1411, 1560, 397, 694, 491, 17, 145, 144, 635, + /* 390 */ 634, 633, 546, 1342, 455, 1710, 398, 451, 1418, 1419, + /* 400 */ 1545, 2054, 1336, 110, 174, 433, 109, 108, 107, 106, + /* 410 */ 105, 104, 103, 102, 101, 1334, 574, 171, 46, 1, + /* 420 */ 1393, 2055, 576, 110, 230, 549, 109, 108, 107, 106, + /* 430 */ 105, 104, 103, 102, 101, 571, 566, 176, 502, 501, + /* 440 */ 500, 694, 1308, 1337, 223, 1335, 126, 496, 1342, 1578, + /* 450 */ 154, 495, 494, 1762, 1710, 1418, 1419, 493, 499, 1713, + /* 460 */ 338, 186, 185, 492, 1148, 1068, 1069, 1340, 1341, 1760, + /* 470 */ 1391, 1392, 1394, 1395, 1396, 1397, 1398, 1399, 1400, 1401, + /* 480 */ 599, 595, 1409, 1410, 1412, 1413, 1414, 1415, 1417, 1420, + /* 490 */ 3, 1867, 11, 40, 39, 38, 694, 1150, 2006, 1479, + /* 500 */ 1337, 1624, 1335, 233, 570, 1447, 1188, 629, 628, 627, + /* 510 */ 1192, 626, 1194, 1195, 625, 1197, 622, 640, 1203, 619, + /* 520 */ 1205, 1206, 616, 613, 1340, 1341, 174, 1391, 1392, 1394, + /* 530 */ 1395, 1396, 1397, 1398, 1399, 1400, 1401, 599, 595, 1409, + /* 540 */ 1410, 1412, 1413, 1414, 1415, 1417, 1420, 3, 44, 42, + /* 550 */ 1804, 354, 1917, 2059, 2001, 1337, 351, 1335, 1336, 154, + /* 560 */ 569, 179, 1314, 1315, 502, 501, 500, 632, 1712, 1416, + /* 570 */ 1363, 1334, 126, 496, 549, 31, 228, 495, 494, 1340, + /* 580 */ 1341, 1899, 1998, 493, 499, 1452, 394, 1688, 1814, 492, + /* 590 */ 37, 36, 1411, 1360, 43, 41, 40, 39, 38, 568, + /* 600 */ 1899, 1762, 1342, 1710, 1342, 44, 42, 1421, 355, 549, + /* 610 */ 1917, 48, 4, 351, 58, 1336, 81, 1760, 604, 549, + /* 620 */ 11, 395, 9, 1867, 357, 603, 1416, 1762, 1334, 1917, + /* 630 */ 8, 405, 154, 128, 320, 2059, 1957, 604, 1710, 549, + /* 640 */ 1577, 1712, 1867, 1760, 603, 1545, 1897, 465, 1710, 1411, + /* 650 */ 1933, 419, 694, 535, 158, 1898, 1900, 607, 1902, 1903, + /* 660 */ 602, 1342, 597, 1483, 2054, 1897, 1418, 1419, 1710, 1933, + /* 670 */ 532, 549, 575, 97, 1898, 1900, 607, 1902, 1903, 602, + /* 680 */ 2058, 597, 1867, 420, 2055, 2056, 2074, 8, 1986, 551, + /* 690 */ 516, 1958, 344, 1982, 1762, 554, 2023, 665, 663, 2054, + /* 700 */ 1710, 2054, 2020, 514, 1686, 512, 553, 11, 1958, 694, + /* 710 */ 1761, 1337, 267, 1335, 2060, 171, 574, 171, 1361, 2055, + /* 720 */ 576, 2055, 576, 1418, 1419, 37, 36, 13, 12, 43, + /* 730 */ 41, 40, 39, 38, 1854, 1340, 1341, 1364, 1391, 1392, + /* 740 */ 1394, 1395, 1396, 1397, 1398, 1399, 1400, 1401, 599, 595, + /* 750 */ 1409, 1410, 1412, 1413, 1414, 1415, 1417, 1420, 3, 1559, + /* 760 */ 174, 652, 1363, 1804, 640, 1810, 1804, 308, 1337, 653, + /* 770 */ 1335, 1680, 87, 327, 180, 1699, 174, 184, 1576, 527, + /* 780 */ 1809, 373, 308, 119, 118, 117, 116, 115, 114, 113, + /* 790 */ 112, 111, 1340, 1341, 1703, 1391, 1392, 1394, 1395, 1396, + /* 800 */ 1397, 1398, 1399, 1400, 1401, 599, 595, 1409, 1410, 1412, + /* 810 */ 1413, 1414, 1415, 1417, 1420, 3, 44, 42, 1791, 549, + /* 820 */ 1867, 1459, 636, 364, 351, 1753, 1336, 2001, 2001, 637, + /* 830 */ 579, 463, 1753, 328, 1575, 326, 325, 1416, 488, 1334, + /* 840 */ 532, 363, 490, 94, 490, 1364, 37, 36, 1710, 1899, + /* 850 */ 43, 41, 40, 39, 38, 1997, 1996, 127, 532, 549, + /* 860 */ 1411, 1695, 2058, 549, 489, 1702, 489, 1574, 1899, 2054, + /* 870 */ 549, 464, 1342, 44, 42, 1707, 1867, 1697, 1917, 244, + /* 880 */ 143, 351, 137, 1336, 2060, 171, 604, 2054, 1710, 2055, + /* 890 */ 576, 1867, 1710, 603, 1416, 1693, 1334, 1917, 8, 1710, + /* 900 */ 1482, 1393, 2060, 171, 267, 604, 224, 2055, 576, 1867, + /* 910 */ 1867, 598, 603, 280, 1897, 1573, 1740, 1411, 1933, 549, + /* 920 */ 694, 1899, 159, 1898, 1900, 607, 1902, 1903, 602, 1342, + /* 930 */ 597, 528, 51, 1897, 1418, 1419, 1570, 1933, 1569, 549, + /* 940 */ 1611, 97, 1898, 1900, 607, 1902, 1903, 602, 1710, 597, + /* 950 */ 1917, 533, 50, 531, 2074, 1, 1986, 1867, 604, 549, + /* 960 */ 344, 1982, 503, 1867, 549, 603, 414, 631, 1710, 582, + /* 970 */ 2048, 238, 549, 93, 577, 2075, 545, 694, 1867, 1337, + /* 980 */ 1867, 1335, 1685, 90, 547, 1664, 1897, 243, 1710, 404, + /* 990 */ 1933, 1418, 1419, 1710, 159, 1898, 1900, 607, 1902, 1903, + /* 1000 */ 602, 1710, 597, 1340, 1341, 1552, 1391, 1392, 1394, 1395, + /* 1010 */ 1396, 1397, 1398, 1399, 1400, 1401, 599, 595, 1409, 1410, + /* 1020 */ 1412, 1413, 1414, 1415, 1417, 1420, 3, 37, 36, 206, + /* 1030 */ 549, 43, 41, 40, 39, 38, 1337, 72, 1335, 1554, + /* 1040 */ 1555, 211, 548, 161, 209, 1568, 580, 2076, 482, 478, + /* 1050 */ 474, 470, 205, 1567, 213, 13, 12, 212, 1572, 1710, + /* 1060 */ 1340, 1341, 1621, 1391, 1392, 1394, 1395, 1396, 1397, 1398, + /* 1070 */ 1399, 1400, 1401, 599, 595, 1409, 1410, 1412, 1413, 1414, + /* 1080 */ 1415, 1417, 1420, 3, 310, 262, 1359, 1867, 638, 78, + /* 1090 */ 227, 215, 203, 427, 214, 1867, 438, 1606, 37, 36, + /* 1100 */ 1551, 2026, 43, 41, 40, 39, 38, 145, 144, 635, + /* 1110 */ 634, 633, 563, 411, 1522, 439, 578, 413, 1566, 505, + /* 1120 */ 1345, 217, 1565, 1564, 216, 671, 670, 669, 668, 361, + /* 1130 */ 80, 667, 666, 133, 661, 660, 659, 658, 657, 656, + /* 1140 */ 655, 654, 147, 650, 649, 648, 360, 359, 645, 644, + /* 1150 */ 643, 642, 641, 155, 202, 196, 1563, 201, 286, 323, + /* 1160 */ 1867, 461, 37, 36, 1867, 1867, 43, 41, 40, 39, + /* 1170 */ 38, 400, 284, 66, 1604, 45, 65, 194, 594, 232, + /* 1180 */ 483, 138, 142, 256, 1562, 1502, 143, 583, 60, 1918, + /* 1190 */ 1595, 248, 190, 444, 442, 1899, 508, 26, 1867, 437, + /* 1200 */ 362, 60, 432, 431, 430, 429, 426, 425, 424, 423, + /* 1210 */ 422, 418, 417, 416, 415, 324, 408, 407, 406, 1750, + /* 1220 */ 402, 401, 322, 549, 1917, 2016, 1867, 1285, 45, 58, + /* 1230 */ 1108, 236, 604, 542, 240, 269, 1600, 1867, 1181, 603, + /* 1240 */ 1509, 37, 36, 251, 32, 43, 41, 40, 39, 38, + /* 1250 */ 37, 36, 1710, 1453, 43, 41, 40, 39, 38, 264, + /* 1260 */ 1897, 261, 1348, 1109, 1933, 1888, 549, 96, 97, 1898, + /* 1270 */ 1900, 607, 1902, 1903, 602, 1344, 597, 1899, 358, 129, + /* 1280 */ 1402, 141, 1957, 1986, 689, 37, 36, 344, 1982, 43, + /* 1290 */ 41, 40, 39, 38, 316, 1710, 45, 611, 588, 5, + /* 1300 */ 2, 520, 71, 70, 393, 367, 1917, 178, 372, 142, + /* 1310 */ 1301, 334, 143, 1890, 604, 646, 1437, 122, 532, 1867, + /* 1320 */ 321, 603, 142, 647, 309, 276, 183, 381, 1899, 379, + /* 1330 */ 375, 371, 368, 365, 399, 403, 1445, 1128, 435, 409, + /* 1340 */ 1359, 421, 1897, 1806, 587, 1126, 1933, 2054, 279, 1209, + /* 1350 */ 302, 1898, 1900, 607, 1902, 1903, 602, 1917, 597, 428, + /* 1360 */ 587, 1213, 2060, 171, 1220, 591, 434, 2055, 576, 1218, + /* 1370 */ 1867, 436, 603, 132, 146, 174, 441, 440, 187, 443, + /* 1380 */ 445, 1365, 446, 454, 1367, 457, 458, 193, 195, 132, + /* 1390 */ 1446, 1366, 1368, 1897, 459, 460, 198, 1933, 466, 200, + /* 1400 */ 462, 97, 1898, 1900, 607, 1902, 1903, 602, 75, 597, + /* 1410 */ 130, 76, 204, 485, 168, 99, 1986, 1347, 487, 519, + /* 1420 */ 344, 1982, 1700, 208, 1696, 312, 130, 210, 521, 277, + /* 1430 */ 148, 149, 170, 1994, 1995, 1698, 1999, 1694, 150, 153, + /* 1440 */ 222, 2013, 151, 522, 225, 1845, 1899, 523, 172, 1994, + /* 1450 */ 1995, 529, 1999, 534, 229, 561, 526, 543, 537, 84, + /* 1460 */ 33, 348, 1440, 1441, 1442, 1443, 1444, 1448, 1449, 1450, + /* 1470 */ 1451, 333, 139, 1844, 1816, 1917, 140, 540, 335, 544, + /* 1480 */ 86, 1364, 557, 604, 1711, 278, 2017, 564, 1867, 6, + /* 1490 */ 603, 2027, 2032, 246, 250, 559, 560, 2031, 573, 558, + /* 1500 */ 556, 162, 255, 340, 567, 555, 260, 341, 584, 2008, + /* 1510 */ 581, 1897, 257, 1899, 1479, 1933, 131, 1363, 57, 97, + /* 1520 */ 1898, 1900, 607, 1902, 1903, 602, 88, 597, 258, 1967, + /* 1530 */ 609, 259, 2074, 1754, 1986, 1899, 1681, 2002, 344, 1982, + /* 1540 */ 281, 272, 1917, 690, 2053, 691, 2077, 263, 2005, 693, + /* 1550 */ 604, 307, 49, 293, 283, 1867, 304, 603, 1861, 303, + /* 1560 */ 1860, 68, 1859, 1858, 1917, 285, 69, 1855, 369, 370, + /* 1570 */ 1328, 1329, 604, 177, 374, 1853, 376, 1867, 1897, 603, + /* 1580 */ 377, 378, 1933, 1852, 380, 1851, 97, 1898, 1900, 607, + /* 1590 */ 1902, 1903, 602, 1899, 597, 1850, 382, 1849, 384, 1961, + /* 1600 */ 1897, 1986, 1304, 386, 1933, 344, 1982, 391, 97, 1898, + /* 1610 */ 1900, 607, 1902, 1903, 602, 1899, 597, 1303, 1827, 347, + /* 1620 */ 346, 1959, 1917, 1986, 1826, 392, 1825, 344, 1982, 1350, + /* 1630 */ 604, 1824, 1273, 1799, 1798, 1867, 134, 603, 1796, 1795, + /* 1640 */ 1416, 1794, 1343, 1797, 1917, 135, 1793, 1792, 1790, 1789, + /* 1650 */ 1788, 181, 604, 1787, 410, 1786, 412, 1867, 1897, 603, + /* 1660 */ 1785, 1784, 1933, 1411, 1783, 1782, 97, 1898, 1900, 607, + /* 1670 */ 1902, 1903, 602, 1781, 597, 1342, 1780, 1779, 1778, 552, + /* 1680 */ 1897, 1986, 1777, 1776, 1933, 344, 1982, 136, 98, 1898, + /* 1690 */ 1900, 607, 1902, 1903, 602, 1775, 597, 1774, 1773, 1772, + /* 1700 */ 1771, 1770, 1769, 1986, 1768, 1767, 1275, 1985, 1982, 1766, + /* 1710 */ 1765, 1764, 1763, 1626, 1156, 188, 1625, 1623, 189, 1591, + /* 1720 */ 123, 1071, 1899, 593, 1590, 1840, 450, 191, 1070, 166, + /* 1730 */ 192, 124, 1834, 1823, 452, 197, 199, 1822, 1808, 1689, + /* 1740 */ 1622, 1620, 1618, 467, 1616, 469, 1614, 1603, 1602, 1587, + /* 1750 */ 468, 1917, 1691, 1101, 59, 471, 475, 473, 479, 604, + /* 1760 */ 1690, 1320, 472, 1612, 1867, 477, 603, 481, 207, 476, + /* 1770 */ 1224, 1147, 1223, 1145, 480, 1607, 1605, 662, 1146, 506, + /* 1780 */ 1144, 1586, 1351, 1138, 1346, 100, 329, 1897, 1143, 1140, + /* 1790 */ 1899, 1933, 1139, 1137, 330, 98, 1898, 1900, 607, 1902, + /* 1800 */ 1903, 602, 664, 597, 509, 331, 1354, 1356, 511, 1899, + /* 1810 */ 1986, 1585, 513, 1584, 592, 1982, 515, 1839, 53, 1917, + /* 1820 */ 595, 1409, 1410, 1412, 1413, 1414, 1415, 601, 1310, 1833, + /* 1830 */ 152, 524, 1867, 525, 603, 1821, 1819, 332, 1917, 1820, + /* 1840 */ 2059, 1818, 1817, 1318, 538, 1815, 604, 242, 226, 25, + /* 1850 */ 18, 1867, 1807, 603, 541, 1897, 237, 530, 83, 1933, + /* 1860 */ 1428, 231, 82, 301, 1898, 1900, 607, 1902, 1903, 602, + /* 1870 */ 600, 597, 550, 1951, 1897, 90, 1899, 19, 1933, 10, + /* 1880 */ 85, 1427, 98, 1898, 1900, 607, 1902, 1903, 602, 239, + /* 1890 */ 597, 20, 27, 1899, 1524, 247, 245, 1986, 1506, 249, + /* 1900 */ 56, 1508, 1983, 253, 160, 1917, 252, 15, 28, 254, + /* 1910 */ 1501, 1888, 89, 601, 21, 29, 1544, 1545, 1867, 61, + /* 1920 */ 603, 22, 1917, 1539, 1538, 342, 1543, 1542, 343, 266, + /* 1930 */ 604, 1887, 163, 1476, 12, 1867, 1899, 603, 1475, 55, + /* 1940 */ 1352, 1897, 1384, 1936, 596, 1933, 1406, 164, 1404, 301, + /* 1950 */ 1898, 1900, 607, 1902, 1903, 602, 1899, 597, 1897, 1952, + /* 1960 */ 35, 14, 1933, 1403, 23, 1917, 158, 1898, 1900, 607, + /* 1970 */ 1902, 1903, 602, 604, 597, 175, 1376, 1210, 1867, 1438, + /* 1980 */ 603, 24, 608, 606, 610, 1917, 353, 614, 612, 615, + /* 1990 */ 349, 617, 1207, 604, 1204, 1198, 618, 620, 1867, 621, + /* 2000 */ 603, 1897, 1196, 623, 624, 1933, 1187, 1899, 2024, 297, + /* 2010 */ 1898, 1900, 607, 1902, 1903, 602, 54, 597, 16, 630, + /* 2020 */ 91, 1897, 1202, 1219, 1201, 1933, 1200, 1199, 92, 302, + /* 2030 */ 1898, 1900, 607, 1902, 1903, 602, 1917, 597, 67, 270, + /* 2040 */ 1215, 352, 1099, 639, 604, 1134, 1133, 1132, 1131, 1867, + /* 2050 */ 1130, 603, 1129, 572, 1127, 1125, 1124, 1123, 1154, 271, + /* 2060 */ 651, 1121, 1120, 1119, 1118, 1117, 1116, 1115, 1114, 1151, + /* 2070 */ 1149, 1111, 1897, 1110, 1107, 1106, 1933, 1105, 1619, 1104, + /* 2080 */ 302, 1898, 1900, 607, 1902, 1903, 602, 1899, 597, 673, + /* 2090 */ 674, 672, 1617, 676, 677, 1615, 678, 680, 682, 681, + /* 2100 */ 1613, 684, 686, 1601, 688, 1899, 1061, 685, 1583, 274, + /* 2110 */ 692, 1558, 1338, 282, 695, 1558, 1917, 696, 1558, 1558, + /* 2120 */ 1558, 1558, 1558, 1558, 604, 1558, 1558, 1558, 1558, 1867, + /* 2130 */ 1558, 603, 1558, 1558, 1917, 1558, 1558, 1558, 1558, 1558, + /* 2140 */ 1558, 1558, 604, 1558, 1558, 1558, 1558, 1867, 1899, 603, + /* 2150 */ 1558, 1558, 518, 1558, 1558, 1558, 1933, 1558, 1558, 1558, + /* 2160 */ 295, 1898, 1900, 607, 1902, 1903, 602, 1899, 597, 1558, + /* 2170 */ 1897, 1558, 1558, 1558, 1933, 1558, 1558, 1917, 287, 1898, + /* 2180 */ 1900, 607, 1902, 1903, 602, 604, 597, 1558, 1558, 1558, + /* 2190 */ 1867, 1899, 603, 1558, 1558, 1558, 1917, 1558, 1558, 1558, + /* 2200 */ 1558, 1558, 1558, 1558, 604, 1558, 1558, 1558, 1558, 1867, + /* 2210 */ 1558, 603, 1558, 1897, 1558, 1558, 1558, 1933, 1558, 1558, + /* 2220 */ 1917, 288, 1898, 1900, 607, 1902, 1903, 602, 604, 597, + /* 2230 */ 1558, 1558, 1897, 1867, 1899, 603, 1933, 1558, 1558, 1558, + /* 2240 */ 289, 1898, 1900, 607, 1902, 1903, 602, 1558, 597, 1558, + /* 2250 */ 1558, 1899, 1558, 1558, 1558, 1558, 1897, 1558, 1558, 1558, + /* 2260 */ 1933, 1558, 1558, 1917, 296, 1898, 1900, 607, 1902, 1903, + /* 2270 */ 602, 604, 597, 1558, 1558, 1558, 1867, 1899, 603, 1558, + /* 2280 */ 1917, 1558, 1558, 1558, 1558, 1558, 1558, 1558, 604, 1558, + /* 2290 */ 1558, 1558, 1558, 1867, 1899, 603, 1558, 1558, 1558, 1897, + /* 2300 */ 1558, 1558, 1558, 1933, 1558, 1558, 1917, 298, 1898, 1900, + /* 2310 */ 607, 1902, 1903, 602, 604, 597, 1897, 1558, 1558, 1867, + /* 2320 */ 1933, 603, 1558, 1917, 290, 1898, 1900, 607, 1902, 1903, + /* 2330 */ 602, 604, 597, 1558, 1558, 1558, 1867, 1558, 603, 1558, + /* 2340 */ 1558, 1558, 1897, 1558, 1558, 1558, 1933, 1558, 1558, 1558, + /* 2350 */ 299, 1898, 1900, 607, 1902, 1903, 602, 1899, 597, 1897, + /* 2360 */ 1558, 1558, 1558, 1933, 1558, 1558, 1558, 291, 1898, 1900, + /* 2370 */ 607, 1902, 1903, 602, 1899, 597, 1558, 1558, 1558, 1558, + /* 2380 */ 1558, 1558, 1558, 1558, 1558, 1558, 1917, 1558, 1558, 1558, + /* 2390 */ 1558, 1558, 1558, 1558, 604, 1558, 1558, 1558, 1558, 1867, + /* 2400 */ 1558, 603, 1558, 1917, 1558, 1558, 1558, 1558, 1558, 1558, + /* 2410 */ 1558, 604, 1558, 1558, 1558, 1558, 1867, 1558, 603, 1558, + /* 2420 */ 1558, 1558, 1897, 1558, 1558, 1558, 1933, 1558, 1558, 1558, + /* 2430 */ 300, 1898, 1900, 607, 1902, 1903, 602, 1899, 597, 1897, + /* 2440 */ 1558, 1558, 1558, 1933, 1558, 1558, 1558, 292, 1898, 1900, + /* 2450 */ 607, 1902, 1903, 602, 1558, 597, 1558, 1558, 1558, 1558, + /* 2460 */ 1558, 1558, 1558, 1899, 1558, 1558, 1917, 1558, 1558, 1558, + /* 2470 */ 1558, 1558, 1558, 1558, 604, 1558, 1558, 1558, 1558, 1867, + /* 2480 */ 1558, 603, 1558, 1558, 1558, 1558, 1558, 1558, 1558, 1558, + /* 2490 */ 1558, 1558, 1917, 1558, 1558, 1558, 1558, 1558, 1558, 1558, + /* 2500 */ 604, 1558, 1897, 1558, 1558, 1867, 1933, 603, 1558, 1558, + /* 2510 */ 305, 1898, 1900, 607, 1902, 1903, 602, 1899, 597, 1558, + /* 2520 */ 1558, 1558, 1558, 1558, 1558, 1558, 1558, 1558, 1897, 1558, + /* 2530 */ 1558, 1558, 1933, 1558, 1899, 1558, 306, 1898, 1900, 607, + /* 2540 */ 1902, 1903, 602, 1558, 597, 1558, 1917, 1558, 1558, 1558, + /* 2550 */ 1558, 1558, 1558, 1558, 604, 1558, 1558, 1558, 1558, 1867, + /* 2560 */ 1558, 603, 1558, 1917, 1558, 1558, 1558, 1558, 1558, 1558, + /* 2570 */ 1558, 604, 1558, 1558, 1558, 1558, 1867, 1899, 603, 1558, + /* 2580 */ 1558, 1558, 1897, 1558, 1558, 1558, 1933, 1558, 1558, 1558, + /* 2590 */ 1911, 1898, 1900, 607, 1902, 1903, 602, 1899, 597, 1897, + /* 2600 */ 1558, 1558, 1558, 1933, 1558, 1558, 1917, 1910, 1898, 1900, + /* 2610 */ 607, 1902, 1903, 602, 604, 597, 1558, 1558, 1558, 1867, + /* 2620 */ 1558, 603, 1558, 1558, 1558, 1558, 1917, 1558, 1558, 1558, + /* 2630 */ 1558, 1558, 1558, 1558, 604, 1558, 1558, 1558, 1558, 1867, + /* 2640 */ 1899, 603, 1897, 1558, 1558, 1558, 1933, 1558, 1558, 1558, + /* 2650 */ 1909, 1898, 1900, 607, 1902, 1903, 602, 1899, 597, 1558, + /* 2660 */ 1558, 1558, 1897, 1558, 1558, 1558, 1933, 1558, 1558, 1917, + /* 2670 */ 317, 1898, 1900, 607, 1902, 1903, 602, 604, 597, 1558, + /* 2680 */ 1558, 1558, 1867, 1558, 603, 1558, 1917, 1558, 1558, 1558, + /* 2690 */ 1558, 1558, 1558, 1558, 604, 1558, 1558, 1558, 1558, 1867, + /* 2700 */ 1558, 603, 1558, 1558, 1558, 1897, 1558, 1558, 1558, 1933, + /* 2710 */ 1558, 1558, 1558, 318, 1898, 1900, 607, 1902, 1903, 602, + /* 2720 */ 1899, 597, 1897, 1558, 1558, 1558, 1933, 1558, 1558, 1558, + /* 2730 */ 314, 1898, 1900, 607, 1902, 1903, 602, 1899, 597, 1558, + /* 2740 */ 1558, 1558, 1558, 1558, 1558, 1558, 1558, 1558, 1558, 1917, + /* 2750 */ 1558, 1558, 1558, 1558, 1558, 1558, 1558, 604, 1558, 1558, + /* 2760 */ 1558, 1558, 1867, 1558, 603, 1558, 1917, 1558, 1558, 1558, + /* 2770 */ 1558, 1558, 1558, 1558, 604, 1558, 1558, 1558, 1558, 1867, + /* 2780 */ 1558, 603, 1558, 1558, 1558, 1897, 1558, 1558, 1558, 1933, + /* 2790 */ 1558, 1558, 1558, 319, 1898, 1900, 607, 1902, 1903, 602, + /* 2800 */ 1558, 597, 1897, 1558, 1558, 1558, 1933, 1558, 1558, 1558, + /* 2810 */ 294, 1898, 1900, 607, 1902, 1903, 602, 1558, 597, }; static const YYCODETYPE yy_lookahead[] = { /* 0 */ 351, 409, 410, 351, 319, 4, 321, 320, 4, 364, @@ -562,7 +562,7 @@ static const YYCODETYPE yy_lookahead[] = { /* 570 */ 20, 35, 71, 72, 328, 227, 56, 76, 77, 199, /* 580 */ 200, 320, 419, 82, 83, 237, 340, 0, 0, 88, /* 590 */ 8, 9, 56, 20, 12, 13, 14, 15, 16, 396, - /* 600 */ 320, 349, 43, 357, 68, 12, 13, 14, 356, 328, + /* 600 */ 320, 349, 68, 357, 68, 12, 13, 14, 356, 328, /* 610 */ 349, 42, 43, 20, 94, 22, 96, 365, 357, 328, /* 620 */ 224, 340, 226, 362, 341, 364, 33, 349, 35, 349, /* 630 */ 94, 340, 349, 404, 356, 394, 407, 357, 357, 328, @@ -579,141 +579,141 @@ static const YYCODETYPE yy_lookahead[] = { /* 740 */ 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, /* 750 */ 214, 215, 216, 217, 218, 219, 220, 221, 222, 0, /* 760 */ 240, 68, 20, 357, 60, 373, 357, 375, 175, 337, - /* 770 */ 177, 339, 330, 37, 368, 68, 240, 368, 320, 381, + /* 770 */ 177, 339, 330, 37, 368, 350, 240, 368, 320, 381, /* 780 */ 373, 47, 375, 24, 25, 26, 27, 28, 29, 30, /* 790 */ 31, 32, 199, 200, 352, 202, 203, 204, 205, 206, /* 800 */ 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, - /* 810 */ 217, 218, 219, 220, 221, 222, 12, 13, 259, 328, + /* 810 */ 217, 218, 219, 220, 221, 222, 12, 13, 0, 328, /* 820 */ 362, 95, 359, 377, 20, 362, 22, 391, 391, 359, - /* 830 */ 350, 340, 362, 97, 320, 99, 100, 33, 102, 35, + /* 830 */ 43, 340, 362, 97, 320, 99, 100, 33, 102, 35, /* 840 */ 394, 377, 106, 330, 106, 20, 8, 9, 357, 320, /* 850 */ 12, 13, 14, 15, 16, 419, 419, 344, 394, 328, /* 860 */ 56, 350, 3, 328, 128, 352, 128, 320, 320, 423, /* 870 */ 328, 340, 68, 12, 13, 340, 362, 350, 349, 162, /* 880 */ 43, 20, 340, 22, 438, 439, 357, 423, 357, 443, /* 890 */ 444, 362, 357, 364, 33, 350, 35, 349, 94, 357, - /* 900 */ 241, 203, 438, 439, 162, 357, 43, 443, 444, 362, + /* 900 */ 241, 203, 438, 439, 162, 357, 350, 443, 444, 362, /* 910 */ 362, 350, 364, 342, 385, 320, 345, 56, 389, 328, /* 920 */ 116, 320, 393, 394, 395, 396, 397, 398, 399, 68, /* 930 */ 401, 340, 95, 385, 130, 131, 320, 389, 320, 328, /* 940 */ 0, 393, 394, 395, 396, 397, 398, 399, 357, 401, /* 950 */ 349, 340, 162, 163, 406, 94, 408, 362, 357, 328, - /* 960 */ 412, 413, 22, 362, 328, 364, 98, 350, 357, 101, - /* 970 */ 422, 340, 328, 350, 445, 446, 340, 116, 362, 175, - /* 980 */ 362, 177, 0, 61, 340, 338, 385, 162, 357, 105, + /* 960 */ 412, 413, 22, 362, 328, 364, 148, 350, 357, 43, + /* 970 */ 422, 340, 328, 94, 445, 446, 340, 116, 362, 175, + /* 980 */ 362, 177, 0, 104, 340, 338, 385, 162, 357, 105, /* 990 */ 389, 130, 131, 357, 393, 394, 395, 396, 397, 398, /* 1000 */ 399, 357, 401, 199, 200, 167, 202, 203, 204, 205, /* 1010 */ 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, /* 1020 */ 216, 217, 218, 219, 220, 221, 222, 8, 9, 33, /* 1030 */ 328, 12, 13, 14, 15, 16, 175, 153, 177, 130, - /* 1040 */ 131, 98, 340, 47, 101, 320, 392, 446, 52, 53, - /* 1050 */ 54, 55, 56, 320, 98, 1, 2, 101, 35, 357, + /* 1040 */ 131, 98, 340, 47, 101, 320, 259, 446, 52, 53, + /* 1050 */ 54, 55, 56, 320, 98, 1, 2, 101, 321, 357, /* 1060 */ 199, 200, 0, 202, 203, 204, 205, 206, 207, 208, /* 1070 */ 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, - /* 1080 */ 219, 220, 221, 222, 18, 321, 20, 362, 106, 93, + /* 1080 */ 219, 220, 221, 222, 18, 447, 20, 362, 106, 93, /* 1090 */ 56, 98, 96, 27, 101, 362, 30, 0, 8, 9, - /* 1100 */ 262, 329, 12, 13, 14, 15, 16, 125, 126, 127, - /* 1110 */ 128, 129, 447, 47, 95, 49, 257, 51, 320, 22, - /* 1120 */ 35, 199, 320, 320, 261, 63, 64, 65, 66, 67, + /* 1100 */ 262, 392, 12, 13, 14, 15, 16, 125, 126, 127, + /* 1110 */ 128, 129, 436, 47, 95, 49, 257, 51, 320, 22, + /* 1120 */ 35, 98, 320, 320, 101, 63, 64, 65, 66, 67, /* 1130 */ 96, 69, 70, 71, 72, 73, 74, 75, 76, 77, /* 1140 */ 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, /* 1150 */ 88, 89, 90, 18, 158, 159, 320, 161, 23, 93, /* 1160 */ 362, 165, 8, 9, 362, 362, 12, 13, 14, 15, - /* 1170 */ 16, 105, 37, 38, 0, 43, 41, 181, 430, 43, - /* 1180 */ 436, 43, 43, 349, 320, 95, 43, 329, 43, 327, - /* 1190 */ 361, 43, 57, 58, 59, 320, 22, 43, 362, 133, - /* 1200 */ 177, 43, 136, 137, 138, 139, 140, 141, 142, 143, - /* 1210 */ 144, 145, 146, 147, 148, 149, 150, 151, 152, 392, - /* 1220 */ 154, 155, 156, 328, 349, 440, 362, 95, 43, 94, + /* 1170 */ 16, 105, 37, 38, 0, 43, 41, 181, 61, 43, + /* 1180 */ 329, 43, 43, 430, 320, 95, 43, 261, 43, 349, + /* 1190 */ 327, 43, 57, 58, 59, 320, 22, 43, 362, 133, + /* 1200 */ 329, 43, 136, 137, 138, 139, 140, 141, 142, 143, + /* 1210 */ 144, 145, 146, 147, 148, 149, 150, 151, 152, 361, + /* 1220 */ 154, 155, 156, 328, 349, 392, 362, 95, 43, 94, /* 1230 */ 35, 95, 357, 95, 95, 340, 0, 362, 95, 364, /* 1240 */ 95, 8, 9, 95, 2, 12, 13, 14, 15, 16, - /* 1250 */ 8, 9, 357, 95, 12, 13, 14, 15, 16, 414, - /* 1260 */ 385, 421, 177, 68, 389, 46, 328, 132, 393, 394, - /* 1270 */ 395, 396, 397, 398, 399, 424, 401, 320, 340, 404, + /* 1250 */ 8, 9, 357, 95, 12, 13, 14, 15, 16, 440, + /* 1260 */ 385, 414, 177, 68, 389, 46, 328, 132, 393, 394, + /* 1270 */ 395, 396, 397, 398, 399, 35, 401, 320, 340, 404, /* 1280 */ 95, 406, 407, 408, 48, 8, 9, 412, 413, 12, - /* 1290 */ 13, 14, 15, 16, 61, 357, 43, 43, 94, 242, - /* 1300 */ 387, 377, 167, 168, 169, 47, 349, 172, 104, 43, - /* 1310 */ 173, 354, 43, 94, 357, 13, 13, 43, 394, 362, - /* 1320 */ 386, 364, 43, 379, 189, 42, 20, 192, 320, 194, - /* 1330 */ 195, 196, 197, 198, 369, 369, 103, 35, 35, 328, - /* 1340 */ 328, 369, 385, 157, 328, 367, 389, 423, 95, 95, - /* 1350 */ 393, 394, 395, 396, 397, 398, 399, 349, 401, 367, - /* 1360 */ 328, 95, 438, 439, 95, 357, 328, 443, 444, 95, - /* 1370 */ 362, 334, 364, 357, 95, 240, 92, 328, 328, 20, - /* 1380 */ 322, 322, 20, 383, 332, 364, 20, 332, 20, 357, - /* 1390 */ 157, 376, 378, 385, 376, 332, 332, 389, 328, 332, - /* 1400 */ 332, 393, 394, 395, 396, 397, 398, 399, 332, 401, - /* 1410 */ 394, 322, 328, 322, 406, 362, 408, 188, 349, 384, - /* 1420 */ 412, 413, 349, 349, 349, 383, 394, 349, 349, 349, - /* 1430 */ 349, 349, 416, 417, 418, 349, 420, 349, 330, 162, - /* 1440 */ 180, 433, 382, 330, 328, 328, 320, 364, 416, 417, - /* 1450 */ 418, 330, 420, 376, 247, 362, 362, 362, 362, 372, + /* 1290 */ 13, 14, 15, 16, 61, 357, 43, 43, 421, 242, + /* 1300 */ 424, 377, 167, 168, 169, 387, 349, 172, 47, 43, + /* 1310 */ 173, 354, 43, 94, 357, 13, 199, 43, 394, 362, + /* 1320 */ 386, 364, 43, 13, 189, 379, 42, 192, 320, 194, + /* 1330 */ 195, 196, 197, 198, 369, 369, 103, 35, 157, 367, + /* 1340 */ 20, 328, 385, 328, 328, 35, 389, 423, 95, 95, + /* 1350 */ 393, 394, 395, 396, 397, 398, 399, 349, 401, 369, + /* 1360 */ 328, 95, 438, 439, 95, 357, 367, 443, 444, 95, + /* 1370 */ 362, 367, 364, 357, 95, 240, 334, 92, 328, 328, + /* 1380 */ 328, 20, 322, 322, 20, 383, 364, 332, 332, 357, + /* 1390 */ 157, 20, 20, 385, 376, 378, 332, 389, 328, 332, + /* 1400 */ 376, 393, 394, 395, 396, 397, 398, 399, 332, 401, + /* 1410 */ 394, 332, 332, 322, 406, 328, 408, 177, 349, 188, + /* 1420 */ 412, 413, 349, 349, 349, 322, 394, 349, 384, 383, + /* 1430 */ 349, 349, 416, 417, 418, 349, 420, 349, 349, 162, + /* 1440 */ 330, 433, 349, 180, 330, 362, 320, 382, 416, 417, + /* 1450 */ 418, 328, 420, 328, 330, 247, 364, 159, 362, 330, /* 1460 */ 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, - /* 1470 */ 237, 372, 362, 159, 370, 349, 330, 330, 345, 357, - /* 1480 */ 20, 362, 248, 357, 392, 429, 372, 362, 362, 362, - /* 1490 */ 364, 362, 392, 362, 429, 372, 166, 254, 243, 387, - /* 1500 */ 256, 429, 255, 432, 263, 260, 258, 239, 357, 448, - /* 1510 */ 20, 385, 94, 320, 94, 389, 353, 362, 411, 393, - /* 1520 */ 394, 395, 396, 397, 398, 399, 339, 401, 427, 431, - /* 1530 */ 428, 426, 406, 391, 408, 320, 328, 36, 412, 413, - /* 1540 */ 330, 323, 349, 322, 380, 442, 375, 441, 422, 343, - /* 1550 */ 357, 331, 343, 318, 343, 362, 182, 364, 0, 0, - /* 1560 */ 0, 0, 42, 0, 349, 35, 193, 35, 35, 35, - /* 1570 */ 193, 0, 357, 35, 35, 193, 0, 362, 385, 364, - /* 1580 */ 193, 0, 389, 35, 0, 0, 393, 394, 395, 396, - /* 1590 */ 397, 398, 399, 320, 401, 0, 22, 35, 177, 406, - /* 1600 */ 385, 408, 175, 0, 389, 412, 413, 171, 393, 394, - /* 1610 */ 395, 396, 397, 398, 399, 320, 401, 170, 0, 12, - /* 1620 */ 13, 406, 349, 408, 0, 46, 0, 412, 413, 22, - /* 1630 */ 357, 0, 0, 42, 0, 362, 42, 364, 0, 0, - /* 1640 */ 33, 0, 35, 0, 349, 0, 0, 0, 0, 35, - /* 1650 */ 148, 0, 357, 148, 0, 0, 0, 362, 385, 364, + /* 1470 */ 237, 376, 372, 362, 362, 349, 372, 362, 362, 370, + /* 1480 */ 330, 20, 362, 357, 357, 345, 392, 248, 362, 254, + /* 1490 */ 364, 392, 429, 372, 372, 362, 362, 429, 166, 256, + /* 1500 */ 255, 429, 431, 362, 362, 243, 387, 263, 260, 432, + /* 1510 */ 258, 385, 428, 320, 239, 389, 357, 20, 94, 393, + /* 1520 */ 394, 395, 396, 397, 398, 399, 94, 401, 427, 411, + /* 1530 */ 353, 426, 406, 362, 408, 320, 339, 391, 412, 413, + /* 1540 */ 328, 330, 349, 36, 442, 323, 448, 441, 422, 322, + /* 1550 */ 357, 375, 380, 343, 331, 362, 343, 364, 0, 343, + /* 1560 */ 0, 182, 0, 0, 349, 318, 42, 0, 35, 193, + /* 1570 */ 35, 35, 357, 35, 193, 0, 35, 362, 385, 364, + /* 1580 */ 35, 193, 389, 0, 193, 0, 393, 394, 395, 396, + /* 1590 */ 397, 398, 399, 320, 401, 0, 35, 0, 22, 406, + /* 1600 */ 385, 408, 177, 35, 389, 412, 413, 171, 393, 394, + /* 1610 */ 395, 396, 397, 398, 399, 320, 401, 175, 0, 12, + /* 1620 */ 13, 406, 349, 408, 0, 170, 0, 412, 413, 22, + /* 1630 */ 357, 0, 46, 0, 0, 362, 42, 364, 0, 0, + /* 1640 */ 33, 0, 35, 0, 349, 42, 0, 0, 0, 0, + /* 1650 */ 0, 148, 357, 0, 35, 0, 148, 362, 385, 364, /* 1660 */ 0, 0, 389, 56, 0, 0, 393, 394, 395, 396, /* 1670 */ 397, 398, 399, 0, 401, 68, 0, 0, 0, 406, - /* 1680 */ 385, 408, 0, 0, 389, 412, 413, 35, 393, 394, - /* 1690 */ 395, 396, 397, 398, 399, 0, 401, 0, 0, 42, + /* 1680 */ 385, 408, 0, 0, 389, 412, 413, 42, 393, 394, + /* 1690 */ 395, 396, 397, 398, 399, 0, 401, 0, 0, 0, /* 1700 */ 0, 0, 0, 408, 0, 0, 22, 412, 413, 0, - /* 1710 */ 0, 0, 0, 0, 56, 56, 0, 42, 39, 0, - /* 1720 */ 14, 14, 320, 116, 43, 39, 46, 0, 40, 0, - /* 1730 */ 0, 46, 39, 166, 0, 0, 0, 0, 0, 47, - /* 1740 */ 0, 47, 39, 35, 0, 0, 47, 0, 0, 35, - /* 1750 */ 0, 349, 62, 35, 39, 35, 39, 0, 35, 357, - /* 1760 */ 0, 39, 0, 22, 362, 103, 364, 101, 47, 43, - /* 1770 */ 0, 22, 0, 49, 35, 43, 22, 35, 35, 0, - /* 1780 */ 0, 35, 175, 22, 177, 22, 35, 385, 35, 0, - /* 1790 */ 320, 389, 162, 35, 35, 393, 394, 395, 396, 397, - /* 1800 */ 398, 399, 0, 401, 22, 22, 199, 200, 35, 320, - /* 1810 */ 408, 35, 20, 35, 412, 413, 0, 22, 178, 349, - /* 1820 */ 213, 214, 215, 216, 217, 218, 219, 357, 95, 162, - /* 1830 */ 159, 0, 362, 0, 364, 3, 162, 0, 349, 0, - /* 1840 */ 0, 35, 0, 0, 39, 46, 357, 95, 223, 94, - /* 1850 */ 94, 362, 43, 364, 225, 385, 187, 43, 94, 389, - /* 1860 */ 164, 244, 94, 393, 394, 395, 396, 397, 398, 399, - /* 1870 */ 400, 401, 402, 403, 385, 94, 320, 43, 389, 104, - /* 1880 */ 94, 94, 393, 394, 395, 396, 397, 398, 399, 95, - /* 1890 */ 401, 160, 95, 320, 94, 223, 95, 408, 95, 95, - /* 1900 */ 43, 94, 413, 43, 94, 349, 94, 46, 46, 94, - /* 1910 */ 3, 43, 244, 357, 95, 95, 35, 35, 362, 35, - /* 1920 */ 364, 35, 349, 158, 35, 35, 46, 2, 43, 238, - /* 1930 */ 357, 95, 22, 244, 46, 362, 320, 364, 46, 95, - /* 1940 */ 94, 385, 46, 95, 94, 389, 95, 94, 94, 393, + /* 1710 */ 0, 0, 0, 0, 35, 56, 0, 0, 56, 0, + /* 1720 */ 39, 14, 320, 116, 0, 0, 46, 42, 14, 43, + /* 1730 */ 40, 39, 0, 0, 46, 39, 166, 0, 0, 0, + /* 1740 */ 0, 0, 0, 35, 0, 39, 0, 0, 0, 0, + /* 1750 */ 47, 349, 0, 62, 103, 35, 35, 39, 35, 357, + /* 1760 */ 0, 95, 47, 0, 362, 39, 364, 39, 101, 47, + /* 1770 */ 35, 35, 22, 22, 47, 0, 0, 43, 35, 49, + /* 1780 */ 35, 0, 175, 22, 177, 20, 22, 385, 35, 35, + /* 1790 */ 320, 389, 35, 35, 22, 393, 394, 395, 396, 397, + /* 1800 */ 398, 399, 43, 401, 35, 22, 199, 200, 35, 320, + /* 1810 */ 408, 0, 35, 0, 412, 413, 22, 0, 162, 349, + /* 1820 */ 213, 214, 215, 216, 217, 218, 219, 357, 35, 0, + /* 1830 */ 178, 22, 362, 162, 364, 0, 0, 162, 349, 0, + /* 1840 */ 3, 0, 0, 35, 187, 0, 357, 46, 159, 94, + /* 1850 */ 94, 362, 0, 364, 160, 385, 94, 164, 39, 389, + /* 1860 */ 223, 95, 94, 393, 394, 395, 396, 397, 398, 399, + /* 1870 */ 400, 401, 402, 403, 385, 104, 320, 43, 389, 225, + /* 1880 */ 94, 223, 393, 394, 395, 396, 397, 398, 399, 158, + /* 1890 */ 401, 43, 94, 320, 95, 95, 94, 408, 95, 94, + /* 1900 */ 43, 95, 413, 43, 94, 349, 94, 244, 94, 46, + /* 1910 */ 95, 46, 94, 357, 244, 43, 95, 95, 362, 3, + /* 1920 */ 364, 43, 349, 35, 35, 35, 35, 35, 35, 46, + /* 1930 */ 357, 46, 46, 95, 2, 362, 320, 364, 95, 43, + /* 1940 */ 22, 385, 22, 94, 94, 389, 95, 46, 95, 393, /* 1950 */ 394, 395, 396, 397, 398, 399, 320, 401, 385, 403, - /* 1960 */ 95, 94, 389, 46, 95, 349, 393, 394, 395, 396, - /* 1970 */ 397, 398, 399, 357, 401, 22, 199, 94, 362, 105, - /* 1980 */ 364, 35, 95, 35, 35, 349, 95, 94, 94, 201, - /* 1990 */ 354, 35, 95, 357, 94, 35, 95, 94, 362, 95, - /* 2000 */ 364, 385, 35, 94, 22, 389, 35, 320, 435, 393, - /* 2010 */ 394, 395, 396, 397, 398, 399, 118, 401, 106, 43, - /* 2020 */ 118, 385, 94, 118, 118, 389, 94, 94, 22, 393, - /* 2030 */ 394, 395, 396, 397, 398, 399, 349, 401, 35, 62, - /* 2040 */ 61, 354, 35, 35, 357, 35, 35, 35, 35, 362, - /* 2050 */ 35, 364, 35, 437, 35, 68, 91, 43, 35, 35, - /* 2060 */ 22, 35, 22, 35, 35, 35, 68, 35, 35, 35, - /* 2070 */ 35, 35, 385, 22, 35, 0, 389, 35, 47, 0, - /* 2080 */ 393, 394, 395, 396, 397, 398, 399, 320, 401, 39, - /* 2090 */ 35, 47, 39, 0, 35, 47, 39, 0, 35, 47, - /* 2100 */ 39, 0, 35, 35, 0, 320, 22, 21, 449, 22, - /* 2110 */ 22, 21, 20, 449, 449, 449, 349, 449, 449, 449, + /* 1960 */ 94, 94, 389, 95, 94, 349, 393, 394, 395, 396, + /* 1970 */ 397, 398, 399, 357, 401, 46, 95, 95, 362, 199, + /* 1980 */ 364, 94, 105, 201, 35, 349, 35, 35, 94, 94, + /* 1990 */ 354, 35, 95, 357, 95, 95, 94, 35, 362, 94, + /* 2000 */ 364, 385, 95, 35, 94, 389, 22, 320, 435, 393, + /* 2010 */ 394, 395, 396, 397, 398, 399, 238, 401, 244, 106, + /* 2020 */ 94, 385, 118, 35, 118, 389, 118, 118, 94, 393, + /* 2030 */ 394, 395, 396, 397, 398, 399, 349, 401, 94, 43, + /* 2040 */ 22, 354, 62, 61, 357, 35, 35, 35, 35, 362, + /* 2050 */ 35, 364, 35, 437, 35, 35, 35, 35, 68, 43, + /* 2060 */ 91, 35, 35, 22, 35, 22, 35, 35, 35, 68, + /* 2070 */ 35, 35, 385, 35, 35, 35, 389, 22, 0, 35, + /* 2080 */ 393, 394, 395, 396, 397, 398, 399, 320, 401, 47, + /* 2090 */ 39, 35, 0, 35, 47, 0, 39, 35, 39, 47, + /* 2100 */ 0, 35, 39, 0, 35, 320, 35, 47, 0, 22, + /* 2110 */ 21, 449, 22, 22, 21, 449, 349, 20, 449, 449, /* 2120 */ 449, 449, 449, 449, 357, 449, 449, 449, 449, 362, /* 2130 */ 449, 364, 449, 449, 349, 449, 449, 449, 449, 449, /* 2140 */ 449, 449, 357, 449, 449, 449, 449, 362, 320, 364, @@ -785,9 +785,9 @@ static const YYCODETYPE yy_lookahead[] = { /* 2800 */ 449, 401, 385, 449, 449, 449, 389, 449, 449, 449, /* 2810 */ 393, 394, 395, 396, 397, 398, 399, 449, 401, }; -#define YY_SHIFT_COUNT (695) +#define YY_SHIFT_COUNT (697) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (2104) +#define YY_SHIFT_MAX (2108) static const unsigned short int yy_shift_ofst[] = { /* 0 */ 1135, 0, 57, 268, 57, 325, 325, 325, 536, 325, /* 10 */ 325, 325, 325, 325, 593, 804, 804, 861, 804, 804, @@ -803,64 +803,64 @@ static const unsigned short int yy_shift_ofst[] = { /* 110 */ 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, /* 120 */ 736, 550, 176, 350, 350, 587, 429, 704, 396, 396, /* 130 */ 742, 742, 742, 429, 573, 573, 573, 462, 109, 588, - /* 140 */ 588, 483, 267, 267, 693, 693, 462, 707, 399, 399, + /* 140 */ 588, 483, 267, 267, 534, 534, 462, 693, 399, 399, /* 150 */ 399, 399, 399, 399, 399, 263, 501, 382, 717, 838, /* 160 */ 42, 134, 190, 154, 217, 319, 421, 738, 825, 260, - /* 170 */ 126, 859, 260, 569, 659, 698, 1057, 1258, 1137, 1283, - /* 180 */ 1283, 1306, 1306, 1283, 1186, 1186, 1284, 1306, 1306, 1306, - /* 190 */ 1359, 1359, 1362, 138, 109, 138, 1366, 1368, 138, 1366, - /* 200 */ 138, 138, 138, 1306, 138, 1359, 267, 267, 267, 267, - /* 210 */ 267, 267, 267, 267, 267, 267, 267, 1306, 1359, 693, - /* 220 */ 1229, 1362, 457, 1260, 109, 457, 1306, 1306, 1366, 457, - /* 230 */ 1207, 693, 693, 693, 693, 1207, 693, 1314, 457, 462, - /* 240 */ 457, 573, 1460, 1460, 693, 1234, 1207, 693, 693, 1234, - /* 250 */ 1207, 693, 693, 267, 1243, 1330, 1234, 1244, 1247, 1255, - /* 260 */ 1057, 1241, 1245, 1248, 1268, 573, 1490, 1418, 1420, 693, - /* 270 */ 707, 1306, 457, 1501, 1359, 2819, 2819, 2819, 2819, 2819, - /* 280 */ 2819, 2819, 1062, 996, 759, 70, 1019, 1154, 1090, 50, - /* 290 */ 1242, 1277, 226, 582, 582, 582, 582, 582, 582, 582, - /* 300 */ 582, 582, 982, 262, 11, 11, 53, 160, 63, 227, - /* 310 */ 327, 669, 378, 479, 726, 348, 479, 479, 479, 837, - /* 320 */ 734, 361, 884, 868, 943, 956, 993, 940, 1097, 1174, - /* 330 */ 1034, 790, 1132, 1136, 1138, 1139, 1143, 1145, 1148, 909, - /* 340 */ 559, 863, 1054, 1158, 1023, 1085, 922, 1185, 305, 1219, - /* 350 */ 1253, 1254, 1266, 1269, 1274, 1279, 1204, 1302, 1303, 1195, - /* 360 */ 1236, 1558, 1559, 1374, 1560, 1561, 1520, 1563, 1530, 1373, - /* 370 */ 1532, 1533, 1534, 1377, 1571, 1538, 1539, 1382, 1576, 1387, - /* 380 */ 1581, 1548, 1584, 1574, 1585, 1562, 1421, 1427, 1595, 1603, - /* 390 */ 1436, 1447, 1618, 1624, 1579, 1626, 1631, 1632, 1591, 1634, - /* 400 */ 1638, 1639, 1594, 1641, 1643, 1645, 1646, 1647, 1648, 1502, - /* 410 */ 1614, 1651, 1505, 1654, 1655, 1656, 1660, 1661, 1664, 1665, - /* 420 */ 1673, 1676, 1677, 1678, 1682, 1683, 1695, 1657, 1697, 1698, - /* 430 */ 1700, 1701, 1702, 1684, 1704, 1705, 1709, 1710, 1652, 1711, - /* 440 */ 1658, 1712, 1659, 1713, 1716, 1675, 1679, 1681, 1706, 1680, - /* 450 */ 1707, 1685, 1719, 1688, 1686, 1727, 1729, 1730, 1693, 1567, - /* 460 */ 1734, 1735, 1736, 1690, 1737, 1738, 1708, 1692, 1703, 1740, - /* 470 */ 1714, 1694, 1715, 1744, 1718, 1699, 1717, 1745, 1720, 1721, - /* 480 */ 1722, 1747, 1748, 1750, 1757, 1662, 1666, 1723, 1741, 1760, - /* 490 */ 1739, 1742, 1749, 1743, 1746, 1726, 1732, 1751, 1753, 1754, - /* 500 */ 1758, 1762, 1761, 1770, 1763, 1724, 1772, 1782, 1759, 1779, - /* 510 */ 1773, 1780, 1776, 1789, 1783, 1792, 1733, 1755, 1802, 1630, - /* 520 */ 1778, 1816, 1640, 1795, 1667, 1671, 1831, 1833, 1674, 1696, - /* 530 */ 1832, 1837, 1839, 1840, 1756, 1752, 1806, 1669, 1842, 1764, - /* 540 */ 1731, 1768, 1843, 1805, 1765, 1781, 1775, 1799, 1809, 1625, - /* 550 */ 1629, 1672, 1814, 1617, 1786, 1794, 1787, 1797, 1801, 1800, - /* 560 */ 1834, 1803, 1807, 1810, 1812, 1804, 1857, 1861, 1862, 1815, - /* 570 */ 1860, 1668, 1819, 1820, 1907, 1868, 1689, 1881, 1882, 1884, - /* 580 */ 1886, 1889, 1890, 1836, 1844, 1880, 1691, 1885, 1888, 1892, - /* 590 */ 1925, 1910, 1777, 1846, 1848, 1850, 1851, 1853, 1865, 1896, - /* 600 */ 1854, 1867, 1917, 1869, 1953, 1788, 1883, 1874, 1887, 1946, - /* 610 */ 1948, 1893, 1891, 1949, 1894, 1897, 1956, 1900, 1901, 1960, - /* 620 */ 1903, 1904, 1967, 1909, 1898, 1902, 1905, 1906, 1982, 1912, - /* 630 */ 1928, 1932, 1971, 1933, 1976, 1976, 2006, 1977, 1979, 2003, - /* 640 */ 2007, 2008, 2010, 2011, 2012, 2013, 2015, 2017, 2019, 1987, - /* 650 */ 1965, 2014, 2023, 2024, 2038, 2026, 2040, 2028, 2029, 2030, - /* 660 */ 1998, 1726, 2032, 1732, 2033, 2034, 2035, 2036, 2051, 2039, - /* 670 */ 2075, 2042, 2031, 2050, 2079, 2055, 2044, 2053, 2093, 2059, - /* 680 */ 2048, 2057, 2097, 2063, 2052, 2061, 2101, 2067, 2068, 2104, - /* 690 */ 2084, 2086, 2087, 2088, 2090, 2092, + /* 170 */ 126, 859, 260, 569, 659, 698, 1057, 1261, 1137, 1284, + /* 180 */ 1284, 1181, 1320, 1320, 1284, 1181, 1181, 1285, 1320, 1320, + /* 190 */ 1320, 1361, 1361, 1364, 138, 109, 138, 1371, 1372, 138, + /* 200 */ 1371, 138, 138, 138, 1320, 138, 1361, 267, 267, 267, + /* 210 */ 267, 267, 267, 267, 267, 267, 267, 267, 1320, 1361, + /* 220 */ 534, 1231, 1364, 457, 1263, 109, 457, 1320, 1320, 1371, + /* 230 */ 457, 1208, 534, 534, 534, 534, 1208, 534, 1298, 457, + /* 240 */ 462, 457, 573, 1461, 1461, 534, 1239, 1208, 534, 534, + /* 250 */ 1239, 1208, 534, 534, 267, 1235, 1332, 1239, 1243, 1245, + /* 260 */ 1262, 1057, 1244, 1248, 1252, 1275, 573, 1497, 1424, 1432, + /* 270 */ 534, 693, 1320, 457, 1507, 1361, 2819, 2819, 2819, 2819, + /* 280 */ 2819, 2819, 2819, 1062, 996, 759, 70, 1019, 1154, 1090, + /* 290 */ 50, 1242, 1277, 226, 582, 582, 582, 582, 582, 582, + /* 300 */ 582, 582, 582, 982, 262, 11, 11, 53, 160, 63, + /* 310 */ 227, 327, 669, 378, 479, 726, 348, 479, 479, 479, + /* 320 */ 837, 734, 361, 884, 818, 943, 956, 993, 1023, 940, + /* 330 */ 1097, 1174, 1034, 790, 1132, 1136, 1138, 1139, 1143, 1145, + /* 340 */ 1148, 909, 787, 926, 1054, 1158, 1085, 1240, 1117, 1185, + /* 350 */ 305, 1219, 1253, 1254, 1266, 1269, 1274, 1279, 879, 1302, + /* 360 */ 1310, 1195, 1236, 1558, 1560, 1379, 1562, 1563, 1524, 1567, + /* 370 */ 1533, 1376, 1535, 1536, 1538, 1381, 1575, 1541, 1545, 1388, + /* 380 */ 1583, 1391, 1585, 1561, 1595, 1576, 1597, 1568, 1425, 1442, + /* 390 */ 1618, 1624, 1436, 1455, 1626, 1631, 1586, 1633, 1634, 1638, + /* 400 */ 1594, 1639, 1641, 1643, 1603, 1646, 1647, 1648, 1649, 1650, + /* 410 */ 1503, 1619, 1653, 1508, 1655, 1660, 1661, 1664, 1665, 1673, + /* 420 */ 1676, 1677, 1678, 1682, 1683, 1695, 1697, 1698, 1699, 1645, + /* 430 */ 1700, 1701, 1702, 1704, 1705, 1684, 1709, 1710, 1711, 1712, + /* 440 */ 1679, 1713, 1659, 1716, 1662, 1717, 1719, 1685, 1681, 1686, + /* 450 */ 1707, 1680, 1714, 1688, 1724, 1690, 1692, 1725, 1732, 1733, + /* 460 */ 1696, 1570, 1737, 1738, 1739, 1691, 1740, 1741, 1708, 1703, + /* 470 */ 1706, 1742, 1720, 1715, 1718, 1744, 1721, 1722, 1726, 1746, + /* 480 */ 1723, 1727, 1728, 1747, 1748, 1749, 1752, 1651, 1667, 1735, + /* 490 */ 1750, 1760, 1736, 1743, 1751, 1745, 1753, 1734, 1759, 1754, + /* 500 */ 1757, 1761, 1758, 1763, 1764, 1775, 1772, 1730, 1776, 1783, + /* 510 */ 1769, 1781, 1773, 1811, 1777, 1813, 1794, 1765, 1666, 1755, + /* 520 */ 1817, 1656, 1793, 1829, 1652, 1809, 1671, 1689, 1835, 1836, + /* 530 */ 1675, 1693, 1837, 1839, 1841, 1842, 1756, 1766, 1808, 1657, + /* 540 */ 1845, 1762, 1694, 1768, 1852, 1819, 1731, 1786, 1771, 1801, + /* 550 */ 1834, 1637, 1654, 1658, 1848, 1663, 1798, 1799, 1802, 1800, + /* 560 */ 1803, 1805, 1857, 1806, 1810, 1812, 1814, 1815, 1860, 1863, + /* 570 */ 1865, 1818, 1872, 1670, 1821, 1822, 1916, 1878, 1774, 1888, + /* 580 */ 1889, 1890, 1891, 1892, 1893, 1838, 1843, 1883, 1778, 1896, + /* 590 */ 1885, 1886, 1932, 1918, 1780, 1849, 1851, 1850, 1853, 1866, + /* 600 */ 1868, 1901, 1867, 1870, 1929, 1881, 1920, 1782, 1887, 1877, + /* 610 */ 1882, 1949, 1951, 1894, 1897, 1952, 1895, 1899, 1956, 1902, + /* 620 */ 1900, 1962, 1905, 1907, 1968, 1910, 1904, 1906, 1908, 1909, + /* 630 */ 1984, 1913, 1926, 1934, 1988, 1944, 1996, 1996, 2018, 1980, + /* 640 */ 1982, 2010, 2011, 2012, 2013, 2015, 2017, 2019, 2020, 2021, + /* 650 */ 2022, 1990, 1969, 2016, 2026, 2027, 2041, 2029, 2043, 2031, + /* 660 */ 2032, 2033, 2001, 1734, 2035, 1759, 2036, 2038, 2039, 2040, + /* 670 */ 2055, 2044, 2078, 2056, 2042, 2051, 2092, 2058, 2047, 2057, + /* 680 */ 2095, 2062, 2052, 2059, 2100, 2066, 2060, 2063, 2103, 2069, + /* 690 */ 2071, 2108, 2087, 2089, 2090, 2091, 2093, 2097, }; -#define YY_REDUCE_COUNT (281) +#define YY_REDUCE_COUNT (282) #define YY_REDUCE_MIN (-408) #define YY_REDUCE_MAX (2417) static const short yy_reduce_ofst[] = { @@ -878,93 +878,93 @@ static const short yy_reduce_ofst[] = { /* 110 */ 595, 616, 618, 725, 733, 798, 802, 803, 836, 864, /* 120 */ -318, 163, -135, -271, 69, -43, -93, 442, 284, 301, /* 130 */ 163, 436, 437, 362, 193, 406, 409, -17, -250, 392, - /* 140 */ 407, 229, 101, 345, 463, 470, 571, 432, 480, 511, - /* 150 */ 527, 545, 561, 617, 623, 398, 647, 764, 654, 665, - /* 160 */ 744, 772, 748, 834, 834, 858, 862, 829, 827, 840, - /* 170 */ 840, 785, 840, 845, 851, 834, 913, 934, 944, 965, - /* 180 */ 966, 1011, 1012, 972, 978, 992, 1037, 1038, 1049, 1050, - /* 190 */ 1058, 1059, 1000, 1052, 1021, 1055, 1015, 1014, 1063, 1018, - /* 200 */ 1064, 1067, 1068, 1070, 1076, 1089, 1069, 1073, 1074, 1075, - /* 210 */ 1078, 1079, 1080, 1081, 1082, 1086, 1088, 1084, 1091, 1053, - /* 220 */ 1035, 1042, 1108, 1060, 1083, 1113, 1116, 1117, 1077, 1121, - /* 230 */ 1087, 1093, 1094, 1095, 1096, 1099, 1110, 1104, 1146, 1133, - /* 240 */ 1147, 1122, 1092, 1100, 1119, 1056, 1114, 1125, 1127, 1065, - /* 250 */ 1123, 1129, 1131, 834, 1071, 1098, 1072, 1102, 1101, 1105, - /* 260 */ 1112, 1061, 1103, 1106, 840, 1151, 1142, 1107, 1163, 1155, - /* 270 */ 1187, 1208, 1210, 1218, 1221, 1164, 1171, 1206, 1209, 1211, - /* 280 */ 1220, 1235, + /* 140 */ 407, 229, 101, 345, 463, 470, 571, 432, 425, 511, + /* 150 */ 527, 545, 556, 561, 617, 398, 647, 737, 709, 638, + /* 160 */ 676, 851, 753, 840, 840, 871, 863, 858, 833, 877, + /* 170 */ 877, 819, 877, 847, 876, 840, 918, 934, 946, 965, + /* 180 */ 966, 972, 1013, 1015, 990, 999, 1004, 1042, 1050, 1051, + /* 190 */ 1052, 1060, 1061, 1002, 1055, 1022, 1056, 1018, 1017, 1064, + /* 200 */ 1024, 1067, 1076, 1079, 1070, 1080, 1091, 1069, 1073, 1074, + /* 210 */ 1075, 1078, 1081, 1082, 1086, 1088, 1089, 1093, 1087, 1103, + /* 220 */ 1083, 1044, 1046, 1110, 1065, 1092, 1114, 1123, 1125, 1095, + /* 230 */ 1124, 1100, 1096, 1111, 1112, 1115, 1104, 1116, 1109, 1129, + /* 240 */ 1140, 1150, 1127, 1094, 1099, 1120, 1063, 1121, 1133, 1134, + /* 250 */ 1068, 1122, 1141, 1142, 840, 1077, 1071, 1072, 1084, 1101, + /* 260 */ 1105, 1119, 1098, 1102, 1106, 877, 1159, 1146, 1118, 1177, + /* 270 */ 1171, 1197, 1212, 1211, 1222, 1227, 1172, 1176, 1210, 1213, + /* 280 */ 1216, 1223, 1247, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, - /* 10 */ 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, - /* 20 */ 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, - /* 30 */ 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, - /* 40 */ 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, - /* 50 */ 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, - /* 60 */ 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, - /* 70 */ 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1627, 1553, - /* 80 */ 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, - /* 90 */ 1553, 1553, 1553, 1553, 1553, 1625, 1796, 1984, 1553, 1553, - /* 100 */ 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, - /* 110 */ 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, - /* 120 */ 1553, 1996, 1553, 1553, 1553, 1627, 1553, 1625, 1956, 1956, - /* 130 */ 1996, 1996, 1996, 1553, 1553, 1553, 1553, 1736, 1553, 1837, - /* 140 */ 1837, 1553, 1553, 1553, 1553, 1553, 1736, 1553, 1553, 1553, - /* 150 */ 1553, 1553, 1553, 1553, 1553, 1831, 1553, 1553, 2021, 2074, - /* 160 */ 1553, 1553, 2024, 1553, 1553, 1553, 1553, 1689, 2011, 1988, - /* 170 */ 2002, 2058, 1989, 1986, 2005, 1553, 2015, 1553, 1824, 1801, - /* 180 */ 1801, 1553, 1553, 1801, 1798, 1798, 1680, 1553, 1553, 1553, - /* 190 */ 1553, 1553, 1553, 1627, 1553, 1627, 1553, 1553, 1627, 1553, - /* 200 */ 1627, 1627, 1627, 1553, 1627, 1553, 1553, 1553, 1553, 1553, - /* 210 */ 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, - /* 220 */ 1843, 1553, 1625, 1833, 1553, 1625, 1553, 1553, 1553, 1625, - /* 230 */ 2029, 1553, 1553, 1553, 1553, 2029, 1553, 1553, 1625, 1553, - /* 240 */ 1625, 1553, 1553, 1553, 1553, 2031, 2029, 1553, 1553, 2031, - /* 250 */ 2029, 1553, 1553, 1553, 2043, 2039, 2031, 2047, 2045, 2017, - /* 260 */ 2015, 2077, 2064, 2060, 2002, 1553, 1553, 1553, 1705, 1553, - /* 270 */ 1553, 1553, 1625, 1585, 1553, 1826, 1837, 1739, 1739, 1739, - /* 280 */ 1628, 1558, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, - /* 290 */ 1553, 1553, 1553, 1912, 1553, 2042, 2041, 1960, 1959, 1958, - /* 300 */ 1949, 1911, 1553, 1701, 1910, 1909, 1553, 1553, 1553, 1553, - /* 310 */ 1553, 1553, 1553, 1903, 1553, 1553, 1904, 1902, 1901, 1553, - /* 320 */ 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, - /* 330 */ 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, - /* 340 */ 2061, 2065, 1985, 1553, 1553, 1553, 1553, 1553, 1894, 1885, - /* 350 */ 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, - /* 360 */ 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, - /* 370 */ 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, - /* 380 */ 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, - /* 390 */ 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, - /* 400 */ 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, - /* 410 */ 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, - /* 420 */ 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, - /* 430 */ 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, - /* 440 */ 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1590, 1553, 1553, - /* 450 */ 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, - /* 460 */ 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, - /* 470 */ 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, - /* 480 */ 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, - /* 490 */ 1553, 1553, 1553, 1553, 1553, 1667, 1666, 1553, 1553, 1553, - /* 500 */ 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, - /* 510 */ 1553, 1553, 1553, 1553, 1553, 1553, 1893, 1553, 1553, 1553, - /* 520 */ 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, - /* 530 */ 2057, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1841, 1553, - /* 540 */ 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1946, 1553, - /* 550 */ 1553, 1553, 2018, 1553, 1553, 1553, 1553, 1553, 1553, 1553, - /* 560 */ 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1885, 1553, - /* 570 */ 2040, 1553, 1553, 2055, 1553, 2059, 1553, 1553, 1553, 1553, - /* 580 */ 1553, 1553, 1553, 1995, 1991, 1553, 1553, 1987, 1884, 1553, - /* 590 */ 1980, 1553, 1553, 1931, 1553, 1553, 1553, 1553, 1553, 1553, - /* 600 */ 1553, 1553, 1553, 1893, 1553, 1897, 1553, 1553, 1553, 1553, - /* 610 */ 1553, 1733, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, - /* 620 */ 1553, 1553, 1553, 1553, 1718, 1716, 1715, 1714, 1553, 1711, - /* 630 */ 1553, 1553, 1553, 1553, 1742, 1741, 1553, 1553, 1553, 1553, - /* 640 */ 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, - /* 650 */ 1553, 1647, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, - /* 660 */ 1553, 1638, 1553, 1637, 1553, 1553, 1553, 1553, 1553, 1553, - /* 670 */ 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, - /* 680 */ 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, - /* 690 */ 1553, 1553, 1553, 1553, 1553, 1553, + /* 0 */ 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, + /* 10 */ 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, + /* 20 */ 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, + /* 30 */ 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, + /* 40 */ 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, + /* 50 */ 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, + /* 60 */ 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, + /* 70 */ 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1630, 1556, + /* 80 */ 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, + /* 90 */ 1556, 1556, 1556, 1556, 1556, 1628, 1800, 1988, 1556, 1556, + /* 100 */ 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, + /* 110 */ 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, + /* 120 */ 1556, 2000, 1556, 1556, 1556, 1630, 1556, 1628, 1960, 1960, + /* 130 */ 2000, 2000, 2000, 1556, 1556, 1556, 1556, 1739, 1556, 1841, + /* 140 */ 1841, 1556, 1556, 1556, 1556, 1556, 1739, 1556, 1556, 1556, + /* 150 */ 1556, 1556, 1556, 1556, 1556, 1835, 1556, 1556, 2025, 2078, + /* 160 */ 1556, 1556, 2028, 1556, 1556, 1556, 1556, 1692, 2015, 1992, + /* 170 */ 2006, 2062, 1993, 1990, 2009, 1556, 2019, 1556, 1828, 1805, + /* 180 */ 1805, 1802, 1556, 1556, 1805, 1802, 1802, 1683, 1556, 1556, + /* 190 */ 1556, 1556, 1556, 1556, 1630, 1556, 1630, 1556, 1556, 1630, + /* 200 */ 1556, 1630, 1630, 1630, 1556, 1630, 1556, 1556, 1556, 1556, + /* 210 */ 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, + /* 220 */ 1556, 1847, 1556, 1628, 1837, 1556, 1628, 1556, 1556, 1556, + /* 230 */ 1628, 2033, 1556, 1556, 1556, 1556, 2033, 1556, 1556, 1628, + /* 240 */ 1556, 1628, 1556, 1556, 1556, 1556, 2035, 2033, 1556, 1556, + /* 250 */ 2035, 2033, 1556, 1556, 1556, 2047, 2043, 2035, 2051, 2049, + /* 260 */ 2021, 2019, 2081, 2068, 2064, 2006, 1556, 1556, 1556, 1708, + /* 270 */ 1556, 1556, 1556, 1628, 1588, 1556, 1830, 1841, 1742, 1742, + /* 280 */ 1742, 1631, 1561, 1556, 1556, 1556, 1556, 1556, 1556, 1556, + /* 290 */ 1556, 1556, 1556, 1556, 1916, 1556, 2046, 2045, 1964, 1963, + /* 300 */ 1962, 1953, 1915, 1556, 1704, 1914, 1913, 1556, 1556, 1556, + /* 310 */ 1556, 1556, 1556, 1556, 1907, 1556, 1556, 1908, 1906, 1905, + /* 320 */ 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, + /* 330 */ 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, + /* 340 */ 1556, 1556, 2065, 2069, 1989, 1556, 1556, 1556, 1556, 1556, + /* 350 */ 1898, 1889, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, + /* 360 */ 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, + /* 370 */ 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, + /* 380 */ 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, + /* 390 */ 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, + /* 400 */ 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, + /* 410 */ 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, + /* 420 */ 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, + /* 430 */ 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, + /* 440 */ 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1593, + /* 450 */ 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, + /* 460 */ 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, + /* 470 */ 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, + /* 480 */ 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, + /* 490 */ 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1670, 1669, 1556, + /* 500 */ 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, + /* 510 */ 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1897, 1556, + /* 520 */ 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, + /* 530 */ 1556, 1556, 2061, 1556, 1556, 1556, 1556, 1556, 1556, 1556, + /* 540 */ 1845, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, + /* 550 */ 1950, 1556, 1556, 1556, 2022, 1556, 1556, 1556, 1556, 1556, + /* 560 */ 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, + /* 570 */ 1889, 1556, 2044, 1556, 1556, 2059, 1556, 2063, 1556, 1556, + /* 580 */ 1556, 1556, 1556, 1556, 1556, 1999, 1995, 1556, 1556, 1991, + /* 590 */ 1888, 1556, 1984, 1556, 1556, 1935, 1556, 1556, 1556, 1556, + /* 600 */ 1556, 1556, 1556, 1556, 1556, 1897, 1556, 1901, 1556, 1556, + /* 610 */ 1556, 1556, 1556, 1736, 1556, 1556, 1556, 1556, 1556, 1556, + /* 620 */ 1556, 1556, 1556, 1556, 1556, 1556, 1721, 1719, 1718, 1717, + /* 630 */ 1556, 1714, 1556, 1556, 1556, 1556, 1745, 1744, 1556, 1556, + /* 640 */ 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, + /* 650 */ 1556, 1556, 1556, 1650, 1556, 1556, 1556, 1556, 1556, 1556, + /* 660 */ 1556, 1556, 1556, 1641, 1556, 1640, 1556, 1556, 1556, 1556, + /* 670 */ 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, + /* 680 */ 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, + /* 690 */ 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, }; /********** End of lemon-generated parsing tables *****************************/ @@ -1133,9 +1133,9 @@ static const YYCODETYPE yyFallback[] = { 0, /* SCORES => nothing */ 0, /* TOPICS => nothing */ 0, /* VARIABLES => nothing */ + 0, /* CLUSTER => nothing */ 0, /* BNODES => nothing */ 0, /* SNODES => nothing */ - 0, /* CLUSTER => nothing */ 0, /* TRANSACTIONS => nothing */ 0, /* DISTRIBUTED => nothing */ 0, /* CONSUMERS => nothing */ @@ -1537,9 +1537,9 @@ static const char *const yyTokenName[] = { /* 146 */ "SCORES", /* 147 */ "TOPICS", /* 148 */ "VARIABLES", - /* 149 */ "BNODES", - /* 150 */ "SNODES", - /* 151 */ "CLUSTER", + /* 149 */ "CLUSTER", + /* 150 */ "BNODES", + /* 151 */ "SNODES", /* 152 */ "TRANSACTIONS", /* 153 */ "DISTRIBUTED", /* 154 */ "CONSUMERS", @@ -2071,303 +2071,304 @@ static const char *const yyRuleName[] = { /* 224 */ "cmd ::= SHOW SCORES", /* 225 */ "cmd ::= SHOW TOPICS", /* 226 */ "cmd ::= SHOW VARIABLES", - /* 227 */ "cmd ::= SHOW LOCAL VARIABLES", - /* 228 */ "cmd ::= SHOW DNODE NK_INTEGER VARIABLES", - /* 229 */ "cmd ::= SHOW BNODES", - /* 230 */ "cmd ::= SHOW SNODES", - /* 231 */ "cmd ::= SHOW CLUSTER", - /* 232 */ "cmd ::= SHOW TRANSACTIONS", - /* 233 */ "cmd ::= SHOW TABLE DISTRIBUTED full_table_name", - /* 234 */ "cmd ::= SHOW CONSUMERS", - /* 235 */ "cmd ::= SHOW SUBSCRIPTIONS", - /* 236 */ "cmd ::= SHOW TAGS FROM table_name_cond from_db_opt", - /* 237 */ "cmd ::= SHOW TABLE TAGS FROM table_name_cond from_db_opt", - /* 238 */ "cmd ::= SHOW VNODES NK_INTEGER", - /* 239 */ "cmd ::= SHOW VNODES NK_STRING", - /* 240 */ "db_name_cond_opt ::=", - /* 241 */ "db_name_cond_opt ::= db_name NK_DOT", - /* 242 */ "like_pattern_opt ::=", - /* 243 */ "like_pattern_opt ::= LIKE NK_STRING", - /* 244 */ "table_name_cond ::= table_name", - /* 245 */ "from_db_opt ::=", - /* 246 */ "from_db_opt ::= FROM db_name", - /* 247 */ "cmd ::= CREATE SMA INDEX not_exists_opt full_table_name ON full_table_name index_options", - /* 248 */ "cmd ::= DROP INDEX exists_opt full_table_name", - /* 249 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt", - /* 250 */ "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", - /* 251 */ "func_list ::= func", - /* 252 */ "func_list ::= func_list NK_COMMA func", - /* 253 */ "func ::= function_name NK_LP expression_list NK_RP", - /* 254 */ "sma_stream_opt ::=", - /* 255 */ "sma_stream_opt ::= stream_options WATERMARK duration_literal", - /* 256 */ "sma_stream_opt ::= stream_options MAX_DELAY duration_literal", - /* 257 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery", - /* 258 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name", - /* 259 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name", - /* 260 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name", - /* 261 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name", - /* 262 */ "cmd ::= DROP TOPIC exists_opt topic_name", - /* 263 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name", - /* 264 */ "cmd ::= DESC full_table_name", - /* 265 */ "cmd ::= DESCRIBE full_table_name", - /* 266 */ "cmd ::= RESET QUERY CACHE", - /* 267 */ "cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery", - /* 268 */ "analyze_opt ::=", - /* 269 */ "analyze_opt ::= ANALYZE", - /* 270 */ "explain_options ::=", - /* 271 */ "explain_options ::= explain_options VERBOSE NK_BOOL", - /* 272 */ "explain_options ::= explain_options RATIO NK_FLOAT", - /* 273 */ "cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt", - /* 274 */ "cmd ::= DROP FUNCTION exists_opt function_name", - /* 275 */ "agg_func_opt ::=", - /* 276 */ "agg_func_opt ::= AGGREGATE", - /* 277 */ "bufsize_opt ::=", - /* 278 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", - /* 279 */ "cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name tags_def_opt subtable_opt AS query_or_subquery", - /* 280 */ "cmd ::= DROP STREAM exists_opt stream_name", - /* 281 */ "stream_options ::=", - /* 282 */ "stream_options ::= stream_options TRIGGER AT_ONCE", - /* 283 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", - /* 284 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", - /* 285 */ "stream_options ::= stream_options WATERMARK duration_literal", - /* 286 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER", - /* 287 */ "subtable_opt ::=", - /* 288 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP", - /* 289 */ "cmd ::= KILL CONNECTION NK_INTEGER", - /* 290 */ "cmd ::= KILL QUERY NK_STRING", - /* 291 */ "cmd ::= KILL TRANSACTION NK_INTEGER", - /* 292 */ "cmd ::= BALANCE VGROUP", - /* 293 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", - /* 294 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", - /* 295 */ "cmd ::= SPLIT VGROUP NK_INTEGER", - /* 296 */ "dnode_list ::= DNODE NK_INTEGER", - /* 297 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", - /* 298 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", - /* 299 */ "cmd ::= query_or_subquery", - /* 300 */ "cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery", - /* 301 */ "cmd ::= INSERT INTO full_table_name query_or_subquery", - /* 302 */ "literal ::= NK_INTEGER", - /* 303 */ "literal ::= NK_FLOAT", - /* 304 */ "literal ::= NK_STRING", - /* 305 */ "literal ::= NK_BOOL", - /* 306 */ "literal ::= TIMESTAMP NK_STRING", - /* 307 */ "literal ::= duration_literal", - /* 308 */ "literal ::= NULL", - /* 309 */ "literal ::= NK_QUESTION", - /* 310 */ "duration_literal ::= NK_VARIABLE", - /* 311 */ "signed ::= NK_INTEGER", - /* 312 */ "signed ::= NK_PLUS NK_INTEGER", - /* 313 */ "signed ::= NK_MINUS NK_INTEGER", - /* 314 */ "signed ::= NK_FLOAT", - /* 315 */ "signed ::= NK_PLUS NK_FLOAT", - /* 316 */ "signed ::= NK_MINUS NK_FLOAT", - /* 317 */ "signed_literal ::= signed", - /* 318 */ "signed_literal ::= NK_STRING", - /* 319 */ "signed_literal ::= NK_BOOL", - /* 320 */ "signed_literal ::= TIMESTAMP NK_STRING", - /* 321 */ "signed_literal ::= duration_literal", - /* 322 */ "signed_literal ::= NULL", - /* 323 */ "signed_literal ::= literal_func", - /* 324 */ "signed_literal ::= NK_QUESTION", - /* 325 */ "literal_list ::= signed_literal", - /* 326 */ "literal_list ::= literal_list NK_COMMA signed_literal", - /* 327 */ "db_name ::= NK_ID", - /* 328 */ "table_name ::= NK_ID", - /* 329 */ "column_name ::= NK_ID", - /* 330 */ "function_name ::= NK_ID", - /* 331 */ "table_alias ::= NK_ID", - /* 332 */ "column_alias ::= NK_ID", - /* 333 */ "user_name ::= NK_ID", - /* 334 */ "topic_name ::= NK_ID", - /* 335 */ "stream_name ::= NK_ID", - /* 336 */ "cgroup_name ::= NK_ID", - /* 337 */ "expr_or_subquery ::= expression", - /* 338 */ "expr_or_subquery ::= subquery", - /* 339 */ "expression ::= literal", - /* 340 */ "expression ::= pseudo_column", - /* 341 */ "expression ::= column_reference", - /* 342 */ "expression ::= function_expression", - /* 343 */ "expression ::= case_when_expression", - /* 344 */ "expression ::= NK_LP expression NK_RP", - /* 345 */ "expression ::= NK_PLUS expr_or_subquery", - /* 346 */ "expression ::= NK_MINUS expr_or_subquery", - /* 347 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery", - /* 348 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery", - /* 349 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery", - /* 350 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery", - /* 351 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery", - /* 352 */ "expression ::= column_reference NK_ARROW NK_STRING", - /* 353 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery", - /* 354 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery", - /* 355 */ "expression_list ::= expr_or_subquery", - /* 356 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery", - /* 357 */ "column_reference ::= column_name", - /* 358 */ "column_reference ::= table_name NK_DOT column_name", - /* 359 */ "pseudo_column ::= ROWTS", - /* 360 */ "pseudo_column ::= TBNAME", - /* 361 */ "pseudo_column ::= table_name NK_DOT TBNAME", - /* 362 */ "pseudo_column ::= QSTART", - /* 363 */ "pseudo_column ::= QEND", - /* 364 */ "pseudo_column ::= QDURATION", - /* 365 */ "pseudo_column ::= WSTART", - /* 366 */ "pseudo_column ::= WEND", - /* 367 */ "pseudo_column ::= WDURATION", - /* 368 */ "pseudo_column ::= IROWTS", - /* 369 */ "pseudo_column ::= QTAGS", - /* 370 */ "function_expression ::= function_name NK_LP expression_list NK_RP", - /* 371 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", - /* 372 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP", - /* 373 */ "function_expression ::= literal_func", - /* 374 */ "literal_func ::= noarg_func NK_LP NK_RP", - /* 375 */ "literal_func ::= NOW", - /* 376 */ "noarg_func ::= NOW", - /* 377 */ "noarg_func ::= TODAY", - /* 378 */ "noarg_func ::= TIMEZONE", - /* 379 */ "noarg_func ::= DATABASE", - /* 380 */ "noarg_func ::= CLIENT_VERSION", - /* 381 */ "noarg_func ::= SERVER_VERSION", - /* 382 */ "noarg_func ::= SERVER_STATUS", - /* 383 */ "noarg_func ::= CURRENT_USER", - /* 384 */ "noarg_func ::= USER", - /* 385 */ "star_func ::= COUNT", - /* 386 */ "star_func ::= FIRST", - /* 387 */ "star_func ::= LAST", - /* 388 */ "star_func ::= LAST_ROW", - /* 389 */ "star_func_para_list ::= NK_STAR", - /* 390 */ "star_func_para_list ::= other_para_list", - /* 391 */ "other_para_list ::= star_func_para", - /* 392 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", - /* 393 */ "star_func_para ::= expr_or_subquery", - /* 394 */ "star_func_para ::= table_name NK_DOT NK_STAR", - /* 395 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END", - /* 396 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END", - /* 397 */ "when_then_list ::= when_then_expr", - /* 398 */ "when_then_list ::= when_then_list when_then_expr", - /* 399 */ "when_then_expr ::= WHEN common_expression THEN common_expression", - /* 400 */ "case_when_else_opt ::=", - /* 401 */ "case_when_else_opt ::= ELSE common_expression", - /* 402 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery", - /* 403 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery", - /* 404 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery", - /* 405 */ "predicate ::= expr_or_subquery IS NULL", - /* 406 */ "predicate ::= expr_or_subquery IS NOT NULL", - /* 407 */ "predicate ::= expr_or_subquery in_op in_predicate_value", - /* 408 */ "compare_op ::= NK_LT", - /* 409 */ "compare_op ::= NK_GT", - /* 410 */ "compare_op ::= NK_LE", - /* 411 */ "compare_op ::= NK_GE", - /* 412 */ "compare_op ::= NK_NE", - /* 413 */ "compare_op ::= NK_EQ", - /* 414 */ "compare_op ::= LIKE", - /* 415 */ "compare_op ::= NOT LIKE", - /* 416 */ "compare_op ::= MATCH", - /* 417 */ "compare_op ::= NMATCH", - /* 418 */ "compare_op ::= CONTAINS", - /* 419 */ "in_op ::= IN", - /* 420 */ "in_op ::= NOT IN", - /* 421 */ "in_predicate_value ::= NK_LP literal_list NK_RP", - /* 422 */ "boolean_value_expression ::= boolean_primary", - /* 423 */ "boolean_value_expression ::= NOT boolean_primary", - /* 424 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", - /* 425 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", - /* 426 */ "boolean_primary ::= predicate", - /* 427 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", - /* 428 */ "common_expression ::= expr_or_subquery", - /* 429 */ "common_expression ::= boolean_value_expression", - /* 430 */ "from_clause_opt ::=", - /* 431 */ "from_clause_opt ::= FROM table_reference_list", - /* 432 */ "table_reference_list ::= table_reference", - /* 433 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", - /* 434 */ "table_reference ::= table_primary", - /* 435 */ "table_reference ::= joined_table", - /* 436 */ "table_primary ::= table_name alias_opt", - /* 437 */ "table_primary ::= db_name NK_DOT table_name alias_opt", - /* 438 */ "table_primary ::= subquery alias_opt", - /* 439 */ "table_primary ::= parenthesized_joined_table", - /* 440 */ "alias_opt ::=", - /* 441 */ "alias_opt ::= table_alias", - /* 442 */ "alias_opt ::= AS table_alias", - /* 443 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", - /* 444 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", - /* 445 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", - /* 446 */ "join_type ::=", - /* 447 */ "join_type ::= INNER", - /* 448 */ "query_specification ::= SELECT set_quantifier_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", - /* 449 */ "set_quantifier_opt ::=", - /* 450 */ "set_quantifier_opt ::= DISTINCT", - /* 451 */ "set_quantifier_opt ::= ALL", - /* 452 */ "select_list ::= select_item", - /* 453 */ "select_list ::= select_list NK_COMMA select_item", - /* 454 */ "select_item ::= NK_STAR", - /* 455 */ "select_item ::= common_expression", - /* 456 */ "select_item ::= common_expression column_alias", - /* 457 */ "select_item ::= common_expression AS column_alias", - /* 458 */ "select_item ::= table_name NK_DOT NK_STAR", - /* 459 */ "where_clause_opt ::=", - /* 460 */ "where_clause_opt ::= WHERE search_condition", - /* 461 */ "partition_by_clause_opt ::=", - /* 462 */ "partition_by_clause_opt ::= PARTITION BY partition_list", - /* 463 */ "partition_list ::= partition_item", - /* 464 */ "partition_list ::= partition_list NK_COMMA partition_item", - /* 465 */ "partition_item ::= expr_or_subquery", - /* 466 */ "partition_item ::= expr_or_subquery column_alias", - /* 467 */ "partition_item ::= expr_or_subquery AS column_alias", - /* 468 */ "twindow_clause_opt ::=", - /* 469 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", - /* 470 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP", - /* 471 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", - /* 472 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", - /* 473 */ "sliding_opt ::=", - /* 474 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", - /* 475 */ "fill_opt ::=", - /* 476 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", - /* 477 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", - /* 478 */ "fill_mode ::= NONE", - /* 479 */ "fill_mode ::= PREV", - /* 480 */ "fill_mode ::= NULL", - /* 481 */ "fill_mode ::= LINEAR", - /* 482 */ "fill_mode ::= NEXT", - /* 483 */ "group_by_clause_opt ::=", - /* 484 */ "group_by_clause_opt ::= GROUP BY group_by_list", - /* 485 */ "group_by_list ::= expr_or_subquery", - /* 486 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery", - /* 487 */ "having_clause_opt ::=", - /* 488 */ "having_clause_opt ::= HAVING search_condition", - /* 489 */ "range_opt ::=", - /* 490 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP", - /* 491 */ "every_opt ::=", - /* 492 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", - /* 493 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt", - /* 494 */ "query_simple ::= query_specification", - /* 495 */ "query_simple ::= union_query_expression", - /* 496 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery", - /* 497 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery", - /* 498 */ "query_simple_or_subquery ::= query_simple", - /* 499 */ "query_simple_or_subquery ::= subquery", - /* 500 */ "query_or_subquery ::= query_expression", - /* 501 */ "query_or_subquery ::= subquery", - /* 502 */ "order_by_clause_opt ::=", - /* 503 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", - /* 504 */ "slimit_clause_opt ::=", - /* 505 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", - /* 506 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", - /* 507 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 508 */ "limit_clause_opt ::=", - /* 509 */ "limit_clause_opt ::= LIMIT NK_INTEGER", - /* 510 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", - /* 511 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 512 */ "subquery ::= NK_LP query_expression NK_RP", - /* 513 */ "subquery ::= NK_LP subquery NK_RP", - /* 514 */ "search_condition ::= common_expression", - /* 515 */ "sort_specification_list ::= sort_specification", - /* 516 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", - /* 517 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt", - /* 518 */ "ordering_specification_opt ::=", - /* 519 */ "ordering_specification_opt ::= ASC", - /* 520 */ "ordering_specification_opt ::= DESC", - /* 521 */ "null_ordering_opt ::=", - /* 522 */ "null_ordering_opt ::= NULLS FIRST", - /* 523 */ "null_ordering_opt ::= NULLS LAST", + /* 227 */ "cmd ::= SHOW CLUSTER VARIABLES", + /* 228 */ "cmd ::= SHOW LOCAL VARIABLES", + /* 229 */ "cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt", + /* 230 */ "cmd ::= SHOW BNODES", + /* 231 */ "cmd ::= SHOW SNODES", + /* 232 */ "cmd ::= SHOW CLUSTER", + /* 233 */ "cmd ::= SHOW TRANSACTIONS", + /* 234 */ "cmd ::= SHOW TABLE DISTRIBUTED full_table_name", + /* 235 */ "cmd ::= SHOW CONSUMERS", + /* 236 */ "cmd ::= SHOW SUBSCRIPTIONS", + /* 237 */ "cmd ::= SHOW TAGS FROM table_name_cond from_db_opt", + /* 238 */ "cmd ::= SHOW TABLE TAGS FROM table_name_cond from_db_opt", + /* 239 */ "cmd ::= SHOW VNODES NK_INTEGER", + /* 240 */ "cmd ::= SHOW VNODES NK_STRING", + /* 241 */ "db_name_cond_opt ::=", + /* 242 */ "db_name_cond_opt ::= db_name NK_DOT", + /* 243 */ "like_pattern_opt ::=", + /* 244 */ "like_pattern_opt ::= LIKE NK_STRING", + /* 245 */ "table_name_cond ::= table_name", + /* 246 */ "from_db_opt ::=", + /* 247 */ "from_db_opt ::= FROM db_name", + /* 248 */ "cmd ::= CREATE SMA INDEX not_exists_opt full_table_name ON full_table_name index_options", + /* 249 */ "cmd ::= DROP INDEX exists_opt full_table_name", + /* 250 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt", + /* 251 */ "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", + /* 252 */ "func_list ::= func", + /* 253 */ "func_list ::= func_list NK_COMMA func", + /* 254 */ "func ::= function_name NK_LP expression_list NK_RP", + /* 255 */ "sma_stream_opt ::=", + /* 256 */ "sma_stream_opt ::= stream_options WATERMARK duration_literal", + /* 257 */ "sma_stream_opt ::= stream_options MAX_DELAY duration_literal", + /* 258 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery", + /* 259 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name", + /* 260 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name", + /* 261 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name", + /* 262 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name", + /* 263 */ "cmd ::= DROP TOPIC exists_opt topic_name", + /* 264 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name", + /* 265 */ "cmd ::= DESC full_table_name", + /* 266 */ "cmd ::= DESCRIBE full_table_name", + /* 267 */ "cmd ::= RESET QUERY CACHE", + /* 268 */ "cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery", + /* 269 */ "analyze_opt ::=", + /* 270 */ "analyze_opt ::= ANALYZE", + /* 271 */ "explain_options ::=", + /* 272 */ "explain_options ::= explain_options VERBOSE NK_BOOL", + /* 273 */ "explain_options ::= explain_options RATIO NK_FLOAT", + /* 274 */ "cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt", + /* 275 */ "cmd ::= DROP FUNCTION exists_opt function_name", + /* 276 */ "agg_func_opt ::=", + /* 277 */ "agg_func_opt ::= AGGREGATE", + /* 278 */ "bufsize_opt ::=", + /* 279 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", + /* 280 */ "cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name tags_def_opt subtable_opt AS query_or_subquery", + /* 281 */ "cmd ::= DROP STREAM exists_opt stream_name", + /* 282 */ "stream_options ::=", + /* 283 */ "stream_options ::= stream_options TRIGGER AT_ONCE", + /* 284 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", + /* 285 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", + /* 286 */ "stream_options ::= stream_options WATERMARK duration_literal", + /* 287 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER", + /* 288 */ "subtable_opt ::=", + /* 289 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP", + /* 290 */ "cmd ::= KILL CONNECTION NK_INTEGER", + /* 291 */ "cmd ::= KILL QUERY NK_STRING", + /* 292 */ "cmd ::= KILL TRANSACTION NK_INTEGER", + /* 293 */ "cmd ::= BALANCE VGROUP", + /* 294 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", + /* 295 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", + /* 296 */ "cmd ::= SPLIT VGROUP NK_INTEGER", + /* 297 */ "dnode_list ::= DNODE NK_INTEGER", + /* 298 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", + /* 299 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", + /* 300 */ "cmd ::= query_or_subquery", + /* 301 */ "cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery", + /* 302 */ "cmd ::= INSERT INTO full_table_name query_or_subquery", + /* 303 */ "literal ::= NK_INTEGER", + /* 304 */ "literal ::= NK_FLOAT", + /* 305 */ "literal ::= NK_STRING", + /* 306 */ "literal ::= NK_BOOL", + /* 307 */ "literal ::= TIMESTAMP NK_STRING", + /* 308 */ "literal ::= duration_literal", + /* 309 */ "literal ::= NULL", + /* 310 */ "literal ::= NK_QUESTION", + /* 311 */ "duration_literal ::= NK_VARIABLE", + /* 312 */ "signed ::= NK_INTEGER", + /* 313 */ "signed ::= NK_PLUS NK_INTEGER", + /* 314 */ "signed ::= NK_MINUS NK_INTEGER", + /* 315 */ "signed ::= NK_FLOAT", + /* 316 */ "signed ::= NK_PLUS NK_FLOAT", + /* 317 */ "signed ::= NK_MINUS NK_FLOAT", + /* 318 */ "signed_literal ::= signed", + /* 319 */ "signed_literal ::= NK_STRING", + /* 320 */ "signed_literal ::= NK_BOOL", + /* 321 */ "signed_literal ::= TIMESTAMP NK_STRING", + /* 322 */ "signed_literal ::= duration_literal", + /* 323 */ "signed_literal ::= NULL", + /* 324 */ "signed_literal ::= literal_func", + /* 325 */ "signed_literal ::= NK_QUESTION", + /* 326 */ "literal_list ::= signed_literal", + /* 327 */ "literal_list ::= literal_list NK_COMMA signed_literal", + /* 328 */ "db_name ::= NK_ID", + /* 329 */ "table_name ::= NK_ID", + /* 330 */ "column_name ::= NK_ID", + /* 331 */ "function_name ::= NK_ID", + /* 332 */ "table_alias ::= NK_ID", + /* 333 */ "column_alias ::= NK_ID", + /* 334 */ "user_name ::= NK_ID", + /* 335 */ "topic_name ::= NK_ID", + /* 336 */ "stream_name ::= NK_ID", + /* 337 */ "cgroup_name ::= NK_ID", + /* 338 */ "expr_or_subquery ::= expression", + /* 339 */ "expr_or_subquery ::= subquery", + /* 340 */ "expression ::= literal", + /* 341 */ "expression ::= pseudo_column", + /* 342 */ "expression ::= column_reference", + /* 343 */ "expression ::= function_expression", + /* 344 */ "expression ::= case_when_expression", + /* 345 */ "expression ::= NK_LP expression NK_RP", + /* 346 */ "expression ::= NK_PLUS expr_or_subquery", + /* 347 */ "expression ::= NK_MINUS expr_or_subquery", + /* 348 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery", + /* 349 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery", + /* 350 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery", + /* 351 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery", + /* 352 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery", + /* 353 */ "expression ::= column_reference NK_ARROW NK_STRING", + /* 354 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery", + /* 355 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery", + /* 356 */ "expression_list ::= expr_or_subquery", + /* 357 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery", + /* 358 */ "column_reference ::= column_name", + /* 359 */ "column_reference ::= table_name NK_DOT column_name", + /* 360 */ "pseudo_column ::= ROWTS", + /* 361 */ "pseudo_column ::= TBNAME", + /* 362 */ "pseudo_column ::= table_name NK_DOT TBNAME", + /* 363 */ "pseudo_column ::= QSTART", + /* 364 */ "pseudo_column ::= QEND", + /* 365 */ "pseudo_column ::= QDURATION", + /* 366 */ "pseudo_column ::= WSTART", + /* 367 */ "pseudo_column ::= WEND", + /* 368 */ "pseudo_column ::= WDURATION", + /* 369 */ "pseudo_column ::= IROWTS", + /* 370 */ "pseudo_column ::= QTAGS", + /* 371 */ "function_expression ::= function_name NK_LP expression_list NK_RP", + /* 372 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", + /* 373 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP", + /* 374 */ "function_expression ::= literal_func", + /* 375 */ "literal_func ::= noarg_func NK_LP NK_RP", + /* 376 */ "literal_func ::= NOW", + /* 377 */ "noarg_func ::= NOW", + /* 378 */ "noarg_func ::= TODAY", + /* 379 */ "noarg_func ::= TIMEZONE", + /* 380 */ "noarg_func ::= DATABASE", + /* 381 */ "noarg_func ::= CLIENT_VERSION", + /* 382 */ "noarg_func ::= SERVER_VERSION", + /* 383 */ "noarg_func ::= SERVER_STATUS", + /* 384 */ "noarg_func ::= CURRENT_USER", + /* 385 */ "noarg_func ::= USER", + /* 386 */ "star_func ::= COUNT", + /* 387 */ "star_func ::= FIRST", + /* 388 */ "star_func ::= LAST", + /* 389 */ "star_func ::= LAST_ROW", + /* 390 */ "star_func_para_list ::= NK_STAR", + /* 391 */ "star_func_para_list ::= other_para_list", + /* 392 */ "other_para_list ::= star_func_para", + /* 393 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", + /* 394 */ "star_func_para ::= expr_or_subquery", + /* 395 */ "star_func_para ::= table_name NK_DOT NK_STAR", + /* 396 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END", + /* 397 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END", + /* 398 */ "when_then_list ::= when_then_expr", + /* 399 */ "when_then_list ::= when_then_list when_then_expr", + /* 400 */ "when_then_expr ::= WHEN common_expression THEN common_expression", + /* 401 */ "case_when_else_opt ::=", + /* 402 */ "case_when_else_opt ::= ELSE common_expression", + /* 403 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery", + /* 404 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery", + /* 405 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery", + /* 406 */ "predicate ::= expr_or_subquery IS NULL", + /* 407 */ "predicate ::= expr_or_subquery IS NOT NULL", + /* 408 */ "predicate ::= expr_or_subquery in_op in_predicate_value", + /* 409 */ "compare_op ::= NK_LT", + /* 410 */ "compare_op ::= NK_GT", + /* 411 */ "compare_op ::= NK_LE", + /* 412 */ "compare_op ::= NK_GE", + /* 413 */ "compare_op ::= NK_NE", + /* 414 */ "compare_op ::= NK_EQ", + /* 415 */ "compare_op ::= LIKE", + /* 416 */ "compare_op ::= NOT LIKE", + /* 417 */ "compare_op ::= MATCH", + /* 418 */ "compare_op ::= NMATCH", + /* 419 */ "compare_op ::= CONTAINS", + /* 420 */ "in_op ::= IN", + /* 421 */ "in_op ::= NOT IN", + /* 422 */ "in_predicate_value ::= NK_LP literal_list NK_RP", + /* 423 */ "boolean_value_expression ::= boolean_primary", + /* 424 */ "boolean_value_expression ::= NOT boolean_primary", + /* 425 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", + /* 426 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", + /* 427 */ "boolean_primary ::= predicate", + /* 428 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", + /* 429 */ "common_expression ::= expr_or_subquery", + /* 430 */ "common_expression ::= boolean_value_expression", + /* 431 */ "from_clause_opt ::=", + /* 432 */ "from_clause_opt ::= FROM table_reference_list", + /* 433 */ "table_reference_list ::= table_reference", + /* 434 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", + /* 435 */ "table_reference ::= table_primary", + /* 436 */ "table_reference ::= joined_table", + /* 437 */ "table_primary ::= table_name alias_opt", + /* 438 */ "table_primary ::= db_name NK_DOT table_name alias_opt", + /* 439 */ "table_primary ::= subquery alias_opt", + /* 440 */ "table_primary ::= parenthesized_joined_table", + /* 441 */ "alias_opt ::=", + /* 442 */ "alias_opt ::= table_alias", + /* 443 */ "alias_opt ::= AS table_alias", + /* 444 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", + /* 445 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", + /* 446 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", + /* 447 */ "join_type ::=", + /* 448 */ "join_type ::= INNER", + /* 449 */ "query_specification ::= SELECT set_quantifier_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", + /* 450 */ "set_quantifier_opt ::=", + /* 451 */ "set_quantifier_opt ::= DISTINCT", + /* 452 */ "set_quantifier_opt ::= ALL", + /* 453 */ "select_list ::= select_item", + /* 454 */ "select_list ::= select_list NK_COMMA select_item", + /* 455 */ "select_item ::= NK_STAR", + /* 456 */ "select_item ::= common_expression", + /* 457 */ "select_item ::= common_expression column_alias", + /* 458 */ "select_item ::= common_expression AS column_alias", + /* 459 */ "select_item ::= table_name NK_DOT NK_STAR", + /* 460 */ "where_clause_opt ::=", + /* 461 */ "where_clause_opt ::= WHERE search_condition", + /* 462 */ "partition_by_clause_opt ::=", + /* 463 */ "partition_by_clause_opt ::= PARTITION BY partition_list", + /* 464 */ "partition_list ::= partition_item", + /* 465 */ "partition_list ::= partition_list NK_COMMA partition_item", + /* 466 */ "partition_item ::= expr_or_subquery", + /* 467 */ "partition_item ::= expr_or_subquery column_alias", + /* 468 */ "partition_item ::= expr_or_subquery AS column_alias", + /* 469 */ "twindow_clause_opt ::=", + /* 470 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", + /* 471 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP", + /* 472 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", + /* 473 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", + /* 474 */ "sliding_opt ::=", + /* 475 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", + /* 476 */ "fill_opt ::=", + /* 477 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", + /* 478 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", + /* 479 */ "fill_mode ::= NONE", + /* 480 */ "fill_mode ::= PREV", + /* 481 */ "fill_mode ::= NULL", + /* 482 */ "fill_mode ::= LINEAR", + /* 483 */ "fill_mode ::= NEXT", + /* 484 */ "group_by_clause_opt ::=", + /* 485 */ "group_by_clause_opt ::= GROUP BY group_by_list", + /* 486 */ "group_by_list ::= expr_or_subquery", + /* 487 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery", + /* 488 */ "having_clause_opt ::=", + /* 489 */ "having_clause_opt ::= HAVING search_condition", + /* 490 */ "range_opt ::=", + /* 491 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP", + /* 492 */ "every_opt ::=", + /* 493 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", + /* 494 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt", + /* 495 */ "query_simple ::= query_specification", + /* 496 */ "query_simple ::= union_query_expression", + /* 497 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery", + /* 498 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery", + /* 499 */ "query_simple_or_subquery ::= query_simple", + /* 500 */ "query_simple_or_subquery ::= subquery", + /* 501 */ "query_or_subquery ::= query_expression", + /* 502 */ "query_or_subquery ::= subquery", + /* 503 */ "order_by_clause_opt ::=", + /* 504 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", + /* 505 */ "slimit_clause_opt ::=", + /* 506 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", + /* 507 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", + /* 508 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 509 */ "limit_clause_opt ::=", + /* 510 */ "limit_clause_opt ::= LIMIT NK_INTEGER", + /* 511 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", + /* 512 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 513 */ "subquery ::= NK_LP query_expression NK_RP", + /* 514 */ "subquery ::= NK_LP subquery NK_RP", + /* 515 */ "search_condition ::= common_expression", + /* 516 */ "sort_specification_list ::= sort_specification", + /* 517 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", + /* 518 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt", + /* 519 */ "ordering_specification_opt ::=", + /* 520 */ "ordering_specification_opt ::= ASC", + /* 521 */ "ordering_specification_opt ::= DESC", + /* 522 */ "null_ordering_opt ::=", + /* 523 */ "null_ordering_opt ::= NULLS FIRST", + /* 524 */ "null_ordering_opt ::= NULLS LAST", }; #endif /* NDEBUG */ @@ -3203,303 +3204,304 @@ static const struct { { 317, -2 }, /* (224) cmd ::= SHOW SCORES */ { 317, -2 }, /* (225) cmd ::= SHOW TOPICS */ { 317, -2 }, /* (226) cmd ::= SHOW VARIABLES */ - { 317, -3 }, /* (227) cmd ::= SHOW LOCAL VARIABLES */ - { 317, -4 }, /* (228) cmd ::= SHOW DNODE NK_INTEGER VARIABLES */ - { 317, -2 }, /* (229) cmd ::= SHOW BNODES */ - { 317, -2 }, /* (230) cmd ::= SHOW SNODES */ - { 317, -2 }, /* (231) cmd ::= SHOW CLUSTER */ - { 317, -2 }, /* (232) cmd ::= SHOW TRANSACTIONS */ - { 317, -4 }, /* (233) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ - { 317, -2 }, /* (234) cmd ::= SHOW CONSUMERS */ - { 317, -2 }, /* (235) cmd ::= SHOW SUBSCRIPTIONS */ - { 317, -5 }, /* (236) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ - { 317, -6 }, /* (237) cmd ::= SHOW TABLE TAGS FROM table_name_cond from_db_opt */ - { 317, -3 }, /* (238) cmd ::= SHOW VNODES NK_INTEGER */ - { 317, -3 }, /* (239) cmd ::= SHOW VNODES NK_STRING */ - { 366, 0 }, /* (240) db_name_cond_opt ::= */ - { 366, -2 }, /* (241) db_name_cond_opt ::= db_name NK_DOT */ - { 367, 0 }, /* (242) like_pattern_opt ::= */ - { 367, -2 }, /* (243) like_pattern_opt ::= LIKE NK_STRING */ - { 368, -1 }, /* (244) table_name_cond ::= table_name */ - { 369, 0 }, /* (245) from_db_opt ::= */ - { 369, -2 }, /* (246) from_db_opt ::= FROM db_name */ - { 317, -8 }, /* (247) cmd ::= CREATE SMA INDEX not_exists_opt full_table_name ON full_table_name index_options */ - { 317, -4 }, /* (248) cmd ::= DROP INDEX exists_opt full_table_name */ - { 370, -10 }, /* (249) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ - { 370, -12 }, /* (250) 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 */ - { 371, -1 }, /* (251) func_list ::= func */ - { 371, -3 }, /* (252) func_list ::= func_list NK_COMMA func */ - { 374, -4 }, /* (253) func ::= function_name NK_LP expression_list NK_RP */ - { 373, 0 }, /* (254) sma_stream_opt ::= */ - { 373, -3 }, /* (255) sma_stream_opt ::= stream_options WATERMARK duration_literal */ - { 373, -3 }, /* (256) sma_stream_opt ::= stream_options MAX_DELAY duration_literal */ - { 317, -6 }, /* (257) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ - { 317, -7 }, /* (258) cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ - { 317, -9 }, /* (259) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ - { 317, -7 }, /* (260) cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ - { 317, -9 }, /* (261) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ - { 317, -4 }, /* (262) cmd ::= DROP TOPIC exists_opt topic_name */ - { 317, -7 }, /* (263) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ - { 317, -2 }, /* (264) cmd ::= DESC full_table_name */ - { 317, -2 }, /* (265) cmd ::= DESCRIBE full_table_name */ - { 317, -3 }, /* (266) cmd ::= RESET QUERY CACHE */ - { 317, -4 }, /* (267) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ - { 379, 0 }, /* (268) analyze_opt ::= */ - { 379, -1 }, /* (269) analyze_opt ::= ANALYZE */ - { 380, 0 }, /* (270) explain_options ::= */ - { 380, -3 }, /* (271) explain_options ::= explain_options VERBOSE NK_BOOL */ - { 380, -3 }, /* (272) explain_options ::= explain_options RATIO NK_FLOAT */ - { 317, -10 }, /* (273) cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ - { 317, -4 }, /* (274) cmd ::= DROP FUNCTION exists_opt function_name */ - { 381, 0 }, /* (275) agg_func_opt ::= */ - { 381, -1 }, /* (276) agg_func_opt ::= AGGREGATE */ - { 382, 0 }, /* (277) bufsize_opt ::= */ - { 382, -2 }, /* (278) bufsize_opt ::= BUFSIZE NK_INTEGER */ - { 317, -11 }, /* (279) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name tags_def_opt subtable_opt AS query_or_subquery */ - { 317, -4 }, /* (280) cmd ::= DROP STREAM exists_opt stream_name */ - { 375, 0 }, /* (281) stream_options ::= */ - { 375, -3 }, /* (282) stream_options ::= stream_options TRIGGER AT_ONCE */ - { 375, -3 }, /* (283) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ - { 375, -4 }, /* (284) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ - { 375, -3 }, /* (285) stream_options ::= stream_options WATERMARK duration_literal */ - { 375, -4 }, /* (286) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ - { 384, 0 }, /* (287) subtable_opt ::= */ - { 384, -4 }, /* (288) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - { 317, -3 }, /* (289) cmd ::= KILL CONNECTION NK_INTEGER */ - { 317, -3 }, /* (290) cmd ::= KILL QUERY NK_STRING */ - { 317, -3 }, /* (291) cmd ::= KILL TRANSACTION NK_INTEGER */ - { 317, -2 }, /* (292) cmd ::= BALANCE VGROUP */ - { 317, -4 }, /* (293) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ - { 317, -4 }, /* (294) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ - { 317, -3 }, /* (295) cmd ::= SPLIT VGROUP NK_INTEGER */ - { 386, -2 }, /* (296) dnode_list ::= DNODE NK_INTEGER */ - { 386, -3 }, /* (297) dnode_list ::= dnode_list DNODE NK_INTEGER */ - { 317, -4 }, /* (298) cmd ::= DELETE FROM full_table_name where_clause_opt */ - { 317, -1 }, /* (299) cmd ::= query_or_subquery */ - { 317, -7 }, /* (300) cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ - { 317, -4 }, /* (301) cmd ::= INSERT INTO full_table_name query_or_subquery */ - { 320, -1 }, /* (302) literal ::= NK_INTEGER */ - { 320, -1 }, /* (303) literal ::= NK_FLOAT */ - { 320, -1 }, /* (304) literal ::= NK_STRING */ - { 320, -1 }, /* (305) literal ::= NK_BOOL */ - { 320, -2 }, /* (306) literal ::= TIMESTAMP NK_STRING */ - { 320, -1 }, /* (307) literal ::= duration_literal */ - { 320, -1 }, /* (308) literal ::= NULL */ - { 320, -1 }, /* (309) literal ::= NK_QUESTION */ - { 362, -1 }, /* (310) duration_literal ::= NK_VARIABLE */ - { 388, -1 }, /* (311) signed ::= NK_INTEGER */ - { 388, -2 }, /* (312) signed ::= NK_PLUS NK_INTEGER */ - { 388, -2 }, /* (313) signed ::= NK_MINUS NK_INTEGER */ - { 388, -1 }, /* (314) signed ::= NK_FLOAT */ - { 388, -2 }, /* (315) signed ::= NK_PLUS NK_FLOAT */ - { 388, -2 }, /* (316) signed ::= NK_MINUS NK_FLOAT */ - { 351, -1 }, /* (317) signed_literal ::= signed */ - { 351, -1 }, /* (318) signed_literal ::= NK_STRING */ - { 351, -1 }, /* (319) signed_literal ::= NK_BOOL */ - { 351, -2 }, /* (320) signed_literal ::= TIMESTAMP NK_STRING */ - { 351, -1 }, /* (321) signed_literal ::= duration_literal */ - { 351, -1 }, /* (322) signed_literal ::= NULL */ - { 351, -1 }, /* (323) signed_literal ::= literal_func */ - { 351, -1 }, /* (324) signed_literal ::= NK_QUESTION */ - { 390, -1 }, /* (325) literal_list ::= signed_literal */ - { 390, -3 }, /* (326) literal_list ::= literal_list NK_COMMA signed_literal */ - { 328, -1 }, /* (327) db_name ::= NK_ID */ - { 357, -1 }, /* (328) table_name ::= NK_ID */ - { 349, -1 }, /* (329) column_name ::= NK_ID */ - { 364, -1 }, /* (330) function_name ::= NK_ID */ - { 391, -1 }, /* (331) table_alias ::= NK_ID */ - { 392, -1 }, /* (332) column_alias ::= NK_ID */ - { 322, -1 }, /* (333) user_name ::= NK_ID */ - { 376, -1 }, /* (334) topic_name ::= NK_ID */ - { 383, -1 }, /* (335) stream_name ::= NK_ID */ - { 378, -1 }, /* (336) cgroup_name ::= NK_ID */ - { 393, -1 }, /* (337) expr_or_subquery ::= expression */ - { 393, -1 }, /* (338) expr_or_subquery ::= subquery */ - { 385, -1 }, /* (339) expression ::= literal */ - { 385, -1 }, /* (340) expression ::= pseudo_column */ - { 385, -1 }, /* (341) expression ::= column_reference */ - { 385, -1 }, /* (342) expression ::= function_expression */ - { 385, -1 }, /* (343) expression ::= case_when_expression */ - { 385, -3 }, /* (344) expression ::= NK_LP expression NK_RP */ - { 385, -2 }, /* (345) expression ::= NK_PLUS expr_or_subquery */ - { 385, -2 }, /* (346) expression ::= NK_MINUS expr_or_subquery */ - { 385, -3 }, /* (347) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ - { 385, -3 }, /* (348) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ - { 385, -3 }, /* (349) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ - { 385, -3 }, /* (350) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ - { 385, -3 }, /* (351) expression ::= expr_or_subquery NK_REM expr_or_subquery */ - { 385, -3 }, /* (352) expression ::= column_reference NK_ARROW NK_STRING */ - { 385, -3 }, /* (353) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ - { 385, -3 }, /* (354) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ - { 354, -1 }, /* (355) expression_list ::= expr_or_subquery */ - { 354, -3 }, /* (356) expression_list ::= expression_list NK_COMMA expr_or_subquery */ - { 396, -1 }, /* (357) column_reference ::= column_name */ - { 396, -3 }, /* (358) column_reference ::= table_name NK_DOT column_name */ - { 395, -1 }, /* (359) pseudo_column ::= ROWTS */ - { 395, -1 }, /* (360) pseudo_column ::= TBNAME */ - { 395, -3 }, /* (361) pseudo_column ::= table_name NK_DOT TBNAME */ - { 395, -1 }, /* (362) pseudo_column ::= QSTART */ - { 395, -1 }, /* (363) pseudo_column ::= QEND */ - { 395, -1 }, /* (364) pseudo_column ::= QDURATION */ - { 395, -1 }, /* (365) pseudo_column ::= WSTART */ - { 395, -1 }, /* (366) pseudo_column ::= WEND */ - { 395, -1 }, /* (367) pseudo_column ::= WDURATION */ - { 395, -1 }, /* (368) pseudo_column ::= IROWTS */ - { 395, -1 }, /* (369) pseudo_column ::= QTAGS */ - { 397, -4 }, /* (370) function_expression ::= function_name NK_LP expression_list NK_RP */ - { 397, -4 }, /* (371) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ - { 397, -6 }, /* (372) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ - { 397, -1 }, /* (373) function_expression ::= literal_func */ - { 389, -3 }, /* (374) literal_func ::= noarg_func NK_LP NK_RP */ - { 389, -1 }, /* (375) literal_func ::= NOW */ - { 401, -1 }, /* (376) noarg_func ::= NOW */ - { 401, -1 }, /* (377) noarg_func ::= TODAY */ - { 401, -1 }, /* (378) noarg_func ::= TIMEZONE */ - { 401, -1 }, /* (379) noarg_func ::= DATABASE */ - { 401, -1 }, /* (380) noarg_func ::= CLIENT_VERSION */ - { 401, -1 }, /* (381) noarg_func ::= SERVER_VERSION */ - { 401, -1 }, /* (382) noarg_func ::= SERVER_STATUS */ - { 401, -1 }, /* (383) noarg_func ::= CURRENT_USER */ - { 401, -1 }, /* (384) noarg_func ::= USER */ - { 399, -1 }, /* (385) star_func ::= COUNT */ - { 399, -1 }, /* (386) star_func ::= FIRST */ - { 399, -1 }, /* (387) star_func ::= LAST */ - { 399, -1 }, /* (388) star_func ::= LAST_ROW */ - { 400, -1 }, /* (389) star_func_para_list ::= NK_STAR */ - { 400, -1 }, /* (390) star_func_para_list ::= other_para_list */ - { 402, -1 }, /* (391) other_para_list ::= star_func_para */ - { 402, -3 }, /* (392) other_para_list ::= other_para_list NK_COMMA star_func_para */ - { 403, -1 }, /* (393) star_func_para ::= expr_or_subquery */ - { 403, -3 }, /* (394) star_func_para ::= table_name NK_DOT NK_STAR */ - { 398, -4 }, /* (395) case_when_expression ::= CASE when_then_list case_when_else_opt END */ - { 398, -5 }, /* (396) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ - { 404, -1 }, /* (397) when_then_list ::= when_then_expr */ - { 404, -2 }, /* (398) when_then_list ::= when_then_list when_then_expr */ - { 407, -4 }, /* (399) when_then_expr ::= WHEN common_expression THEN common_expression */ - { 405, 0 }, /* (400) case_when_else_opt ::= */ - { 405, -2 }, /* (401) case_when_else_opt ::= ELSE common_expression */ - { 408, -3 }, /* (402) predicate ::= expr_or_subquery compare_op expr_or_subquery */ - { 408, -5 }, /* (403) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ - { 408, -6 }, /* (404) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ - { 408, -3 }, /* (405) predicate ::= expr_or_subquery IS NULL */ - { 408, -4 }, /* (406) predicate ::= expr_or_subquery IS NOT NULL */ - { 408, -3 }, /* (407) predicate ::= expr_or_subquery in_op in_predicate_value */ - { 409, -1 }, /* (408) compare_op ::= NK_LT */ - { 409, -1 }, /* (409) compare_op ::= NK_GT */ - { 409, -1 }, /* (410) compare_op ::= NK_LE */ - { 409, -1 }, /* (411) compare_op ::= NK_GE */ - { 409, -1 }, /* (412) compare_op ::= NK_NE */ - { 409, -1 }, /* (413) compare_op ::= NK_EQ */ - { 409, -1 }, /* (414) compare_op ::= LIKE */ - { 409, -2 }, /* (415) compare_op ::= NOT LIKE */ - { 409, -1 }, /* (416) compare_op ::= MATCH */ - { 409, -1 }, /* (417) compare_op ::= NMATCH */ - { 409, -1 }, /* (418) compare_op ::= CONTAINS */ - { 410, -1 }, /* (419) in_op ::= IN */ - { 410, -2 }, /* (420) in_op ::= NOT IN */ - { 411, -3 }, /* (421) in_predicate_value ::= NK_LP literal_list NK_RP */ - { 412, -1 }, /* (422) boolean_value_expression ::= boolean_primary */ - { 412, -2 }, /* (423) boolean_value_expression ::= NOT boolean_primary */ - { 412, -3 }, /* (424) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - { 412, -3 }, /* (425) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - { 413, -1 }, /* (426) boolean_primary ::= predicate */ - { 413, -3 }, /* (427) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - { 406, -1 }, /* (428) common_expression ::= expr_or_subquery */ - { 406, -1 }, /* (429) common_expression ::= boolean_value_expression */ - { 414, 0 }, /* (430) from_clause_opt ::= */ - { 414, -2 }, /* (431) from_clause_opt ::= FROM table_reference_list */ - { 415, -1 }, /* (432) table_reference_list ::= table_reference */ - { 415, -3 }, /* (433) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - { 416, -1 }, /* (434) table_reference ::= table_primary */ - { 416, -1 }, /* (435) table_reference ::= joined_table */ - { 417, -2 }, /* (436) table_primary ::= table_name alias_opt */ - { 417, -4 }, /* (437) table_primary ::= db_name NK_DOT table_name alias_opt */ - { 417, -2 }, /* (438) table_primary ::= subquery alias_opt */ - { 417, -1 }, /* (439) table_primary ::= parenthesized_joined_table */ - { 419, 0 }, /* (440) alias_opt ::= */ - { 419, -1 }, /* (441) alias_opt ::= table_alias */ - { 419, -2 }, /* (442) alias_opt ::= AS table_alias */ - { 420, -3 }, /* (443) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - { 420, -3 }, /* (444) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - { 418, -6 }, /* (445) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ - { 421, 0 }, /* (446) join_type ::= */ - { 421, -1 }, /* (447) join_type ::= INNER */ - { 423, -12 }, /* (448) query_specification ::= SELECT set_quantifier_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 */ - { 424, 0 }, /* (449) set_quantifier_opt ::= */ - { 424, -1 }, /* (450) set_quantifier_opt ::= DISTINCT */ - { 424, -1 }, /* (451) set_quantifier_opt ::= ALL */ - { 425, -1 }, /* (452) select_list ::= select_item */ - { 425, -3 }, /* (453) select_list ::= select_list NK_COMMA select_item */ - { 433, -1 }, /* (454) select_item ::= NK_STAR */ - { 433, -1 }, /* (455) select_item ::= common_expression */ - { 433, -2 }, /* (456) select_item ::= common_expression column_alias */ - { 433, -3 }, /* (457) select_item ::= common_expression AS column_alias */ - { 433, -3 }, /* (458) select_item ::= table_name NK_DOT NK_STAR */ - { 387, 0 }, /* (459) where_clause_opt ::= */ - { 387, -2 }, /* (460) where_clause_opt ::= WHERE search_condition */ - { 426, 0 }, /* (461) partition_by_clause_opt ::= */ - { 426, -3 }, /* (462) partition_by_clause_opt ::= PARTITION BY partition_list */ - { 434, -1 }, /* (463) partition_list ::= partition_item */ - { 434, -3 }, /* (464) partition_list ::= partition_list NK_COMMA partition_item */ - { 435, -1 }, /* (465) partition_item ::= expr_or_subquery */ - { 435, -2 }, /* (466) partition_item ::= expr_or_subquery column_alias */ - { 435, -3 }, /* (467) partition_item ::= expr_or_subquery AS column_alias */ - { 430, 0 }, /* (468) twindow_clause_opt ::= */ - { 430, -6 }, /* (469) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ - { 430, -4 }, /* (470) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ - { 430, -6 }, /* (471) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ - { 430, -8 }, /* (472) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ - { 372, 0 }, /* (473) sliding_opt ::= */ - { 372, -4 }, /* (474) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ - { 429, 0 }, /* (475) fill_opt ::= */ - { 429, -4 }, /* (476) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - { 429, -6 }, /* (477) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ - { 436, -1 }, /* (478) fill_mode ::= NONE */ - { 436, -1 }, /* (479) fill_mode ::= PREV */ - { 436, -1 }, /* (480) fill_mode ::= NULL */ - { 436, -1 }, /* (481) fill_mode ::= LINEAR */ - { 436, -1 }, /* (482) fill_mode ::= NEXT */ - { 431, 0 }, /* (483) group_by_clause_opt ::= */ - { 431, -3 }, /* (484) group_by_clause_opt ::= GROUP BY group_by_list */ - { 437, -1 }, /* (485) group_by_list ::= expr_or_subquery */ - { 437, -3 }, /* (486) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ - { 432, 0 }, /* (487) having_clause_opt ::= */ - { 432, -2 }, /* (488) having_clause_opt ::= HAVING search_condition */ - { 427, 0 }, /* (489) range_opt ::= */ - { 427, -6 }, /* (490) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ - { 428, 0 }, /* (491) every_opt ::= */ - { 428, -4 }, /* (492) every_opt ::= EVERY NK_LP duration_literal NK_RP */ - { 438, -4 }, /* (493) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ - { 439, -1 }, /* (494) query_simple ::= query_specification */ - { 439, -1 }, /* (495) query_simple ::= union_query_expression */ - { 443, -4 }, /* (496) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ - { 443, -3 }, /* (497) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ - { 444, -1 }, /* (498) query_simple_or_subquery ::= query_simple */ - { 444, -1 }, /* (499) query_simple_or_subquery ::= subquery */ - { 377, -1 }, /* (500) query_or_subquery ::= query_expression */ - { 377, -1 }, /* (501) query_or_subquery ::= subquery */ - { 440, 0 }, /* (502) order_by_clause_opt ::= */ - { 440, -3 }, /* (503) order_by_clause_opt ::= ORDER BY sort_specification_list */ - { 441, 0 }, /* (504) slimit_clause_opt ::= */ - { 441, -2 }, /* (505) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - { 441, -4 }, /* (506) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - { 441, -4 }, /* (507) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - { 442, 0 }, /* (508) limit_clause_opt ::= */ - { 442, -2 }, /* (509) limit_clause_opt ::= LIMIT NK_INTEGER */ - { 442, -4 }, /* (510) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - { 442, -4 }, /* (511) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - { 394, -3 }, /* (512) subquery ::= NK_LP query_expression NK_RP */ - { 394, -3 }, /* (513) subquery ::= NK_LP subquery NK_RP */ - { 422, -1 }, /* (514) search_condition ::= common_expression */ - { 445, -1 }, /* (515) sort_specification_list ::= sort_specification */ - { 445, -3 }, /* (516) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - { 446, -3 }, /* (517) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ - { 447, 0 }, /* (518) ordering_specification_opt ::= */ - { 447, -1 }, /* (519) ordering_specification_opt ::= ASC */ - { 447, -1 }, /* (520) ordering_specification_opt ::= DESC */ - { 448, 0 }, /* (521) null_ordering_opt ::= */ - { 448, -2 }, /* (522) null_ordering_opt ::= NULLS FIRST */ - { 448, -2 }, /* (523) null_ordering_opt ::= NULLS LAST */ + { 317, -3 }, /* (227) cmd ::= SHOW CLUSTER VARIABLES */ + { 317, -3 }, /* (228) cmd ::= SHOW LOCAL VARIABLES */ + { 317, -5 }, /* (229) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ + { 317, -2 }, /* (230) cmd ::= SHOW BNODES */ + { 317, -2 }, /* (231) cmd ::= SHOW SNODES */ + { 317, -2 }, /* (232) cmd ::= SHOW CLUSTER */ + { 317, -2 }, /* (233) cmd ::= SHOW TRANSACTIONS */ + { 317, -4 }, /* (234) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ + { 317, -2 }, /* (235) cmd ::= SHOW CONSUMERS */ + { 317, -2 }, /* (236) cmd ::= SHOW SUBSCRIPTIONS */ + { 317, -5 }, /* (237) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ + { 317, -6 }, /* (238) cmd ::= SHOW TABLE TAGS FROM table_name_cond from_db_opt */ + { 317, -3 }, /* (239) cmd ::= SHOW VNODES NK_INTEGER */ + { 317, -3 }, /* (240) cmd ::= SHOW VNODES NK_STRING */ + { 366, 0 }, /* (241) db_name_cond_opt ::= */ + { 366, -2 }, /* (242) db_name_cond_opt ::= db_name NK_DOT */ + { 367, 0 }, /* (243) like_pattern_opt ::= */ + { 367, -2 }, /* (244) like_pattern_opt ::= LIKE NK_STRING */ + { 368, -1 }, /* (245) table_name_cond ::= table_name */ + { 369, 0 }, /* (246) from_db_opt ::= */ + { 369, -2 }, /* (247) from_db_opt ::= FROM db_name */ + { 317, -8 }, /* (248) cmd ::= CREATE SMA INDEX not_exists_opt full_table_name ON full_table_name index_options */ + { 317, -4 }, /* (249) cmd ::= DROP INDEX exists_opt full_table_name */ + { 370, -10 }, /* (250) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ + { 370, -12 }, /* (251) 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 */ + { 371, -1 }, /* (252) func_list ::= func */ + { 371, -3 }, /* (253) func_list ::= func_list NK_COMMA func */ + { 374, -4 }, /* (254) func ::= function_name NK_LP expression_list NK_RP */ + { 373, 0 }, /* (255) sma_stream_opt ::= */ + { 373, -3 }, /* (256) sma_stream_opt ::= stream_options WATERMARK duration_literal */ + { 373, -3 }, /* (257) sma_stream_opt ::= stream_options MAX_DELAY duration_literal */ + { 317, -6 }, /* (258) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ + { 317, -7 }, /* (259) cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ + { 317, -9 }, /* (260) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ + { 317, -7 }, /* (261) cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ + { 317, -9 }, /* (262) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ + { 317, -4 }, /* (263) cmd ::= DROP TOPIC exists_opt topic_name */ + { 317, -7 }, /* (264) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ + { 317, -2 }, /* (265) cmd ::= DESC full_table_name */ + { 317, -2 }, /* (266) cmd ::= DESCRIBE full_table_name */ + { 317, -3 }, /* (267) cmd ::= RESET QUERY CACHE */ + { 317, -4 }, /* (268) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ + { 379, 0 }, /* (269) analyze_opt ::= */ + { 379, -1 }, /* (270) analyze_opt ::= ANALYZE */ + { 380, 0 }, /* (271) explain_options ::= */ + { 380, -3 }, /* (272) explain_options ::= explain_options VERBOSE NK_BOOL */ + { 380, -3 }, /* (273) explain_options ::= explain_options RATIO NK_FLOAT */ + { 317, -10 }, /* (274) cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ + { 317, -4 }, /* (275) cmd ::= DROP FUNCTION exists_opt function_name */ + { 381, 0 }, /* (276) agg_func_opt ::= */ + { 381, -1 }, /* (277) agg_func_opt ::= AGGREGATE */ + { 382, 0 }, /* (278) bufsize_opt ::= */ + { 382, -2 }, /* (279) bufsize_opt ::= BUFSIZE NK_INTEGER */ + { 317, -11 }, /* (280) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name tags_def_opt subtable_opt AS query_or_subquery */ + { 317, -4 }, /* (281) cmd ::= DROP STREAM exists_opt stream_name */ + { 375, 0 }, /* (282) stream_options ::= */ + { 375, -3 }, /* (283) stream_options ::= stream_options TRIGGER AT_ONCE */ + { 375, -3 }, /* (284) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ + { 375, -4 }, /* (285) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ + { 375, -3 }, /* (286) stream_options ::= stream_options WATERMARK duration_literal */ + { 375, -4 }, /* (287) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ + { 384, 0 }, /* (288) subtable_opt ::= */ + { 384, -4 }, /* (289) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + { 317, -3 }, /* (290) cmd ::= KILL CONNECTION NK_INTEGER */ + { 317, -3 }, /* (291) cmd ::= KILL QUERY NK_STRING */ + { 317, -3 }, /* (292) cmd ::= KILL TRANSACTION NK_INTEGER */ + { 317, -2 }, /* (293) cmd ::= BALANCE VGROUP */ + { 317, -4 }, /* (294) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + { 317, -4 }, /* (295) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ + { 317, -3 }, /* (296) cmd ::= SPLIT VGROUP NK_INTEGER */ + { 386, -2 }, /* (297) dnode_list ::= DNODE NK_INTEGER */ + { 386, -3 }, /* (298) dnode_list ::= dnode_list DNODE NK_INTEGER */ + { 317, -4 }, /* (299) cmd ::= DELETE FROM full_table_name where_clause_opt */ + { 317, -1 }, /* (300) cmd ::= query_or_subquery */ + { 317, -7 }, /* (301) cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ + { 317, -4 }, /* (302) cmd ::= INSERT INTO full_table_name query_or_subquery */ + { 320, -1 }, /* (303) literal ::= NK_INTEGER */ + { 320, -1 }, /* (304) literal ::= NK_FLOAT */ + { 320, -1 }, /* (305) literal ::= NK_STRING */ + { 320, -1 }, /* (306) literal ::= NK_BOOL */ + { 320, -2 }, /* (307) literal ::= TIMESTAMP NK_STRING */ + { 320, -1 }, /* (308) literal ::= duration_literal */ + { 320, -1 }, /* (309) literal ::= NULL */ + { 320, -1 }, /* (310) literal ::= NK_QUESTION */ + { 362, -1 }, /* (311) duration_literal ::= NK_VARIABLE */ + { 388, -1 }, /* (312) signed ::= NK_INTEGER */ + { 388, -2 }, /* (313) signed ::= NK_PLUS NK_INTEGER */ + { 388, -2 }, /* (314) signed ::= NK_MINUS NK_INTEGER */ + { 388, -1 }, /* (315) signed ::= NK_FLOAT */ + { 388, -2 }, /* (316) signed ::= NK_PLUS NK_FLOAT */ + { 388, -2 }, /* (317) signed ::= NK_MINUS NK_FLOAT */ + { 351, -1 }, /* (318) signed_literal ::= signed */ + { 351, -1 }, /* (319) signed_literal ::= NK_STRING */ + { 351, -1 }, /* (320) signed_literal ::= NK_BOOL */ + { 351, -2 }, /* (321) signed_literal ::= TIMESTAMP NK_STRING */ + { 351, -1 }, /* (322) signed_literal ::= duration_literal */ + { 351, -1 }, /* (323) signed_literal ::= NULL */ + { 351, -1 }, /* (324) signed_literal ::= literal_func */ + { 351, -1 }, /* (325) signed_literal ::= NK_QUESTION */ + { 390, -1 }, /* (326) literal_list ::= signed_literal */ + { 390, -3 }, /* (327) literal_list ::= literal_list NK_COMMA signed_literal */ + { 328, -1 }, /* (328) db_name ::= NK_ID */ + { 357, -1 }, /* (329) table_name ::= NK_ID */ + { 349, -1 }, /* (330) column_name ::= NK_ID */ + { 364, -1 }, /* (331) function_name ::= NK_ID */ + { 391, -1 }, /* (332) table_alias ::= NK_ID */ + { 392, -1 }, /* (333) column_alias ::= NK_ID */ + { 322, -1 }, /* (334) user_name ::= NK_ID */ + { 376, -1 }, /* (335) topic_name ::= NK_ID */ + { 383, -1 }, /* (336) stream_name ::= NK_ID */ + { 378, -1 }, /* (337) cgroup_name ::= NK_ID */ + { 393, -1 }, /* (338) expr_or_subquery ::= expression */ + { 393, -1 }, /* (339) expr_or_subquery ::= subquery */ + { 385, -1 }, /* (340) expression ::= literal */ + { 385, -1 }, /* (341) expression ::= pseudo_column */ + { 385, -1 }, /* (342) expression ::= column_reference */ + { 385, -1 }, /* (343) expression ::= function_expression */ + { 385, -1 }, /* (344) expression ::= case_when_expression */ + { 385, -3 }, /* (345) expression ::= NK_LP expression NK_RP */ + { 385, -2 }, /* (346) expression ::= NK_PLUS expr_or_subquery */ + { 385, -2 }, /* (347) expression ::= NK_MINUS expr_or_subquery */ + { 385, -3 }, /* (348) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ + { 385, -3 }, /* (349) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ + { 385, -3 }, /* (350) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ + { 385, -3 }, /* (351) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ + { 385, -3 }, /* (352) expression ::= expr_or_subquery NK_REM expr_or_subquery */ + { 385, -3 }, /* (353) expression ::= column_reference NK_ARROW NK_STRING */ + { 385, -3 }, /* (354) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ + { 385, -3 }, /* (355) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ + { 354, -1 }, /* (356) expression_list ::= expr_or_subquery */ + { 354, -3 }, /* (357) expression_list ::= expression_list NK_COMMA expr_or_subquery */ + { 396, -1 }, /* (358) column_reference ::= column_name */ + { 396, -3 }, /* (359) column_reference ::= table_name NK_DOT column_name */ + { 395, -1 }, /* (360) pseudo_column ::= ROWTS */ + { 395, -1 }, /* (361) pseudo_column ::= TBNAME */ + { 395, -3 }, /* (362) pseudo_column ::= table_name NK_DOT TBNAME */ + { 395, -1 }, /* (363) pseudo_column ::= QSTART */ + { 395, -1 }, /* (364) pseudo_column ::= QEND */ + { 395, -1 }, /* (365) pseudo_column ::= QDURATION */ + { 395, -1 }, /* (366) pseudo_column ::= WSTART */ + { 395, -1 }, /* (367) pseudo_column ::= WEND */ + { 395, -1 }, /* (368) pseudo_column ::= WDURATION */ + { 395, -1 }, /* (369) pseudo_column ::= IROWTS */ + { 395, -1 }, /* (370) pseudo_column ::= QTAGS */ + { 397, -4 }, /* (371) function_expression ::= function_name NK_LP expression_list NK_RP */ + { 397, -4 }, /* (372) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ + { 397, -6 }, /* (373) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ + { 397, -1 }, /* (374) function_expression ::= literal_func */ + { 389, -3 }, /* (375) literal_func ::= noarg_func NK_LP NK_RP */ + { 389, -1 }, /* (376) literal_func ::= NOW */ + { 401, -1 }, /* (377) noarg_func ::= NOW */ + { 401, -1 }, /* (378) noarg_func ::= TODAY */ + { 401, -1 }, /* (379) noarg_func ::= TIMEZONE */ + { 401, -1 }, /* (380) noarg_func ::= DATABASE */ + { 401, -1 }, /* (381) noarg_func ::= CLIENT_VERSION */ + { 401, -1 }, /* (382) noarg_func ::= SERVER_VERSION */ + { 401, -1 }, /* (383) noarg_func ::= SERVER_STATUS */ + { 401, -1 }, /* (384) noarg_func ::= CURRENT_USER */ + { 401, -1 }, /* (385) noarg_func ::= USER */ + { 399, -1 }, /* (386) star_func ::= COUNT */ + { 399, -1 }, /* (387) star_func ::= FIRST */ + { 399, -1 }, /* (388) star_func ::= LAST */ + { 399, -1 }, /* (389) star_func ::= LAST_ROW */ + { 400, -1 }, /* (390) star_func_para_list ::= NK_STAR */ + { 400, -1 }, /* (391) star_func_para_list ::= other_para_list */ + { 402, -1 }, /* (392) other_para_list ::= star_func_para */ + { 402, -3 }, /* (393) other_para_list ::= other_para_list NK_COMMA star_func_para */ + { 403, -1 }, /* (394) star_func_para ::= expr_or_subquery */ + { 403, -3 }, /* (395) star_func_para ::= table_name NK_DOT NK_STAR */ + { 398, -4 }, /* (396) case_when_expression ::= CASE when_then_list case_when_else_opt END */ + { 398, -5 }, /* (397) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ + { 404, -1 }, /* (398) when_then_list ::= when_then_expr */ + { 404, -2 }, /* (399) when_then_list ::= when_then_list when_then_expr */ + { 407, -4 }, /* (400) when_then_expr ::= WHEN common_expression THEN common_expression */ + { 405, 0 }, /* (401) case_when_else_opt ::= */ + { 405, -2 }, /* (402) case_when_else_opt ::= ELSE common_expression */ + { 408, -3 }, /* (403) predicate ::= expr_or_subquery compare_op expr_or_subquery */ + { 408, -5 }, /* (404) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ + { 408, -6 }, /* (405) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ + { 408, -3 }, /* (406) predicate ::= expr_or_subquery IS NULL */ + { 408, -4 }, /* (407) predicate ::= expr_or_subquery IS NOT NULL */ + { 408, -3 }, /* (408) predicate ::= expr_or_subquery in_op in_predicate_value */ + { 409, -1 }, /* (409) compare_op ::= NK_LT */ + { 409, -1 }, /* (410) compare_op ::= NK_GT */ + { 409, -1 }, /* (411) compare_op ::= NK_LE */ + { 409, -1 }, /* (412) compare_op ::= NK_GE */ + { 409, -1 }, /* (413) compare_op ::= NK_NE */ + { 409, -1 }, /* (414) compare_op ::= NK_EQ */ + { 409, -1 }, /* (415) compare_op ::= LIKE */ + { 409, -2 }, /* (416) compare_op ::= NOT LIKE */ + { 409, -1 }, /* (417) compare_op ::= MATCH */ + { 409, -1 }, /* (418) compare_op ::= NMATCH */ + { 409, -1 }, /* (419) compare_op ::= CONTAINS */ + { 410, -1 }, /* (420) in_op ::= IN */ + { 410, -2 }, /* (421) in_op ::= NOT IN */ + { 411, -3 }, /* (422) in_predicate_value ::= NK_LP literal_list NK_RP */ + { 412, -1 }, /* (423) boolean_value_expression ::= boolean_primary */ + { 412, -2 }, /* (424) boolean_value_expression ::= NOT boolean_primary */ + { 412, -3 }, /* (425) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + { 412, -3 }, /* (426) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + { 413, -1 }, /* (427) boolean_primary ::= predicate */ + { 413, -3 }, /* (428) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + { 406, -1 }, /* (429) common_expression ::= expr_or_subquery */ + { 406, -1 }, /* (430) common_expression ::= boolean_value_expression */ + { 414, 0 }, /* (431) from_clause_opt ::= */ + { 414, -2 }, /* (432) from_clause_opt ::= FROM table_reference_list */ + { 415, -1 }, /* (433) table_reference_list ::= table_reference */ + { 415, -3 }, /* (434) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + { 416, -1 }, /* (435) table_reference ::= table_primary */ + { 416, -1 }, /* (436) table_reference ::= joined_table */ + { 417, -2 }, /* (437) table_primary ::= table_name alias_opt */ + { 417, -4 }, /* (438) table_primary ::= db_name NK_DOT table_name alias_opt */ + { 417, -2 }, /* (439) table_primary ::= subquery alias_opt */ + { 417, -1 }, /* (440) table_primary ::= parenthesized_joined_table */ + { 419, 0 }, /* (441) alias_opt ::= */ + { 419, -1 }, /* (442) alias_opt ::= table_alias */ + { 419, -2 }, /* (443) alias_opt ::= AS table_alias */ + { 420, -3 }, /* (444) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + { 420, -3 }, /* (445) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + { 418, -6 }, /* (446) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ + { 421, 0 }, /* (447) join_type ::= */ + { 421, -1 }, /* (448) join_type ::= INNER */ + { 423, -12 }, /* (449) query_specification ::= SELECT set_quantifier_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 */ + { 424, 0 }, /* (450) set_quantifier_opt ::= */ + { 424, -1 }, /* (451) set_quantifier_opt ::= DISTINCT */ + { 424, -1 }, /* (452) set_quantifier_opt ::= ALL */ + { 425, -1 }, /* (453) select_list ::= select_item */ + { 425, -3 }, /* (454) select_list ::= select_list NK_COMMA select_item */ + { 433, -1 }, /* (455) select_item ::= NK_STAR */ + { 433, -1 }, /* (456) select_item ::= common_expression */ + { 433, -2 }, /* (457) select_item ::= common_expression column_alias */ + { 433, -3 }, /* (458) select_item ::= common_expression AS column_alias */ + { 433, -3 }, /* (459) select_item ::= table_name NK_DOT NK_STAR */ + { 387, 0 }, /* (460) where_clause_opt ::= */ + { 387, -2 }, /* (461) where_clause_opt ::= WHERE search_condition */ + { 426, 0 }, /* (462) partition_by_clause_opt ::= */ + { 426, -3 }, /* (463) partition_by_clause_opt ::= PARTITION BY partition_list */ + { 434, -1 }, /* (464) partition_list ::= partition_item */ + { 434, -3 }, /* (465) partition_list ::= partition_list NK_COMMA partition_item */ + { 435, -1 }, /* (466) partition_item ::= expr_or_subquery */ + { 435, -2 }, /* (467) partition_item ::= expr_or_subquery column_alias */ + { 435, -3 }, /* (468) partition_item ::= expr_or_subquery AS column_alias */ + { 430, 0 }, /* (469) twindow_clause_opt ::= */ + { 430, -6 }, /* (470) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ + { 430, -4 }, /* (471) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ + { 430, -6 }, /* (472) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ + { 430, -8 }, /* (473) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ + { 372, 0 }, /* (474) sliding_opt ::= */ + { 372, -4 }, /* (475) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ + { 429, 0 }, /* (476) fill_opt ::= */ + { 429, -4 }, /* (477) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + { 429, -6 }, /* (478) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ + { 436, -1 }, /* (479) fill_mode ::= NONE */ + { 436, -1 }, /* (480) fill_mode ::= PREV */ + { 436, -1 }, /* (481) fill_mode ::= NULL */ + { 436, -1 }, /* (482) fill_mode ::= LINEAR */ + { 436, -1 }, /* (483) fill_mode ::= NEXT */ + { 431, 0 }, /* (484) group_by_clause_opt ::= */ + { 431, -3 }, /* (485) group_by_clause_opt ::= GROUP BY group_by_list */ + { 437, -1 }, /* (486) group_by_list ::= expr_or_subquery */ + { 437, -3 }, /* (487) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ + { 432, 0 }, /* (488) having_clause_opt ::= */ + { 432, -2 }, /* (489) having_clause_opt ::= HAVING search_condition */ + { 427, 0 }, /* (490) range_opt ::= */ + { 427, -6 }, /* (491) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ + { 428, 0 }, /* (492) every_opt ::= */ + { 428, -4 }, /* (493) every_opt ::= EVERY NK_LP duration_literal NK_RP */ + { 438, -4 }, /* (494) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ + { 439, -1 }, /* (495) query_simple ::= query_specification */ + { 439, -1 }, /* (496) query_simple ::= union_query_expression */ + { 443, -4 }, /* (497) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ + { 443, -3 }, /* (498) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ + { 444, -1 }, /* (499) query_simple_or_subquery ::= query_simple */ + { 444, -1 }, /* (500) query_simple_or_subquery ::= subquery */ + { 377, -1 }, /* (501) query_or_subquery ::= query_expression */ + { 377, -1 }, /* (502) query_or_subquery ::= subquery */ + { 440, 0 }, /* (503) order_by_clause_opt ::= */ + { 440, -3 }, /* (504) order_by_clause_opt ::= ORDER BY sort_specification_list */ + { 441, 0 }, /* (505) slimit_clause_opt ::= */ + { 441, -2 }, /* (506) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + { 441, -4 }, /* (507) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + { 441, -4 }, /* (508) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 442, 0 }, /* (509) limit_clause_opt ::= */ + { 442, -2 }, /* (510) limit_clause_opt ::= LIMIT NK_INTEGER */ + { 442, -4 }, /* (511) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + { 442, -4 }, /* (512) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 394, -3 }, /* (513) subquery ::= NK_LP query_expression NK_RP */ + { 394, -3 }, /* (514) subquery ::= NK_LP subquery NK_RP */ + { 422, -1 }, /* (515) search_condition ::= common_expression */ + { 445, -1 }, /* (516) sort_specification_list ::= sort_specification */ + { 445, -3 }, /* (517) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + { 446, -3 }, /* (518) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ + { 447, 0 }, /* (519) ordering_specification_opt ::= */ + { 447, -1 }, /* (520) ordering_specification_opt ::= ASC */ + { 447, -1 }, /* (521) ordering_specification_opt ::= DESC */ + { 448, 0 }, /* (522) null_ordering_opt ::= */ + { 448, -2 }, /* (523) null_ordering_opt ::= NULLS FIRST */ + { 448, -2 }, /* (524) null_ordering_opt ::= NULLS LAST */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -3715,29 +3717,29 @@ static YYACTIONTYPE yy_reduce( case 49: /* dnode_endpoint ::= NK_STRING */ case 50: /* dnode_endpoint ::= NK_ID */ yytestcase(yyruleno==50); case 51: /* dnode_endpoint ::= NK_IPTOKEN */ yytestcase(yyruleno==51); - case 327: /* db_name ::= NK_ID */ yytestcase(yyruleno==327); - case 328: /* table_name ::= NK_ID */ yytestcase(yyruleno==328); - case 329: /* column_name ::= NK_ID */ yytestcase(yyruleno==329); - case 330: /* function_name ::= NK_ID */ yytestcase(yyruleno==330); - case 331: /* table_alias ::= NK_ID */ yytestcase(yyruleno==331); - case 332: /* column_alias ::= NK_ID */ yytestcase(yyruleno==332); - case 333: /* user_name ::= NK_ID */ yytestcase(yyruleno==333); - case 334: /* topic_name ::= NK_ID */ yytestcase(yyruleno==334); - case 335: /* stream_name ::= NK_ID */ yytestcase(yyruleno==335); - case 336: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==336); - case 376: /* noarg_func ::= NOW */ yytestcase(yyruleno==376); - case 377: /* noarg_func ::= TODAY */ yytestcase(yyruleno==377); - case 378: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==378); - case 379: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==379); - case 380: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==380); - case 381: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==381); - case 382: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==382); - case 383: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==383); - case 384: /* noarg_func ::= USER */ yytestcase(yyruleno==384); - case 385: /* star_func ::= COUNT */ yytestcase(yyruleno==385); - case 386: /* star_func ::= FIRST */ yytestcase(yyruleno==386); - case 387: /* star_func ::= LAST */ yytestcase(yyruleno==387); - case 388: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==388); + case 328: /* db_name ::= NK_ID */ yytestcase(yyruleno==328); + case 329: /* table_name ::= NK_ID */ yytestcase(yyruleno==329); + case 330: /* column_name ::= NK_ID */ yytestcase(yyruleno==330); + case 331: /* function_name ::= NK_ID */ yytestcase(yyruleno==331); + case 332: /* table_alias ::= NK_ID */ yytestcase(yyruleno==332); + case 333: /* column_alias ::= NK_ID */ yytestcase(yyruleno==333); + case 334: /* user_name ::= NK_ID */ yytestcase(yyruleno==334); + case 335: /* topic_name ::= NK_ID */ yytestcase(yyruleno==335); + case 336: /* stream_name ::= NK_ID */ yytestcase(yyruleno==336); + case 337: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==337); + case 377: /* noarg_func ::= NOW */ yytestcase(yyruleno==377); + case 378: /* noarg_func ::= TODAY */ yytestcase(yyruleno==378); + case 379: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==379); + case 380: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==380); + case 381: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==381); + case 382: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==382); + case 383: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==383); + case 384: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==384); + case 385: /* noarg_func ::= USER */ yytestcase(yyruleno==385); + case 386: /* star_func ::= COUNT */ yytestcase(yyruleno==386); + case 387: /* star_func ::= FIRST */ yytestcase(yyruleno==387); + case 388: /* star_func ::= LAST */ yytestcase(yyruleno==388); + case 389: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==389); { yylhsminor.yy181 = yymsp[0].minor.yy0; } yymsp[0].minor.yy181 = yylhsminor.yy181; break; @@ -3794,9 +3796,9 @@ static YYACTIONTYPE yy_reduce( break; case 69: /* not_exists_opt ::= */ case 71: /* exists_opt ::= */ yytestcase(yyruleno==71); - case 268: /* analyze_opt ::= */ yytestcase(yyruleno==268); - case 275: /* agg_func_opt ::= */ yytestcase(yyruleno==275); - case 449: /* set_quantifier_opt ::= */ yytestcase(yyruleno==449); + case 269: /* analyze_opt ::= */ yytestcase(yyruleno==269); + case 276: /* agg_func_opt ::= */ yytestcase(yyruleno==276); + case 450: /* set_quantifier_opt ::= */ yytestcase(yyruleno==450); { yymsp[1].minor.yy39 = false; } break; case 70: /* exists_opt ::= IF EXISTS */ @@ -3975,7 +3977,7 @@ static YYACTIONTYPE yy_reduce( yymsp[0].minor.yy282 = yylhsminor.yy282; break; case 118: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */ - case 297: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==297); + case 298: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==298); { yylhsminor.yy282 = addNodeToList(pCxt, yymsp[-2].minor.yy282, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } yymsp[-2].minor.yy282 = yylhsminor.yy282; break; @@ -3993,13 +3995,13 @@ static YYACTIONTYPE yy_reduce( case 153: /* column_def_list ::= column_def */ yytestcase(yyruleno==153); case 196: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==196); case 201: /* col_name_list ::= col_name */ yytestcase(yyruleno==201); - case 251: /* func_list ::= func */ yytestcase(yyruleno==251); - case 325: /* literal_list ::= signed_literal */ yytestcase(yyruleno==325); - case 391: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==391); - case 397: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==397); - case 452: /* select_list ::= select_item */ yytestcase(yyruleno==452); - case 463: /* partition_list ::= partition_item */ yytestcase(yyruleno==463); - case 515: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==515); + case 252: /* func_list ::= func */ yytestcase(yyruleno==252); + case 326: /* literal_list ::= signed_literal */ yytestcase(yyruleno==326); + case 392: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==392); + case 398: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==398); + case 453: /* select_list ::= select_item */ yytestcase(yyruleno==453); + case 464: /* partition_list ::= partition_item */ yytestcase(yyruleno==464); + case 516: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==516); { yylhsminor.yy282 = createNodeList(pCxt, yymsp[0].minor.yy778); } yymsp[0].minor.yy282 = yylhsminor.yy282; break; @@ -4007,12 +4009,12 @@ static YYACTIONTYPE yy_reduce( case 154: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==154); case 197: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==197); case 202: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==202); - case 252: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==252); - case 326: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==326); - case 392: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==392); - case 453: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==453); - case 464: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==464); - case 516: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==516); + case 253: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==253); + case 327: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==327); + case 393: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==393); + case 454: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==454); + case 465: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==465); + case 517: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==517); { yylhsminor.yy282 = addNodeToList(pCxt, yymsp[-2].minor.yy282, yymsp[0].minor.yy778); } yymsp[-2].minor.yy282 = yylhsminor.yy282; break; @@ -4021,11 +4023,11 @@ static YYACTIONTYPE yy_reduce( yymsp[-2].minor.yy778 = yylhsminor.yy778; break; case 124: /* speed_opt ::= */ - case 277: /* bufsize_opt ::= */ yytestcase(yyruleno==277); + case 278: /* bufsize_opt ::= */ yytestcase(yyruleno==278); { yymsp[1].minor.yy276 = 0; } break; case 125: /* speed_opt ::= MAX_SPEED NK_INTEGER */ - case 278: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==278); + case 279: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==279); { yymsp[-1].minor.yy276 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } break; case 126: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ @@ -4042,7 +4044,7 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy39, yymsp[0].minor.yy778); } break; case 131: /* cmd ::= ALTER TABLE alter_table_clause */ - case 299: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==299); + case 300: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==300); { pCxt->pRootNode = yymsp[0].minor.yy778; } break; case 132: /* cmd ::= ALTER STABLE alter_table_clause */ @@ -4090,7 +4092,7 @@ static YYACTIONTYPE yy_reduce( break; case 144: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ case 147: /* multi_drop_clause ::= multi_drop_clause drop_table_clause */ yytestcase(yyruleno==147); - case 398: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==398); + case 399: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==399); { yylhsminor.yy282 = addNodeToList(pCxt, yymsp[-1].minor.yy282, yymsp[0].minor.yy778); } yymsp[-1].minor.yy282 = yylhsminor.yy282; break; @@ -4104,9 +4106,9 @@ static YYACTIONTYPE yy_reduce( break; case 149: /* specific_cols_opt ::= */ case 180: /* tags_def_opt ::= */ yytestcase(yyruleno==180); - case 461: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==461); - case 483: /* group_by_clause_opt ::= */ yytestcase(yyruleno==483); - case 502: /* order_by_clause_opt ::= */ yytestcase(yyruleno==502); + case 462: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==462); + case 484: /* group_by_clause_opt ::= */ yytestcase(yyruleno==484); + case 503: /* order_by_clause_opt ::= */ yytestcase(yyruleno==503); { yymsp[1].minor.yy282 = NULL; } break; case 150: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */ @@ -4196,7 +4198,7 @@ static YYACTIONTYPE yy_reduce( { yymsp[-5].minor.yy380 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 181: /* tags_def_opt ::= tags_def */ - case 390: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==390); + case 391: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==391); { yylhsminor.yy282 = yymsp[0].minor.yy282; } yymsp[0].minor.yy282 = yylhsminor.yy282; break; @@ -4245,12 +4247,12 @@ static YYACTIONTYPE yy_reduce( { yymsp[-1].minor.yy645.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy645.val = yymsp[0].minor.yy0; } break; case 194: /* duration_list ::= duration_literal */ - case 355: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==355); + case 356: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==356); { yylhsminor.yy282 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy778)); } yymsp[0].minor.yy282 = yylhsminor.yy282; break; case 195: /* duration_list ::= duration_list NK_COMMA duration_literal */ - case 356: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==356); + case 357: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==357); { yylhsminor.yy282 = addNodeToList(pCxt, yymsp[-2].minor.yy282, releaseRawExprNode(pCxt, yymsp[0].minor.yy778)); } yymsp[-2].minor.yy282 = yylhsminor.yy282; break; @@ -4332,287 +4334,288 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TOPICS_STMT); } break; case 226: /* cmd ::= SHOW VARIABLES */ + case 227: /* cmd ::= SHOW CLUSTER VARIABLES */ yytestcase(yyruleno==227); { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VARIABLES_STMT); } break; - case 227: /* cmd ::= SHOW LOCAL VARIABLES */ + case 228: /* cmd ::= SHOW LOCAL VARIABLES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT); } break; - case 228: /* cmd ::= SHOW DNODE NK_INTEGER VARIABLES */ -{ pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[-1].minor.yy0)); } + case 229: /* cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ +{ pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[-2].minor.yy0), yymsp[0].minor.yy778); } break; - case 229: /* cmd ::= SHOW BNODES */ + case 230: /* cmd ::= SHOW BNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_BNODES_STMT); } break; - case 230: /* cmd ::= SHOW SNODES */ + case 231: /* cmd ::= SHOW SNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SNODES_STMT); } break; - case 231: /* cmd ::= SHOW CLUSTER */ + case 232: /* cmd ::= SHOW CLUSTER */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_STMT); } break; - case 232: /* cmd ::= SHOW TRANSACTIONS */ + case 233: /* cmd ::= SHOW TRANSACTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TRANSACTIONS_STMT); } break; - case 233: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ + case 234: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ { pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy778); } break; - case 234: /* cmd ::= SHOW CONSUMERS */ + case 235: /* cmd ::= SHOW CONSUMERS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); } break; - case 235: /* cmd ::= SHOW SUBSCRIPTIONS */ + case 236: /* cmd ::= SHOW SUBSCRIPTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT); } break; - case 236: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ + case 237: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy778, yymsp[-1].minor.yy778, OP_TYPE_EQUAL); } break; - case 237: /* cmd ::= SHOW TABLE TAGS FROM table_name_cond from_db_opt */ + case 238: /* cmd ::= SHOW TABLE TAGS FROM table_name_cond from_db_opt */ { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLE_TAGS_STMT, yymsp[0].minor.yy778, yymsp[-1].minor.yy778, OP_TYPE_EQUAL); } break; - case 238: /* cmd ::= SHOW VNODES NK_INTEGER */ + case 239: /* cmd ::= SHOW VNODES NK_INTEGER */ { pCxt->pRootNode = createShowVnodesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0), NULL); } break; - case 239: /* cmd ::= SHOW VNODES NK_STRING */ + case 240: /* cmd ::= SHOW VNODES NK_STRING */ { pCxt->pRootNode = createShowVnodesStmt(pCxt, NULL, createValueNode(pCxt, TSDB_DATA_TYPE_VARCHAR, &yymsp[0].minor.yy0)); } break; - case 240: /* db_name_cond_opt ::= */ - case 245: /* from_db_opt ::= */ yytestcase(yyruleno==245); + case 241: /* db_name_cond_opt ::= */ + case 246: /* from_db_opt ::= */ yytestcase(yyruleno==246); { yymsp[1].minor.yy778 = createDefaultDatabaseCondValue(pCxt); } break; - case 241: /* db_name_cond_opt ::= db_name NK_DOT */ + case 242: /* db_name_cond_opt ::= db_name NK_DOT */ { yylhsminor.yy778 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy181); } yymsp[-1].minor.yy778 = yylhsminor.yy778; break; - case 242: /* like_pattern_opt ::= */ - case 287: /* subtable_opt ::= */ yytestcase(yyruleno==287); - case 400: /* case_when_else_opt ::= */ yytestcase(yyruleno==400); - case 430: /* from_clause_opt ::= */ yytestcase(yyruleno==430); - case 459: /* where_clause_opt ::= */ yytestcase(yyruleno==459); - case 468: /* twindow_clause_opt ::= */ yytestcase(yyruleno==468); - case 473: /* sliding_opt ::= */ yytestcase(yyruleno==473); - case 475: /* fill_opt ::= */ yytestcase(yyruleno==475); - case 487: /* having_clause_opt ::= */ yytestcase(yyruleno==487); - case 489: /* range_opt ::= */ yytestcase(yyruleno==489); - case 491: /* every_opt ::= */ yytestcase(yyruleno==491); - case 504: /* slimit_clause_opt ::= */ yytestcase(yyruleno==504); - case 508: /* limit_clause_opt ::= */ yytestcase(yyruleno==508); + case 243: /* like_pattern_opt ::= */ + case 288: /* subtable_opt ::= */ yytestcase(yyruleno==288); + case 401: /* case_when_else_opt ::= */ yytestcase(yyruleno==401); + case 431: /* from_clause_opt ::= */ yytestcase(yyruleno==431); + case 460: /* where_clause_opt ::= */ yytestcase(yyruleno==460); + case 469: /* twindow_clause_opt ::= */ yytestcase(yyruleno==469); + case 474: /* sliding_opt ::= */ yytestcase(yyruleno==474); + case 476: /* fill_opt ::= */ yytestcase(yyruleno==476); + case 488: /* having_clause_opt ::= */ yytestcase(yyruleno==488); + case 490: /* range_opt ::= */ yytestcase(yyruleno==490); + case 492: /* every_opt ::= */ yytestcase(yyruleno==492); + case 505: /* slimit_clause_opt ::= */ yytestcase(yyruleno==505); + case 509: /* limit_clause_opt ::= */ yytestcase(yyruleno==509); { yymsp[1].minor.yy778 = NULL; } break; - case 243: /* like_pattern_opt ::= LIKE NK_STRING */ + case 244: /* like_pattern_opt ::= LIKE NK_STRING */ { yymsp[-1].minor.yy778 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } break; - case 244: /* table_name_cond ::= table_name */ + case 245: /* table_name_cond ::= table_name */ { yylhsminor.yy778 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy181); } yymsp[0].minor.yy778 = yylhsminor.yy778; break; - case 246: /* from_db_opt ::= FROM db_name */ + case 247: /* from_db_opt ::= FROM db_name */ { yymsp[-1].minor.yy778 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy181); } break; - case 247: /* cmd ::= CREATE SMA INDEX not_exists_opt full_table_name ON full_table_name index_options */ + case 248: /* cmd ::= CREATE SMA INDEX not_exists_opt full_table_name ON full_table_name index_options */ { pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy39, yymsp[-3].minor.yy778, yymsp[-1].minor.yy778, NULL, yymsp[0].minor.yy778); } break; - case 248: /* cmd ::= DROP INDEX exists_opt full_table_name */ + case 249: /* cmd ::= DROP INDEX exists_opt full_table_name */ { pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy39, yymsp[0].minor.yy778); } break; - case 249: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ + case 250: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ { yymsp[-9].minor.yy778 = createIndexOption(pCxt, yymsp[-7].minor.yy282, releaseRawExprNode(pCxt, yymsp[-3].minor.yy778), NULL, yymsp[-1].minor.yy778, yymsp[0].minor.yy778); } break; - case 250: /* 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 */ + case 251: /* 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 */ { yymsp[-11].minor.yy778 = createIndexOption(pCxt, yymsp[-9].minor.yy282, releaseRawExprNode(pCxt, yymsp[-5].minor.yy778), releaseRawExprNode(pCxt, yymsp[-3].minor.yy778), yymsp[-1].minor.yy778, yymsp[0].minor.yy778); } break; - case 253: /* func ::= function_name NK_LP expression_list NK_RP */ + case 254: /* func ::= function_name NK_LP expression_list NK_RP */ { yylhsminor.yy778 = createFunctionNode(pCxt, &yymsp[-3].minor.yy181, yymsp[-1].minor.yy282); } yymsp[-3].minor.yy778 = yylhsminor.yy778; break; - case 254: /* sma_stream_opt ::= */ - case 281: /* stream_options ::= */ yytestcase(yyruleno==281); + case 255: /* sma_stream_opt ::= */ + case 282: /* stream_options ::= */ yytestcase(yyruleno==282); { yymsp[1].minor.yy778 = createStreamOptions(pCxt); } break; - case 255: /* sma_stream_opt ::= stream_options WATERMARK duration_literal */ - case 285: /* stream_options ::= stream_options WATERMARK duration_literal */ yytestcase(yyruleno==285); + case 256: /* sma_stream_opt ::= stream_options WATERMARK duration_literal */ + case 286: /* stream_options ::= stream_options WATERMARK duration_literal */ yytestcase(yyruleno==286); { ((SStreamOptions*)yymsp[-2].minor.yy778)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy778); yylhsminor.yy778 = yymsp[-2].minor.yy778; } yymsp[-2].minor.yy778 = yylhsminor.yy778; break; - case 256: /* sma_stream_opt ::= stream_options MAX_DELAY duration_literal */ + case 257: /* sma_stream_opt ::= stream_options MAX_DELAY duration_literal */ { ((SStreamOptions*)yymsp[-2].minor.yy778)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy778); yylhsminor.yy778 = yymsp[-2].minor.yy778; } yymsp[-2].minor.yy778 = yylhsminor.yy778; break; - case 257: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ + case 258: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ { pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy39, &yymsp[-2].minor.yy181, yymsp[0].minor.yy778); } break; - case 258: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ + case 259: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ { pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy39, &yymsp[-3].minor.yy181, &yymsp[0].minor.yy181, false); } break; - case 259: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ + case 260: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ { pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-6].minor.yy39, &yymsp[-5].minor.yy181, &yymsp[0].minor.yy181, true); } break; - case 260: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ + case 261: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ { pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-4].minor.yy39, &yymsp[-3].minor.yy181, yymsp[0].minor.yy778, false); } break; - case 261: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ + case 262: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ { pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-6].minor.yy39, &yymsp[-5].minor.yy181, yymsp[0].minor.yy778, true); } break; - case 262: /* cmd ::= DROP TOPIC exists_opt topic_name */ + case 263: /* cmd ::= DROP TOPIC exists_opt topic_name */ { pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy39, &yymsp[0].minor.yy181); } break; - case 263: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ + case 264: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ { pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy39, &yymsp[-2].minor.yy181, &yymsp[0].minor.yy181); } break; - case 264: /* cmd ::= DESC full_table_name */ - case 265: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==265); + case 265: /* cmd ::= DESC full_table_name */ + case 266: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==266); { pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy778); } break; - case 266: /* cmd ::= RESET QUERY CACHE */ + case 267: /* cmd ::= RESET QUERY CACHE */ { pCxt->pRootNode = createResetQueryCacheStmt(pCxt); } break; - case 267: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ + case 268: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ { pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy39, yymsp[-1].minor.yy778, yymsp[0].minor.yy778); } break; - case 269: /* analyze_opt ::= ANALYZE */ - case 276: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==276); - case 450: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==450); + case 270: /* analyze_opt ::= ANALYZE */ + case 277: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==277); + case 451: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==451); { yymsp[0].minor.yy39 = true; } break; - case 270: /* explain_options ::= */ + case 271: /* explain_options ::= */ { yymsp[1].minor.yy778 = createDefaultExplainOptions(pCxt); } break; - case 271: /* explain_options ::= explain_options VERBOSE NK_BOOL */ + case 272: /* explain_options ::= explain_options VERBOSE NK_BOOL */ { yylhsminor.yy778 = setExplainVerbose(pCxt, yymsp[-2].minor.yy778, &yymsp[0].minor.yy0); } yymsp[-2].minor.yy778 = yylhsminor.yy778; break; - case 272: /* explain_options ::= explain_options RATIO NK_FLOAT */ + case 273: /* explain_options ::= explain_options RATIO NK_FLOAT */ { yylhsminor.yy778 = setExplainRatio(pCxt, yymsp[-2].minor.yy778, &yymsp[0].minor.yy0); } yymsp[-2].minor.yy778 = yylhsminor.yy778; break; - case 273: /* cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ + case 274: /* cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ { pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-6].minor.yy39, yymsp[-8].minor.yy39, &yymsp[-5].minor.yy181, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy380, yymsp[0].minor.yy276); } break; - case 274: /* cmd ::= DROP FUNCTION exists_opt function_name */ + case 275: /* cmd ::= DROP FUNCTION exists_opt function_name */ { pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy39, &yymsp[0].minor.yy181); } break; - case 279: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name tags_def_opt subtable_opt AS query_or_subquery */ + case 280: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name tags_def_opt subtable_opt AS query_or_subquery */ { pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-8].minor.yy39, &yymsp[-7].minor.yy181, yymsp[-4].minor.yy778, yymsp[-6].minor.yy778, yymsp[-3].minor.yy282, yymsp[-2].minor.yy778, yymsp[0].minor.yy778); } break; - case 280: /* cmd ::= DROP STREAM exists_opt stream_name */ + case 281: /* cmd ::= DROP STREAM exists_opt stream_name */ { pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy39, &yymsp[0].minor.yy181); } break; - case 282: /* stream_options ::= stream_options TRIGGER AT_ONCE */ + case 283: /* stream_options ::= stream_options TRIGGER AT_ONCE */ { ((SStreamOptions*)yymsp[-2].minor.yy778)->triggerType = STREAM_TRIGGER_AT_ONCE; yylhsminor.yy778 = yymsp[-2].minor.yy778; } yymsp[-2].minor.yy778 = yylhsminor.yy778; break; - case 283: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ + case 284: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ { ((SStreamOptions*)yymsp[-2].minor.yy778)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; yylhsminor.yy778 = yymsp[-2].minor.yy778; } yymsp[-2].minor.yy778 = yylhsminor.yy778; break; - case 284: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ + case 285: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ { ((SStreamOptions*)yymsp[-3].minor.yy778)->triggerType = STREAM_TRIGGER_MAX_DELAY; ((SStreamOptions*)yymsp[-3].minor.yy778)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy778); yylhsminor.yy778 = yymsp[-3].minor.yy778; } yymsp[-3].minor.yy778 = yylhsminor.yy778; break; - case 286: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ + case 287: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ { ((SStreamOptions*)yymsp[-3].minor.yy778)->ignoreExpired = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); yylhsminor.yy778 = yymsp[-3].minor.yy778; } yymsp[-3].minor.yy778 = yylhsminor.yy778; break; - case 288: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - case 474: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ yytestcase(yyruleno==474); - case 492: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==492); + case 289: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + case 475: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ yytestcase(yyruleno==475); + case 493: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==493); { yymsp[-3].minor.yy778 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy778); } break; - case 289: /* cmd ::= KILL CONNECTION NK_INTEGER */ + case 290: /* cmd ::= KILL CONNECTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); } break; - case 290: /* cmd ::= KILL QUERY NK_STRING */ + case 291: /* cmd ::= KILL QUERY NK_STRING */ { pCxt->pRootNode = createKillQueryStmt(pCxt, &yymsp[0].minor.yy0); } break; - case 291: /* cmd ::= KILL TRANSACTION NK_INTEGER */ + case 292: /* cmd ::= KILL TRANSACTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_TRANSACTION_STMT, &yymsp[0].minor.yy0); } break; - case 292: /* cmd ::= BALANCE VGROUP */ + case 293: /* cmd ::= BALANCE VGROUP */ { pCxt->pRootNode = createBalanceVgroupStmt(pCxt); } break; - case 293: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + case 294: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ { pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } break; - case 294: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ + case 295: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ { pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy282); } break; - case 295: /* cmd ::= SPLIT VGROUP NK_INTEGER */ + case 296: /* cmd ::= SPLIT VGROUP NK_INTEGER */ { pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); } break; - case 296: /* dnode_list ::= DNODE NK_INTEGER */ + case 297: /* dnode_list ::= DNODE NK_INTEGER */ { yymsp[-1].minor.yy282 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } break; - case 298: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ + case 299: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ { pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy778, yymsp[0].minor.yy778); } break; - case 300: /* cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ + case 301: /* cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ { pCxt->pRootNode = createInsertStmt(pCxt, yymsp[-4].minor.yy778, yymsp[-2].minor.yy282, yymsp[0].minor.yy778); } break; - case 301: /* cmd ::= INSERT INTO full_table_name query_or_subquery */ + case 302: /* cmd ::= INSERT INTO full_table_name query_or_subquery */ { pCxt->pRootNode = createInsertStmt(pCxt, yymsp[-1].minor.yy778, NULL, yymsp[0].minor.yy778); } break; - case 302: /* literal ::= NK_INTEGER */ + case 303: /* literal ::= NK_INTEGER */ { yylhsminor.yy778 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); } yymsp[0].minor.yy778 = yylhsminor.yy778; break; - case 303: /* literal ::= NK_FLOAT */ + case 304: /* literal ::= NK_FLOAT */ { yylhsminor.yy778 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } yymsp[0].minor.yy778 = yylhsminor.yy778; break; - case 304: /* literal ::= NK_STRING */ + case 305: /* literal ::= NK_STRING */ { yylhsminor.yy778 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } yymsp[0].minor.yy778 = yylhsminor.yy778; break; - case 305: /* literal ::= NK_BOOL */ + case 306: /* literal ::= NK_BOOL */ { yylhsminor.yy778 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } yymsp[0].minor.yy778 = yylhsminor.yy778; break; - case 306: /* literal ::= TIMESTAMP NK_STRING */ + case 307: /* literal ::= TIMESTAMP NK_STRING */ { yylhsminor.yy778 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } yymsp[-1].minor.yy778 = yylhsminor.yy778; break; - case 307: /* literal ::= duration_literal */ - case 317: /* signed_literal ::= signed */ yytestcase(yyruleno==317); - case 337: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==337); - case 338: /* expr_or_subquery ::= subquery */ yytestcase(yyruleno==338); - case 339: /* expression ::= literal */ yytestcase(yyruleno==339); - case 340: /* expression ::= pseudo_column */ yytestcase(yyruleno==340); - case 341: /* expression ::= column_reference */ yytestcase(yyruleno==341); - case 342: /* expression ::= function_expression */ yytestcase(yyruleno==342); - case 343: /* expression ::= case_when_expression */ yytestcase(yyruleno==343); - case 373: /* function_expression ::= literal_func */ yytestcase(yyruleno==373); - case 422: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==422); - case 426: /* boolean_primary ::= predicate */ yytestcase(yyruleno==426); - case 428: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==428); - case 429: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==429); - case 432: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==432); - case 434: /* table_reference ::= table_primary */ yytestcase(yyruleno==434); - case 435: /* table_reference ::= joined_table */ yytestcase(yyruleno==435); - case 439: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==439); - case 494: /* query_simple ::= query_specification */ yytestcase(yyruleno==494); - case 495: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==495); - case 498: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==498); - case 500: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==500); + case 308: /* literal ::= duration_literal */ + case 318: /* signed_literal ::= signed */ yytestcase(yyruleno==318); + case 338: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==338); + case 339: /* expr_or_subquery ::= subquery */ yytestcase(yyruleno==339); + case 340: /* expression ::= literal */ yytestcase(yyruleno==340); + case 341: /* expression ::= pseudo_column */ yytestcase(yyruleno==341); + case 342: /* expression ::= column_reference */ yytestcase(yyruleno==342); + case 343: /* expression ::= function_expression */ yytestcase(yyruleno==343); + case 344: /* expression ::= case_when_expression */ yytestcase(yyruleno==344); + case 374: /* function_expression ::= literal_func */ yytestcase(yyruleno==374); + case 423: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==423); + case 427: /* boolean_primary ::= predicate */ yytestcase(yyruleno==427); + case 429: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==429); + case 430: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==430); + case 433: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==433); + case 435: /* table_reference ::= table_primary */ yytestcase(yyruleno==435); + case 436: /* table_reference ::= joined_table */ yytestcase(yyruleno==436); + case 440: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==440); + case 495: /* query_simple ::= query_specification */ yytestcase(yyruleno==495); + case 496: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==496); + case 499: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==499); + case 501: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==501); { yylhsminor.yy778 = yymsp[0].minor.yy778; } yymsp[0].minor.yy778 = yylhsminor.yy778; break; - case 308: /* literal ::= NULL */ + case 309: /* literal ::= NULL */ { yylhsminor.yy778 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } yymsp[0].minor.yy778 = yylhsminor.yy778; break; - case 309: /* literal ::= NK_QUESTION */ + case 310: /* literal ::= NK_QUESTION */ { yylhsminor.yy778 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } yymsp[0].minor.yy778 = yylhsminor.yy778; break; - case 310: /* duration_literal ::= NK_VARIABLE */ + case 311: /* duration_literal ::= NK_VARIABLE */ { yylhsminor.yy778 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } yymsp[0].minor.yy778 = yylhsminor.yy778; break; - case 311: /* signed ::= NK_INTEGER */ + case 312: /* signed ::= NK_INTEGER */ { yylhsminor.yy778 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } yymsp[0].minor.yy778 = yylhsminor.yy778; break; - case 312: /* signed ::= NK_PLUS NK_INTEGER */ + case 313: /* signed ::= NK_PLUS NK_INTEGER */ { yymsp[-1].minor.yy778 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } break; - case 313: /* signed ::= NK_MINUS NK_INTEGER */ + case 314: /* signed ::= NK_MINUS NK_INTEGER */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; @@ -4620,14 +4623,14 @@ static YYACTIONTYPE yy_reduce( } yymsp[-1].minor.yy778 = yylhsminor.yy778; break; - case 314: /* signed ::= NK_FLOAT */ + case 315: /* signed ::= NK_FLOAT */ { yylhsminor.yy778 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } yymsp[0].minor.yy778 = yylhsminor.yy778; break; - case 315: /* signed ::= NK_PLUS NK_FLOAT */ + case 316: /* signed ::= NK_PLUS NK_FLOAT */ { yymsp[-1].minor.yy778 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } break; - case 316: /* signed ::= NK_MINUS NK_FLOAT */ + case 317: /* signed ::= NK_MINUS NK_FLOAT */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; @@ -4635,57 +4638,57 @@ static YYACTIONTYPE yy_reduce( } yymsp[-1].minor.yy778 = yylhsminor.yy778; break; - case 318: /* signed_literal ::= NK_STRING */ + case 319: /* signed_literal ::= NK_STRING */ { yylhsminor.yy778 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } yymsp[0].minor.yy778 = yylhsminor.yy778; break; - case 319: /* signed_literal ::= NK_BOOL */ + case 320: /* signed_literal ::= NK_BOOL */ { yylhsminor.yy778 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } yymsp[0].minor.yy778 = yylhsminor.yy778; break; - case 320: /* signed_literal ::= TIMESTAMP NK_STRING */ + case 321: /* signed_literal ::= TIMESTAMP NK_STRING */ { yymsp[-1].minor.yy778 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } break; - case 321: /* signed_literal ::= duration_literal */ - case 323: /* signed_literal ::= literal_func */ yytestcase(yyruleno==323); - case 393: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==393); - case 455: /* select_item ::= common_expression */ yytestcase(yyruleno==455); - case 465: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==465); - case 499: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==499); - case 501: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==501); - case 514: /* search_condition ::= common_expression */ yytestcase(yyruleno==514); + case 322: /* signed_literal ::= duration_literal */ + case 324: /* signed_literal ::= literal_func */ yytestcase(yyruleno==324); + case 394: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==394); + case 456: /* select_item ::= common_expression */ yytestcase(yyruleno==456); + case 466: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==466); + case 500: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==500); + case 502: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==502); + case 515: /* search_condition ::= common_expression */ yytestcase(yyruleno==515); { yylhsminor.yy778 = releaseRawExprNode(pCxt, yymsp[0].minor.yy778); } yymsp[0].minor.yy778 = yylhsminor.yy778; break; - case 322: /* signed_literal ::= NULL */ + case 323: /* signed_literal ::= NULL */ { yylhsminor.yy778 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } yymsp[0].minor.yy778 = yylhsminor.yy778; break; - case 324: /* signed_literal ::= NK_QUESTION */ + case 325: /* signed_literal ::= NK_QUESTION */ { yylhsminor.yy778 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } yymsp[0].minor.yy778 = yylhsminor.yy778; break; - case 344: /* expression ::= NK_LP expression NK_RP */ - case 427: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==427); - case 513: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==513); + case 345: /* expression ::= NK_LP expression NK_RP */ + case 428: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==428); + case 514: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==514); { yylhsminor.yy778 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy778)); } yymsp[-2].minor.yy778 = yylhsminor.yy778; break; - case 345: /* expression ::= NK_PLUS expr_or_subquery */ + case 346: /* expression ::= NK_PLUS expr_or_subquery */ { SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy778); yylhsminor.yy778 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy778)); } yymsp[-1].minor.yy778 = yylhsminor.yy778; break; - case 346: /* expression ::= NK_MINUS expr_or_subquery */ + case 347: /* expression ::= NK_MINUS expr_or_subquery */ { SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy778); yylhsminor.yy778 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy778), NULL)); } yymsp[-1].minor.yy778 = yylhsminor.yy778; break; - case 347: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ + case 348: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy778); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy778); @@ -4693,7 +4696,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy778 = yylhsminor.yy778; break; - case 348: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ + case 349: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy778); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy778); @@ -4701,7 +4704,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy778 = yylhsminor.yy778; break; - case 349: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */ + case 350: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy778); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy778); @@ -4709,7 +4712,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy778 = yylhsminor.yy778; break; - case 350: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ + case 351: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy778); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy778); @@ -4717,7 +4720,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy778 = yylhsminor.yy778; break; - case 351: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */ + case 352: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy778); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy778); @@ -4725,14 +4728,14 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy778 = yylhsminor.yy778; break; - case 352: /* expression ::= column_reference NK_ARROW NK_STRING */ + case 353: /* expression ::= column_reference NK_ARROW NK_STRING */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy778); yylhsminor.yy778 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy778), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); } yymsp[-2].minor.yy778 = yylhsminor.yy778; break; - case 353: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ + case 354: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy778); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy778); @@ -4740,7 +4743,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy778 = yylhsminor.yy778; break; - case 354: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ + case 355: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy778); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy778); @@ -4748,70 +4751,70 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy778 = yylhsminor.yy778; break; - case 357: /* column_reference ::= column_name */ + case 358: /* column_reference ::= column_name */ { yylhsminor.yy778 = createRawExprNode(pCxt, &yymsp[0].minor.yy181, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy181)); } yymsp[0].minor.yy778 = yylhsminor.yy778; break; - case 358: /* column_reference ::= table_name NK_DOT column_name */ + case 359: /* column_reference ::= table_name NK_DOT column_name */ { yylhsminor.yy778 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy181, &yymsp[0].minor.yy181, createColumnNode(pCxt, &yymsp[-2].minor.yy181, &yymsp[0].minor.yy181)); } yymsp[-2].minor.yy778 = yylhsminor.yy778; break; - case 359: /* pseudo_column ::= ROWTS */ - case 360: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==360); - case 362: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==362); - case 363: /* pseudo_column ::= QEND */ yytestcase(yyruleno==363); - case 364: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==364); - case 365: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==365); - case 366: /* pseudo_column ::= WEND */ yytestcase(yyruleno==366); - case 367: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==367); - case 368: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==368); - case 369: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==369); - case 375: /* literal_func ::= NOW */ yytestcase(yyruleno==375); + case 360: /* pseudo_column ::= ROWTS */ + case 361: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==361); + case 363: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==363); + case 364: /* pseudo_column ::= QEND */ yytestcase(yyruleno==364); + case 365: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==365); + case 366: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==366); + case 367: /* pseudo_column ::= WEND */ yytestcase(yyruleno==367); + case 368: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==368); + case 369: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==369); + case 370: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==370); + case 376: /* literal_func ::= NOW */ yytestcase(yyruleno==376); { yylhsminor.yy778 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } yymsp[0].minor.yy778 = yylhsminor.yy778; break; - case 361: /* pseudo_column ::= table_name NK_DOT TBNAME */ + case 362: /* pseudo_column ::= table_name NK_DOT TBNAME */ { yylhsminor.yy778 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy181, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy181)))); } yymsp[-2].minor.yy778 = yylhsminor.yy778; break; - case 370: /* function_expression ::= function_name NK_LP expression_list NK_RP */ - case 371: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==371); + case 371: /* function_expression ::= function_name NK_LP expression_list NK_RP */ + case 372: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==372); { yylhsminor.yy778 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy181, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy181, yymsp[-1].minor.yy282)); } yymsp[-3].minor.yy778 = yylhsminor.yy778; break; - case 372: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ + case 373: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ { yylhsminor.yy778 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy778), yymsp[-1].minor.yy380)); } yymsp[-5].minor.yy778 = yylhsminor.yy778; break; - case 374: /* literal_func ::= noarg_func NK_LP NK_RP */ + case 375: /* literal_func ::= noarg_func NK_LP NK_RP */ { yylhsminor.yy778 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy181, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy181, NULL)); } yymsp[-2].minor.yy778 = yylhsminor.yy778; break; - case 389: /* star_func_para_list ::= NK_STAR */ + case 390: /* star_func_para_list ::= NK_STAR */ { yylhsminor.yy282 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } yymsp[0].minor.yy282 = yylhsminor.yy282; break; - case 394: /* star_func_para ::= table_name NK_DOT NK_STAR */ - case 458: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==458); + case 395: /* star_func_para ::= table_name NK_DOT NK_STAR */ + case 459: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==459); { yylhsminor.yy778 = createColumnNode(pCxt, &yymsp[-2].minor.yy181, &yymsp[0].minor.yy0); } yymsp[-2].minor.yy778 = yylhsminor.yy778; break; - case 395: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ + case 396: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ { yylhsminor.yy778 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy282, yymsp[-1].minor.yy778)); } yymsp[-3].minor.yy778 = yylhsminor.yy778; break; - case 396: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ + case 397: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ { yylhsminor.yy778 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy778), yymsp[-2].minor.yy282, yymsp[-1].minor.yy778)); } yymsp[-4].minor.yy778 = yylhsminor.yy778; break; - case 399: /* when_then_expr ::= WHEN common_expression THEN common_expression */ + case 400: /* when_then_expr ::= WHEN common_expression THEN common_expression */ { yymsp[-3].minor.yy778 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy778), releaseRawExprNode(pCxt, yymsp[0].minor.yy778)); } break; - case 401: /* case_when_else_opt ::= ELSE common_expression */ + case 402: /* case_when_else_opt ::= ELSE common_expression */ { yymsp[-1].minor.yy778 = releaseRawExprNode(pCxt, yymsp[0].minor.yy778); } break; - case 402: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ - case 407: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==407); + case 403: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ + case 408: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==408); { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy778); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy778); @@ -4819,7 +4822,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy778 = yylhsminor.yy778; break; - case 403: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ + case 404: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy778); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy778); @@ -4827,7 +4830,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-4].minor.yy778 = yylhsminor.yy778; break; - case 404: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ + case 405: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy778); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy778); @@ -4835,71 +4838,71 @@ static YYACTIONTYPE yy_reduce( } yymsp[-5].minor.yy778 = yylhsminor.yy778; break; - case 405: /* predicate ::= expr_or_subquery IS NULL */ + case 406: /* predicate ::= expr_or_subquery IS NULL */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy778); yylhsminor.yy778 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy778), NULL)); } yymsp[-2].minor.yy778 = yylhsminor.yy778; break; - case 406: /* predicate ::= expr_or_subquery IS NOT NULL */ + case 407: /* predicate ::= expr_or_subquery IS NOT NULL */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy778); yylhsminor.yy778 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy778), NULL)); } yymsp[-3].minor.yy778 = yylhsminor.yy778; break; - case 408: /* compare_op ::= NK_LT */ + case 409: /* compare_op ::= NK_LT */ { yymsp[0].minor.yy682 = OP_TYPE_LOWER_THAN; } break; - case 409: /* compare_op ::= NK_GT */ + case 410: /* compare_op ::= NK_GT */ { yymsp[0].minor.yy682 = OP_TYPE_GREATER_THAN; } break; - case 410: /* compare_op ::= NK_LE */ + case 411: /* compare_op ::= NK_LE */ { yymsp[0].minor.yy682 = OP_TYPE_LOWER_EQUAL; } break; - case 411: /* compare_op ::= NK_GE */ + case 412: /* compare_op ::= NK_GE */ { yymsp[0].minor.yy682 = OP_TYPE_GREATER_EQUAL; } break; - case 412: /* compare_op ::= NK_NE */ + case 413: /* compare_op ::= NK_NE */ { yymsp[0].minor.yy682 = OP_TYPE_NOT_EQUAL; } break; - case 413: /* compare_op ::= NK_EQ */ + case 414: /* compare_op ::= NK_EQ */ { yymsp[0].minor.yy682 = OP_TYPE_EQUAL; } break; - case 414: /* compare_op ::= LIKE */ + case 415: /* compare_op ::= LIKE */ { yymsp[0].minor.yy682 = OP_TYPE_LIKE; } break; - case 415: /* compare_op ::= NOT LIKE */ + case 416: /* compare_op ::= NOT LIKE */ { yymsp[-1].minor.yy682 = OP_TYPE_NOT_LIKE; } break; - case 416: /* compare_op ::= MATCH */ + case 417: /* compare_op ::= MATCH */ { yymsp[0].minor.yy682 = OP_TYPE_MATCH; } break; - case 417: /* compare_op ::= NMATCH */ + case 418: /* compare_op ::= NMATCH */ { yymsp[0].minor.yy682 = OP_TYPE_NMATCH; } break; - case 418: /* compare_op ::= CONTAINS */ + case 419: /* compare_op ::= CONTAINS */ { yymsp[0].minor.yy682 = OP_TYPE_JSON_CONTAINS; } break; - case 419: /* in_op ::= IN */ + case 420: /* in_op ::= IN */ { yymsp[0].minor.yy682 = OP_TYPE_IN; } break; - case 420: /* in_op ::= NOT IN */ + case 421: /* in_op ::= NOT IN */ { yymsp[-1].minor.yy682 = OP_TYPE_NOT_IN; } break; - case 421: /* in_predicate_value ::= NK_LP literal_list NK_RP */ + case 422: /* in_predicate_value ::= NK_LP literal_list NK_RP */ { yylhsminor.yy778 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy282)); } yymsp[-2].minor.yy778 = yylhsminor.yy778; break; - case 423: /* boolean_value_expression ::= NOT boolean_primary */ + case 424: /* boolean_value_expression ::= NOT boolean_primary */ { SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy778); yylhsminor.yy778 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy778), NULL)); } yymsp[-1].minor.yy778 = yylhsminor.yy778; break; - case 424: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + case 425: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy778); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy778); @@ -4907,7 +4910,7 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy778 = yylhsminor.yy778; break; - case 425: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + case 426: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ { SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy778); SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy778); @@ -4915,52 +4918,52 @@ static YYACTIONTYPE yy_reduce( } yymsp[-2].minor.yy778 = yylhsminor.yy778; break; - case 431: /* from_clause_opt ::= FROM table_reference_list */ - case 460: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==460); - case 488: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==488); + case 432: /* from_clause_opt ::= FROM table_reference_list */ + case 461: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==461); + case 489: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==489); { yymsp[-1].minor.yy778 = yymsp[0].minor.yy778; } break; - case 433: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ + case 434: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ { yylhsminor.yy778 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy778, yymsp[0].minor.yy778, NULL); } yymsp[-2].minor.yy778 = yylhsminor.yy778; break; - case 436: /* table_primary ::= table_name alias_opt */ + case 437: /* table_primary ::= table_name alias_opt */ { yylhsminor.yy778 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy181, &yymsp[0].minor.yy181); } yymsp[-1].minor.yy778 = yylhsminor.yy778; break; - case 437: /* table_primary ::= db_name NK_DOT table_name alias_opt */ + case 438: /* table_primary ::= db_name NK_DOT table_name alias_opt */ { yylhsminor.yy778 = createRealTableNode(pCxt, &yymsp[-3].minor.yy181, &yymsp[-1].minor.yy181, &yymsp[0].minor.yy181); } yymsp[-3].minor.yy778 = yylhsminor.yy778; break; - case 438: /* table_primary ::= subquery alias_opt */ + case 439: /* table_primary ::= subquery alias_opt */ { yylhsminor.yy778 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy778), &yymsp[0].minor.yy181); } yymsp[-1].minor.yy778 = yylhsminor.yy778; break; - case 440: /* alias_opt ::= */ + case 441: /* alias_opt ::= */ { yymsp[1].minor.yy181 = nil_token; } break; - case 441: /* alias_opt ::= table_alias */ + case 442: /* alias_opt ::= table_alias */ { yylhsminor.yy181 = yymsp[0].minor.yy181; } yymsp[0].minor.yy181 = yylhsminor.yy181; break; - case 442: /* alias_opt ::= AS table_alias */ + case 443: /* alias_opt ::= AS table_alias */ { yymsp[-1].minor.yy181 = yymsp[0].minor.yy181; } break; - case 443: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - case 444: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==444); + case 444: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + case 445: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==445); { yymsp[-2].minor.yy778 = yymsp[-1].minor.yy778; } break; - case 445: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ + case 446: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ { yylhsminor.yy778 = createJoinTableNode(pCxt, yymsp[-4].minor.yy202, yymsp[-5].minor.yy778, yymsp[-2].minor.yy778, yymsp[0].minor.yy778); } yymsp[-5].minor.yy778 = yylhsminor.yy778; break; - case 446: /* join_type ::= */ + case 447: /* join_type ::= */ { yymsp[1].minor.yy202 = JOIN_TYPE_INNER; } break; - case 447: /* join_type ::= INNER */ + case 448: /* join_type ::= INNER */ { yymsp[0].minor.yy202 = JOIN_TYPE_INNER; } break; - case 448: /* query_specification ::= SELECT set_quantifier_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 */ + case 449: /* query_specification ::= SELECT set_quantifier_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 */ { yymsp[-11].minor.yy778 = createSelectStmt(pCxt, yymsp[-10].minor.yy39, yymsp[-9].minor.yy282, yymsp[-8].minor.yy778); yymsp[-11].minor.yy778 = addWhereClause(pCxt, yymsp[-11].minor.yy778, yymsp[-7].minor.yy778); @@ -4973,73 +4976,73 @@ static YYACTIONTYPE yy_reduce( yymsp[-11].minor.yy778 = addFillClause(pCxt, yymsp[-11].minor.yy778, yymsp[-3].minor.yy778); } break; - case 451: /* set_quantifier_opt ::= ALL */ + case 452: /* set_quantifier_opt ::= ALL */ { yymsp[0].minor.yy39 = false; } break; - case 454: /* select_item ::= NK_STAR */ + case 455: /* select_item ::= NK_STAR */ { yylhsminor.yy778 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } yymsp[0].minor.yy778 = yylhsminor.yy778; break; - case 456: /* select_item ::= common_expression column_alias */ - case 466: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==466); + case 457: /* select_item ::= common_expression column_alias */ + case 467: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==467); { yylhsminor.yy778 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy778), &yymsp[0].minor.yy181); } yymsp[-1].minor.yy778 = yylhsminor.yy778; break; - case 457: /* select_item ::= common_expression AS column_alias */ - case 467: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==467); + case 458: /* select_item ::= common_expression AS column_alias */ + case 468: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==468); { yylhsminor.yy778 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy778), &yymsp[0].minor.yy181); } yymsp[-2].minor.yy778 = yylhsminor.yy778; break; - case 462: /* partition_by_clause_opt ::= PARTITION BY partition_list */ - case 484: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==484); - case 503: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==503); + case 463: /* partition_by_clause_opt ::= PARTITION BY partition_list */ + case 485: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==485); + case 504: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==504); { yymsp[-2].minor.yy282 = yymsp[0].minor.yy282; } break; - case 469: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ + case 470: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ { yymsp[-5].minor.yy778 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy778), releaseRawExprNode(pCxt, yymsp[-1].minor.yy778)); } break; - case 470: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ + case 471: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ { yymsp[-3].minor.yy778 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy778)); } break; - case 471: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ + case 472: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ { yymsp[-5].minor.yy778 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy778), NULL, yymsp[-1].minor.yy778, yymsp[0].minor.yy778); } break; - case 472: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ + case 473: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ { yymsp[-7].minor.yy778 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy778), releaseRawExprNode(pCxt, yymsp[-3].minor.yy778), yymsp[-1].minor.yy778, yymsp[0].minor.yy778); } break; - case 476: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ + case 477: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ { yymsp[-3].minor.yy778 = createFillNode(pCxt, yymsp[-1].minor.yy381, NULL); } break; - case 477: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ + case 478: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ { yymsp[-5].minor.yy778 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy282)); } break; - case 478: /* fill_mode ::= NONE */ + case 479: /* fill_mode ::= NONE */ { yymsp[0].minor.yy381 = FILL_MODE_NONE; } break; - case 479: /* fill_mode ::= PREV */ + case 480: /* fill_mode ::= PREV */ { yymsp[0].minor.yy381 = FILL_MODE_PREV; } break; - case 480: /* fill_mode ::= NULL */ + case 481: /* fill_mode ::= NULL */ { yymsp[0].minor.yy381 = FILL_MODE_NULL; } break; - case 481: /* fill_mode ::= LINEAR */ + case 482: /* fill_mode ::= LINEAR */ { yymsp[0].minor.yy381 = FILL_MODE_LINEAR; } break; - case 482: /* fill_mode ::= NEXT */ + case 483: /* fill_mode ::= NEXT */ { yymsp[0].minor.yy381 = FILL_MODE_NEXT; } break; - case 485: /* group_by_list ::= expr_or_subquery */ + case 486: /* group_by_list ::= expr_or_subquery */ { yylhsminor.yy282 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy778))); } yymsp[0].minor.yy282 = yylhsminor.yy282; break; - case 486: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ + case 487: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ { yylhsminor.yy282 = addNodeToList(pCxt, yymsp[-2].minor.yy282, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy778))); } yymsp[-2].minor.yy282 = yylhsminor.yy282; break; - case 490: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ + case 491: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ { yymsp[-5].minor.yy778 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy778), releaseRawExprNode(pCxt, yymsp[-1].minor.yy778)); } break; - case 493: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ + case 494: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ { yylhsminor.yy778 = addOrderByClause(pCxt, yymsp[-3].minor.yy778, yymsp[-2].minor.yy282); yylhsminor.yy778 = addSlimitClause(pCxt, yylhsminor.yy778, yymsp[-1].minor.yy778); @@ -5047,50 +5050,50 @@ static YYACTIONTYPE yy_reduce( } yymsp[-3].minor.yy778 = yylhsminor.yy778; break; - case 496: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ + case 497: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ { yylhsminor.yy778 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy778, yymsp[0].minor.yy778); } yymsp[-3].minor.yy778 = yylhsminor.yy778; break; - case 497: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ + case 498: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ { yylhsminor.yy778 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy778, yymsp[0].minor.yy778); } yymsp[-2].minor.yy778 = yylhsminor.yy778; break; - case 505: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ - case 509: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==509); + case 506: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ + case 510: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==510); { yymsp[-1].minor.yy778 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } break; - case 506: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - case 510: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==510); + case 507: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + case 511: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==511); { yymsp[-3].minor.yy778 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } break; - case 507: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - case 511: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==511); + case 508: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + case 512: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==512); { yymsp[-3].minor.yy778 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } break; - case 512: /* subquery ::= NK_LP query_expression NK_RP */ + case 513: /* subquery ::= NK_LP query_expression NK_RP */ { yylhsminor.yy778 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy778); } yymsp[-2].minor.yy778 = yylhsminor.yy778; break; - case 517: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ + case 518: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ { yylhsminor.yy778 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy778), yymsp[-1].minor.yy14, yymsp[0].minor.yy305); } yymsp[-2].minor.yy778 = yylhsminor.yy778; break; - case 518: /* ordering_specification_opt ::= */ + case 519: /* ordering_specification_opt ::= */ { yymsp[1].minor.yy14 = ORDER_ASC; } break; - case 519: /* ordering_specification_opt ::= ASC */ + case 520: /* ordering_specification_opt ::= ASC */ { yymsp[0].minor.yy14 = ORDER_ASC; } break; - case 520: /* ordering_specification_opt ::= DESC */ + case 521: /* ordering_specification_opt ::= DESC */ { yymsp[0].minor.yy14 = ORDER_DESC; } break; - case 521: /* null_ordering_opt ::= */ + case 522: /* null_ordering_opt ::= */ { yymsp[1].minor.yy305 = NULL_ORDER_DEFAULT; } break; - case 522: /* null_ordering_opt ::= NULLS FIRST */ + case 523: /* null_ordering_opt ::= NULLS FIRST */ { yymsp[-1].minor.yy305 = NULL_ORDER_FIRST; } break; - case 523: /* null_ordering_opt ::= NULLS LAST */ + case 524: /* null_ordering_opt ::= NULLS LAST */ { yymsp[-1].minor.yy305 = NULL_ORDER_LAST; } break; default: diff --git a/source/libs/parser/test/parShowToUse.cpp b/source/libs/parser/test/parShowToUse.cpp index fe1e14797a..7f6e4adb2f 100644 --- a/source/libs/parser/test/parShowToUse.cpp +++ b/source/libs/parser/test/parShowToUse.cpp @@ -100,6 +100,8 @@ TEST_F(ParserShowToUseTest, showDnodeVariables) { useDb("root", "test"); run("SHOW DNODE 1 VARIABLES"); + + run("SHOW DNODE 1 VARIABLES LIKE '%debug%'"); } TEST_F(ParserShowToUseTest, showFunctions) { diff --git a/source/libs/planner/src/planOptimizer.c b/source/libs/planner/src/planOptimizer.c index 3171bb531b..0b38cdb3ba 100644 --- a/source/libs/planner/src/planOptimizer.c +++ b/source/libs/planner/src/planOptimizer.c @@ -2365,7 +2365,7 @@ static int32_t mergeProjectsOptimize(SOptimizeContext* pCxt, SLogicSubplan* pLog return mergeProjectsOptimizeImpl(pCxt, pLogicSubplan, pProjectNode); } -static bool tagScanMayBeOptimized(SLogicNode* pNode) { +static bool tagScanOptShouldBeOptimized(SLogicNode* pNode) { if (QUERY_NODE_LOGIC_PLAN_SCAN != nodeType(pNode) || (SCAN_TYPE_TAG == ((SScanLogicNode*)pNode)->scanType)) { return false; } @@ -2397,7 +2397,7 @@ static bool tagScanMayBeOptimized(SLogicNode* pNode) { } static int32_t tagScanOptimize(SOptimizeContext* pCxt, SLogicSubplan* pLogicSubplan) { - SScanLogicNode* pScanNode = (SScanLogicNode*)optFindPossibleNode(pLogicSubplan->pNode, tagScanMayBeOptimized); + SScanLogicNode* pScanNode = (SScanLogicNode*)optFindPossibleNode(pLogicSubplan->pNode, tagScanOptShouldBeOptimized); if (NULL == pScanNode) { return TSDB_CODE_SUCCESS; } @@ -2440,6 +2440,29 @@ static int32_t tagScanOptimize(SOptimizeContext* pCxt, SLogicSubplan* pLogicSubp return TSDB_CODE_SUCCESS; } +static bool pushDownLimitOptShouldBeOptimized(SLogicNode* pNode) { + if (NULL == pNode->pLimit || 1 != LIST_LENGTH(pNode->pChildren) || + QUERY_NODE_LOGIC_PLAN_SCAN != nodeType(nodesListGetNode(pNode->pChildren, 0))) { + return false; + } + return true; +} + +static int32_t pushDownLimitOptimize(SOptimizeContext* pCxt, SLogicSubplan* pLogicSubplan) { + SLogicNode* pNode = optFindPossibleNode(pLogicSubplan->pNode, pushDownLimitOptShouldBeOptimized); + if (NULL == pNode) { + return TSDB_CODE_SUCCESS; + } + + SLogicNode* pChild = (SLogicNode*)nodesListGetNode(pNode->pChildren, 0); + nodesDestroyNode(pChild->pLimit); + pChild->pLimit = pNode->pLimit; + pNode->pLimit = NULL; + pCxt->optimized = true; + + return TSDB_CODE_SUCCESS; +} + // clang-format off static const SOptimizeRule optimizeRuleSet[] = { {.pName = "ScanPath", .optimizeFunc = scanPathOptimize}, @@ -2453,7 +2476,8 @@ static const SOptimizeRule optimizeRuleSet[] = { {.pName = "RewriteTail", .optimizeFunc = rewriteTailOptimize}, {.pName = "RewriteUnique", .optimizeFunc = rewriteUniqueOptimize}, {.pName = "LastRowScan", .optimizeFunc = lastRowScanOptimize}, - {.pName = "TagScan", .optimizeFunc = tagScanOptimize} + {.pName = "TagScan", .optimizeFunc = tagScanOptimize}, + // {.pName = "PushDownLimit", .optimizeFunc = pushDownLimitOptimize} }; // clang-format on diff --git a/source/libs/planner/src/planSpliter.c b/source/libs/planner/src/planSpliter.c index a2bbc0af60..62c7eaef55 100644 --- a/source/libs/planner/src/planSpliter.c +++ b/source/libs/planner/src/planSpliter.c @@ -84,6 +84,7 @@ static int32_t splCreateExchangeNode(SSplitContext* pCxt, SLogicNode* pChild, SE if (NULL == pExchange) { return TSDB_CODE_OUT_OF_MEMORY; } + pExchange->srcStartGroupId = pCxt->groupId; pExchange->srcEndGroupId = pCxt->groupId; pExchange->node.precision = pChild->precision; @@ -91,6 +92,13 @@ static int32_t splCreateExchangeNode(SSplitContext* pCxt, SLogicNode* pChild, SE if (NULL == pExchange->node.pTargets) { return TSDB_CODE_OUT_OF_MEMORY; } + if (NULL != pChild->pLimit) { + pExchange->node.pLimit = nodesCloneNode(pChild->pLimit); + if (NULL == pExchange->node.pLimit) { + return TSDB_CODE_OUT_OF_MEMORY; + } + ((SLimitNode*)pChild->pLimit)->offset = 0; + } *pOutput = pExchange; return TSDB_CODE_SUCCESS; @@ -921,6 +929,13 @@ static int32_t stbSplSplitScanNodeWithoutPartTags(SSplitContext* pCxt, SStableSp if (NULL != pInfo->pSplitNode->pParent && QUERY_NODE_LOGIC_PLAN_PROJECT == nodeType(pInfo->pSplitNode->pParent) && NULL == pInfo->pSplitNode->pParent->pLimit && NULL == pInfo->pSplitNode->pParent->pSlimit) { pSplitNode = pInfo->pSplitNode->pParent; + if (NULL != pInfo->pSplitNode->pLimit) { + pSplitNode->pLimit = nodesCloneNode(pInfo->pSplitNode->pLimit); + if (NULL == pSplitNode->pLimit) { + return TSDB_CODE_OUT_OF_MEMORY; + } + ((SLimitNode*)pInfo->pSplitNode->pLimit)->offset = 0; + } } int32_t code = splCreateExchangeNodeForSubplan(pCxt, pInfo->pSubplan, pSplitNode, SUBPLAN_TYPE_MERGE); if (TSDB_CODE_SUCCESS == code) { diff --git a/source/libs/planner/test/planOptimizeTest.cpp b/source/libs/planner/test/planOptimizeTest.cpp index fb4f32a9bf..e75daba6f2 100644 --- a/source/libs/planner/test/planOptimizeTest.cpp +++ b/source/libs/planner/test/planOptimizeTest.cpp @@ -95,9 +95,13 @@ TEST_F(PlanOptimizeTest, eliminateProjection) { useDb("root", "test"); run("SELECT c1, sum(c3) FROM t1 GROUP BY c1"); + run("SELECT c1 FROM t1"); + run("SELECT * FROM st1"); + run("SELECT c1 FROM st1s3"); + // run("select 1-abs(c1) from (select unique(c1) c1 from st1s3) order by 1 nulls first"); } @@ -136,4 +140,14 @@ TEST_F(PlanOptimizeTest, tagScan) { run("select tag1 from st1 group by tag1"); run("select distinct tag1 from st1"); run("select tag1*tag1 from st1 group by tag1*tag1"); -} \ No newline at end of file +} + +TEST_F(PlanOptimizeTest, pushDownLimit) { + useDb("root", "test"); + + run("SELECT c1 FROM t1 LIMIT 1"); + + run("SELECT c1 FROM st1 LIMIT 1"); + + run("SELECT c1 FROM st1 LIMIT 20 OFFSET 10"); +} diff --git a/source/libs/planner/test/planOtherTest.cpp b/source/libs/planner/test/planOtherTest.cpp index a934fb615c..3ed23d6cb2 100644 --- a/source/libs/planner/test/planOtherTest.cpp +++ b/source/libs/planner/test/planOtherTest.cpp @@ -85,6 +85,8 @@ TEST_F(PlanOtherTest, show) { run("SHOW DNODE 1 VARIABLES"); + run("SHOW DNODE 1 VARIABLES LIKE '%debug%'"); + run("SHOW TAGS FROM st1s1"); run("SHOW TABLE TAGS FROM st1"); diff --git a/source/libs/scalar/src/filter.c b/source/libs/scalar/src/filter.c index a04d5a3a3a..e7f3fe7b49 100644 --- a/source/libs/scalar/src/filter.c +++ b/source/libs/scalar/src/filter.c @@ -1082,7 +1082,12 @@ int32_t filterAddUnitImpl(SFilterInfo *info, uint8_t optr, SFilterFieldId *left, if (info->unitNum >= info->unitSize) { uint32_t psize = info->unitSize; info->unitSize += FILTER_DEFAULT_UNIT_SIZE; - info->units = taosMemoryRealloc(info->units, info->unitSize * sizeof(SFilterUnit)); + + void *tmp = taosMemoryRealloc(info->units, info->unitSize * sizeof(SFilterUnit)); + if (tmp == NULL) { + return TSDB_CODE_OUT_OF_MEMORY; + } + info->units = tmp; memset(info->units + psize, 0, sizeof(*info->units) * FILTER_DEFAULT_UNIT_SIZE); } @@ -1135,7 +1140,12 @@ int32_t filterAddUnit(SFilterInfo *info, uint8_t optr, SFilterFieldId *left, SFi int32_t filterAddUnitToGroup(SFilterGroup *group, uint32_t unitIdx) { if (group->unitNum >= group->unitSize) { group->unitSize += FILTER_DEFAULT_UNIT_SIZE; - group->unitIdxs = taosMemoryRealloc(group->unitIdxs, group->unitSize * sizeof(*group->unitIdxs)); + + void *tmp = taosMemoryRealloc(group->unitIdxs, group->unitSize * sizeof(*group->unitIdxs)); + if (tmp == NULL) { + return TSDB_CODE_OUT_OF_MEMORY; + } + group->unitIdxs = tmp; } group->unitIdxs[group->unitNum++] = unitIdx; @@ -3712,7 +3722,7 @@ EDealRes fltReviseRewriter(SNode **pNode, void *pContext) { SListCell *cell = node->pParameterList->pHead; for (int32_t i = 0; i < node->pParameterList->length; ++i) { if (NULL == cell || NULL == cell->pNode) { - fltError("invalid cell, cell:%p, pNode:%p", cell, cell->pNode); + fltError("invalid cell"); stat->code = TSDB_CODE_QRY_INVALID_INPUT; return DEAL_RES_ERROR; } @@ -4066,6 +4076,10 @@ bool filterExecute(SFilterInfo *info, SSDataBlock *pSrc, SColumnInfoData **p, SC *p = output.columnData; output.numOfRows = pSrc->info.rows; + if (*p == NULL) { + return false; + } + bool keep = (*info->func)(info, pSrc->info.rows, *p, statis, numOfCols, &output.numOfQualified); // todo this should be return during filter procedure diff --git a/source/libs/scalar/src/scalar.c b/source/libs/scalar/src/scalar.c index cc1949f17d..7c59c70f30 100644 --- a/source/libs/scalar/src/scalar.c +++ b/source/libs/scalar/src/scalar.c @@ -331,7 +331,10 @@ int32_t sclInitParam(SNode *node, SScalarParam *param, SScalarCtx *ctx, int32_t ASSERT(param->columnData == NULL); param->numOfRows = 1; - /*int32_t code = */ sclCreateColumnInfoData(&valueNode->node.resType, 1, param); + int32_t code = sclCreateColumnInfoData(&valueNode->node.resType, 1, param); + if (code != TSDB_CODE_SUCCESS) { + SCL_RET(TSDB_CODE_OUT_OF_MEMORY); + } if (TSDB_DATA_TYPE_NULL == valueNode->node.resType.type || valueNode->isNull) { colDataAppendNULL(param->columnData, 0); } else { @@ -1485,8 +1488,13 @@ static int32_t sclGetMinusOperatorResType(SOperatorNode *pOp) { } static int32_t sclGetMathOperatorResType(SOperatorNode *pOp) { + if (pOp == NULL || pOp->pLeft == NULL || pOp->pRight == NULL) { + return TSDB_CODE_TSC_INVALID_OPERATION; + } + SDataType ldt = ((SExprNode *)(pOp->pLeft))->resType; SDataType rdt = ((SExprNode *)(pOp->pRight))->resType; + if ((TSDB_DATA_TYPE_TIMESTAMP == ldt.type && TSDB_DATA_TYPE_TIMESTAMP == rdt.type) || (TSDB_DATA_TYPE_TIMESTAMP == ldt.type && (IS_VAR_DATA_TYPE(rdt.type) || IS_FLOAT_TYPE(rdt.type))) || (TSDB_DATA_TYPE_TIMESTAMP == rdt.type && (IS_VAR_DATA_TYPE(ldt.type) || IS_FLOAT_TYPE(ldt.type)))) { @@ -1507,10 +1515,21 @@ static int32_t sclGetMathOperatorResType(SOperatorNode *pOp) { } static int32_t sclGetCompOperatorResType(SOperatorNode *pOp) { + if (pOp == NULL || pOp->pLeft == NULL) { + return TSDB_CODE_TSC_INVALID_OPERATION; + } + SDataType ldt = ((SExprNode *)(pOp->pLeft))->resType; + if (OP_TYPE_IN == pOp->opType || OP_TYPE_NOT_IN == pOp->opType) { + if (pOp->pRight == NULL) { + return TSDB_CODE_TSC_INVALID_OPERATION; + } ((SExprNode *)(pOp->pRight))->resType = ldt; } else if (nodesIsRegularOp(pOp)) { + if (pOp->pRight == NULL) { + return TSDB_CODE_TSC_INVALID_OPERATION; + } SDataType rdt = ((SExprNode *)(pOp->pRight))->resType; if (!IS_VAR_DATA_TYPE(ldt.type) || QUERY_NODE_VALUE != nodeType(pOp->pRight) || (!IS_STR_DATA_TYPE(rdt.type) && (rdt.type != TSDB_DATA_TYPE_NULL))) { @@ -1523,8 +1542,13 @@ static int32_t sclGetCompOperatorResType(SOperatorNode *pOp) { } static int32_t sclGetJsonOperatorResType(SOperatorNode *pOp) { + if (pOp == NULL || pOp->pLeft == NULL || pOp->pRight == NULL) { + return TSDB_CODE_TSC_INVALID_OPERATION; + } + SDataType ldt = ((SExprNode *)(pOp->pLeft))->resType; SDataType rdt = ((SExprNode *)(pOp->pRight))->resType; + if (TSDB_DATA_TYPE_JSON != ldt.type || !IS_STR_DATA_TYPE(rdt.type)) { return TSDB_CODE_TSC_INVALID_OPERATION; } diff --git a/source/libs/scalar/src/sclfunc.c b/source/libs/scalar/src/sclfunc.c index 1d8744d726..7e93c9173c 100644 --- a/source/libs/scalar/src/sclfunc.c +++ b/source/libs/scalar/src/sclfunc.c @@ -1416,7 +1416,7 @@ int32_t timeDiffFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *p } else if (tsDigits == TSDB_TIME_PRECISION_MICRO_DIGITS) { timeVal[k] = timeVal[k] * 1000; } else if (tsDigits == TSDB_TIME_PRECISION_NANO_DIGITS) { - timeVal[k] = timeVal[k]; + timeVal[k] = timeVal[k] * 1; } else { hasNull = true; break; diff --git a/source/libs/scalar/src/sclvector.c b/source/libs/scalar/src/sclvector.c index 6480c53dbf..415ceeb2bd 100644 --- a/source/libs/scalar/src/sclvector.c +++ b/source/libs/scalar/src/sclvector.c @@ -344,8 +344,11 @@ static FORCE_INLINE void varToNchar(char *buf, SScalarParam *pOut, int32_t rowIn int32_t outputMaxLen = (inputLen + 1) * TSDB_NCHAR_SIZE + VARSTR_HEADER_SIZE; char *t = taosMemoryCalloc(1, outputMaxLen); - /*int32_t resLen = */ taosMbsToUcs4(varDataVal(buf), inputLen, (TdUcs4 *)varDataVal(t), - outputMaxLen - VARSTR_HEADER_SIZE, &len); + int32_t ret = taosMbsToUcs4(varDataVal(buf), inputLen, (TdUcs4 *)varDataVal(t), + outputMaxLen - VARSTR_HEADER_SIZE, &len); + if (!ret) { + sclError("failed to convert to NCHAR"); + } varDataSetLen(t, len); colDataAppend(pOut->columnData, rowIndex, t, false); diff --git a/source/libs/stream/src/streamState.c b/source/libs/stream/src/streamState.c index 1c44af49b7..ea429a76b0 100644 --- a/source/libs/stream/src/streamState.c +++ b/source/libs/stream/src/streamState.c @@ -650,10 +650,10 @@ int32_t streamStateSessionGetKey(SStreamState* pState, const SSessionKey* key, S if (code == 0 && sessionKeyCmpr(key, &tmpKey) == 0) { res = 0; resKey = tmpKey; + streamStateCurPrev(pState, pCur); } else { break; } - streamStateCurPrev(pState, pCur); } *curKey = resKey; streamStateFreeCur(pCur); @@ -700,9 +700,14 @@ int32_t streamStateStateAddIfNotExist(SStreamState* pState, SSessionKey* key, ch memcpy(tmp, *pVal, valSize); goto _end; } + + streamStateCurNext(pState, pCur); + } else { + *key = tmpKey; + streamStateFreeCur(pCur); + pCur = streamStateSessionSeekKeyNext(pState, key); } - streamStateCurNext(pState, pCur); code = streamStateSessionGetKVByCur(pCur, key, (const void**)pVal, pVLen); if (code == 0) { void* stateKey = (char*)(*pVal) + (valSize - keyDataLen); diff --git a/source/libs/sync/src/syncAppendEntries.c b/source/libs/sync/src/syncAppendEntries.c index 170a57a7a9..80e0cbbf99 100644 --- a/source/libs/sync/src/syncAppendEntries.c +++ b/source/libs/sync/src/syncAppendEntries.c @@ -383,6 +383,8 @@ int32_t syncNodeOnAppendEntries(SSyncNode* ths, SyncAppendEntries* pMsg) { snprintf(logBuf, sizeof(logBuf), "ignore, truncate error, append-index:%" PRId64, appendIndex); syncLogRecvAppendEntries(ths, pMsg, logBuf); + syncEntryDestory(pLocalEntry); + syncEntryDestory(pAppendEntry); goto _IGNORE; } @@ -393,6 +395,8 @@ int32_t syncNodeOnAppendEntries(SSyncNode* ths, SyncAppendEntries* pMsg) { snprintf(logBuf, sizeof(logBuf), "ignore, append error, append-index:%" PRId64, appendIndex); syncLogRecvAppendEntries(ths, pMsg, logBuf); + syncEntryDestory(pLocalEntry); + syncEntryDestory(pAppendEntry); goto _IGNORE; } } @@ -408,6 +412,8 @@ int32_t syncNodeOnAppendEntries(SSyncNode* ths, SyncAppendEntries* pMsg) { snprintf(logBuf, sizeof(logBuf), "ignore, log not exist, truncate error, append-index:%" PRId64, appendIndex); syncLogRecvAppendEntries(ths, pMsg, logBuf); + syncEntryDestory(pLocalEntry); + syncEntryDestory(pAppendEntry); goto _IGNORE; } @@ -418,6 +424,8 @@ int32_t syncNodeOnAppendEntries(SSyncNode* ths, SyncAppendEntries* pMsg) { snprintf(logBuf, sizeof(logBuf), "ignore, log not exist, append error, append-index:%" PRId64, appendIndex); syncLogRecvAppendEntries(ths, pMsg, logBuf); + syncEntryDestory(pLocalEntry); + syncEntryDestory(pAppendEntry); goto _IGNORE; } @@ -427,33 +435,12 @@ int32_t syncNodeOnAppendEntries(SSyncNode* ths, SyncAppendEntries* pMsg) { snprintf(logBuf, sizeof(logBuf), "ignore, get local entry error, append-index:%" PRId64, appendIndex); syncLogRecvAppendEntries(ths, pMsg, logBuf); + syncEntryDestory(pLocalEntry); + syncEntryDestory(pAppendEntry); goto _IGNORE; } } -#if 0 - if (code != 0 && terrno == TSDB_CODE_WAL_LOG_NOT_EXIST) { - code = ths->pLogStore->syncLogTruncate(ths->pLogStore, appendIndex); - ASSERT(code == 0); - - code = ths->pLogStore->syncLogAppendEntry(ths->pLogStore, pAppendEntry); - ASSERT(code == 0); - - } else { - ASSERT(code == 0); - - if (pLocalEntry->term == pAppendEntry->term) { - // do nothing - } else { - code = ths->pLogStore->syncLogTruncate(ths->pLogStore, appendIndex); - ASSERT(code == 0); - - code = ths->pLogStore->syncLogAppendEntry(ths->pLogStore, pAppendEntry); - ASSERT(code == 0); - } - } -#endif - // update match index pReply->matchIndex = pAppendEntry->index; diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c index fd2a1b22b4..1f24c7c403 100644 --- a/source/libs/sync/src/syncMain.c +++ b/source/libs/sync/src/syncMain.c @@ -336,7 +336,10 @@ char* syncNodePeerState2Str(const SSyncNode* pSyncNode) { for (int32_t i = 0; i < pSyncNode->replicaNum; ++i) { SPeerState* pState = syncNodeGetPeerState((SSyncNode*)pSyncNode, &(pSyncNode->replicasId[i])); - ASSERT(pState != NULL); + if (pState == NULL) { + sError("vgId:%d, replica maybe dropped", pSyncNode->vgId); + break; + } p = pStr + useLen; use = snprintf(p, leftLen, "%d:%" PRId64 " ,%" PRId64, i, pState->lastSendIndex, pState->lastSendTime); @@ -3495,6 +3498,7 @@ SPeerState* syncNodeGetPeerState(SSyncNode* ths, const SRaftId* pDestId) { bool syncNodeNeedSendAppendEntries(SSyncNode* ths, const SRaftId* pDestId, const SyncAppendEntries* pMsg) { SPeerState* pState = syncNodeGetPeerState(ths, pDestId); if (pState == NULL) { + sError("vgId:%d, replica maybe dropped", ths->vgId); return false; } diff --git a/source/libs/sync/src/syncReplication.c b/source/libs/sync/src/syncReplication.c index e040310e15..7296e30e02 100644 --- a/source/libs/sync/src/syncReplication.c +++ b/source/libs/sync/src/syncReplication.c @@ -163,7 +163,10 @@ int32_t syncNodeSendAppendEntries(SSyncNode* pSyncNode, const SRaftId* destRaftI syncNodeSendMsgById(destRaftId, pSyncNode, &rpcMsg); SPeerState* pState = syncNodeGetPeerState(pSyncNode, destRaftId); - ASSERT(pState != NULL); + if (pState == NULL) { + sError("vgId:%d, replica maybe dropped", pSyncNode->vgId); + return 0; + } if (pMsg->dataLen > 0) { pState->lastSendIndex = pMsg->prevLogIndex + 1; diff --git a/source/libs/transport/src/thttp.c b/source/libs/transport/src/thttp.c index a583632765..92989a45f5 100644 --- a/source/libs/transport/src/thttp.c +++ b/source/libs/transport/src/thttp.c @@ -148,14 +148,22 @@ static FORCE_INLINE void clientRecvCb(uv_stream_t* handle, ssize_t nread, const } else { uTrace("http-report succ to recv %d bytes", (int32_t)nread); } - uv_close((uv_handle_t*)&cli->tcp, clientCloseCb); + if (!uv_is_closing((uv_handle_t*)&cli->tcp)) { + uv_close((uv_handle_t*)&cli->tcp, clientCloseCb); + } else { + destroyHttpClient(cli); + } } static void clientSentCb(uv_write_t* req, int32_t status) { SHttpClient* cli = req->data; if (status != 0) { terrno = TAOS_SYSTEM_ERROR(status); uError("http-report failed to send data %s", uv_strerror(status)); - uv_close((uv_handle_t*)&cli->tcp, clientCloseCb); + if (!uv_is_closing((uv_handle_t*)&cli->tcp)) { + uv_close((uv_handle_t*)&cli->tcp, clientCloseCb); + } else { + destroyHttpClient(cli); + } return; } else { uTrace("http-report succ to send data"); @@ -176,7 +184,11 @@ static void clientConnCb(uv_connect_t* req, int32_t status) { if (status != 0) { terrno = TAOS_SYSTEM_ERROR(status); uError("http-report failed to conn to server, reason:%s, dst:%s:%d", uv_strerror(status), cli->addr, cli->port); - uv_close((uv_handle_t*)&cli->tcp, clientCloseCb); + if (!uv_is_closing((uv_handle_t*)&cli->tcp)) { + uv_close((uv_handle_t*)&cli->tcp, clientCloseCb); + } else { + destroyHttpClient(cli); + } return; } status = uv_write(&cli->req, (uv_stream_t*)&cli->tcp, cli->wbuf, 2, clientSentCb); diff --git a/source/os/src/osFile.c b/source/os/src/osFile.c index be862308f1..94a10322ed 100644 --- a/source/os/src/osFile.c +++ b/source/os/src/osFile.c @@ -191,7 +191,7 @@ int32_t taosRenameFile(const char *oldName, const char *newName) { printf("failed to rename file %s to %s, reason:%s\n", oldName, newName, strerror(errno)); } - return !code; + return code ? 0 : -1; #else int32_t code = rename(oldName, newName); if (code < 0) { diff --git a/source/util/src/tcompression.c b/source/util/src/tcompression.c index be220c2585..fbbe970c74 100644 --- a/source/util/src/tcompression.c +++ b/source/util/src/tcompression.c @@ -2274,6 +2274,9 @@ int32_t tsCompressBool(void *pIn, int32_t nIn, int32_t nEle, void *pOut, int32_t return tsCompressBoolImp(pIn, nEle, pOut); } else if (cmprAlg == TWO_STAGE_COMP) { int32_t len = tsCompressBoolImp(pIn, nEle, pBuf); + if (len < 0) { + return -1; + } return tsCompressStringImp(pBuf, len, pOut, nOut); } else { assert(0); diff --git a/source/util/src/tdigest.c b/source/util/src/tdigest.c index 067580708e..dc2a943de9 100644 --- a/source/util/src/tdigest.c +++ b/source/util/src/tdigest.c @@ -263,7 +263,7 @@ double tdigestQuantile(TDigest *t, double q) { b = c; right = (b->weight * a->mean + a->weight * b->mean) / (a->weight + b->weight); if (idx < weight_so_far + a->weight) { - double p = (idx - weight_so_far) / a->weight; + double p = (idx - weight_so_far) / ((a->weight == 0) ? 1 : a->weight); return left * (1 - p) + right * p; } weight_so_far += a->weight; diff --git a/source/util/src/tencode.c b/source/util/src/tencode.c index 2267c90783..7f8a0edfdd 100644 --- a/source/util/src/tencode.c +++ b/source/util/src/tencode.c @@ -109,7 +109,7 @@ void tEndEncode(SEncoder* pCoder) { pCoder->size = pNode->size; pCoder->pos = pNode->pos; - tEncodeI32(pCoder, len); + (void)tEncodeI32(pCoder, len); TD_CODER_MOVE_POS(pCoder, len); } diff --git a/source/util/src/tenv.c b/source/util/src/tenv.c index 027918f2c6..7fe079ada4 100644 --- a/source/util/src/tenv.c +++ b/source/util/src/tenv.c @@ -54,7 +54,7 @@ int32_t taosEnvNameToCfgName(const char *envNameStr, char *cfgNameStr, int32_t c } int32_t taosEnvToCfg(const char *envStr, char *cfgStr) { - if (envStr == NULL && cfgStr == NULL) { + if (envStr == NULL || cfgStr == NULL) { return -1; } if (cfgStr != envStr) strcpy(cfgStr, envStr); diff --git a/source/util/src/thash.c b/source/util/src/thash.c index e7b2d9638f..eb20024ff9 100644 --- a/source/util/src/thash.c +++ b/source/util/src/thash.c @@ -639,7 +639,7 @@ void taosHashTableResize(SHashObj *pHashObj) { } int64_t st = taosGetTimestampUs(); - void *pNewEntryList = taosMemoryRealloc(pHashObj->hashList, sizeof(void *) * newCapacity); + SHashEntry **pNewEntryList = taosMemoryRealloc(pHashObj->hashList, sizeof(SHashEntry *) * newCapacity); if (pNewEntryList == NULL) { // uDebug("cache resize failed due to out of memory, capacity remain:%zu", pHashObj->capacity); return; diff --git a/source/util/src/tlog.c b/source/util/src/tlog.c index 9d97cf7ab2..618b80760f 100644 --- a/source/util/src/tlog.c +++ b/source/util/src/tlog.c @@ -207,7 +207,8 @@ static void taosKeepOldLog(char *oldName) { char fileName[LOG_FILE_NAME_LEN + 20]; snprintf(fileName, LOG_FILE_NAME_LEN + 20, "%s.%" PRId64, tsLogObj.logName, fileSec); - taosRenameFile(oldName, fileName); + (void)taosRenameFile(oldName, fileName); + if (tsLogKeepDays < 0) { char compressFileName[LOG_FILE_NAME_LEN + 20]; snprintf(compressFileName, LOG_FILE_NAME_LEN + 20, "%s.%" PRId64 ".gz", tsLogObj.logName, fileSec); diff --git a/source/util/src/tlrucache.c b/source/util/src/tlrucache.c index 83cfbb2ad1..0ea7258828 100644 --- a/source/util/src/tlrucache.c +++ b/source/util/src/tlrucache.c @@ -337,6 +337,7 @@ static int taosLRUCacheShardInit(SLRUCacheShard *shard, size_t capacity, bool st taosThreadMutexInit(&shard->mutex, NULL); + taosThreadMutexLock(&shard->mutex); shard->capacity = 0; shard->highPriPoolUsage = 0; shard->strictCapacity = strict; @@ -349,6 +350,7 @@ static int taosLRUCacheShardInit(SLRUCacheShard *shard, size_t capacity, bool st shard->lru.next = &shard->lru; shard->lru.prev = &shard->lru; shard->lruLowPri = &shard->lru; + taosThreadMutexUnlock(&shard->mutex); taosLRUCacheShardSetCapacity(shard, capacity); diff --git a/source/util/src/tpagedbuf.c b/source/util/src/tpagedbuf.c index 94d90104aa..c81888eb95 100644 --- a/source/util/src/tpagedbuf.c +++ b/source/util/src/tpagedbuf.c @@ -534,7 +534,9 @@ void destroyDiskbasedBuf(SDiskbasedBuf* pBuf) { } } - taosRemoveFile(pBuf->path); + if (taosRemoveFile(pBuf->path) < 0) { + uDebug("WARNING tPage remove file failed. path=%s", pBuf->path); + } taosMemoryFreeClear(pBuf->path); size_t n = taosArrayGetSize(pBuf->pIdList); diff --git a/tests/docs-examples-test/taosx.sh b/tests/docs-examples-test/taosx.sh deleted file mode 100644 index 5db2605bfd..0000000000 --- a/tests/docs-examples-test/taosx.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -set -e - -taosd >>/dev/null 2>&1 & -taosadapter >>/dev/null 2>&1 & -sleep 5 - -taosBenchmark -y -n 10000 -t 1000 - -taosx run -f 'tmq:///test' -t 'taos:///test1' -y - -taos -s 'select count(*) from test1.meters' |grep 10000000 || (echo database sync failed!; exit 1) - -taosx run -f 'tmq:///test' -t 'local:./test-backup' -y -taosx run -f 'local:./test-backup' -t 'taos:///test2' -y - -rm -rf ./test-backup diff --git a/tests/parallel_test/container_build.sh b/tests/parallel_test/container_build.sh index e88982aa80..deaea4fa40 100755 --- a/tests/parallel_test/container_build.sh +++ b/tests/parallel_test/container_build.sh @@ -52,7 +52,7 @@ fi docker run \ -v $REP_MOUNT_PARAM \ - --rm --ulimit core=-1 taos_test:v1.0 sh -c "cd $REP_DIR;rm -rf debug;mkdir -p debug;cd debug;cmake .. -DBUILD_HTTP=false -DBUILD_TOOLS=true -DWEBSOCKET=true -DBUILD_TAOSX=true;make -j $THREAD_COUNT" + --rm --ulimit core=-1 taos_test:v1.0 sh -c "cd $REP_DIR;rm -rf debug;mkdir -p debug;cd debug;cmake .. -DBUILD_HTTP=false -DBUILD_TOOLS=true -DWEBSOCKET=true;make -j $THREAD_COUNT" ret=$? exit $ret diff --git a/tests/script/tsim/stream/state0.sim b/tests/script/tsim/stream/state0.sim index 60a50f9560..dc7d9bc407 100644 --- a/tests/script/tsim/stream/state0.sim +++ b/tests/script/tsim/stream/state0.sim @@ -449,12 +449,12 @@ if $data26 != 14 then return -1 endi -sql create database test1 vgroups 1 -sql select * from information_schema.ins_databases +sql create database test1 vgroups 1; +sql select * from information_schema.ins_databases; print $data00 $data01 $data02 -sql use test1 +sql use test1; sql create table t1(ts timestamp, a int, b int , c int, d double, id int); sql create stream streams2 trigger at_once into streamt1 as select _wstart, count(*) c1, count(d) c2 , sum(a) c3 , max(a) c4, min(c) c5, max(id) c from t1 state_window(a); @@ -498,7 +498,50 @@ if $data15 != 3 then goto loop5 endi -sql drop database test; -sql drop database test1; +sql create database test3 vgroups 1; +sql use test3; + +sql create table t1(ts timestamp, a int, b int , c int, d double, id int); +sql create stream streams3 trigger at_once into streamt3 as select _wstart, count(*) c1, sum(b) c3 from t1 state_window(a); +sql insert into t1 values(1648791212000,1,2,3,1.0,1); +sql insert into t1 values(1648791213000,2,2,3,1.0,1); +sql insert into t1 values(1648791214000,3,2,4,1.0,2); +sql insert into t1 values(1648791215000,4,2,3,1.0,1); +sql insert into t1 values(1648791211000,5,2,3,1.0,1); +sql insert into t1 values(1648791210000,6,2,4,1.0,2); +sql insert into t1 values(1648791217000,7,2,3,1.0,1); +sql insert into t1 values(1648791219000,8,2,3,1.0,1); +sql insert into t1 values(1648791209000,9,2,4,1.0,2); +sql insert into t1 values(1648791220000,10,2,4,1.0,2); + +sql insert into t1 values(1648791212000,1,2,3,1.0,1); +sql insert into t1 values(1648791213000,2,2,3,1.0,1); +sql insert into t1 values(1648791214000,3,2,4,1.0,2); +sql insert into t1 values(1648791215000,4,2,3,1.0,1); +sql insert into t1 values(1648791211000,5,2,3,1.0,1); +sql insert into t1 values(1648791210000,6,2,4,1.0,2); +sql insert into t1 values(1648791217000,7,2,3,1.0,1); +sql insert into t1 values(1648791219000,8,2,3,1.0,1); +sql insert into t1 values(1648791209000,9,2,4,1.0,2); +sql insert into t1 values(1648791220000,10,2,4,1.0,2); + + +$loop_count = 0 +loop6: + +sleep 300 + +sql select * from streamt3; + +$loop_count = $loop_count + 1 +if $loop_count == 10 then + return -1 +endi + +if $rows != 10 then + print =====rows=$rows + goto loop6 +endi + system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/user/privilege_sysinfo.sim b/tests/script/tsim/user/privilege_sysinfo.sim index 1614c3be55..815d0bd7b2 100644 --- a/tests/script/tsim/user/privilege_sysinfo.sim +++ b/tests/script/tsim/user/privilege_sysinfo.sim @@ -137,10 +137,9 @@ sql_error show create database d2 sql show create table d2.stb2; sql show create table d2.ctb2; sql show create table d2.ntb2; -sql_error show variables; sql show local variables; sql_error show dnode 1 variables; -sql_error show variables; +sql show variables; print =============== check information_schema @@ -167,7 +166,7 @@ sql select * from information_schema.ins_subscriptions sql select * from information_schema.ins_streams sql_error select * from information_schema.ins_grants sql_error select * from information_schema.ins_vgroups -sql_error select * from information_schema.ins_configs +sql select * from information_schema.ins_configs sql_error select * from information_schema.ins_dnode_variables print =============== check performance_schema diff --git a/tests/system-test/1-insert/keep_expired.py b/tests/system-test/1-insert/keep_expired.py new file mode 100644 index 0000000000..09db1e45ba --- /dev/null +++ b/tests/system-test/1-insert/keep_expired.py @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- + +from util.log import * +from util.cases import * +from util.sql import * +import time + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + self.dbname = "test" + self.stbname = "stb" + self.ctbname = "ctb" + self.keep_value = "2d,2d,2d" + self.duration_value = "1d" + self.offset_time = 5 + self.sleep_time = self.offset_time*2 + + def run(self): + tdSql.execute(f'create database if not exists {self.dbname} duration {self.duration_value} keep {self.keep_value};') + tdSql.execute(f'create table {self.dbname}.{self.stbname} (ts timestamp, c11 int) TAGS(t11 int, t12 int );') + tdSql.execute(f'create table {self.dbname}.{self.ctbname} using {self.dbname}.{self.stbname} TAGS (1, 1);') + expired_row_ts = f'now-{int(self.keep_value.split(",")[0].replace("d", "")) * 86400 - self.offset_time}s' + tdSql.execute(f'insert into {self.dbname}.{self.ctbname} values ({expired_row_ts}, 1);') + tdSql.query(f'select * from {self.dbname}.{self.ctbname}') + tdSql.checkEqual(tdSql.queryRows, 1) + time.sleep(self.offset_time * 2) + tdSql.query(f'select * from {self.dbname}.{self.ctbname}') + tdSql.checkEqual(tdSql.queryRows, 0) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/system-test/fulltest.sh b/tests/system-test/fulltest.sh index 92db2700c5..d57f682b40 100644 --- a/tests/system-test/fulltest.sh +++ b/tests/system-test/fulltest.sh @@ -209,6 +209,7 @@ python3 ./test.py -f 2-query/varchar.py -R python3 ./test.py -f 1-insert/update_data.py python3 ./test.py -f 1-insert/delete_data.py +python3 ./test.py -f 1-insert/keep_expired.py python3 ./test.py -f 2-query/join2.py python3 ./test.py -f 2-query/union1.py diff --git a/tools/shell/inc/shellTire.h b/tools/shell/inc/shellTire.h index b262aa68d8..bdcf7bcfb3 100644 --- a/tools/shell/inc/shellTire.h +++ b/tools/shell/inc/shellTire.h @@ -78,7 +78,7 @@ bool insertWord(STire* tire, char* word); bool deleteWord(STire* tire, char* word); // match prefix words, if match is not NULL , put all item to match and return match -SMatch* matchPrefix(STire* tire, char* prefix, SMatch* match); +void matchPrefix(STire* tire, char* prefix, SMatch* match); // get all items from tires tree SMatch* enumAll(STire* tire); diff --git a/tools/shell/src/shellAuto.c b/tools/shell/src/shellAuto.c index e7dfd45c60..534ecf3c4d 100644 --- a/tools/shell/src/shellAuto.c +++ b/tools/shell/src/shellAuto.c @@ -564,6 +564,7 @@ void parseCommand(SWords* command, bool pattern) { // free SShellCmd void freeCommand(SWords* command) { SWord* item = command->head; + command->head = NULL; // loop while (item) { SWord* tmp = item; @@ -815,7 +816,9 @@ char* matchNextPrefix(STire* tire, char* pre) { match = enumAll(tire); } else { // NOT EMPTY - match = matchPrefix(tire, pre, NULL); + match = (SMatch*)taosMemoryMalloc(sizeof(SMatch)); + memset(match, 0, sizeof(SMatch)); + matchPrefix(tire, pre, match); } // save to lastMatch @@ -828,7 +831,7 @@ char* matchNextPrefix(STire* tire, char* pre) { // check valid if (match == NULL || match->head == NULL) { // no one matched - return false; + return NULL; } if (cursorVar == -1) { diff --git a/tools/shell/src/shellTire.c b/tools/shell/src/shellTire.c index 0628570904..0ce0588cce 100644 --- a/tools/shell/src/shellTire.c +++ b/tools/shell/src/shellTire.c @@ -308,25 +308,21 @@ void matchPrefixFromTree(STire* tire, char* prefix, SMatch* match) { } } -SMatch* matchPrefix(STire* tire, char* prefix, SMatch* match) { - SMatch* rMatch = match; // define return match - if (rMatch == NULL) { - rMatch = (SMatch*)taosMemoryMalloc(sizeof(SMatch)); - memset(rMatch, 0, sizeof(SMatch)); +void matchPrefix(STire* tire, char* prefix, SMatch* match) { + if (match == NULL) { + return; } switch (tire->type) { case TIRE_TREE: - matchPrefixFromTree(tire, prefix, rMatch); + matchPrefixFromTree(tire, prefix, match); break; case TIRE_LIST: - matchPrefixFromList(tire, prefix, rMatch); + matchPrefixFromList(tire, prefix, match); break; default: break; } - - return rMatch; } // get all items from tires tree @@ -360,10 +356,11 @@ void enumFromTree(STire* tire, SMatch* match) { } // this branch have data - if (c->end) + if (c->end) { addWordToMatch(match, pre); - else + } else { matchPrefix(tire, pre, match); + } } }